@techsio/ui-kit 0.47.0 → 0.49.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/numeric-input.js +3 -0
- package/dist/internal/molecules/vertical-navigation.context.js +15 -0
- package/dist/internal/molecules/vertical-navigation.styles.js +68 -0
- package/dist/molecules/form-checkbox.js +12 -2
- package/dist/molecules/form-error-summary.js +59 -0
- package/dist/molecules/form-input.js +10 -1
- package/dist/molecules/form-numeric-input.js +9 -1
- package/dist/molecules/form-textarea.js +10 -1
- package/dist/molecules/vertical-navigation.js +228 -0
- package/dist/src/atoms/numeric-input.d.ts +1 -1
- package/dist/src/atoms/numeric-input.d.ts.map +1 -1
- package/dist/src/internal/molecules/vertical-navigation.context.d.ts +25 -0
- package/dist/src/internal/molecules/vertical-navigation.context.d.ts.map +1 -0
- package/dist/src/internal/molecules/vertical-navigation.styles.d.ts +143 -0
- package/dist/src/internal/molecules/vertical-navigation.styles.d.ts.map +1 -0
- package/dist/src/molecules/form-checkbox.d.ts +2 -1
- package/dist/src/molecules/form-checkbox.d.ts.map +1 -1
- package/dist/src/molecules/form-error-summary.d.ts +29 -0
- package/dist/src/molecules/form-error-summary.d.ts.map +1 -0
- package/dist/src/molecules/form-input.d.ts +3 -3
- package/dist/src/molecules/form-input.d.ts.map +1 -1
- package/dist/src/molecules/form-numeric-input.d.ts +3 -3
- package/dist/src/molecules/form-numeric-input.d.ts.map +1 -1
- package/dist/src/molecules/form-textarea.d.ts +3 -3
- package/dist/src/molecules/form-textarea.d.ts.map +1 -1
- package/dist/src/molecules/vertical-navigation.d.ts +44 -0
- package/dist/src/molecules/vertical-navigation.d.ts.map +1 -0
- package/dist/src/templates/numeric-input.d.ts +1 -1
- package/dist/src/types/zag.d.ts +1 -0
- package/dist/src/types/zag.d.ts.map +1 -1
- package/dist/stories/changelog/changelog.stories.d.ts.map +1 -1
- package/dist/stories/molecules/form-error-summary.stories.d.ts +11 -0
- package/dist/stories/molecules/form-error-summary.stories.d.ts.map +1 -0
- package/dist/stories/molecules/vertical-navigation.stories.d.ts +75 -0
- package/dist/stories/molecules/vertical-navigation.stories.d.ts.map +1 -0
- package/dist/test/form-error-summary.ids.test.d.ts +2 -0
- package/dist/test/form-error-summary.ids.test.d.ts.map +1 -0
- package/dist/test/vertical-navigation.behavior.spec.d.ts +2 -0
- package/dist/test/vertical-navigation.behavior.spec.d.ts.map +1 -0
- package/dist/test/vertical-navigation.playwright.config.d.ts +4 -0
- package/dist/test/vertical-navigation.playwright.config.d.ts.map +1 -0
- package/package.json +2 -1
- package/src/tokens/components/components.css +2 -0
- package/src/tokens/components/molecules/_form-error-summary.css +20 -0
- package/src/tokens/components/molecules/_vertical-navigation.css +155 -0
|
@@ -102,6 +102,9 @@ function NumericInput({ id, name, size, disabled = false, required = false, patt
|
|
|
102
102
|
const stringDefaultValue = void 0 !== defaultValue ? formatValue(defaultValue) : void 0;
|
|
103
103
|
const service = useMachine(__rspack_external__zag_js_number_input_f1a1f439.machine, {
|
|
104
104
|
id: uniqueId,
|
|
105
|
+
ids: id ? {
|
|
106
|
+
input: id
|
|
107
|
+
} : void 0,
|
|
105
108
|
min,
|
|
106
109
|
max,
|
|
107
110
|
step,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
const VerticalNavigationContext = createContext(null);
|
|
3
|
+
const VerticalNavigationDepthContext = createContext(0);
|
|
4
|
+
const VerticalNavigationBranchContext = createContext(null);
|
|
5
|
+
function useVerticalNavigationContext() {
|
|
6
|
+
const context = useContext(VerticalNavigationContext);
|
|
7
|
+
if (!context) throw new Error("VerticalNavigation parts must be used within VerticalNavigation.Root");
|
|
8
|
+
return context;
|
|
9
|
+
}
|
|
10
|
+
function useVerticalNavigationBranchContext() {
|
|
11
|
+
const context = useContext(VerticalNavigationBranchContext);
|
|
12
|
+
if (!context) throw new Error("VerticalNavigation branch parts must be used within VerticalNavigation.Branch");
|
|
13
|
+
return context;
|
|
14
|
+
}
|
|
15
|
+
export { VerticalNavigationBranchContext, VerticalNavigationContext, VerticalNavigationDepthContext, useVerticalNavigationBranchContext, useVerticalNavigationContext };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { tv } from "../../utils.js";
|
|
2
|
+
const verticalNavigationStyles = tv({
|
|
3
|
+
slots: {
|
|
4
|
+
root: "min-w-0 text-vertical-navigation-fg",
|
|
5
|
+
list: "flex min-w-0 list-none flex-col gap-vertical-navigation-list",
|
|
6
|
+
item: "min-w-0",
|
|
7
|
+
row: "vertical-navigation-row flex min-w-0 items-start gap-vertical-navigation-row rounded-vertical-navigation-item bg-vertical-navigation-item-bg data-current-path:font-vertical-navigation-path",
|
|
8
|
+
link: "vertical-navigation-control focus-visible:vertical-navigation-focus flex min-w-0 flex-1 items-center justify-start gap-vertical-navigation-row whitespace-normal rounded-vertical-navigation-item bg-vertical-navigation-item-bg text-start text-inherit hover:bg-vertical-navigation-item-bg-hover data-current:bg-vertical-navigation-item-bg-current data-current-path:font-vertical-navigation-path data-current:font-vertical-navigation-current data-current:text-vertical-navigation-item-fg-current data-disabled:text-vertical-navigation-item-fg-disabled data-disabled:hover:bg-vertical-navigation-item-bg",
|
|
9
|
+
trigger: "vertical-navigation-control focus-visible:vertical-navigation-focus flex w-full min-w-0 items-center justify-between whitespace-normal rounded-vertical-navigation-item bg-vertical-navigation-item-bg text-start text-inherit hover:bg-vertical-navigation-item-bg-hover disabled:text-vertical-navigation-item-fg-disabled disabled:hover:bg-vertical-navigation-item-bg",
|
|
10
|
+
indicator: "inline-flex shrink-0 data-[state=open]:rotate-180",
|
|
11
|
+
content: "data-guide:vertical-navigation-guide min-w-0 rounded-vertical-navigation-group py-vertical-navigation-group data-indented:ms-vertical-navigation-indent",
|
|
12
|
+
group: "flex min-w-0 flex-col gap-vertical-navigation-group rounded-vertical-navigation-group p-vertical-navigation-group",
|
|
13
|
+
groupLabel: "mb-vertical-navigation-label font-vertical-navigation-label text-vertical-navigation-label-fg text-vertical-navigation-label-sm",
|
|
14
|
+
separator: "my-vertical-navigation-group h-vertical-navigation-separator border-0 bg-vertical-navigation-separator-bg"
|
|
15
|
+
},
|
|
16
|
+
variants: {
|
|
17
|
+
variant: {
|
|
18
|
+
primary: {},
|
|
19
|
+
secondary: {}
|
|
20
|
+
},
|
|
21
|
+
size: {
|
|
22
|
+
sm: {
|
|
23
|
+
root: "text-vertical-navigation-sm",
|
|
24
|
+
link: "min-h-vertical-navigation-item-sm px-vertical-navigation-item-x-sm py-vertical-navigation-item-y-sm",
|
|
25
|
+
trigger: "min-h-vertical-navigation-item-sm px-vertical-navigation-item-x-sm py-vertical-navigation-item-y-sm",
|
|
26
|
+
indicator: "text-vertical-navigation-icon-sm",
|
|
27
|
+
groupLabel: "px-vertical-navigation-item-x-sm"
|
|
28
|
+
},
|
|
29
|
+
md: {
|
|
30
|
+
root: "text-vertical-navigation-md",
|
|
31
|
+
link: "min-h-vertical-navigation-item-md px-vertical-navigation-item-x-md py-vertical-navigation-item-y-md",
|
|
32
|
+
trigger: "min-h-vertical-navigation-item-md px-vertical-navigation-item-x-md py-vertical-navigation-item-y-md",
|
|
33
|
+
indicator: "text-vertical-navigation-icon-md",
|
|
34
|
+
groupLabel: "px-vertical-navigation-item-x-md"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
tone: {
|
|
38
|
+
plain: {
|
|
39
|
+
content: "bg-vertical-navigation-group-bg-plain text-vertical-navigation-group-fg-plain",
|
|
40
|
+
group: "bg-vertical-navigation-group-bg-plain text-vertical-navigation-group-fg-plain"
|
|
41
|
+
},
|
|
42
|
+
subtle: {
|
|
43
|
+
content: "bg-vertical-navigation-group-bg-subtle text-vertical-navigation-group-fg-subtle",
|
|
44
|
+
group: "bg-vertical-navigation-group-bg-subtle text-vertical-navigation-group-fg-subtle"
|
|
45
|
+
},
|
|
46
|
+
accent: {
|
|
47
|
+
content: "bg-vertical-navigation-group-bg-accent text-vertical-navigation-group-fg-accent",
|
|
48
|
+
group: "bg-vertical-navigation-group-bg-accent text-vertical-navigation-group-fg-accent"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
compoundVariants: [
|
|
53
|
+
{
|
|
54
|
+
tone: "accent",
|
|
55
|
+
variant: "secondary",
|
|
56
|
+
class: {
|
|
57
|
+
content: "bg-vertical-navigation-group-bg-secondary text-vertical-navigation-group-fg-secondary",
|
|
58
|
+
group: "bg-vertical-navigation-group-bg-secondary text-vertical-navigation-group-fg-secondary"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
defaultVariants: {
|
|
63
|
+
size: "md",
|
|
64
|
+
tone: "plain",
|
|
65
|
+
variant: "primary"
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
export { verticalNavigationStyles };
|
|
@@ -61,11 +61,19 @@ const checkboxVariants = tv({
|
|
|
61
61
|
size: "md"
|
|
62
62
|
}
|
|
63
63
|
});
|
|
64
|
-
function FormCheckbox({ id, name, value, checked, defaultChecked, indeterminate, disabled = false, required = false, readOnly = false, children, label, helpText, validateStatus = "default", showHelpTextIcon = "default" !== validateStatus, size = "md", className, onCheckedChange }) {
|
|
64
|
+
function FormCheckbox({ id, name, value, checked, defaultChecked, indeterminate, disabled = false, required = false, readOnly = false, children, label, helpText, "aria-describedby": ariaDescribedBy, validateStatus = "default", showHelpTextIcon = "default" !== validateStatus, size = "md", className, onCheckedChange }) {
|
|
65
65
|
const generatedId = useId();
|
|
66
66
|
const uniqueId = id || generatedId;
|
|
67
|
+
const helpTextId = useId();
|
|
68
|
+
const describedBy = [
|
|
69
|
+
ariaDescribedBy,
|
|
70
|
+
helpText ? helpTextId : void 0
|
|
71
|
+
].filter(Boolean).join(" ") || void 0;
|
|
67
72
|
const service = useMachine(machine, {
|
|
68
73
|
id: uniqueId,
|
|
74
|
+
ids: id ? {
|
|
75
|
+
hiddenInput: id
|
|
76
|
+
} : void 0,
|
|
69
77
|
name,
|
|
70
78
|
value,
|
|
71
79
|
checked: indeterminate ? "indeterminate" : checked,
|
|
@@ -100,7 +108,8 @@ function FormCheckbox({ id, name, value, checked, defaultChecked, indeterminate,
|
|
|
100
108
|
}),
|
|
101
109
|
/*#__PURE__*/ jsx("input", {
|
|
102
110
|
className: styles.hiddenInput(),
|
|
103
|
-
...api.getHiddenInputProps()
|
|
111
|
+
...api.getHiddenInputProps(),
|
|
112
|
+
"aria-describedby": describedBy
|
|
104
113
|
}),
|
|
105
114
|
labelContent && /*#__PURE__*/ jsxs("span", {
|
|
106
115
|
className: styles.label(),
|
|
@@ -119,6 +128,7 @@ function FormCheckbox({ id, name, value, checked, defaultChecked, indeterminate,
|
|
|
119
128
|
className: styles.textIndented(),
|
|
120
129
|
"data-icon": showHelpTextIcon,
|
|
121
130
|
children: /*#__PURE__*/ jsx(StatusText, {
|
|
131
|
+
id: helpTextId,
|
|
122
132
|
showIcon: showHelpTextIcon,
|
|
123
133
|
size: size,
|
|
124
134
|
status: validateStatus,
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { tv } from "../utils.js";
|
|
3
|
+
const formErrorSummaryVariants = tv({
|
|
4
|
+
slots: {
|
|
5
|
+
root: [
|
|
6
|
+
"flex flex-col gap-100",
|
|
7
|
+
"rounded-form-control",
|
|
8
|
+
"border-(length:--border-width-validation)",
|
|
9
|
+
"border-form-error-summary-border",
|
|
10
|
+
"bg-form-error-summary-bg",
|
|
11
|
+
"p-300"
|
|
12
|
+
],
|
|
13
|
+
title: [
|
|
14
|
+
"text-label-md",
|
|
15
|
+
"font-medium",
|
|
16
|
+
"text-form-error-summary-fg"
|
|
17
|
+
],
|
|
18
|
+
list: [
|
|
19
|
+
"m-0",
|
|
20
|
+
"flex list-none flex-col gap-100 p-0"
|
|
21
|
+
],
|
|
22
|
+
link: [
|
|
23
|
+
"text-form-error-summary-fg",
|
|
24
|
+
"underline",
|
|
25
|
+
"underline-offset-4",
|
|
26
|
+
"focus-visible:form-error-summary-focus-ring"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
function FormErrorSummary({ title = "There is a problem", errors, onFieldFocus, className, ref }) {
|
|
31
|
+
if (0 === errors.length) return null;
|
|
32
|
+
const styles = formErrorSummaryVariants();
|
|
33
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
34
|
+
className: styles.root({
|
|
35
|
+
className
|
|
36
|
+
}),
|
|
37
|
+
ref: ref,
|
|
38
|
+
role: "alert",
|
|
39
|
+
children: [
|
|
40
|
+
/*#__PURE__*/ jsx("h2", {
|
|
41
|
+
className: styles.title(),
|
|
42
|
+
children: title
|
|
43
|
+
}),
|
|
44
|
+
/*#__PURE__*/ jsx("ul", {
|
|
45
|
+
className: styles.list(),
|
|
46
|
+
children: errors.map((error)=>/*#__PURE__*/ jsx("li", {
|
|
47
|
+
children: /*#__PURE__*/ jsx("a", {
|
|
48
|
+
className: styles.link(),
|
|
49
|
+
href: `#${error.targetId}`,
|
|
50
|
+
onClick: ()=>onFieldFocus?.(error.targetId),
|
|
51
|
+
children: error.label
|
|
52
|
+
})
|
|
53
|
+
}, error.id))
|
|
54
|
+
})
|
|
55
|
+
]
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
FormErrorSummary.displayName = "FormErrorSummary";
|
|
59
|
+
export { FormErrorSummary };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from "react";
|
|
2
3
|
import { Input } from "../atoms/input.js";
|
|
3
4
|
import { Label } from "../atoms/label.js";
|
|
4
5
|
import { StatusText } from "../atoms/status-text.js";
|
|
@@ -26,9 +27,15 @@ function FormInputRaw({ id, label, validateStatus = "default", helpText, size =
|
|
|
26
27
|
]
|
|
27
28
|
});
|
|
28
29
|
}
|
|
29
|
-
function FormInput({ helpText, id, validateStatus = "default", showHelpTextIcon = "default" !== validateStatus, size = "md", ...props }) {
|
|
30
|
+
function FormInput({ helpText, id, validateStatus = "default", showHelpTextIcon = "default" !== validateStatus, size = "md", "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, ...props }) {
|
|
31
|
+
const helpTextId = useId();
|
|
32
|
+
const describedBy = [
|
|
33
|
+
ariaDescribedBy,
|
|
34
|
+
helpText ? helpTextId : void 0
|
|
35
|
+
].filter(Boolean).join(" ") || void 0;
|
|
30
36
|
return /*#__PURE__*/ jsx(FormInputRaw, {
|
|
31
37
|
helpText: helpText && /*#__PURE__*/ jsx(StatusText, {
|
|
38
|
+
id: helpTextId,
|
|
32
39
|
status: validateStatus,
|
|
33
40
|
showIcon: showHelpTextIcon,
|
|
34
41
|
size: size,
|
|
@@ -37,6 +44,8 @@ function FormInput({ helpText, id, validateStatus = "default", showHelpTextIcon
|
|
|
37
44
|
id: id,
|
|
38
45
|
size: size,
|
|
39
46
|
validateStatus: validateStatus,
|
|
47
|
+
"aria-invalid": "error" === validateStatus ? true : ariaInvalid,
|
|
48
|
+
"aria-describedby": describedBy,
|
|
40
49
|
...props
|
|
41
50
|
});
|
|
42
51
|
}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from "react";
|
|
2
3
|
import { Label } from "../atoms/label.js";
|
|
3
4
|
import { NumericInput } from "../atoms/numeric-input.js";
|
|
4
5
|
import { StatusText } from "../atoms/status-text.js";
|
|
5
|
-
function FormNumericInput({ id, label, validateStatus = "default", helpText, showHelpTextIcon = "default" !== validateStatus, size = "md", required, disabled, children, ...numericInputProps }) {
|
|
6
|
+
function FormNumericInput({ id, label, validateStatus = "default", helpText, showHelpTextIcon = "default" !== validateStatus, size = "md", required, disabled, children, describedBy, ...numericInputProps }) {
|
|
7
|
+
const helpTextId = useId();
|
|
8
|
+
const mergedDescribedBy = [
|
|
9
|
+
describedBy,
|
|
10
|
+
helpText ? helpTextId : void 0
|
|
11
|
+
].filter(Boolean).join(" ") || void 0;
|
|
6
12
|
return /*#__PURE__*/ jsxs("div", {
|
|
7
13
|
className: "flex flex-col gap-form-field-gap",
|
|
8
14
|
children: [
|
|
@@ -19,10 +25,12 @@ function FormNumericInput({ id, label, validateStatus = "default", helpText, sho
|
|
|
19
25
|
invalid: "error" === validateStatus,
|
|
20
26
|
required: required,
|
|
21
27
|
size: size,
|
|
28
|
+
describedBy: mergedDescribedBy,
|
|
22
29
|
...numericInputProps,
|
|
23
30
|
children: children
|
|
24
31
|
}),
|
|
25
32
|
helpText && /*#__PURE__*/ jsx(StatusText, {
|
|
33
|
+
id: helpTextId,
|
|
26
34
|
status: validateStatus,
|
|
27
35
|
showIcon: showHelpTextIcon,
|
|
28
36
|
size: size,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from "react";
|
|
2
3
|
import { Label } from "../atoms/label.js";
|
|
3
4
|
import { StatusText } from "../atoms/status-text.js";
|
|
4
5
|
import { Textarea } from "../atoms/textarea.js";
|
|
@@ -25,9 +26,15 @@ function FormTextareaRaw({ id, label, validateStatus = "default", helpText, size
|
|
|
25
26
|
]
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
|
-
function FormTextarea({ helpText, id, validateStatus = "default", showHelpTextIcon = "default" !== validateStatus, size = "md", ...props }) {
|
|
29
|
+
function FormTextarea({ helpText, id, validateStatus = "default", showHelpTextIcon = "default" !== validateStatus, size = "md", "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, ...props }) {
|
|
30
|
+
const helpTextId = useId();
|
|
31
|
+
const describedBy = [
|
|
32
|
+
ariaDescribedBy,
|
|
33
|
+
helpText ? helpTextId : void 0
|
|
34
|
+
].filter(Boolean).join(" ") || void 0;
|
|
29
35
|
return /*#__PURE__*/ jsx(FormTextareaRaw, {
|
|
30
36
|
helpText: helpText && /*#__PURE__*/ jsx(StatusText, {
|
|
37
|
+
id: helpTextId,
|
|
31
38
|
status: validateStatus,
|
|
32
39
|
showIcon: showHelpTextIcon,
|
|
33
40
|
size: size,
|
|
@@ -36,6 +43,8 @@ function FormTextarea({ helpText, id, validateStatus = "default", showHelpTextIc
|
|
|
36
43
|
id: id,
|
|
37
44
|
size: size,
|
|
38
45
|
validateStatus: validateStatus,
|
|
46
|
+
"aria-invalid": "error" === validateStatus ? true : ariaInvalid,
|
|
47
|
+
"aria-describedby": describedBy,
|
|
39
48
|
...props
|
|
40
49
|
});
|
|
41
50
|
}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { mergeProps, normalizeProps, useMachine } from "@zag-js/react";
|
|
4
|
+
import { useContext, useId } from "react";
|
|
5
|
+
import { Button } from "../atoms/button.js";
|
|
6
|
+
import { Icon } from "../atoms/icon.js";
|
|
7
|
+
import { LinkButton } from "../atoms/link-button.js";
|
|
8
|
+
import { VerticalNavigationBranchContext, VerticalNavigationContext, VerticalNavigationDepthContext, useVerticalNavigationBranchContext, useVerticalNavigationContext } from "../internal/molecules/vertical-navigation.context.js";
|
|
9
|
+
import { verticalNavigationStyles } from "../internal/molecules/vertical-navigation.styles.js";
|
|
10
|
+
import * as __rspack_external__zag_js_collapsible_508ff486 from "@zag-js/collapsible";
|
|
11
|
+
function VerticalNavigation({ size = "md", maxIndentDepth = 3, dir, className, children, ...props }) {
|
|
12
|
+
return /*#__PURE__*/ jsx(VerticalNavigationContext.Provider, {
|
|
13
|
+
value: {
|
|
14
|
+
size,
|
|
15
|
+
maxIndentDepth,
|
|
16
|
+
dir
|
|
17
|
+
},
|
|
18
|
+
children: /*#__PURE__*/ jsx(VerticalNavigationDepthContext.Provider, {
|
|
19
|
+
value: 0,
|
|
20
|
+
children: /*#__PURE__*/ jsx(VerticalNavigationBranchContext.Provider, {
|
|
21
|
+
value: null,
|
|
22
|
+
children: /*#__PURE__*/ jsx("nav", {
|
|
23
|
+
...props,
|
|
24
|
+
className: verticalNavigationStyles({
|
|
25
|
+
size
|
|
26
|
+
}).root({
|
|
27
|
+
className
|
|
28
|
+
}),
|
|
29
|
+
"data-part": "root",
|
|
30
|
+
"data-scope": "vertical-navigation",
|
|
31
|
+
dir: dir,
|
|
32
|
+
children: children
|
|
33
|
+
})
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
VerticalNavigation.Root = VerticalNavigation;
|
|
39
|
+
VerticalNavigation.List = function({ children, className, ...props }) {
|
|
40
|
+
useVerticalNavigationContext();
|
|
41
|
+
const depth = useContext(VerticalNavigationDepthContext);
|
|
42
|
+
return /*#__PURE__*/ jsx(VerticalNavigationDepthContext.Provider, {
|
|
43
|
+
value: depth + 1,
|
|
44
|
+
children: /*#__PURE__*/ jsx("ul", {
|
|
45
|
+
...props,
|
|
46
|
+
className: verticalNavigationStyles().list({
|
|
47
|
+
className
|
|
48
|
+
}),
|
|
49
|
+
"data-depth": depth,
|
|
50
|
+
"data-part": "list",
|
|
51
|
+
"data-scope": "vertical-navigation",
|
|
52
|
+
children: children
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
VerticalNavigation.Item = function({ className, ...props }) {
|
|
57
|
+
useVerticalNavigationContext();
|
|
58
|
+
return /*#__PURE__*/ jsx(VerticalNavigationBranchContext.Provider, {
|
|
59
|
+
value: null,
|
|
60
|
+
children: /*#__PURE__*/ jsx("li", {
|
|
61
|
+
...props,
|
|
62
|
+
className: verticalNavigationStyles().item({
|
|
63
|
+
className
|
|
64
|
+
}),
|
|
65
|
+
"data-part": "item",
|
|
66
|
+
"data-scope": "vertical-navigation"
|
|
67
|
+
})
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
VerticalNavigation.Row = function({ className, ...props }) {
|
|
71
|
+
useVerticalNavigationContext();
|
|
72
|
+
const branch = useContext(VerticalNavigationBranchContext);
|
|
73
|
+
return /*#__PURE__*/ jsx("div", {
|
|
74
|
+
...props,
|
|
75
|
+
className: verticalNavigationStyles().row({
|
|
76
|
+
className
|
|
77
|
+
}),
|
|
78
|
+
"data-current-path": branch?.containsCurrent || void 0,
|
|
79
|
+
"data-part": "row",
|
|
80
|
+
"data-scope": "vertical-navigation"
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
VerticalNavigation.Link = function({ current = false, className, ...props }) {
|
|
84
|
+
const { size } = useVerticalNavigationContext();
|
|
85
|
+
const branch = useContext(VerticalNavigationBranchContext);
|
|
86
|
+
return /*#__PURE__*/ jsx(LinkButton, {
|
|
87
|
+
...props,
|
|
88
|
+
"aria-current": current ? "page" : void 0,
|
|
89
|
+
className: verticalNavigationStyles({
|
|
90
|
+
size
|
|
91
|
+
}).link({
|
|
92
|
+
className
|
|
93
|
+
}),
|
|
94
|
+
"data-current": current || void 0,
|
|
95
|
+
"data-current-path": branch?.containsCurrent || void 0,
|
|
96
|
+
"data-part": "link",
|
|
97
|
+
"data-scope": "vertical-navigation",
|
|
98
|
+
size: "current",
|
|
99
|
+
theme: "unstyled"
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
VerticalNavigation.Branch = function({ id, open, defaultOpen, onOpenChange, disabled, getRootNode, containsCurrent = false, children, className, ...props }) {
|
|
103
|
+
const { dir } = useVerticalNavigationContext();
|
|
104
|
+
const generatedId = useId();
|
|
105
|
+
const service = useMachine(__rspack_external__zag_js_collapsible_508ff486.machine, {
|
|
106
|
+
id: id ?? generatedId,
|
|
107
|
+
dir,
|
|
108
|
+
open,
|
|
109
|
+
defaultOpen,
|
|
110
|
+
onOpenChange,
|
|
111
|
+
disabled,
|
|
112
|
+
getRootNode
|
|
113
|
+
});
|
|
114
|
+
const api = __rspack_external__zag_js_collapsible_508ff486.connect(service, normalizeProps);
|
|
115
|
+
return /*#__PURE__*/ jsx(VerticalNavigationBranchContext.Provider, {
|
|
116
|
+
value: {
|
|
117
|
+
api,
|
|
118
|
+
containsCurrent
|
|
119
|
+
},
|
|
120
|
+
children: /*#__PURE__*/ jsx("li", {
|
|
121
|
+
...mergeProps(props, api.getRootProps()),
|
|
122
|
+
className: verticalNavigationStyles().item({
|
|
123
|
+
className
|
|
124
|
+
}),
|
|
125
|
+
"data-current-path": containsCurrent || void 0,
|
|
126
|
+
"data-part": "branch",
|
|
127
|
+
"data-scope": "vertical-navigation",
|
|
128
|
+
children: children
|
|
129
|
+
})
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
VerticalNavigation.BranchTrigger = function({ className, disabled, ...props }) {
|
|
133
|
+
const { size } = useVerticalNavigationContext();
|
|
134
|
+
const { api } = useVerticalNavigationBranchContext();
|
|
135
|
+
return /*#__PURE__*/ jsx(Button, {
|
|
136
|
+
...mergeProps(props, api.getTriggerProps()),
|
|
137
|
+
className: verticalNavigationStyles({
|
|
138
|
+
size
|
|
139
|
+
}).trigger({
|
|
140
|
+
className
|
|
141
|
+
}),
|
|
142
|
+
"data-part": "branch-trigger",
|
|
143
|
+
"data-scope": "vertical-navigation",
|
|
144
|
+
disabled: disabled || api.disabled,
|
|
145
|
+
size: "current",
|
|
146
|
+
theme: "unstyled"
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
VerticalNavigation.BranchIndicator = function({ className, ...props }) {
|
|
150
|
+
const { size } = useVerticalNavigationContext();
|
|
151
|
+
const { api } = useVerticalNavigationBranchContext();
|
|
152
|
+
return /*#__PURE__*/ jsx("span", {
|
|
153
|
+
...mergeProps(props, api.getIndicatorProps()),
|
|
154
|
+
"aria-hidden": "true",
|
|
155
|
+
className: verticalNavigationStyles({
|
|
156
|
+
size
|
|
157
|
+
}).indicator({
|
|
158
|
+
className
|
|
159
|
+
}),
|
|
160
|
+
"data-part": "branch-indicator",
|
|
161
|
+
"data-scope": "vertical-navigation",
|
|
162
|
+
children: /*#__PURE__*/ jsx(Icon, {
|
|
163
|
+
icon: "token-icon-vertical-navigation-chevron",
|
|
164
|
+
size: "current"
|
|
165
|
+
})
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
VerticalNavigation.BranchContent = function({ tone = "plain", variant = "primary", indent = true, showGuide = false, className, ...props }) {
|
|
169
|
+
const { maxIndentDepth } = useVerticalNavigationContext();
|
|
170
|
+
const { api } = useVerticalNavigationBranchContext();
|
|
171
|
+
const depth = useContext(VerticalNavigationDepthContext);
|
|
172
|
+
return /*#__PURE__*/ jsx("div", {
|
|
173
|
+
...mergeProps(props, api.getContentProps()),
|
|
174
|
+
className: verticalNavigationStyles({
|
|
175
|
+
tone,
|
|
176
|
+
variant
|
|
177
|
+
}).content({
|
|
178
|
+
className
|
|
179
|
+
}),
|
|
180
|
+
"data-guide": showGuide || void 0,
|
|
181
|
+
"data-indented": indent && depth <= maxIndentDepth || void 0,
|
|
182
|
+
"data-part": "branch-content",
|
|
183
|
+
"data-scope": "vertical-navigation",
|
|
184
|
+
"data-tone": tone,
|
|
185
|
+
"data-variant": variant
|
|
186
|
+
});
|
|
187
|
+
};
|
|
188
|
+
VerticalNavigation.Group = function({ tone = "plain", variant = "primary", className, ...props }) {
|
|
189
|
+
useVerticalNavigationContext();
|
|
190
|
+
return /*#__PURE__*/ jsx("div", {
|
|
191
|
+
...props,
|
|
192
|
+
className: verticalNavigationStyles({
|
|
193
|
+
tone,
|
|
194
|
+
variant
|
|
195
|
+
}).group({
|
|
196
|
+
className
|
|
197
|
+
}),
|
|
198
|
+
"data-part": "group",
|
|
199
|
+
"data-scope": "vertical-navigation",
|
|
200
|
+
"data-tone": tone,
|
|
201
|
+
"data-variant": variant
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
VerticalNavigation.GroupLabel = function({ className, ...props }) {
|
|
205
|
+
const { size } = useVerticalNavigationContext();
|
|
206
|
+
return /*#__PURE__*/ jsx("h2", {
|
|
207
|
+
...props,
|
|
208
|
+
className: verticalNavigationStyles({
|
|
209
|
+
size
|
|
210
|
+
}).groupLabel({
|
|
211
|
+
className
|
|
212
|
+
}),
|
|
213
|
+
"data-part": "group-label",
|
|
214
|
+
"data-scope": "vertical-navigation"
|
|
215
|
+
});
|
|
216
|
+
};
|
|
217
|
+
VerticalNavigation.Separator = function({ className, ...props }) {
|
|
218
|
+
useVerticalNavigationContext();
|
|
219
|
+
return /*#__PURE__*/ jsx("hr", {
|
|
220
|
+
...props,
|
|
221
|
+
className: verticalNavigationStyles().separator({
|
|
222
|
+
className
|
|
223
|
+
}),
|
|
224
|
+
"data-part": "separator",
|
|
225
|
+
"data-scope": "vertical-navigation"
|
|
226
|
+
});
|
|
227
|
+
};
|
|
228
|
+
export { VerticalNavigation };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"numeric-input.d.ts","sourceRoot":"","sources":["../../../src/atoms/numeric-input.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,WAAW,MAAM,sBAAsB,CAAA;AAEnD,OAAO,EACL,KAAK,wBAAwB,EAE7B,KAAK,SAAS,EACd,KAAK,GAAG,EAGT,MAAM,OAAO,CAAA;AAGd,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAyGtC,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAClC,WAAW,CAAC,KAAK,EACjB,OAAO,GAAG,cAAc,GAAG,IAAI,CAChC,GACC,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC,GAAG;IAC/D,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CA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,SAAQ,wBAAwB,CAAC,KAAK,CAAC;IACvC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAA;CAC1B"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Api } from "@zag-js/collapsible";
|
|
2
|
+
import type { PropTypes } from "@zag-js/react";
|
|
3
|
+
export type VerticalNavigationSize = "sm" | "md";
|
|
4
|
+
export type VerticalNavigationTone = "plain" | "subtle" | "accent";
|
|
5
|
+
export type VerticalNavigationVariant = "primary" | "secondary";
|
|
6
|
+
export declare const VerticalNavigationContext: import("react").Context<{
|
|
7
|
+
size: VerticalNavigationSize;
|
|
8
|
+
maxIndentDepth: number;
|
|
9
|
+
dir?: "ltr" | "rtl";
|
|
10
|
+
} | null>;
|
|
11
|
+
export declare const VerticalNavigationDepthContext: import("react").Context<number>;
|
|
12
|
+
export declare const VerticalNavigationBranchContext: import("react").Context<{
|
|
13
|
+
api: Api<PropTypes>;
|
|
14
|
+
containsCurrent: boolean;
|
|
15
|
+
} | null>;
|
|
16
|
+
export declare function useVerticalNavigationContext(): {
|
|
17
|
+
size: VerticalNavigationSize;
|
|
18
|
+
maxIndentDepth: number;
|
|
19
|
+
dir?: "ltr" | "rtl";
|
|
20
|
+
};
|
|
21
|
+
export declare function useVerticalNavigationBranchContext(): {
|
|
22
|
+
api: Api<PropTypes>;
|
|
23
|
+
containsCurrent: boolean;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=vertical-navigation.context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vertical-navigation.context.d.ts","sourceRoot":"","sources":["../../../../src/internal/molecules/vertical-navigation.context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAG9C,MAAM,MAAM,sBAAsB,GAAG,IAAI,GAAG,IAAI,CAAA;AAChD,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAClE,MAAM,MAAM,yBAAyB,GAAG,SAAS,GAAG,WAAW,CAAA;AAE/D,eAAO,MAAM,yBAAyB;UAC9B,sBAAsB;oBACZ,MAAM;UAChB,KAAK,GAAG,KAAK;SACN,CAAA;AACf,eAAO,MAAM,8BAA8B,iCAAmB,CAAA;AAC9D,eAAO,MAAM,+BAA+B;SACrC,GAAG,CAAC,SAAS,CAAC;qBACF,OAAO;SACX,CAAA;AAEf,wBAAgB,4BAA4B;UAVpC,sBAAsB;oBACZ,MAAM;UAChB,KAAK,GAAG,KAAK;EAgBpB;AAED,wBAAgB,kCAAkC;SAd3C,GAAG,CAAC,SAAS,CAAC;qBACF,OAAO;EAqBzB"}
|