@k8ordo/ui 3.0.0 → 4.0.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.
Files changed (264) hide show
  1. package/README.md +73 -182
  2. package/dist/{integrations/_shared → catalog}/icon-map.d.mts +4 -2
  3. package/dist/catalog/icon-map.mjs +212 -0
  4. package/dist/catalog/icon-names.d.mts +1 -0
  5. package/dist/{integrations/_shared → catalog}/icon-names.mjs +3 -1
  6. package/dist/catalog/index.d.mts +1289 -0
  7. package/dist/catalog/index.mjs +419 -0
  8. package/dist/catalog/render.css +34 -0
  9. package/dist/catalog/render.d.mts +72 -0
  10. package/dist/catalog/render.mjs +631 -0
  11. package/dist/catalog/render.module.mjs +11 -0
  12. package/dist/{integrations/_shared → catalog}/schemas.d.mts +120 -132
  13. package/dist/{integrations/_shared → catalog}/schemas.mjs +189 -131
  14. package/dist/catalog/to-tree.d.mts +4 -0
  15. package/dist/catalog/to-tree.mjs +17 -0
  16. package/dist/components/_internal/checked-values.d.mts +1 -0
  17. package/dist/components/_internal/checked-values.mjs +5 -0
  18. package/dist/components/_internal/field-message.css +25 -0
  19. package/dist/components/_internal/field-message.d.mts +10 -0
  20. package/dist/components/_internal/field-message.mjs +22 -0
  21. package/dist/components/_internal/field-message.module.mjs +9 -0
  22. package/dist/components/_internal/focus-ring.css +1 -1
  23. package/dist/components/_internal/high-contrast.css +1 -0
  24. package/dist/components/{observers/in-view → _internal}/in-view.mjs +1 -1
  25. package/dist/components/{observers/resize → _internal}/resize.mjs +1 -1
  26. package/dist/components/ai/_internal/attachment-preview.mjs +1 -1
  27. package/dist/components/ai/_internal/collapsible.mjs +1 -1
  28. package/dist/components/ai/attachment/attachment.d.mts +1 -1
  29. package/dist/components/ai/attachment/index.d.mts +1 -1
  30. package/dist/components/ai/conversation/conversation.mjs +4 -4
  31. package/dist/components/ai/index.d.mts +2 -2
  32. package/dist/components/ai/message/index.d.mts +2 -2
  33. package/dist/components/ai/message/message.d.mts +2 -2
  34. package/dist/components/ai/message/message.mjs +9 -9
  35. package/dist/components/ai/prompt-input/prompt-input.mjs +4 -4
  36. package/dist/components/ai/source/index.d.mts +2 -2
  37. package/dist/components/ai/source/source.d.mts +2 -2
  38. package/dist/components/ai/source/source.mjs +1 -1
  39. package/dist/components/ai/tool-invocation/approval-bar.mjs +11 -22
  40. package/dist/components/ai/tool-invocation/tool-invocation.d.mts +2 -2
  41. package/dist/components/buttons/button/button.css +1 -1
  42. package/dist/components/buttons/button/button.d.mts +34 -37
  43. package/dist/components/buttons/button/button.mjs +37 -24
  44. package/dist/components/buttons/button/button.module.mjs +0 -1
  45. package/dist/components/buttons/button/index.d.mts +2 -2
  46. package/dist/components/buttons/copy-button/copy-button.mjs +4 -4
  47. package/dist/components/buttons/icon-button/icon-button.css +3 -3
  48. package/dist/components/buttons/icon-button/icon-button.d.mts +37 -43
  49. package/dist/components/buttons/icon-button/icon-button.mjs +73 -63
  50. package/dist/components/buttons/icon-button/icon-button.module.mjs +2 -2
  51. package/dist/components/buttons/icon-button/index.d.mts +2 -2
  52. package/dist/components/buttons/toolbar/toolbar.css +5 -1
  53. package/dist/components/buttons/toolbar/toolbar.mjs +1 -1
  54. package/dist/components/data-display/accordion/accordion-button.d.mts +4 -1
  55. package/dist/components/data-display/accordion/accordion-button.mjs +4 -4
  56. package/dist/components/data-display/accordion/index.d.mts +3 -3
  57. package/dist/components/data-display/card/card-action.d.mts +6 -0
  58. package/dist/components/data-display/card/card-action.mjs +21 -0
  59. package/dist/components/data-display/card/card.css +24 -0
  60. package/dist/components/data-display/card/card.d.mts +26 -3
  61. package/dist/components/data-display/card/card.mjs +46 -6
  62. package/dist/components/data-display/card/card.module.mjs +4 -1
  63. package/dist/components/data-display/card/index.d.mts +2 -2
  64. package/dist/components/data-display/carousel/carousel.mjs +2 -2
  65. package/dist/components/data-display/code/code.css +4 -0
  66. package/dist/components/data-display/code-block/code-block.mjs +1 -1
  67. package/dist/components/data-display/data-table/data-table.css +0 -3
  68. package/dist/components/data-display/data-table/data-table.mjs +25 -26
  69. package/dist/components/data-display/tree/tree.d.mts +1 -1
  70. package/dist/components/data-display/tree/tree.mjs +6 -5
  71. package/dist/components/feedback/alert/alert.d.mts +2 -7
  72. package/dist/components/feedback/alert/alert.mjs +11 -11
  73. package/dist/components/feedback/alert/index.d.mts +2 -2
  74. package/dist/components/feedback/callout/callout.mjs +2 -2
  75. package/dist/components/feedback/progress/progress.mjs +1 -1
  76. package/dist/components/feedback/toast/context.d.mts +4 -5
  77. package/dist/components/feedback/toast/index.d.mts +2 -2
  78. package/dist/components/feedback/toast/provider.d.mts +7 -2
  79. package/dist/components/feedback/toast/provider.mjs +7 -2
  80. package/dist/components/feedback/toast/toast.d.mts +2 -3
  81. package/dist/components/form/autocomplete/autocomplete.d.mts +2 -2
  82. package/dist/components/form/autocomplete/autocomplete.mjs +12 -9
  83. package/dist/components/form/calendar/calendar.mjs +3 -5
  84. package/dist/components/form/checkbox/checkbox.d.mts +3 -1
  85. package/dist/components/form/checkbox/checkbox.mjs +44 -45
  86. package/dist/components/form/checkbox-card/checkbox-card.d.mts +3 -2
  87. package/dist/components/form/checkbox-card/checkbox-card.mjs +13 -6
  88. package/dist/components/form/checkbox-group/checkbox-group.d.mts +15 -20
  89. package/dist/components/form/checkbox-group/checkbox-group.mjs +18 -26
  90. package/dist/components/form/checkbox-group/index.d.mts +2 -34
  91. package/dist/components/form/checkbox-group/index.mjs +1 -8
  92. package/dist/components/form/color-picker/color-picker.css +3 -5
  93. package/dist/components/form/color-picker/color-picker.d.mts +0 -1
  94. package/dist/components/form/color-picker/color-picker.mjs +4 -4
  95. package/dist/components/form/combobox/combobox.d.mts +0 -1
  96. package/dist/components/form/combobox/combobox.mjs +9 -8
  97. package/dist/components/form/date-picker/date-picker.css +0 -5
  98. package/dist/components/form/date-picker/date-picker.mjs +21 -22
  99. package/dist/components/form/file-field/file-field.d.mts +6 -3
  100. package/dist/components/form/file-field/file-field.mjs +41 -18
  101. package/dist/components/form/file-field/index.d.mts +4 -1
  102. package/dist/components/form/form/form.mjs +0 -1
  103. package/dist/components/form/form-control/form-control.css +0 -15
  104. package/dist/components/form/form-control/form-control.d.mts +3 -4
  105. package/dist/components/form/form-control/form-control.mjs +44 -46
  106. package/dist/components/form/form-control/form-control.module.mjs +0 -3
  107. package/dist/components/form/number-field/number-field.d.mts +2 -2
  108. package/dist/components/form/number-field/number-field.mjs +13 -52
  109. package/dist/components/form/password-input/password-input.mjs +1 -1
  110. package/dist/components/form/radio/radio.mjs +4 -2
  111. package/dist/components/form/radio-card/radio-card.mjs +9 -2
  112. package/dist/components/form/range-slider/range-slider.d.mts +4 -2
  113. package/dist/components/form/range-slider/range-slider.mjs +2 -4
  114. package/dist/components/form/select/select.css +6 -4
  115. package/dist/components/form/select/select.d.mts +5 -0
  116. package/dist/components/form/select/select.mjs +10 -7
  117. package/dist/components/form/slider/slider.d.mts +2 -2
  118. package/dist/components/form/slider/slider.mjs +3 -6
  119. package/dist/components/form/switch/switch.d.mts +3 -0
  120. package/dist/components/form/switch/switch.mjs +43 -31
  121. package/dist/components/form/text-field/index.d.mts +2 -2
  122. package/dist/components/form/text-field/text-field.css +4 -0
  123. package/dist/components/form/text-field/text-field.d.mts +1 -1
  124. package/dist/components/form/textarea/textarea.d.mts +0 -1
  125. package/dist/components/form/textarea/textarea.mjs +1 -1
  126. package/dist/components/icons/base.d.mts +0 -1
  127. package/dist/components/icons/base.mjs +1 -2
  128. package/dist/components/icons/clipboard-check.d.mts +3 -0
  129. package/dist/components/icons/clipboard-check.mjs +18 -0
  130. package/dist/components/icons/git-pull-request.d.mts +3 -0
  131. package/dist/components/icons/git-pull-request.mjs +20 -0
  132. package/dist/components/icons/index.d.mts +9 -7
  133. package/dist/components/icons/index.mjs +30 -28
  134. package/dist/components/index.d.mts +58 -66
  135. package/dist/components/index.mjs +13 -19
  136. package/dist/components/layout/resizable-panels/resizable-panels.mjs +3 -3
  137. package/dist/components/navigation/anchor/anchor.css +3 -3
  138. package/dist/components/navigation/anchor/anchor.mjs +20 -7
  139. package/dist/components/navigation/anchor/anchor.module.mjs +1 -1
  140. package/dist/components/navigation/breadcrumb/breadcrumb.d.mts +6 -4
  141. package/dist/components/navigation/breadcrumb/breadcrumb.mjs +3 -2
  142. package/dist/components/navigation/pagination/pagination.d.mts +2 -2
  143. package/dist/components/navigation/pagination/pagination.mjs +2 -2
  144. package/dist/components/navigation/side-nav/side-nav.mjs +1 -1
  145. package/dist/components/navigation/stepper/stepper.mjs +3 -3
  146. package/dist/components/navigation/tabs/index.d.mts +10 -5
  147. package/dist/components/navigation/tabs/tabs.d.mts +11 -6
  148. package/dist/components/navigation/tabs/tabs.mjs +24 -27
  149. package/dist/components/overlays/_internal/modal-header.css +38 -0
  150. package/dist/components/overlays/_internal/modal-header.d.mts +7 -0
  151. package/dist/components/overlays/_internal/modal-header.mjs +32 -0
  152. package/dist/components/overlays/_internal/modal-header.module.mjs +10 -0
  153. package/dist/components/overlays/command-palette/command-palette.d.mts +2 -2
  154. package/dist/components/overlays/command-palette/command-palette.mjs +9 -8
  155. package/dist/components/overlays/context-menu/context-menu.mjs +3 -3
  156. package/dist/components/overlays/context-menu/index.d.mts +27 -2
  157. package/dist/components/overlays/dialog/dialog.css +3 -21
  158. package/dist/components/overlays/dialog/dialog.d.mts +20 -9
  159. package/dist/components/overlays/dialog/dialog.mjs +35 -73
  160. package/dist/components/overlays/dialog/dialog.module.mjs +1 -3
  161. package/dist/components/overlays/dialog/index.d.mts +2 -15
  162. package/dist/components/overlays/dialog/index.mjs +1 -8
  163. package/dist/components/overlays/drawer/drawer.css +4 -26
  164. package/dist/components/overlays/drawer/drawer.d.mts +7 -2
  165. package/dist/components/overlays/drawer/drawer.mjs +24 -37
  166. package/dist/components/overlays/drawer/drawer.module.mjs +2 -6
  167. package/dist/components/overlays/dropdown-menu/dropdown-menu.d.mts +35 -5
  168. package/dist/components/overlays/dropdown-menu/dropdown-menu.mjs +29 -11
  169. package/dist/components/overlays/dropdown-menu/hooks.d.mts +1 -1
  170. package/dist/components/overlays/dropdown-menu/hooks.mjs +1 -1
  171. package/dist/components/overlays/dropdown-menu/index.d.mts +34 -4
  172. package/dist/components/overlays/dropdown-menu/shared.css +1 -0
  173. package/dist/components/overlays/dropdown-menu/sub-menu.mjs +4 -4
  174. package/dist/components/overlays/list-box/hooks.mjs +2 -2
  175. package/dist/components/overlays/list-box/index.d.mts +2 -25
  176. package/dist/components/overlays/list-box/index.mjs +1 -9
  177. package/dist/components/overlays/list-box/list-box.d.mts +11 -16
  178. package/dist/components/overlays/list-box/list-box.mjs +23 -16
  179. package/dist/components/overlays/modal/modal.d.mts +8 -7
  180. package/dist/components/overlays/modal/modal.mjs +23 -32
  181. package/dist/components/overlays/popover/anchor-positioning.d.mts +3 -16
  182. package/dist/components/overlays/popover/anchor-positioning.mjs +14 -6
  183. package/dist/components/overlays/popover/hooks.d.mts +0 -2
  184. package/dist/components/overlays/popover/hooks.mjs +0 -2
  185. package/dist/components/overlays/popover/index.d.mts +19 -2
  186. package/dist/components/overlays/popover/index.mjs +7 -2
  187. package/dist/components/overlays/popover/popover.css +6 -0
  188. package/dist/components/overlays/popover/popover.d.mts +15 -2
  189. package/dist/components/overlays/popover/popover.mjs +28 -13
  190. package/dist/components/overlays/popover/popover.module.mjs +2 -1
  191. package/dist/components/overlays/tooltip/bridge.css +1 -1
  192. package/dist/components/overlays/tooltip/tooltip.mjs +5 -5
  193. package/dist/helpers/index.mjs +1 -1
  194. package/dist/i18n/en.mjs +1 -2
  195. package/dist/i18n/index.d.mts +3 -4
  196. package/dist/i18n/index.mjs +1 -2
  197. package/dist/i18n/ja.mjs +1 -2
  198. package/dist/i18n/messages.d.mts +2 -4
  199. package/dist/i18n/usage.d.mts +2 -1
  200. package/dist/i18n/usage.mjs +3 -3
  201. package/dist/index.d.mts +30 -36
  202. package/dist/index.mjs +4 -10
  203. package/dist/internal/iso-date.mjs +1 -1
  204. package/dist/styles/index.css +79 -225
  205. package/dist/styles/tailwind.css +1 -1
  206. package/dist/styles/tokens.css +281 -0
  207. package/dist/styles/tokens.d.mts +1 -1
  208. package/dist/styles/tokens.mjs +1 -1
  209. package/dist/types/index.d.mts +2 -2
  210. package/dist/types/variables.d.mts +4 -2
  211. package/docs/GUIDE.md +141 -66
  212. package/docs/llms.txt +38 -11
  213. package/docs/props.generated.json +752 -481
  214. package/docs/references/ai-chat.md +87 -39
  215. package/docs/references/color.md +15 -15
  216. package/docs/references/components.md +568 -499
  217. package/docs/references/generative-ui.md +373 -185
  218. package/docs/references/interaction-design.md +6 -5
  219. package/docs/references/spatial-design.md +8 -8
  220. package/docs/references/types.md +22 -25
  221. package/package.json +37 -70
  222. package/dist/components/form/date-field/date-field.css +0 -31
  223. package/dist/components/form/date-field/date-field.d.mts +0 -7
  224. package/dist/components/form/date-field/date-field.mjs +0 -19
  225. package/dist/components/form/date-field/date-field.module.mjs +0 -4
  226. package/dist/components/form/date-field/index.d.mts +0 -2
  227. package/dist/components/form/date-field/index.mjs +0 -1
  228. package/dist/components/observers/in-view/index.d.mts +0 -2
  229. package/dist/components/observers/in-view/index.mjs +0 -1
  230. package/dist/components/observers/resize/index.d.mts +0 -2
  231. package/dist/components/observers/resize/index.mjs +0 -1
  232. package/dist/components/overlays/_internal/modal-dialog-context.d.mts +0 -11
  233. package/dist/components/overlays/_internal/modal-dialog-context.mjs +0 -12
  234. package/dist/components/providers/index.d.mts +0 -3
  235. package/dist/components/providers/index.mjs +0 -3
  236. package/dist/components/providers/portal-root.d.mts +0 -8
  237. package/dist/components/providers/portal-root.mjs +0 -11
  238. package/dist/components/providers/ui-provider.d.mts +0 -2
  239. package/dist/components/providers/ui-provider.mjs +0 -6
  240. package/dist/integrations/_shared/icon-map.mjs +0 -208
  241. package/dist/integrations/_shared/icon-names.d.mts +0 -1
  242. package/dist/integrations/_shared/openui-defs.d.mts +0 -15
  243. package/dist/integrations/_shared/openui-defs.mjs +0 -230
  244. package/dist/integrations/_shared/renderers.css +0 -50
  245. package/dist/integrations/_shared/renderers.d.mts +0 -88
  246. package/dist/integrations/_shared/renderers.mjs +0 -880
  247. package/dist/integrations/_shared/renderers.module.mjs +0 -13
  248. package/dist/integrations/ai-sdk/index.d.mts +0 -3
  249. package/dist/integrations/ai-sdk/index.mjs +0 -1
  250. package/dist/integrations/ai-sdk/map-parts.d.mts +0 -44
  251. package/dist/integrations/ai-sdk/map-parts.mjs +0 -56
  252. package/dist/integrations/json-render/catalog.d.mts +0 -1359
  253. package/dist/integrations/json-render/catalog.mjs +0 -373
  254. package/dist/integrations/json-render/registry.d.mts +0 -26
  255. package/dist/integrations/json-render/registry.mjs +0 -192
  256. package/dist/integrations/openui/form-views.d.mts +0 -24
  257. package/dist/integrations/openui/form-views.mjs +0 -89
  258. package/dist/integrations/openui/library.d.mts +0 -202
  259. package/dist/integrations/openui/library.mjs +0 -83
  260. package/dist/integrations/openui/prompt.d.mts +0 -2
  261. package/dist/integrations/openui/prompt.mjs +0 -18
  262. /package/dist/components/{observers → _internal}/fragment-instance.d.mts +0 -0
  263. /package/dist/components/{observers/in-view → _internal}/in-view.d.mts +0 -0
  264. /package/dist/components/{observers/resize → _internal}/resize.d.mts +0 -0
