@kanso-labs/kanso-ui 0.45.34 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/button/index.js +13 -9
- package/dist/button/index.js.map +1 -1
- package/dist/calendar/styles.js +12 -7
- package/dist/calendar/styles.js.map +1 -1
- package/dist/chip/label.js +1 -0
- package/dist/chip/label.js.map +1 -1
- package/dist/chip/styles.js +2 -0
- package/dist/chip/styles.js.map +1 -1
- package/dist/collection/styles.js +1 -1
- package/dist/collection/styles.js.map +1 -1
- package/dist/components/breadcrumbs/index.js +4 -1
- package/dist/components/breadcrumbs/index.js.map +1 -1
- package/dist/components/button-group/index.d.ts +16 -3
- package/dist/components/button-group/index.js +53 -86
- package/dist/components/button-group/index.js.map +1 -1
- package/dist/components/calendar/index.d.ts +3 -3
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/card/index.js +5 -1
- package/dist/components/card/index.js.map +1 -1
- package/dist/components/carousel/index.js +162 -105
- package/dist/components/carousel/index.js.map +1 -1
- package/dist/components/chip/index.d.ts +38 -15
- package/dist/components/chip/index.js +104 -8
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/code/index.js +32 -26
- package/dist/components/code/index.js.map +1 -1
- package/dist/components/color-area/index.d.ts +5 -3
- package/dist/components/color-area/index.js +5 -3
- package/dist/components/color-area/index.js.map +1 -1
- package/dist/components/color-picker/index.js +6 -3
- package/dist/components/color-picker/index.js.map +1 -1
- package/dist/components/color-swatch/index.js +1 -1
- package/dist/components/color-swatch/index.js.map +1 -1
- package/dist/components/color-swatch-picker/index.js +24 -9
- package/dist/components/color-swatch-picker/index.js.map +1 -1
- package/dist/components/combo-box/index.d.ts +11 -3
- package/dist/components/combo-box/index.js +66 -62
- package/dist/components/combo-box/index.js.map +1 -1
- package/dist/components/copy-field/index.js +1 -0
- package/dist/components/copy-field/index.js.map +1 -1
- package/dist/components/date-picker/index.d.ts +22 -3
- package/dist/components/date-picker/index.js +234 -45
- package/dist/components/date-picker/index.js.map +1 -1
- package/dist/components/date-range-picker/index.d.ts +3 -1
- package/dist/components/date-range-picker/index.js +6 -4
- package/dist/components/date-range-picker/index.js.map +1 -1
- package/dist/components/disclosure/index.d.ts +4 -3
- package/dist/components/disclosure/index.js +159 -101
- package/dist/components/disclosure/index.js.map +1 -1
- package/dist/components/fab/index.d.ts +3 -1
- package/dist/components/fab/index.js +25 -12
- package/dist/components/fab/index.js.map +1 -1
- package/dist/components/fab-menu/index.js +1 -1
- package/dist/components/fab-menu/index.js.map +1 -1
- package/dist/components/icon-button/index.js +3 -3
- package/dist/components/icon-button/index.js.map +1 -1
- package/dist/components/index.d.ts +3 -3
- package/dist/components/link/index.js +2 -2
- package/dist/components/link/index.js.map +1 -1
- package/dist/components/menu/index.js +5 -2
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/navigation-bar/index.js.map +1 -1
- package/dist/components/navigation-rail/index.js +4 -4
- package/dist/components/navigation-rail/index.js.map +1 -1
- package/dist/components/navigation-tree/index.js +16 -13
- package/dist/components/navigation-tree/index.js.map +1 -1
- package/dist/components/popover/index.js +35 -33
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/progress-indicator/index.js +258 -172
- package/dist/components/progress-indicator/index.js.map +1 -1
- package/dist/components/range-calendar/index.js +41 -7
- package/dist/components/range-calendar/index.js.map +1 -1
- package/dist/components/search-view/index.js +1 -1
- package/dist/components/search-view/index.js.map +1 -1
- package/dist/components/segmented-button/index.d.ts +3 -2
- package/dist/components/segmented-button/index.js +46 -95
- package/dist/components/segmented-button/index.js.map +1 -1
- package/dist/components/select/index.js +5 -2
- package/dist/components/select/index.js.map +1 -1
- package/dist/components/slider/index.js +42 -10
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/table/index.d.ts +26 -5
- package/dist/components/table/index.js +93 -75
- package/dist/components/table/index.js.map +1 -1
- package/dist/components/tag/index.js +1 -0
- package/dist/components/tag/index.js.map +1 -1
- package/dist/components/time-picker/index.js +37 -5
- package/dist/components/time-picker/index.js.map +1 -1
- package/dist/components/token-field/index.js +89 -66
- package/dist/components/token-field/index.js.map +1 -1
- package/dist/components/toolbar/index.d.ts +8 -3
- package/dist/components/toolbar/index.js +123 -43
- package/dist/components/toolbar/index.js.map +1 -1
- package/dist/components/tree/index.js +1 -1
- package/dist/components/tree/index.js.map +1 -1
- package/dist/fab/styles.js +12 -0
- package/dist/fab/styles.js.map +1 -1
- package/dist/field/styles.js +2 -2
- package/dist/field/styles.js.map +1 -1
- package/dist/hooks/useDockedMonths.js +36 -0
- package/dist/hooks/useDockedMonths.js.map +1 -0
- package/dist/i18n/index.js +1 -0
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/messages.js +34 -0
- package/dist/i18n/messages.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/navigation/index.js +5 -5
- package/dist/navigation/index.js.map +1 -1
- package/dist/navigation/styles.js +5 -1
- package/dist/navigation/styles.js.map +1 -1
- package/dist/row/context.js +6 -0
- package/dist/row/context.js.map +1 -0
- package/dist/row/index.js +77 -66
- package/dist/row/index.js.map +1 -1
- package/dist/row/styles.js +15 -0
- package/dist/row/styles.js.map +1 -1
- package/dist/segments/index.js +2 -5
- package/dist/segments/index.js.map +1 -1
- package/dist/segments/literal.js +66 -0
- package/dist/segments/literal.js.map +1 -0
- package/dist/segments/styles.js +8 -0
- package/dist/segments/styles.js.map +1 -1
- package/dist/styles/chequer.js +1 -0
- package/dist/styles/chequer.js.map +1 -1
- package/dist/styles/focus.js.map +1 -1
- package/dist/styles.css +509 -69
- package/dist/toggle-group/index.js +133 -0
- package/dist/toggle-group/index.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { c } from "react/compiler-runtime";
|
|
2
|
+
import { createElement, useContext } from "react";
|
|
3
|
+
import { ToggleGroupStateContext } from "react-aria-components";
|
|
4
|
+
// src/toggle-group/index.ts
|
|
5
|
+
const NOT_A_RADIO = {};
|
|
6
|
+
const lastFocused = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
const pressed = /* @__PURE__ */ new WeakMap();
|
|
8
|
+
function focusMemory(domProps, keys) {
|
|
9
|
+
if (domProps.onFocusCapture === void 0) return { onKeyDownCapture: keys };
|
|
10
|
+
return {
|
|
11
|
+
onBlurCapture: rememberLeaving,
|
|
12
|
+
onFocusCapture: handBack,
|
|
13
|
+
onKeyDownCapture: rememberTab(keys),
|
|
14
|
+
onPointerDownCapture: rememberPress
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function keyOf(item) {
|
|
18
|
+
const written = item.dataset.key;
|
|
19
|
+
if (written === void 0) return null;
|
|
20
|
+
const key = JSON.parse(written);
|
|
21
|
+
return typeof key === "string" || typeof key === "number" ? key : null;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The group's element, with the group's own memory of where focus left it in
|
|
25
|
+
* place of React Aria's, and with the radio group's keys in place of React
|
|
26
|
+
* Aria's keyboard handler while `single` — then handed to the call site's own
|
|
27
|
+
* `render` if it passed one.
|
|
28
|
+
*/
|
|
29
|
+
function toggleGroupRenderer(render, single) {
|
|
30
|
+
return (domProps, renderProps) => {
|
|
31
|
+
const keys = single ? radioKeys(renderProps.state, domProps.onKeyDownCapture) : domProps.onKeyDownCapture;
|
|
32
|
+
const merged = {
|
|
33
|
+
...domProps,
|
|
34
|
+
...focusMemory(domProps, keys)
|
|
35
|
+
};
|
|
36
|
+
return render === void 0 ? createElement("div", merged) : render(merged, renderProps);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const rememberLeaving = (event) => {
|
|
40
|
+
const group = event.currentTarget;
|
|
41
|
+
pressed.delete(group);
|
|
42
|
+
if (!group.contains(event.relatedTarget) && !lastFocused.has(group) && event.target instanceof HTMLElement) lastFocused.set(group, event.target);
|
|
43
|
+
};
|
|
44
|
+
const handBack = (event) => {
|
|
45
|
+
const group = event.currentTarget;
|
|
46
|
+
const press = pressed.get(group);
|
|
47
|
+
pressed.delete(group);
|
|
48
|
+
if (group.contains(event.relatedTarget) || !group.contains(event.target)) return;
|
|
49
|
+
const last = lastFocused.get(group);
|
|
50
|
+
lastFocused.delete(group);
|
|
51
|
+
if (!(press !== void 0 && event.target.contains(press)) && last !== void 0 && group.contains(last)) last.focus();
|
|
52
|
+
};
|
|
53
|
+
const rememberPress = (event) => {
|
|
54
|
+
if (event.target instanceof Element) pressed.set(event.currentTarget, event.target);
|
|
55
|
+
};
|
|
56
|
+
function radioKeys(state, toolbar) {
|
|
57
|
+
return (event) => {
|
|
58
|
+
const group = event.currentTarget;
|
|
59
|
+
const items = [...group.querySelectorAll("[data-key]:not([data-disabled])")].filter((item) => item.closest("[role=\"radiogroup\"]") === group);
|
|
60
|
+
const from = items.findIndex((item) => item === event.target);
|
|
61
|
+
const step = event.altKey || event.ctrlKey || event.metaKey ? null : stepOf(event.key, getComputedStyle(group).direction === "rtl");
|
|
62
|
+
if (from === -1 || step === null) {
|
|
63
|
+
toolbar?.(event);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
event.preventDefault();
|
|
67
|
+
event.stopPropagation();
|
|
68
|
+
const item = items[step === "first" ? 0 : step === "last" ? items.length - 1 : (from + step + items.length) % items.length];
|
|
69
|
+
const key = keyOf(item);
|
|
70
|
+
if (key === null) return;
|
|
71
|
+
item.focus();
|
|
72
|
+
state.setSelected(key, true);
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function rememberTab(keys) {
|
|
76
|
+
return (event) => {
|
|
77
|
+
if (event.key === "Tab" && event.target instanceof HTMLElement) lastFocused.set(event.currentTarget, event.target);
|
|
78
|
+
keys?.(event);
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function stepOf(key, rtl) {
|
|
82
|
+
switch (key) {
|
|
83
|
+
case "ArrowDown": return 1;
|
|
84
|
+
case "ArrowLeft": return rtl ? 1 : -1;
|
|
85
|
+
case "ArrowRight": return rtl ? -1 : 1;
|
|
86
|
+
case "ArrowUp": return -1;
|
|
87
|
+
case "End": return "last";
|
|
88
|
+
case "Home": return "first";
|
|
89
|
+
default: return null;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The props an item of a `ToggleButtonGroup` takes while the group chooses
|
|
94
|
+
* one at a time: its key, written where `toggleGroupRenderer`'s keys read it,
|
|
95
|
+
* since React Aria keeps an item's key off its element, and whether it stays
|
|
96
|
+
* out of the Tab order. Every item but the checked one does while one is
|
|
97
|
+
* checked, which is the radio group's single Tab stop; with nothing checked
|
|
98
|
+
* every item keeps its own, and Tab enters on the first. Nothing outside a
|
|
99
|
+
* single-selecting group, or for an item without an `id`, which React Aria
|
|
100
|
+
* leaves out of the group's selection.
|
|
101
|
+
*/
|
|
102
|
+
function useRadioItem(id) {
|
|
103
|
+
const $ = c(8);
|
|
104
|
+
const group = useContext(ToggleGroupStateContext);
|
|
105
|
+
if (group?.selectionMode !== "single" || id === void 0) return NOT_A_RADIO;
|
|
106
|
+
let t0;
|
|
107
|
+
if ($[0] !== id) {
|
|
108
|
+
t0 = JSON.stringify(id);
|
|
109
|
+
$[0] = id;
|
|
110
|
+
$[1] = t0;
|
|
111
|
+
} else t0 = $[1];
|
|
112
|
+
let t1;
|
|
113
|
+
if ($[2] !== group.selectedKeys || $[3] !== id) {
|
|
114
|
+
t1 = group.selectedKeys.size > 0 && !group.selectedKeys.has(id);
|
|
115
|
+
$[2] = group.selectedKeys;
|
|
116
|
+
$[3] = id;
|
|
117
|
+
$[4] = t1;
|
|
118
|
+
} else t1 = $[4];
|
|
119
|
+
let t2;
|
|
120
|
+
if ($[5] !== t0 || $[6] !== t1) {
|
|
121
|
+
t2 = {
|
|
122
|
+
"data-key": t0,
|
|
123
|
+
excludeFromTabOrder: t1
|
|
124
|
+
};
|
|
125
|
+
$[5] = t0;
|
|
126
|
+
$[6] = t1;
|
|
127
|
+
$[7] = t2;
|
|
128
|
+
} else t2 = $[7];
|
|
129
|
+
return t2;
|
|
130
|
+
}
|
|
131
|
+
export { toggleGroupRenderer, useRadioItem };
|
|
132
|
+
|
|
133
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["createElement","useContext","ToggleGroupStateContext","excludeFromTabOrder","NOT_A_RADIO","lastFocused","WeakMap","Element","HTMLElement","pressed","focusMemory","domProps","keys","onFocusCapture","undefined","onKeyDownCapture","onBlurCapture","rememberLeaving","handBack","rememberTab","onPointerDownCapture","rememberPress","keyOf","item","written","dataset","key","JSON","parse","toggleGroupRenderer","render","single","renderProps","radioKeys","state","merged","event","group","currentTarget","delete","contains","relatedTarget","has","target","set","press","get","last","focus","toolbar","items","querySelectorAll","filter","closest","from","findIndex","step","altKey","ctrlKey","metaKey","stepOf","getComputedStyle","direction","preventDefault","stopPropagation","length","setSelected","rtl","useRadioItem","id","$","_c","selectionMode","t0","stringify","t1","selectedKeys","size","t2"],"sources":["../../src/toggle-group/index.ts"],"sourcesContent":["import type {\n FocusEventHandler,\n KeyboardEventHandler,\n PointerEventHandler,\n} from 'react'\nimport type {\n Key,\n ToggleButtonGroupProps,\n ToggleGroupState,\n} from 'react-aria-components'\n\nimport { createElement, useContext } from 'react'\nimport { ToggleGroupStateContext } from 'react-aria-components'\n\n// What SegmentedButton and a ButtonGroup given `selectionMode` lay over\n// React Aria's `ToggleButtonGroup`, in two parts.\n//\n// The first is for both modes. React Aria's toolbar hands focus back to the\n// item it last left from whenever focus comes back into the group, which is\n// the toolbar pattern's own memory for the keyboard, and a pointer pressing\n// an item is focus coming back too: the pressed item was chosen while focus\n// went to the one the keyboard had left, so the next arrow moved on from\n// there. The group keeps that memory here instead, and lets a pointer's\n// focus stay on the item it pressed.\n//\n// The second is the radio group pattern from the ARIA Authoring Practices,\n// where the group chooses one item at a time. React Aria announces that\n// mode as a radio group of radios but behaves as a toolbar: its arrows move\n// focus alone and stop at the ends, so a screen reader reaches each radio\n// without it being checked, and every item is a Tab stop, so Tab enters on\n// the first whatever is checked. Two halves take the rest of the pattern:\n//\n// - `toggleGroupRenderer`'s keys, in that mode, move focus and the choice\n// together, wrapping at either end, with Home and End choosing the first\n// and last item.\n// - `useRadioItem` is each item's. It writes the item's key onto its element\n// for those keys to choose it by, and keeps every item but the checked one\n// out of the Tab order, so Tab lands on the choice.\n//\n// The third part, keeping the choice from being pressed off, is the group's\n// own `disallowEmptySelection`, which each component defaults to `true` in\n// that mode.\n\ntype GroupDOMProps = Parameters<NonNullable<GroupRender>>[0]\n\ntype GroupRender = ToggleButtonGroupProps['render']\n\ntype RadioItemProps = {\n 'data-key'?: string\n excludeFromTabOrder?: boolean\n}\n\nconst NOT_A_RADIO: RadioItemProps = {}\n\n// The item each group last held focus on as focus left it, to hand focus\n// back to when it returns.\nconst lastFocused = new WeakMap<Element, HTMLElement>()\n\n// The element a pointer last went down on in each group, until the focus\n// that press moves arrives, or focus leaves.\nconst pressed = new WeakMap<Element, Element>()\n\n// The toolbar's focus memory, kept by the group rather than by React Aria:\n// the same record, taken as Tab leaves the group or as focus moves out of it\n// some other way, and the same hand-back when focus returns, unless the\n// focus arriving is a pointer's on the item it pressed. React Aria's record\n// is private to its hook, so its two handlers are replaced rather than\n// wrapped: let run, the hand-back would move focus off the pressed item.\n//\n// React Aria leaves all of this off a group inside another toolbar, whose\n// own memory is the one that applies, and so does this.\nfunction focusMemory(\n domProps: GroupDOMProps,\n keys: KeyboardEventHandler<HTMLDivElement> | undefined,\n): Pick<\n GroupDOMProps,\n | 'onBlurCapture'\n | 'onFocusCapture'\n | 'onKeyDownCapture'\n | 'onPointerDownCapture'\n> {\n if (domProps.onFocusCapture === undefined) {\n return { onKeyDownCapture: keys }\n }\n return {\n onBlurCapture: rememberLeaving,\n onFocusCapture: handBack,\n onKeyDownCapture: rememberTab(keys),\n onPointerDownCapture: rememberPress,\n }\n}\n\n// An item's key, back from the attribute `useRadioItem` writes it into. JSON\n// rather than the key as written, so a numeric key comes back a number and\n// matches the one React Aria's selection holds.\nfunction keyOf(item: HTMLElement): Key | null {\n const written = item.dataset.key\n if (written === undefined) {\n return null\n }\n const key: unknown = JSON.parse(written)\n return typeof key === 'string' || typeof key === 'number' ? key : null\n}\n\n/**\n * The group's element, with the group's own memory of where focus left it in\n * place of React Aria's, and with the radio group's keys in place of React\n * Aria's keyboard handler while `single` — then handed to the call site's own\n * `render` if it passed one.\n */\nfunction toggleGroupRenderer(\n render: GroupRender,\n single: boolean,\n): NonNullable<GroupRender> {\n return (domProps, renderProps) => {\n const keys = single\n ? radioKeys(renderProps.state, domProps.onKeyDownCapture)\n : domProps.onKeyDownCapture\n const merged = { ...domProps, ...focusMemory(domProps, keys) }\n return render === undefined\n ? createElement('div', merged)\n : render(merged, renderProps)\n }\n}\n\nconst rememberLeaving: FocusEventHandler<HTMLDivElement> = (event) => {\n const group = event.currentTarget\n pressed.delete(group)\n if (\n !group.contains(event.relatedTarget) &&\n !lastFocused.has(group) &&\n event.target instanceof HTMLElement\n ) {\n lastFocused.set(group, event.target)\n }\n}\n\nconst handBack: FocusEventHandler<HTMLDivElement> = (event) => {\n const group = event.currentTarget\n const press = pressed.get(group)\n pressed.delete(group)\n // Focus moving between items, or arriving in a portal the group renders,\n // which React carries up to the group as though it were inside it.\n if (group.contains(event.relatedTarget) || !group.contains(event.target)) {\n return\n }\n const last = lastFocused.get(group)\n lastFocused.delete(group)\n const isPress = press !== undefined && event.target.contains(press)\n if (!isPress && last !== undefined && group.contains(last)) {\n last.focus()\n }\n}\n\nconst rememberPress: PointerEventHandler<HTMLDivElement> = (event) => {\n if (event.target instanceof Element) {\n pressed.set(event.currentTarget, event.target)\n }\n}\n\n// The radio group's keys, taken ahead of React Aria's toolbar ones on the\n// same capture listener: the arrows, Home and End move focus to an item and\n// choose it, wrapping at the ends and passing over a disabled item, which is\n// what the toolbar's own handler would otherwise do with focus alone.\n// Everything else — Tab, and an arrow held with a modifier the browser may\n// want — is handed to the toolbar as before.\nfunction radioKeys(\n state: ToggleGroupState,\n toolbar: KeyboardEventHandler<HTMLDivElement> | undefined,\n): KeyboardEventHandler<HTMLDivElement> {\n return (event) => {\n const group = event.currentTarget\n const items = [\n ...group.querySelectorAll<HTMLElement>('[data-key]:not([data-disabled])'),\n ].filter((item) => item.closest('[role=\"radiogroup\"]') === group)\n const from = items.findIndex((item) => item === event.target)\n const step =\n event.altKey || event.ctrlKey || event.metaKey\n ? null\n : stepOf(event.key, getComputedStyle(group).direction === 'rtl')\n if (from === -1 || step === null) {\n toolbar?.(event)\n return\n }\n\n event.preventDefault()\n event.stopPropagation()\n const to =\n step === 'first'\n ? 0\n : step === 'last'\n ? items.length - 1\n : (from + step + items.length) % items.length\n const item = items[to]\n const key = keyOf(item)\n if (key === null) {\n return\n }\n item.focus()\n state.setSelected(key, true)\n }\n}\n\n// Tab leaves from the item it is pressed on, which is the record: React\n// Aria's handler then moves focus to the group's last item for the browser's\n// own Tab to carry it out from, so the focus leaving is that item's.\nfunction rememberTab(\n keys: KeyboardEventHandler<HTMLDivElement> | undefined,\n): KeyboardEventHandler<HTMLDivElement> {\n return (event) => {\n if (event.key === 'Tab' && event.target instanceof HTMLElement) {\n lastFocused.set(event.currentTarget, event.target)\n }\n keys?.(event)\n }\n}\n\n// Where a key moves the choice in a radio group: one item on, one back, or\n// to either end. Right and left follow the direction the group is drawn in,\n// read off the group itself rather than the locale, so a `dir` on a wrapper\n// turns them over as it turns the group over; up and down, and Home and End,\n// follow the document order whatever the direction.\nfunction stepOf(key: string, rtl: boolean): -1 | 1 | 'first' | 'last' | null {\n switch (key) {\n case 'ArrowDown': {\n return 1\n }\n case 'ArrowLeft': {\n return rtl ? 1 : -1\n }\n case 'ArrowRight': {\n return rtl ? -1 : 1\n }\n case 'ArrowUp': {\n return -1\n }\n case 'End': {\n return 'last'\n }\n case 'Home': {\n return 'first'\n }\n default: {\n return null\n }\n }\n}\n\n/**\n * The props an item of a `ToggleButtonGroup` takes while the group chooses\n * one at a time: its key, written where `toggleGroupRenderer`'s keys read it,\n * since React Aria keeps an item's key off its element, and whether it stays\n * out of the Tab order. Every item but the checked one does while one is\n * checked, which is the radio group's single Tab stop; with nothing checked\n * every item keeps its own, and Tab enters on the first. Nothing outside a\n * single-selecting group, or for an item without an `id`, which React Aria\n * leaves out of the group's selection.\n */\nfunction useRadioItem(id: Key | undefined): RadioItemProps {\n const group = useContext(ToggleGroupStateContext)\n if (group?.selectionMode !== 'single' || id === undefined) {\n return NOT_A_RADIO\n }\n return {\n 'data-key': JSON.stringify(id),\n excludeFromTabOrder:\n group.selectedKeys.size > 0 && !group.selectedKeys.has(id),\n }\n}\n\nexport { toggleGroupRenderer, useRadioItem }\n"],"mappings":";;;;AAoDA,MAAMI,cAA8B,CAAC;AAIrC,MAAMC,8BAAc,IAAIC,QAA8B;AAItD,MAAMG,0BAAU,IAAIH,QAA0B;AAW9C,SAASI,YACPC,UACAC,MAOA;CACA,IAAID,SAASE,mBAAmBC,KAAAA,GAC9B,OAAO,EAAEC,kBAAkBH,KAAK;CAElC,OAAO;EACLI,eAAeC;EACfJ,gBAAgBK;EAChBH,kBAAkBI,YAAYP,IAAI;EAClCQ,sBAAsBC;CACxB;AACF;AAKA,SAASC,MAAMC,MAA+B;CAC5C,MAAMC,UAAUD,KAAKE,QAAQC;CAC7B,IAAIF,YAAYV,KAAAA,GACd,OAAO;CAET,MAAMY,MAAeC,KAAKC,MAAMJ,OAAO;CACvC,OAAO,OAAOE,QAAQ,YAAY,OAAOA,QAAQ,WAAWA,MAAM;AACpE;;;;;;;AAQA,SAASG,oBACPC,QACAC,QAC0B;CAC1B,QAAQpB,UAAUqB,gBAAgB;EAChC,MAAMpB,OAAOmB,SACTE,UAAUD,YAAYE,OAAOvB,SAASI,gBAAgB,IACtDJ,SAASI;EACb,MAAMoB,SAAS;GAAE,GAAGxB;GAAU,GAAGD,YAAYC,UAAUC,IAAI;EAAE;EAC7D,OAAOkB,WAAWhB,KAAAA,IACdd,cAAc,OAAOmC,MAAM,IAC3BL,OAAOK,QAAQH,WAAW;CAChC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KuC,aAAalC,IAAK2B,EAAE;EAACC,EAAA,KAAAjC,MAAAuC;EAAAN,EAAA,KAAAD;EAAAC,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,IAAAQ;CAAA,IAAAR,EAAA,OAAAG,MAAAH,EAAA,OAAAK,IAAA;EAHvDG,KAAA;GAAA,YACOL;GAAkBtE,qBAE5BwE;EACJ;EAACL,EAAA,KAAAG;EAAAH,EAAA,KAAAK;EAAAL,EAAA,KAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,OAJMQ;AAIN"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kanso-labs/kanso-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.47.0",
|
|
4
4
|
"description": "A React component library built on React Aria Components primitives and styled with StyleX, with design tokens sourced from a single W3C DTCG file and compiled via Style Dictionary",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"@vitest/browser-playwright": "5.1.0",
|
|
108
108
|
"@vitest/coverage-v8": "5.1.0",
|
|
109
109
|
"babel-plugin-react-compiler": "1.0.0",
|
|
110
|
-
"eslint": "10.
|
|
110
|
+
"eslint": "10.15.0",
|
|
111
111
|
"eslint-plugin-oxlint": "1.93.0",
|
|
112
112
|
"eslint-plugin-perfectionist": "5.13.0",
|
|
113
113
|
"eslint-plugin-react-hooks": "7.1.1",
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"oxfmt": "0.78.0",
|
|
121
121
|
"oxlint": "1.93.0",
|
|
122
122
|
"oxlint-tsgolint": "7.0.2007",
|
|
123
|
-
"playwright": "1.65.
|
|
123
|
+
"playwright": "1.65.1",
|
|
124
124
|
"publint": "0.3.25",
|
|
125
125
|
"react": "19.3.1",
|
|
126
126
|
"react-dom": "19.3.1",
|