Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(kit): allow configuration of default options for input-count #675

Merged
merged 10 commits into from
Sep 13, 2021

Conversation

KarimovDev
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows Conventional Commits
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Refactoring (no functional changes, no api changes)
  • Other... Please describe:

What is the current behavior?

Partially implements #133

What is the new behavior?

Default input-count options can be set via a provider. This is a partial implementation of #133

Does this PR introduce a breaking change?

  • Yes
  • No

Other information


export interface InputCountOptions {
readonly icons: Readonly<{
up: PolymorpheusContent<TuiContextWithImplicit<TuiSizeL>>;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Buttons are rather tiny, they always have size "s". How about we simplify it by keeping context {} — this way you can just pass it to buttons' icon input, as it is already polymorpheus.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But buttons' height gets smaller when input-count uses "s" size. And this polymorpheus context is taken into account textfield size

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant that you probably cannot fit a big icon anyway, even for a big input size. Template complexity really increases now and I don't want this token option feature to become an overkill.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. I agree about template complexity. I've changed it to {} context

down: PASSWORD_ICON_DOWN,
},
appearance: 'textfield',
hideButtons: false,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now we force hide buttons in tables by comparing appearance to table. That's rather hardcode. @vladimirpotekhin @nsbarsukov what do you think, it probably makes sense to alter this token in Table directive now? With a factory, skipSelf and spread with hideButtons set to true? Sounds like that would be more idiomatic.

Copy link
Contributor Author

@KarimovDev KarimovDev Sep 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case someone can override token by mistake if they use nested components inside the table. Or am I wrong?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, if somebody uses component inside table and for some reason want to change it, they can create a directive that would override it, yes. I don't think that's bad.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. I've already done this as an example. @vladimirpotekhin @nsbarsukov you can check it right here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@waterplea there is also tuiTableMode directive with TUI_TEXTFIELD_APPEARANCE token. Should we add TUI_INPUT_COUNT_OPTIONS here as well? In this case, should we move TUI_INPUT_COUNT_OPTIONS into core package?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that directive was there before we introduced table component. I believe we might end up just dropping it in the next major release.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, @KarimovDev I see this directive is still actually in use on the demo and that fails the screenshots. Let's copy-paste this factory for the time being then.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@KarimovDev KarimovDev force-pushed the feat-input-count-options branch 3 times, most recently from a51859f to 6997d54 Compare September 8, 2021 22:31
@lumberjack-bot
Copy link

lumberjack-bot bot commented Sep 10, 2021

Pull request was closed ✔️

All saved screenshots (for current PR) were deleted 🗑️

@waterplea waterplea merged commit fab225b into taiga-family:main Sep 13, 2021
@well-done-bot
Copy link

well-done-bot bot commented Sep 13, 2021

'Well done'

splincode pushed a commit that referenced this pull request Sep 21, 2021
Co-authored-by: Dima Karimov <d.karimov@aitarget.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants