@ttoss/fsl-ui 0.2.4
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/LICENSE +21 -0
- package/README.md +76 -0
- package/dist/_virtual/_rolldown/runtime.cjs +30 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.cjs +129 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.cts +61 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.mts +61 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.mjs +126 -0
- package/dist/components/Button/Button.cjs +80 -0
- package/dist/components/Button/Button.d.cts +68 -0
- package/dist/components/Button/Button.d.mts +68 -0
- package/dist/components/Button/Button.mjs +79 -0
- package/dist/components/Checkbox/Checkbox.cjs +183 -0
- package/dist/components/Checkbox/Checkbox.d.cts +45 -0
- package/dist/components/Checkbox/Checkbox.d.mts +45 -0
- package/dist/components/Checkbox/Checkbox.mjs +182 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.cjs +97 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.d.cts +56 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.d.mts +56 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.mjs +96 -0
- package/dist/components/FileTrigger/FileTrigger.cjs +51 -0
- package/dist/components/FileTrigger/FileTrigger.d.cts +52 -0
- package/dist/components/FileTrigger/FileTrigger.d.mts +52 -0
- package/dist/components/FileTrigger/FileTrigger.mjs +50 -0
- package/dist/components/GridList/GridList.cjs +220 -0
- package/dist/components/GridList/GridList.d.cts +72 -0
- package/dist/components/GridList/GridList.d.mts +72 -0
- package/dist/components/GridList/GridList.mjs +217 -0
- package/dist/components/Group/Group.cjs +77 -0
- package/dist/components/Group/Group.d.cts +61 -0
- package/dist/components/Group/Group.d.mts +61 -0
- package/dist/components/Group/Group.mjs +74 -0
- package/dist/components/Icon/Icon.cjs +52 -0
- package/dist/components/Icon/Icon.mjs +52 -0
- package/dist/components/Icon/glyphs.cjs +72 -0
- package/dist/components/Icon/glyphs.mjs +63 -0
- package/dist/components/Link/Link.cjs +62 -0
- package/dist/components/Link/Link.d.cts +38 -0
- package/dist/components/Link/Link.d.mts +38 -0
- package/dist/components/Link/Link.mjs +61 -0
- package/dist/components/ListBox/ListBox.cjs +126 -0
- package/dist/components/ListBox/ListBox.d.cts +63 -0
- package/dist/components/ListBox/ListBox.d.mts +63 -0
- package/dist/components/ListBox/ListBox.mjs +123 -0
- package/dist/components/Meter/Meter.cjs +126 -0
- package/dist/components/Meter/Meter.d.cts +63 -0
- package/dist/components/Meter/Meter.d.mts +63 -0
- package/dist/components/Meter/Meter.mjs +125 -0
- package/dist/components/NumberField/NumberField.cjs +221 -0
- package/dist/components/NumberField/NumberField.d.cts +68 -0
- package/dist/components/NumberField/NumberField.d.mts +68 -0
- package/dist/components/NumberField/NumberField.mjs +220 -0
- package/dist/components/ProgressBar/ProgressBar.cjs +132 -0
- package/dist/components/ProgressBar/ProgressBar.d.cts +56 -0
- package/dist/components/ProgressBar/ProgressBar.d.mts +56 -0
- package/dist/components/ProgressBar/ProgressBar.mjs +129 -0
- package/dist/components/RadioGroup/RadioGroup.cjs +218 -0
- package/dist/components/RadioGroup/RadioGroup.d.cts +82 -0
- package/dist/components/RadioGroup/RadioGroup.d.mts +82 -0
- package/dist/components/RadioGroup/RadioGroup.mjs +215 -0
- package/dist/components/Select/Select.cjs +253 -0
- package/dist/components/Select/Select.d.cts +86 -0
- package/dist/components/Select/Select.d.mts +86 -0
- package/dist/components/Select/Select.mjs +250 -0
- package/dist/components/Separator/Separator.cjs +64 -0
- package/dist/components/Separator/Separator.d.cts +44 -0
- package/dist/components/Separator/Separator.d.mts +44 -0
- package/dist/components/Separator/Separator.mjs +63 -0
- package/dist/components/Slider/Slider.cjs +160 -0
- package/dist/components/Slider/Slider.d.cts +45 -0
- package/dist/components/Slider/Slider.d.mts +45 -0
- package/dist/components/Slider/Slider.mjs +159 -0
- package/dist/components/Switch/Switch.cjs +176 -0
- package/dist/components/Switch/Switch.d.cts +43 -0
- package/dist/components/Switch/Switch.d.mts +43 -0
- package/dist/components/Switch/Switch.mjs +175 -0
- package/dist/components/Tabs/Tabs.cjs +180 -0
- package/dist/components/Tabs/Tabs.d.cts +85 -0
- package/dist/components/Tabs/Tabs.d.mts +85 -0
- package/dist/components/Tabs/Tabs.mjs +173 -0
- package/dist/components/Toast/Toast.cjs +218 -0
- package/dist/components/Toast/Toast.d.cts +96 -0
- package/dist/components/Toast/Toast.d.mts +96 -0
- package/dist/components/Toast/Toast.mjs +214 -0
- package/dist/components/ToggleButton/ToggleButton.cjs +125 -0
- package/dist/components/ToggleButton/ToggleButton.d.cts +43 -0
- package/dist/components/ToggleButton/ToggleButton.d.mts +43 -0
- package/dist/components/ToggleButton/ToggleButton.mjs +124 -0
- package/dist/components/ToggleButtonGroup/ToggleButtonGroup.cjs +48 -0
- package/dist/components/ToggleButtonGroup/ToggleButtonGroup.d.cts +41 -0
- package/dist/components/ToggleButtonGroup/ToggleButtonGroup.d.mts +41 -0
- package/dist/components/ToggleButtonGroup/ToggleButtonGroup.mjs +47 -0
- package/dist/components/Toolbar/Toolbar.cjs +67 -0
- package/dist/components/Toolbar/Toolbar.d.cts +60 -0
- package/dist/components/Toolbar/Toolbar.d.mts +60 -0
- package/dist/components/Toolbar/Toolbar.mjs +66 -0
- package/dist/composites/Accordion/Accordion.cjs +279 -0
- package/dist/composites/Accordion/Accordion.d.cts +176 -0
- package/dist/composites/Accordion/Accordion.d.mts +176 -0
- package/dist/composites/Accordion/Accordion.mjs +270 -0
- package/dist/composites/ConfirmationDialog/ConfirmationDialog.cjs +206 -0
- package/dist/composites/ConfirmationDialog/ConfirmationDialog.d.cts +166 -0
- package/dist/composites/ConfirmationDialog/ConfirmationDialog.d.mts +166 -0
- package/dist/composites/ConfirmationDialog/ConfirmationDialog.mjs +203 -0
- package/dist/composites/Dialog/Dialog.cjs +372 -0
- package/dist/composites/Dialog/Dialog.d.cts +234 -0
- package/dist/composites/Dialog/Dialog.d.mts +234 -0
- package/dist/composites/Dialog/Dialog.mjs +360 -0
- package/dist/composites/Disclosure/Disclosure.cjs +214 -0
- package/dist/composites/Disclosure/Disclosure.d.cts +118 -0
- package/dist/composites/Disclosure/Disclosure.d.mts +118 -0
- package/dist/composites/Disclosure/Disclosure.mjs +207 -0
- package/dist/composites/Form/Form.cjs +161 -0
- package/dist/composites/Form/Form.d.cts +176 -0
- package/dist/composites/Form/Form.d.mts +176 -0
- package/dist/composites/Form/Form.mjs +156 -0
- package/dist/composites/Menu/Menu.cjs +190 -0
- package/dist/composites/Menu/Menu.d.cts +158 -0
- package/dist/composites/Menu/Menu.d.mts +158 -0
- package/dist/composites/Menu/Menu.mjs +186 -0
- package/dist/composites/Popover/Popover.cjs +80 -0
- package/dist/composites/Popover/Popover.d.cts +56 -0
- package/dist/composites/Popover/Popover.d.mts +56 -0
- package/dist/composites/Popover/Popover.mjs +78 -0
- package/dist/composites/SearchField/SearchField.cjs +194 -0
- package/dist/composites/SearchField/SearchField.d.cts +81 -0
- package/dist/composites/SearchField/SearchField.d.mts +81 -0
- package/dist/composites/SearchField/SearchField.mjs +189 -0
- package/dist/composites/TagGroup/TagGroup.cjs +212 -0
- package/dist/composites/TagGroup/TagGroup.d.cts +84 -0
- package/dist/composites/TagGroup/TagGroup.d.mts +84 -0
- package/dist/composites/TagGroup/TagGroup.mjs +209 -0
- package/dist/composites/TextArea/TextArea.cjs +190 -0
- package/dist/composites/TextArea/TextArea.d.cts +95 -0
- package/dist/composites/TextArea/TextArea.d.mts +95 -0
- package/dist/composites/TextArea/TextArea.mjs +181 -0
- package/dist/composites/TextField/TextField.cjs +200 -0
- package/dist/composites/TextField/TextField.d.cts +111 -0
- package/dist/composites/TextField/TextField.d.mts +111 -0
- package/dist/composites/TextField/TextField.mjs +191 -0
- package/dist/composites/Tooltip/Tooltip.cjs +79 -0
- package/dist/composites/Tooltip/Tooltip.d.cts +53 -0
- package/dist/composites/Tooltip/Tooltip.d.mts +53 -0
- package/dist/composites/Tooltip/Tooltip.mjs +77 -0
- package/dist/composites/Wizard/Wizard.cjs +333 -0
- package/dist/composites/Wizard/Wizard.d.cts +206 -0
- package/dist/composites/Wizard/Wizard.d.mts +206 -0
- package/dist/composites/Wizard/Wizard.mjs +324 -0
- package/dist/composites/scope.cjs +124 -0
- package/dist/composites/scope.mjs +121 -0
- package/dist/index.cjs +186 -0
- package/dist/index.d.cts +37 -0
- package/dist/index.d.mts +37 -0
- package/dist/index.mjs +39 -0
- package/dist/semantics/componentMeta.d.cts +37 -0
- package/dist/semantics/componentMeta.d.mts +37 -0
- package/dist/semantics/index.cjs +16 -0
- package/dist/semantics/index.d.cts +4 -0
- package/dist/semantics/index.d.mts +4 -0
- package/dist/semantics/index.mjs +3 -0
- package/dist/semantics/taxonomy.cjs +150 -0
- package/dist/semantics/taxonomy.d.cts +153 -0
- package/dist/semantics/taxonomy.d.mts +153 -0
- package/dist/semantics/taxonomy.mjs +140 -0
- package/dist/tokens/escapeHatch.cjs +13 -0
- package/dist/tokens/escapeHatch.mjs +13 -0
- package/dist/tokens/focusRing.cjs +28 -0
- package/dist/tokens/focusRing.mjs +28 -0
- package/dist/tokens/keyframes.cjs +76 -0
- package/dist/tokens/keyframes.mjs +75 -0
- package/dist/tokens/resolveInteractiveStyle.cjs +41 -0
- package/dist/tokens/resolveInteractiveStyle.mjs +41 -0
- package/llms.txt +142 -0
- package/package.json +70 -0
- package/src/tokens/CONTRACT.md +505 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
|
|
2
|
+
import { RadioGroupProps, RadioProps } from "react-aria-components";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/RadioGroup/RadioGroup.d.ts
|
|
6
|
+
/** Formal semantic identity — RadioGroup root (Selection entity, single-choice). */
|
|
7
|
+
declare const radioGroupMeta: {
|
|
8
|
+
readonly displayName: "RadioGroup";
|
|
9
|
+
readonly entity: "Selection";
|
|
10
|
+
readonly structure: "root";
|
|
11
|
+
};
|
|
12
|
+
/** Formal semantic identity — Radio item (Selection entity, selectionControl + label). */
|
|
13
|
+
declare const radioMeta: {
|
|
14
|
+
readonly displayName: "Radio";
|
|
15
|
+
readonly entity: "Selection";
|
|
16
|
+
readonly structure: "selectionControl";
|
|
17
|
+
readonly composition: "selection";
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Props for the RadioGroup component.
|
|
21
|
+
*/
|
|
22
|
+
interface RadioGroupProps$1 extends Omit<RadioGroupProps, 'style' | 'children'> {
|
|
23
|
+
/** Group label displayed above the radio options. */
|
|
24
|
+
label?: React.ReactNode;
|
|
25
|
+
/** Radio option children — must be `Radio` components. */
|
|
26
|
+
children?: React.ReactNode;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A semantic radio group built on React Aria.
|
|
30
|
+
*
|
|
31
|
+
* Orchestrates a set of mutually exclusive `Radio` options. Validation
|
|
32
|
+
* feedback flows from `isInvalid` (or React Aria's `validate` callback) and
|
|
33
|
+
* surfaces on each Radio via the `invalid` State.
|
|
34
|
+
*
|
|
35
|
+
* Entity = Selection, interaction = `select.single`.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```tsx
|
|
39
|
+
* <RadioGroup label="Size" defaultValue="md">
|
|
40
|
+
* <Radio value="sm">Small</Radio>
|
|
41
|
+
* <Radio value="md">Medium</Radio>
|
|
42
|
+
* <Radio value="lg">Large</Radio>
|
|
43
|
+
* </RadioGroup>
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
declare const RadioGroup$1: {
|
|
47
|
+
({
|
|
48
|
+
label,
|
|
49
|
+
children,
|
|
50
|
+
...props
|
|
51
|
+
}: RadioGroupProps$1): import("react/jsx-runtime").JSX.Element;
|
|
52
|
+
displayName: "RadioGroup";
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Props for the Radio component.
|
|
56
|
+
*/
|
|
57
|
+
interface RadioProps$1 extends Omit<RadioProps, 'style' | 'children'> {
|
|
58
|
+
/** Label content displayed next to the radio indicator. */
|
|
59
|
+
children?: React.ReactNode;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A single radio option — must be used inside a `RadioGroup`.
|
|
63
|
+
*
|
|
64
|
+
* Renders a circular indicator (`data-part="selectionControl"`) with an
|
|
65
|
+
* inner dot (`data-part="indicator"`) when selected. Reads the parent
|
|
66
|
+
* group's `isInvalid` from React Aria's render props and surfaces the
|
|
67
|
+
* `invalid` State on the control.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```tsx
|
|
71
|
+
* <Radio value="sm">Small</Radio>
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
declare const Radio$1: {
|
|
75
|
+
({
|
|
76
|
+
children,
|
|
77
|
+
...props
|
|
78
|
+
}: RadioProps$1): import("react/jsx-runtime").JSX.Element;
|
|
79
|
+
displayName: "Radio";
|
|
80
|
+
};
|
|
81
|
+
//#endregion
|
|
82
|
+
export { Radio$1 as Radio, RadioGroup$1 as RadioGroup, RadioGroupProps$1 as RadioGroupProps, RadioProps$1 as RadioProps, radioGroupMeta, radioMeta };
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
import { focusRingOutline } from "../../tokens/focusRing.mjs";
|
|
3
|
+
import { resolveInteractiveStyle } from "../../tokens/resolveInteractiveStyle.mjs";
|
|
4
|
+
import { vars } from "@ttoss/fsl-theme/vars";
|
|
5
|
+
import { Label, Radio, RadioGroup } from "react-aria-components";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/components/RadioGroup/RadioGroup.tsx
|
|
9
|
+
/** Formal semantic identity — RadioGroup root (Selection entity, single-choice). */
|
|
10
|
+
var radioGroupMeta = {
|
|
11
|
+
displayName: "RadioGroup",
|
|
12
|
+
entity: "Selection",
|
|
13
|
+
structure: "root"
|
|
14
|
+
};
|
|
15
|
+
/** Formal semantic identity — Radio item (Selection entity, selectionControl + label). */
|
|
16
|
+
var radioMeta = {
|
|
17
|
+
displayName: "Radio",
|
|
18
|
+
entity: "Selection",
|
|
19
|
+
structure: "selectionControl",
|
|
20
|
+
composition: "selection"
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* A semantic radio group built on React Aria.
|
|
24
|
+
*
|
|
25
|
+
* Orchestrates a set of mutually exclusive `Radio` options. Validation
|
|
26
|
+
* feedback flows from `isInvalid` (or React Aria's `validate` callback) and
|
|
27
|
+
* surfaces on each Radio via the `invalid` State.
|
|
28
|
+
*
|
|
29
|
+
* Entity = Selection, interaction = `select.single`.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* <RadioGroup label="Size" defaultValue="md">
|
|
34
|
+
* <Radio value="sm">Small</Radio>
|
|
35
|
+
* <Radio value="md">Medium</Radio>
|
|
36
|
+
* <Radio value="lg">Large</Radio>
|
|
37
|
+
* </RadioGroup>
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
var RadioGroup$1 = ({
|
|
41
|
+
label,
|
|
42
|
+
children,
|
|
43
|
+
...props
|
|
44
|
+
}) => {
|
|
45
|
+
const c = vars.colors.input.primary;
|
|
46
|
+
return /* @__PURE__ */jsxs(RadioGroup, {
|
|
47
|
+
...props,
|
|
48
|
+
"data-scope": "radio-group",
|
|
49
|
+
"data-part": "root",
|
|
50
|
+
style: {
|
|
51
|
+
boxSizing: "border-box",
|
|
52
|
+
display: "flex",
|
|
53
|
+
flexDirection: "column",
|
|
54
|
+
gap: vars.spacing.gap.stack.sm
|
|
55
|
+
},
|
|
56
|
+
children: [label && /* @__PURE__ */jsx(Label, {
|
|
57
|
+
"data-scope": "radio-group",
|
|
58
|
+
"data-part": "label",
|
|
59
|
+
style: {
|
|
60
|
+
...vars.text.label.md,
|
|
61
|
+
color: c?.text?.default
|
|
62
|
+
},
|
|
63
|
+
children: label
|
|
64
|
+
}), children]
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
RadioGroup$1.displayName = radioGroupMeta.displayName;
|
|
68
|
+
var RADIO_BOX_STATIC = {
|
|
69
|
+
boxSizing: "border-box",
|
|
70
|
+
flexShrink: 0,
|
|
71
|
+
position: "relative",
|
|
72
|
+
display: "inline-flex",
|
|
73
|
+
alignItems: "center",
|
|
74
|
+
justifyContent: "center",
|
|
75
|
+
width: "1.125rem",
|
|
76
|
+
height: "1.125rem",
|
|
77
|
+
borderRadius: vars.radii.round,
|
|
78
|
+
borderStyle: vars.border.outline.control.style,
|
|
79
|
+
transitionProperty: "background-color, border-color, border-width",
|
|
80
|
+
transitionDuration: vars.motion.feedback.duration,
|
|
81
|
+
transitionTimingFunction: vars.motion.feedback.easing,
|
|
82
|
+
outlineOffset: "2px"
|
|
83
|
+
};
|
|
84
|
+
/** Circular radio-indicator style (state-dependent chrome + focus ring). */
|
|
85
|
+
var buildRadioBoxStyle = ({
|
|
86
|
+
c,
|
|
87
|
+
isSelected,
|
|
88
|
+
isInvalid,
|
|
89
|
+
isDisabled,
|
|
90
|
+
isHovered,
|
|
91
|
+
isPressed,
|
|
92
|
+
isFocusVisible
|
|
93
|
+
}) => {
|
|
94
|
+
return {
|
|
95
|
+
...RADIO_BOX_STATIC,
|
|
96
|
+
borderWidth: isSelected ? vars.border.outline.selected.width : vars.border.outline.control.width,
|
|
97
|
+
backgroundColor: resolveInteractiveStyle(c?.background, {
|
|
98
|
+
isDisabled,
|
|
99
|
+
isInvalid,
|
|
100
|
+
isSelected,
|
|
101
|
+
isHovered,
|
|
102
|
+
isPressed
|
|
103
|
+
}),
|
|
104
|
+
borderColor: resolveInteractiveStyle(c?.border, {
|
|
105
|
+
isDisabled,
|
|
106
|
+
isInvalid,
|
|
107
|
+
isSelected,
|
|
108
|
+
isFocusVisible
|
|
109
|
+
}),
|
|
110
|
+
outline: focusRingOutline(isFocusVisible)
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
/** Label color — invalid dominates disabled dominates default. */
|
|
114
|
+
var resolveRadioLabelColor = ({
|
|
115
|
+
c,
|
|
116
|
+
isInvalid,
|
|
117
|
+
isDisabled
|
|
118
|
+
}) => {
|
|
119
|
+
const text = c?.text;
|
|
120
|
+
if (isInvalid) return text?.invalid;
|
|
121
|
+
if (isDisabled) return text?.disabled;
|
|
122
|
+
return text?.default;
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* A single radio option — must be used inside a `RadioGroup`.
|
|
126
|
+
*
|
|
127
|
+
* Renders a circular indicator (`data-part="selectionControl"`) with an
|
|
128
|
+
* inner dot (`data-part="indicator"`) when selected. Reads the parent
|
|
129
|
+
* group's `isInvalid` from React Aria's render props and surfaces the
|
|
130
|
+
* `invalid` State on the control.
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```tsx
|
|
134
|
+
* <Radio value="sm">Small</Radio>
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
var Radio$1 = ({
|
|
138
|
+
children,
|
|
139
|
+
...props
|
|
140
|
+
}) => {
|
|
141
|
+
const c = vars.colors.input.primary;
|
|
142
|
+
return /* @__PURE__ */jsx(Radio, {
|
|
143
|
+
...props,
|
|
144
|
+
"data-scope": "radio",
|
|
145
|
+
"data-part": "root",
|
|
146
|
+
style: ({
|
|
147
|
+
isDisabled
|
|
148
|
+
}) => {
|
|
149
|
+
return {
|
|
150
|
+
boxSizing: "border-box",
|
|
151
|
+
display: "inline-flex",
|
|
152
|
+
alignItems: "center",
|
|
153
|
+
gap: vars.spacing.gap.inline.sm,
|
|
154
|
+
minHeight: vars.sizing.hit.base,
|
|
155
|
+
cursor: isDisabled ? "not-allowed" : "pointer",
|
|
156
|
+
opacity: isDisabled ? vars.opacity.disabled : void 0,
|
|
157
|
+
...vars.text.label.md,
|
|
158
|
+
color: isDisabled ? c?.text?.disabled : c?.text?.default
|
|
159
|
+
};
|
|
160
|
+
},
|
|
161
|
+
children: ({
|
|
162
|
+
isHovered,
|
|
163
|
+
isPressed,
|
|
164
|
+
isDisabled,
|
|
165
|
+
isFocusVisible,
|
|
166
|
+
isSelected,
|
|
167
|
+
isInvalid
|
|
168
|
+
}) => {
|
|
169
|
+
const text = c?.text;
|
|
170
|
+
return /* @__PURE__ */jsxs(Fragment, {
|
|
171
|
+
children: [/* @__PURE__ */jsx("span", {
|
|
172
|
+
"data-scope": "radio",
|
|
173
|
+
"data-part": "selectionControl",
|
|
174
|
+
"aria-hidden": true,
|
|
175
|
+
style: buildRadioBoxStyle({
|
|
176
|
+
c,
|
|
177
|
+
isSelected,
|
|
178
|
+
isInvalid,
|
|
179
|
+
isDisabled,
|
|
180
|
+
isHovered,
|
|
181
|
+
isPressed,
|
|
182
|
+
isFocusVisible
|
|
183
|
+
}),
|
|
184
|
+
children: isSelected && /* @__PURE__ */jsx("span", {
|
|
185
|
+
"data-scope": "radio",
|
|
186
|
+
"data-part": "indicator",
|
|
187
|
+
"aria-hidden": true,
|
|
188
|
+
style: {
|
|
189
|
+
width: "0.4375rem",
|
|
190
|
+
height: "0.4375rem",
|
|
191
|
+
borderRadius: vars.radii.round,
|
|
192
|
+
backgroundColor: text?.checked ?? text?.default,
|
|
193
|
+
flexShrink: 0
|
|
194
|
+
}
|
|
195
|
+
})
|
|
196
|
+
}), children != null && /* @__PURE__ */jsx("span", {
|
|
197
|
+
"data-scope": "radio",
|
|
198
|
+
"data-part": "label",
|
|
199
|
+
style: {
|
|
200
|
+
color: resolveRadioLabelColor({
|
|
201
|
+
c,
|
|
202
|
+
isInvalid,
|
|
203
|
+
isDisabled
|
|
204
|
+
})
|
|
205
|
+
},
|
|
206
|
+
children
|
|
207
|
+
})]
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
};
|
|
212
|
+
Radio$1.displayName = radioMeta.displayName;
|
|
213
|
+
|
|
214
|
+
//#endregion
|
|
215
|
+
export { Radio$1 as Radio, RadioGroup$1 as RadioGroup, radioGroupMeta, radioMeta };
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
const require_focusRing = require('../../tokens/focusRing.cjs');
|
|
3
|
+
const require_resolveInteractiveStyle = require('../../tokens/resolveInteractiveStyle.cjs');
|
|
4
|
+
const require_Icon = require('../Icon/Icon.cjs');
|
|
5
|
+
let _ttoss_fsl_theme_vars = require("@ttoss/fsl-theme/vars");
|
|
6
|
+
let react_aria_components = require("react-aria-components");
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
|
|
9
|
+
//#region src/components/Select/Select.tsx
|
|
10
|
+
var selectMeta = {
|
|
11
|
+
displayName: "Select",
|
|
12
|
+
entity: "Selection",
|
|
13
|
+
structure: "root"
|
|
14
|
+
};
|
|
15
|
+
var selectItemMeta = {
|
|
16
|
+
displayName: "SelectItem",
|
|
17
|
+
entity: "Selection",
|
|
18
|
+
structure: "item",
|
|
19
|
+
composition: "selection"
|
|
20
|
+
};
|
|
21
|
+
/** Trigger label color — invalid dominates default (Selection has no evaluation). */
|
|
22
|
+
var resolveSelectLabelColor = ({
|
|
23
|
+
c,
|
|
24
|
+
isInvalid
|
|
25
|
+
}) => {
|
|
26
|
+
const text = c?.text;
|
|
27
|
+
return isInvalid ? text?.invalid : text?.default;
|
|
28
|
+
};
|
|
29
|
+
/** Dropdown popover surface style — Selection-entity chrome. */
|
|
30
|
+
var buildPopoverStyle = c => {
|
|
31
|
+
return {
|
|
32
|
+
boxSizing: "border-box",
|
|
33
|
+
borderRadius: _ttoss_fsl_theme_vars.vars.radii.control,
|
|
34
|
+
borderWidth: _ttoss_fsl_theme_vars.vars.border.outline.control.width,
|
|
35
|
+
borderStyle: _ttoss_fsl_theme_vars.vars.border.outline.control.style,
|
|
36
|
+
borderColor: c?.border?.default,
|
|
37
|
+
backgroundColor: c?.background?.default,
|
|
38
|
+
overflow: "hidden"
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* A semantic dropdown selection built on React Aria.
|
|
43
|
+
*
|
|
44
|
+
* Composes a trigger `Button`, a floating `Popover`, and a `ListBox`.
|
|
45
|
+
* Use `SelectItem` for each option.
|
|
46
|
+
*
|
|
47
|
+
* Entity = Selection, interaction = `select.single`. Validation feedback is
|
|
48
|
+
* driven by React Aria's `isInvalid` and surfaces on the trigger via the
|
|
49
|
+
* `invalid` token State.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```tsx
|
|
53
|
+
* <Select label="Framework" placeholder="Choose a framework">
|
|
54
|
+
* <SelectItem id="react">React</SelectItem>
|
|
55
|
+
* <SelectItem id="vue">Vue</SelectItem>
|
|
56
|
+
* <SelectItem id="angular">Angular</SelectItem>
|
|
57
|
+
* </Select>
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
var Select = ({
|
|
61
|
+
label,
|
|
62
|
+
placeholder = "Select…",
|
|
63
|
+
children,
|
|
64
|
+
...props
|
|
65
|
+
}) => {
|
|
66
|
+
const c = _ttoss_fsl_theme_vars.vars.colors.input.primary;
|
|
67
|
+
return /* @__PURE__ */(0, react_jsx_runtime.jsx)(react_aria_components.Select, {
|
|
68
|
+
...props,
|
|
69
|
+
"data-scope": "select",
|
|
70
|
+
"data-part": "root",
|
|
71
|
+
style: {
|
|
72
|
+
boxSizing: "border-box",
|
|
73
|
+
display: "inline-flex",
|
|
74
|
+
flexDirection: "column",
|
|
75
|
+
gap: _ttoss_fsl_theme_vars.vars.spacing.gap.stack.xs
|
|
76
|
+
},
|
|
77
|
+
children: ({
|
|
78
|
+
isInvalid
|
|
79
|
+
}) => {
|
|
80
|
+
return /* @__PURE__ */(0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, {
|
|
81
|
+
children: [label && /* @__PURE__ */(0, react_jsx_runtime.jsx)(react_aria_components.Label, {
|
|
82
|
+
"data-scope": "select",
|
|
83
|
+
"data-part": "label",
|
|
84
|
+
style: {
|
|
85
|
+
..._ttoss_fsl_theme_vars.vars.text.label.md,
|
|
86
|
+
color: resolveSelectLabelColor({
|
|
87
|
+
c,
|
|
88
|
+
isInvalid
|
|
89
|
+
})
|
|
90
|
+
},
|
|
91
|
+
children: label
|
|
92
|
+
}), /* @__PURE__ */(0, react_jsx_runtime.jsxs)(react_aria_components.Button, {
|
|
93
|
+
"data-scope": "select",
|
|
94
|
+
"data-part": "trigger",
|
|
95
|
+
style: ({
|
|
96
|
+
isHovered,
|
|
97
|
+
isPressed,
|
|
98
|
+
isDisabled,
|
|
99
|
+
isFocusVisible
|
|
100
|
+
}) => {
|
|
101
|
+
return {
|
|
102
|
+
boxSizing: "border-box",
|
|
103
|
+
display: "inline-flex",
|
|
104
|
+
alignItems: "center",
|
|
105
|
+
justifyContent: "space-between",
|
|
106
|
+
gap: _ttoss_fsl_theme_vars.vars.spacing.gap.inline.sm,
|
|
107
|
+
minHeight: _ttoss_fsl_theme_vars.vars.sizing.hit.base,
|
|
108
|
+
paddingBlock: _ttoss_fsl_theme_vars.vars.spacing.inset.control.md,
|
|
109
|
+
paddingInline: _ttoss_fsl_theme_vars.vars.spacing.inset.control.md,
|
|
110
|
+
borderRadius: _ttoss_fsl_theme_vars.vars.radii.control,
|
|
111
|
+
borderWidth: _ttoss_fsl_theme_vars.vars.border.outline.control.width,
|
|
112
|
+
borderStyle: _ttoss_fsl_theme_vars.vars.border.outline.control.style,
|
|
113
|
+
..._ttoss_fsl_theme_vars.vars.text.label.md,
|
|
114
|
+
cursor: isDisabled ? "not-allowed" : "pointer",
|
|
115
|
+
opacity: isDisabled ? _ttoss_fsl_theme_vars.vars.opacity.disabled : void 0,
|
|
116
|
+
backgroundColor: require_resolveInteractiveStyle.resolveInteractiveStyle(c?.background, {
|
|
117
|
+
isDisabled,
|
|
118
|
+
isInvalid,
|
|
119
|
+
isHovered,
|
|
120
|
+
isPressed
|
|
121
|
+
}),
|
|
122
|
+
borderColor: require_resolveInteractiveStyle.resolveInteractiveStyle(c?.border, {
|
|
123
|
+
isDisabled,
|
|
124
|
+
isInvalid,
|
|
125
|
+
isFocusVisible
|
|
126
|
+
}),
|
|
127
|
+
color: require_resolveInteractiveStyle.resolveInteractiveStyle(c?.text, {
|
|
128
|
+
isDisabled,
|
|
129
|
+
isInvalid,
|
|
130
|
+
isHovered,
|
|
131
|
+
isPressed
|
|
132
|
+
}) ?? c?.text?.default,
|
|
133
|
+
transitionProperty: "background-color, border-color, color",
|
|
134
|
+
transitionDuration: _ttoss_fsl_theme_vars.vars.motion.feedback.duration,
|
|
135
|
+
transitionTimingFunction: _ttoss_fsl_theme_vars.vars.motion.feedback.easing,
|
|
136
|
+
outline: require_focusRing.focusRingOutline(isFocusVisible)
|
|
137
|
+
};
|
|
138
|
+
},
|
|
139
|
+
children: [/* @__PURE__ */(0, react_jsx_runtime.jsx)(react_aria_components.SelectValue, {
|
|
140
|
+
"data-scope": "select",
|
|
141
|
+
"data-part": "content",
|
|
142
|
+
style: {
|
|
143
|
+
flex: 1
|
|
144
|
+
},
|
|
145
|
+
children: ({
|
|
146
|
+
selectedText,
|
|
147
|
+
isPlaceholder
|
|
148
|
+
}) => {
|
|
149
|
+
return /* @__PURE__ */(0, react_jsx_runtime.jsx)("span", {
|
|
150
|
+
style: {
|
|
151
|
+
color: isPlaceholder ? c?.text?.disabled : void 0
|
|
152
|
+
},
|
|
153
|
+
children: isPlaceholder ? placeholder : selectedText
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}), /* @__PURE__ */(0, react_jsx_runtime.jsx)("span", {
|
|
157
|
+
"data-scope": "select",
|
|
158
|
+
"data-part": "icon",
|
|
159
|
+
"aria-hidden": true,
|
|
160
|
+
style: {
|
|
161
|
+
flexShrink: 0
|
|
162
|
+
},
|
|
163
|
+
children: /* @__PURE__ */(0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
164
|
+
intent: "disclosure.expand"
|
|
165
|
+
})
|
|
166
|
+
})]
|
|
167
|
+
}), /* @__PURE__ */(0, react_jsx_runtime.jsx)(react_aria_components.Popover, {
|
|
168
|
+
"data-scope": "select",
|
|
169
|
+
"data-part": "positioner",
|
|
170
|
+
style: buildPopoverStyle(c),
|
|
171
|
+
children: /* @__PURE__ */(0, react_jsx_runtime.jsx)(react_aria_components.ListBox, {
|
|
172
|
+
"data-scope": "select",
|
|
173
|
+
"data-part": "surface",
|
|
174
|
+
style: {
|
|
175
|
+
outline: "none",
|
|
176
|
+
display: "flex",
|
|
177
|
+
flexDirection: "column",
|
|
178
|
+
padding: _ttoss_fsl_theme_vars.vars.spacing.inset.control.md,
|
|
179
|
+
gap: _ttoss_fsl_theme_vars.vars.spacing.gap.stack.xs
|
|
180
|
+
},
|
|
181
|
+
children
|
|
182
|
+
})
|
|
183
|
+
})]
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
};
|
|
188
|
+
Select.displayName = selectMeta.displayName;
|
|
189
|
+
/**
|
|
190
|
+
* A single option inside a `Select` dropdown.
|
|
191
|
+
*
|
|
192
|
+
* Renders interactive hover/focus/selected states via
|
|
193
|
+
* `vars.colors.input.primary.*`.
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```tsx
|
|
197
|
+
* <SelectItem id="react">React</SelectItem>
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
var SelectItem = ({
|
|
201
|
+
children,
|
|
202
|
+
...props
|
|
203
|
+
}) => {
|
|
204
|
+
const c = _ttoss_fsl_theme_vars.vars.colors.input.primary;
|
|
205
|
+
return /* @__PURE__ */(0, react_jsx_runtime.jsx)(react_aria_components.ListBoxItem, {
|
|
206
|
+
...props,
|
|
207
|
+
"data-scope": "select",
|
|
208
|
+
"data-part": "item",
|
|
209
|
+
style: ({
|
|
210
|
+
isHovered,
|
|
211
|
+
isPressed,
|
|
212
|
+
isDisabled,
|
|
213
|
+
isFocusVisible,
|
|
214
|
+
isSelected
|
|
215
|
+
}) => {
|
|
216
|
+
return {
|
|
217
|
+
boxSizing: "border-box",
|
|
218
|
+
display: "flex",
|
|
219
|
+
alignItems: "center",
|
|
220
|
+
paddingBlock: _ttoss_fsl_theme_vars.vars.spacing.inset.control.md,
|
|
221
|
+
paddingInline: _ttoss_fsl_theme_vars.vars.spacing.inset.control.md,
|
|
222
|
+
borderRadius: _ttoss_fsl_theme_vars.vars.radii.control,
|
|
223
|
+
cursor: isDisabled ? "not-allowed" : "pointer",
|
|
224
|
+
opacity: isDisabled ? _ttoss_fsl_theme_vars.vars.opacity.disabled : void 0,
|
|
225
|
+
..._ttoss_fsl_theme_vars.vars.text.label.md,
|
|
226
|
+
backgroundColor: require_resolveInteractiveStyle.resolveInteractiveStyle(c?.background, {
|
|
227
|
+
isDisabled,
|
|
228
|
+
isSelected,
|
|
229
|
+
isHovered,
|
|
230
|
+
isPressed
|
|
231
|
+
}),
|
|
232
|
+
color: require_resolveInteractiveStyle.resolveInteractiveStyle(c?.text, {
|
|
233
|
+
isDisabled,
|
|
234
|
+
isSelected,
|
|
235
|
+
isHovered
|
|
236
|
+
}) ?? c?.text?.default,
|
|
237
|
+
outline: require_focusRing.focusRingOutline(isFocusVisible),
|
|
238
|
+
outlineOffset: "2px",
|
|
239
|
+
transitionProperty: "background-color, color",
|
|
240
|
+
transitionDuration: _ttoss_fsl_theme_vars.vars.motion.feedback.duration,
|
|
241
|
+
transitionTimingFunction: _ttoss_fsl_theme_vars.vars.motion.feedback.easing
|
|
242
|
+
};
|
|
243
|
+
},
|
|
244
|
+
children
|
|
245
|
+
});
|
|
246
|
+
};
|
|
247
|
+
SelectItem.displayName = selectItemMeta.displayName;
|
|
248
|
+
|
|
249
|
+
//#endregion
|
|
250
|
+
exports.Select = Select;
|
|
251
|
+
exports.SelectItem = SelectItem;
|
|
252
|
+
exports.selectItemMeta = selectItemMeta;
|
|
253
|
+
exports.selectMeta = selectMeta;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { ListBoxItemProps, SelectProps } from "react-aria-components";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Select/Select.d.ts
|
|
6
|
+
declare const selectMeta: {
|
|
7
|
+
readonly displayName: "Select";
|
|
8
|
+
readonly entity: "Selection";
|
|
9
|
+
readonly structure: "root";
|
|
10
|
+
};
|
|
11
|
+
declare const selectItemMeta: {
|
|
12
|
+
readonly displayName: "SelectItem";
|
|
13
|
+
readonly entity: "Selection";
|
|
14
|
+
readonly structure: "item";
|
|
15
|
+
readonly composition: "selection";
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Props for the Select component.
|
|
19
|
+
*/
|
|
20
|
+
interface SelectProps$1<T extends object = object> extends Omit<SelectProps<T>, 'style' | 'children'> {
|
|
21
|
+
/** Label displayed above the trigger button. */
|
|
22
|
+
label?: React.ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* Placeholder shown in the trigger when no value is selected.
|
|
25
|
+
*
|
|
26
|
+
* Ships a documented English fallback (`'Select…'`) — the placeholder is
|
|
27
|
+
* supplementary hint text, not a flow-critical label (CONTRIBUTING §6 /
|
|
28
|
+
* ADR-001). Localized hosts should still supply their own copy.
|
|
29
|
+
* @default 'Select…'
|
|
30
|
+
*/
|
|
31
|
+
placeholder?: string;
|
|
32
|
+
/** `SelectItem` children rendered inside the dropdown ListBox. */
|
|
33
|
+
children?: React.ReactNode;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A semantic dropdown selection built on React Aria.
|
|
37
|
+
*
|
|
38
|
+
* Composes a trigger `Button`, a floating `Popover`, and a `ListBox`.
|
|
39
|
+
* Use `SelectItem` for each option.
|
|
40
|
+
*
|
|
41
|
+
* Entity = Selection, interaction = `select.single`. Validation feedback is
|
|
42
|
+
* driven by React Aria's `isInvalid` and surfaces on the trigger via the
|
|
43
|
+
* `invalid` token State.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```tsx
|
|
47
|
+
* <Select label="Framework" placeholder="Choose a framework">
|
|
48
|
+
* <SelectItem id="react">React</SelectItem>
|
|
49
|
+
* <SelectItem id="vue">Vue</SelectItem>
|
|
50
|
+
* <SelectItem id="angular">Angular</SelectItem>
|
|
51
|
+
* </Select>
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
declare const Select: {
|
|
55
|
+
<T extends object = object>({
|
|
56
|
+
label,
|
|
57
|
+
placeholder,
|
|
58
|
+
children,
|
|
59
|
+
...props
|
|
60
|
+
}: SelectProps$1<T>): import("react/jsx-runtime").JSX.Element;
|
|
61
|
+
displayName: "Select";
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Props for the SelectItem component.
|
|
65
|
+
*/
|
|
66
|
+
type SelectItemProps = Omit<ListBoxItemProps, 'style'>;
|
|
67
|
+
/**
|
|
68
|
+
* A single option inside a `Select` dropdown.
|
|
69
|
+
*
|
|
70
|
+
* Renders interactive hover/focus/selected states via
|
|
71
|
+
* `vars.colors.input.primary.*`.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```tsx
|
|
75
|
+
* <SelectItem id="react">React</SelectItem>
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
declare const SelectItem: {
|
|
79
|
+
({
|
|
80
|
+
children,
|
|
81
|
+
...props
|
|
82
|
+
}: SelectItemProps): import("react/jsx-runtime").JSX.Element;
|
|
83
|
+
displayName: "SelectItem";
|
|
84
|
+
};
|
|
85
|
+
//#endregion
|
|
86
|
+
export { Select, SelectItem, SelectItemProps, SelectProps$1 as SelectProps, selectItemMeta, selectMeta };
|