@@ -1,12 +1,12 @@
1
1
  "use client";
2
2
  import { getMessages } from "../../../i18n/current.mjs";
3
- import focus_ring_module_default from "../../_internal/focus-ring.module.mjs";
4
3
  import { Button } from "../../buttons/button/button.mjs";
5
- import { Popover } from "../../overlays/popover/index.mjs";
6
- import { ChevronIcon } from "../../icons/chevron.mjs";
7
4
  import { Checkbox } from "../../form/checkbox/checkbox.mjs";
8
- import { CheckboxGroup } from "../../form/checkbox-group/index.mjs";
5
+ import { CheckboxGroup } from "../../form/checkbox-group/checkbox-group.mjs";
6
+ import { ChevronIcon } from "../../icons/chevron.mjs";
7
+ import { Popover } from "../../overlays/popover/index.mjs";
9
8
  import { Table } from "../table/table.mjs";
9
+ import focus_ring_module_default from "../../_internal/focus-ring.module.mjs";
10
10
  import data_table_module_default from "./data-table.module.mjs";
11
11
  import { clsx } from "clsx";
12
12
  import { useId } from "react";
@@ -48,7 +48,6 @@ const ColumnMenu = ({ columns, hiddenColumnIds, onHiddenColumnIdsChange }) => {
48
48
  const visible = hideable.filter((column) => !hiddenColumnIds.includes(column.id)).map((column) => column.id);
49
49
  return /* @__PURE__ */ jsxs(Popover.Root, {
50
50
  placement: "bottom-end",
51
- role: "dialog",
52
51
  children: [/* @__PURE__ */ jsx(Popover.Trigger, { renderItem: (props) => /* @__PURE__ */ jsx(Button, {
53
52
  ...props,
54
53
  color: "base",
@@ -56,27 +55,27 @@ const ColumnMenu = ({ columns, hiddenColumnIds, onHiddenColumnIdsChange }) => {
56
55
  type: "button",
57
56
  variant: "outline",
58
57
  children: messages.dataTableColumns
59
- }) }), /* @__PURE__ */ jsx(Popover.Content, { renderItem: (props) => /* @__PURE__ */ jsxs("div", {
60
- ...props,
61
- "aria-labelledby": titleId,
62
- className: data_table_module_default.columnMenu,
63
- children: [/* @__PURE__ */ jsx("p", {
64
- className: data_table_module_default.columnMenuTitle,
65
- id: titleId,
66
- children: messages.dataTableColumns
67
- }), /* @__PURE__ */ jsx(CheckboxGroup.Root, {
68
- "aria-labelledby": titleId,
69
- name: `${titleId}-columns`,
70
- onChange: (next) => {
71
- onHiddenColumnIdsChange(hideable.map((column) => column.id).filter((id) => !next.includes(id)));
72
- },
73
- value: visible,
74
- children: hideable.map((column) => /* @__PURE__ */ jsx(CheckboxGroup.Item, {
75
- itemValue: column.id,
76
- label: column.header
77
- }, column.id))
78
- })]
79
- }) })]
58
+ }) }), /* @__PURE__ */ jsx(Popover.Content, {
59
+ label: messages.dataTableColumns,
60
+ children: /* @__PURE__ */ jsxs("div", {
61
+ className: data_table_module_default.columnMenu,
62
+ children: [/* @__PURE__ */ jsx("p", {
63
+ className: data_table_module_default.columnMenuTitle,
64
+ id: titleId,
65
+ children: messages.dataTableColumns
66
+ }), /* @__PURE__ */ jsx(CheckboxGroup, {
67
+ "aria-labelledby": titleId,
68
+ onChange: (next) => {
69
+ onHiddenColumnIdsChange(hideable.map((column) => column.id).filter((id) => !next.includes(id)));
70
+ },
71
+ options: hideable.map((column) => ({
72
+ value: column.id,
73
+ label: column.header
74
+ })),
75
+ value: visible
76
+ })]
77
+ })
78
+ })]
80
79
  });
