@techsio/ui-kit 0.55.0 → 0.56.1
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 +30 -0
- package/dist/atoms/button.js +2 -2
- package/dist/atoms/checkbox.js +1 -1
- package/dist/atoms/icon.js +8 -2
- package/dist/atoms/input.js +2 -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-checkbox.js +1 -1
- package/dist/molecules/form-input.js +15 -7
- 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/checkbox.d.ts +1 -1
- package/dist/src/atoms/icon.d.ts +9 -4
- package/dist/src/atoms/icon.d.ts.map +1 -1
- package/dist/src/atoms/input.d.ts +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 +6 -5
- 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/src/utils.d.ts.map +1 -1
- package/dist/templates/product-card.js +2 -1
- package/dist/utils.js +16 -0
- package/package.json +1 -1
- package/src/tokens/_tokens-base.css +4 -0
- package/src/tokens/components/atoms/_button.css +3 -0
- package/src/tokens/components/atoms/_input.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
|
@@ -3,25 +3,33 @@ import { useId } from "react";
|
|
|
3
3
|
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
|
+
import { tv } from "../utils.js";
|
|
7
|
+
const formInputVariants = tv({
|
|
8
|
+
base: "p-input-sm md:p-input-md"
|
|
9
|
+
});
|
|
10
|
+
function FormInputRaw({ id, label, validateStatus = "default", helpText, size = "md", required, disabled, className, ...props }) {
|
|
11
|
+
const generatedId = useId();
|
|
12
|
+
const controlId = id || generatedId;
|
|
7
13
|
return /*#__PURE__*/ jsxs("div", {
|
|
8
14
|
className: "flex flex-col gap-form-field-gap",
|
|
9
15
|
children: [
|
|
10
16
|
/*#__PURE__*/ jsx(Label, {
|
|
11
17
|
disabled: disabled,
|
|
12
|
-
htmlFor:
|
|
18
|
+
htmlFor: controlId,
|
|
13
19
|
required: required,
|
|
14
20
|
size: size,
|
|
15
21
|
children: label
|
|
16
22
|
}),
|
|
17
23
|
/*#__PURE__*/ jsx(Input, {
|
|
18
24
|
disabled: disabled,
|
|
19
|
-
id:
|
|
25
|
+
id: controlId,
|
|
20
26
|
required: required,
|
|
21
27
|
size: size,
|
|
22
28
|
variant: validateStatus,
|
|
23
29
|
...props,
|
|
24
|
-
className:
|
|
30
|
+
className: formInputVariants({
|
|
31
|
+
className
|
|
32
|
+
})
|
|
25
33
|
}),
|
|
26
34
|
helpText
|
|
27
35
|
]
|
|
@@ -34,18 +42,18 @@ function FormInput({ helpText, id, validateStatus = "default", showHelpTextIcon
|
|
|
34
42
|
helpText ? helpTextId : void 0
|
|
35
43
|
].filter(Boolean).join(" ") || void 0;
|
|
36
44
|
return /*#__PURE__*/ jsx(FormInputRaw, {
|
|
45
|
+
"aria-describedby": describedBy,
|
|
46
|
+
"aria-invalid": "error" === validateStatus ? true : ariaInvalid,
|
|
37
47
|
helpText: helpText && /*#__PURE__*/ jsx(StatusText, {
|
|
38
48
|
id: helpTextId,
|
|
39
|
-
status: validateStatus,
|
|
40
49
|
showIcon: showHelpTextIcon,
|
|
41
50
|
size: size,
|
|
51
|
+
status: validateStatus,
|
|
42
52
|
children: helpText
|
|
43
53
|
}),
|
|
44
54
|
id: id,
|
|
45
55
|
size: size,
|
|
46
56
|
validateStatus: validateStatus,
|
|
47
|
-
"aria-invalid": "error" === validateStatus ? true : ariaInvalid,
|
|
48
|
-
"aria-describedby": describedBy,
|
|
49
57
|
...props
|
|
50
58
|
});
|
|
51
59
|
}
|
|
@@ -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
|
]
|
|
@@ -4,19 +4,21 @@ import { Label } from "../atoms/label.js";
|
|
|
4
4
|
import { StatusText } from "../atoms/status-text.js";
|
|
5
5
|
import { Textarea } from "../atoms/textarea.js";
|
|
6
6
|
function FormTextareaRaw({ 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(Textarea, {
|
|
18
20
|
disabled: disabled,
|
|
19
|
-
id:
|
|
21
|
+
id: controlId,
|
|
20
22
|
required: required,
|
|
21
23
|
size: size,
|
|
22
24
|
variant: validateStatus,
|
|
@@ -33,18 +35,18 @@ function FormTextarea({ helpText, id, validateStatus = "default", showHelpTextIc
|
|
|
33
35
|
helpText ? helpTextId : void 0
|
|
34
36
|
].filter(Boolean).join(" ") || void 0;
|
|
35
37
|
return /*#__PURE__*/ jsx(FormTextareaRaw, {
|
|
38
|
+
"aria-describedby": describedBy,
|
|
39
|
+
"aria-invalid": "error" === validateStatus ? true : ariaInvalid,
|
|
36
40
|
helpText: helpText && /*#__PURE__*/ jsx(StatusText, {
|
|
37
41
|
id: helpTextId,
|
|
38
|
-
status: validateStatus,
|
|
39
42
|
showIcon: showHelpTextIcon,
|
|
40
43
|
size: size,
|
|
44
|
+
status: validateStatus,
|
|
41
45
|
children: helpText
|
|
42
46
|
}),
|
|
43
47
|
id: id,
|
|
44
48
|
size: size,
|
|
45
49
|
validateStatus: validateStatus,
|
|
46
|
-
"aria-invalid": "error" === validateStatus ? true : ariaInvalid,
|
|
47
|
-
"aria-describedby": describedBy,
|
|
48
50
|
...props
|
|
49
51
|
});
|
|
50
52
|
}
|
|
@@ -131,7 +131,9 @@ function Pagination({ page, defaultPage = 1, count, pageSize = 10, siblingCount
|
|
|
131
131
|
variant,
|
|
132
132
|
size
|
|
133
133
|
});
|
|
134
|
-
const rootProps = mergeProps(props, api.getRootProps()
|
|
134
|
+
const rootProps = mergeProps(props, api.getRootProps(), props["aria-label"] ? {
|
|
135
|
+
"aria-label": props["aria-label"]
|
|
136
|
+
} : {});
|
|
135
137
|
const sharedLinkProps = linkProps && "object" == typeof linkProps ? (({ href: _ignoredHref, ...rest })=>rest)(linkProps) : void 0;
|
|
136
138
|
const getTriggerButtonProps = (triggerProps, overrides = {})=>{
|
|
137
139
|
const isNavigable = hasHref(triggerProps);
|
|
@@ -146,6 +148,8 @@ function Pagination({ page, defaultPage = 1, count, pageSize = 10, siblingCount
|
|
|
146
148
|
as: linkAs
|
|
147
149
|
} : {},
|
|
148
150
|
...isNavigable ? {} : {
|
|
151
|
+
as: "button",
|
|
152
|
+
type: "button",
|
|
149
153
|
disabled: true,
|
|
150
154
|
role: triggerProps.role ?? sharedLinkProps?.role ?? "link"
|
|
151
155
|
}
|
|
@@ -4,6 +4,7 @@ import { createContext, useCallback, useContext, useEffect, useId, useMemo, useR
|
|
|
4
4
|
import { Input } from "../atoms/input.js";
|
|
5
5
|
import { Label } from "../atoms/label.js";
|
|
6
6
|
import { StatusText } from "../atoms/status-text.js";
|
|
7
|
+
import { joinDescribedBy, useDescribedBy, useRegisterDescription } from "../internal/described-by.js";
|
|
7
8
|
import { tv } from "../utils.js";
|
|
8
9
|
import { Select } from "./select.js";
|
|
9
10
|
const defaultNativeValidationMessage = "Enter a valid phone number.";
|
|
@@ -213,6 +214,7 @@ function PhoneInput({ countries: countriesProp = defaultPhoneInputCountries, val
|
|
|
213
214
|
const styles = phoneInputVariants({
|
|
214
215
|
size
|
|
215
216
|
});
|
|
217
|
+
const describedBy = useDescribedBy();
|
|
216
218
|
return /*#__PURE__*/ jsxs(PhoneInputContext.Provider, {
|
|
217
219
|
value: {
|
|
218
220
|
countries,
|
|
@@ -231,7 +233,9 @@ function PhoneInput({ countries: countriesProp = defaultPhoneInputCountries, val
|
|
|
231
233
|
nativeValidationMessage,
|
|
232
234
|
readOnly,
|
|
233
235
|
required,
|
|
234
|
-
validateStatus
|
|
236
|
+
validateStatus,
|
|
237
|
+
statusTextId: `${id}-status`,
|
|
238
|
+
...describedBy
|
|
235
239
|
},
|
|
236
240
|
children: [
|
|
237
241
|
name && /*#__PURE__*/ jsx("input", {
|
|
@@ -423,7 +427,7 @@ PhoneInput.CountryCallingCode = function({ item, className, ref, ...props }) {
|
|
|
423
427
|
});
|
|
424
428
|
};
|
|
425
429
|
PhoneInput.Input = function({ className, onChange, placeholder = "Phone number", ref, ...props }) {
|
|
426
|
-
const { details, disabled, form, inputId, inputValue, nativeValidation, nativeValidationMessage, readOnly, required, setInputValue, size, validateStatus } = usePhoneInputContext();
|
|
430
|
+
const { details, disabled, form, inputId, inputValue, nativeValidation, nativeValidationMessage, readOnly, required, setInputValue, size, describedById, validateStatus } = usePhoneInputContext();
|
|
427
431
|
const styles = phoneInputVariants({
|
|
428
432
|
size
|
|
429
433
|
});
|
|
@@ -449,6 +453,7 @@ PhoneInput.Input = function({ className, onChange, placeholder = "Phone number",
|
|
|
449
453
|
]);
|
|
450
454
|
return /*#__PURE__*/ jsx(Input, {
|
|
451
455
|
...props,
|
|
456
|
+
"aria-describedby": joinDescribedBy(props["aria-describedby"], describedById),
|
|
452
457
|
"aria-invalid": "error" === validateStatus || nativeValidation && "" !== inputValue.trim() && !details.isValid || void 0,
|
|
453
458
|
className: styles.input({
|
|
454
459
|
className
|
|
@@ -544,12 +549,15 @@ PhoneInput.ItemText = PhoneInput.CountryItemText;
|
|
|
544
549
|
PhoneInput.ItemMeta = PhoneInput.CountryItemMeta;
|
|
545
550
|
PhoneInput.ItemIndicator = PhoneInput.CountryItemIndicator;
|
|
546
551
|
PhoneInput.StatusText = function({ status, showIcon, children, ...props }) {
|
|
547
|
-
const { size, validateStatus } = usePhoneInputContext();
|
|
552
|
+
const { size, validateStatus, statusTextId, registerDescription } = usePhoneInputContext();
|
|
553
|
+
const id = props.id ?? statusTextId;
|
|
554
|
+
useRegisterDescription(id, registerDescription);
|
|
548
555
|
return /*#__PURE__*/ jsx(StatusText, {
|
|
549
556
|
showIcon: showIcon,
|
|
550
557
|
size: size,
|
|
551
558
|
status: status ?? validateStatus,
|
|
552
559
|
...props,
|
|
560
|
+
id: id,
|
|
553
561
|
children: children
|
|
554
562
|
});
|
|
555
563
|
};
|
|
@@ -88,12 +88,12 @@ ProductCard.Image = function({ as, className, ref, ...props }) {
|
|
|
88
88
|
...props
|
|
89
89
|
});
|
|
90
90
|
};
|
|
91
|
-
ProductCard.Name = function({ children, className, ref, ...props }) {
|
|
91
|
+
ProductCard.Name = function({ as: Heading = "h3", children, className, ref, ...props }) {
|
|
92
92
|
const context = useContext(ProductCardContext);
|
|
93
93
|
const { nameSlot } = productCardVariants({
|
|
94
94
|
layout: context.layout
|
|
95
95
|
});
|
|
96
|
-
return /*#__PURE__*/ jsx(
|
|
96
|
+
return /*#__PURE__*/ jsx(Heading, {
|
|
97
97
|
className: nameSlot({
|
|
98
98
|
className
|
|
99
99
|
}),
|
|
@@ -3,6 +3,7 @@ import { normalizeProps, useMachine } from "@zag-js/react";
|
|
|
3
3
|
import { createContext, useContext, useId } from "react";
|
|
4
4
|
import { Label } from "../atoms/label.js";
|
|
5
5
|
import { StatusText } from "../atoms/status-text.js";
|
|
6
|
+
import { joinDescribedBy, useDescribedBy, useRegisterDescription } from "../internal/described-by.js";
|
|
6
7
|
import { tv } from "../utils.js";
|
|
7
8
|
import * as __rspack_external__zag_js_radio_group_44acf138 from "@zag-js/radio-group";
|
|
8
9
|
const radioGroupVariants = tv({
|
|
@@ -160,6 +161,7 @@ function RadioGroup({ id: providedId, disabled = false, required = false, orient
|
|
|
160
161
|
size,
|
|
161
162
|
variant
|
|
162
163
|
});
|
|
164
|
+
const describedBy = useDescribedBy();
|
|
163
165
|
return /*#__PURE__*/ jsx(RadioGroupContext.Provider, {
|
|
164
166
|
value: {
|
|
165
167
|
api,
|
|
@@ -168,7 +170,9 @@ function RadioGroup({ id: providedId, disabled = false, required = false, orient
|
|
|
168
170
|
orientation,
|
|
169
171
|
disabled,
|
|
170
172
|
required,
|
|
171
|
-
validateStatus
|
|
173
|
+
validateStatus,
|
|
174
|
+
statusTextId: `${id}-status`,
|
|
175
|
+
...describedBy
|
|
172
176
|
},
|
|
173
177
|
children: /*#__PURE__*/ jsx("div", {
|
|
174
178
|
className: styles.root({
|
|
@@ -176,6 +180,7 @@ function RadioGroup({ id: providedId, disabled = false, required = false, orient
|
|
|
176
180
|
}),
|
|
177
181
|
ref: ref,
|
|
178
182
|
...api.getRootProps(),
|
|
183
|
+
"aria-describedby": joinDescribedBy(describedBy.describedById),
|
|
179
184
|
children: children
|
|
180
185
|
})
|
|
181
186
|
});
|
|
@@ -326,14 +331,17 @@ RadioGroup.ItemDescription = function({ children, className, ref, ...props }) {
|
|
|
326
331
|
});
|
|
327
332
|
};
|
|
328
333
|
RadioGroup.StatusText = function({ status, size: sizeProp, showIcon, children, ...props }) {
|
|
329
|
-
const { size, validateStatus } = useRadioGroupContext();
|
|
334
|
+
const { size, validateStatus, statusTextId, registerDescription } = useRadioGroupContext();
|
|
330
335
|
const effectiveSize = sizeProp ?? size;
|
|
331
336
|
const effectiveStatus = status ?? validateStatus;
|
|
337
|
+
const id = props.id ?? statusTextId;
|
|
338
|
+
useRegisterDescription(id, registerDescription);
|
|
332
339
|
return /*#__PURE__*/ jsx(StatusText, {
|
|
333
340
|
showIcon: showIcon ?? "default" !== effectiveStatus,
|
|
334
341
|
size: effectiveSize,
|
|
335
342
|
status: effectiveStatus,
|
|
336
343
|
...props,
|
|
344
|
+
id: id,
|
|
337
345
|
children: children
|
|
338
346
|
});
|
|
339
347
|
};
|
|
@@ -177,6 +177,7 @@ SearchForm.Button = function({ className, children, showSearchIcon = false, icon
|
|
|
177
177
|
});
|
|
178
178
|
const effectiveIcon = icon ?? (showSearchIcon ? "token-icon-search" : void 0);
|
|
179
179
|
return /*#__PURE__*/ jsx(Button, {
|
|
180
|
+
"aria-label": children ? void 0 : "Search",
|
|
180
181
|
className: styles.button({
|
|
181
182
|
className
|
|
182
183
|
}),
|
package/dist/molecules/select.js
CHANGED
|
@@ -7,6 +7,7 @@ import { Button } from "../atoms/button.js";
|
|
|
7
7
|
import { Icon } from "../atoms/icon.js";
|
|
8
8
|
import { Label } from "../atoms/label.js";
|
|
9
9
|
import { StatusText } from "../atoms/status-text.js";
|
|
10
|
+
import { joinDescribedBy, useDescribedBy, useRegisterDescription } from "../internal/described-by.js";
|
|
10
11
|
import * as __rspack_external__zag_js_select_2818cf80 from "@zag-js/select";
|
|
11
12
|
const toControlSize = (size)=>"xs" === size ? "sm" : size;
|
|
12
13
|
const controlGlyphClass = {
|
|
@@ -60,7 +61,7 @@ const selectVariants = tv({
|
|
|
60
61
|
"transition-colors duration-200 motion-reduce:transition-none"
|
|
61
62
|
],
|
|
62
63
|
clearTrigger: [
|
|
63
|
-
"absolute top-1/2
|
|
64
|
+
"absolute end-select-right top-1/2 -translate-y-1/2"
|
|
64
65
|
],
|
|
65
66
|
content: [
|
|
66
67
|
"popup-surface-base",
|
|
@@ -104,7 +105,7 @@ const selectVariants = tv({
|
|
|
104
105
|
variants: {
|
|
105
106
|
size: {
|
|
106
107
|
xs: {
|
|
107
|
-
trigger: "p-select-trigger-sm text-select-trigger-xs",
|
|
108
|
+
trigger: "h-form-control-sm rounded-select-sm p-select-trigger-sm text-select-trigger-xs",
|
|
108
109
|
content: "popup-size-xs text-select-item-xs",
|
|
109
110
|
valueText: "text-select-value-xs",
|
|
110
111
|
itemGroupLabel: "text-select-item-group-label-xs"
|
|
@@ -122,7 +123,7 @@ const selectVariants = tv({
|
|
|
122
123
|
itemGroupLabel: "text-select-item-group-label-md"
|
|
123
124
|
},
|
|
124
125
|
lg: {
|
|
125
|
-
trigger: "p-select-trigger-md text-select-trigger-lg",
|
|
126
|
+
trigger: "h-form-control-lg rounded-select-lg p-select-trigger-md text-select-trigger-lg",
|
|
126
127
|
content: "popup-size-lg text-select-item-lg",
|
|
127
128
|
valueText: "text-select-value-lg",
|
|
128
129
|
itemGroupLabel: "text-select-item-group-label-lg"
|
|
@@ -177,12 +178,15 @@ function Select({ items, id: providedId, size = "md", value, defaultValue, multi
|
|
|
177
178
|
const styles = selectVariants({
|
|
178
179
|
size
|
|
179
180
|
});
|
|
181
|
+
const describedBy = useDescribedBy();
|
|
180
182
|
return /*#__PURE__*/ jsxs(SelectContext.Provider, {
|
|
181
183
|
value: {
|
|
182
184
|
api,
|
|
183
185
|
size,
|
|
184
186
|
items,
|
|
185
|
-
validateStatus
|
|
187
|
+
validateStatus,
|
|
188
|
+
statusTextId: `${id}-status`,
|
|
189
|
+
...describedBy
|
|
186
190
|
},
|
|
187
191
|
children: [
|
|
188
192
|
/*#__PURE__*/ jsx("select", {
|
|
@@ -228,7 +232,7 @@ Select.Control = function({ children, className, ref, ...props }) {
|
|
|
228
232
|
});
|
|
229
233
|
};
|
|
230
234
|
Select.Trigger = function({ children, className, size: sizeProp, iconSize, ref, ...props }) {
|
|
231
|
-
const { api, size: contextSize, validateStatus } = useSelectContext();
|
|
235
|
+
const { api, size: contextSize, validateStatus, describedById } = useSelectContext();
|
|
232
236
|
const effectiveSize = sizeProp ?? contextSize;
|
|
233
237
|
const styles = selectVariants({
|
|
234
238
|
size: effectiveSize
|
|
@@ -246,6 +250,7 @@ Select.Trigger = function({ children, className, size: sizeProp, iconSize, ref,
|
|
|
246
250
|
...api.getTriggerProps(),
|
|
247
251
|
...validationDataAttrs,
|
|
248
252
|
...props,
|
|
253
|
+
"aria-describedby": joinDescribedBy(props["aria-describedby"], describedById),
|
|
249
254
|
children: [
|
|
250
255
|
children,
|
|
251
256
|
/*#__PURE__*/ jsx(Icon, {
|
|
@@ -426,7 +431,9 @@ Select.ItemIndicator = function({ className, iconSize, ref, ...props }) {
|
|
|
426
431
|
});
|
|
427
432
|
};
|
|
428
433
|
Select.StatusText = function({ status: statusProp, size: sizeProp, showIcon, children, ...props }) {
|
|
429
|
-
const { size: contextSize, validateStatus: contextValidateStatus } = useSelectContext();
|
|
434
|
+
const { size: contextSize, validateStatus: contextValidateStatus, statusTextId, registerDescription } = useSelectContext();
|
|
435
|
+
const id = props.id ?? statusTextId;
|
|
436
|
+
useRegisterDescription(id, registerDescription);
|
|
430
437
|
const effectiveSize = sizeProp ?? contextSize;
|
|
431
438
|
const effectiveStatus = statusProp ?? contextValidateStatus;
|
|
432
439
|
return /*#__PURE__*/ jsx(StatusText, {
|
|
@@ -434,6 +441,7 @@ Select.StatusText = function({ status: statusProp, size: sizeProp, showIcon, chi
|
|
|
434
441
|
size: "xs" === effectiveSize ? "sm" : effectiveSize,
|
|
435
442
|
status: effectiveStatus,
|
|
436
443
|
...props,
|
|
444
|
+
id: id,
|
|
437
445
|
children: children
|
|
438
446
|
});
|
|
439
447
|
};
|
package/dist/molecules/slider.js
CHANGED
|
@@ -74,7 +74,7 @@ const sliderVariants = tv({
|
|
|
74
74
|
],
|
|
75
75
|
markerText: [
|
|
76
76
|
"absolute top-full",
|
|
77
|
-
"data-[orientation=vertical]:
|
|
77
|
+
"data-[orientation=vertical]:start-full data-[orientation=vertical]:top-0",
|
|
78
78
|
"data-[orientation=vertical]:h-full",
|
|
79
79
|
"data-[orientation=vertical]:p-marker-text"
|
|
80
80
|
]
|
|
@@ -209,12 +209,13 @@ const apiValueFallback = (value, defaultValue, fallbackValues)=>{
|
|
|
209
209
|
if (Array.isArray(defaultValue) && defaultValue.length > 0) return defaultValue;
|
|
210
210
|
return fallbackValues;
|
|
211
211
|
};
|
|
212
|
-
function Slider({ id, name, label, validateStatus, helpText, showHelpTextIcon = true, value, origin, thumbAlignment = "center", defaultValue = [
|
|
212
|
+
function Slider({ id, name, label, "aria-label": ariaLabel, validateStatus, helpText, showHelpTextIcon = true, value, origin, thumbAlignment = "center", defaultValue = [
|
|
213
213
|
25,
|
|
214
214
|
75
|
|
215
215
|
], min = 0, max = 100, step = 1, minStepsBetweenThumbs = 0, disabled = false, readOnly = false, dir = "ltr", orientation = "horizontal", size = "md", showMarkers = false, markerCount = 5, showValueText = false, formatRangeText, formatValue = (val)=>val.toString(), className, onChange, onChangeEnd }) {
|
|
216
216
|
const generatedId = useId();
|
|
217
217
|
const uniqueId = id || generatedId;
|
|
218
|
+
const helpTextId = `${uniqueId}-help`;
|
|
218
219
|
const thumbCount = resolveThumbCount(value, defaultValue);
|
|
219
220
|
const resolvedConfig = resolveSliderConfig(min, max, step, minStepsBetweenThumbs, thumbCount);
|
|
220
221
|
const fallbackValues = createFallbackValues(thumbCount, resolvedConfig.min, resolvedConfig.max);
|
|
@@ -225,6 +226,7 @@ function Slider({ id, name, label, validateStatus, helpText, showHelpTextIcon =
|
|
|
225
226
|
const service = useMachine(__rspack_external__zag_js_slider_b64ec793.machine, {
|
|
226
227
|
id: uniqueId,
|
|
227
228
|
name,
|
|
229
|
+
"aria-label": ariaLabel,
|
|
228
230
|
value: resolvedValue,
|
|
229
231
|
defaultValue: resolvedDefaultValue,
|
|
230
232
|
min: resolvedConfig.min,
|
|
@@ -318,6 +320,7 @@ function Slider({ id, name, label, validateStatus, helpText, showHelpTextIcon =
|
|
|
318
320
|
...api.getThumbProps({
|
|
319
321
|
index
|
|
320
322
|
}),
|
|
323
|
+
"aria-describedby": helpText ? helpTextId : void 0,
|
|
321
324
|
children: /*#__PURE__*/ jsx("input", {
|
|
322
325
|
...api.getHiddenInputProps({
|
|
323
326
|
index
|
|
@@ -327,9 +330,10 @@ function Slider({ id, name, label, validateStatus, helpText, showHelpTextIcon =
|
|
|
327
330
|
]
|
|
328
331
|
}),
|
|
329
332
|
helpText && /*#__PURE__*/ jsx(StatusText, {
|
|
330
|
-
|
|
333
|
+
id: helpTextId,
|
|
331
334
|
showIcon: showHelpTextIcon,
|
|
332
335
|
size: size,
|
|
336
|
+
status: validateStatus,
|
|
333
337
|
children: helpText
|
|
334
338
|
})
|
|
335
339
|
]
|
package/dist/molecules/steps.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { mergeProps, normalizeProps, useMachine } from "@zag-js/react";
|
|
3
3
|
import { connect, machine } from "@zag-js/steps";
|
|
4
|
-
import { createContext, useContext, useId } from "react";
|
|
4
|
+
import { createContext, useContext, useEffect, useId, useState } from "react";
|
|
5
5
|
import { Button } from "../atoms/button.js";
|
|
6
6
|
import { Icon } from "../atoms/icon.js";
|
|
7
7
|
import { tv } from "../utils.js";
|
|
@@ -117,6 +117,7 @@ const stepsVariants = tv({
|
|
|
117
117
|
"data-current:bg-steps-trigger-bg-current",
|
|
118
118
|
"data-complete:bg-steps-trigger-bg-complete"
|
|
119
119
|
],
|
|
120
|
+
title: "data-current:text-steps-title-fg-solid-current",
|
|
120
121
|
indicator: [
|
|
121
122
|
"border-transparent bg-steps-indicator-bg-solid text-steps-indicator-fg-solid",
|
|
122
123
|
"group-hover:bg-steps-indicator-bg-solid-hover",
|
|
@@ -160,6 +161,27 @@ const stepsVariants = tv({
|
|
|
160
161
|
size: "md"
|
|
161
162
|
}
|
|
162
163
|
});
|
|
164
|
+
function useStepsContentRegistry() {
|
|
165
|
+
const [contentIndexes, setContentIndexes] = useState(()=>new Set());
|
|
166
|
+
return {
|
|
167
|
+
contentIndexes,
|
|
168
|
+
setContentIndexes
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function useRegisterStepsContent(index) {
|
|
172
|
+
const { setContentIndexes } = useStepsContext();
|
|
173
|
+
useEffect(()=>{
|
|
174
|
+
setContentIndexes((previous)=>new Set(previous).add(index));
|
|
175
|
+
return ()=>setContentIndexes((previous)=>{
|
|
176
|
+
const next = new Set(previous);
|
|
177
|
+
next.delete(index);
|
|
178
|
+
return next;
|
|
179
|
+
});
|
|
180
|
+
}, [
|
|
181
|
+
index,
|
|
182
|
+
setContentIndexes
|
|
183
|
+
]);
|
|
184
|
+
}
|
|
163
185
|
const StepsContext = /*#__PURE__*/ createContext(null);
|
|
164
186
|
function useStepsContext() {
|
|
165
187
|
const context = useContext(StepsContext);
|
|
@@ -213,12 +235,14 @@ function Steps({ id, count = 1, defaultStep, dir = "ltr", linear = false, onStep
|
|
|
213
235
|
variant
|
|
214
236
|
});
|
|
215
237
|
const rootProps = mergeProps(props, api.getRootProps());
|
|
238
|
+
const contentRegistry = useStepsContentRegistry();
|
|
216
239
|
return /*#__PURE__*/ jsx(StepsContext.Provider, {
|
|
217
240
|
value: {
|
|
218
241
|
api,
|
|
219
242
|
orientation,
|
|
220
243
|
size,
|
|
221
|
-
styles
|
|
244
|
+
styles,
|
|
245
|
+
...contentRegistry
|
|
222
246
|
},
|
|
223
247
|
children: /*#__PURE__*/ jsx("div", {
|
|
224
248
|
className: styles.root({
|
|
@@ -237,12 +261,14 @@ Steps.RootProvider = function({ value, size, variant, children, className, ref,
|
|
|
237
261
|
});
|
|
238
262
|
const resolvedOrientation = getOrientationFromApi(value);
|
|
239
263
|
const rootProps = mergeProps(props, value.getRootProps());
|
|
264
|
+
const contentRegistry = useStepsContentRegistry();
|
|
240
265
|
return /*#__PURE__*/ jsx(StepsContext.Provider, {
|
|
241
266
|
value: {
|
|
242
267
|
api: value,
|
|
243
268
|
orientation: resolvedOrientation,
|
|
244
269
|
size,
|
|
245
|
-
styles
|
|
270
|
+
styles,
|
|
271
|
+
...contentRegistry
|
|
246
272
|
},
|
|
247
273
|
children: /*#__PURE__*/ jsx("div", {
|
|
248
274
|
className: styles.root({
|
|
@@ -316,7 +342,7 @@ Steps.Item = function({ index, children, className, ref, ...props }) {
|
|
|
316
342
|
});
|
|
317
343
|
};
|
|
318
344
|
Steps.Trigger = function({ children, className, disabled, ref, ...props }) {
|
|
319
|
-
const { api, styles } = useStepsContext();
|
|
345
|
+
const { api, contentIndexes, styles } = useStepsContext();
|
|
320
346
|
const { ariaCurrent, index } = useStepsItemContext();
|
|
321
347
|
const triggerProps = api.getTriggerProps({
|
|
322
348
|
index
|
|
@@ -334,6 +360,7 @@ Steps.Trigger = function({ children, className, disabled, ref, ...props }) {
|
|
|
334
360
|
theme: "unstyled",
|
|
335
361
|
type: "button",
|
|
336
362
|
...buttonProps,
|
|
363
|
+
"aria-controls": contentIndexes.has(index) ? buttonProps["aria-controls"] : void 0,
|
|
337
364
|
"aria-current": props["aria-current"] ?? ariaCurrent,
|
|
338
365
|
"data-disabled": isDisabled || void 0,
|
|
339
366
|
disabled: isDisabled,
|
|
@@ -434,6 +461,7 @@ Steps.Separator = function({ className, ref, ...props }) {
|
|
|
434
461
|
const separatorProps = mergeProps(props, api.getSeparatorProps({
|
|
435
462
|
index
|
|
436
463
|
}), {
|
|
464
|
+
"aria-hidden": true,
|
|
437
465
|
"data-last": state.last || void 0
|
|
438
466
|
});
|
|
439
467
|
return /*#__PURE__*/ jsx("div", {
|
|
@@ -449,6 +477,7 @@ Steps.Content = function({ index, children, className, ref, ...props }) {
|
|
|
449
477
|
const contentProps = mergeProps(props, api.getContentProps({
|
|
450
478
|
index
|
|
451
479
|
}));
|
|
480
|
+
useRegisterStepsContent(index);
|
|
452
481
|
return /*#__PURE__*/ jsx("div", {
|
|
453
482
|
className: styles.content({
|
|
454
483
|
className
|
package/dist/molecules/switch.js
CHANGED
|
@@ -49,6 +49,7 @@ const switchVariants = tv({
|
|
|
49
49
|
function Switch({ id, name, value, checked, defaultChecked, disabled = false, readOnly = false, required = false, dir = "ltr", children, className, onCheckedChange, validateStatus, helpText, showHelpTextIcon = true }) {
|
|
50
50
|
const generatedId = useId();
|
|
51
51
|
const uniqueId = id || generatedId;
|
|
52
|
+
const helpTextId = `${uniqueId}-help`;
|
|
52
53
|
const service = useMachine(__rspack_external__zag_js_switch_171a0128.machine, {
|
|
53
54
|
id: uniqueId,
|
|
54
55
|
name,
|
|
@@ -76,7 +77,8 @@ function Switch({ id, name, value, checked, defaultChecked, disabled = false, re
|
|
|
76
77
|
children: [
|
|
77
78
|
/*#__PURE__*/ jsx("input", {
|
|
78
79
|
className: hiddenInput(),
|
|
79
|
-
...api.getHiddenInputProps()
|
|
80
|
+
...api.getHiddenInputProps(),
|
|
81
|
+
"aria-describedby": helpText ? helpTextId : void 0
|
|
80
82
|
}),
|
|
81
83
|
/*#__PURE__*/ jsx("span", {
|
|
82
84
|
className: control(),
|
|
@@ -94,9 +96,10 @@ function Switch({ id, name, value, checked, defaultChecked, disabled = false, re
|
|
|
94
96
|
]
|
|
95
97
|
}),
|
|
96
98
|
helpText && /*#__PURE__*/ jsx(StatusText, {
|
|
97
|
-
|
|
99
|
+
id: helpTextId,
|
|
98
100
|
showIcon: showHelpTextIcon,
|
|
99
101
|
size: "sm",
|
|
102
|
+
status: validateStatus,
|
|
100
103
|
children: helpText
|
|
101
104
|
})
|
|
102
105
|
]
|
package/dist/molecules/tabs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { mergeProps, normalizeProps, useMachine } from "@zag-js/react";
|
|
3
|
-
import { createContext, useContext, useId } from "react";
|
|
3
|
+
import { createContext, useContext, useEffect, useId, useState } from "react";
|
|
4
4
|
import { Button } from "../atoms/button.js";
|
|
5
5
|
import { tv } from "../utils.js";
|
|
6
6
|
import * as __rspack_external__zag_js_tabs_b98983a9 from "@zag-js/tabs";
|
|
@@ -70,15 +70,15 @@ const tabsVariants = tv({
|
|
|
70
70
|
},
|
|
71
71
|
size: {
|
|
72
72
|
sm: {
|
|
73
|
-
trigger: "p-tabs-trigger-sm text-tabs-trigger-sm",
|
|
73
|
+
trigger: "h-form-control-sm p-tabs-trigger-sm text-tabs-trigger-sm",
|
|
74
74
|
content: "p-tabs-content-padding-sm text-tabs-content-sm"
|
|
75
75
|
},
|
|
76
76
|
md: {
|
|
77
|
-
trigger: "p-tabs-trigger-md text-tabs-trigger-md",
|
|
77
|
+
trigger: "h-form-control-md p-tabs-trigger-md text-tabs-trigger-md",
|
|
78
78
|
content: "p-tabs-content-padding-md text-tabs-content-md"
|
|
79
79
|
},
|
|
80
80
|
lg: {
|
|
81
|
-
trigger: "p-tabs-trigger-lg text-tabs-trigger-lg",
|
|
81
|
+
trigger: "h-form-control-lg p-tabs-trigger-lg text-tabs-trigger-lg",
|
|
82
82
|
content: "p-tabs-content-padding-lg text-tabs-content-lg"
|
|
83
83
|
}
|
|
84
84
|
},
|
|
@@ -135,6 +135,7 @@ function Tabs({ id, defaultValue, value, orientation = "horizontal", dir = "ltr"
|
|
|
135
135
|
fitted,
|
|
136
136
|
justify
|
|
137
137
|
});
|
|
138
|
+
const [contentValues, setContentValues] = useState(()=>new Set());
|
|
138
139
|
return /*#__PURE__*/ jsx(TabsContext.Provider, {
|
|
139
140
|
value: {
|
|
140
141
|
api,
|
|
@@ -142,7 +143,9 @@ function Tabs({ id, defaultValue, value, orientation = "horizontal", dir = "ltr"
|
|
|
142
143
|
size,
|
|
143
144
|
fitted,
|
|
144
145
|
justify,
|
|
145
|
-
styles
|
|
146
|
+
styles,
|
|
147
|
+
contentValues,
|
|
148
|
+
setContentValues
|
|
146
149
|
},
|
|
147
150
|
children: /*#__PURE__*/ jsx("div", {
|
|
148
151
|
className: styles.root({
|
|
@@ -168,13 +171,14 @@ Tabs.List = function({ children, ref, className, ...props }) {
|
|
|
168
171
|
});
|
|
169
172
|
};
|
|
170
173
|
Tabs.Trigger = function({ value, disabled, children, ref, className, size = "current", theme = "unstyled", type = "button", ...props }) {
|
|
171
|
-
const { api, styles } = useTabsContext();
|
|
174
|
+
const { api, contentValues, styles } = useTabsContext();
|
|
172
175
|
const triggerProps = mergeProps(props, api.getTriggerProps({
|
|
173
176
|
value,
|
|
174
177
|
disabled
|
|
175
178
|
}));
|
|
176
179
|
return /*#__PURE__*/ jsx(Button, {
|
|
177
180
|
...triggerProps,
|
|
181
|
+
"aria-controls": contentValues.has(value) ? triggerProps["aria-controls"] : void 0,
|
|
178
182
|
className: styles.trigger({
|
|
179
183
|
className
|
|
180
184
|
}),
|
|
@@ -187,7 +191,18 @@ Tabs.Trigger = function({ value, disabled, children, ref, className, size = "cur
|
|
|
187
191
|
});
|
|
188
192
|
};
|
|
189
193
|
Tabs.Content = function({ value, children, ref, className, ...props }) {
|
|
190
|
-
const { api, styles } = useTabsContext();
|
|
194
|
+
const { api, setContentValues, styles } = useTabsContext();
|
|
195
|
+
useEffect(()=>{
|
|
196
|
+
setContentValues((previous)=>new Set(previous).add(value));
|
|
197
|
+
return ()=>setContentValues((previous)=>{
|
|
198
|
+
const next = new Set(previous);
|
|
199
|
+
next.delete(value);
|
|
200
|
+
return next;
|
|
201
|
+
});
|
|
202
|
+
}, [
|
|
203
|
+
value,
|
|
204
|
+
setContentValues
|
|
205
|
+
]);
|
|
191
206
|
return /*#__PURE__*/ jsx("div", {
|
|
192
207
|
className: styles.content({
|
|
193
208
|
className
|
package/dist/molecules/tour.js
CHANGED
|
@@ -302,7 +302,7 @@ Tour.CloseTrigger = function({ className, icon = "token-icon-close", onClick, re
|
|
|
302
302
|
const { onClick: onMachineClick, "aria-label": machineLabel, ...machineProps } = api.getCloseTriggerProps();
|
|
303
303
|
return /*#__PURE__*/ jsx(ActionIcon, {
|
|
304
304
|
...mergeProps(props, machineProps),
|
|
305
|
-
"aria-label": props["aria-label"] ?? machineLabel,
|
|
305
|
+
"aria-label": props["aria-label"] ?? machineLabel ?? "Close tour",
|
|
306
306
|
className: tourStyles().closeTrigger({
|
|
307
307
|
className
|
|
308
308
|
}),
|