@techsio/ui-kit 0.55.0 → 0.56.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/dist/atoms/button.js +1 -1
- package/dist/atoms/icon.js +8 -2
- package/dist/atoms/rating.js +17 -4
- package/dist/atoms/skeleton.js +23 -4
- package/dist/atoms/status-text.js +2 -0
- package/dist/atoms/textarea.js +1 -1
- package/dist/internal/described-by.js +33 -0
- package/dist/internal/reduced-motion.js +11 -0
- package/dist/molecules/carousel.js +62 -63
- package/dist/molecules/cascade-select.js +2 -2
- package/dist/molecules/chart.js +6 -3
- package/dist/molecules/combobox.js +5 -4
- package/dist/molecules/file-upload.js +2 -1
- package/dist/molecules/form-input.js +7 -5
- package/dist/molecules/form-numeric-input.js +6 -4
- package/dist/molecules/form-textarea.js +7 -5
- package/dist/molecules/pagination.js +5 -1
- package/dist/molecules/phone-input.js +11 -3
- package/dist/molecules/product-card.js +2 -2
- package/dist/molecules/radio-group.js +10 -2
- package/dist/molecules/search-form.js +1 -0
- package/dist/molecules/select.js +14 -6
- package/dist/molecules/slider.js +7 -3
- package/dist/molecules/steps.js +33 -4
- package/dist/molecules/switch.js +5 -2
- package/dist/molecules/tabs.js +22 -7
- package/dist/molecules/tour.js +1 -1
- package/dist/organisms/data-table.fields.js +6 -2
- package/dist/organisms/data-table.js +51 -22
- package/dist/organisms/footer.js +22 -4
- package/dist/src/atoms/action-icon.d.ts +10 -2
- package/dist/src/atoms/action-icon.d.ts.map +1 -1
- package/dist/src/atoms/button.d.ts +4 -4
- package/dist/src/atoms/icon.d.ts +9 -4
- package/dist/src/atoms/icon.d.ts.map +1 -1
- package/dist/src/atoms/link-button.d.ts +4 -4
- package/dist/src/atoms/numeric-input.d.ts +1 -1
- package/dist/src/atoms/rating.d.ts +1 -1
- package/dist/src/atoms/rating.d.ts.map +1 -1
- package/dist/src/atoms/skeleton.d.ts +1 -1
- package/dist/src/atoms/skeleton.d.ts.map +1 -1
- package/dist/src/atoms/status-text.d.ts +1 -1
- package/dist/src/atoms/status-text.d.ts.map +1 -1
- package/dist/src/atoms/textarea.d.ts +4 -4
- package/dist/src/atoms/textarea.d.ts.map +1 -1
- package/dist/src/internal/described-by.d.ts +11 -0
- package/dist/src/internal/described-by.d.ts.map +1 -0
- package/dist/src/internal/reduced-motion.d.ts +2 -0
- package/dist/src/internal/reduced-motion.d.ts.map +1 -0
- package/dist/src/molecules/accordion.d.ts +2 -2
- package/dist/src/molecules/accordion.d.ts.map +1 -1
- package/dist/src/molecules/carousel.d.ts +19 -13
- package/dist/src/molecules/carousel.d.ts.map +1 -1
- package/dist/src/molecules/cascade-select.d.ts +1 -1
- package/dist/src/molecules/cascade-select.d.ts.map +1 -1
- package/dist/src/molecules/chart.d.ts +4 -1
- package/dist/src/molecules/chart.d.ts.map +1 -1
- package/dist/src/molecules/combobox.d.ts +1 -1
- package/dist/src/molecules/combobox.d.ts.map +1 -1
- package/dist/src/molecules/file-upload.d.ts +1 -1
- package/dist/src/molecules/file-upload.d.ts.map +1 -1
- package/dist/src/molecules/form-input.d.ts +5 -4
- package/dist/src/molecules/form-input.d.ts.map +1 -1
- package/dist/src/molecules/form-numeric-input.d.ts +1 -1
- package/dist/src/molecules/form-numeric-input.d.ts.map +1 -1
- package/dist/src/molecules/form-textarea.d.ts +5 -4
- package/dist/src/molecules/form-textarea.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 -2
- package/dist/src/molecules/phone-input.d.ts.map +1 -1
- package/dist/src/molecules/product-card.d.ts +6 -4
- package/dist/src/molecules/product-card.d.ts.map +1 -1
- package/dist/src/molecules/radio-group.d.ts +4 -2
- package/dist/src/molecules/radio-group.d.ts.map +1 -1
- package/dist/src/molecules/search-form.d.ts +1 -1
- package/dist/src/molecules/search-form.d.ts.map +1 -1
- package/dist/src/molecules/select.d.ts +3 -1
- package/dist/src/molecules/select.d.ts.map +1 -1
- package/dist/src/molecules/slider.d.ts +8 -3
- package/dist/src/molecules/slider.d.ts.map +1 -1
- package/dist/src/molecules/steps.d.ts +3 -0
- package/dist/src/molecules/steps.d.ts.map +1 -1
- package/dist/src/molecules/switch.d.ts.map +1 -1
- package/dist/src/molecules/tabs.d.ts.map +1 -1
- package/dist/src/molecules/tour.d.ts +1 -1
- package/dist/src/organisms/data-table.d.ts +1 -1
- package/dist/src/organisms/data-table.d.ts.map +1 -1
- package/dist/src/organisms/data-table.fields.d.ts +9 -1
- package/dist/src/organisms/data-table.fields.d.ts.map +1 -1
- package/dist/src/organisms/footer.d.ts +1 -1
- package/dist/src/organisms/footer.d.ts.map +1 -1
- package/dist/src/templates/accordion.d.ts +1 -1
- package/dist/src/templates/carousel.d.ts +1 -1
- package/dist/src/templates/numeric-input.d.ts +7 -3
- package/dist/src/templates/numeric-input.d.ts.map +1 -1
- package/dist/src/templates/product-card.d.ts +6 -4
- package/dist/src/templates/product-card.d.ts.map +1 -1
- package/dist/src/templates/select.d.ts +1 -1
- package/dist/src/templates/tabs.d.ts +1 -1
- package/dist/templates/product-card.js +2 -1
- package/package.json +1 -1
- package/src/tokens/_tokens-base.css +4 -0
- package/src/tokens/components/molecules/_vertical-navigation.css +0 -20
- package/src/tokens/components/molecules/_vertical-navigation.derived.css +27 -0
- package/src/tokens/figma/akros/variables.css +27 -8
- package/src/tokens/figma/brand-overrides.css +47 -45
- package/src/tokens/figma/business/variables.css +30 -11
- package/src/tokens/figma/dark/variables.css +29 -9
- package/src/tokens/figma/light/variables.css +302 -131
- package/src/tokens/figma/neo/variables.css +49 -30
- package/src/tokens/figma/neo-dark/variables.css +53 -34
- package/src/tokens/figma/variables.css +305 -134
package/dist/atoms/button.js
CHANGED
|
@@ -34,7 +34,7 @@ const buttonVariants = tv({
|
|
|
34
34
|
size: {
|
|
35
35
|
sm: "h-form-control-sm gap-button-sm rounded-button-sm p-button-sm text-button-sm",
|
|
36
36
|
md: "h-form-control-md gap-button-md rounded-button-md p-button-md text-button-md",
|
|
37
|
-
lg: "gap-button-lg rounded-button-lg p-button-lg text-button-lg",
|
|
37
|
+
lg: "h-form-control-lg gap-button-lg rounded-button-lg p-button-lg text-button-lg",
|
|
38
38
|
current: "gap-button-md text-inherit"
|
|
39
39
|
},
|
|
40
40
|
block: {
|
package/dist/atoms/icon.js
CHANGED
|
@@ -28,9 +28,15 @@ const iconVariants = tv({
|
|
|
28
28
|
color: "current"
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
-
function Icon({ icon, size, color, className, ...props }) {
|
|
31
|
+
function Icon({ icon, size, color, className, label, ...props }) {
|
|
32
|
+
const a11yProps = label ? {
|
|
33
|
+
role: "img",
|
|
34
|
+
"aria-label": label
|
|
35
|
+
} : {
|
|
36
|
+
"aria-hidden": true
|
|
37
|
+
};
|
|
32
38
|
return /*#__PURE__*/ jsx("span", {
|
|
33
|
-
|
|
39
|
+
...a11yProps,
|
|
34
40
|
className: `${iconVariants({
|
|
35
41
|
size,
|
|
36
42
|
color,
|
package/dist/atoms/rating.js
CHANGED
|
@@ -84,6 +84,8 @@ function Rating({ value, defaultValue, count = 5, labelText, readOnly = false, d
|
|
|
84
84
|
size,
|
|
85
85
|
isInteractive: !(readOnly || disabled)
|
|
86
86
|
});
|
|
87
|
+
const isDisplay = readOnly && !disabled;
|
|
88
|
+
const valueLabel = `${labelText ? `${labelText}: ` : ""}${api.value} out of ${count}`;
|
|
87
89
|
return /*#__PURE__*/ jsxs("div", {
|
|
88
90
|
className: root({
|
|
89
91
|
className
|
|
@@ -91,21 +93,29 @@ function Rating({ value, defaultValue, count = 5, labelText, readOnly = false, d
|
|
|
91
93
|
...api.getRootProps(),
|
|
92
94
|
...props,
|
|
93
95
|
children: [
|
|
94
|
-
labelText && /*#__PURE__*/ jsx(Label, {
|
|
96
|
+
labelText && (isDisplay ? /*#__PURE__*/ jsx(Label, {
|
|
97
|
+
"aria-hidden": true,
|
|
98
|
+
children: labelText
|
|
99
|
+
}) : /*#__PURE__*/ jsx(Label, {
|
|
95
100
|
...api.getLabelProps(),
|
|
96
101
|
children: labelText
|
|
97
|
-
}),
|
|
102
|
+
})),
|
|
98
103
|
/*#__PURE__*/ jsx("input", {
|
|
99
104
|
...api.getHiddenInputProps()
|
|
100
105
|
}),
|
|
101
106
|
/*#__PURE__*/ jsx("div", {
|
|
102
107
|
className: control(),
|
|
103
|
-
...
|
|
108
|
+
...isDisplay ? {
|
|
109
|
+
role: "img",
|
|
110
|
+
"aria-label": valueLabel
|
|
111
|
+
} : api.getControlProps(),
|
|
104
112
|
children: api.items.map((index)=>/*#__PURE__*/ jsx("div", {
|
|
105
113
|
className: itemWrapper(),
|
|
106
114
|
children: /*#__PURE__*/ jsx("span", {
|
|
107
115
|
className: item(),
|
|
108
|
-
...api.getItemProps({
|
|
116
|
+
...isDisplay ? pickDataAttributes(api.getItemProps({
|
|
117
|
+
index
|
|
118
|
+
})) : api.getItemProps({
|
|
109
119
|
index
|
|
110
120
|
})
|
|
111
121
|
})
|
|
@@ -114,4 +124,7 @@ function Rating({ value, defaultValue, count = 5, labelText, readOnly = false, d
|
|
|
114
124
|
]
|
|
115
125
|
});
|
|
116
126
|
}
|
|
127
|
+
function pickDataAttributes(props) {
|
|
128
|
+
return Object.fromEntries(Object.entries(props).filter(([key])=>key.startsWith("data-")));
|
|
129
|
+
}
|
|
117
130
|
export { Rating };
|
package/dist/atoms/skeleton.js
CHANGED
|
@@ -82,6 +82,22 @@ function useResolvedSkeletonProps(props) {
|
|
|
82
82
|
speed: props.speed ?? context?.speed
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
|
+
const LOADING_STATUS_PROPS = {
|
|
86
|
+
role: "status",
|
|
87
|
+
"aria-busy": true,
|
|
88
|
+
"aria-label": "Loading content"
|
|
89
|
+
};
|
|
90
|
+
function useSkeletonA11yProps(ariaHidden) {
|
|
91
|
+
const context = useSkeletonContext();
|
|
92
|
+
if (context) return {
|
|
93
|
+
"aria-hidden": true
|
|
94
|
+
};
|
|
95
|
+
if (true === ariaHidden || "true" === ariaHidden) return {
|
|
96
|
+
"aria-busy": true,
|
|
97
|
+
"aria-hidden": true
|
|
98
|
+
};
|
|
99
|
+
return LOADING_STATUS_PROPS;
|
|
100
|
+
}
|
|
85
101
|
function Skeleton({ isLoaded = false, variant, children, speed, className, ref, ...props }) {
|
|
86
102
|
const styles = skeletonVariants({
|
|
87
103
|
variant,
|
|
@@ -96,7 +112,7 @@ function Skeleton({ isLoaded = false, variant, children, speed, className, ref,
|
|
|
96
112
|
children: isLoaded ? /*#__PURE__*/ jsx(Fragment, {
|
|
97
113
|
children: children
|
|
98
114
|
}) : /*#__PURE__*/ jsx("div", {
|
|
99
|
-
|
|
115
|
+
...LOADING_STATUS_PROPS,
|
|
100
116
|
className: styles.root({
|
|
101
117
|
className
|
|
102
118
|
}),
|
|
@@ -112,6 +128,7 @@ Skeleton.Circle = function({ size = "md", speed, isLoaded, variant, children, cl
|
|
|
112
128
|
variant,
|
|
113
129
|
speed
|
|
114
130
|
});
|
|
131
|
+
const a11yProps = useSkeletonA11yProps(props["aria-hidden"]);
|
|
115
132
|
const styles = skeletonVariants({
|
|
116
133
|
size,
|
|
117
134
|
variant: resolved.variant,
|
|
@@ -121,7 +138,7 @@ Skeleton.Circle = function({ size = "md", speed, isLoaded, variant, children, cl
|
|
|
121
138
|
children: children
|
|
122
139
|
});
|
|
123
140
|
return /*#__PURE__*/ jsx("div", {
|
|
124
|
-
|
|
141
|
+
...a11yProps,
|
|
125
142
|
className: styles.root({
|
|
126
143
|
className: styles.circle({
|
|
127
144
|
className
|
|
@@ -137,6 +154,7 @@ Skeleton.Text = function({ noOfLines = 3, size = "md", speed, lastLineWidth = "8
|
|
|
137
154
|
variant,
|
|
138
155
|
speed
|
|
139
156
|
});
|
|
157
|
+
const a11yProps = useSkeletonA11yProps(props["aria-hidden"]);
|
|
140
158
|
const styles = skeletonVariants({
|
|
141
159
|
size,
|
|
142
160
|
variant: resolved.variant,
|
|
@@ -147,7 +165,7 @@ Skeleton.Text = function({ noOfLines = 3, size = "md", speed, lastLineWidth = "8
|
|
|
147
165
|
});
|
|
148
166
|
const lineCount = Number.isFinite(noOfLines) ? Math.max(1, noOfLines) : 1;
|
|
149
167
|
return /*#__PURE__*/ jsx("div", {
|
|
150
|
-
|
|
168
|
+
...a11yProps,
|
|
151
169
|
className: styles.textContainer({
|
|
152
170
|
className: containerClassName
|
|
153
171
|
}),
|
|
@@ -177,6 +195,7 @@ Skeleton.Rectangle = function({ speed, isLoaded, variant, children, className, r
|
|
|
177
195
|
variant,
|
|
178
196
|
speed
|
|
179
197
|
});
|
|
198
|
+
const a11yProps = useSkeletonA11yProps(props["aria-hidden"]);
|
|
180
199
|
const styles = skeletonVariants({
|
|
181
200
|
variant: resolved.variant,
|
|
182
201
|
speed: resolved.speed
|
|
@@ -185,7 +204,7 @@ Skeleton.Rectangle = function({ speed, isLoaded, variant, children, className, r
|
|
|
185
204
|
children: children
|
|
186
205
|
});
|
|
187
206
|
return /*#__PURE__*/ jsx("div", {
|
|
188
|
-
|
|
207
|
+
...a11yProps,
|
|
189
208
|
className: styles.root({
|
|
190
209
|
className: styles.rectangle({
|
|
191
210
|
className
|
|
@@ -46,6 +46,7 @@ const ICON_MAP = {
|
|
|
46
46
|
};
|
|
47
47
|
function StatusText({ className, showIcon = false, status = "default", size = "md", align = "center", icon, children, ref, ...props }) {
|
|
48
48
|
const resolvedIcon = icon ?? ICON_MAP[status];
|
|
49
|
+
const liveRole = "error" === status ? "alert" : "warning" === status || "success" === status ? "status" : void 0;
|
|
49
50
|
const { base, icon: iconSlot } = statusTextVariants({
|
|
50
51
|
status,
|
|
51
52
|
size,
|
|
@@ -59,6 +60,7 @@ function StatusText({ className, showIcon = false, status = "default", size = "m
|
|
|
59
60
|
className
|
|
60
61
|
}),
|
|
61
62
|
ref: ref,
|
|
63
|
+
role: liveRole,
|
|
62
64
|
...props,
|
|
63
65
|
children: [
|
|
64
66
|
showIcon && resolvedIcon && /*#__PURE__*/ jsx(Icon, {
|
package/dist/atoms/textarea.js
CHANGED
|
@@ -64,7 +64,7 @@ const textareaVariants = tv({
|
|
|
64
64
|
auto: "field-sizing-content resize-none"
|
|
65
65
|
},
|
|
66
66
|
readonly: {
|
|
67
|
-
true: "cursor-default border-textarea-border-disabled bg-textarea-bg-disabled
|
|
67
|
+
true: "cursor-default border-textarea-border-disabled bg-textarea-bg-disabled"
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
defaultVariants: {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useCallback, useEffect, useState } from "react";
|
|
2
|
+
function useDescribedBy() {
|
|
3
|
+
const [ids, setIds] = useState([]);
|
|
4
|
+
const registerDescription = useCallback((id)=>{
|
|
5
|
+
setIds((current)=>[
|
|
6
|
+
...current,
|
|
7
|
+
id
|
|
8
|
+
]);
|
|
9
|
+
return ()=>setIds((current)=>{
|
|
10
|
+
const index = current.indexOf(id);
|
|
11
|
+
return -1 === index ? current : [
|
|
12
|
+
...current.slice(0, index),
|
|
13
|
+
...current.slice(index + 1)
|
|
14
|
+
];
|
|
15
|
+
});
|
|
16
|
+
}, []);
|
|
17
|
+
return {
|
|
18
|
+
describedById: [
|
|
19
|
+
...new Set(ids)
|
|
20
|
+
].join(" ") || void 0,
|
|
21
|
+
registerDescription
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function useRegisterDescription(id, registerDescription) {
|
|
25
|
+
useEffect(()=>registerDescription(id), [
|
|
26
|
+
id,
|
|
27
|
+
registerDescription
|
|
28
|
+
]);
|
|
29
|
+
}
|
|
30
|
+
function joinDescribedBy(...ids) {
|
|
31
|
+
return ids.filter(Boolean).join(" ") || void 0;
|
|
32
|
+
}
|
|
33
|
+
export { joinDescribedBy, useDescribedBy, useRegisterDescription };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useSyncExternalStore } from "react";
|
|
2
|
+
const QUERY = "(prefers-reduced-motion: reduce)";
|
|
3
|
+
function subscribe(onChange) {
|
|
4
|
+
const media = window.matchMedia(QUERY);
|
|
5
|
+
media.addEventListener("change", onChange);
|
|
6
|
+
return ()=>media.removeEventListener("change", onChange);
|
|
7
|
+
}
|
|
8
|
+
function usePrefersReducedMotion() {
|
|
9
|
+
return useSyncExternalStore(subscribe, ()=>window.matchMedia(QUERY).matches, ()=>true);
|
|
10
|
+
}
|
|
11
|
+
export { usePrefersReducedMotion };
|
|
@@ -2,8 +2,9 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { normalizeProps, useMachine } from "@zag-js/react";
|
|
3
3
|
import { createContext, useContext, useId } from "react";
|
|
4
4
|
import { tv } from "tailwind-variants";
|
|
5
|
-
import {
|
|
5
|
+
import { ActionIcon } from "../atoms/action-icon.js";
|
|
6
6
|
import { Image } from "../atoms/image.js";
|
|
7
|
+
import { usePrefersReducedMotion } from "../internal/reduced-motion.js";
|
|
7
8
|
import * as __rspack_external__zag_js_carousel_a12b93a3 from "@zag-js/carousel";
|
|
8
9
|
const carouselVariants = tv({
|
|
9
10
|
slots: {
|
|
@@ -31,58 +32,41 @@ const carouselVariants = tv({
|
|
|
31
32
|
"overflow-hidden",
|
|
32
33
|
"data-[orientation=vertical]:size-full"
|
|
33
34
|
],
|
|
34
|
-
prevTrigger:
|
|
35
|
-
|
|
35
|
+
prevTrigger: [
|
|
36
|
+
"bg-carousel-trigger-bg-base text-carousel-trigger-fg-base",
|
|
37
|
+
"hover:bg-carousel-trigger-bg-hover hover:text-carousel-trigger-fg-hover"
|
|
38
|
+
],
|
|
39
|
+
nextTrigger: [
|
|
40
|
+
"bg-carousel-trigger-bg-base text-carousel-trigger-fg-base",
|
|
41
|
+
"hover:bg-carousel-trigger-bg-hover hover:text-carousel-trigger-fg-hover"
|
|
42
|
+
],
|
|
36
43
|
indicatorGroup: [
|
|
37
44
|
"flex w-full items-center justify-center gap-carousel-indicator"
|
|
38
45
|
],
|
|
39
46
|
indicator: [
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"data-current:border-carousel-indicator-border-active",
|
|
47
|
+
"group inline-flex shrink-0 cursor-pointer items-center justify-center",
|
|
48
|
+
"aspect-carousel-indicator w-carousel-indicator",
|
|
43
49
|
"rounded-carousel-indicator border border-carousel-indicator-border-base",
|
|
44
|
-
"
|
|
50
|
+
"data-current:border-carousel-indicator-border-active",
|
|
51
|
+
"text-carousel-trigger-fg-base",
|
|
52
|
+
"focus-visible:outline-(style:--default-ring-style) focus-visible:outline-(length:--default-ring-width)",
|
|
53
|
+
"focus-visible:outline-carousel-ring",
|
|
54
|
+
"focus-visible:outline-offset-(length:--default-ring-offset)"
|
|
45
55
|
],
|
|
46
|
-
|
|
47
|
-
"
|
|
48
|
-
"
|
|
56
|
+
indicatorDot: [
|
|
57
|
+
"size-carousel-indicator-dot rounded-carousel-indicator",
|
|
58
|
+
"bg-carousel-indicator-bg-base",
|
|
59
|
+
"group-data-current:bg-carousel-indicator-bg-active",
|
|
60
|
+
"transition-colors duration-200 motion-reduce:transition-none"
|
|
49
61
|
],
|
|
50
62
|
autoplayTrigger: [
|
|
51
63
|
"absolute top-carousel-trigger-top right-carousel-trigger-right z-50",
|
|
52
|
-
"bg-carousel-
|
|
64
|
+
"bg-carousel-control-bg"
|
|
53
65
|
],
|
|
54
66
|
spacer: [
|
|
55
67
|
"flex-1"
|
|
56
68
|
]
|
|
57
69
|
},
|
|
58
|
-
compoundSlots: [
|
|
59
|
-
{
|
|
60
|
-
slots: [
|
|
61
|
-
"autoplayTrigger",
|
|
62
|
-
"indicator",
|
|
63
|
-
"prevTrigger",
|
|
64
|
-
"nextTrigger"
|
|
65
|
-
],
|
|
66
|
-
class: [
|
|
67
|
-
"p-carousel-trigger",
|
|
68
|
-
"text-carousel-trigger-fg-base",
|
|
69
|
-
"focus-visible:outline-(style:--default-ring-style) focus-visible:outline-(length:--default-ring-width)",
|
|
70
|
-
"focus-visible:outline-carousel-ring",
|
|
71
|
-
"focus-visible:outline-offset-(length:--default-ring-offset)"
|
|
72
|
-
]
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
slots: [
|
|
76
|
-
"prevTrigger",
|
|
77
|
-
"nextTrigger"
|
|
78
|
-
],
|
|
79
|
-
class: [
|
|
80
|
-
"bg-carousel-trigger-bg-base text-carousel-trigger hover:bg-carousel-trigger-bg-hover",
|
|
81
|
-
"hover:text-carousel-trigger-fg-hover",
|
|
82
|
-
"transition-colors duration-200 motion-reduce:transition-none"
|
|
83
|
-
]
|
|
84
|
-
}
|
|
85
|
-
],
|
|
86
70
|
variants: {
|
|
87
71
|
objectFit: {
|
|
88
72
|
cover: {
|
|
@@ -179,17 +163,23 @@ const carouselVariants = tv({
|
|
|
179
163
|
}
|
|
180
164
|
});
|
|
181
165
|
const CarouselContext = /*#__PURE__*/ createContext(null);
|
|
166
|
+
function toTriggerSize(size) {
|
|
167
|
+
if ("sm" === size) return "sm";
|
|
168
|
+
if ("lg" === size || "full" === size) return "lg";
|
|
169
|
+
return "md";
|
|
170
|
+
}
|
|
182
171
|
const useCarouselContext = ()=>{
|
|
183
172
|
const context = useContext(CarouselContext);
|
|
184
173
|
if (!context) throw new Error("Carousel components must be used within Carousel.Root");
|
|
185
174
|
return context;
|
|
186
175
|
};
|
|
187
|
-
function Carousel({ id, size, objectFit, aspectRatio, orientation = "horizontal", slideCount = 1, loop = true, autoplay = false, allowMouseDrag = true, slidesPerPage = 1, slidesPerMove = 1, spacing = "0px", padding = "0px", dir = "ltr", snapType = "mandatory", className, children, width, height, onPageChange, ...props }) {
|
|
176
|
+
function Carousel({ id, size, objectFit, aspectRatio, orientation = "horizontal", slideCount = 1, loop = true, autoplay = false, allowMouseDrag = true, slidesPerPage = 1, slidesPerMove = 1, spacing = "0px", padding = "0px", dir = "ltr", snapType = "mandatory", className, children, width, height, onPageChange, "aria-label": ariaLabel, ...props }) {
|
|
188
177
|
const fallbackId = useId();
|
|
178
|
+
const prefersReducedMotion = usePrefersReducedMotion();
|
|
189
179
|
const service = useMachine(__rspack_external__zag_js_carousel_a12b93a3.machine, {
|
|
190
180
|
id: id ?? fallbackId,
|
|
191
181
|
slideCount,
|
|
192
|
-
autoplay,
|
|
182
|
+
autoplay: prefersReducedMotion ? false : autoplay,
|
|
193
183
|
orientation,
|
|
194
184
|
allowMouseDrag,
|
|
195
185
|
loop,
|
|
@@ -238,6 +228,7 @@ function Carousel({ id, size, objectFit, aspectRatio, orientation = "horizontal"
|
|
|
238
228
|
style: resolvedWrapperStyle,
|
|
239
229
|
children: /*#__PURE__*/ jsx("div", {
|
|
240
230
|
...rootProps,
|
|
231
|
+
"aria-label": ariaLabel,
|
|
241
232
|
className: root({
|
|
242
233
|
className
|
|
243
234
|
}),
|
|
@@ -287,39 +278,47 @@ Carousel.Slide = function({ index, children, size: overrideSize, className }) {
|
|
|
287
278
|
const itemProps = api.getItemProps({
|
|
288
279
|
index
|
|
289
280
|
});
|
|
281
|
+
const hidden = true === itemProps["aria-hidden"] || "true" === itemProps["aria-hidden"];
|
|
290
282
|
return /*#__PURE__*/ jsx("div", {
|
|
291
283
|
...itemProps,
|
|
292
284
|
className: slideSlot({
|
|
293
285
|
className
|
|
294
286
|
}),
|
|
287
|
+
inert: hidden || void 0,
|
|
295
288
|
children: children
|
|
296
289
|
});
|
|
297
290
|
};
|
|
298
291
|
Carousel.Previous = function({ className, icon = "token-icon-carousel-prev" }) {
|
|
299
|
-
const { api } = useCarouselContext();
|
|
292
|
+
const { api, size } = useCarouselContext();
|
|
300
293
|
const { prevTrigger } = carouselVariants();
|
|
301
|
-
|
|
294
|
+
const triggerProps = api.getPrevTriggerProps();
|
|
295
|
+
return /*#__PURE__*/ jsx(ActionIcon, {
|
|
302
296
|
className: prevTrigger({
|
|
303
297
|
className
|
|
304
298
|
}),
|
|
305
|
-
|
|
299
|
+
size: toTriggerSize(size),
|
|
300
|
+
...triggerProps,
|
|
301
|
+
"aria-label": triggerProps["aria-label"] ?? "Previous slide",
|
|
306
302
|
icon: icon
|
|
307
303
|
});
|
|
308
304
|
};
|
|
309
305
|
Carousel.Next = function({ className, icon = "token-icon-carousel-next" }) {
|
|
310
|
-
const { api } = useCarouselContext();
|
|
306
|
+
const { api, size } = useCarouselContext();
|
|
311
307
|
const { nextTrigger } = carouselVariants();
|
|
312
|
-
|
|
308
|
+
const triggerProps = api.getNextTriggerProps();
|
|
309
|
+
return /*#__PURE__*/ jsx(ActionIcon, {
|
|
313
310
|
className: nextTrigger({
|
|
314
311
|
className
|
|
315
312
|
}),
|
|
316
|
-
|
|
313
|
+
size: toTriggerSize(size),
|
|
314
|
+
...triggerProps,
|
|
315
|
+
"aria-label": triggerProps["aria-label"] ?? "Next slide",
|
|
317
316
|
icon: icon
|
|
318
317
|
});
|
|
319
318
|
};
|
|
320
319
|
Carousel.Indicators = function({ className, children }) {
|
|
321
320
|
const { api } = useCarouselContext();
|
|
322
|
-
const { indicatorGroup
|
|
321
|
+
const { indicatorGroup } = carouselVariants();
|
|
323
322
|
if (children) return /*#__PURE__*/ jsx("div", {
|
|
324
323
|
className: indicatorGroup({
|
|
325
324
|
className
|
|
@@ -332,40 +331,40 @@ Carousel.Indicators = function({ className, children }) {
|
|
|
332
331
|
className
|
|
333
332
|
}),
|
|
334
333
|
...api.getIndicatorGroupProps(),
|
|
335
|
-
children: api.pageSnapPoints.map((_, index)=>/*#__PURE__*/ jsx(
|
|
336
|
-
|
|
337
|
-
size: "current",
|
|
338
|
-
theme: "unstyled",
|
|
339
|
-
...api.getIndicatorProps({
|
|
340
|
-
index
|
|
341
|
-
})
|
|
334
|
+
children: api.pageSnapPoints.map((_, index)=>/*#__PURE__*/ jsx(Carousel.Indicator, {
|
|
335
|
+
index: index
|
|
342
336
|
}, `indicator-${index}`))
|
|
343
337
|
});
|
|
344
338
|
};
|
|
345
339
|
Carousel.Indicator = function({ index, className, children }) {
|
|
346
340
|
const { api } = useCarouselContext();
|
|
347
|
-
const { indicator } = carouselVariants();
|
|
348
|
-
return /*#__PURE__*/ jsx(
|
|
341
|
+
const { indicator, indicatorDot } = carouselVariants();
|
|
342
|
+
return /*#__PURE__*/ jsx("button", {
|
|
349
343
|
className: indicator({
|
|
350
344
|
className
|
|
351
345
|
}),
|
|
352
|
-
|
|
353
|
-
theme: "unstyled",
|
|
346
|
+
type: "button",
|
|
354
347
|
...api.getIndicatorProps({
|
|
355
348
|
index
|
|
356
349
|
}),
|
|
357
|
-
children: children
|
|
350
|
+
children: children ?? /*#__PURE__*/ jsx("span", {
|
|
351
|
+
"aria-hidden": "true",
|
|
352
|
+
className: indicatorDot()
|
|
353
|
+
})
|
|
358
354
|
});
|
|
359
355
|
};
|
|
360
356
|
Carousel.Autoplay = function({ className }) {
|
|
361
|
-
const { api } = useCarouselContext();
|
|
357
|
+
const { api, size } = useCarouselContext();
|
|
362
358
|
const { autoplayTrigger: autoplayTriggerSlot } = carouselVariants();
|
|
363
|
-
|
|
359
|
+
const triggerProps = api.getAutoplayTriggerProps();
|
|
360
|
+
return /*#__PURE__*/ jsx(ActionIcon, {
|
|
364
361
|
className: autoplayTriggerSlot({
|
|
365
362
|
className
|
|
366
363
|
}),
|
|
367
364
|
icon: api.isPlaying ? "token-icon-carousel-pause" : "token-icon-carousel-play",
|
|
368
|
-
|
|
365
|
+
size: toTriggerSize(size),
|
|
366
|
+
...triggerProps,
|
|
367
|
+
"aria-label": triggerProps["aria-label"] ?? (api.isPlaying ? "Stop slide rotation" : "Start slide rotation")
|
|
369
368
|
});
|
|
370
369
|
};
|
|
371
370
|
Carousel.Control = function({ children, className, controlPosition }) {
|
|
@@ -90,7 +90,7 @@ const cascadeSelectVariants = tv({
|
|
|
90
90
|
variants: {
|
|
91
91
|
size: {
|
|
92
92
|
xs: {
|
|
93
|
-
trigger: "p-cascade-select-trigger-sm text-cascade-select-trigger-xs",
|
|
93
|
+
trigger: "h-form-control-sm rounded-cascade-select-sm p-cascade-select-trigger-sm text-cascade-select-trigger-xs",
|
|
94
94
|
content: "popup-size-xs text-cascade-select-item-xs",
|
|
95
95
|
valueText: "text-cascade-select-value-xs"
|
|
96
96
|
},
|
|
@@ -105,7 +105,7 @@ const cascadeSelectVariants = tv({
|
|
|
105
105
|
valueText: "text-cascade-select-value-md"
|
|
106
106
|
},
|
|
107
107
|
lg: {
|
|
108
|
-
trigger: "p-cascade-select-trigger-md text-cascade-select-trigger-lg",
|
|
108
|
+
trigger: "h-form-control-lg rounded-cascade-select-lg p-cascade-select-trigger-md text-cascade-select-trigger-lg",
|
|
109
109
|
content: "popup-size-lg text-cascade-select-item-lg",
|
|
110
110
|
valueText: "text-cascade-select-value-lg"
|
|
111
111
|
}
|
package/dist/molecules/chart.js
CHANGED
|
@@ -10,6 +10,7 @@ import { tooltip as tooltip_tooltip } from "@tanstack/charts/tooltip";
|
|
|
10
10
|
import { scaleUtc } from "d3-scale";
|
|
11
11
|
import { curveMonotoneX, pie } from "d3-shape";
|
|
12
12
|
import { useMemo } from "react";
|
|
13
|
+
import { usePrefersReducedMotion } from "../internal/reduced-motion.js";
|
|
13
14
|
import { tv } from "../utils.js";
|
|
14
15
|
const chartVariants = tv({
|
|
15
16
|
slots: {
|
|
@@ -389,9 +390,11 @@ function renderCartesianChartSvg(scene, options) {
|
|
|
389
390
|
nodes
|
|
390
391
|
}, options);
|
|
391
392
|
}
|
|
392
|
-
function chart_Chart({ type = "line", data, x, y, series, stacked, points = false, smooth = false, grid = true, legend, legendLabel, xLabel, yLabel, formatValue, height, aspectRatio, initialWidth = 640, animate
|
|
393
|
+
function chart_Chart({ type = "line", data, x, y, series, stacked, points = false, smooth = false, grid = true, legend, legendLabel, xLabel, yLabel, formatValue, height, aspectRatio, initialWidth = 640, animate, tooltip = true, ariaLabel, ariaDescription, className, onSelect }) {
|
|
393
394
|
const { root, tooltip: tooltipSlot } = chartVariants();
|
|
394
395
|
const tooltipClassName = tooltipSlot();
|
|
396
|
+
const prefersReducedMotion = usePrefersReducedMotion();
|
|
397
|
+
const shouldAnimate = animate ?? !prefersReducedMotion;
|
|
395
398
|
const definition = useMemo(()=>buildChartDefinition({
|
|
396
399
|
type,
|
|
397
400
|
data,
|
|
@@ -407,7 +410,7 @@ function chart_Chart({ type = "line", data, x, y, series, stacked, points = fals
|
|
|
407
410
|
xLabel,
|
|
408
411
|
yLabel,
|
|
409
412
|
formatValue,
|
|
410
|
-
animate,
|
|
413
|
+
animate: shouldAnimate,
|
|
411
414
|
showTooltip: tooltip,
|
|
412
415
|
tooltipClassName
|
|
413
416
|
}), [
|
|
@@ -425,7 +428,7 @@ function chart_Chart({ type = "line", data, x, y, series, stacked, points = fals
|
|
|
425
428
|
xLabel,
|
|
426
429
|
yLabel,
|
|
427
430
|
formatValue,
|
|
428
|
-
|
|
431
|
+
shouldAnimate,
|
|
429
432
|
tooltip,
|
|
430
433
|
tooltipClassName
|
|
431
434
|
]);
|
|
@@ -66,10 +66,10 @@ const comboboxVariants = tv({
|
|
|
66
66
|
],
|
|
67
67
|
groupLabel: [
|
|
68
68
|
"combobox-popup-padding",
|
|
69
|
-
"
|
|
69
|
+
"font-combobox-group-label text-combobox-group-fg text-combobox-group-label-size"
|
|
70
70
|
],
|
|
71
71
|
footer: [
|
|
72
|
-
"combobox-popup-padding shrink-0 border-
|
|
72
|
+
"combobox-popup-padding shrink-0 border-combobox-footer-border border-t"
|
|
73
73
|
],
|
|
74
74
|
itemText: [
|
|
75
75
|
"min-w-0 flex-grow truncate"
|
|
@@ -143,7 +143,7 @@ const comboboxVariants = tv({
|
|
|
143
143
|
},
|
|
144
144
|
lg: {
|
|
145
145
|
root: "gap-combobox-lg",
|
|
146
|
-
control: "rounded-combobox text-input-lg",
|
|
146
|
+
control: "h-form-control-lg rounded-combobox-lg text-input-lg",
|
|
147
147
|
input: "p-combobox-input-lg",
|
|
148
148
|
content: "popup-size-lg text-combobox-item-lg",
|
|
149
149
|
triggerIndicator: "text-icon-control-lg"
|
|
@@ -241,7 +241,7 @@ function Combobox({ id, name, label, size, placeholder = "Select option", disabl
|
|
|
241
241
|
size
|
|
242
242
|
});
|
|
243
243
|
const hasOptions = api.collection.size > 0;
|
|
244
|
-
const showEmptyState = !resultsHidden
|
|
244
|
+
const showEmptyState = !(resultsHidden || hasOptions) && Boolean(api.inputValue);
|
|
245
245
|
let state = "idle";
|
|
246
246
|
if (loading) state = "loading";
|
|
247
247
|
else if (error) state = "error";
|
|
@@ -331,6 +331,7 @@ function Combobox({ id, name, label, size, placeholder = "Select option", disabl
|
|
|
331
331
|
size: size ?? "md",
|
|
332
332
|
tone: "neutral",
|
|
333
333
|
...api.getClearTriggerProps(),
|
|
334
|
+
"aria-label": api.getClearTriggerProps()["aria-label"] ?? "Clear value",
|
|
334
335
|
disabled: disabled || readOnly,
|
|
335
336
|
hidden: false,
|
|
336
337
|
onClick: (event)=>{
|
|
@@ -338,7 +338,8 @@ FileUpload.ItemDeleteTrigger = function({ className, disabled, icon = "token-ico
|
|
|
338
338
|
size: "md",
|
|
339
339
|
tone: "neutral",
|
|
340
340
|
type: "button",
|
|
341
|
-
...deleteProps
|
|
341
|
+
...deleteProps,
|
|
342
|
+
"aria-label": deleteProps["aria-label"] ?? `Delete file ${file.name}`
|
|
342
343
|
});
|
|
343
344
|
};
|
|
344
345
|
FileUpload.ClearTrigger = function({ "aria-label": ariaLabel = "Clear files", className, disabled, icon = "token-icon-file-upload-clear", onClick, ref, ...props }) {
|
|
@@ -4,19 +4,21 @@ import { Input } from "../atoms/input.js";
|
|
|
4
4
|
import { Label } from "../atoms/label.js";
|
|
5
5
|
import { StatusText } from "../atoms/status-text.js";
|
|
6
6
|
function FormInputRaw({ id, label, validateStatus = "default", helpText, size = "md", required, disabled, ...props }) {
|
|
7
|
+
const generatedId = useId();
|
|
8
|
+
const controlId = id || generatedId;
|
|
7
9
|
return /*#__PURE__*/ jsxs("div", {
|
|
8
10
|
className: "flex flex-col gap-form-field-gap",
|
|
9
11
|
children: [
|
|
10
12
|
/*#__PURE__*/ jsx(Label, {
|
|
11
13
|
disabled: disabled,
|
|
12
|
-
htmlFor:
|
|
14
|
+
htmlFor: controlId,
|
|
13
15
|
required: required,
|
|
14
16
|
size: size,
|
|
15
17
|
children: label
|
|
16
18
|
}),
|
|
17
19
|
/*#__PURE__*/ jsx(Input, {
|
|
18
20
|
disabled: disabled,
|
|
19
|
-
id:
|
|
21
|
+
id: controlId,
|
|
20
22
|
required: required,
|
|
21
23
|
size: size,
|
|
22
24
|
variant: validateStatus,
|
|
@@ -34,18 +36,18 @@ function FormInput({ helpText, id, validateStatus = "default", showHelpTextIcon
|
|
|
34
36
|
helpText ? helpTextId : void 0
|
|
35
37
|
].filter(Boolean).join(" ") || void 0;
|
|
36
38
|
return /*#__PURE__*/ jsx(FormInputRaw, {
|
|
39
|
+
"aria-describedby": describedBy,
|
|
40
|
+
"aria-invalid": "error" === validateStatus ? true : ariaInvalid,
|
|
37
41
|
helpText: helpText && /*#__PURE__*/ jsx(StatusText, {
|
|
38
42
|
id: helpTextId,
|
|
39
|
-
status: validateStatus,
|
|
40
43
|
showIcon: showHelpTextIcon,
|
|
41
44
|
size: size,
|
|
45
|
+
status: validateStatus,
|
|
42
46
|
children: helpText
|
|
43
47
|
}),
|
|
44
48
|
id: id,
|
|
45
49
|
size: size,
|
|
46
50
|
validateStatus: validateStatus,
|
|
47
|
-
"aria-invalid": "error" === validateStatus ? true : ariaInvalid,
|
|
48
|
-
"aria-describedby": describedBy,
|
|
49
51
|
...props
|
|
50
52
|
});
|
|
51
53
|
}
|
|
@@ -4,7 +4,9 @@ import { Label } from "../atoms/label.js";
|
|
|
4
4
|
import { NumericInput } from "../atoms/numeric-input.js";
|
|
5
5
|
import { StatusText } from "../atoms/status-text.js";
|
|
6
6
|
function FormNumericInput({ id, ids, label, validateStatus = "default", helpText, showHelpTextIcon = "default" !== validateStatus, size = "md", required, disabled, describedBy, children, ...numericInputProps }) {
|
|
7
|
-
const
|
|
7
|
+
const generatedId = useId();
|
|
8
|
+
const fieldId = id || generatedId;
|
|
9
|
+
const inputId = ids?.input ?? fieldId;
|
|
8
10
|
const helpTextId = useId();
|
|
9
11
|
const mergedDescribedBy = [
|
|
10
12
|
describedBy,
|
|
@@ -21,21 +23,21 @@ function FormNumericInput({ id, ids, label, validateStatus = "default", helpText
|
|
|
21
23
|
children: label
|
|
22
24
|
}),
|
|
23
25
|
/*#__PURE__*/ jsx(NumericInput, {
|
|
26
|
+
describedBy: mergedDescribedBy,
|
|
24
27
|
disabled: disabled,
|
|
25
|
-
id:
|
|
28
|
+
id: fieldId,
|
|
26
29
|
ids: ids,
|
|
27
30
|
invalid: "error" === validateStatus,
|
|
28
31
|
required: required,
|
|
29
32
|
size: size,
|
|
30
|
-
describedBy: mergedDescribedBy,
|
|
31
33
|
...numericInputProps,
|
|
32
34
|
children: children
|
|
33
35
|
}),
|
|
34
36
|
helpText && /*#__PURE__*/ jsx(StatusText, {
|
|
35
37
|
id: helpTextId,
|
|
36
|
-
status: validateStatus,
|
|
37
38
|
showIcon: showHelpTextIcon,
|
|
38
39
|
size: size,
|
|
40
|
+
status: validateStatus,
|
|
39
41
|
children: helpText
|
|
40
42
|
})
|
|
41
43
|
]
|