@scaleflex/ui-tw 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -33
- package/README.md +2 -16
- package/{core/button → button}/button.component.d.ts +2 -3
- package/{core/button → button}/button.component.js +8 -9
- package/{core/button → button}/button.const.d.ts +0 -2
- package/{core/button → button}/button.const.js +2 -2
- package/{core/button → button}/button.types.d.ts +3 -5
- package/{core/button → button}/button.types.js +2 -4
- package/{core/button → button}/button.utils.d.ts +1 -1
- package/{core/button → button}/button.utils.js +1 -1
- package/{core/button → button}/components/end-icon.d.ts +1 -1
- package/{core/button → button}/components/end-icon.js +3 -3
- package/{core/button → button}/components/start-icon.d.ts +2 -2
- package/{core/button → button}/components/start-icon.js +3 -3
- package/button/index.d.ts +3 -0
- package/button/index.js +2 -0
- package/form/components/form-field-group.component.d.ts +19 -0
- package/form/components/form-field-group.component.js +41 -0
- package/form/form.component.d.ts +30 -0
- package/form/form.component.js +123 -0
- package/form/form.types.d.ts +7 -0
- package/{core/switcher/switcher-size.js → form/form.types.js} +1 -1
- package/form/index.d.ts +2 -0
- package/form/index.js +2 -0
- package/input/index.d.ts +3 -0
- package/input/index.js +2 -0
- package/input/input.component.d.ts +7 -0
- package/input/input.component.js +42 -0
- package/input/input.types.d.ts +17 -0
- package/input/input.types.js +10 -0
- package/label/components/info-outline-icon.d.ts +3 -0
- package/label/components/info-outline-icon.js +30 -0
- package/label/components/label-icon.d.ts +7 -0
- package/label/components/label-icon.js +43 -0
- package/label/index.d.ts +1 -0
- package/label/index.js +1 -0
- package/label/label.component.d.ts +4 -0
- package/label/label.component.js +44 -0
- package/label/label.types.d.ts +14 -0
- package/{core/tab/types/size.js → label/label.types.js} +1 -1
- package/label/label.utils.d.ts +2 -0
- package/label/label.utils.js +16 -0
- package/package.json +8 -4
- package/{theme/theme.css → theme.css} +4 -4
- package/tooltip/index.d.ts +1 -0
- package/tooltip/index.js +1 -0
- package/tooltip/tooltip.component.d.ts +10 -0
- package/tooltip/tooltip.component.js +51 -0
- package/tooltip/tooltip.types.d.ts +5 -0
- package/core/accordion/accordion.component.d.ts +0 -3
- package/core/accordion/accordion.component.js +0 -50
- package/core/accordion/accordion.props.d.ts +0 -13
- package/core/accordion/accordion.props.js +0 -1
- package/core/accordion/index.d.ts +0 -2
- package/core/accordion/index.js +0 -1
- package/core/accordion-details/accordion-details.component.d.ts +0 -3
- package/core/accordion-details/accordion-details.component.js +0 -16
- package/core/accordion-details/accordion-details.props.d.ts +0 -4
- package/core/accordion-details/index.d.ts +0 -2
- package/core/accordion-details/index.js +0 -1
- package/core/accordion-header/accordion-header.component.d.ts +0 -3
- package/core/accordion-header/accordion-header.component.js +0 -48
- package/core/accordion-header/accordion-header.props.d.ts +0 -11
- package/core/accordion-header/accordion-header.props.js +0 -1
- package/core/accordion-header/index.d.ts +0 -2
- package/core/accordion-header/index.js +0 -1
- package/core/arrow/arrow.component.d.ts +0 -3
- package/core/arrow/arrow.component.js +0 -22
- package/core/arrow/arrow.props.d.ts +0 -14
- package/core/arrow/arrow.props.js +0 -6
- package/core/arrow/index.d.ts +0 -2
- package/core/arrow/index.js +0 -1
- package/core/arrow-tick/arrow-tick.component.d.ts +0 -3
- package/core/arrow-tick/arrow-tick.component.js +0 -21
- package/core/arrow-tick/arrow-tick.props.d.ts +0 -14
- package/core/arrow-tick/arrow-tick.props.js +0 -6
- package/core/arrow-tick/index.d.ts +0 -2
- package/core/arrow-tick/index.js +0 -1
- package/core/button/index.d.ts +0 -4
- package/core/button/index.js +0 -3
- package/core/check-box/check-box.component.d.ts +0 -0
- package/core/check-box/check-box.component.js +0 -77
- package/core/check-box/check-box.props.d.ts +0 -15
- package/core/check-box/check-box.props.js +0 -1
- package/core/check-box/check-box.utils.d.ts +0 -3
- package/core/check-box/check-box.utils.js +0 -21
- package/core/check-box/index.d.ts +0 -0
- package/core/check-box/index.js +0 -2
- package/core/check-box/types/index.d.ts +0 -2
- package/core/check-box/types/index.js +0 -2
- package/core/check-box/types/size.d.ts +0 -4
- package/core/check-box/types/size.js +0 -4
- package/core/check-box/types/type.d.ts +0 -4
- package/core/check-box/types/type.js +0 -4
- package/core/check-box-group/check-box-group.component.d.ts +0 -0
- package/core/check-box-group/check-box-group.component.js +0 -75
- package/core/check-box-group/check-box-group.props.d.ts +0 -0
- package/core/check-box-group/check-box-group.props.js +0 -23
- package/core/check-box-group/index.d.ts +0 -0
- package/core/check-box-group/index.js +0 -2
- package/core/check-box-group/types/index.d.ts +0 -1
- package/core/check-box-group/types/index.js +0 -1
- package/core/check-box-group/types/label-position.d.ts +0 -4
- package/core/check-box-group/types/label-position.js +0 -4
- package/core/cross-button/cross-button.component.d.ts +0 -3
- package/core/cross-button/cross-button.component.js +0 -37
- package/core/cross-button/cross-button.props.d.ts +0 -8
- package/core/cross-button/cross-button.props.js +0 -1
- package/core/cross-button/index.d.ts +0 -2
- package/core/cross-button/index.js +0 -1
- package/core/cross-button/types/index.d.ts +0 -1
- package/core/cross-button/types/index.js +0 -1
- package/core/cross-button/types/size.d.ts +0 -6
- package/core/cross-button/types/size.js +0 -6
- package/core/dot/dot.component.d.ts +0 -3
- package/core/dot/dot.component.js +0 -15
- package/core/dot/dot.props.d.ts +0 -4
- package/core/dot/dot.props.js +0 -1
- package/core/dot/index.d.ts +0 -2
- package/core/dot/index.js +0 -1
- package/core/dots-navigation/dots-navigation.component.d.ts +0 -3
- package/core/dots-navigation/dots-navigation.component.js +0 -24
- package/core/dots-navigation/dots-navigation.props.d.ts +0 -5
- package/core/dots-navigation/dots-navigation.props.js +0 -1
- package/core/dots-navigation/index.d.ts +0 -2
- package/core/dots-navigation/index.js +0 -1
- package/core/input/components/clear-icon.d.ts +0 -6
- package/core/input/components/clear-icon.js +0 -12
- package/core/input/components/copy-icon.d.ts +0 -6
- package/core/input/components/copy-icon.js +0 -13
- package/core/input/components/password-icon.d.ts +0 -7
- package/core/input/components/password-icon.js +0 -24
- package/core/input/components/render-icon.d.ts +0 -7
- package/core/input/components/render-icon.js +0 -26
- package/core/input/index.d.ts +0 -2
- package/core/input/index.js +0 -1
- package/core/input/input.component.d.ts +0 -3
- package/core/input/input.component.js +0 -233
- package/core/input/input.const.d.ts +0 -6
- package/core/input/input.const.js +0 -6
- package/core/input/input.types.d.ts +0 -56
- package/core/input/input.types.js +0 -16
- package/core/input/input.utils.d.ts +0 -2
- package/core/input/input.utils.js +0 -13
- package/core/modal/index.d.ts +0 -2
- package/core/modal/index.js +0 -1
- package/core/modal/modal-menu-context.d.ts +0 -5
- package/core/modal/modal-menu-context.js +0 -10
- package/core/modal/modal.component.d.ts +0 -3
- package/core/modal/modal.component.js +0 -97
- package/core/modal/modal.props.d.ts +0 -16
- package/core/modal/modal.props.js +0 -1
- package/core/modal/modal.utils.d.ts +0 -1
- package/core/modal/modal.utils.js +0 -4
- package/core/modal/types/index.d.ts +0 -1
- package/core/modal/types/index.js +0 -1
- package/core/modal/types/size.d.ts +0 -7
- package/core/modal/types/size.js +0 -7
- package/core/modal-actions/index.d.ts +0 -2
- package/core/modal-actions/index.js +0 -1
- package/core/modal-actions/modal-actions.component.d.ts +0 -3
- package/core/modal-actions/modal-actions.component.js +0 -18
- package/core/modal-actions/modal-actions.props.d.ts +0 -8
- package/core/modal-actions/modal-actions.props.js +0 -1
- package/core/modal-actions/types/align.d.ts +0 -5
- package/core/modal-actions/types/align.js +0 -5
- package/core/modal-actions/types/index.d.ts +0 -1
- package/core/modal-actions/types/index.js +0 -1
- package/core/modal-content/index.d.ts +0 -2
- package/core/modal-content/index.js +0 -1
- package/core/modal-content/modal-content.component.d.ts +0 -3
- package/core/modal-content/modal-content.component.js +0 -15
- package/core/modal-content/modal-content.props.d.ts +0 -4
- package/core/modal-content/modal-content.props.js +0 -1
- package/core/modal-title/index.d.ts +0 -2
- package/core/modal-title/index.js +0 -1
- package/core/modal-title/modal-title.component.d.ts +0 -6
- package/core/modal-title/modal-title.component.js +0 -37
- package/core/modal-title/modal-title.props.d.ts +0 -14
- package/core/modal-title/modal-title.props.js +0 -1
- package/core/modal-title/types/index.d.ts +0 -1
- package/core/modal-title/types/index.js +0 -1
- package/core/modal-title/types/variant.d.ts +0 -4
- package/core/modal-title/types/variant.js +0 -4
- package/core/pagination/index.d.ts +0 -2
- package/core/pagination/index.js +0 -1
- package/core/pagination/pagination.component.d.ts +0 -3
- package/core/pagination/pagination.component.js +0 -81
- package/core/pagination/pagination.props.d.ts +0 -11
- package/core/pagination/pagination.props.js +0 -1
- package/core/popper/index.d.ts +0 -2
- package/core/popper/index.js +0 -1
- package/core/popper/popper.component.d.ts +0 -3
- package/core/popper/popper.component.js +0 -113
- package/core/popper/popper.props.d.ts +0 -41
- package/core/popper/popper.props.js +0 -1
- package/core/popper/popper.utils.d.ts +0 -1
- package/core/popper/popper.utils.js +0 -10
- package/core/popper/types/index.d.ts +0 -3
- package/core/popper/types/index.js +0 -3
- package/core/popper/types/phases.d.ts +0 -11
- package/core/popper/types/phases.js +0 -11
- package/core/popper/types/position.d.ts +0 -17
- package/core/popper/types/position.js +0 -17
- package/core/popper/types/strategy.d.ts +0 -4
- package/core/popper/types/strategy.js +0 -4
- package/core/radio/index.d.ts +0 -3
- package/core/radio/index.js +0 -2
- package/core/radio/radio.component.d.ts +0 -3
- package/core/radio/radio.component.js +0 -38
- package/core/radio/radio.props.d.ts +0 -13
- package/core/radio/radio.props.js +0 -1
- package/core/radio/size.d.ts +0 -4
- package/core/radio/size.js +0 -4
- package/core/radio-group/index.d.ts +0 -2
- package/core/radio-group/index.js +0 -1
- package/core/radio-group/radio-group.component.d.ts +0 -3
- package/core/radio-group/radio-group.component.js +0 -48
- package/core/radio-group/radio-group.props.d.ts +0 -15
- package/core/radio-group/radio-group.props.js +0 -1
- package/core/switcher/index.d.ts +0 -3
- package/core/switcher/index.js +0 -2
- package/core/switcher/switcher-size.d.ts +0 -5
- package/core/switcher/switcher.component.d.ts +0 -3
- package/core/switcher/switcher.component.js +0 -54
- package/core/switcher/switcher.props.d.ts +0 -14
- package/core/switcher/switcher.props.js +0 -1
- package/core/switcher/switcher.utils.d.ts +0 -4
- package/core/switcher/switcher.utils.js +0 -37
- package/core/switcher-group/index.d.ts +0 -2
- package/core/switcher-group/index.js +0 -1
- package/core/switcher-group/switcher-group.component.d.ts +0 -3
- package/core/switcher-group/switcher-group.component.js +0 -41
- package/core/switcher-group/switcher-group.props.d.ts +0 -13
- package/core/switcher-group/switcher-group.props.js +0 -1
- package/core/tab/index.d.ts +0 -2
- package/core/tab/index.js +0 -1
- package/core/tab/tab.component.d.ts +0 -6
- package/core/tab/tab.component.js +0 -52
- package/core/tab/tab.props.d.ts +0 -15
- package/core/tab/tab.props.js +0 -1
- package/core/tab/types/index.d.ts +0 -1
- package/core/tab/types/index.js +0 -1
- package/core/tab/types/size.d.ts +0 -5
- package/core/tab-panel/index.d.ts +0 -2
- package/core/tab-panel/index.js +0 -1
- package/core/tab-panel/tab-panel.component.d.ts +0 -3
- package/core/tab-panel/tab-panel.component.js +0 -18
- package/core/tab-panel/tab-panel.props.d.ts +0 -6
- package/core/tab-panel/tab-panel.props.js +0 -1
- package/core/upload-input/index.d.ts +0 -2
- package/core/upload-input/index.js +0 -1
- package/core/upload-input/upload-input.component.d.ts +0 -3
- package/core/upload-input/upload-input.component.js +0 -68
- package/core/upload-input/upload-input.props.d.ts +0 -9
- package/core/upload-input/upload-input.props.js +0 -1
- package/hooks/README.md +0 -26
- package/hooks/use-controlled.d.ts +0 -1
- package/hooks/use-controlled.js +0 -20
- package/hooks/use-debounce.d.ts +0 -2
- package/hooks/use-debounce.js +0 -19
- package/hooks/use-drag.d.ts +0 -5
- package/hooks/use-drag.js +0 -37
- package/hooks/use-enhanced-effect.d.ts +0 -3
- package/hooks/use-enhanced-effect.js +0 -3
- package/hooks/use-event-callback.d.ts +0 -4
- package/hooks/use-event-callback.js +0 -19
- package/hooks/use-pagination.d.ts +0 -3
- package/hooks/use-pagination.js +0 -106
- package/hooks/use-portal.d.ts +0 -14
- package/hooks/use-portal.js +0 -75
- package/theme/README.md +0 -9
- package/utils/README.md +0 -11
- package/utils/functions/apply-display-names.d.ts +0 -6
- package/utils/functions/apply-display-names.js +0 -12
- package/utils/functions/apply-polymorphic-function-prop.d.ts +0 -6
- package/utils/functions/apply-polymorphic-function-prop.js +0 -11
- package/utils/functions/color-picker/color-converters.d.ts +0 -11
- package/utils/functions/color-picker/color-converters.js +0 -159
- package/utils/functions/convert-to-string.d.ts +0 -1
- package/utils/functions/convert-to-string.js +0 -3
- package/utils/functions/escape-regexp.d.ts +0 -1
- package/utils/functions/escape-regexp.js +0 -3
- package/utils/functions/generate-class-names.d.ts +0 -1
- package/utils/functions/generate-class-names.js +0 -22
- package/utils/functions/get-elem-document-coords.d.ts +0 -6
- package/utils/functions/get-elem-document-coords.js +0 -21
- package/utils/functions/ignore-event.d.ts +0 -1
- package/utils/functions/ignore-event.js +0 -9
- package/utils/functions/index.d.ts +0 -11
- package/utils/functions/index.js +0 -12
- package/utils/functions/intrinsic-component.d.ts +0 -0
- package/utils/functions/intrinsic-component.js +0 -28
- package/utils/functions/object-keys.d.ts +0 -6
- package/utils/functions/object-keys.js +0 -6
- package/utils/functions/object-values.d.ts +0 -7
- package/utils/functions/object-values.js +0 -6
- package/utils/functions/on-click-by-mouse-down.d.ts +0 -2
- package/utils/functions/on-click-by-mouse-down.js +0 -9
- package/utils/functions/set-ref.d.ts +0 -8
- package/utils/functions/set-ref.js +0 -13
- package/utils/functions/slider/utils.d.ts +0 -47
- package/utils/functions/slider/utils.js +0 -124
- package/utils/functions/use-fork-ref.d.ts +0 -2
- package/utils/functions/use-fork-ref.js +0 -18
- package/utils/types/color/icon-button-color.d.ts +0 -5
- package/utils/types/color/icon-button-color.js +0 -5
- package/utils/types/color/index.d.ts +0 -0
- package/utils/types/color/index.js +0 -2
- package/utils/types/color/input-background-color.d.ts +0 -4
- package/utils/types/color/input-background-color.js +0 -4
- package/utils/types/css/align.d.ts +0 -11
- package/utils/types/css/align.js +0 -11
- package/utils/types/css/breakpoint.d.ts +0 -18
- package/utils/types/css/breakpoint.js +0 -18
- package/utils/types/css/direction.d.ts +0 -8
- package/utils/types/css/direction.js +0 -4
- package/utils/types/css/index.d.ts +0 -4
- package/utils/types/css/index.js +0 -4
- package/utils/types/css/position.d.ts +0 -6
- package/utils/types/css/position.js +0 -6
- package/utils/types/index.d.ts +0 -6
- package/utils/types/index.js +0 -3
- package/utils/types/intrinsic-component.d.ts +0 -1
- package/utils/types/keys.d.ts +0 -4
- package/utils/types/palette/color.d.ts +0 -133
- package/utils/types/palette/color.js +0 -133
- package/utils/types/palette/index.d.ts +0 -1
- package/utils/types/palette/index.js +0 -1
- package/utils/types/position/index.d.ts +0 -1
- package/utils/types/position/index.js +0 -1
- package/utils/types/position/position.d.ts +0 -6
- package/utils/types/position/position.js +0 -6
- package/utils/types/prop-types/index.d.ts +0 -1
- package/utils/types/prop-types/index.js +0 -1
- package/utils/types/prop-types/record.d.ts +0 -1
- package/utils/types/prop-types/record.js +0 -6
- package/utils/types/shadows/index.d.ts +0 -1
- package/utils/types/shadows/index.js +0 -1
- package/utils/types/shadows/shadows.d.ts +0 -14
- package/utils/types/shadows/shadows.js +0 -14
- package/utils/types/shape/border-radius-size.d.ts +0 -5
- package/utils/types/shape/border-radius-size.js +0 -5
- package/utils/types/shape/index.d.ts +0 -1
- package/utils/types/shape/index.js +0 -1
- package/utils/types/stylable-component.d.ts +0 -7
- package/utils/types/typography/font-variant.d.ts +0 -58
- package/utils/types/typography/font-variant.js +0 -58
- package/utils/types/typography/font-weight.d.ts +0 -11
- package/utils/types/typography/font-weight.js +0 -11
- package/utils/types/typography/index.d.ts +0 -4
- package/utils/types/typography/index.js +0 -4
- package/utils/types/typography/text-align.d.ts +0 -5
- package/utils/types/typography/text-align.js +0 -5
- package/utils/types/typography/text-decoration.d.ts +0 -5
- package/utils/types/typography/text-decoration.js +0 -5
- package/utils/types/with.d.ts +0 -4
- /package/{core/accordion-details/accordion-details.props.js → tooltip/tooltip.types.js} +0 -0
- /package/{utils/types → types}/values.d.ts +0 -0
- /package/utils/{functions/shadcn-utils.d.ts → cn.d.ts} +0 -0
- /package/utils/{functions/shadcn-utils.js → cn.js} +0 -0
package/LICENSE
CHANGED
|
@@ -1,33 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 SCALEFLEX SAS
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
|
6
|
-
to use the Software without restriction for personal purposes only. If you intend to use, copy, modify, distribute, sell, or lease any part of our Software for
|
|
7
|
-
commercial or corporate purposes,
|
|
8
|
-
you are required to contact the Scaleflex Sales team (sales@scaleflex.com) to settle the payment of a yearly licensing subscription of five thousand euros.
|
|
9
|
-
If you are proven to be in violation of this condition, you agree to pay a ten thousand euro penalty charge in addition to the yearly licensing subscription.
|
|
10
|
-
|
|
11
|
-
By utilizing the "Software", you acknowledge and unconditionally agree to be bound by these Terms, which are associated with the Scaleflex Services Terms and Conditions,
|
|
12
|
-
which can be found at www.scaleflex.com:
|
|
13
|
-
|
|
14
|
-
The above copyright notice and this permission notice shall be included in all
|
|
15
|
-
copies or substantial portions of the Software.
|
|
16
|
-
|
|
17
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
-
SOFTWARE.
|
|
24
|
-
|
|
25
|
-
---------------------------------------------------------------------------------
|
|
26
|
-
|
|
27
|
-
Publicity
|
|
28
|
-
|
|
29
|
-
You agree that Scaleflex may reference and use Your name, logos and trademarks in
|
|
30
|
-
Scaleflex marketing and promotional materials, including, but not limited to the
|
|
31
|
-
Scaleflex Websites, solely for purposes of identifying You as a customer of Scaleflex.
|
|
32
|
-
Otherwise, neither party may use the trade names, trademarks, service marks, or logos
|
|
33
|
-
of the other party without the express written consent of the other party.
|
|
1
|
+
TBD
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @scaleflex/ui-tw
|
|
2
2
|
|
|
3
|
-
React UI components library by Scaleflex
|
|
3
|
+
React UI components library based on shadcn and tailwind by Scaleflex
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -9,20 +9,6 @@ TODO: Update doc
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
11
11
|
```shell script
|
|
12
|
-
|
|
12
|
+
yarn add @scaleflex/ui-tw
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
```shell script
|
|
16
|
-
yarn add @scaleflex/ui # styled-components react react-dom
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
> Make sure to have `react`, `react-dom` and `styled-components` installed in your package as they are included in our peer dependencies.
|
|
20
|
-
|
|
21
|
-
## Usage
|
|
22
|
-
|
|
23
|
-
Scaleflex UI includes several parts:
|
|
24
|
-
|
|
25
|
-
- [`core`](src/core/README.md)
|
|
26
|
-
- [`hooks`](src/hooks/README.md)
|
|
27
|
-
- [`theme`](src/theme/README.md)
|
|
28
|
-
- [`utils`](src/utils/README.md)
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type ButtonProps } from './button.types';
|
|
3
3
|
declare const buttonVariants: (props?: ({
|
|
4
|
-
variant?: "primary" | "secondary" | "outline" | "link-primary" | "link-secondary" | "link-basic-primary" | "link-basic-secondary" | "link-error" | "link-warning" | "error-primary" | "
|
|
4
|
+
variant?: "primary" | "secondary" | "outline" | "link-primary" | "link-secondary" | "link-basic-primary" | "link-basic-secondary" | "link-error" | "link-warning" | "error-primary" | "warning-primary" | null | undefined;
|
|
5
5
|
size?: "xs" | "sm" | "md" | "lg" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
7
7
|
declare function Button({ className, children, size, startIcon, endIcon, variant, loading, asChild, disabled, ...rest }: ButtonProps): React.JSX.Element;
|
|
8
|
-
export { buttonVariants };
|
|
9
|
-
export default Button;
|
|
8
|
+
export { Button, buttonVariants };
|
|
@@ -5,16 +5,16 @@ var _excluded = ["className", "children", "size", "startIcon", "endIcon", "varia
|
|
|
5
5
|
var _buttonVariantOptions;
|
|
6
6
|
import { Slot } from '@radix-ui/react-slot';
|
|
7
7
|
import SpinnerIcon from '@scaleflex/icons-tw/spinner';
|
|
8
|
-
import EndIcon from '@scaleflex/ui-tw/
|
|
9
|
-
import StartIcon, { startIconVariants } from '@scaleflex/ui-tw/
|
|
10
|
-
import { cn } from '@scaleflex/ui-tw/utils/
|
|
8
|
+
import EndIcon from '@scaleflex/ui-tw/button/components/end-icon';
|
|
9
|
+
import StartIcon, { startIconVariants } from '@scaleflex/ui-tw/button/components/start-icon';
|
|
10
|
+
import { cn } from '@scaleflex/ui-tw/utils/cn';
|
|
11
11
|
import { cva } from 'class-variance-authority';
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import { ButtonSize, ButtonVariant } from './button.types';
|
|
14
14
|
import { getIconSizeInRem } from './button.utils';
|
|
15
|
-
var buttonVariantOptions = (_buttonVariantOptions = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_buttonVariantOptions, ButtonVariant.Primary, 'bg-primary text-primary-foreground shadow-xs hover:bg-primary/80'), ButtonVariant.Secondary, 'border bg-background shadow-xs text-primary border-primary hover:bg-
|
|
16
|
-
var buttonSizeOptions = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ButtonSize.Xs, 'h-6 px-2.5 py-1.5 text-
|
|
17
|
-
var buttonVariants = cva(
|
|
15
|
+
var buttonVariantOptions = (_buttonVariantOptions = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_buttonVariantOptions, ButtonVariant.Primary, 'bg-primary text-primary-foreground shadow-xs hover:bg-primary/80'), ButtonVariant.Secondary, 'border bg-background shadow-xs text-primary border-primary hover:bg-accent hover:border-primary/80'), ButtonVariant.Outline, 'border bg-background text-secondary-foreground shadow-xs border-input hover:bg-secondary hover:border-input/80'), ButtonVariant.LinkPrimary, 'text-primary hover:text-primary/80'), ButtonVariant.LinkSecondary, 'text-secondary-foreground hover:text-secondary-foreground/80'), ButtonVariant.LinkBasicPrimary, 'text-primary font-normal hover:text-primary/80'), ButtonVariant.LinkBasicSecondary, 'text-secondary-foreground font-normal hover:text-secondary-foreground/80'), ButtonVariant.LinkError, 'text-destructive hover:text-destructive/80'), ButtonVariant.LinkWarning, 'text-warning hover:text-warning/80'), ButtonVariant.Error, 'bg-destructive text-primary-foreground shadow-xs hover:bg-destructive/80'), _defineProperty(_buttonVariantOptions, ButtonVariant.Warning, 'bg-warning text-primary-foreground shadow-xs hover:bg-warning/80'));
|
|
16
|
+
var buttonSizeOptions = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ButtonSize.Xs, 'h-6 px-2.5 py-1.5 text-xs'), ButtonSize.Sm, 'h-8 px-3 py-2 text-sm'), ButtonSize.Md, 'h-10 px-4 py-2.5 text-base'), ButtonSize.Lg, 'h-12 px-6 py-3.5 text-lg');
|
|
17
|
+
var buttonVariants = cva('', {
|
|
18
18
|
variants: {
|
|
19
19
|
variant: buttonVariantOptions,
|
|
20
20
|
size: buttonSizeOptions
|
|
@@ -43,7 +43,7 @@ function Button(_ref) {
|
|
|
43
43
|
var Comp = asChild ? Slot : 'button';
|
|
44
44
|
return /*#__PURE__*/React.createElement(Comp, _extends({
|
|
45
45
|
"data-slot": "button",
|
|
46
|
-
className: cn(buttonVariants({
|
|
46
|
+
className: cn('group/button inline-flex shrink-0 cursor-pointer items-center justify-center rounded-md font-medium whitespace-nowrap transition-all outline-none', 'ring-offset-background focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-40', "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", buttonVariants({
|
|
47
47
|
variant: variant,
|
|
48
48
|
size: size,
|
|
49
49
|
className: className
|
|
@@ -69,5 +69,4 @@ function Button(_ref) {
|
|
|
69
69
|
icon: endIcon
|
|
70
70
|
})) : children);
|
|
71
71
|
}
|
|
72
|
-
export { buttonVariants };
|
|
73
|
-
export default Button;
|
|
72
|
+
export { Button, buttonVariants };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
var _iconVariantOptions;
|
|
3
|
-
import { ButtonVariant } from '@scaleflex/ui-tw/
|
|
4
|
-
export var iconVariantOptions = (_iconVariantOptions = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_iconVariantOptions, ButtonVariant.Primary, ''), ButtonVariant.Secondary, ''), ButtonVariant.Outline, 'text-muted-foreground group-hover/button:text-muted-foreground/80'), ButtonVariant.LinkPrimary, ''), ButtonVariant.LinkSecondary, 'text-muted-foreground group-hover/button:text-muted-foreground/80'), ButtonVariant.LinkBasicPrimary, ''), ButtonVariant.LinkBasicSecondary, 'text-muted-foreground group-hover/button:text-muted-foreground/80'), ButtonVariant.LinkError, ''), ButtonVariant.LinkWarning, ''), ButtonVariant.
|
|
3
|
+
import { ButtonVariant } from '@scaleflex/ui-tw/button/button.types';
|
|
4
|
+
export var iconVariantOptions = (_iconVariantOptions = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_iconVariantOptions, ButtonVariant.Primary, ''), ButtonVariant.Secondary, ''), ButtonVariant.Outline, 'text-muted-foreground group-hover/button:text-muted-foreground/80'), ButtonVariant.LinkPrimary, ''), ButtonVariant.LinkSecondary, 'text-muted-foreground group-hover/button:text-muted-foreground/80'), ButtonVariant.LinkBasicPrimary, ''), ButtonVariant.LinkBasicSecondary, 'text-muted-foreground group-hover/button:text-muted-foreground/80'), ButtonVariant.LinkError, ''), ButtonVariant.LinkWarning, ''), ButtonVariant.Error, ''), _defineProperty(_iconVariantOptions, ButtonVariant.Warning, ''));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { buttonVariants } from '@scaleflex/ui-tw/
|
|
1
|
+
import { buttonVariants } from '@scaleflex/ui-tw/button/button.component';
|
|
2
2
|
import type { VariantProps } from 'class-variance-authority';
|
|
3
3
|
import { ComponentProps, ReactElement } from 'react';
|
|
4
4
|
export declare const ButtonVariant: {
|
|
@@ -11,10 +11,8 @@ export declare const ButtonVariant: {
|
|
|
11
11
|
readonly LinkBasicSecondary: "link-basic-secondary";
|
|
12
12
|
readonly LinkError: "link-error";
|
|
13
13
|
readonly LinkWarning: "link-warning";
|
|
14
|
-
readonly
|
|
15
|
-
readonly
|
|
16
|
-
readonly WarningPrimary: "warning-primary";
|
|
17
|
-
readonly WarningOutline: "warning-outline";
|
|
14
|
+
readonly Error: "error-primary";
|
|
15
|
+
readonly Warning: "warning-primary";
|
|
18
16
|
};
|
|
19
17
|
export interface ButtonProps extends ComponentProps<'button'>, VariantProps<typeof buttonVariants> {
|
|
20
18
|
asChild?: boolean;
|
|
@@ -8,10 +8,8 @@ export var ButtonVariant = {
|
|
|
8
8
|
LinkBasicSecondary: 'link-basic-secondary',
|
|
9
9
|
LinkError: 'link-error',
|
|
10
10
|
LinkWarning: 'link-warning',
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
WarningPrimary: 'warning-primary',
|
|
14
|
-
WarningOutline: 'warning-outline'
|
|
11
|
+
Error: 'error-primary',
|
|
12
|
+
Warning: 'warning-primary'
|
|
15
13
|
};
|
|
16
14
|
export var ButtonSize = {
|
|
17
15
|
Xs: 'xs',
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ButtonSizeType } from '@scaleflex/ui-tw/
|
|
1
|
+
import { ButtonSizeType } from '@scaleflex/ui-tw/button/button.types';
|
|
2
2
|
export declare const getIconSizeInRem: (sizeName?: ButtonSizeType | null) => string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ButtonProps } from '@scaleflex/ui-tw/
|
|
1
|
+
import { type ButtonProps } from '@scaleflex/ui-tw/button';
|
|
2
2
|
import React, { ComponentProps, ReactElement } from 'react';
|
|
3
3
|
interface EndIconProps extends ComponentProps<'span'>, Pick<ButtonProps, 'size' | 'variant'> {
|
|
4
4
|
icon?: ReactElement;
|
|
@@ -2,9 +2,9 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
var _excluded = ["size", "icon", "variant"];
|
|
5
|
-
import { ButtonSize } from '@scaleflex/ui-tw/
|
|
6
|
-
import { iconVariantOptions } from '@scaleflex/ui-tw/
|
|
7
|
-
import { getIconSizeInRem } from '@scaleflex/ui-tw/
|
|
5
|
+
import { ButtonSize } from '@scaleflex/ui-tw/button';
|
|
6
|
+
import { iconVariantOptions } from '@scaleflex/ui-tw/button/button.const';
|
|
7
|
+
import { getIconSizeInRem } from '@scaleflex/ui-tw/button/button.utils';
|
|
8
8
|
import { cva } from 'class-variance-authority';
|
|
9
9
|
import React, { cloneElement, useMemo } from 'react';
|
|
10
10
|
var endIconSizes = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ButtonSize.Xs, 'ml-1.5'), ButtonSize.Sm, 'ml-1.5'), ButtonSize.Md, 'ml-2'), ButtonSize.Lg, 'ml-2');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type ButtonProps } from '@scaleflex/ui-tw/
|
|
1
|
+
import { type ButtonProps } from '@scaleflex/ui-tw/button';
|
|
2
2
|
import React, { ComponentProps, ReactElement } from 'react';
|
|
3
3
|
declare const startIconVariants: (props?: ({
|
|
4
|
-
variant?: "primary" | "secondary" | "outline" | "link-primary" | "link-secondary" | "link-basic-primary" | "link-basic-secondary" | "link-error" | "link-warning" | "error-primary" | "
|
|
4
|
+
variant?: "primary" | "secondary" | "outline" | "link-primary" | "link-secondary" | "link-basic-primary" | "link-basic-secondary" | "link-error" | "link-warning" | "error-primary" | "warning-primary" | null | undefined;
|
|
5
5
|
size?: "xs" | "sm" | "md" | "lg" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
7
7
|
interface StartIconProps extends ComponentProps<'span'>, Pick<ButtonProps, 'size' | 'variant'> {
|
|
@@ -3,9 +3,9 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
var _excluded = ["size", "variant", "icon", "loading"];
|
|
5
5
|
import SpinnerIcon from '@scaleflex/icons-tw/spinner';
|
|
6
|
-
import { ButtonSize } from '@scaleflex/ui-tw/
|
|
7
|
-
import { iconVariantOptions } from '@scaleflex/ui-tw/
|
|
8
|
-
import { getIconSizeInRem } from '@scaleflex/ui-tw/
|
|
6
|
+
import { ButtonSize } from '@scaleflex/ui-tw/button';
|
|
7
|
+
import { iconVariantOptions } from '@scaleflex/ui-tw/button/button.const';
|
|
8
|
+
import { getIconSizeInRem } from '@scaleflex/ui-tw/button/button.utils';
|
|
9
9
|
import { cva } from 'class-variance-authority';
|
|
10
10
|
import React, { cloneElement, useMemo } from 'react';
|
|
11
11
|
var startIconSizes = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ButtonSize.Xs, 'mr-1.5'), ButtonSize.Sm, 'mr-1.5'), ButtonSize.Md, 'mr-2'), ButtonSize.Lg, 'mr-2');
|
package/button/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { InputSizeType } from '@scaleflex/ui-tw/input/input.types';
|
|
2
|
+
import React, { ReactNode } from 'react';
|
|
3
|
+
import { ControllerRenderProps, FieldValues, Path, UseControllerProps } from 'react-hook-form';
|
|
4
|
+
export interface FormFieldArgs {
|
|
5
|
+
size?: InputSizeType;
|
|
6
|
+
readOnly?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface FormFieldGroupProps<TFieldValues extends FieldValues, TName extends Path<TFieldValues>> extends UseControllerProps<TFieldValues, TName> {
|
|
10
|
+
label?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
tooltip?: string;
|
|
13
|
+
size?: InputSizeType;
|
|
14
|
+
readOnly?: boolean;
|
|
15
|
+
highlight?: boolean;
|
|
16
|
+
children: (field: ControllerRenderProps<TFieldValues, TName>, args?: FormFieldArgs) => ReactNode;
|
|
17
|
+
}
|
|
18
|
+
declare function FormFieldGroup<TFieldValues extends FieldValues, TName extends Path<TFieldValues>>({ control, name, label, description, size, readOnly, disabled, tooltip, highlight, children, }: FormFieldGroupProps<TFieldValues, TName>): React.JSX.Element;
|
|
19
|
+
export { FormFieldGroup };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from '@scaleflex/ui-tw/form';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
function FormFieldGroup(_ref) {
|
|
4
|
+
var control = _ref.control,
|
|
5
|
+
name = _ref.name,
|
|
6
|
+
label = _ref.label,
|
|
7
|
+
description = _ref.description,
|
|
8
|
+
_ref$size = _ref.size,
|
|
9
|
+
size = _ref$size === void 0 ? 'md' : _ref$size,
|
|
10
|
+
_ref$readOnly = _ref.readOnly,
|
|
11
|
+
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
|
|
12
|
+
_ref$disabled = _ref.disabled,
|
|
13
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
14
|
+
tooltip = _ref.tooltip,
|
|
15
|
+
highlight = _ref.highlight,
|
|
16
|
+
children = _ref.children;
|
|
17
|
+
return /*#__PURE__*/React.createElement(FormField, {
|
|
18
|
+
control: control,
|
|
19
|
+
name: name,
|
|
20
|
+
render: function render(_ref2) {
|
|
21
|
+
var field = _ref2.field;
|
|
22
|
+
return /*#__PURE__*/React.createElement(FormItem, {
|
|
23
|
+
className: "group",
|
|
24
|
+
"data-disabled": disabled,
|
|
25
|
+
"data-highlight": highlight
|
|
26
|
+
}, label && /*#__PURE__*/React.createElement(FormLabel, {
|
|
27
|
+
size: size,
|
|
28
|
+
tooltip: tooltip
|
|
29
|
+
}, label), /*#__PURE__*/React.createElement(FormControl, null, children(field, {
|
|
30
|
+
size: size,
|
|
31
|
+
readOnly: readOnly,
|
|
32
|
+
disabled: disabled
|
|
33
|
+
})), description && /*#__PURE__*/React.createElement(FormDescription, {
|
|
34
|
+
size: size
|
|
35
|
+
}, description), /*#__PURE__*/React.createElement(FormMessage, {
|
|
36
|
+
size: size
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
export { FormFieldGroup };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
2
|
+
import { FormMessageSizeType } from '@scaleflex/ui-tw/form/form.types';
|
|
3
|
+
import { LabelProps } from '@scaleflex/ui-tw/label/label.types';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ComponentProps } from 'react';
|
|
6
|
+
import { type ControllerProps, type FieldPath, type FieldValues } from 'react-hook-form';
|
|
7
|
+
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>(props: import("react-hook-form").FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
|
|
8
|
+
declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => React.JSX.Element;
|
|
9
|
+
declare const useFormField: () => {
|
|
10
|
+
invalid: boolean;
|
|
11
|
+
isDirty: boolean;
|
|
12
|
+
isTouched: boolean;
|
|
13
|
+
isValidating: boolean;
|
|
14
|
+
error?: import("react-hook-form").FieldError;
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
formItemId: string;
|
|
18
|
+
formDescriptionId: string;
|
|
19
|
+
formMessageId: string;
|
|
20
|
+
};
|
|
21
|
+
declare function FormItem({ className, ...props }: ComponentProps<'div'>): React.JSX.Element;
|
|
22
|
+
declare function FormLabel({ className, ...props }: LabelProps): React.JSX.Element;
|
|
23
|
+
declare function FormControl({ ...props }: ComponentProps<typeof Slot>): React.JSX.Element;
|
|
24
|
+
declare function FormDescription({ className, size, ...props }: ComponentProps<'p'> & {
|
|
25
|
+
size?: FormMessageSizeType;
|
|
26
|
+
}): React.JSX.Element;
|
|
27
|
+
declare function FormMessage({ className, size, ...props }: ComponentProps<'p'> & {
|
|
28
|
+
size?: FormMessageSizeType;
|
|
29
|
+
}): React.JSX.Element | null;
|
|
30
|
+
export { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField };
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import _objectDestructuringEmpty from "@babel/runtime/helpers/objectDestructuringEmpty";
|
|
4
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
5
|
+
var _excluded = ["className"],
|
|
6
|
+
_excluded2 = ["className"],
|
|
7
|
+
_excluded3 = ["className", "size"],
|
|
8
|
+
_excluded4 = ["className", "size"];
|
|
9
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
12
|
+
import { FormMessageSize } from '@scaleflex/ui-tw/form/form.types';
|
|
13
|
+
import { Label } from '@scaleflex/ui-tw/label';
|
|
14
|
+
import { cn } from '@scaleflex/ui-tw/utils/cn';
|
|
15
|
+
import * as React from 'react';
|
|
16
|
+
import { createContext, useContext, useId } from 'react';
|
|
17
|
+
import { Controller, FormProvider, useFormContext, useFormState } from 'react-hook-form';
|
|
18
|
+
var Form = FormProvider;
|
|
19
|
+
var FormFieldContext = /*#__PURE__*/createContext({});
|
|
20
|
+
var FormField = function FormField(_ref) {
|
|
21
|
+
var props = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
22
|
+
return /*#__PURE__*/React.createElement(FormFieldContext.Provider, {
|
|
23
|
+
value: {
|
|
24
|
+
name: props.name
|
|
25
|
+
}
|
|
26
|
+
}, /*#__PURE__*/React.createElement(Controller, props));
|
|
27
|
+
};
|
|
28
|
+
var useFormField = function useFormField() {
|
|
29
|
+
var fieldContext = useContext(FormFieldContext);
|
|
30
|
+
var itemContext = useContext(FormItemContext);
|
|
31
|
+
var _useFormContext = useFormContext(),
|
|
32
|
+
getFieldState = _useFormContext.getFieldState;
|
|
33
|
+
var formState = useFormState({
|
|
34
|
+
name: fieldContext.name
|
|
35
|
+
});
|
|
36
|
+
var fieldState = getFieldState(fieldContext.name, formState);
|
|
37
|
+
if (!fieldContext) {
|
|
38
|
+
throw new Error('useFormField should be used within <FormField>');
|
|
39
|
+
}
|
|
40
|
+
var id = itemContext.id;
|
|
41
|
+
return _objectSpread({
|
|
42
|
+
id: id,
|
|
43
|
+
name: fieldContext.name,
|
|
44
|
+
formItemId: "".concat(id, "-form-item"),
|
|
45
|
+
formDescriptionId: "".concat(id, "-form-item-description"),
|
|
46
|
+
formMessageId: "".concat(id, "-form-item-message")
|
|
47
|
+
}, fieldState);
|
|
48
|
+
};
|
|
49
|
+
var FormItemContext = /*#__PURE__*/createContext({});
|
|
50
|
+
function FormItem(_ref2) {
|
|
51
|
+
var className = _ref2.className,
|
|
52
|
+
props = _objectWithoutProperties(_ref2, _excluded);
|
|
53
|
+
var id = useId();
|
|
54
|
+
return /*#__PURE__*/React.createElement(FormItemContext.Provider, {
|
|
55
|
+
value: {
|
|
56
|
+
id: id
|
|
57
|
+
}
|
|
58
|
+
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
59
|
+
"data-slot": "form-item",
|
|
60
|
+
className: cn('grid gap-1.5', className)
|
|
61
|
+
}, props)));
|
|
62
|
+
}
|
|
63
|
+
function FormLabel(_ref3) {
|
|
64
|
+
var className = _ref3.className,
|
|
65
|
+
props = _objectWithoutProperties(_ref3, _excluded2);
|
|
66
|
+
var _useFormField = useFormField(),
|
|
67
|
+
error = _useFormField.error,
|
|
68
|
+
formItemId = _useFormField.formItemId;
|
|
69
|
+
return /*#__PURE__*/React.createElement(Label, _extends({
|
|
70
|
+
"data-slot": "form-label",
|
|
71
|
+
"data-error": !!error,
|
|
72
|
+
className: cn('data-[error=true]:text-destructive', className),
|
|
73
|
+
htmlFor: formItemId
|
|
74
|
+
}, props));
|
|
75
|
+
}
|
|
76
|
+
function FormControl(_ref4) {
|
|
77
|
+
var props = _extends({}, (_objectDestructuringEmpty(_ref4), _ref4));
|
|
78
|
+
var _useFormField2 = useFormField(),
|
|
79
|
+
error = _useFormField2.error,
|
|
80
|
+
formItemId = _useFormField2.formItemId,
|
|
81
|
+
formDescriptionId = _useFormField2.formDescriptionId,
|
|
82
|
+
formMessageId = _useFormField2.formMessageId;
|
|
83
|
+
return /*#__PURE__*/React.createElement(Slot, _extends({
|
|
84
|
+
"data-slot": "form-control",
|
|
85
|
+
id: formItemId,
|
|
86
|
+
"aria-describedby": !error ? "".concat(formDescriptionId) : "".concat(formDescriptionId, " ").concat(formMessageId),
|
|
87
|
+
"aria-invalid": !!error
|
|
88
|
+
}, props));
|
|
89
|
+
}
|
|
90
|
+
var formMessageSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, FormMessageSize.Sm, 'text-xs'), FormMessageSize.Md, 'text-xs'), FormMessageSize.Lg, 'text-sm');
|
|
91
|
+
function FormDescription(_ref5) {
|
|
92
|
+
var className = _ref5.className,
|
|
93
|
+
_ref5$size = _ref5.size,
|
|
94
|
+
size = _ref5$size === void 0 ? FormMessageSize.Md : _ref5$size,
|
|
95
|
+
props = _objectWithoutProperties(_ref5, _excluded3);
|
|
96
|
+
var _useFormField3 = useFormField(),
|
|
97
|
+
formDescriptionId = _useFormField3.formDescriptionId;
|
|
98
|
+
return /*#__PURE__*/React.createElement("p", _extends({
|
|
99
|
+
"data-slot": "form-description",
|
|
100
|
+
id: formDescriptionId,
|
|
101
|
+
className: cn('text-muted-foreground', 'group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50', 'group-data-[highlight=true]:text-warning', formMessageSizeOptions[size], className)
|
|
102
|
+
}, props));
|
|
103
|
+
}
|
|
104
|
+
function FormMessage(_ref6) {
|
|
105
|
+
var _error$message;
|
|
106
|
+
var className = _ref6.className,
|
|
107
|
+
_ref6$size = _ref6.size,
|
|
108
|
+
size = _ref6$size === void 0 ? FormMessageSize.Md : _ref6$size,
|
|
109
|
+
props = _objectWithoutProperties(_ref6, _excluded4);
|
|
110
|
+
var _useFormField4 = useFormField(),
|
|
111
|
+
error = _useFormField4.error,
|
|
112
|
+
formMessageId = _useFormField4.formMessageId;
|
|
113
|
+
var body = error ? String((_error$message = error === null || error === void 0 ? void 0 : error.message) !== null && _error$message !== void 0 ? _error$message : '') : props.children;
|
|
114
|
+
if (!body) {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
return /*#__PURE__*/React.createElement("p", _extends({
|
|
118
|
+
"data-slot": "form-message",
|
|
119
|
+
id: formMessageId,
|
|
120
|
+
className: cn('text-destructive', 'group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50', formMessageSizeOptions[size], className)
|
|
121
|
+
}, props), body);
|
|
122
|
+
}
|
|
123
|
+
export { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField };
|
package/form/index.d.ts
ADDED
package/form/index.js
ADDED
package/input/index.d.ts
ADDED
package/input/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { InputProps } from './input.types';
|
|
3
|
+
declare const inputVariants: (props?: ({
|
|
4
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
6
|
+
declare function Input({ className, type, size, disabled, readOnly, ...props }: InputProps): React.JSX.Element;
|
|
7
|
+
export { Input, inputVariants };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
+
var _excluded = ["className", "type", "size", "disabled", "readOnly"];
|
|
5
|
+
import { ButtonSize } from '@scaleflex/ui-tw/button';
|
|
6
|
+
import { cn } from '@scaleflex/ui-tw/utils/cn';
|
|
7
|
+
import { cva } from 'class-variance-authority';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { InputType } from './input.types';
|
|
10
|
+
import { InputSize } from './input.types';
|
|
11
|
+
var inputSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, InputSize.Sm, 'py-2 px-3 text-sm h-8'), InputSize.Md, 'py-3 px-4 h-10 text-base '), InputSize.Lg, 'py-3 px-4 h-12 text-lg ');
|
|
12
|
+
var inputVariants = cva('', {
|
|
13
|
+
variants: {
|
|
14
|
+
size: inputSizeOptions
|
|
15
|
+
},
|
|
16
|
+
defaultVariants: {
|
|
17
|
+
size: ButtonSize.Md
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
function Input(_ref) {
|
|
21
|
+
var className = _ref.className,
|
|
22
|
+
_ref$type = _ref.type,
|
|
23
|
+
type = _ref$type === void 0 ? InputType.Text : _ref$type,
|
|
24
|
+
_ref$size = _ref.size,
|
|
25
|
+
size = _ref$size === void 0 ? InputSize.Md : _ref$size,
|
|
26
|
+
_ref$disabled = _ref.disabled,
|
|
27
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
28
|
+
_ref$readOnly = _ref.readOnly,
|
|
29
|
+
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
|
|
30
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
31
|
+
return /*#__PURE__*/React.createElement("input", _extends({
|
|
32
|
+
type: type,
|
|
33
|
+
"data-slot": "input",
|
|
34
|
+
disabled: disabled,
|
|
35
|
+
readOnly: readOnly,
|
|
36
|
+
className: cn('border-input text-foreground bg-background flex w-full min-w-0 rounded-md border shadow-xs transition-[color,box-shadow] outline-none', 'placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50', 'focus-visible:ring-ring ring-offset-background focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none', 'read-only:bg-secondary read-only:text-foreground read-only:cursor-default', 'aria-invalid:ring-destructive/20 aria-invalid:border-destructive', 'group-data-[highlight=true]:border-warning group-data-[highlight=true]:focus-visible:ring-warning/20', inputVariants({
|
|
37
|
+
size: size,
|
|
38
|
+
className: className
|
|
39
|
+
}))
|
|
40
|
+
}, props));
|
|
41
|
+
}
|
|
42
|
+
export { Input, inputVariants };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Values } from 'packages/ui/src/types/values';
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
|
+
export interface InputProps extends Omit<ComponentProps<'input'>, 'size'> {
|
|
4
|
+
size?: InputSizeType;
|
|
5
|
+
'aria-invalid'?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const InputType: {
|
|
8
|
+
readonly Text: "text";
|
|
9
|
+
readonly Email: "email";
|
|
10
|
+
readonly Number: "number";
|
|
11
|
+
};
|
|
12
|
+
export declare const InputSize: {
|
|
13
|
+
readonly Sm: "sm";
|
|
14
|
+
readonly Md: "md";
|
|
15
|
+
readonly Lg: "lg";
|
|
16
|
+
};
|
|
17
|
+
export type InputSizeType = Values<typeof InputSize>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["color", "size", "ref"];
|
|
4
|
+
import React from 'react';
|
|
5
|
+
export var InfoOutlineIcon = function InfoOutlineIcon(_ref) {
|
|
6
|
+
var _ref$color = _ref.color,
|
|
7
|
+
color = _ref$color === void 0 ? 'currentColor' : _ref$color,
|
|
8
|
+
_ref$size = _ref.size,
|
|
9
|
+
size = _ref$size === void 0 ? '0.875rem' : _ref$size,
|
|
10
|
+
ref = _ref.ref,
|
|
11
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
12
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
13
|
+
ref: ref,
|
|
14
|
+
width: size,
|
|
15
|
+
height: size,
|
|
16
|
+
viewBox: "0 0 50 50",
|
|
17
|
+
fill: "none",
|
|
18
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
19
|
+
}, rest), /*#__PURE__*/React.createElement("path", {
|
|
20
|
+
d: "M25 50C11.2033 50 0 38.7967 0 25C0 11.2033 11.2033 0 25 0C38.7967 0 50 11.2033 50 25C50 38.7967 38.6929 50 25 50ZM25 3.52697C13.1743 3.52697 3.63071 13.1743 3.63071 24.8963C3.63071 36.6183 13.278 46.2656 25 46.2656C36.8257 46.2656 46.3693 36.6183 46.3693 24.8963C46.3693 13.1743 36.8257 3.52697 25 3.52697Z",
|
|
21
|
+
fill: color
|
|
22
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
23
|
+
d: "M28.3755 13.125C28.3755 11.3992 26.9765 10 25.2505 10C23.5245 10 22.1255 11.3992 22.1255 13.125C22.1255 14.8516 23.5245 16.25 25.2505 16.25C26.9765 16.25 28.3755 14.8516 28.3755 13.125Z",
|
|
24
|
+
fill: color
|
|
25
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
26
|
+
d: "M20.563 38.5H29.938C30.8009 38.5 31.5005 37.8012 31.5005 36.9375C31.5005 36.0746 30.8009 35.375 29.938 35.375H28.3755V20.9375C28.3755 20.0746 27.6759 19.375 26.813 19.375H20.563C19.7001 19.375 19.0005 20.0746 19.0005 20.9375C19.0005 21.8012 19.7001 22.5 20.563 22.5H22.1255V35.375H20.563C19.7001 35.375 19.0005 36.0746 19.0005 36.9375C19.0005 37.8012 19.7001 38.5 20.563 38.5Z",
|
|
27
|
+
fill: color
|
|
28
|
+
}));
|
|
29
|
+
};
|
|
30
|
+
export default InfoOutlineIcon;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LabelProps } from '@scaleflex/ui-tw/label/label.types';
|
|
2
|
+
import React, { ComponentProps, ReactElement } from 'react';
|
|
3
|
+
interface LabelIconProps extends ComponentProps<'span'>, Pick<LabelProps, 'size' | 'tooltip'> {
|
|
4
|
+
icon?: ReactElement;
|
|
5
|
+
}
|
|
6
|
+
declare const LabelIcon: (props: LabelIconProps) => React.JSX.Element | null;
|
|
7
|
+
export { LabelIcon };
|