81
80
  };
82
81
  const DataTable = ({ label, columns, rows, getRowId, sort = null, onSortChange, selectedIds = NONE, onSelectedIdsChange, hiddenColumnIds = NONE, onHiddenColumnIdsChange, emptyState }) => {
@@ -10,7 +10,7 @@ type Props = {
10
10
  items: readonly TreeItem[];
11
11
  expandedIds?: readonly string[];
12
12
  defaultExpandedIds?: readonly string[];
13
- onExpandedChange?: (ids: readonly string[]) => void;
13
+ onExpandedIdsChange?: (ids: string[]) => void;
14
14
  selectedId?: string | null;
15
15
  defaultSelectedId?: string | null;
16
16
  onChange?: (id: string) => void;
@@ -1,8 +1,8 @@
1
1
  "use client";
2
- import focus_ring_module_default from "../../_internal/focus-ring.module.mjs";
3
2
  import { useControllableState } from "../../../hooks/controllable-state/index.mjs";
4
3
  import { readWritingMode } from "../../../hooks/writing-mode/index.mjs";
5
4
  import { ChevronIcon } from "../../icons/chevron.mjs";
5
+ import focus_ring_module_default from "../../_internal/focus-ring.module.mjs";
6
6
  import tree_module_default from "./tree.module.mjs";
7
7
  import { clsx } from "clsx";
8
8
  import { useRef, useState } from "react";
@@ -30,11 +30,10 @@ const directionOf = (key, isVertical) => {
30
30
  })[key];
31
31
  };
