@techsio/ui-kit 0.57.0 → 0.59.0
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/README.md +128 -133
- package/dist/atoms/action-icon.js +9 -8
- package/dist/atoms/button.js +114 -18
- package/dist/atoms/checkbox.js +77 -17
- package/dist/atoms/hotkeys.js +26 -7
- package/dist/atoms/icon.js +5 -5
- package/dist/atoms/image.js +118 -3
- package/dist/atoms/input.js +57 -9
- package/dist/atoms/label.js +13 -4
- package/dist/atoms/link-button.js +15 -12
- package/dist/atoms/link.js +18 -4
- package/dist/atoms/numeric-input.js +362 -84
- package/dist/atoms/rating.js +306 -73
- package/dist/atoms/skeleton.js +18 -14
- package/dist/atoms/status-text.js +31 -18
- package/dist/atoms/textarea.js +59 -12
- package/dist/atoms/tooltip.js +64 -43
- package/dist/hotkeys.js +1 -0
- package/dist/internal/choice-control.js +173 -0
- package/dist/internal/combobox-query-sync.js +11 -0
- package/dist/internal/date-picker-coordinator.js +56 -40
- package/dist/internal/date-picker-dom.js +44 -0
- package/dist/internal/date-picker-input.js +30 -0
- package/dist/internal/described-by.js +23 -18
- package/dist/internal/form-control-lifecycle.js +122 -0
- package/dist/internal/molecules/command.context.js +1 -0
- package/dist/internal/molecules/drawer.context.js +1 -0
- package/dist/internal/molecules/vertical-navigation.context.js +1 -0
- package/dist/internal/molecules/vertical-navigation.styles.js +9 -2
- package/dist/internal/numeric-input-editing.js +87 -0
- package/dist/internal/organisms/sidebar.context.js +1 -0
- package/dist/internal/organisms/sidebar.focus.js +1 -0
- package/dist/internal/overlay-portal.js +72 -0
- package/dist/internal/reduced-motion.js +1 -0
- package/dist/internal/use-effective-disabled.js +8 -0
- package/dist/molecules/accordion.js +44 -30
- package/dist/molecules/availability-status.js +1 -0
- package/dist/molecules/breadcrumb.js +11 -11
- package/dist/molecules/carousel.js +279 -97
- package/dist/molecules/cascade-select.js +327 -81
- package/dist/molecules/chart.js +427 -78
- package/dist/molecules/color-select.js +181 -62
- package/dist/molecules/combobox.js +537 -182
- package/dist/molecules/command.js +2 -1
- package/dist/molecules/date-picker.js +629 -119
- package/dist/molecules/dialog.js +89 -48
- package/dist/molecules/drawer.js +63 -6
- package/dist/molecules/file-upload.js +373 -37
- package/dist/molecules/form-checkbox.js +65 -22
- package/dist/molecules/form-error-summary.js +29 -5
- package/dist/molecules/form-input.js +26 -30
- package/dist/molecules/form-numeric-input.js +11 -9
- package/dist/molecules/form-textarea.js +26 -23
- package/dist/molecules/menu.js +170 -47
- package/dist/molecules/pagination.js +100 -28
- package/dist/molecules/phone-input.js +172 -37
- package/dist/molecules/popover.js +53 -26
- package/dist/molecules/price-block.js +1 -0
- package/dist/molecules/product-card.js +85 -23
- package/dist/molecules/quantity-field.js +4 -2
- package/dist/molecules/radio-card.js +102 -30
- package/dist/molecules/radio-group.js +108 -31
- package/dist/molecules/search-form.js +116 -13
- package/dist/molecules/select.js +226 -81
- package/dist/molecules/slider.js +141 -30
- package/dist/molecules/steps.js +181 -50
- package/dist/molecules/switch.js +86 -20
- package/dist/molecules/tabs.js +227 -31
- package/dist/molecules/toast.js +155 -53
- package/dist/molecules/totals-summary.js +2 -1
- package/dist/molecules/tour.js +9 -5
- package/dist/molecules/tree-view.js +255 -109
- package/dist/molecules/vertical-navigation.js +8 -4
- package/dist/organisms/data-table.fields.js +26 -5
- package/dist/organisms/data-table.helpers.js +6 -2
- package/dist/organisms/data-table.js +587 -154
- package/dist/organisms/footer.js +18 -11
- package/dist/organisms/gallery.js +61 -24
- package/dist/organisms/header.js +106 -32
- package/dist/organisms/line-item.js +1 -0
- package/dist/organisms/sidebar.js +1 -0
- package/dist/organisms/table.js +22 -7
- package/dist/src/atoms/action-icon.d.ts +10 -10
- package/dist/src/atoms/action-icon.d.ts.map +1 -1
- package/dist/src/atoms/badge.d.ts +3 -3
- package/dist/src/atoms/badge.d.ts.map +1 -1
- package/dist/src/atoms/button.d.ts +47 -24
- package/dist/src/atoms/button.d.ts.map +1 -1
- package/dist/src/atoms/checkbox.d.ts +6 -5
- package/dist/src/atoms/checkbox.d.ts.map +1 -1
- package/dist/src/atoms/hotkeys.d.ts +3 -2
- package/dist/src/atoms/hotkeys.d.ts.map +1 -1
- package/dist/src/atoms/icon.d.ts +18 -17
- package/dist/src/atoms/icon.d.ts.map +1 -1
- package/dist/src/atoms/image.d.ts +38 -7
- package/dist/src/atoms/image.d.ts.map +1 -1
- package/dist/src/atoms/input.d.ts +23 -14
- package/dist/src/atoms/input.d.ts.map +1 -1
- package/dist/src/atoms/label.d.ts +4 -4
- package/dist/src/atoms/label.d.ts.map +1 -1
- package/dist/src/atoms/link-button.d.ts +78 -31
- package/dist/src/atoms/link-button.d.ts.map +1 -1
- package/dist/src/atoms/link.d.ts +30 -9
- package/dist/src/atoms/link.d.ts.map +1 -1
- package/dist/src/atoms/numeric-input.d.ts +24 -19
- package/dist/src/atoms/numeric-input.d.ts.map +1 -1
- package/dist/src/atoms/rating.d.ts +54 -26
- package/dist/src/atoms/rating.d.ts.map +1 -1
- package/dist/src/atoms/skeleton.d.ts +9 -9
- package/dist/src/atoms/skeleton.d.ts.map +1 -1
- package/dist/src/atoms/status-text.d.ts +21 -13
- package/dist/src/atoms/status-text.d.ts.map +1 -1
- package/dist/src/atoms/textarea.d.ts +22 -20
- package/dist/src/atoms/textarea.d.ts.map +1 -1
- package/dist/src/atoms/tooltip.d.ts +5 -5
- package/dist/src/atoms/tooltip.d.ts.map +1 -1
- package/dist/src/hotkeys.d.ts +1 -1
- package/dist/src/hotkeys.d.ts.map +1 -1
- package/dist/src/internal/choice-control.d.ts +18 -0
- package/dist/src/internal/choice-control.d.ts.map +1 -0
- package/dist/src/internal/combobox-query-sync.d.ts +4 -0
- package/dist/src/internal/combobox-query-sync.d.ts.map +1 -0
- package/dist/src/internal/date-picker-coordinator.d.ts +7 -1
- package/dist/src/internal/date-picker-coordinator.d.ts.map +1 -1
- package/dist/src/internal/date-picker-dom.d.ts +10 -0
- package/dist/src/internal/date-picker-dom.d.ts.map +1 -0
- package/dist/src/internal/date-picker-input.d.ts +7 -0
- package/dist/src/internal/date-picker-input.d.ts.map +1 -0
- package/dist/src/internal/described-by.d.ts +7 -1
- package/dist/src/internal/described-by.d.ts.map +1 -1
- package/dist/src/internal/form-control-lifecycle.d.ts +22 -0
- package/dist/src/internal/form-control-lifecycle.d.ts.map +1 -0
- package/dist/src/internal/molecules/vertical-navigation.context.d.ts +1 -1
- package/dist/src/internal/molecules/vertical-navigation.context.d.ts.map +1 -1
- package/dist/src/internal/molecules/vertical-navigation.styles.d.ts +21 -0
- package/dist/src/internal/molecules/vertical-navigation.styles.d.ts.map +1 -1
- package/dist/src/internal/numeric-input-editing.d.ts +13 -0
- package/dist/src/internal/numeric-input-editing.d.ts.map +1 -0
- package/dist/src/internal/overlay-portal.d.ts +18 -0
- package/dist/src/internal/overlay-portal.d.ts.map +1 -0
- package/dist/src/internal/use-effective-disabled.d.ts +4 -0
- package/dist/src/internal/use-effective-disabled.d.ts.map +1 -0
- package/dist/src/molecules/accordion.d.ts +25 -19
- package/dist/src/molecules/accordion.d.ts.map +1 -1
- package/dist/src/molecules/availability-status.d.ts +4 -1
- package/dist/src/molecules/availability-status.d.ts.map +1 -1
- package/dist/src/molecules/breadcrumb.d.ts +2 -2
- package/dist/src/molecules/breadcrumb.d.ts.map +1 -1
- package/dist/src/molecules/carousel.d.ts +51 -52
- package/dist/src/molecules/carousel.d.ts.map +1 -1
- package/dist/src/molecules/cascade-select.d.ts +23 -8
- package/dist/src/molecules/cascade-select.d.ts.map +1 -1
- package/dist/src/molecules/chart.d.ts +18 -1
- package/dist/src/molecules/chart.d.ts.map +1 -1
- package/dist/src/molecules/color-select.d.ts +19 -3
- package/dist/src/molecules/color-select.d.ts.map +1 -1
- package/dist/src/molecules/combobox.d.ts +27 -5
- package/dist/src/molecules/combobox.d.ts.map +1 -1
- package/dist/src/molecules/command.d.ts +1 -1
- package/dist/src/molecules/date-picker.d.ts +30 -4
- package/dist/src/molecules/date-picker.d.ts.map +1 -1
- package/dist/src/molecules/dialog.d.ts +17 -4
- package/dist/src/molecules/dialog.d.ts.map +1 -1
- package/dist/src/molecules/drawer.d.ts +4 -4
- package/dist/src/molecules/drawer.d.ts.map +1 -1
- package/dist/src/molecules/file-upload.d.ts +11 -6
- package/dist/src/molecules/file-upload.d.ts.map +1 -1
- package/dist/src/molecules/form-checkbox.d.ts +7 -2
- package/dist/src/molecules/form-checkbox.d.ts.map +1 -1
- package/dist/src/molecules/form-error-summary.d.ts +4 -3
- package/dist/src/molecules/form-error-summary.d.ts.map +1 -1
- package/dist/src/molecules/form-input.d.ts +5 -6
- package/dist/src/molecules/form-input.d.ts.map +1 -1
- package/dist/src/molecules/form-numeric-input.d.ts +5 -5
- package/dist/src/molecules/form-numeric-input.d.ts.map +1 -1
- package/dist/src/molecules/form-textarea.d.ts +5 -6
- package/dist/src/molecules/form-textarea.d.ts.map +1 -1
- package/dist/src/molecules/menu.d.ts +17 -3
- package/dist/src/molecules/menu.d.ts.map +1 -1
- package/dist/src/molecules/pagination.d.ts +1 -1
- package/dist/src/molecules/pagination.d.ts.map +1 -1
- package/dist/src/molecules/phone-input.d.ts +4 -1
- package/dist/src/molecules/phone-input.d.ts.map +1 -1
- package/dist/src/molecules/popover.d.ts +7 -1
- package/dist/src/molecules/popover.d.ts.map +1 -1
- package/dist/src/molecules/price-block.d.ts +1 -1
- package/dist/src/molecules/price-block.d.ts.map +1 -1
- package/dist/src/molecules/product-card.d.ts +127 -27
- package/dist/src/molecules/product-card.d.ts.map +1 -1
- package/dist/src/molecules/quantity-field.d.ts +1 -1
- package/dist/src/molecules/quantity-field.d.ts.map +1 -1
- package/dist/src/molecules/radio-card.d.ts +10 -3
- package/dist/src/molecules/radio-card.d.ts.map +1 -1
- package/dist/src/molecules/radio-group.d.ts +15 -6
- package/dist/src/molecules/radio-group.d.ts.map +1 -1
- package/dist/src/molecules/search-form.d.ts +37 -12
- package/dist/src/molecules/search-form.d.ts.map +1 -1
- package/dist/src/molecules/select.d.ts +34 -29
- package/dist/src/molecules/select.d.ts.map +1 -1
- package/dist/src/molecules/slider.d.ts +23 -2
- package/dist/src/molecules/slider.d.ts.map +1 -1
- package/dist/src/molecules/steps.d.ts +30 -10
- package/dist/src/molecules/steps.d.ts.map +1 -1
- package/dist/src/molecules/switch.d.ts +54 -33
- package/dist/src/molecules/switch.d.ts.map +1 -1
- package/dist/src/molecules/tabs.d.ts +11 -11
- package/dist/src/molecules/tabs.d.ts.map +1 -1
- package/dist/src/molecules/toast.d.ts +38 -14
- package/dist/src/molecules/toast.d.ts.map +1 -1
- package/dist/src/molecules/totals-summary.d.ts +1 -1
- package/dist/src/molecules/totals-summary.d.ts.map +1 -1
- package/dist/src/molecules/tour.d.ts +1 -1
- package/dist/src/molecules/tour.d.ts.map +1 -1
- package/dist/src/molecules/tree-view.d.ts +16 -20
- package/dist/src/molecules/tree-view.d.ts.map +1 -1
- package/dist/src/molecules/vertical-navigation.d.ts +2 -2
- package/dist/src/molecules/vertical-navigation.d.ts.map +1 -1
- package/dist/src/organisms/data-table.d.ts +28 -3
- package/dist/src/organisms/data-table.d.ts.map +1 -1
- package/dist/src/organisms/data-table.fields.d.ts +4 -1
- package/dist/src/organisms/data-table.fields.d.ts.map +1 -1
- package/dist/src/organisms/data-table.helpers.d.ts +5 -12
- package/dist/src/organisms/data-table.helpers.d.ts.map +1 -1
- package/dist/src/organisms/footer.d.ts +5 -5
- package/dist/src/organisms/footer.d.ts.map +1 -1
- package/dist/src/organisms/gallery.d.ts +11 -9
- package/dist/src/organisms/gallery.d.ts.map +1 -1
- package/dist/src/organisms/header.d.ts +24 -22
- package/dist/src/organisms/header.d.ts.map +1 -1
- package/dist/src/organisms/table.d.ts +14 -14
- package/dist/src/organisms/table.d.ts.map +1 -1
- package/dist/src/templates/accordion.d.ts +8 -6
- package/dist/src/templates/accordion.d.ts.map +1 -1
- package/dist/src/templates/breadcrumb.d.ts +1 -1
- package/dist/src/templates/breadcrumb.d.ts.map +1 -1
- package/dist/src/templates/carousel.d.ts +3 -3
- package/dist/src/templates/carousel.d.ts.map +1 -1
- package/dist/src/templates/facet-filter-panel.d.ts +9 -3
- package/dist/src/templates/facet-filter-panel.d.ts.map +1 -1
- package/dist/src/templates/gallery.d.ts +2 -2
- package/dist/src/templates/gallery.d.ts.map +1 -1
- package/dist/src/templates/numeric-input.d.ts +1 -1
- package/dist/src/templates/numeric-input.d.ts.map +1 -1
- package/dist/src/templates/popover.d.ts +4 -2
- package/dist/src/templates/popover.d.ts.map +1 -1
- package/dist/src/templates/product-card.d.ts +12 -4
- package/dist/src/templates/product-card.d.ts.map +1 -1
- package/dist/src/templates/search-suggestions.d.ts +1 -1
- package/dist/src/templates/select.d.ts +7 -2
- package/dist/src/templates/select.d.ts.map +1 -1
- package/dist/src/templates/tabs.d.ts +8 -7
- package/dist/src/templates/tabs.d.ts.map +1 -1
- package/dist/src/theme/theme-config.d.ts +9 -16
- package/dist/src/theme/theme-config.d.ts.map +1 -1
- package/dist/src/theme/theme-provider.d.ts +16 -21
- package/dist/src/theme/theme-provider.d.ts.map +1 -1
- package/dist/src/theme/theme-toggle.d.ts.map +1 -1
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/templates/accordion.js +3 -1
- package/dist/templates/breadcrumb.js +11 -4
- package/dist/templates/carousel.js +3 -6
- package/dist/templates/facet-filter-panel.js +121 -52
- package/dist/templates/gallery.js +6 -2
- package/dist/templates/numeric-input.js +6 -1
- package/dist/templates/popover.js +6 -1
- package/dist/templates/product-card.js +52 -26
- package/dist/templates/select.js +6 -1
- package/dist/templates/tabs.js +4 -2
- package/dist/theme/theme-config.js +8 -16
- package/dist/theme/theme-provider.js +89 -63
- package/dist/theme/theme-toggle.js +17 -9
- package/dist/utils.js +11 -1
- package/package.json +9 -5
- package/src/tokens/_base.css +4 -3
- package/src/tokens/_business-atoms.css +96 -0
- package/src/tokens/_foundation-overrides.css +251 -0
- package/src/tokens/_reset.css +10 -10
- package/src/tokens/_scheme-scopes.css +4194 -0
- package/src/tokens/_semantic.css +1 -23
- package/src/tokens/_tokens-base.css +36 -32
- package/src/tokens/_typography.css +2 -1
- package/src/tokens/components/_form-control.css +149 -6
- package/src/tokens/components/_popup-surface.css +15 -29
- package/src/tokens/components/atoms/_action-icon.css +49 -0
- package/src/tokens/components/atoms/_button.css +77 -0
- package/src/tokens/components/atoms/_checkbox.css +47 -4
- package/src/tokens/components/atoms/_hotkeys.css +2 -0
- package/src/tokens/components/atoms/_icon.css +60 -7
- package/src/tokens/components/atoms/_image.css +18 -0
- package/src/tokens/components/atoms/_input.css +20 -0
- package/src/tokens/components/atoms/_label.css +3 -7
- package/src/tokens/components/atoms/_link.css +47 -5
- package/src/tokens/components/atoms/_numeric-input.css +121 -2
- package/src/tokens/components/atoms/_rating.css +55 -6
- package/src/tokens/components/atoms/_skeleton.css +12 -2
- package/src/tokens/components/atoms/_status-text.css +35 -5
- package/src/tokens/components/atoms/_textarea.css +32 -3
- package/src/tokens/components/atoms/_tooltip.css +25 -0
- package/src/tokens/components/molecules/_accordion.css +46 -5
- package/src/tokens/components/molecules/_breadcrumb.css +15 -4
- package/src/tokens/components/molecules/_carousel.css +67 -0
- package/src/tokens/components/molecules/_cascade-select.css +104 -0
- package/src/tokens/components/molecules/_chart.css +32 -16
- package/src/tokens/components/molecules/_color-select.css +21 -0
- package/src/tokens/components/molecules/_combobox.css +81 -0
- package/src/tokens/components/molecules/_command.css +1 -0
- package/src/tokens/components/molecules/_date-picker.css +66 -10
- package/src/tokens/components/molecules/_dialog.css +36 -4
- package/src/tokens/components/molecules/_drawer.css +39 -3
- package/src/tokens/components/molecules/_file-upload.css +16 -1
- package/src/tokens/components/molecules/_menu.css +17 -0
- package/src/tokens/components/molecules/_pagination.css +19 -0
- package/src/tokens/components/molecules/_phone-input.css +20 -5
- package/src/tokens/components/molecules/_popover.css +34 -0
- package/src/tokens/components/molecules/_product-card.css +70 -0
- package/src/tokens/components/molecules/_radio-card.css +35 -0
- package/src/tokens/components/molecules/_radio-group.css +8 -0
- package/src/tokens/components/molecules/_select.css +33 -0
- package/src/tokens/components/molecules/_slider.css +5 -0
- package/src/tokens/components/molecules/_steps.css +52 -0
- package/src/tokens/components/molecules/_switch.css +59 -10
- package/src/tokens/components/molecules/_tabs.css +61 -3
- package/src/tokens/components/molecules/_toast.css +60 -0
- package/src/tokens/components/molecules/_totals-summary.css +22 -22
- package/src/tokens/components/molecules/_tour.css +16 -1
- package/src/tokens/components/molecules/_tree-view.css +27 -3
- package/src/tokens/components/molecules/_vertical-navigation.css +21 -3
- package/src/tokens/components/organisms/_data-table.css +97 -0
- package/src/tokens/components/organisms/_footer.css +9 -0
- package/src/tokens/components/organisms/_gallery.css +11 -0
- package/src/tokens/components/organisms/_header.css +22 -0
- package/src/tokens/components/organisms/_sidebar.css +1 -1
- package/src/tokens/components/organisms/_table.css +31 -0
- package/src/tokens/components/templates/_facet-filter-panel.css +11 -1
- package/src/tokens/figma/akros/variables.css +15 -6
- package/src/tokens/figma/brand-overrides.css +171 -57
- package/src/tokens/figma/business/variables.css +15 -6
- package/src/tokens/figma/cyber/variables.css +115 -38
- package/src/tokens/figma/cyber-dark/variables.css +115 -38
- package/src/tokens/figma/dark/variables.css +13 -4
- package/src/tokens/figma/light/variables.css +62 -49
- package/src/tokens/figma/{neo → n1}/variables.css +123 -114
- package/src/tokens/figma/variables.css +658 -249
- package/src/tokens/theme.css +24 -4
- package/src/tokens/_colors.css +0 -5
- package/src/tokens/figma/neo-dark/variables.css +0 -457
package/dist/atoms/checkbox.js
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useLayoutEffect, useMemo, useRef } from "react";
|
|
4
|
+
import { useChoiceInputRef } from "../internal/choice-control.js";
|
|
5
|
+
import { subscribeOwnerFormReset, syncReactFormControl } from "../internal/form-control-lifecycle.js";
|
|
2
6
|
import { tv } from "../utils.js";
|
|
3
7
|
const checkboxVariants = tv({
|
|
4
8
|
base: [
|
|
5
|
-
"relative shrink-0 cursor-pointer appearance-none",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
9
|
+
"form-control-readonly relative shrink-0 cursor-pointer appearance-none",
|
|
10
|
+
"data-readonly:checked:text-checkbox-fg-readonly",
|
|
11
|
+
"data-readonly:indeterminate:after:bg-checkbox-fg-readonly",
|
|
12
|
+
"border-(length:--border-width-checkbox) rounded-checkbox-control border-checkbox-border-base",
|
|
8
13
|
"bg-checkbox-bg-base",
|
|
9
14
|
"after:-translate-1/2 after:absolute after:top-1/2 after:left-1/2",
|
|
10
15
|
"checked:bg-checkbox-bg-checked",
|
|
11
16
|
"checked:border-checkbox-border-checked",
|
|
12
|
-
"checked:after:token-icon-checkbox",
|
|
17
|
+
"checked:not-indeterminate:after:token-icon-checkbox",
|
|
13
18
|
"checked:text-checkbox-fg-checked",
|
|
14
19
|
"indeterminate:bg-checkbox-bg-indeterminate",
|
|
15
20
|
"indeterminate:border-checkbox-border-indeterminate",
|
|
16
|
-
"indeterminate:after:
|
|
21
|
+
"indeterminate:after:w-checkbox-indeterminate-icon",
|
|
22
|
+
"indeterminate:after:h-checkbox-indeterminate-stroke",
|
|
17
23
|
"indeterminate:after:rounded-full",
|
|
18
24
|
"indeterminate:after:bg-checkbox-fg-indeterminate",
|
|
19
25
|
"disabled:cursor-not-allowed",
|
|
@@ -23,29 +29,83 @@ const checkboxVariants = tv({
|
|
|
23
29
|
"disabled:checked:bg-checkbox-bg-disabled",
|
|
24
30
|
"disabled:checked:text-checkbox-fg-disabled",
|
|
25
31
|
"disabled:checked:border-checkbox-border-disabled",
|
|
32
|
+
"disabled:indeterminate:bg-checkbox-bg-disabled",
|
|
33
|
+
"disabled:indeterminate:border-checkbox-border-disabled",
|
|
34
|
+
"disabled:indeterminate:after:bg-checkbox-fg-disabled",
|
|
26
35
|
"transition duration-200 motion-reduce:transition-none",
|
|
27
|
-
"focus-visible:
|
|
28
|
-
"focus-visible:outline-checkbox-ring-focus",
|
|
29
|
-
"focus-visible:outline-offset-(length:--default-ring-offset)",
|
|
36
|
+
"focus-visible:checkbox-focus-outline",
|
|
30
37
|
"data-invalid:border-(length:--border-width-validation)",
|
|
31
38
|
"data-invalid:border-checkbox-border-error"
|
|
32
|
-
]
|
|
39
|
+
],
|
|
40
|
+
variants: {
|
|
41
|
+
size: {
|
|
42
|
+
sm: "size-form-checkbox-control-sm text-checkbox-icon-sm",
|
|
43
|
+
md: "size-form-checkbox-control-md text-checkbox-icon-md",
|
|
44
|
+
lg: "size-form-checkbox-control-lg text-checkbox-icon-lg"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
defaultVariants: {
|
|
48
|
+
size: "md"
|
|
49
|
+
}
|
|
33
50
|
});
|
|
34
|
-
function Checkbox({ className, indeterminate, invalid, ref, ...props }) {
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
};
|
|
51
|
+
function Checkbox({ className, size = "md", indeterminate, invalid, ref, readOnly = false, onClick, onChange, onKeyDown, ...props }) {
|
|
52
|
+
const inputRef = useRef(null);
|
|
53
|
+
const currentValue = useRef({
|
|
54
|
+
checked: props.checked,
|
|
55
|
+
indeterminate
|
|
56
|
+
});
|
|
57
|
+
useLayoutEffect(()=>{
|
|
58
|
+
currentValue.current = {
|
|
59
|
+
checked: props.checked,
|
|
60
|
+
indeterminate
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
const choiceRef = useChoiceInputRef(ref, indeterminate ?? false);
|
|
64
|
+
const setInputRef = useMemo(()=>(node)=>{
|
|
65
|
+
inputRef.current = node;
|
|
66
|
+
const cleanup = choiceRef(node);
|
|
67
|
+
return ()=>{
|
|
68
|
+
inputRef.current = null;
|
|
69
|
+
cleanup();
|
|
70
|
+
};
|
|
71
|
+
}, [
|
|
72
|
+
choiceRef
|
|
73
|
+
]);
|
|
74
|
+
useLayoutEffect(()=>{
|
|
75
|
+
const input = inputRef.current;
|
|
76
|
+
if (!input) return;
|
|
77
|
+
return subscribeOwnerFormReset(input, ()=>{
|
|
78
|
+
syncReactFormControl(input, currentValue.current.checked ?? input.checked);
|
|
79
|
+
input.indeterminate = currentValue.current.indeterminate ?? false;
|
|
80
|
+
});
|
|
81
|
+
}, []);
|
|
40
82
|
return /*#__PURE__*/ jsx("input", {
|
|
41
83
|
"aria-invalid": invalid || void 0,
|
|
42
84
|
className: checkboxVariants({
|
|
85
|
+
size,
|
|
43
86
|
className
|
|
44
87
|
}),
|
|
45
88
|
"data-invalid": invalid || void 0,
|
|
46
|
-
ref:
|
|
89
|
+
ref: setInputRef,
|
|
47
90
|
type: "checkbox",
|
|
48
|
-
...props
|
|
91
|
+
...props,
|
|
92
|
+
"aria-readonly": readOnly && !props.disabled || void 0,
|
|
93
|
+
"data-readonly": readOnly && !props.disabled ? "" : void 0,
|
|
94
|
+
onChange: (event)=>{
|
|
95
|
+
if (!(readOnly || props.disabled)) {
|
|
96
|
+
onChange?.(event);
|
|
97
|
+
event.currentTarget.indeterminate = indeterminate ?? false;
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
onClick: (event)=>{
|
|
101
|
+
if (readOnly) return void event.preventDefault();
|
|
102
|
+
onClick?.(event);
|
|
103
|
+
},
|
|
104
|
+
onKeyDown: (event)=>{
|
|
105
|
+
if (readOnly && " " === event.key) return void event.preventDefault();
|
|
106
|
+
onKeyDown?.(event);
|
|
107
|
+
},
|
|
108
|
+
readOnly: readOnly
|
|
49
109
|
});
|
|
50
110
|
}
|
|
51
111
|
Checkbox.displayName = "Checkbox";
|
package/dist/atoms/hotkeys.js
CHANGED
|
@@ -1,26 +1,45 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx } from "react/jsx-runtime";
|
|
2
3
|
import { useFormatHotkey } from "../hotkeys.js";
|
|
3
4
|
import { tv } from "../utils.js";
|
|
4
5
|
const hotkeysStyles = tv({
|
|
5
6
|
slots: {
|
|
6
|
-
root: "inline-flex items-center gap-hotkeys whitespace-nowrap font-hotkeys
|
|
7
|
-
key: "hotkeys-key-border-width inline-flex items-center justify-center rounded-hotkeys-key border-hotkeys-key-border bg-hotkeys-key-bg px-hotkeys-key-x py-hotkeys-key-y text-hotkeys-key-fg",
|
|
8
|
-
separator: "text-hotkeys-separator-fg"
|
|
7
|
+
root: "inline-flex items-center gap-hotkeys whitespace-nowrap font-hotkeys",
|
|
8
|
+
key: "hotkeys-key-border-width inline-flex shrink-0 items-center justify-center rounded-hotkeys-key border-hotkeys-key-border bg-hotkeys-key-bg px-hotkeys-key-x py-hotkeys-key-y text-hotkeys-key-fg",
|
|
9
|
+
separator: "shrink-0 text-hotkeys-separator-fg"
|
|
10
|
+
},
|
|
11
|
+
variants: {
|
|
12
|
+
size: {
|
|
13
|
+
sm: {
|
|
14
|
+
root: "text-hotkeys-sm"
|
|
15
|
+
},
|
|
16
|
+
md: {
|
|
17
|
+
root: "text-hotkeys-md"
|
|
18
|
+
},
|
|
19
|
+
lg: {
|
|
20
|
+
root: "text-hotkeys-lg"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
defaultVariants: {
|
|
25
|
+
size: "md"
|
|
9
26
|
}
|
|
10
27
|
});
|
|
11
|
-
function Hotkeys({ hotkey, formatOptions, children, className, ref, ...props }) {
|
|
28
|
+
function Hotkeys({ hotkey, size, formatOptions, children, className, ref, ...props }) {
|
|
12
29
|
const format = useFormatHotkey();
|
|
13
30
|
return /*#__PURE__*/ jsx("span", {
|
|
14
31
|
...props,
|
|
15
|
-
className: hotkeysStyles(
|
|
32
|
+
className: hotkeysStyles({
|
|
33
|
+
size
|
|
34
|
+
}).root({
|
|
16
35
|
className
|
|
17
36
|
}),
|
|
18
37
|
"data-part": "root",
|
|
19
38
|
"data-scope": "hotkeys",
|
|
20
39
|
ref: ref,
|
|
21
|
-
children: children ?? (void 0
|
|
40
|
+
children: children ?? (void 0 === hotkey ? null : /*#__PURE__*/ jsx(Hotkeys.Key, {
|
|
22
41
|
children: format(hotkey, formatOptions)
|
|
23
|
-
})
|
|
42
|
+
}))
|
|
24
43
|
});
|
|
25
44
|
}
|
|
26
45
|
Hotkeys.Root = Hotkeys;
|
package/dist/atoms/icon.js
CHANGED
|
@@ -16,11 +16,11 @@ const iconVariants = tv({
|
|
|
16
16
|
},
|
|
17
17
|
color: {
|
|
18
18
|
current: "text-current",
|
|
19
|
-
primary: "text-
|
|
20
|
-
secondary: "text-secondary",
|
|
21
|
-
danger: "text-danger",
|
|
22
|
-
success: "text-success",
|
|
23
|
-
warning: "text-warning"
|
|
19
|
+
primary: "text-icon-fg-accent-safe",
|
|
20
|
+
secondary: "text-icon-fg-secondary-safe",
|
|
21
|
+
danger: "text-icon-fg-danger-safe",
|
|
22
|
+
success: "text-icon-fg-success-safe",
|
|
23
|
+
warning: "text-icon-fg-warning-safe"
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
defaultVariants: {
|
package/dist/atoms/image.js
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
2
4
|
import { tv } from "../utils.js";
|
|
5
|
+
import { Icon } from "./icon.js";
|
|
3
6
|
const imageVariants = tv({
|
|
7
|
+
base: "block max-w-full object-cover",
|
|
4
8
|
variants: {
|
|
9
|
+
objectFit: {
|
|
10
|
+
contain: "object-contain",
|
|
11
|
+
cover: "object-cover",
|
|
12
|
+
fill: "object-fill",
|
|
13
|
+
none: "object-none",
|
|
14
|
+
scaleDown: "object-scale-down"
|
|
15
|
+
},
|
|
5
16
|
size: {
|
|
6
17
|
sm: "size-image-sm",
|
|
7
18
|
md: "size-image-md",
|
|
@@ -14,16 +25,120 @@ const imageVariants = tv({
|
|
|
14
25
|
size: "full"
|
|
15
26
|
}
|
|
16
27
|
});
|
|
17
|
-
function Image({ as, src, alt, size, className, ...props }) {
|
|
28
|
+
function Image({ as, src, alt, size, objectFit, className, ...props }) {
|
|
18
29
|
const Component = as || "img";
|
|
19
30
|
return /*#__PURE__*/ jsx(Component, {
|
|
20
31
|
alt: alt,
|
|
21
32
|
className: imageVariants({
|
|
22
33
|
size,
|
|
34
|
+
objectFit,
|
|
23
35
|
className
|
|
24
36
|
}),
|
|
25
37
|
src: src,
|
|
26
38
|
...props
|
|
27
39
|
});
|
|
28
40
|
}
|
|
29
|
-
|
|
41
|
+
const fallbackVariants = tv({
|
|
42
|
+
slots: {
|
|
43
|
+
root: "relative aspect-(--image-aspect-ratio) overflow-hidden bg-image-bg-fallback",
|
|
44
|
+
image: "size-full",
|
|
45
|
+
reservation: "image-reservation block h-auto w-full",
|
|
46
|
+
placeholder: "absolute inset-0 flex items-center justify-center text-image-fg-fallback",
|
|
47
|
+
icon: "text-image-fallback-icon"
|
|
48
|
+
},
|
|
49
|
+
variants: {
|
|
50
|
+
failed: {
|
|
51
|
+
true: {
|
|
52
|
+
image: "opacity-0"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
reserved: {
|
|
56
|
+
true: {
|
|
57
|
+
image: "absolute inset-0"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
function ImageWithFallback(props) {
|
|
63
|
+
const sourceKey = `${props.src}|${"srcSet" in props ? props.srcSet : ""}`;
|
|
64
|
+
return /*#__PURE__*/ jsx(ImageFallbackContent, {
|
|
65
|
+
...props
|
|
66
|
+
}, sourceKey);
|
|
67
|
+
}
|
|
68
|
+
function ImageFallbackContent({ as, src, alt, size, objectFit, className, fallbackLabel, ...props }) {
|
|
69
|
+
const [failed, setFailed] = useState(!src);
|
|
70
|
+
const [loaded, setLoaded] = useState(false);
|
|
71
|
+
const pending = !(failed || loaded);
|
|
72
|
+
const Component = as || "img";
|
|
73
|
+
const width = Number(props.width);
|
|
74
|
+
const height = Number(props.height);
|
|
75
|
+
const reserved = Number.isFinite(width) && width > 0 && Number.isFinite(height) && height > 0;
|
|
76
|
+
const styles = fallbackVariants({
|
|
77
|
+
failed: failed || pending,
|
|
78
|
+
reserved
|
|
79
|
+
});
|
|
80
|
+
const reservationStyle = reserved ? {
|
|
81
|
+
"--image-aspect-ratio": `${width} / ${height}`
|
|
82
|
+
} : void 0;
|
|
83
|
+
const onError = props.onError;
|
|
84
|
+
const onLoad = props.onLoad;
|
|
85
|
+
let imageState = "loaded";
|
|
86
|
+
if (failed) imageState = "error";
|
|
87
|
+
else if (pending) imageState = "loading";
|
|
88
|
+
return /*#__PURE__*/ jsxs("span", {
|
|
89
|
+
className: styles.root({
|
|
90
|
+
className: imageVariants({
|
|
91
|
+
size,
|
|
92
|
+
objectFit,
|
|
93
|
+
className
|
|
94
|
+
})
|
|
95
|
+
}),
|
|
96
|
+
"data-image-state": imageState,
|
|
97
|
+
style: reservationStyle,
|
|
98
|
+
children: [
|
|
99
|
+
reserved && /*#__PURE__*/ jsx("svg", {
|
|
100
|
+
"aria-hidden": "true",
|
|
101
|
+
className: styles.reservation(),
|
|
102
|
+
"data-image-reservation": "",
|
|
103
|
+
focusable: "false",
|
|
104
|
+
height: height,
|
|
105
|
+
width: width
|
|
106
|
+
}),
|
|
107
|
+
/*#__PURE__*/ jsx(Component, {
|
|
108
|
+
...props,
|
|
109
|
+
alt: failed ? "" : alt,
|
|
110
|
+
"aria-hidden": failed ? true : props["aria-hidden"],
|
|
111
|
+
className: styles.image({
|
|
112
|
+
className: imageVariants({
|
|
113
|
+
size,
|
|
114
|
+
objectFit,
|
|
115
|
+
className
|
|
116
|
+
})
|
|
117
|
+
}),
|
|
118
|
+
onError: (event)=>{
|
|
119
|
+
setFailed(true);
|
|
120
|
+
onError?.(event);
|
|
121
|
+
},
|
|
122
|
+
onLoad: (event)=>{
|
|
123
|
+
setFailed(false);
|
|
124
|
+
setLoaded(true);
|
|
125
|
+
onLoad?.(event);
|
|
126
|
+
},
|
|
127
|
+
src: src || void 0
|
|
128
|
+
}),
|
|
129
|
+
failed && /*#__PURE__*/ jsx("span", {
|
|
130
|
+
"aria-hidden": !alt || props["aria-hidden"] || void 0,
|
|
131
|
+
"aria-label": alt ? fallbackLabel ?? alt : void 0,
|
|
132
|
+
className: styles.placeholder(),
|
|
133
|
+
"data-image-fallback": "",
|
|
134
|
+
role: "img",
|
|
135
|
+
children: /*#__PURE__*/ jsx(Icon, {
|
|
136
|
+
className: styles.icon(),
|
|
137
|
+
icon: "token-icon-image-unavailable",
|
|
138
|
+
size: "current"
|
|
139
|
+
})
|
|
140
|
+
})
|
|
141
|
+
]
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
export { Image, ImageWithFallback };
|
package/dist/atoms/input.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useId, useLayoutEffect, useMemo, useRef } from "react";
|
|
4
|
+
import { subscribeOwnerFormReset, syncReactFormControl } from "../internal/form-control-lifecycle.js";
|
|
2
5
|
import { tv } from "../utils.js";
|
|
3
6
|
const inputVariants = tv({
|
|
4
7
|
base: [
|
|
5
|
-
"block w-full",
|
|
8
|
+
"form-control-readonly input-readonly form-control-disabled block w-full",
|
|
6
9
|
"font-input",
|
|
7
10
|
"bg-input-bg-base",
|
|
8
11
|
"text-input-fg",
|
|
@@ -24,9 +27,9 @@ const inputVariants = tv({
|
|
|
24
27
|
],
|
|
25
28
|
variants: {
|
|
26
29
|
size: {
|
|
27
|
-
sm: "h-form-control-sm rounded-input-sm p-input-sm text-input-sm",
|
|
28
|
-
md: "h-form-control-md rounded-input-md p-input-md text-input-md",
|
|
29
|
-
lg: "h-form-control-lg rounded-input-lg p-input-lg text-input-lg"
|
|
30
|
+
sm: "h-form-control-sm rounded-input-sm p-input-sm px-input-inline-sm text-input-sm",
|
|
31
|
+
md: "h-form-control-md rounded-input-md p-input-md px-input-inline-md text-input-md",
|
|
32
|
+
lg: "h-form-control-lg rounded-input-lg p-input-lg px-input-inline-lg text-input-lg"
|
|
30
33
|
},
|
|
31
34
|
variant: {
|
|
32
35
|
default: "",
|
|
@@ -63,27 +66,72 @@ const inputVariants = tv({
|
|
|
63
66
|
"border-input-border-disabled",
|
|
64
67
|
"text-input-fg-disabled"
|
|
65
68
|
]
|
|
69
|
+
},
|
|
70
|
+
readOnly: {
|
|
71
|
+
true: ""
|
|
66
72
|
}
|
|
67
73
|
},
|
|
74
|
+
compoundVariants: [
|
|
75
|
+
{
|
|
76
|
+
variant: "default",
|
|
77
|
+
readOnly: true,
|
|
78
|
+
class: [
|
|
79
|
+
"hover:border-input-border-readonly-hover",
|
|
80
|
+
"focus:border-input-border-readonly-focus"
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
],
|
|
68
84
|
defaultVariants: {
|
|
69
85
|
size: "md",
|
|
70
86
|
variant: "default",
|
|
71
|
-
hideSearchClear: true
|
|
72
|
-
withIconInside: false
|
|
87
|
+
hideSearchClear: true
|
|
73
88
|
}
|
|
74
89
|
});
|
|
75
|
-
function Input({ size, variant, disabled, ref, withButtonInside, className, ...props }) {
|
|
90
|
+
function Input({ size, variant, disabled, readOnly, hideSearchClear, id, ref, withButtonInside, className, ...props }) {
|
|
91
|
+
const generatedId = useId();
|
|
92
|
+
const currentValue = useRef({
|
|
93
|
+
value: props.value,
|
|
94
|
+
checked: props.checked
|
|
95
|
+
});
|
|
96
|
+
useLayoutEffect(()=>{
|
|
97
|
+
currentValue.current = {
|
|
98
|
+
value: props.value,
|
|
99
|
+
checked: props.checked
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
const inputRef = useMemo(()=>(input)=>{
|
|
103
|
+
const stopReset = input ? subscribeOwnerFormReset(input, ()=>{
|
|
104
|
+
const { value, checked } = currentValue.current;
|
|
105
|
+
"checkbox" === input.type || "radio" === input.type ? syncReactFormControl(input, checked ?? input.checked) : syncReactFormControl(input, null == value ? input.value : String(value));
|
|
106
|
+
}) : void 0;
|
|
107
|
+
const cleanup = "function" == typeof ref ? ref(input) : void 0;
|
|
108
|
+
if (ref && "function" != typeof ref) ref.current = input;
|
|
109
|
+
return ()=>{
|
|
110
|
+
stopReset?.();
|
|
111
|
+
if ("function" == typeof cleanup) cleanup();
|
|
112
|
+
else if ("function" == typeof ref) ref(null);
|
|
113
|
+
else if (ref) ref.current = null;
|
|
114
|
+
};
|
|
115
|
+
}, [
|
|
116
|
+
ref
|
|
117
|
+
]);
|
|
76
118
|
return /*#__PURE__*/ jsx("input", {
|
|
77
119
|
className: inputVariants({
|
|
78
120
|
size,
|
|
79
121
|
variant,
|
|
80
122
|
disabled,
|
|
123
|
+
hideSearchClear: readOnly || hideSearchClear,
|
|
124
|
+
readOnly: Boolean(readOnly),
|
|
81
125
|
withButtonInside,
|
|
82
126
|
className
|
|
83
127
|
}),
|
|
128
|
+
"data-readonly": readOnly ? "" : void 0,
|
|
84
129
|
disabled: disabled,
|
|
85
|
-
|
|
86
|
-
|
|
130
|
+
id: id || generatedId,
|
|
131
|
+
readOnly: readOnly,
|
|
132
|
+
ref: inputRef,
|
|
133
|
+
...props,
|
|
134
|
+
"aria-invalid": "error" === variant ? true : props["aria-invalid"]
|
|
87
135
|
});
|
|
88
136
|
}
|
|
89
137
|
export { Input };
|
package/dist/atoms/label.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { tv } from "../utils.js";
|
|
3
3
|
const labelVariants = tv({
|
|
4
4
|
base: [
|
|
@@ -33,9 +33,18 @@ function Label({ size, disabled, required, children, className, ...props }) {
|
|
|
33
33
|
htmlFor: props.htmlFor,
|
|
34
34
|
children: [
|
|
35
35
|
children,
|
|
36
|
-
required && /*#__PURE__*/
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
required && /*#__PURE__*/ jsxs(Fragment, {
|
|
37
|
+
children: [
|
|
38
|
+
/*#__PURE__*/ jsx("span", {
|
|
39
|
+
"aria-hidden": "true",
|
|
40
|
+
className: "ms-label-required text-label-fg-required",
|
|
41
|
+
children: "*"
|
|
42
|
+
}),
|
|
43
|
+
/*#__PURE__*/ jsx("span", {
|
|
44
|
+
className: "sr-only",
|
|
45
|
+
children: " (required)"
|
|
46
|
+
})
|
|
47
|
+
]
|
|
39
48
|
})
|
|
40
49
|
]
|
|
41
50
|
});
|
|
@@ -1,31 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { tv } from "../utils.js";
|
|
3
4
|
import { buttonVariants } from "./button.js";
|
|
4
5
|
import { Icon } from "./icon.js";
|
|
5
|
-
import { Link } from "./link.js";
|
|
6
6
|
const linkButton = tv({
|
|
7
7
|
extend: buttonVariants,
|
|
8
|
-
base: "data-disabled:cursor-not-allowed",
|
|
8
|
+
base: "no-underline data-disabled:cursor-not-allowed",
|
|
9
9
|
defaultVariants: {
|
|
10
|
-
size: "
|
|
10
|
+
size: "md"
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
function LinkButton({ href, icon, as, iconPosition = "left", iconSize, children, variant, theme, size, block, uppercase, className, disabled, ref, onClick, tabIndex, ...props }) {
|
|
13
|
+
function LinkButton({ density, href, icon, as, iconPosition = "left", iconSize, children, variant, theme, size, block, uppercase, className, disabled, composition, ref, onClick, tabIndex, ...props }) {
|
|
14
14
|
const handleClick = onClick;
|
|
15
|
-
|
|
15
|
+
const Component = disabled ? "span" : as || "a";
|
|
16
|
+
return /*#__PURE__*/ jsxs(Component, {
|
|
16
17
|
...props,
|
|
17
|
-
"aria-disabled": disabled,
|
|
18
|
-
as: as,
|
|
18
|
+
"aria-disabled": true === disabled ? true : props["aria-disabled"],
|
|
19
19
|
className: linkButton({
|
|
20
|
+
density,
|
|
20
21
|
variant,
|
|
21
22
|
theme,
|
|
22
23
|
size,
|
|
23
24
|
block,
|
|
24
25
|
uppercase,
|
|
26
|
+
composition,
|
|
25
27
|
className
|
|
26
28
|
}),
|
|
27
|
-
"data-disabled": disabled
|
|
28
|
-
href: href,
|
|
29
|
+
"data-disabled": disabled ? "" : void 0,
|
|
30
|
+
href: disabled ? void 0 : href,
|
|
29
31
|
onClick: (e)=>{
|
|
30
32
|
if (disabled) {
|
|
31
33
|
e.preventDefault();
|
|
@@ -34,17 +36,18 @@ function LinkButton({ href, icon, as, iconPosition = "left", iconSize, children,
|
|
|
34
36
|
}
|
|
35
37
|
handleClick?.(e);
|
|
36
38
|
},
|
|
37
|
-
ref: ref,
|
|
39
|
+
ref: disabled ? void 0 : ref,
|
|
40
|
+
role: disabled ? "link" : props.role,
|
|
38
41
|
tabIndex: disabled ? -1 : tabIndex,
|
|
39
42
|
children: [
|
|
40
43
|
icon && "left" === iconPosition && /*#__PURE__*/ jsx(Icon, {
|
|
41
44
|
icon: icon,
|
|
42
|
-
size: iconSize ??
|
|
45
|
+
size: iconSize ?? "current"
|
|
43
46
|
}),
|
|
44
47
|
children,
|
|
45
48
|
icon && "right" === iconPosition && /*#__PURE__*/ jsx(Icon, {
|
|
46
49
|
icon: icon,
|
|
47
|
-
size: iconSize ??
|
|
50
|
+
size: iconSize ?? "current"
|
|
48
51
|
})
|
|
49
52
|
]
|
|
50
53
|
});
|
package/dist/atoms/link.js
CHANGED
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { tv } from "../utils.js";
|
|
3
3
|
const linkVariants = tv({
|
|
4
|
-
base: [
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
base: [
|
|
5
|
+
"text-link-fg-readable underline underline-offset-2",
|
|
6
|
+
"hover:decoration-2",
|
|
7
|
+
"focus-visible:link-focus-inline data-focus-visible:link-focus-inline"
|
|
8
|
+
],
|
|
9
|
+
variants: {
|
|
10
|
+
size: {
|
|
11
|
+
sm: "text-link-sm",
|
|
12
|
+
md: "text-link-md",
|
|
13
|
+
lg: "text-link-lg",
|
|
14
|
+
current: "link-current-size"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: {
|
|
18
|
+
size: "md"
|
|
19
|
+
}
|
|
7
20
|
});
|
|
8
|
-
function Link({ as, children, external = false, className, ...props }) {
|
|
21
|
+
function Link({ as, children, external = false, className, size, ...props }) {
|
|
9
22
|
const Component = as || "a";
|
|
10
23
|
const target = "target" in props ? props.target : void 0;
|
|
11
24
|
const rel = "rel" in props ? props.rel : void 0;
|
|
@@ -15,6 +28,7 @@ function Link({ as, children, external = false, className, ...props }) {
|
|
|
15
28
|
} : {};
|
|
16
29
|
return /*#__PURE__*/ jsx(Component, {
|
|
17
30
|
className: linkVariants({
|
|
31
|
+
size,
|
|
18
32
|
className
|
|
19
33
|
}),
|
|
20
34
|
...externalProps,
|