@manakind/ui-core 0.28.1 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -3
- package/dist/accordion/accordion.css +89 -0
- package/dist/accordion/accordion.css.d.ts +2 -0
- package/dist/accordion/accordion.d.ts +79 -0
- package/dist/accordion/accordion.d.ts.map +1 -0
- package/dist/accordion/accordion.js +44 -0
- package/dist/accordion/accordion.js.map +1 -0
- package/dist/accordion/index.d.ts +2 -0
- package/dist/accordion/index.d.ts.map +1 -0
- package/dist/accordion/index.js +2 -0
- package/dist/accordion/index.js.map +1 -0
- package/dist/button/button.css +7 -1
- package/dist/button/button.d.ts +5 -3
- package/dist/button/button.d.ts.map +1 -1
- package/dist/button/button.js +7 -4
- package/dist/button/button.js.map +1 -1
- package/dist/button/icon-button.d.ts +4 -2
- package/dist/button/icon-button.d.ts.map +1 -1
- package/dist/button/icon-button.js +5 -2
- package/dist/button/icon-button.js.map +1 -1
- package/dist/button/loading-interaction.d.ts +6 -0
- package/dist/button/loading-interaction.d.ts.map +1 -0
- package/dist/button/loading-interaction.js +26 -0
- package/dist/button/loading-interaction.js.map +1 -0
- package/dist/calendar/calendar.d.ts +3 -4
- package/dist/calendar/calendar.d.ts.map +1 -1
- package/dist/calendar/calendar.js +5 -2
- package/dist/calendar/calendar.js.map +1 -1
- package/dist/checkbox/checkbox.d.ts +2 -4
- package/dist/checkbox/checkbox.d.ts.map +1 -1
- package/dist/checkbox/checkbox.js +4 -2
- package/dist/checkbox/checkbox.js.map +1 -1
- package/dist/combobox/combobox.d.ts +3 -3
- package/dist/combobox/combobox.d.ts.map +1 -1
- package/dist/combobox/combobox.js +5 -2
- package/dist/combobox/combobox.js.map +1 -1
- package/dist/dialog/dialog.d.ts +3 -4
- package/dist/dialog/dialog.d.ts.map +1 -1
- package/dist/dialog/dialog.js +4 -2
- package/dist/dialog/dialog.js.map +1 -1
- package/dist/fallback-glyphs.js +3 -3
- package/dist/fallback-glyphs.js.map +1 -1
- package/dist/icon-defaults.d.ts +45 -0
- package/dist/icon-defaults.d.ts.map +1 -0
- package/dist/icon-defaults.js +43 -0
- package/dist/icon-defaults.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/menu/action-menu.d.ts +3 -3
- package/dist/menu/action-menu.d.ts.map +1 -1
- package/dist/menu/action-menu.js +4 -2
- package/dist/menu/action-menu.js.map +1 -1
- package/dist/menu/menu.d.ts +5 -7
- package/dist/menu/menu.d.ts.map +1 -1
- package/dist/menu/menu.js +7 -3
- package/dist/menu/menu.js.map +1 -1
- package/dist/radio-group/index.d.ts +2 -0
- package/dist/radio-group/index.d.ts.map +1 -0
- package/dist/radio-group/index.js +2 -0
- package/dist/radio-group/index.js.map +1 -0
- package/dist/radio-group/radio-group.css +70 -0
- package/dist/radio-group/radio-group.css.d.ts +2 -0
- package/dist/radio-group/radio-group.d.ts +74 -0
- package/dist/radio-group/radio-group.d.ts.map +1 -0
- package/dist/radio-group/radio-group.js +57 -0
- package/dist/radio-group/radio-group.js.map +1 -0
- package/dist/select/select.d.ts +3 -3
- package/dist/select/select.d.ts.map +1 -1
- package/dist/select/select.js +5 -2
- package/dist/select/select.js.map +1 -1
- package/dist/sticky/sticky.css +13 -1
- package/dist/sticky/sticky.d.ts +8 -2
- package/dist/sticky/sticky.d.ts.map +1 -1
- package/dist/sticky/sticky.js +3 -3
- package/dist/sticky/sticky.js.map +1 -1
- package/package.json +18 -2
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.ds-radio-group {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
align-items: flex-start;
|
|
6
|
+
gap: var(--ds-radio-group-gap);
|
|
7
|
+
overflow-wrap: anywhere;
|
|
8
|
+
|
|
9
|
+
& .ds-radio-group__label {
|
|
10
|
+
color: var(--ds-radio-group-label-text);
|
|
11
|
+
font-size: var(--ds-radio-group-label-font-size);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
& .ds-radio-group__item {
|
|
15
|
+
display: inline-flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
gap: var(--ds-radio-group-label-gap);
|
|
18
|
+
max-width: 100%;
|
|
19
|
+
color: var(--ds-radio-group-label-text);
|
|
20
|
+
font-size: var(--ds-radio-group-label-font-size);
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
|
|
23
|
+
&[data-disabled] {
|
|
24
|
+
cursor: not-allowed;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/*
|
|
29
|
+
* Checked, the circle fills with the primary and a dot in the primary's
|
|
30
|
+
* own text colour sits in it, as a checked Checkbox's box holds its check.
|
|
31
|
+
* The border stays and darkens: the fill alone need not clear 3:1.
|
|
32
|
+
*/
|
|
33
|
+
& .ds-radio-group__control {
|
|
34
|
+
box-sizing: border-box;
|
|
35
|
+
position: relative;
|
|
36
|
+
flex-shrink: 0;
|
|
37
|
+
inline-size: var(--ds-radio-group-control-size);
|
|
38
|
+
block-size: var(--ds-radio-group-control-size);
|
|
39
|
+
border: 1px solid var(--ds-radio-group-control-border);
|
|
40
|
+
border-radius: 50%;
|
|
41
|
+
background-color: var(--ds-radio-group-control-bg);
|
|
42
|
+
transition:
|
|
43
|
+
background-color 150ms cubic-bezier(0, 0, 0.2, 1),
|
|
44
|
+
border-color 150ms cubic-bezier(0, 0, 0.2, 1);
|
|
45
|
+
|
|
46
|
+
&[data-state="checked"] {
|
|
47
|
+
border-color: var(--ds-radio-group-control-border-checked);
|
|
48
|
+
background-color: var(--ds-radio-group-control-bg-checked);
|
|
49
|
+
|
|
50
|
+
&::after {
|
|
51
|
+
content: "";
|
|
52
|
+
position: absolute;
|
|
53
|
+
inset: calc(var(--ds-radio-group-indicator-inset) - 1px);
|
|
54
|
+
border-radius: 50%;
|
|
55
|
+
background-color: var(--ds-radio-group-indicator-color);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* Ark mirrors the hidden input's `:focus-visible` onto the control. */
|
|
60
|
+
&[data-focus-visible] {
|
|
61
|
+
outline: 2px solid var(--ds-radio-group-focus-ring);
|
|
62
|
+
outline-offset: 3px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&[data-disabled] {
|
|
66
|
+
opacity: var(--ds-opacity-disabled);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import './radio-group.css';
|
|
3
|
+
export interface RadioGroupItem {
|
|
4
|
+
/** Stable value reported by `onValueChange` and compared with `value`. */
|
|
5
|
+
value: string;
|
|
6
|
+
/** Text beside the radio. The whole row is its click target. */
|
|
7
|
+
label: string;
|
|
8
|
+
/** Individually disable this choice without removing it. */
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A radio group has to have a name, expressed as a union so an unnamed group
|
|
13
|
+
* is a compile error rather than an axe finding, as `SegmentGroup` does.
|
|
14
|
+
*/
|
|
15
|
+
type RadioGroupName = {
|
|
16
|
+
/** Visible label, above the choices, naming the group. */
|
|
17
|
+
label: ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* A different accessible name when the visible label alone would not
|
|
20
|
+
* say what the choice is. Keep the visible words in it.
|
|
21
|
+
*/
|
|
22
|
+
'aria-label'?: string;
|
|
23
|
+
} | {
|
|
24
|
+
label?: undefined;
|
|
25
|
+
/** Accessible name when a heading or a section title around it already says what the choice is. */
|
|
26
|
+
'aria-label': string;
|
|
27
|
+
};
|
|
28
|
+
export type RadioGroupProps = RadioGroupName & {
|
|
29
|
+
/** The choices, in order, one under the other. */
|
|
30
|
+
items: RadioGroupItem[];
|
|
31
|
+
/**
|
|
32
|
+
* Controlled value. `null` is controlled with nothing chosen; `undefined`
|
|
33
|
+
* leaves the component to own its value from `defaultValue` onward.
|
|
34
|
+
*/
|
|
35
|
+
value?: string | null;
|
|
36
|
+
/** Initial value when uncontrolled. */
|
|
37
|
+
defaultValue?: string;
|
|
38
|
+
/** Fired with the newly chosen value. Choosing the chosen one again does nothing. */
|
|
39
|
+
onValueChange?: (value: string) => void;
|
|
40
|
+
/** Disable every choice. The chosen one keeps showing which is set. */
|
|
41
|
+
disabled?: boolean;
|
|
42
|
+
/** Name for native form participation through the radio inputs. */
|
|
43
|
+
name?: string;
|
|
44
|
+
/** Extra class names appended after `ds-radio-group`. */
|
|
45
|
+
className?: string;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* One choice among several, as a column of radios, built on Ark UI's
|
|
49
|
+
* RadioGroup: a filter's period, a setting with a handful of options whose
|
|
50
|
+
* labels are worth reading side by side.
|
|
51
|
+
*
|
|
52
|
+
* Ark owns the behaviour: native radio inputs carry the state, the arrow keys
|
|
53
|
+
* move the choice and Tab leaves the group in one step. This wrapper
|
|
54
|
+
* contributes `ds-` classes, the `--ds-radio-group-*` bindings and a flat
|
|
55
|
+
* `items` API.
|
|
56
|
+
*
|
|
57
|
+
* ```tsx
|
|
58
|
+
* <RadioGroup
|
|
59
|
+
* aria-label="Scheduled in"
|
|
60
|
+
* items={[
|
|
61
|
+
* { value: 'any', label: 'Any time' },
|
|
62
|
+
* { value: 'this-week', label: 'This week' },
|
|
63
|
+
* ]}
|
|
64
|
+
* value={when}
|
|
65
|
+
* onValueChange={setWhen}
|
|
66
|
+
* />
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* A few short choices seen at once in a row are a `SegmentGroup`; a long
|
|
70
|
+
* list, or one in a form row, is a `Select`.
|
|
71
|
+
*/
|
|
72
|
+
export declare function RadioGroup({ label, items, value, defaultValue, onValueChange, disabled, name, className, 'aria-label': ariaLabel, }: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
73
|
+
export {};
|
|
74
|
+
//# sourceMappingURL=radio-group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio-group.d.ts","sourceRoot":"","sources":["../../src/radio-group/radio-group.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAU,MAAM,OAAO,CAAC;AAC/C,OAAO,mBAAmB,CAAC;AAG3B,MAAM,WAAW,cAAc;IAC7B,0EAA0E;IAC1E,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,KAAK,EAAE,MAAM,CAAC;IACd,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;GAGG;AACH,KAAK,cAAc,GACf;IACE,0DAA0D;IAC1D,KAAK,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GACD;IACE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,mGAAmG;IACnG,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEN,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG;IAC7C,kDAAkD;IAClD,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,uCAAuC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qFAAqF;IACrF,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,uEAAuE;IACvE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mEAAmE;IACnE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,KAAK,EACL,KAAK,EACL,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,IAAI,EACJ,SAAS,EACT,YAAY,EAAE,SAAS,GACxB,EAAE,eAAe,2CA0DjB"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { RadioGroup as ArkRadioGroup } from '@ark-ui/react/radio-group';
|
|
3
|
+
import { useRef } from 'react';
|
|
4
|
+
import './radio-group.css';
|
|
5
|
+
import { cx } from '../cx';
|
|
6
|
+
/**
|
|
7
|
+
* One choice among several, as a column of radios, built on Ark UI's
|
|
8
|
+
* RadioGroup: a filter's period, a setting with a handful of options whose
|
|
9
|
+
* labels are worth reading side by side.
|
|
10
|
+
*
|
|
11
|
+
* Ark owns the behaviour: native radio inputs carry the state, the arrow keys
|
|
12
|
+
* move the choice and Tab leaves the group in one step. This wrapper
|
|
13
|
+
* contributes `ds-` classes, the `--ds-radio-group-*` bindings and a flat
|
|
14
|
+
* `items` API.
|
|
15
|
+
*
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <RadioGroup
|
|
18
|
+
* aria-label="Scheduled in"
|
|
19
|
+
* items={[
|
|
20
|
+
* { value: 'any', label: 'Any time' },
|
|
21
|
+
* { value: 'this-week', label: 'This week' },
|
|
22
|
+
* ]}
|
|
23
|
+
* value={when}
|
|
24
|
+
* onValueChange={setWhen}
|
|
25
|
+
* />
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* A few short choices seen at once in a row are a `SegmentGroup`; a long
|
|
29
|
+
* list, or one in a form row, is a `Select`.
|
|
30
|
+
*/
|
|
31
|
+
export function RadioGroup({ label, items, value, defaultValue, onValueChange, disabled, name, className, 'aria-label': ariaLabel, }) {
|
|
32
|
+
const rootRef = useRef(null);
|
|
33
|
+
/*
|
|
34
|
+
* As in SegmentGroup: Ark leaves the native radios uncontrolled, so a
|
|
35
|
+
* controlled parent that declines a choice would leave the input checked
|
|
36
|
+
* while the control shows the old one. Restoring the parent's value after
|
|
37
|
+
* Ark has read the inputs keeps the two agreeing.
|
|
38
|
+
*/
|
|
39
|
+
const handleValueChange = (details) => {
|
|
40
|
+
if (details.value !== null)
|
|
41
|
+
onValueChange?.(details.value);
|
|
42
|
+
if (value === undefined || !rootRef.current)
|
|
43
|
+
return;
|
|
44
|
+
for (const input of rootRef.current.querySelectorAll('input[type="radio"]')) {
|
|
45
|
+
input.checked = input.value === value;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
/*
|
|
49
|
+
* Zag names the root by its label part's id, which would outrank an
|
|
50
|
+
* `aria-label`; with both given the visible label is plain text instead.
|
|
51
|
+
*/
|
|
52
|
+
const visibleLabel = label &&
|
|
53
|
+
(ariaLabel ? (_jsx("span", { className: "ds-radio-group__label", children: label })) : (_jsx(ArkRadioGroup.Label, { className: "ds-radio-group__label", children: label })));
|
|
54
|
+
const renderItem = (item) => (_jsxs(ArkRadioGroup.Item, { value: item.value, disabled: item.disabled, className: "ds-radio-group__item", children: [_jsx(ArkRadioGroup.ItemControl, { className: "ds-radio-group__control" }), _jsx(ArkRadioGroup.ItemText, { className: "ds-radio-group__text", children: item.label }), _jsx(ArkRadioGroup.ItemHiddenInput, {})] }, item.value));
|
|
55
|
+
return (_jsxs(ArkRadioGroup.Root, { ref: rootRef, className: cx('ds-radio-group', className), value: value, defaultValue: defaultValue, onValueChange: handleValueChange, disabled: disabled, name: name, orientation: "vertical", "aria-label": ariaLabel, children: [visibleLabel, items.map(renderItem)] }));
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=radio-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio-group.js","sourceRoot":"","sources":["../../src/radio-group/radio-group.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,IAAI,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAkB,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,mBAAmB,CAAC;AAC3B,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAmD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AE,IAAI,CAAC,KAAK,GAA0B,EAC9F,KAAC,aAAa,CAAC,eAAe,KAAG,KAP5B,IAAI,CAAC,KAAK,CAQI,CACtB,CAAC;IAEF,OAAO,CACL,MAAC,aAAa,CAAC,IAAI,IACjB,GAAG,EAAE,OAAO,EACZ,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAAE,SAAS,CAAC,EAC1C,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,EAC1B,aAAa,EAAE,iBAAiB,EAChC,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,WAAW,EAAC,UAAU,gBACV,SAAS,aAEpB,YAAY,EACZ,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,IACH,CACtB,CAAC;AACJ,CAAC","sourcesContent":["import { RadioGroup as ArkRadioGroup } from '@ark-ui/react/radio-group';\nimport { type ReactNode, useRef } from 'react';\nimport './radio-group.css';\nimport { cx } from '../cx';\n\nexport interface RadioGroupItem {\n /** Stable value reported by `onValueChange` and compared with `value`. */\n value: string;\n /** Text beside the radio. The whole row is its click target. */\n label: string;\n /** Individually disable this choice without removing it. */\n disabled?: boolean;\n}\n\n/**\n * A radio group has to have a name, expressed as a union so an unnamed group\n * is a compile error rather than an axe finding, as `SegmentGroup` does.\n */\ntype RadioGroupName =\n | {\n /** Visible label, above the choices, naming the group. */\n label: ReactNode;\n /**\n * A different accessible name when the visible label alone would not\n * say what the choice is. Keep the visible words in it.\n */\n 'aria-label'?: string;\n }\n | {\n label?: undefined;\n /** Accessible name when a heading or a section title around it already says what the choice is. */\n 'aria-label': string;\n };\n\nexport type RadioGroupProps = RadioGroupName & {\n /** The choices, in order, one under the other. */\n items: RadioGroupItem[];\n /**\n * Controlled value. `null` is controlled with nothing chosen; `undefined`\n * leaves the component to own its value from `defaultValue` onward.\n */\n value?: string | null;\n /** Initial value when uncontrolled. */\n defaultValue?: string;\n /** Fired with the newly chosen value. Choosing the chosen one again does nothing. */\n onValueChange?: (value: string) => void;\n /** Disable every choice. The chosen one keeps showing which is set. */\n disabled?: boolean;\n /** Name for native form participation through the radio inputs. */\n name?: string;\n /** Extra class names appended after `ds-radio-group`. */\n className?: string;\n};\n\n/**\n * One choice among several, as a column of radios, built on Ark UI's\n * RadioGroup: a filter's period, a setting with a handful of options whose\n * labels are worth reading side by side.\n *\n * Ark owns the behaviour: native radio inputs carry the state, the arrow keys\n * move the choice and Tab leaves the group in one step. This wrapper\n * contributes `ds-` classes, the `--ds-radio-group-*` bindings and a flat\n * `items` API.\n *\n * ```tsx\n * <RadioGroup\n * aria-label=\"Scheduled in\"\n * items={[\n * { value: 'any', label: 'Any time' },\n * { value: 'this-week', label: 'This week' },\n * ]}\n * value={when}\n * onValueChange={setWhen}\n * />\n * ```\n *\n * A few short choices seen at once in a row are a `SegmentGroup`; a long\n * list, or one in a form row, is a `Select`.\n */\nexport function RadioGroup({\n label,\n items,\n value,\n defaultValue,\n onValueChange,\n disabled,\n name,\n className,\n 'aria-label': ariaLabel,\n}: RadioGroupProps) {\n const rootRef = useRef<HTMLDivElement>(null);\n\n /*\n * As in SegmentGroup: Ark leaves the native radios uncontrolled, so a\n * controlled parent that declines a choice would leave the input checked\n * while the control shows the old one. Restoring the parent's value after\n * Ark has read the inputs keeps the two agreeing.\n */\n const handleValueChange = (details: { value: string | null }) => {\n if (details.value !== null) onValueChange?.(details.value);\n if (value === undefined || !rootRef.current) return;\n for (const input of rootRef.current.querySelectorAll<HTMLInputElement>('input[type=\"radio\"]')) {\n input.checked = input.value === value;\n }\n };\n\n /*\n * Zag names the root by its label part's id, which would outrank an\n * `aria-label`; with both given the visible label is plain text instead.\n */\n const visibleLabel =\n label &&\n (ariaLabel ? (\n <span className=\"ds-radio-group__label\">{label}</span>\n ) : (\n <ArkRadioGroup.Label className=\"ds-radio-group__label\">{label}</ArkRadioGroup.Label>\n ));\n\n const renderItem = (item: RadioGroupItem) => (\n <ArkRadioGroup.Item\n key={item.value}\n value={item.value}\n disabled={item.disabled}\n className=\"ds-radio-group__item\"\n >\n <ArkRadioGroup.ItemControl className=\"ds-radio-group__control\" />\n <ArkRadioGroup.ItemText className=\"ds-radio-group__text\">{item.label}</ArkRadioGroup.ItemText>\n <ArkRadioGroup.ItemHiddenInput />\n </ArkRadioGroup.Item>\n );\n\n return (\n <ArkRadioGroup.Root\n ref={rootRef}\n className={cx('ds-radio-group', className)}\n value={value}\n defaultValue={defaultValue}\n onValueChange={handleValueChange}\n disabled={disabled}\n name={name}\n orientation=\"vertical\"\n aria-label={ariaLabel}\n >\n {visibleLabel}\n {items.map(renderItem)}\n </ArkRadioGroup.Root>\n );\n}\n"]}
|
package/dist/select/select.d.ts
CHANGED
|
@@ -117,8 +117,8 @@ export interface SelectProps {
|
|
|
117
117
|
* open, so one glyph serves both states. Pass `ChevronRight`, not a
|
|
118
118
|
* `ChevronDown`: the slot turns what it is given.
|
|
119
119
|
*
|
|
120
|
-
* Defaults to
|
|
121
|
-
*
|
|
120
|
+
* Defaults to the `chevronRight` of the nearest `IconDefaultsProvider`,
|
|
121
|
+
* where a product puts its own icon set once, or a plain built-in chevron.
|
|
122
122
|
*/
|
|
123
123
|
indicator?: IconSource;
|
|
124
124
|
/** Glyph marking the selected option. Same defaulting rule as {@link SelectProps.indicator}. */
|
|
@@ -156,5 +156,5 @@ export interface SelectProps {
|
|
|
156
156
|
* dialog's panel instead of `<body>`, so the modal does not hide it from
|
|
157
157
|
* assistive tech.
|
|
158
158
|
*/
|
|
159
|
-
export declare function Select({ items, label, placeholder, value, defaultValue, onValueChange, size, disabled, loading, loadingText, invalid, name, className, renderItem, indicator, itemIndicator, 'aria-label': ariaLabel, }: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
159
|
+
export declare function Select({ items, label, placeholder, value, defaultValue, onValueChange, size, disabled, loading, loadingText, invalid, name, className, renderItem, indicator: indicatorProp, itemIndicator: itemIndicatorProp, 'aria-label': ariaLabel, }: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
160
160
|
//# sourceMapping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X,QAAQ,EACR,OAAe,EACf,WAAwB,EACxB,OAAO,EACP,IAAI,EACJ,SAAS,EACT,UAAU,EACV,SAAS,EAAE,aAAa,EACxB,aAAa,EAAE,iBAAiB,EAChC,YAAY,EAAE,SAAS,GACxB,EAAE,WAAW,2CAwHb"}
|
package/dist/select/select.js
CHANGED
|
@@ -6,8 +6,8 @@ import { Icon } from '../icon/icon';
|
|
|
6
6
|
import { PortalContainerContext } from '../portal-container';
|
|
7
7
|
import './select.css';
|
|
8
8
|
import { cx } from '../cx';
|
|
9
|
-
import { Check, ChevronRight } from '../fallback-glyphs';
|
|
10
9
|
import { groupItems } from '../group-items';
|
|
10
|
+
import { useIconDefaults } from '../icon-defaults';
|
|
11
11
|
function ItemContent({ item }) {
|
|
12
12
|
return (_jsxs("span", { className: "ds-select__item-content", children: [item.icon && _jsx("span", { className: "ds-select__item-icon", children: item.icon }), _jsxs("span", { className: "ds-select__item-text", children: [_jsx("span", { children: item.label }), item.description && (_jsxs(_Fragment, { children: [' ', _jsx("span", { className: "ds-select__item-description", children: item.description })] }))] })] }));
|
|
13
13
|
}
|
|
@@ -48,7 +48,10 @@ function chosenWithIcon(item) {
|
|
|
48
48
|
* dialog's panel instead of `<body>`, so the modal does not hide it from
|
|
49
49
|
* assistive tech.
|
|
50
50
|
*/
|
|
51
|
-
export function Select({ items, label, placeholder, value, defaultValue, onValueChange, size = 'md', disabled, loading = false, loadingText = 'Loading…', invalid, name, className, renderItem, indicator
|
|
51
|
+
export function Select({ items, label, placeholder, value, defaultValue, onValueChange, size = 'md', disabled, loading = false, loadingText = 'Loading…', invalid, name, className, renderItem, indicator: indicatorProp, itemIndicator: itemIndicatorProp, 'aria-label': ariaLabel, }) {
|
|
52
|
+
const icons = useIconDefaults();
|
|
53
|
+
const indicator = indicatorProp ?? icons.chevronRight;
|
|
54
|
+
const itemIndicator = itemIndicatorProp ?? icons.check;
|
|
52
55
|
// The collection holds the options in drawn order, so arrows, typeahead and
|
|
53
56
|
// the hidden native select all follow the list on screen.
|
|
54
57
|
const groups = useMemo(() => groupItems(items), [items]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../src/select/select.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAkB,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAkB,MAAM,gBAAgB,CAAC;AAkI5D,SAAS,WAAW,CAAC,EAAE,IAAI,EAAwB;IACjD,OAAO,CACL,gBAAM,SAAS,EAAC,yBAAyB,aACtC,IAAI,CAAC,IAAI,IAAI,eAAM,SAAS,EAAC,sBAAsB,YAAE,IAAI,CAAC,IAAI,GAAQ,EACvE,gBAAM,SAAS,EAAC,sBAAsB,aACpC,yBAAO,IAAI,CAAC,KAAK,GAAQ,EACxB,IAAI,CAAC,WAAW,IAAI,CACnB,8BACG,GAAG,EACJ,eAAM,SAAS,EAAC,6BAA6B,YAAE,IAAI,CAAC,WAAW,GAAQ,IACtE,CACJ,IACI,IACF,CACR,CAAC;AACJ,CAAC;AAED,uEAAuE;AACvE,8DAA8D;AAC9D,SAAS,cAAc,CAAC,IAA4B;IAClD,IAAI,CAAC,IAAI,EAAE,IAAI;QAAE,OAAO,SAAS,CAAC;IAClC,OAAO,CACL,gBAAM,SAAS,EAAC,yBAAyB,aACvC,eAAM,SAAS,E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AAc,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,GACpB,CACvB,GACiB,EACpB,KAAC,SAAS,CAAC,SAAS,IAAC,SAAS,EAAC,sBAAsB,YACnD,KAAC,IAAI,IAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAC,IAAI,EAAC,UAAU,SAAG,GAC5B,IACJ,GACF,EAEpB,KAAC,MAAM,IAAC,SAAS,EAAE,eAAe,YAChC,KAAC,SAAS,CAAC,UAAU,cACnB,KAAC,SAAS,CAAC,OAAO,IAAC,SAAS,EAAC,oBAAoB,YAC9C,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,GACN,GACC,GAChB,EAET,KAAC,SAAS,CAAC,YAAY,KAAG,IACX,CAClB,CAAC;AACJ,CAAC","sourcesContent":["import { Portal } from '@ark-ui/react/portal';\nimport { Select as ArkSelect, createListCollection } from '@ark-ui/react/select';\nimport { type ReactNode, useCallback, useContext, useMemo } from 'react';\nimport { Icon, type IconSource } from '../icon/icon';\nimport { PortalContainerContext } from '../portal-container';\nimport './select.css';\nimport { cx } from '../cx';\nimport { Check, ChevronRight } from '../fallback-glyphs';\nimport { groupItems, type ItemGroup } from '../group-items';\n\nexport type SelectSize = 'sm' | 'md' | 'lg';\n\nexport interface SelectItem {\n /** Stable value submitted and compared. */\n value: string;\n /** Text shown in the list and in the trigger once chosen. */\n label: string;\n /**\n * Optional secondary line under the label in the list, shown muted, such as\n * the category a project is filed under. Part of the option's name. On a\n * highlighted row it takes the row's text colour, which the muted colour\n * was never measured against.\n */\n description?: string;\n /**\n * Decorative mark before the label, in the list and in the trigger once\n * chosen: a category's colour dot or its glyph. The label carries the\n * meaning, so mark it `aria-hidden` or decorative.\n */\n icon?: ReactNode;\n /**\n * The group the option is listed under, by its heading. Options sharing a\n * group are listed together under it, groups in the order they first\n * appear; options without one (or with an empty name) are listed before\n * any group. Same rule as `ComboboxItem.group`.\n */\n group?: string;\n /** Individually disable this option without removing it. */\n disabled?: boolean;\n}\n\nexport interface SelectProps {\n /** Options to choose from. */\n items: SelectItem[];\n /**\n * Visible label. Strongly preferred over `aria-label` — a visible label\n * helps everyone, not only screen reader users, and gives the control a\n * larger hit area.\n */\n label?: ReactNode;\n /** Text shown before anything is chosen. */\n placeholder?: string;\n /**\n * Controlled value.\n *\n * Three states, and the difference between the last two matters:\n * - a string — that option is selected;\n * - `null` — controlled, with nothing selected. The trigger shows the\n * `placeholder`. Use this to reset the field programmatically;\n * - `undefined` — **uncontrolled**. The component owns its own value, from\n * `defaultValue` onward.\n *\n * Passing `undefined` to clear a controlled Select would silently hand\n * ownership back to the component mid-life, which React warns about and\n * which leaves the old selection on screen. Pass `null` instead.\n *\n * A value with no matching entry in `items` — a category deleted since it\n * was stored — is treated as `null` rather than as a selection, so the\n * trigger and the submitted form value agree that nothing is chosen.\n */\n value?: string | null;\n /** Initial value when uncontrolled. */\n defaultValue?: string;\n /**\n * Fired with the newly selected value, or `undefined` when the selection is\n * emptied.\n *\n * `undefined` is reachable by exactly one route, and it is not the obvious\n * one. Ark's `deselectable` behaviour — click the selected row to unselect\n * it — is deliberately **not** enabled: a filter that needs an empty state\n * should offer it as a real option (\"All categories\") rather than as a\n * second, invisible way to reach the same place.\n *\n * What does empty the value is a native **form reset**. Ark tracks the\n * enclosing form unconditionally and restores the initial value on reset,\n * which for a Select mounted without a `defaultValue` is nothing selected.\n * Handle `undefined` if this Select lives in a resettable form; a consumer\n * that mirrors the value into its own state and ignores the empty payload\n * will keep showing a selection the control no longer has.\n */\n onValueChange?: (value: string | undefined) => void;\n /** Control height and type scale. */\n size?: SelectSize;\n /** Disable the whole control. */\n disabled?: boolean;\n /**\n * Options are still being fetched.\n *\n * Renders the control inert with `aria-busy`, so it cannot be opened onto\n * an empty list. Prefer this over passing `items={[]}` while a query is in\n * flight — an empty dropdown reads as \"no options exist\", which is a\n * different and wrong message.\n */\n loading?: boolean;\n /** Text shown in place of the placeholder while `loading`. */\n loadingText?: string;\n /** Marks the field invalid for assistive tech and styling. */\n invalid?: boolean;\n /** Name for native form participation. */\n name?: string;\n /** Extra class names appended after `ds-select` modifiers. */\n className?: string;\n /**\n * Render an option's content. Defaults to its `label`.\n *\n * The escape hatch for rows that `icon` and `description` don't cover.\n * Whatever you return must still convey the option in text; do not return\n * colour or an icon alone. It replaces the label, icon and description in\n * the list, not in the trigger.\n */\n renderItem?: (item: SelectItem) => ReactNode;\n /**\n * Glyph for the trigger's open/close affordance.\n *\n * Must point RIGHT — the component rotates it down when closed and up when\n * open, so one glyph serves both states. Pass `ChevronRight`, not a\n * `ChevronDown`: the slot turns what it is given.\n *\n * Defaults to a plain built-in chevron so `@manakind/ui-core` installs and\n * renders on its own. Products override it with their own icon set.\n */\n indicator?: IconSource;\n /** Glyph marking the selected option. Same defaulting rule as {@link SelectProps.indicator}. */\n itemIndicator?: IconSource;\n /** Accessible name when no visible `label` is supplied. */\n 'aria-label'?: string;\n}\n\nfunction ItemContent({ item }: { item: SelectItem }) {\n return (\n <span className=\"ds-select__item-content\">\n {item.icon && <span className=\"ds-select__item-icon\">{item.icon}</span>}\n <span className=\"ds-select__item-text\">\n <span>{item.label}</span>\n {item.description && (\n <>\n {' '}\n <span className=\"ds-select__item-description\">{item.description}</span>\n </>\n )}\n </span>\n </span>\n );\n}\n\n// The trigger shows a chosen option's icon too. Without one it returns\n// nothing, so Ark falls back to the label or the placeholder.\nfunction chosenWithIcon(item: SelectItem | undefined): ReactNode {\n if (!item?.icon) return undefined;\n return (\n <span className=\"ds-select__item-content\">\n <span className=\"ds-select__item-icon\">{item.icon}</span>\n <span>{item.label}</span>\n </span>\n );\n}\n\n/**\n * Single-select dropdown, built on Ark UI.\n *\n * Ark owns the hard parts: listbox semantics, typeahead, keyboard\n * navigation, focus return on close, and dismiss behaviour. This wrapper\n * contributes `ds-` classes, the `--ds-select-*` bindings, and a flat\n * `items` API in place of Ark's lower-level collection anatomy.\n *\n * ```tsx\n * <Select\n * label=\"Category\"\n * placeholder=\"Filter by category\"\n * items={[{ value: 'all', label: 'All Categories' }]}\n * value={selected}\n * onValueChange={setSelected}\n * />\n * ```\n *\n * Give it a `label` or an `aria-label` — a select with neither is announced\n * as an unnamed combobox. Options can carry a leading `icon`, a muted\n * `description` line and a `group` heading; for multi-select, compose Ark's\n * anatomy directly in a product package rather than widening this API.\n *\n * The listbox renders in a portal, so it escapes ancestor `overflow: hidden`\n * rather than being clipped inside a card. It sits at `z-index: 60`, a step\n * above the products' overlay layer (50), so it paints above the page or\n * dialog it opens from. Inside a ui-core `Dialog` it portals into the\n * dialog's panel instead of `<body>`, so the modal does not hide it from\n * assistive tech.\n */\nexport function Select({\n items,\n label,\n placeholder,\n value,\n defaultValue,\n onValueChange,\n size = 'md',\n disabled,\n loading = false,\n loadingText = 'Loading…',\n invalid,\n name,\n className,\n renderItem,\n indicator = ChevronRight,\n itemIndicator = Check,\n 'aria-label': ariaLabel,\n}: SelectProps) {\n // The collection holds the options in drawn order, so arrows, typeahead and\n // the hidden native select all follow the list on screen.\n const groups = useMemo(() => groupItems(items), [items]);\n const collection = useMemo(\n () =>\n createListCollection({\n items: groups.flatMap((group) => group.items),\n itemToValue: (item) => item.value,\n itemToString: (item) => item.label,\n isItemDisabled: (item) => item.disabled ?? false,\n }),\n [groups],\n );\n\n /*\n * A controlled value that no longer matches an option resolves to empty, so\n * the trigger and the form agree about it.\n *\n * Left unresolved they disagree: the trigger already falls back to the\n * placeholder (Ark drives that off whether a value is *set*, not whether it\n * *resolves*), but the hidden native select ends up with no option marked\n * selected — and a single `<select>` in that state reports its **first**\n * option. Measured: with the value `deleted-category`, the field submits\n * `all`. Reading the placeholder and posting a real, different value is the\n * worse half of the mismatch, and it is silent.\n */\n const controlledValue = useMemo(() => {\n if (value === undefined) return undefined;\n if (value === null) return [];\n return items.some((item) => item.value === value) ? [value] : [];\n }, [value, items]);\n\n // Same resolution for the uncontrolled path: an unresolvable `defaultValue`\n // produces the identical trigger-says-placeholder / form-submits-`all` split.\n const initialValue = useMemo(() => {\n if (defaultValue === undefined) return undefined;\n return items.some((item) => item.value === defaultValue) ? [defaultValue] : [];\n }, [defaultValue, items]);\n\n const portalContainer = useContext(PortalContainerContext);\n\n const handleValueChange = useCallback(\n (details: { value: string[] }) => onValueChange?.(details.value[0]),\n [onValueChange],\n );\n\n const renderOption = (item: SelectItem) => (\n <ArkSelect.Item key={item.value} item={item} className=\"ds-select__item\">\n <ArkSelect.ItemText>\n {renderItem ? renderItem(item) : <ItemContent item={item} />}\n </ArkSelect.ItemText>\n <ArkSelect.ItemIndicator className=\"ds-select__item-indicator\">\n <Icon source={itemIndicator} size=\"sm\" decorative />\n </ArkSelect.ItemIndicator>\n </ArkSelect.Item>\n );\n\n const renderGroup = (group: ItemGroup<SelectItem>) =>\n group.label === undefined ? (\n group.items.map(renderOption)\n ) : (\n <ArkSelect.ItemGroup key={group.label} className=\"ds-select__group\">\n <ArkSelect.ItemGroupLabel className=\"ds-select__group-label\">\n {group.label}\n </ArkSelect.ItemGroupLabel>\n {group.items.map(renderOption)}\n </ArkSelect.ItemGroup>\n );\n\n return (\n <ArkSelect.Root\n collection={collection}\n className={cx('ds-select', `ds-select--${size}`, className)}\n value={controlledValue}\n defaultValue={initialValue}\n onValueChange={handleValueChange}\n disabled={disabled || loading}\n invalid={invalid}\n name={name}\n positioning={{ sameWidth: true }}\n >\n {label && <ArkSelect.Label className=\"ds-select__label\">{label}</ArkSelect.Label>}\n\n <ArkSelect.Control>\n <ArkSelect.Trigger\n className=\"ds-select__trigger\"\n aria-label={ariaLabel}\n aria-busy={loading || undefined}\n >\n <ArkSelect.Context<SelectItem>>\n {(select) => (\n <ArkSelect.ValueText\n placeholder={loading ? loadingText : placeholder}\n className=\"ds-select__value-text\"\n >\n {chosenWithIcon(select.selectedItems[0])}\n </ArkSelect.ValueText>\n )}\n </ArkSelect.Context>\n <ArkSelect.Indicator className=\"ds-select__indicator\">\n <Icon source={indicator} size=\"sm\" decorative />\n </ArkSelect.Indicator>\n </ArkSelect.Trigger>\n </ArkSelect.Control>\n\n <Portal container={portalContainer}>\n <ArkSelect.Positioner>\n <ArkSelect.Content className=\"ds-select__content\">\n {groups.map(renderGroup)}\n </ArkSelect.Content>\n </ArkSelect.Positioner>\n </Portal>\n\n <ArkSelect.HiddenSelect />\n </ArkSelect.Root>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../src/select/select.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAkB,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAkB,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAkInD,SAAS,WAAW,CAAC,EAAE,IAAI,EAAwB;IACjD,OAAO,CACL,gBAAM,SAAS,EAAC,yBAAyB,aACtC,IAAI,CAAC,IAAI,IAAI,eAAM,SAAS,EAAC,sBAAsB,YAAE,IAAI,CAAC,IAAI,GAAQ,EACvE,gBAAM,SAAS,EAAC,sBAAsB,aACpC,yBAAO,IAAI,CAAC,KAAK,GAAQ,EACxB,IAAI,CAAC,WAAW,IAAI,CACnB,8BACG,GAAG,EACJ,eAAM,SAAS,EAAC,6BAA6B,YAAE,IAAI,CAAC,WAAW,GAAQ,IACtE,CACJ,IACI,IACF,CACR,CAAC;AACJ,CAAC;AAED,uEAAuE;AACvE,8DAA8D;AAC9D,SAAS,cAAc,CAAC,IAA4B;IAClD,IAAI,CAAC,IAAI,E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,IAChB,SAAS,EAAC,oBAAoB,gBAClB,SAAS,eACV,OAAO,IAAI,SAAS,aAE/B,KAAC,SAAS,CAAC,OAAO,cACf,CAAC,MAAM,EAAE,EAAE,CAAC,CACX,KAAC,SAAS,CAAC,SAAS,IAClB,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,EAChD,SAAS,EAAC,uBAAuB,YAEhC,cAAc,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,GACpB,CACvB,GACiB,EACpB,KAAC,SAAS,CAAC,SAAS,IAAC,SAAS,EAAC,sBAAsB,YACnD,KAAC,IAAI,IAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAC,IAAI,EAAC,UAAU,SAAG,GAC5B,IACJ,GACF,EAEpB,KAAC,MAAM,IAAC,SAAS,EAAE,eAAe,YAChC,KAAC,SAAS,CAAC,UAAU,cACnB,KAAC,SAAS,CAAC,OAAO,IAAC,SAAS,EAAC,oBAAoB,YAC9C,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,GACN,GACC,GAChB,EAET,KAAC,SAAS,CAAC,YAAY,KAAG,IACX,CAClB,CAAC;AACJ,CAAC","sourcesContent":["import { Portal } from '@ark-ui/react/portal';\nimport { Select as ArkSelect, createListCollection } from '@ark-ui/react/select';\nimport { type ReactNode, useCallback, useContext, useMemo } from 'react';\nimport { Icon, type IconSource } from '../icon/icon';\nimport { PortalContainerContext } from '../portal-container';\nimport './select.css';\nimport { cx } from '../cx';\nimport { groupItems, type ItemGroup } from '../group-items';\nimport { useIconDefaults } from '../icon-defaults';\n\nexport type SelectSize = 'sm' | 'md' | 'lg';\n\nexport interface SelectItem {\n /** Stable value submitted and compared. */\n value: string;\n /** Text shown in the list and in the trigger once chosen. */\n label: string;\n /**\n * Optional secondary line under the label in the list, shown muted, such as\n * the category a project is filed under. Part of the option's name. On a\n * highlighted row it takes the row's text colour, which the muted colour\n * was never measured against.\n */\n description?: string;\n /**\n * Decorative mark before the label, in the list and in the trigger once\n * chosen: a category's colour dot or its glyph. The label carries the\n * meaning, so mark it `aria-hidden` or decorative.\n */\n icon?: ReactNode;\n /**\n * The group the option is listed under, by its heading. Options sharing a\n * group are listed together under it, groups in the order they first\n * appear; options without one (or with an empty name) are listed before\n * any group. Same rule as `ComboboxItem.group`.\n */\n group?: string;\n /** Individually disable this option without removing it. */\n disabled?: boolean;\n}\n\nexport interface SelectProps {\n /** Options to choose from. */\n items: SelectItem[];\n /**\n * Visible label. Strongly preferred over `aria-label` — a visible label\n * helps everyone, not only screen reader users, and gives the control a\n * larger hit area.\n */\n label?: ReactNode;\n /** Text shown before anything is chosen. */\n placeholder?: string;\n /**\n * Controlled value.\n *\n * Three states, and the difference between the last two matters:\n * - a string — that option is selected;\n * - `null` — controlled, with nothing selected. The trigger shows the\n * `placeholder`. Use this to reset the field programmatically;\n * - `undefined` — **uncontrolled**. The component owns its own value, from\n * `defaultValue` onward.\n *\n * Passing `undefined` to clear a controlled Select would silently hand\n * ownership back to the component mid-life, which React warns about and\n * which leaves the old selection on screen. Pass `null` instead.\n *\n * A value with no matching entry in `items` — a category deleted since it\n * was stored — is treated as `null` rather than as a selection, so the\n * trigger and the submitted form value agree that nothing is chosen.\n */\n value?: string | null;\n /** Initial value when uncontrolled. */\n defaultValue?: string;\n /**\n * Fired with the newly selected value, or `undefined` when the selection is\n * emptied.\n *\n * `undefined` is reachable by exactly one route, and it is not the obvious\n * one. Ark's `deselectable` behaviour — click the selected row to unselect\n * it — is deliberately **not** enabled: a filter that needs an empty state\n * should offer it as a real option (\"All categories\") rather than as a\n * second, invisible way to reach the same place.\n *\n * What does empty the value is a native **form reset**. Ark tracks the\n * enclosing form unconditionally and restores the initial value on reset,\n * which for a Select mounted without a `defaultValue` is nothing selected.\n * Handle `undefined` if this Select lives in a resettable form; a consumer\n * that mirrors the value into its own state and ignores the empty payload\n * will keep showing a selection the control no longer has.\n */\n onValueChange?: (value: string | undefined) => void;\n /** Control height and type scale. */\n size?: SelectSize;\n /** Disable the whole control. */\n disabled?: boolean;\n /**\n * Options are still being fetched.\n *\n * Renders the control inert with `aria-busy`, so it cannot be opened onto\n * an empty list. Prefer this over passing `items={[]}` while a query is in\n * flight — an empty dropdown reads as \"no options exist\", which is a\n * different and wrong message.\n */\n loading?: boolean;\n /** Text shown in place of the placeholder while `loading`. */\n loadingText?: string;\n /** Marks the field invalid for assistive tech and styling. */\n invalid?: boolean;\n /** Name for native form participation. */\n name?: string;\n /** Extra class names appended after `ds-select` modifiers. */\n className?: string;\n /**\n * Render an option's content. Defaults to its `label`.\n *\n * The escape hatch for rows that `icon` and `description` don't cover.\n * Whatever you return must still convey the option in text; do not return\n * colour or an icon alone. It replaces the label, icon and description in\n * the list, not in the trigger.\n */\n renderItem?: (item: SelectItem) => ReactNode;\n /**\n * Glyph for the trigger's open/close affordance.\n *\n * Must point RIGHT — the component rotates it down when closed and up when\n * open, so one glyph serves both states. Pass `ChevronRight`, not a\n * `ChevronDown`: the slot turns what it is given.\n *\n * Defaults to the `chevronRight` of the nearest `IconDefaultsProvider`,\n * where a product puts its own icon set once, or a plain built-in chevron.\n */\n indicator?: IconSource;\n /** Glyph marking the selected option. Same defaulting rule as {@link SelectProps.indicator}. */\n itemIndicator?: IconSource;\n /** Accessible name when no visible `label` is supplied. */\n 'aria-label'?: string;\n}\n\nfunction ItemContent({ item }: { item: SelectItem }) {\n return (\n <span className=\"ds-select__item-content\">\n {item.icon && <span className=\"ds-select__item-icon\">{item.icon}</span>}\n <span className=\"ds-select__item-text\">\n <span>{item.label}</span>\n {item.description && (\n <>\n {' '}\n <span className=\"ds-select__item-description\">{item.description}</span>\n </>\n )}\n </span>\n </span>\n );\n}\n\n// The trigger shows a chosen option's icon too. Without one it returns\n// nothing, so Ark falls back to the label or the placeholder.\nfunction chosenWithIcon(item: SelectItem | undefined): ReactNode {\n if (!item?.icon) return undefined;\n return (\n <span className=\"ds-select__item-content\">\n <span className=\"ds-select__item-icon\">{item.icon}</span>\n <span>{item.label}</span>\n </span>\n );\n}\n\n/**\n * Single-select dropdown, built on Ark UI.\n *\n * Ark owns the hard parts: listbox semantics, typeahead, keyboard\n * navigation, focus return on close, and dismiss behaviour. This wrapper\n * contributes `ds-` classes, the `--ds-select-*` bindings, and a flat\n * `items` API in place of Ark's lower-level collection anatomy.\n *\n * ```tsx\n * <Select\n * label=\"Category\"\n * placeholder=\"Filter by category\"\n * items={[{ value: 'all', label: 'All Categories' }]}\n * value={selected}\n * onValueChange={setSelected}\n * />\n * ```\n *\n * Give it a `label` or an `aria-label` — a select with neither is announced\n * as an unnamed combobox. Options can carry a leading `icon`, a muted\n * `description` line and a `group` heading; for multi-select, compose Ark's\n * anatomy directly in a product package rather than widening this API.\n *\n * The listbox renders in a portal, so it escapes ancestor `overflow: hidden`\n * rather than being clipped inside a card. It sits at `z-index: 60`, a step\n * above the products' overlay layer (50), so it paints above the page or\n * dialog it opens from. Inside a ui-core `Dialog` it portals into the\n * dialog's panel instead of `<body>`, so the modal does not hide it from\n * assistive tech.\n */\nexport function Select({\n items,\n label,\n placeholder,\n value,\n defaultValue,\n onValueChange,\n size = 'md',\n disabled,\n loading = false,\n loadingText = 'Loading…',\n invalid,\n name,\n className,\n renderItem,\n indicator: indicatorProp,\n itemIndicator: itemIndicatorProp,\n 'aria-label': ariaLabel,\n}: SelectProps) {\n const icons = useIconDefaults();\n const indicator = indicatorProp ?? icons.chevronRight;\n const itemIndicator = itemIndicatorProp ?? icons.check;\n // The collection holds the options in drawn order, so arrows, typeahead and\n // the hidden native select all follow the list on screen.\n const groups = useMemo(() => groupItems(items), [items]);\n const collection = useMemo(\n () =>\n createListCollection({\n items: groups.flatMap((group) => group.items),\n itemToValue: (item) => item.value,\n itemToString: (item) => item.label,\n isItemDisabled: (item) => item.disabled ?? false,\n }),\n [groups],\n );\n\n /*\n * A controlled value that no longer matches an option resolves to empty, so\n * the trigger and the form agree about it.\n *\n * Left unresolved they disagree: the trigger already falls back to the\n * placeholder (Ark drives that off whether a value is *set*, not whether it\n * *resolves*), but the hidden native select ends up with no option marked\n * selected — and a single `<select>` in that state reports its **first**\n * option. Measured: with the value `deleted-category`, the field submits\n * `all`. Reading the placeholder and posting a real, different value is the\n * worse half of the mismatch, and it is silent.\n */\n const controlledValue = useMemo(() => {\n if (value === undefined) return undefined;\n if (value === null) return [];\n return items.some((item) => item.value === value) ? [value] : [];\n }, [value, items]);\n\n // Same resolution for the uncontrolled path: an unresolvable `defaultValue`\n // produces the identical trigger-says-placeholder / form-submits-`all` split.\n const initialValue = useMemo(() => {\n if (defaultValue === undefined) return undefined;\n return items.some((item) => item.value === defaultValue) ? [defaultValue] : [];\n }, [defaultValue, items]);\n\n const portalContainer = useContext(PortalContainerContext);\n\n const handleValueChange = useCallback(\n (details: { value: string[] }) => onValueChange?.(details.value[0]),\n [onValueChange],\n );\n\n const renderOption = (item: SelectItem) => (\n <ArkSelect.Item key={item.value} item={item} className=\"ds-select__item\">\n <ArkSelect.ItemText>\n {renderItem ? renderItem(item) : <ItemContent item={item} />}\n </ArkSelect.ItemText>\n <ArkSelect.ItemIndicator className=\"ds-select__item-indicator\">\n <Icon source={itemIndicator} size=\"sm\" decorative />\n </ArkSelect.ItemIndicator>\n </ArkSelect.Item>\n );\n\n const renderGroup = (group: ItemGroup<SelectItem>) =>\n group.label === undefined ? (\n group.items.map(renderOption)\n ) : (\n <ArkSelect.ItemGroup key={group.label} className=\"ds-select__group\">\n <ArkSelect.ItemGroupLabel className=\"ds-select__group-label\">\n {group.label}\n </ArkSelect.ItemGroupLabel>\n {group.items.map(renderOption)}\n </ArkSelect.ItemGroup>\n );\n\n return (\n <ArkSelect.Root\n collection={collection}\n className={cx('ds-select', `ds-select--${size}`, className)}\n value={controlledValue}\n defaultValue={initialValue}\n onValueChange={handleValueChange}\n disabled={disabled || loading}\n invalid={invalid}\n name={name}\n positioning={{ sameWidth: true }}\n >\n {label && <ArkSelect.Label className=\"ds-select__label\">{label}</ArkSelect.Label>}\n\n <ArkSelect.Control>\n <ArkSelect.Trigger\n className=\"ds-select__trigger\"\n aria-label={ariaLabel}\n aria-busy={loading || undefined}\n >\n <ArkSelect.Context<SelectItem>>\n {(select) => (\n <ArkSelect.ValueText\n placeholder={loading ? loadingText : placeholder}\n className=\"ds-select__value-text\"\n >\n {chosenWithIcon(select.selectedItems[0])}\n </ArkSelect.ValueText>\n )}\n </ArkSelect.Context>\n <ArkSelect.Indicator className=\"ds-select__indicator\">\n <Icon source={indicator} size=\"sm\" decorative />\n </ArkSelect.Indicator>\n </ArkSelect.Trigger>\n </ArkSelect.Control>\n\n <Portal container={portalContainer}>\n <ArkSelect.Positioner>\n <ArkSelect.Content className=\"ds-select__content\">\n {groups.map(renderGroup)}\n </ArkSelect.Content>\n </ArkSelect.Positioner>\n </Portal>\n\n <ArkSelect.HiddenSelect />\n </ArkSelect.Root>\n );\n}\n"]}
|
package/dist/sticky/sticky.css
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
/*
|
|
3
3
|
* The inset from the edge is a private property so the scroll variant can
|
|
4
4
|
* subtract it from the viewport's height. `z-index: 40` is the `sticky`
|
|
5
|
-
* layer
|
|
5
|
+
* layer, and the header's 45 the `header` layer above it
|
|
6
|
+
* (ds-config/scripts/stacking.ts).
|
|
6
7
|
*/
|
|
7
8
|
.ds-sticky {
|
|
8
9
|
--_sticky-inset: 0px;
|
|
@@ -24,6 +25,17 @@
|
|
|
24
25
|
bottom: var(--_sticky-inset);
|
|
25
26
|
}
|
|
26
27
|
|
|
28
|
+
/*
|
|
29
|
+
* The app's header fills the inset the chrome's offset keeps clear of,
|
|
30
|
+
* so a bar or a side panel under it starts where it ends.
|
|
31
|
+
*/
|
|
32
|
+
&.ds-sticky--header {
|
|
33
|
+
z-index: 45;
|
|
34
|
+
display: grid;
|
|
35
|
+
align-content: center;
|
|
36
|
+
min-block-size: var(--ds-sticky-offset-top);
|
|
37
|
+
}
|
|
38
|
+
|
|
27
39
|
&.ds-sticky--top.ds-sticky--offset {
|
|
28
40
|
--_sticky-inset: var(--ds-sticky-offset-top);
|
|
29
41
|
}
|
package/dist/sticky/sticky.d.ts
CHANGED
|
@@ -30,6 +30,12 @@ export interface StickyProps extends ComponentProps<typeof ark.div> {
|
|
|
30
30
|
scroll?: boolean;
|
|
31
31
|
/** What it paints behind itself. Defaults to `none`. */
|
|
32
32
|
surface?: StickySurface;
|
|
33
|
+
/**
|
|
34
|
+
* The app's header itself: at least as tall as `--ds-sticky-offset-top`,
|
|
35
|
+
* where every offset bar and side panel under it starts, with its content
|
|
36
|
+
* centred in that height. Takes no `offset`.
|
|
37
|
+
*/
|
|
38
|
+
header?: boolean;
|
|
33
39
|
}
|
|
34
40
|
/**
|
|
35
41
|
* An element that holds to an edge of the viewport while the page scrolls
|
|
@@ -41,7 +47,7 @@ export interface StickyProps extends ComponentProps<typeof ark.div> {
|
|
|
41
47
|
* settles into its own place when the page ends, with nothing to clear.
|
|
42
48
|
* Sits on the `sticky` stacking layer, above the page's raised controls
|
|
43
49
|
* and below every overlay. Renders a `div`; pass `asChild` to stick your
|
|
44
|
-
* own element (`<Sticky asChild><header>…</header></Sticky>`).
|
|
50
|
+
* own element (`<Sticky asChild header><header>…</header></Sticky>`).
|
|
45
51
|
*/
|
|
46
|
-
export declare function Sticky({ edge, offset, from, scroll, surface, className, children, ...props }: StickyProps): import("react/jsx-runtime").JSX.Element;
|
|
52
|
+
export declare function Sticky({ edge, offset, from, scroll, surface, header, className, children, ...props }: StickyProps): import("react/jsx-runtime").JSX.Element;
|
|
47
53
|
//# sourceMappingURL=sticky.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sticky.d.ts","sourceRoot":"","sources":["../../src/sticky/sticky.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,cAAc,CAAC;AAEtB,OAAO,KA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AC;IACjB,wDAAwD;IACxD,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CAAC,EACrB,IAAY,EACZ,MAAc,EACd,IAAI,EACJ,MAAc,EACd,OAAgB,EAChB,MAAc,EACd,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,WAAW,2CAkBb"}
|
package/dist/sticky/sticky.js
CHANGED
|
@@ -12,9 +12,9 @@ import { cx } from '../cx';
|
|
|
12
12
|
* settles into its own place when the page ends, with nothing to clear.
|
|
13
13
|
* Sits on the `sticky` stacking layer, above the page's raised controls
|
|
14
14
|
* and below every overlay. Renders a `div`; pass `asChild` to stick your
|
|
15
|
-
* own element (`<Sticky asChild><header>…</header></Sticky>`).
|
|
15
|
+
* own element (`<Sticky asChild header><header>…</header></Sticky>`).
|
|
16
16
|
*/
|
|
17
|
-
export function Sticky({ edge = 'top', offset = false, from, scroll = false, surface = 'none', className, children, ...props }) {
|
|
18
|
-
return (_jsx(ark.div, { className: cx('ds-sticky', `ds-sticky--${edge}`, offset && 'ds-sticky--offset', from && `ds-sticky--from-${from}`, scroll && 'ds-sticky--scroll', surface !== 'none' && `ds-sticky--surface-${surface}`, className), ...props, children: children }));
|
|
17
|
+
export function Sticky({ edge = 'top', offset = false, from, scroll = false, surface = 'none', header = false, className, children, ...props }) {
|
|
18
|
+
return (_jsx(ark.div, { className: cx('ds-sticky', `ds-sticky--${edge}`, offset && 'ds-sticky--offset', from && `ds-sticky--from-${from}`, scroll && 'ds-sticky--scroll', surface !== 'none' && `ds-sticky--surface-${surface}`, header && 'ds-sticky--header', className), ...props, children: children }));
|
|
19
19
|
}
|
|
20
20
|
//# sourceMappingURL=sticky.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sticky.js","sourceRoot":"","sources":["../../src/sticky/sticky.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"sticky.js","sourceRoot":"","sources":["../../src/sticky/sticky.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAyC3B;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,MAAM,CAAC,EACrB,IAAI,GAAG,KAAK,EACZ,MAAM,GAAG,KAAK,EACd,IAAI,EACJ,MAAM,GAAG,KAAK,EACd,OAAO,GAAG,MAAM,EAChB,MAAM,GAAG,KAAK,EACd,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACI;IACZ,OAAO,CACL,KAAC,GAAG,CAAC,GAAG,IACN,SAAS,EAAE,EAAE,CACX,WAAW,EACX,cAAc,IAAI,EAAE,EACpB,MAAM,IAAI,mBAAmB,EAC7B,IAAI,IAAI,mBAAmB,IAAI,EAAE,EACjC,MAAM,IAAI,mBAAmB,EAC7B,OAAO,KAAK,MAAM,IAAI,sBAAsB,OAAO,EAAE,EACrD,MAAM,IAAI,mBAAmB,EAC7B,SAAS,CACV,KACG,KAAK,YAER,QAAQ,GACD,CACX,CAAC;AACJ,CAAC","sourcesContent":["import { ark } from '@ark-ui/react/factory';\nimport type { ComponentProps } from 'react';\nimport './sticky.css';\nimport { cx } from '../cx';\nimport type { Breakpoint } from '../layout/layout';\n\n/** The viewport edge a sticky element holds to while the page scrolls past it. */\nexport type StickyEdge = 'top' | 'bottom';\n\n/**\n * What a sticky element paints behind itself. `none` leaves the children\n * to draw their own surface (a card); `canvas` paints the page's canvas so\n * content scrolling under it is covered, with the bar's block inset;\n * `raised` is the chrome's surface with a hairline and shadow on the side\n * facing the page.\n */\nexport type StickySurface = 'none' | 'canvas' | 'raised';\n\nexport interface StickyProps extends ComponentProps<typeof ark.div> {\n /** The edge it holds to. Defaults to `top`. */\n edge?: StickyEdge;\n /**\n * Keep clear of the app's chrome: under the header at the top\n * (`--ds-sticky-offset-top`), above the viewport's edge at the bottom\n * (`--ds-sticky-offset-bottom`). Off by default, for the header itself.\n */\n offset?: boolean;\n /** Stick only from this viewport step up; stay in the flow on narrower viewports. */\n from?: Breakpoint;\n /**\n * Scroll inside its own box when taller than the room it holds, instead\n * of pushing past the viewport: a pinned aside longer than the screen.\n */\n scroll?: boolean;\n /** What it paints behind itself. Defaults to `none`. */\n surface?: StickySurface;\n /**\n * The app's header itself: at least as tall as `--ds-sticky-offset-top`,\n * where every offset bar and side panel under it starts, with its content\n * centred in that height. Takes no `offset`.\n */\n header?: boolean;\n}\n\n/**\n * An element that holds to an edge of the viewport while the page scrolls\n * past it: the app's header, a filter row under it, a bar of bulk actions\n * at the foot of a list, an aside pinned beside a long form.\n *\n * Sticky, never fixed, so it stays in the page's flow and column: a bottom\n * bar at the end of a page floats above the rows while they scroll and\n * settles into its own place when the page ends, with nothing to clear.\n * Sits on the `sticky` stacking layer, above the page's raised controls\n * and below every overlay. Renders a `div`; pass `asChild` to stick your\n * own element (`<Sticky asChild header><header>…</header></Sticky>`).\n */\nexport function Sticky({\n edge = 'top',\n offset = false,\n from,\n scroll = false,\n surface = 'none',\n header = false,\n className,\n children,\n ...props\n}: StickyProps) {\n return (\n <ark.div\n className={cx(\n 'ds-sticky',\n `ds-sticky--${edge}`,\n offset && 'ds-sticky--offset',\n from && `ds-sticky--from-${from}`,\n scroll && 'ds-sticky--scroll',\n surface !== 'none' && `ds-sticky--surface-${surface}`,\n header && 'ds-sticky--header',\n className,\n )}\n {...props}\n >\n {children}\n </ark.div>\n );\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manakind/ui-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -24,6 +24,10 @@
|
|
|
24
24
|
"types": "./dist/index.d.ts",
|
|
25
25
|
"import": "./dist/index.js"
|
|
26
26
|
},
|
|
27
|
+
"./accordion": {
|
|
28
|
+
"types": "./dist/accordion/index.d.ts",
|
|
29
|
+
"import": "./dist/accordion/index.js"
|
|
30
|
+
},
|
|
27
31
|
"./alert": {
|
|
28
32
|
"types": "./dist/alert/index.d.ts",
|
|
29
33
|
"import": "./dist/alert/index.js"
|
|
@@ -124,6 +128,10 @@
|
|
|
124
128
|
"types": "./dist/reorder-control/index.d.ts",
|
|
125
129
|
"import": "./dist/reorder-control/index.js"
|
|
126
130
|
},
|
|
131
|
+
"./radio-group": {
|
|
132
|
+
"types": "./dist/radio-group/index.d.ts",
|
|
133
|
+
"import": "./dist/radio-group/index.js"
|
|
134
|
+
},
|
|
127
135
|
"./scroll-area": {
|
|
128
136
|
"types": "./dist/scroll-area/index.d.ts",
|
|
129
137
|
"import": "./dist/scroll-area/index.js"
|
|
@@ -188,6 +196,10 @@
|
|
|
188
196
|
"types": "./dist/wizard-layout/index.d.ts",
|
|
189
197
|
"import": "./dist/wizard-layout/index.js"
|
|
190
198
|
},
|
|
199
|
+
"./css/accordion": {
|
|
200
|
+
"types": "./dist/accordion/accordion.css.d.ts",
|
|
201
|
+
"default": "./dist/accordion/accordion.css"
|
|
202
|
+
},
|
|
191
203
|
"./css/alert": {
|
|
192
204
|
"types": "./dist/alert/alert.css.d.ts",
|
|
193
205
|
"default": "./dist/alert/alert.css"
|
|
@@ -288,6 +300,10 @@
|
|
|
288
300
|
"types": "./dist/reorder-control/reorder-control.css.d.ts",
|
|
289
301
|
"default": "./dist/reorder-control/reorder-control.css"
|
|
290
302
|
},
|
|
303
|
+
"./css/radio-group": {
|
|
304
|
+
"types": "./dist/radio-group/radio-group.css.d.ts",
|
|
305
|
+
"default": "./dist/radio-group/radio-group.css"
|
|
306
|
+
},
|
|
291
307
|
"./css/scroll-area": {
|
|
292
308
|
"types": "./dist/scroll-area/scroll-area.css.d.ts",
|
|
293
309
|
"default": "./dist/scroll-area/scroll-area.css"
|
|
@@ -380,7 +396,7 @@
|
|
|
380
396
|
},
|
|
381
397
|
"devDependencies": {
|
|
382
398
|
"@manakind/ds-config": "*",
|
|
383
|
-
"@manakind/manuia-tokens": "0.
|
|
399
|
+
"@manakind/manuia-tokens": "0.28.0",
|
|
384
400
|
"@testing-library/jest-dom": "^6.9.1",
|
|
385
401
|
"@testing-library/react": "^16.3.2",
|
|
386
402
|
"@testing-library/user-event": "^14.6.1",
|