32
32
  const NONE = [];
33
- const Tree = ({ label, items, expandedIds, defaultExpandedIds, onExpandedChange, selectedId, defaultSelectedId = null, onChange, ...rest }) => {
33
+ const Tree = ({ label, items, expandedIds, defaultExpandedIds, onExpandedIdsChange, selectedId, defaultSelectedId = null, onChange, ...rest }) => {
34
34
  const [expanded, setExpanded] = useControllableState({
35
35
  value: expandedIds,
36
- defaultValue: defaultExpandedIds ?? NONE,
37
- onChange: onExpandedChange
36
+ defaultValue: defaultExpandedIds ?? NONE
38
37
  });
39
38
  const [selected, setSelected] = useControllableState({
40
39
  value: selectedId,
@@ -54,7 +53,9 @@ const Tree = ({ label, items, expandedIds, defaultExpandedIds, onExpandedChange,
54
53
  elements.current.get(id)?.focus();
55
54
  };
56
55
  const toggle = (id) => {
57
- setExpanded((previous) => previous.includes(id) ? previous.filter((value) => value !== id) : [...previous, id]);
56
+ const next = expanded.includes(id) ? expanded.filter((value) => value !== id) : [...expanded, id];
57
+ setExpanded(next);
58
+ onExpandedIdsChange?.(next);
58
59
  };
59
60
  const typeahead = (from, character) => {
60
61
  const lower = character.toLowerCase();
@@ -1,15 +1,10 @@
1
1
  import { Status } from "../../../types/variables.mjs";
2
2
  import { FC, HTMLAttributes, ReactNode } from "react";
3
- export type AlertAction = {
4
- label: string;
5
- renderItem: (props: {
6
- children: ReactNode;
7
- }) => ReactNode;
8
- };
9
3
  type Props = {
10
4
  tone: Status;
11
5
  message: string | string[];
12
- action?: AlertAction;
6
+ /** A link or button, placed after a one-line message or below a list. */
7
+ action?: ReactNode;
13
8
  onClose?: () => void;
14
9
  closeLabel?: string;
15
10
  } & Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'role' | 'className' | 'style'>;
@@ -1,30 +1,30 @@
1
1
  import { getMessages } from "../../../i18n/current.mjs";
2
- import sr_only_module_default from "../../_internal/sr-only.module.mjs";
3
- import { AlertIcon } from "../../icons/alert.mjs";
4
- import { IconButton } from "../../buttons/icon-button/icon-button.mjs";
5
- import high_contrast_module_default from "../../_internal/high-contrast.module.mjs";
6
2
  import { STATUS_ICON, STATUS_MESSAGE_KEY, STATUS_SURFACE } from "../../_internal/status-tone.mjs";
3
+ import { IconButton } from "../../buttons/icon-button/icon-button.mjs";
4
+ import { AlertIcon } from "../../icons/alert.mjs";
7
5
  import { XIcon } from "../../icons/x.mjs";
6
+ import high_contrast_module_default from "../../_internal/high-contrast.module.mjs";
7
+ import sr_only_module_default from "../../_internal/sr-only.module.mjs";
8
8
  import alert_module_default from "./alert.module.mjs";
9
9
  import { clsx } from "clsx";
10
10
  import { jsx, jsxs } from "react/jsx-runtime";
11
11
  // src/components/feedback/alert/alert.tsx
12
12
  const Alert = ({ tone, message, action, onClose, closeLabel, ...rest }) => {
13
13
  const messages = getMessages();
14
- const actionNode = action ? action.renderItem({ children: action.label }) : null;
15
- const inlineAction = action ? /* @__PURE__ */ jsx("span", {
14
+ const hasAction = action !== void 0 && action !== null && typeof action !== "boolean";
15
+ const inlineAction = hasAction ? /* @__PURE__ */ jsx("span", {
16
16
  className: alert_module_default.inlineAction,
17
- children: actionNode
17
+ children: action
18
18
  }) : null;
19
19
  let messageContent;
20
20
  if (Array.isArray(message) && message.length > 1) {
21
- const list = /* @__PURE__ */ jsx("ul", { children: message.map((msg) => /* @__PURE__ */ jsx("li", {
21
+ const list = /* @__PURE__ */ jsx("ul", { children: message.map((msg, index) => /* @__PURE__ */ jsx("li", {
22
22
  className: alert_module_default.listItem,
23
23
  children: msg
24
- }, msg)) });
25
- messageContent = action ? /* @__PURE__ */ jsxs("div", { children: [list, /* @__PURE__ */ jsx("div", {
24
+ }, `${msg}-${index}`)) });
25
+ messageContent = hasAction ? /* @__PURE__ */ jsxs("div", { children: [list, /* @__PURE__ */ jsx("div", {
26
26
  className: alert_module_default.listAction,
27
- children: actionNode
27
+ children: action
28
28
  })] }) : list;
29
29
  } else {
30
30
  const text = Array.isArray(message) ? message[0] : message;
@@ -1,2 +1,2 @@
1
- import { Alert, AlertAction } from "./alert.mjs";
2
- export { Alert, type AlertAction };
1
+ import { Alert } from "./alert.mjs";
2
+ export { Alert };
@@ -1,8 +1,8 @@
1
1
  import { getMessages } from "../../../i18n/current.mjs";
2
- import sr_only_module_default from "../../_internal/sr-only.module.mjs";
2
+ import { STATUS_ICON, STATUS_MESSAGE_KEY, STATUS_SURFACE } from "../../_internal/status-tone.mjs";
3
3
  import { AlertIcon } from "../../icons/alert.mjs";
4
4
  import high_contrast_module_default from "../../_internal/high-contrast.module.mjs";
5
- import { STATUS_ICON, STATUS_MESSAGE_KEY, STATUS_SURFACE } from "../../_internal/status-tone.mjs";
5
+ import sr_only_module_default from "../../_internal/sr-only.module.mjs";
6
6
  import callout_module_default from "./callout.module.mjs";
7
7
  import { clsx } from "clsx";
8
8
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1,6 +1,6 @@
1
1
  import { getMessages } from "../../../i18n/current.mjs";
2
- import high_contrast_module_default from "../../_internal/high-contrast.module.mjs";
3
2
  import { toPrecision } from "../../../internal/to-precision.mjs";
3
+ import high_contrast_module_default from "../../_internal/high-contrast.module.mjs";
4
4
  import progress_module_default from "./progress.module.mjs";
5
5
  import { clsx } from "clsx";
6
6
  import { jsx } from "react/jsx-runtime";
@@ -1,21 +1,20 @@
1
1
  import { Status } from "../../../types/variables.mjs";
2
- import { AlertAction } from "../alert/alert.mjs";
3
- import "../alert/index.mjs";
4
- export type ToastAction = AlertAction;
2
+ import { ReactNode } from "react";
5
3
  export type ToastOptions = {
6
4
  /**
7
5
  * 自動で閉じるまでのミリ秒。`Number.POSITIVE_INFINITY` で自動クローズなし
8
6
  * (閉じるボタンでのみ閉じる)。既定は 5000ms。
9
7
  */
10
8
  duration?: number;
11
- action?: ToastAction;
9
+ /** A link or button drawn in the toast, as `Alert`'s `action`. */
10
+ action?: ReactNode;
12
11
  };
13
12
  export type ToastType = {
14
13
  id: string;
15
14
  tone: Status;
16
15
  message: string;
17
16
  duration: number;
18
- action?: ToastAction;
17
+ action?: ReactNode;
19
18
  /**
20
19
  * 開いた時点のフォーカス位置。閉じたときの返還先候補として使う。
21
20
  * 参照を握り続けて DOM のリークを起こさないよう WeakRef で持つ。
@@ -1,3 +1,3 @@
1
- import { ToastAction, ToastOptions, useToast } from "./context.mjs";
1
+ import { ToastOptions, useToast } from "./context.mjs";
2
2
  import { ToastProvider } from "./provider.mjs";
3
- export { type ToastAction, type ToastOptions, ToastProvider, useToast };
3
+ export { type ToastOptions, ToastProvider, useToast };
@@ -1,5 +1,10 @@
1
1
  import { FC, PropsWithChildren, RefObject } from "react";
2
- export declare const ToastProvider: FC<PropsWithChildren<{
2
+ /**
3
+ * The toasts of one layer. `Modal` opens its own inside its `<dialog>`, which
4
+ * the top layer would otherwise cover; the application's is `ToastProvider`.
5
+ */
6
+ export declare const ToastLayer: FC<PropsWithChildren<{
3
7
  portalRef?: RefObject<HTMLElement | null>;
4
8
  position?: 'fixed' | 'absolute';
5
- }>>;
9
+ }>>;
10
+ export declare const ToastProvider: FC<PropsWithChildren>;
@@ -52,7 +52,11 @@ const ToastItem = ({ id, isClosing, onExited, children }) => {
52
52
  })
53
53
  });
54
54
  };
55
- const ToastProvider = ({ children, portalRef = null, position = "fixed" }) => {
55
+ /**
56
+ * The toasts of one layer. `Modal` opens its own inside its `<dialog>`, which
57
+ * the top layer would otherwise cover; the application's is `ToastProvider`.
58
+ */
59
+ const ToastLayer = ({ children, portalRef = null, position = "fixed" }) => {
56
60
  const messages = getMessages();
57
61
  const [state, setState] = useState({
58
62
  toasts: [],
@@ -172,4 +176,5 @@ const ToastProvider = ({ children, portalRef = null, position = "fixed" }) => {
172
176
  }), container) : null]
173
177
  });
174
178
  };
175
- export { ToastProvider };
179
+ const ToastProvider = ({ children }) => /* @__PURE__ */ jsx(ToastLayer, { children });
180
+ export { ToastLayer, ToastProvider };
@@ -1,11 +1,10 @@
1
1
  import { Status } from "../../../types/variables.mjs";
2
- import { ToastAction } from "./context.mjs";
3
- import { FC } from "react";
2
+ import { FC, ReactNode } from "react";
4
3
  type ToastProps = {
5
4
  tone: Status;
6
5
  message: string;
7
6
  duration: number;
8
- action?: ToastAction;
7
+ action?: ReactNode;
9
8
  isPaused?: boolean;
10
9
  onClose: () => void;
11
10
  };
@@ -7,12 +7,12 @@ type BaseProps = {
7
7
  ref?: Ref<HTMLInputElement>;
8
8
  } & Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'role' | 'className' | 'style' | 'value' | 'onChange' | 'defaultValue' | 'children' | 'id' | 'autoComplete' | 'aria-autocomplete' | 'aria-controls' | 'aria-expanded' | 'aria-activedescendant'>;
9
9
  type ControlledProps = {
10
- value: string[];
10
+ value: readonly string[];
11
11
  onChange: (value: string[]) => void;
12
12
  defaultValue?: never;
13
13
  };
14
14
  type UncontrolledProps = {
15
- defaultValue?: string[];
15
+ defaultValue?: readonly string[];
16
16
  value?: never;
17
17
  onChange?: (value: string[]) => void;
18
18
  };
@@ -1,14 +1,14 @@
1
1
  "use client";
2
- import { getMessages } from "../../../i18n/current.mjs";
3
- import { mergeRefs } from "../../../helpers/merge-refs.mjs";
4
- import focus_ring_module_default from "../../_internal/focus-ring.module.mjs";
5
- import { chain } from "../../../helpers/chain.mjs";
6
2
  import { useClickAway } from "../../../hooks/click-away/index.mjs";
7
3
  import { useControllableState } from "../../../hooks/controllable-state/index.mjs";
8
4
  import { useWritingMode } from "../../../hooks/writing-mode/index.mjs";
5
+ import { getMessages } from "../../../i18n/current.mjs";
6
+ import { FormValue } from "../../_internal/form-value.mjs";
9
7
  import { IconButton } from "../../buttons/icon-button/icon-button.mjs";
10
8
  import { XIcon } from "../../icons/x.mjs";
11
- import { FormValue } from "../../_internal/form-value.mjs";
9
+ import { chain } from "../../../helpers/chain.mjs";
10
+ import { mergeRefs } from "../../../helpers/merge-refs.mjs";
11
+ import focus_ring_module_default from "../../_internal/focus-ring.module.mjs";
12
12
  import autocomplete_module_default from "./autocomplete.module.mjs";
13
13
  import { clsx } from "clsx";
14
14
  import { useCallback, useDeferredValue, useId, useMemo, useRef, useState } from "react";
@@ -17,11 +17,14 @@ import { jsx, jsxs } from "react/jsx-runtime";
17
17
  // src/components/form/autocomplete/autocomplete.tsx
18
18
  const Autocomplete = ({ id, name, invalid = false, disabled = false, readOnly = false, required = false, options, value, defaultValue, onChange, placeholder, onBlur, onClick, onKeyDown, ref, ...rest }) => {
19
19
  const messages = getMessages();
20
- const [currentValue, handleChange] = useControllableState({
20
+ const [currentValue, setCurrentValue] = useControllableState({
21
21
  value,
22
- defaultValue: defaultValue ?? [],
23
- onChange
22
+ defaultValue: defaultValue ?? []
24
23
  });
24
+ const handleChange = (next) => {
25
+ setCurrentValue(next);
26
+ onChange?.(next);
27
+ };
25
28
  const baseId = useId();
26
29
  const listboxId = `${baseId}-listbox`;
27
30
  const optionId = (index) => `${baseId}-option-${String(index)}`;
@@ -135,7 +138,7 @@ const Autocomplete = ({ id, name, invalid = false, disabled = false, readOnly =
135
138
  name,
136
139
  onReset: () => {
137
140
  reset();
138
- if (value === void 0) handleChange(defaultValue ?? []);
141
+ if (value === void 0) handleChange([...defaultValue ?? []]);
139
142
  },
140
143
  required,
141
144
  values: currentValue
@@ -1,10 +1,10 @@
1
1
  "use client";
2
- import { getLocale, getMessages } from "../../../i18n/current.mjs";
3
- import focus_ring_module_default from "../../_internal/focus-ring.module.mjs";
4
2
  import { useControllableState } from "../../../hooks/controllable-state/index.mjs";
3
+ import { getLocale, getMessages } from "../../../i18n/current.mjs";
4
+ import { addDays, addMonths, clampDate, endOfMonth, formatDate, isIsoDate, isSameMonth, isWithin, localToday, monthWeeks, startOfMonth, startOfWeek, subscribeToDateChange } from "../../../internal/iso-date.mjs";
5
5
  import { IconButton } from "../../buttons/icon-button/icon-button.mjs";
6
6
  import { ChevronIcon } from "../../icons/chevron.mjs";
7
- import { addDays, addMonths, clampDate, endOfMonth, formatDate, isIsoDate, isSameMonth, isWithin, localToday, monthWeeks, startOfMonth, startOfWeek, subscribeToDateChange } from "../../../internal/iso-date.mjs";
7
+ import focus_ring_module_default from "../../_internal/focus-ring.module.mjs";
8
8
  import calendar_module_default from "./calendar.module.mjs";
9
9
  import { clsx } from "clsx";
10
10
  import { Suspense, use, useEffect, useId, useMemo, useRef, useState, useSyncExternalStore } from "react";
@@ -99,7 +99,6 @@ const CalendarBody = ({ value, defaultValue, onChange, min: minProp, max: maxPro
99
99
  className: calendar_module_default.header,
100
100
  children: [
101
101
  /* @__PURE__ */ jsx(IconButton, {
102
- color: "transparent",
103
102
  disabled: !canGoPrevious,
104
103
  label: messages.calendarPreviousMonth,
105
104
  onClick: () => {
@@ -119,7 +118,6 @@ const CalendarBody = ({ value, defaultValue, onChange, min: minProp, max: maxPro
119
118
  children: monthFormat.format(formatDate(focused))
120
119
  }),
121
120
  /* @__PURE__ */ jsx(IconButton, {
122
- color: "transparent",
123
121
  disabled: !canGoNext,
124
122
  label: messages.calendarNextMonth,
125
123
  onClick: () => {
@@ -1,11 +1,13 @@
1
1
  import { ChangeEvent, FC, InputHTMLAttributes, Ref } from "react";
2
2
  type BaseProps = {
3
+ errorText?: string;
4
+ helpText?: string;
3
5
  indeterminate?: boolean;
4
6
  invalid?: boolean;
5
- itemValue?: string;
6
7
  label: string;
7
8
  labelHidden?: boolean;
8
9
  ref?: Ref<HTMLInputElement>;
10
+ value?: string;
9
11
  } & Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'className' | 'style' | 'value' | 'onChange' | 'defaultChecked' | 'checked' | 'children'>;
10
12
  type ControlledProps = {
11
13
  checked: boolean;
@@ -1,62 +1,61 @@
1
1
  "use client";
2
- import sr_only_module_default from "../../_internal/sr-only.module.mjs";
3
2
  import { mergeRefs } from "../../../helpers/merge-refs.mjs";
4
- import { CheckIcon } from "../../icons/check.mjs";
3
+ import { FieldMessage, describedByWith, hasErrorText } from "../../_internal/field-message.mjs";
5
4
  import { ignoreClick } from "../../_internal/ignore-changes.mjs";
5
+ import { CheckIcon } from "../../icons/check.mjs";
6
6
  import { MinusIcon } from "../../icons/minus.mjs";
7
- import { useCheckboxGroupContext } from "../checkbox-group/checkbox-group.mjs";
7
+ import field_message_module_default from "../../_internal/field-message.module.mjs";
8
+ import sr_only_module_default from "../../_internal/sr-only.module.mjs";
8
9
  import checkbox_module_default from "./checkbox.module.mjs";
9
10
  import { clsx } from "clsx";
10
- import { useCallback, useMemo } from "react";
11
+ import { useCallback, useId, useMemo } from "react";
11
12
  import { useFormStatus } from "react-dom";
12
13
  import { jsx, jsxs } from "react/jsx-runtime";
13
14
  // src/components/form/checkbox/checkbox.tsx
14
- const Checkbox = ({ name, itemValue, disabled = false, indeterminate = false, invalid = false, label, labelHidden = false, checked, defaultChecked, onChange, ref, ...rest }) => {
15
- const groupContext = useCheckboxGroupContext();
15
+ const Checkbox = ({ "aria-describedby": describedby, disabled = false, errorText, helpText, indeterminate = false, invalid = false, label, labelHidden = false, checked, defaultChecked, onChange, ref, ...rest }) => {
16
16
  const { pending } = useFormStatus();
17
- const groupItemValue = itemValue ?? "";
18
- if (groupContext && (itemValue === void 0 || itemValue === "")) throw new Error("Checkbox inside CheckboxGroup requires itemValue");
17
+ const message = {
18
+ id: useId(),
19
+ errorText,
20
+ helpText
21
+ };
19
22
  const indeterminateRef = useCallback((input) => {
20
23
  if (input !== null) input.indeterminate = indeterminate;
21
24
  }, [indeterminate]);
22
25
  const mergedRef = useMemo(() => mergeRefs(ref, indeterminateRef), [ref, indeterminateRef]);
23
- const disabledNative = disabled || groupContext?.disabled === true;
24
- const disabledResolved = disabledNative || pending;
25
- const isChecked = groupContext ? groupContext.value?.includes(groupItemValue) : checked;
26
- const isDefaultChecked = groupContext ? groupContext.defaultValue.includes(groupItemValue) : defaultChecked;
27
- return /* @__PURE__ */ jsxs("label", {
28
- className: clsx(checkbox_module_default.root, !labelHidden && checkbox_module_default.withLabel, disabledResolved && checkbox_module_default.disabled),
29
- onClickCapture: pending ? ignoreClick : void 0,
30
- children: [
31
- /* @__PURE__ */ jsx("input", {
32
- ...rest,
33
- ...isChecked === void 0 ? { defaultChecked: isDefaultChecked } : { checked: isChecked },
34
- "aria-disabled": pending || void 0,
35
- "aria-invalid": invalid,
36
- className: clsx(sr_only_module_default.srOnly, checkbox_module_default.input),
37
- disabled: disabledNative,
38
- name: groupContext?.name ?? name,
39
- onChange: (event) => {
40
- if (groupContext) {
41
- groupContext.notifyChange(event);
42
- return;
43
- }
44
- onChange?.(event.target.checked, event);
45
- },
46
- ref: mergedRef,
47
- type: "checkbox",
48
- value: itemValue
49
- }),
50
- /* @__PURE__ */ jsx("span", {
51
- "aria-hidden": true,
52
- className: clsx(checkbox_module_default.box, invalid && checkbox_module_default.invalid),
53
- children: indeterminate ? /* @__PURE__ */ jsx(MinusIcon, { size: "sm" }) : /* @__PURE__ */ jsx(CheckIcon, { size: "sm" })
54
- }),
55
- /* @__PURE__ */ jsx("span", {
56
- className: labelHidden ? sr_only_module_default.srOnly : checkbox_module_default.label,
57
- children: label
58
- })
59
- ]
26
+ const disabledResolved = disabled || pending;
27
+ const invalidResolved = invalid || hasErrorText(errorText);
28
+ return /* @__PURE__ */ jsxs("span", {
29
+ className: field_message_module_default.field,
30
+ children: [/* @__PURE__ */ jsxs("label", {
31
+ className: clsx(checkbox_module_default.root, !labelHidden && checkbox_module_default.withLabel, disabledResolved && checkbox_module_default.disabled),
32
+ onClickCapture: pending ? ignoreClick : void 0,
33
+ children: [
34
+ /* @__PURE__ */ jsx("input", {
35
+ ...rest,
36
+ ...checked === void 0 ? { defaultChecked } : { checked },
37
+ "aria-describedby": describedByWith(describedby, message),
38
+ "aria-disabled": pending || void 0,
39
+ "aria-invalid": invalidResolved,
40
+ className: clsx(sr_only_module_default.srOnly, checkbox_module_default.input),
41
+ disabled,
42
+ onChange: (event) => {
43
+ onChange?.(event.target.checked, event);
44
+ },
45
+ ref: mergedRef,
46
+ type: "checkbox"
47
+ }),
48
+ /* @__PURE__ */ jsx("span", {
49
+ "aria-hidden": true,
50
+ className: clsx(checkbox_module_default.box, invalidResolved && checkbox_module_default.invalid),
51
+ children: indeterminate ? /* @__PURE__ */ jsx(MinusIcon, { size: "sm" }) : /* @__PURE__ */ jsx(CheckIcon, { size: "sm" })
52
+ }),
53
+ /* @__PURE__ */ jsx("span", {
54
+ className: labelHidden ? sr_only_module_default.srOnly : checkbox_module_default.label,
55
+ children: label
56
+ })
57
+ ]
58
+ }), /* @__PURE__ */ jsx(FieldMessage, { ...message })]
60
59
  });
61
60
  };
62
61
  export { Checkbox };
@@ -11,14 +11,15 @@ type BaseProps = {
11
11
  invalid?: boolean;
12
12
  options: readonly CheckboxCardOption[];
13
13
  ref?: Ref<HTMLFieldSetElement>;
14
+ required?: boolean;
14
15
  } & Omit<FieldsetHTMLAttributes<HTMLFieldSetElement>, 'className' | 'style' | 'children' | 'onChange' | 'defaultValue' | 'aria-labelledby' | 'role'>;
15
16
  type ControlledProps = {
16
- value: string[];
17
+ value: readonly string[];
17
18
  onChange: (value: string[]) => void;
18
19
  defaultValue?: never;
19
20
  };
20
21
  type UncontrolledProps = {
21
- defaultValue?: string[];
22
+ defaultValue?: readonly string[];
22
23
  value?: never;
23
24
  onChange?: (value: string[]) => void;
24
25
  };
@@ -1,22 +1,26 @@
1
1
  "use client";
2
- import sr_only_module_default from "../../_internal/sr-only.module.mjs";
2
+ import { checkedValuesAround } from "../../_internal/checked-values.mjs";
3
+ import { ignoreClick } from "../../_internal/ignore-changes.mjs";
3
4
  import { CheckIcon } from "../../icons/check.mjs";
5
+ import sr_only_module_default from "../../_internal/sr-only.module.mjs";
4
6
  import checkbox_card_module_default from "./checkbox-card.module.mjs";
5
7
  import { clsx } from "clsx";
6
8
  import { useId } from "react";
9
+ import { useFormStatus } from "react-dom";
7
10
  import { jsx, jsxs } from "react/jsx-runtime";
8
11
  // src/components/form/checkbox-card/checkbox-card.tsx
9
- const CheckboxCard = ({ "aria-labelledby": labelledbyId, name, disabled = false, invalid = false, options, value, defaultValue, onChange, ref, ...rest }) => {
12
+ const CheckboxCard = ({ "aria-labelledby": labelledbyId, name, disabled = false, invalid = false, options, value, defaultValue, onChange, ref, required: _required, ...rest }) => {
10
13
  const groupId = useId();
11
14
  const isControlled = value !== void 0;
15
+ const { pending } = useFormStatus();
16
+ const disabledResolved = disabled || pending;
12
17
  const handleChange = (event) => {
13
- const inputs = event.currentTarget.closest("fieldset")?.querySelectorAll("input[type=\"checkbox\"]") ?? [];
14
- onChange?.([...inputs].filter((input) => input.checked).map((input) => input.value));
18
+ onChange?.(checkedValuesAround(event.currentTarget));
15
19
  };
16
20
  return /* @__PURE__ */ jsx("fieldset", {
17
21
  ...rest,
18
22
  "aria-labelledby": labelledbyId,
19
- className: clsx(checkbox_card_module_default.root, disabled && checkbox_card_module_default.rootDisabled),
23
+ className: clsx(checkbox_card_module_default.root, disabledResolved && checkbox_card_module_default.rootDisabled),
20
24
  ref,
21
25
  role: "group",
22
26
  children: options.map((option) => {
@@ -25,11 +29,14 @@ const CheckboxCard = ({ "aria-labelledby": labelledbyId, name, disabled = false,
25
29
  const hasVisual = option.visual !== void 0 && option.visual !== null;
26
30
  const optionId = `${groupId}-${option.value}`;
27
31
  return /* @__PURE__ */ jsxs("label", {
28
- className: clsx(checkbox_card_module_default.card, invalid && checkbox_card_module_default.invalid, optionDisabled && checkbox_card_module_default.disabled),
32
+ className: clsx(checkbox_card_module_default.card, invalid && checkbox_card_module_default.invalid, (optionDisabled || pending) && checkbox_card_module_default.disabled),
29
33
  id: optionId,
34
+ onClickCapture: pending ? ignoreClick : void 0,
30
35
  children: [
31
36
  /* @__PURE__ */ jsx("input", {
32
37
  "aria-describedby": hasDescription ? `${optionId}-description` : void 0,
38
+ "aria-disabled": pending || void 0,
39
+ "aria-invalid": invalid,
33
40
  "aria-labelledby": `${optionId}-label`,
34
41
  ...isControlled ? { checked: value.includes(option.value) } : { defaultChecked: defaultValue?.includes(option.value) },
35
42
  className: clsx(sr_only_module_default.srOnly, checkbox_card_module_default.input),
@@ -1,29 +1,24 @@
1
- import { ChangeEvent, FC, FieldsetHTMLAttributes, PropsWithChildren, Ref } from "react";
2
- type CheckboxGroupContextValue = {
3
- /** 制御モードの値。非制御では undefined で、各項目は defaultValue から始める */
4
- value: string[] | undefined;
5
- defaultValue: string[];
6
- disabled: boolean;
7
- name: string;
8
- notifyChange: (event: ChangeEvent<HTMLInputElement>) => void;
9
- };
10
- export declare const useCheckboxGroupContext: () => CheckboxGroupContextValue | undefined;
11
- type RootBaseProps = PropsWithChildren<{
1
+ import { Option } from "../../../types/variables.mjs";
2
+ import { FC, FieldsetHTMLAttributes, Ref } from "react";
3
+ type BaseProps = {
12
4
  'aria-labelledby': string;
5
+ disabled?: boolean;
13
6
  invalid?: boolean;
14
- name: string;
7
+ name?: string;
8
+ options: readonly Option[];
15
9
  ref?: Ref<HTMLFieldSetElement>;
16
- } & Omit<FieldsetHTMLAttributes<HTMLFieldSetElement>, 'className' | 'style' | 'onChange' | 'defaultValue' | 'name' | 'aria-labelledby' | 'role'>>;
17
- type RootControlledProps = {
18
- value: string[];
10
+ required?: boolean;
11
+ } & Omit<FieldsetHTMLAttributes<HTMLFieldSetElement>, 'className' | 'style' | 'children' | 'onChange' | 'defaultValue' | 'disabled' | 'name' | 'aria-labelledby' | 'role'>;
12
+ type ControlledProps = {
13
+ value: readonly string[];
19
14
  onChange: (value: string[]) => void;
20
15
  defaultValue?: never;
21
16
  };
22
- type RootUncontrolledProps = {
23
- defaultValue?: string[];
17
+ type UncontrolledProps = {
18
+ defaultValue?: readonly string[];
24
19
  value?: never;
25
20
  onChange?: (value: string[]) => void;
26
21
  };
27
- type RootProps = RootBaseProps & (RootControlledProps | RootUncontrolledProps);
28
- declare const Root: FC<RootProps>;
29
- export { Root as CheckboxGroupRoot };
22
+ type Props = BaseProps & (ControlledProps | UncontrolledProps);
23
+ export declare const CheckboxGroup: FC<Props>;
24
+ export {};