@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
|
@@ -1,67 +1,121 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx } from "react/jsx-runtime";
|
|
2
3
|
import { createContext, useContext } from "react";
|
|
3
4
|
import { Button } from "../atoms/button.js";
|
|
4
|
-
import { Image } from "../atoms/image.js";
|
|
5
|
+
import { Image, ImageWithFallback } from "../atoms/image.js";
|
|
5
6
|
import { Rating } from "../atoms/rating.js";
|
|
6
7
|
import { tv } from "../utils.js";
|
|
7
8
|
const productCardVariants = tv({
|
|
8
9
|
slots: {
|
|
9
10
|
root: [
|
|
10
|
-
"
|
|
11
|
-
"border-(length:--border-product-card-width) max-w-product-card-max border-product-card-border bg-product-card-bg shadow-sm"
|
|
11
|
+
"max-w-product-card-max border-product-card-border"
|
|
12
12
|
],
|
|
13
|
-
imageSlot: "
|
|
14
|
-
nameSlot: "
|
|
15
|
-
priceSlot: "font-product-card-price text-product-card-price-fg text-product-card-price-size",
|
|
13
|
+
imageSlot: "w-full",
|
|
14
|
+
nameSlot: "product-card-name line-clamp-product-card-name min-h-product-card-name text-product-card-name-fg",
|
|
15
|
+
priceSlot: "mt-auto font-product-card-price text-product-card-price-fg text-product-card-price-size",
|
|
16
16
|
stockStatusSlot: [
|
|
17
|
-
"font-product-card-stock text-product-card-stock-size",
|
|
18
17
|
"data-[stock=in-stock]:text-product-card-stock-fg-in-stock",
|
|
19
18
|
"data-[stock=limited-stock]:text-product-card-stock-fg-limited-stock",
|
|
20
19
|
"data-[stock=out-of-stock]:text-product-card-stock-fg-out-of-stock"
|
|
21
20
|
],
|
|
22
21
|
badgesSlot: "flex flex-wrap gap-product-card-badges",
|
|
23
|
-
ratingSlot: "flex items-center",
|
|
22
|
+
ratingSlot: "flex min-w-0 max-w-full items-center",
|
|
24
23
|
actionsSlot: "flex flex-wrap gap-product-card-actions",
|
|
25
24
|
button: ""
|
|
26
25
|
},
|
|
27
26
|
variants: {
|
|
27
|
+
presentation: {
|
|
28
|
+
default: {
|
|
29
|
+
root: "border-(length:--border-product-card-width) rounded-product-card bg-product-card-bg p-product-card-padding",
|
|
30
|
+
imageSlot: "rounded-product-card-image",
|
|
31
|
+
nameSlot: "font-product-card-name text-product-card-name-size",
|
|
32
|
+
stockStatusSlot: "font-product-card-stock text-product-card-stock-size"
|
|
33
|
+
},
|
|
34
|
+
featured: {
|
|
35
|
+
root: "border-(length:--border-product-card-featured-width) rounded-product-card-featured bg-product-card-featured-bg p-product-card-featured-padding",
|
|
36
|
+
imageSlot: "rounded-product-card-featured-image",
|
|
37
|
+
nameSlot: "font-product-card-featured-name text-product-card-featured-name-size",
|
|
38
|
+
stockStatusSlot: "font-product-card-featured-stock text-product-card-featured-stock-size"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
shadow: {
|
|
42
|
+
true: {
|
|
43
|
+
root: "shadow-sm"
|
|
44
|
+
},
|
|
45
|
+
false: {
|
|
46
|
+
root: "shadow-none"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
objectFit: {
|
|
50
|
+
cover: {
|
|
51
|
+
imageSlot: "object-cover"
|
|
52
|
+
},
|
|
53
|
+
contain: {
|
|
54
|
+
imageSlot: "object-contain"
|
|
55
|
+
},
|
|
56
|
+
fill: {
|
|
57
|
+
imageSlot: "object-fill"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
28
60
|
buttonVariant: {
|
|
29
61
|
cart: {
|
|
30
|
-
button: "w-max bg-product-card-button-cart-bg-base text-product-card-button-cart-fg hover:bg-product-card-button-cart-bg-hover"
|
|
62
|
+
button: "w-max bg-product-card-button-cart-bg-base text-product-card-button-cart-fg hover:bg-product-card-button-cart-bg-hover active:bg-product-card-button-cart-bg-active active:text-product-card-button-cart-fg"
|
|
31
63
|
},
|
|
32
64
|
detail: {
|
|
33
|
-
button: "w-max bg-product-card-button-detail-bg-base text-product-card-button-detail-fg hover:bg-product-card-button-detail-bg-hover"
|
|
65
|
+
button: "w-max bg-product-card-button-detail-bg-base text-product-card-button-detail-fg hover:bg-product-card-button-detail-bg-hover active:bg-product-card-button-detail-bg-active active:text-product-card-button-detail-fg"
|
|
34
66
|
},
|
|
35
67
|
wishlist: {
|
|
36
|
-
button: "w-max bg-product-card-button-wishlist-bg-base text-product-card-button-wishlist-fg hover:bg-product-card-button-wishlist-bg-hover"
|
|
68
|
+
button: "w-max bg-product-card-button-wishlist-bg-base text-product-card-button-wishlist-fg hover:bg-product-card-button-wishlist-bg-hover active:bg-product-card-button-wishlist-bg-active active:text-product-card-button-wishlist-fg"
|
|
37
69
|
},
|
|
38
70
|
custom: {}
|
|
39
71
|
},
|
|
40
72
|
layout: {
|
|
41
73
|
column: {
|
|
42
74
|
root: [
|
|
43
|
-
"
|
|
75
|
+
"flex h-full flex-col"
|
|
44
76
|
],
|
|
45
77
|
imageSlot: "aspect-product-card-image"
|
|
46
78
|
},
|
|
47
79
|
row: {
|
|
48
|
-
root: "grid grid-cols-(--product-card-layout-row-grid) gap-x-product-card-row-layout",
|
|
49
|
-
imageSlot: "row-span-6 aspect-
|
|
80
|
+
root: "product-card-row grid w-full grid-cols-(--product-card-layout-row-grid) gap-x-product-card-row-layout",
|
|
81
|
+
imageSlot: "row-span-6 aspect-product-card-image h-full"
|
|
50
82
|
}
|
|
51
83
|
}
|
|
52
84
|
},
|
|
85
|
+
compoundVariants: [
|
|
86
|
+
{
|
|
87
|
+
presentation: "default",
|
|
88
|
+
layout: "column",
|
|
89
|
+
className: {
|
|
90
|
+
root: "gap-product-card-col-layout"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
presentation: "featured",
|
|
95
|
+
layout: "column",
|
|
96
|
+
className: {
|
|
97
|
+
root: "gap-product-card-featured-col-layout"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
],
|
|
53
101
|
defaultVariants: {
|
|
102
|
+
presentation: "default",
|
|
103
|
+
shadow: true,
|
|
104
|
+
objectFit: "cover",
|
|
54
105
|
layout: "column",
|
|
55
106
|
buttonVariant: "cart"
|
|
56
107
|
}
|
|
57
108
|
});
|
|
58
109
|
const ProductCardContext = /*#__PURE__*/ createContext({});
|
|
59
|
-
function ProductCard({ children, layout = "column", className, ref, ...props }) {
|
|
110
|
+
function ProductCard({ children, layout = "column", presentation = "default", shadow = true, className, ref, ...props }) {
|
|
60
111
|
const { root } = productCardVariants({
|
|
112
|
+
shadow,
|
|
113
|
+
presentation,
|
|
61
114
|
layout
|
|
62
115
|
});
|
|
63
116
|
return /*#__PURE__*/ jsx(ProductCardContext.Provider, {
|
|
64
117
|
value: {
|
|
118
|
+
presentation,
|
|
65
119
|
layout
|
|
66
120
|
},
|
|
67
121
|
children: /*#__PURE__*/ jsx("div", {
|
|
@@ -70,27 +124,32 @@ function ProductCard({ children, layout = "column", className, ref, ...props })
|
|
|
70
124
|
}),
|
|
71
125
|
ref: ref,
|
|
72
126
|
...props,
|
|
127
|
+
"data-layout": layout,
|
|
73
128
|
children: children
|
|
74
129
|
})
|
|
75
130
|
});
|
|
76
131
|
}
|
|
77
|
-
ProductCard.Image = function({ as, className, ref, ...props }) {
|
|
132
|
+
ProductCard.Image = function({ as, objectFit = "cover", className, ref, ...props }) {
|
|
78
133
|
const context = useContext(ProductCardContext);
|
|
79
134
|
const { imageSlot } = productCardVariants({
|
|
135
|
+
objectFit,
|
|
136
|
+
presentation: context.presentation,
|
|
80
137
|
layout: context.layout
|
|
81
138
|
});
|
|
82
|
-
const
|
|
83
|
-
return /*#__PURE__*/ jsx(
|
|
139
|
+
const Media = ImageWithFallback;
|
|
140
|
+
return /*#__PURE__*/ jsx(Media, {
|
|
141
|
+
...props,
|
|
142
|
+
as: as && as !== Image ? as : "img",
|
|
84
143
|
className: imageSlot({
|
|
85
144
|
className
|
|
86
145
|
}),
|
|
87
|
-
ref: ref
|
|
88
|
-
...props
|
|
146
|
+
ref: ref
|
|
89
147
|
});
|
|
90
148
|
};
|
|
91
149
|
ProductCard.Name = function({ as: Heading = "h3", children, className, ref, ...props }) {
|
|
92
150
|
const context = useContext(ProductCardContext);
|
|
93
151
|
const { nameSlot } = productCardVariants({
|
|
152
|
+
presentation: context.presentation,
|
|
94
153
|
layout: context.layout
|
|
95
154
|
});
|
|
96
155
|
return /*#__PURE__*/ jsx(Heading, {
|
|
@@ -119,6 +178,7 @@ ProductCard.Price = function({ children, className, ref, ...props }) {
|
|
|
119
178
|
ProductCard.Stock = function({ children, className, ref, status = "in-stock", ...props }) {
|
|
120
179
|
const context = useContext(ProductCardContext);
|
|
121
180
|
const { stockStatusSlot } = productCardVariants({
|
|
181
|
+
presentation: context.presentation,
|
|
122
182
|
layout: context.layout
|
|
123
183
|
});
|
|
124
184
|
return /*#__PURE__*/ jsx("p", {
|
|
@@ -150,15 +210,16 @@ ProductCard.Rating = function({ children, className, rating, ref, ...props }) {
|
|
|
150
210
|
const { ratingSlot } = productCardVariants({
|
|
151
211
|
layout: context.layout
|
|
152
212
|
});
|
|
213
|
+
const content = rating ? /*#__PURE__*/ jsx(Rating, {
|
|
214
|
+
...rating
|
|
215
|
+
}) : children;
|
|
153
216
|
return /*#__PURE__*/ jsx("div", {
|
|
154
217
|
className: ratingSlot({
|
|
155
218
|
className
|
|
156
219
|
}),
|
|
157
220
|
ref: ref,
|
|
158
221
|
...props,
|
|
159
|
-
children:
|
|
160
|
-
...rating
|
|
161
|
-
}) : children
|
|
222
|
+
children: content
|
|
162
223
|
});
|
|
163
224
|
};
|
|
164
225
|
ProductCard.Actions = function({ children, className, ref, ...props }) {
|
|
@@ -188,6 +249,7 @@ ProductCard.Button = function({ children, onClick, icon, iconSize, className, bu
|
|
|
188
249
|
onClick: onClick,
|
|
189
250
|
ref: ref,
|
|
190
251
|
size: "sm",
|
|
252
|
+
variant: "detail" === buttonVariant || "wishlist" === buttonVariant ? "secondary" : "primary",
|
|
191
253
|
...props,
|
|
192
254
|
children: children
|
|
193
255
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { useId } from "react";
|
|
3
4
|
import { Label } from "../atoms/label.js";
|
|
@@ -10,7 +11,7 @@ const quantityFieldVariants = tv({
|
|
|
10
11
|
root: "flex min-w-0 flex-col gap-quantity-field",
|
|
11
12
|
control: "flex min-w-0 flex-wrap items-center gap-quantity-field-control",
|
|
12
13
|
numeric: "min-w-quantity-field-control-min-width flex-1",
|
|
13
|
-
input: "min-w-0",
|
|
14
|
+
input: "min-w-0 read-only:enabled:cursor-text!",
|
|
14
15
|
unit: "min-w-0 max-w-full break-words text-quantity-field-unit-fg",
|
|
15
16
|
message: "text-quantity-field-message-fg",
|
|
16
17
|
label: ""
|
|
@@ -113,13 +114,14 @@ function QuantityField({ id, label, unitLabel, value, onValueChange, onValueComm
|
|
|
113
114
|
"data-validation": hasError ? "error" : void 0,
|
|
114
115
|
children: [
|
|
115
116
|
/*#__PURE__*/ jsx(NumericInput.Input, {
|
|
117
|
+
"aria-errormessage": hasError ? errorId : void 0,
|
|
116
118
|
"aria-label": ariaLabel,
|
|
117
119
|
"aria-labelledby": ariaLabelledBy,
|
|
118
120
|
autoFocus: autoFocus,
|
|
119
121
|
className: styles.input(),
|
|
120
122
|
ref: ref
|
|
121
123
|
}),
|
|
122
|
-
/*#__PURE__*/ jsxs(NumericInput.TriggerContainer, {
|
|
124
|
+
!readOnly && /*#__PURE__*/ jsxs(NumericInput.TriggerContainer, {
|
|
123
125
|
children: [
|
|
124
126
|
/*#__PURE__*/ jsx(NumericInput.IncrementTrigger, {}),
|
|
125
127
|
/*#__PURE__*/ jsx(NumericInput.DecrementTrigger, {})
|
|
@@ -1,17 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { connect
|
|
3
|
+
import { connect } from "@zag-js/radio-group";
|
|
3
4
|
import { mergeProps, normalizeProps, useMachine } from "@zag-js/react";
|
|
4
5
|
import { createContext, useContext, useId } from "react";
|
|
5
6
|
import { Label } from "../atoms/label.js";
|
|
6
7
|
import { StatusText } from "../atoms/status-text.js";
|
|
8
|
+
import { getControlledChoiceInputProps, handleChoiceArrowKey, isSilentChoiceReset, mergeChoiceInputProps, useChoiceFocusRecovery } from "../internal/choice-control.js";
|
|
9
|
+
import { joinDescribedBy, useDescribedBy, useRegisterDescription } from "../internal/described-by.js";
|
|
7
10
|
import { tv } from "../utils.js";
|
|
11
|
+
import { radioChoiceMachine } from "./radio-group.js";
|
|
8
12
|
const radioCardVariants = tv({
|
|
9
13
|
slots: {
|
|
10
14
|
root: [
|
|
11
|
-
"flex w-full flex-col"
|
|
15
|
+
"flex w-full flex-col",
|
|
16
|
+
"focus-visible:outline-(style:--default-ring-style)",
|
|
17
|
+
"focus-visible:outline-(length:--default-ring-width)",
|
|
18
|
+
"focus-visible:outline-radio-card-ring",
|
|
19
|
+
"focus-visible:outline-offset-(length:--default-ring-offset)"
|
|
12
20
|
],
|
|
13
21
|
item: [
|
|
14
|
-
"relative flex min-w-0 flex-col overflow-clip",
|
|
22
|
+
"radio-card-readonly relative flex min-w-0 flex-col overflow-clip",
|
|
23
|
+
"cursor-pointer data-readonly:not-data-disabled:cursor-default",
|
|
15
24
|
"rounded-radio-card-item",
|
|
16
25
|
"border-(length:--border-width-radio-card)",
|
|
17
26
|
"border-radio-card-item-border",
|
|
@@ -59,7 +68,7 @@ const radioCardVariants = tv({
|
|
|
59
68
|
"inline-grid shrink-0 place-items-center",
|
|
60
69
|
"rounded-radio-card-indicator",
|
|
61
70
|
"border-(length:--border-width-radio-card-indicator)",
|
|
62
|
-
"border-radio-card-
|
|
71
|
+
"border-radio-card-indicator-border-base",
|
|
63
72
|
"bg-radio-card-item-indicator-bg",
|
|
64
73
|
"transition-colors duration-200 motion-reduce:transition-none",
|
|
65
74
|
"data-disabled:border-radio-card-item-indicator-border-disabled",
|
|
@@ -97,16 +106,17 @@ const radioCardVariants = tv({
|
|
|
97
106
|
variant: {
|
|
98
107
|
outline: {
|
|
99
108
|
item: [
|
|
109
|
+
"radio-card-outline-readable",
|
|
100
110
|
"data-[state=checked]:bg-radio-card-item-bg-outline-checked",
|
|
101
111
|
"data-[state=checked]:border-radio-card-item-border-outline-checked",
|
|
102
112
|
"data-hover:data-[state=checked]:bg-radio-card-item-bg-outline-checked-hover",
|
|
103
113
|
"data-hover:data-[state=checked]:border-radio-card-item-border-outline-checked-hover"
|
|
104
114
|
],
|
|
105
115
|
itemIndicator: [
|
|
106
|
-
"data-[state=checked]:border-radio-card-
|
|
116
|
+
"data-[state=checked]:border-radio-card-indicator-border-selected"
|
|
107
117
|
],
|
|
108
118
|
itemIndicatorContent: [
|
|
109
|
-
"data-[state=checked]:text-radio-card-
|
|
119
|
+
"data-[state=checked]:text-radio-card-fg-choice-selected"
|
|
110
120
|
]
|
|
111
121
|
},
|
|
112
122
|
subtle: {
|
|
@@ -123,14 +133,14 @@ const radioCardVariants = tv({
|
|
|
123
133
|
"data-[state=checked]:text-radio-card-item-description-fg-subtle-checked"
|
|
124
134
|
],
|
|
125
135
|
itemIndicator: [
|
|
126
|
-
"data-[state=checked]:border-radio-card-
|
|
136
|
+
"data-[state=checked]:border-radio-card-indicator-border-selected"
|
|
127
137
|
],
|
|
128
138
|
itemIndicatorContent: [
|
|
129
|
-
"data-[state=checked]:text-radio-card-
|
|
139
|
+
"data-[state=checked]:text-radio-card-fg-choice-selected"
|
|
130
140
|
],
|
|
131
141
|
itemAddon: [
|
|
132
142
|
"data-[state=checked]:border-radio-card-addon-border-subtle-checked",
|
|
133
|
-
"data-[state=checked]:text-radio-card-
|
|
143
|
+
"data-[state=checked]:text-radio-card-fg-choice-selected"
|
|
134
144
|
]
|
|
135
145
|
},
|
|
136
146
|
solid: {
|
|
@@ -147,15 +157,15 @@ const radioCardVariants = tv({
|
|
|
147
157
|
"data-[state=checked]:text-radio-card-item-description-fg-solid-checked"
|
|
148
158
|
],
|
|
149
159
|
itemIndicator: [
|
|
150
|
-
"data-[state=checked]:border-radio-card-
|
|
151
|
-
"data-[state=checked]:bg-radio-card-
|
|
160
|
+
"data-[state=checked]:border-radio-card-indicator-border-on-selected",
|
|
161
|
+
"data-[state=checked]:bg-radio-card-indicator-bg-selected"
|
|
152
162
|
],
|
|
153
163
|
itemIndicatorContent: [
|
|
154
|
-
"data-[state=checked]:text-radio-card-
|
|
164
|
+
"data-[state=checked]:text-radio-card-fg-on-selected"
|
|
155
165
|
],
|
|
156
166
|
itemAddon: [
|
|
157
167
|
"data-[state=checked]:border-radio-card-addon-border-solid-checked",
|
|
158
|
-
"data-[state=checked]:text-radio-card-
|
|
168
|
+
"data-[state=checked]:text-radio-card-item-fg-solid-checked"
|
|
159
169
|
]
|
|
160
170
|
}
|
|
161
171
|
},
|
|
@@ -265,6 +275,7 @@ const radioCardVariants = tv({
|
|
|
265
275
|
justify: "between"
|
|
266
276
|
}
|
|
267
277
|
});
|
|
278
|
+
const ignoreDescription = ()=>()=>void 0;
|
|
268
279
|
const RadioCardContext = /*#__PURE__*/ createContext(null);
|
|
269
280
|
function useRadioCardContext() {
|
|
270
281
|
const context = useContext(RadioCardContext);
|
|
@@ -277,22 +288,24 @@ function useRadioCardItemContext() {
|
|
|
277
288
|
if (!context) throw new Error("RadioCard item components must be used within RadioCard.Item");
|
|
278
289
|
return context;
|
|
279
290
|
}
|
|
280
|
-
function RadioCard({ "aria-describedby": ariaDescribedByProp, id: providedId, disabled = false, required = false, orientation = "horizontal", itemOrientation = "horizontal", align = "start", justify = "between", validateStatus = "default", onValueChange, variant = "outline", size = "md", children, className, ref, ...machineProps }) {
|
|
291
|
+
function RadioCard({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedByProp, id: providedId, disabled = false, readOnly = false, required = false, orientation = "horizontal", itemOrientation = "horizontal", align = "start", justify = "between", validateStatus = "default", onValueChange, variant = "outline", size = "md", children, className, ref, ...machineProps }) {
|
|
281
292
|
const generatedId = useId();
|
|
282
293
|
const id = providedId || generatedId;
|
|
283
294
|
const invalid = "error" === validateStatus;
|
|
284
|
-
const service = useMachine(
|
|
295
|
+
const service = useMachine(radioChoiceMachine, {
|
|
285
296
|
...machineProps,
|
|
286
297
|
id,
|
|
287
298
|
disabled,
|
|
299
|
+
readOnly: readOnly && !disabled,
|
|
288
300
|
required,
|
|
289
301
|
orientation,
|
|
290
302
|
invalid,
|
|
291
303
|
onValueChange: ({ value: nextValue })=>{
|
|
292
|
-
onValueChange?.(nextValue);
|
|
304
|
+
if (!(readOnly || disabled || isSilentChoiceReset(service.context))) onValueChange?.(nextValue);
|
|
293
305
|
}
|
|
294
306
|
});
|
|
295
307
|
const api = connect(service, normalizeProps);
|
|
308
|
+
const focusRef = useChoiceFocusRecovery();
|
|
296
309
|
const styles = radioCardVariants({
|
|
297
310
|
size,
|
|
298
311
|
variant,
|
|
@@ -300,12 +313,16 @@ function RadioCard({ "aria-describedby": ariaDescribedByProp, id: providedId, di
|
|
|
300
313
|
align,
|
|
301
314
|
justify
|
|
302
315
|
});
|
|
303
|
-
const
|
|
304
|
-
|
|
305
|
-
}, api.getRootProps());
|
|
316
|
+
const describedBy = useDescribedBy();
|
|
317
|
+
const errors = useDescribedBy();
|
|
306
318
|
return /*#__PURE__*/ jsx(RadioCardContext.Provider, {
|
|
307
319
|
value: {
|
|
308
320
|
api,
|
|
321
|
+
readOnly: readOnly && !disabled,
|
|
322
|
+
callerDescribedBy: ariaDescribedByProp,
|
|
323
|
+
errorMessageId: errors.describedById,
|
|
324
|
+
registerError: errors.registerDescription,
|
|
325
|
+
...describedBy,
|
|
309
326
|
variant,
|
|
310
327
|
size,
|
|
311
328
|
itemOrientation,
|
|
@@ -319,8 +336,19 @@ function RadioCard({ "aria-describedby": ariaDescribedByProp, id: providedId, di
|
|
|
319
336
|
className: styles.root({
|
|
320
337
|
className
|
|
321
338
|
}),
|
|
322
|
-
ref:
|
|
323
|
-
|
|
339
|
+
ref: (node)=>{
|
|
340
|
+
focusRef.current = node;
|
|
341
|
+
if ("function" == typeof ref) return ref(node);
|
|
342
|
+
if (ref) ref.current = node;
|
|
343
|
+
},
|
|
344
|
+
...api.getRootProps(),
|
|
345
|
+
"aria-describedby": joinDescribedBy(ariaDescribedByProp, describedBy.describedById),
|
|
346
|
+
"aria-errormessage": errors.describedById,
|
|
347
|
+
"aria-invalid": invalid || !!errors.describedById || void 0,
|
|
348
|
+
"aria-label": ariaLabel,
|
|
349
|
+
"aria-labelledby": ariaLabelledBy ?? (ariaLabel ? void 0 : api.getRootProps()["aria-labelledby"]),
|
|
350
|
+
role: "radiogroup",
|
|
351
|
+
tabIndex: -1,
|
|
324
352
|
children: children
|
|
325
353
|
})
|
|
326
354
|
});
|
|
@@ -347,10 +375,12 @@ RadioCard.Item = function({ value, disabled, invalid, children, className, ref,
|
|
|
347
375
|
disabled,
|
|
348
376
|
invalid
|
|
349
377
|
};
|
|
378
|
+
const descriptions = useDescribedBy();
|
|
350
379
|
const mergedItemProps = mergeProps(props, api.getItemProps(itemProps));
|
|
351
380
|
return /*#__PURE__*/ jsx(RadioCardItemContext.Provider, {
|
|
352
381
|
value: {
|
|
353
|
-
itemProps
|
|
382
|
+
itemProps,
|
|
383
|
+
...descriptions
|
|
354
384
|
},
|
|
355
385
|
children: /*#__PURE__*/ jsx("label", {
|
|
356
386
|
className: styles.item({
|
|
@@ -363,19 +393,43 @@ RadioCard.Item = function({ value, disabled, invalid, children, className, ref,
|
|
|
363
393
|
});
|
|
364
394
|
};
|
|
365
395
|
RadioCard.ItemHiddenInput = function({ className, ref, ...props }) {
|
|
366
|
-
const { api, size, variant } = useRadioCardContext();
|
|
367
|
-
const { itemProps } = useRadioCardItemContext();
|
|
396
|
+
const { api, size, variant, readOnly, callerDescribedBy, describedById, errorMessageId, validateStatus } = useRadioCardContext();
|
|
397
|
+
const { itemProps, describedById: itemDescriptionId } = useRadioCardItemContext();
|
|
368
398
|
const styles = radioCardVariants({
|
|
369
399
|
size,
|
|
370
400
|
variant
|
|
371
401
|
});
|
|
372
|
-
const hiddenInputProps =
|
|
402
|
+
const hiddenInputProps = getControlledChoiceInputProps(mergeChoiceInputProps(props, api.getItemHiddenInputProps(itemProps)), api.getItemState(itemProps).checked);
|
|
373
403
|
return /*#__PURE__*/ jsx("input", {
|
|
374
404
|
className: styles.hiddenInput({
|
|
375
405
|
className
|
|
376
406
|
}),
|
|
377
407
|
ref: ref,
|
|
378
|
-
...hiddenInputProps
|
|
408
|
+
...hiddenInputProps,
|
|
409
|
+
"aria-describedby": joinDescribedBy(props["aria-describedby"], callerDescribedBy, describedById, itemDescriptionId),
|
|
410
|
+
"aria-errormessage": "error" === validateStatus || errorMessageId ? errorMessageId : void 0,
|
|
411
|
+
"aria-invalid": api.getItemState(itemProps).invalid || !!errorMessageId || void 0,
|
|
412
|
+
disabled: api.getItemState(itemProps).disabled,
|
|
413
|
+
onKeyDown: (event)=>{
|
|
414
|
+
hiddenInputProps.onKeyDown?.(event);
|
|
415
|
+
if (!readOnly) handleChoiceArrowKey(event);
|
|
416
|
+
},
|
|
417
|
+
onKeyDownCapture: (event)=>{
|
|
418
|
+
props.onKeyDownCapture?.(event);
|
|
419
|
+
if (readOnly && [
|
|
420
|
+
" ",
|
|
421
|
+
"ArrowLeft",
|
|
422
|
+
"ArrowRight",
|
|
423
|
+
"ArrowUp",
|
|
424
|
+
"ArrowDown",
|
|
425
|
+
"Home",
|
|
426
|
+
"End"
|
|
427
|
+
].includes(event.key)) {
|
|
428
|
+
event.preventDefault();
|
|
429
|
+
event.stopPropagation();
|
|
430
|
+
}
|
|
431
|
+
},
|
|
432
|
+
readOnly: readOnly
|
|
379
433
|
});
|
|
380
434
|
};
|
|
381
435
|
RadioCard.ItemControl = function({ children, className, ref, ...props }) {
|
|
@@ -395,6 +449,7 @@ RadioCard.ItemControl = function({ children, className, ref, ...props }) {
|
|
|
395
449
|
}),
|
|
396
450
|
ref: ref,
|
|
397
451
|
...itemControlProps,
|
|
452
|
+
"aria-hidden": void 0,
|
|
398
453
|
children: children
|
|
399
454
|
});
|
|
400
455
|
};
|
|
@@ -436,7 +491,10 @@ RadioCard.ItemText = function({ children, className, ref, ...props }) {
|
|
|
436
491
|
};
|
|
437
492
|
RadioCard.ItemDescription = function({ children, className, ref, ...props }) {
|
|
438
493
|
const { api, size, variant, align } = useRadioCardContext();
|
|
439
|
-
const { itemProps } = useRadioCardItemContext();
|
|
494
|
+
const { itemProps, registerDescription } = useRadioCardItemContext();
|
|
495
|
+
const generatedId = useId();
|
|
496
|
+
const id = props.id ?? generatedId;
|
|
497
|
+
useRegisterDescription(id, registerDescription);
|
|
440
498
|
const styles = radioCardVariants({
|
|
441
499
|
size,
|
|
442
500
|
variant,
|
|
@@ -448,9 +506,11 @@ RadioCard.ItemDescription = function({ children, className, ref, ...props }) {
|
|
|
448
506
|
className
|
|
449
507
|
}),
|
|
450
508
|
"data-disabled": itemState.disabled || void 0,
|
|
509
|
+
"data-part": "item-description",
|
|
451
510
|
"data-state": itemState.checked ? "checked" : "unchecked",
|
|
452
511
|
ref: ref,
|
|
453
512
|
...props,
|
|
513
|
+
id: id,
|
|
454
514
|
children: children
|
|
455
515
|
});
|
|
456
516
|
};
|
|
@@ -466,6 +526,8 @@ RadioCard.ItemIndicator = function({ className, ref, ...props }) {
|
|
|
466
526
|
"aria-hidden": "true",
|
|
467
527
|
className: styles.itemIndicator(),
|
|
468
528
|
"data-disabled": itemState.disabled || void 0,
|
|
529
|
+
"data-part": "item-indicator",
|
|
530
|
+
"data-scope": "radio-group",
|
|
469
531
|
"data-state": itemState.checked ? "checked" : "unchecked",
|
|
470
532
|
ref: ref,
|
|
471
533
|
...props,
|
|
@@ -483,7 +545,10 @@ RadioCard.ItemIndicator = function({ className, ref, ...props }) {
|
|
|
483
545
|
};
|
|
484
546
|
RadioCard.ItemAddon = function({ children, className, ref, ...props }) {
|
|
485
547
|
const { api, size, variant, align } = useRadioCardContext();
|
|
486
|
-
const { itemProps } = useRadioCardItemContext();
|
|
548
|
+
const { itemProps, registerDescription } = useRadioCardItemContext();
|
|
549
|
+
const generatedId = useId();
|
|
550
|
+
const id = props.id ?? generatedId;
|
|
551
|
+
useRegisterDescription(id, registerDescription);
|
|
487
552
|
const styles = radioCardVariants({
|
|
488
553
|
size,
|
|
489
554
|
variant,
|
|
@@ -495,21 +560,28 @@ RadioCard.ItemAddon = function({ children, className, ref, ...props }) {
|
|
|
495
560
|
className
|
|
496
561
|
}),
|
|
497
562
|
"data-disabled": itemState.disabled || void 0,
|
|
563
|
+
"data-part": "item-addon",
|
|
498
564
|
"data-state": itemState.checked ? "checked" : "unchecked",
|
|
499
565
|
ref: ref,
|
|
500
566
|
...props,
|
|
567
|
+
id: id,
|
|
501
568
|
children: children
|
|
502
569
|
});
|
|
503
570
|
};
|
|
504
571
|
RadioCard.StatusText = function({ status, size: sizeProp, showIcon, children, ...props }) {
|
|
505
|
-
const { size, validateStatus } = useRadioCardContext();
|
|
572
|
+
const { size, validateStatus, registerDescription, registerError } = useRadioCardContext();
|
|
573
|
+
const generatedId = useId();
|
|
574
|
+
const id = props.id ?? generatedId;
|
|
506
575
|
const effectiveSize = sizeProp ?? size;
|
|
507
576
|
const effectiveStatus = status ?? validateStatus;
|
|
577
|
+
useRegisterDescription(id, registerDescription);
|
|
578
|
+
useRegisterDescription(id, "error" === effectiveStatus ? registerError : ignoreDescription);
|
|
508
579
|
return /*#__PURE__*/ jsx(StatusText, {
|
|
509
|
-
showIcon:
|
|
580
|
+
showIcon: "default" !== effectiveStatus || showIcon,
|
|
510
581
|
size: effectiveSize,
|
|
511
582
|
status: effectiveStatus,
|
|
512
583
|
...props,
|
|
584
|
+
id: id,
|
|
513
585
|
children: children
|
|
514
586
|
});
|
|
515
587
|
};
|