@k8o/arte-odyssey 9.0.0 → 10.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 (138) hide show
  1. package/README.md +121 -28
  2. package/dist/components/_internal/focus-ring.d.mts +8 -0
  3. package/dist/components/_internal/focus-ring.mjs +8 -0
  4. package/dist/components/buttons/button/button.d.mts +9 -2
  5. package/dist/components/buttons/button/button.mjs +13 -12
  6. package/dist/components/buttons/icon-button/icon-button.d.mts +8 -2
  7. package/dist/components/buttons/icon-button/icon-button.mjs +3 -2
  8. package/dist/components/data-display/accordion/accordion-button.mjs +3 -2
  9. package/dist/components/data-display/accordion/accordion-item.d.mts +2 -0
  10. package/dist/components/data-display/accordion/accordion-item.mjs +7 -2
  11. package/dist/components/data-display/accordion/accordion.mjs +1 -1
  12. package/dist/components/data-display/accordion/context.d.mts +2 -0
  13. package/dist/components/data-display/accordion/context.mjs +12 -6
  14. package/dist/components/data-display/accordion/index.d.mts +9 -9
  15. package/dist/components/data-display/avatar/avatar.d.mts +1 -1
  16. package/dist/components/data-display/avatar/avatar.mjs +3 -3
  17. package/dist/components/data-display/badge/badge.d.mts +2 -2
  18. package/dist/components/data-display/badge/badge.mjs +6 -5
  19. package/dist/components/data-display/card/card.mjs +2 -2
  20. package/dist/components/data-display/card/interactive-card.mjs +2 -2
  21. package/dist/components/data-display/card/type.d.mts +1 -1
  22. package/dist/components/data-display/code/code.d.mts +1 -1
  23. package/dist/components/data-display/code/code.mjs +3 -4
  24. package/dist/components/data-display/code/find-all-colors.mjs +3 -3
  25. package/dist/components/data-display/heading/heading.d.mts +1 -1
  26. package/dist/components/data-display/heading/heading.mjs +7 -7
  27. package/dist/components/data-display/table/table.d.mts +12 -17
  28. package/dist/components/data-display/table/table.mjs +23 -21
  29. package/dist/components/feedback/alert/alert.d.mts +2 -2
  30. package/dist/components/feedback/alert/alert.mjs +6 -6
  31. package/dist/components/feedback/progress/progress.d.mts +1 -1
  32. package/dist/components/feedback/progress/progress.mjs +5 -6
  33. package/dist/components/feedback/skeleton/skeleton.d.mts +1 -1
  34. package/dist/components/feedback/skeleton/skeleton.mjs +2 -2
  35. package/dist/components/feedback/spinner/spinner.d.mts +1 -1
  36. package/dist/components/feedback/spinner/spinner.mjs +2 -2
  37. package/dist/components/feedback/toast/context.d.mts +3 -4
  38. package/dist/components/feedback/toast/context.mjs +3 -4
  39. package/dist/components/feedback/toast/provider.mjs +2 -2
  40. package/dist/components/feedback/toast/toast.d.mts +1 -1
  41. package/dist/components/feedback/toast/toast.mjs +2 -2
  42. package/dist/components/form/autocomplete/autocomplete.d.mts +1 -1
  43. package/dist/components/form/autocomplete/autocomplete.mjs +67 -39
  44. package/dist/components/form/checkbox/checkbox.d.mts +4 -4
  45. package/dist/components/form/checkbox/checkbox.mjs +5 -4
  46. package/dist/components/form/checkbox-card/checkbox-card.d.mts +1 -1
  47. package/dist/components/form/checkbox-card/checkbox-card.mjs +4 -2
  48. package/dist/components/form/checkbox-group/checkbox-group.d.mts +1 -1
  49. package/dist/components/form/checkbox-group/checkbox-group.mjs +1 -0
  50. package/dist/components/form/checkbox-group/index.d.mts +10 -12
  51. package/dist/components/form/file-field/file-field.d.mts +4 -5
  52. package/dist/components/form/file-field/file-field.mjs +2 -7
  53. package/dist/components/form/form/form.d.mts +1 -1
  54. package/dist/components/form/form/form.mjs +2 -3
  55. package/dist/components/form/number-field/cast.mjs +2 -2
  56. package/dist/components/form/number-field/number-field.d.mts +1 -1
  57. package/dist/components/form/number-field/number-field.mjs +7 -6
  58. package/dist/components/form/password-input/password-input.d.mts +1 -1
  59. package/dist/components/form/password-input/password-input.mjs +4 -3
  60. package/dist/components/form/radio/radio.d.mts +4 -4
  61. package/dist/components/form/radio/radio.mjs +6 -5
  62. package/dist/components/form/radio-card/radio-card.d.mts +4 -4
  63. package/dist/components/form/radio-card/radio-card.mjs +6 -4
  64. package/dist/components/form/select/select.d.mts +1 -1
  65. package/dist/components/form/select/select.mjs +6 -4
  66. package/dist/components/form/slider/slider.d.mts +1 -1
  67. package/dist/components/form/slider/slider.mjs +15 -8
  68. package/dist/components/form/switch/switch.d.mts +4 -4
  69. package/dist/components/form/switch/switch.mjs +4 -3
  70. package/dist/components/form/text-field/text-field.d.mts +1 -1
  71. package/dist/components/form/text-field/text-field.mjs +2 -1
  72. package/dist/components/form/textarea/textarea.d.mts +1 -1
  73. package/dist/components/form/textarea/textarea.mjs +2 -1
  74. package/dist/components/index.d.mts +3 -1
  75. package/dist/components/index.mjs +3 -1
  76. package/dist/components/layout/_shared/gap.d.mts +11 -0
  77. package/dist/components/layout/_shared/gap.mjs +10 -0
  78. package/dist/components/layout/grid/grid.d.mts +16 -0
  79. package/dist/components/layout/grid/grid.mjs +35 -0
  80. package/dist/components/layout/grid/index.d.mts +2 -0
  81. package/dist/components/layout/grid/index.mjs +2 -0
  82. package/dist/components/layout/separator/separator.d.mts +1 -1
  83. package/dist/components/layout/separator/separator.mjs +2 -5
  84. package/dist/components/layout/stack/index.d.mts +2 -0
  85. package/dist/components/layout/stack/index.mjs +2 -0
  86. package/dist/components/layout/stack/stack.d.mts +13 -0
  87. package/dist/components/layout/stack/stack.mjs +23 -0
  88. package/dist/components/navigation/anchor/anchor.d.mts +10 -9
  89. package/dist/components/navigation/anchor/anchor.mjs +4 -3
  90. package/dist/components/navigation/breadcrumb/breadcrumb.d.mts +2 -4
  91. package/dist/components/navigation/breadcrumb/breadcrumb.mjs +4 -4
  92. package/dist/components/navigation/pagination/pagination.mjs +12 -6
  93. package/dist/components/navigation/tabs/tabs.d.mts +2 -0
  94. package/dist/components/navigation/tabs/tabs.mjs +35 -19
  95. package/dist/components/overlays/dialog/dialog.d.mts +1 -2
  96. package/dist/components/overlays/drawer/drawer.d.mts +3 -2
  97. package/dist/components/overlays/drawer/drawer.mjs +7 -4
  98. package/dist/components/overlays/dropdown-menu/dropdown-menu.mjs +4 -4
  99. package/dist/components/overlays/dropdown-menu/hooks.d.mts +153 -154
  100. package/dist/components/overlays/list-box/hooks.d.mts +173 -174
  101. package/dist/components/overlays/list-box/list-box.d.mts +1 -1
  102. package/dist/components/overlays/list-box/list-box.mjs +6 -6
  103. package/dist/components/overlays/modal/modal.mjs +9 -5
  104. package/dist/components/overlays/popover/hooks.d.mts +1 -2
  105. package/dist/components/overlays/popover/popover.mjs +8 -2
  106. package/dist/components/overlays/tooltip/tooltip.d.mts +1 -2
  107. package/dist/hooks/index.d.mts +3 -2
  108. package/dist/hooks/index.mjs +4 -3
  109. package/dist/hooks/writing-mode/index.d.mts +7 -0
  110. package/dist/hooks/writing-mode/index.mjs +22 -0
  111. package/dist/index.d.mts +5 -2
  112. package/dist/index.mjs +21 -18
  113. package/dist/integrations/_shared/renderers.d.mts +74 -0
  114. package/dist/integrations/_shared/renderers.mjs +667 -0
  115. package/dist/integrations/_shared/schemas.d.mts +704 -0
  116. package/dist/integrations/_shared/schemas.mjs +496 -0
  117. package/dist/integrations/json-render/catalog.d.mts +770 -0
  118. package/dist/integrations/json-render/catalog.mjs +229 -0
  119. package/dist/integrations/json-render/registry.d.mts +4 -0
  120. package/dist/integrations/json-render/registry.mjs +137 -0
  121. package/dist/integrations/openui/form-views.d.mts +31 -0
  122. package/dist/integrations/openui/form-views.mjs +75 -0
  123. package/dist/integrations/openui/library.d.mts +4 -0
  124. package/dist/integrations/openui/library.mjs +432 -0
  125. package/dist/styles/base.css +75 -0
  126. package/dist/styles/index.css +12 -463
  127. package/dist/styles/tokens.css +379 -0
  128. package/dist/styles/tokens.d.mts +2 -84
  129. package/dist/styles/tokens.generated.d.mts +839 -0
  130. package/dist/styles/tokens.generated.mjs +812 -0
  131. package/dist/styles/tokens.mjs +2 -752
  132. package/dist/styles/utilities.css +62 -0
  133. package/dist/types/index.d.mts +1 -1
  134. package/docs/GUIDE.md +26 -7
  135. package/docs/references/components.md +40 -21
  136. package/docs/references/hooks.md +17 -0
  137. package/docs/references/typography.md +29 -0
  138. package/package.json +69 -27
@@ -4,6 +4,6 @@ import { HTMLAttributes } from "react";
4
4
  type CardProps = {
5
5
  width?: 'full' | 'fit';
6
6
  appearance?: 'shadow' | 'bordered';
7
- } & HTMLAttributes<HTMLDivElement>;
7
+ } & Omit<HTMLAttributes<HTMLDivElement>, 'className' | 'style'>;
8
8
  //#endregion
9
9
  export { CardProps };
@@ -3,7 +3,7 @@ import { FC, HTMLAttributes } from "react";
3
3
  //#region src/components/data-display/code/code.d.ts
4
4
  type Props = {
5
5
  children: string;
6
- } & Omit<HTMLAttributes<HTMLElement>, 'children'>;
6
+ } & Omit<HTMLAttributes<HTMLElement>, 'children' | 'className' | 'style'>;
7
7
  declare const Code: FC<Props>;
8
8
  //#endregion
9
9
  export { Code };
@@ -1,13 +1,12 @@
1
- import { cn } from "../../../helpers/cn.mjs";
2
1
  import { findAllColors } from "./find-all-colors.mjs";
3
2
  import { Fragment } from "react";
4
3
  import { jsx, jsxs } from "react/jsx-runtime";
5
4
  //#region src/components/data-display/code/code.tsx
6
- const Code = ({ children, className, ...rest }) => {
5
+ const Code = ({ children, ...rest }) => {
7
6
  const colors = findAllColors(children);
8
7
  if (colors.length === 0) return /* @__PURE__ */ jsx("code", {
9
8
  ...rest,
10
- className: cn("bg-bg-mute m-0.5 rounded-md px-1.5 sm:py-0.5", className),
9
+ className: "bg-bg-mute m-0.5 rounded-md px-1.5 sm:py-0.5",
11
10
  children
12
11
  });
13
12
  const parts = [];
@@ -25,7 +24,7 @@ const Code = ({ children, className, ...rest }) => {
25
24
  if (lastIndex < children.length) parts.push(children.slice(lastIndex));
26
25
  return /* @__PURE__ */ jsx("code", {
27
26
  ...rest,
28
- className: cn("bg-bg-mute m-0.5 inline-flex items-center gap-1 rounded-md px-1.5 sm:py-0.5", className),
27
+ className: "bg-bg-mute vertical:inline vertical:gap-0 m-0.5 inline-flex items-center gap-1 rounded-md px-1.5 sm:py-0.5",
29
28
  children: parts
30
29
  });
31
30
  };
@@ -1,6 +1,6 @@
1
1
  //#region src/components/data-display/code/find-all-colors.ts
2
2
  const extractFunctionContent = (source, funcName) => {
3
- const funcPattern = new RegExp(`${funcName}\\s*\\(`, "gi");
3
+ const funcPattern = new RegExp(`${funcName}\\s*\\(`, "giu");
4
4
  const matches = [];
5
5
  let match = funcPattern.exec(source);
6
6
  while (match !== null) {
@@ -46,7 +46,7 @@ function findAllColors(text) {
46
46
  const matches = extractFunctionContent(text, func);
47
47
  results.push(...matches);
48
48
  }
49
- const hexPattern = /#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})(?=\s|;|,|$|\)|]|})/g;
49
+ const hexPattern = /#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})(?=\s|;|,|$|\)|\]|\})/gu;
50
50
  let hexMatch = hexPattern.exec(text);
51
51
  while (hexMatch !== null) {
52
52
  results.push({
@@ -88,7 +88,7 @@ function findAllColors(text) {
88
88
  while (index !== -1) {
89
89
  const beforeChar = index > 0 ? lowerText[index - 1] ?? " " : " ";
90
90
  const afterChar = index + color.length < lowerText.length ? lowerText[index + color.length] ?? " " : " ";
91
- if (!(/[a-zA-Z0-9]/.test(beforeChar) || /[a-zA-Z0-9]/.test(afterChar))) results.push({
91
+ if (!(/[a-zA-Z0-9]/u.test(beforeChar) || /[a-zA-Z0-9]/u.test(afterChar))) results.push({
92
92
  color,
93
93
  start: index,
94
94
  end: index + color.length
@@ -4,7 +4,7 @@ import { FC, HTMLAttributes } from "react";
4
4
  type Props = {
5
5
  type: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
6
6
  lineClamp?: number;
7
- } & HTMLAttributes<HTMLHeadingElement>;
7
+ } & Omit<HTMLAttributes<HTMLHeadingElement>, 'className' | 'style'>;
8
8
  declare const Heading: FC<Props>;
9
9
  //#endregion
10
10
  export { Heading };
@@ -1,36 +1,36 @@
1
1
  import { cn } from "../../../helpers/cn.mjs";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  //#region src/components/data-display/heading/heading.tsx
4
- const Heading = ({ children, type, lineClamp, className, ...rest }) => {
4
+ const Heading = ({ children, type, lineClamp, ...rest }) => {
5
5
  const lineClampClass = { [`line-clamp-${lineClamp?.toString() ?? ""}`]: lineClamp };
6
6
  if (type === "h1") return /* @__PURE__ */ jsx("h1", {
7
7
  ...rest,
8
- className: cn("font-bold text-2xl md:text-3xl", lineClampClass, className),
8
+ className: cn("font-bold text-2xl md:text-3xl", lineClampClass),
9
9
  children
10
10
  });
11
11
  if (type === "h2") return /* @__PURE__ */ jsx("h2", {
12
12
  ...rest,
13
- className: cn("font-bold text-xl md:text-2xl", lineClampClass, className),
13
+ className: cn("font-bold text-xl md:text-2xl", lineClampClass),
14
14
  children
15
15
  });
16
16
  if (type === "h3") return /* @__PURE__ */ jsx("h3", {
17
17
  ...rest,
18
- className: cn("font-bold text-lg md:text-xl", lineClampClass, className),
18
+ className: cn("font-bold text-lg md:text-xl", lineClampClass),
19
19
  children
20
20
  });
21
21
  if (type === "h4") return /* @__PURE__ */ jsx("h4", {
22
22
  ...rest,
23
- className: cn("font-bold text-md md:text-lg", lineClampClass, className),
23
+ className: cn("font-bold text-md md:text-lg", lineClampClass),
24
24
  children
25
25
  });
26
26
  if (type === "h5") return /* @__PURE__ */ jsx("h5", {
27
27
  ...rest,
28
- className: cn("font-bold text-sm md:text-md", lineClampClass, className),
28
+ className: cn("font-bold text-sm md:text-md", lineClampClass),
29
29
  children
30
30
  });
31
31
  return /* @__PURE__ */ jsx("h6", {
32
32
  ...rest,
33
- className: cn("font-bold text-xs md:text-sm", lineClampClass, className),
33
+ className: cn("font-bold text-xs md:text-sm", lineClampClass),
34
34
  children
35
35
  });
36
36
  };
@@ -1,43 +1,38 @@
1
1
  import { FC, PropsWithChildren, ReactNode } from "react";
2
2
 
3
3
  //#region src/components/data-display/table/table.d.ts
4
- type RootProps = PropsWithChildren<{
5
- className?: string;
6
- containerClassName?: string;
7
- }>;
8
4
  type RowProps = PropsWithChildren<{
9
- className?: string;
10
5
  interactive?: boolean;
11
6
  }>;
12
7
  type CellAlign = 'left' | 'center' | 'right';
13
8
  type HeaderCellProps = PropsWithChildren<{
14
9
  align?: CellAlign;
15
- className?: string;
16
10
  }>;
17
11
  type CellProps = PropsWithChildren<{
18
12
  align?: CellAlign;
19
- className?: string;
20
13
  colSpan?: number;
21
14
  tone?: 'default' | 'muted';
22
15
  }>;
23
- type SectionProps = PropsWithChildren<{
24
- className?: string;
25
- }>;
26
- type CaptionProps = PropsWithChildren<{
27
- className?: string;
28
- }>;
29
16
  type EmptyStateProps = {
30
17
  colSpan: number;
31
18
  children: ReactNode;
32
19
  };
33
20
  declare const Table: {
34
- readonly Root: FC<RootProps>;
35
- readonly Head: FC<SectionProps>;
36
- readonly Body: FC<SectionProps>;
21
+ readonly Root: FC<{
22
+ children?: ReactNode | undefined;
23
+ }>;
24
+ readonly Head: FC<{
25
+ children?: ReactNode | undefined;
26
+ }>;
27
+ readonly Body: FC<{
28
+ children?: ReactNode | undefined;
29
+ }>;
37
30
  readonly Row: FC<RowProps>;
38
31
  readonly HeaderCell: FC<HeaderCellProps>;
39
32
  readonly Cell: FC<CellProps>;
40
- readonly Caption: FC<CaptionProps>;
33
+ readonly Caption: FC<{
34
+ children?: ReactNode | undefined;
35
+ }>;
41
36
  readonly EmptyState: FC<EmptyStateProps>;
42
37
  };
43
38
  //#endregion
@@ -1,45 +1,47 @@
1
1
  import { cn } from "../../../helpers/cn.mjs";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  //#region src/components/data-display/table/table.tsx
4
- const Root = ({ children, className, containerClassName }) => /* @__PURE__ */ jsx("div", {
5
- className: cn("w-full overflow-x-auto rounded-lg border border-border-mute bg-bg-base", containerClassName),
4
+ const Root = ({ children }) => /* @__PURE__ */ jsx("div", {
5
+ className: "border-border-mute bg-bg-base vertical:writing-sideways-rl vertical:h-fit vertical:w-fit w-full overflow-x-auto rounded-lg border",
6
6
  children: /* @__PURE__ */ jsx("table", {
7
- className: cn("min-w-full border-collapse text-left text-sm", className),
7
+ className: "min-w-full border-collapse text-left text-sm",
8
8
  children
9
9
  })
10
10
  });
11
- const Head = ({ children, className }) => /* @__PURE__ */ jsx("thead", {
12
- className: cn("bg-bg-subtle", className),
11
+ const Head = ({ children }) => /* @__PURE__ */ jsx("thead", {
12
+ className: "bg-bg-subtle",
13
13
  children
14
14
  });
15
- const Body = ({ children, className }) => /* @__PURE__ */ jsx("tbody", {
16
- className: cn("[&_tr:last-child]:border-b-0", className),
15
+ const Body = ({ children }) => /* @__PURE__ */ jsx("tbody", {
16
+ className: "vertical:[&_tr:last-child]:border-l-0 [&_tr:last-child]:border-b-0",
17
17
  children
18
18
  });
19
- const Row = ({ children, className, interactive = false }) => /* @__PURE__ */ jsx("tr", {
20
- className: cn("border-border-mute border-b transition-colors", interactive && "hover:bg-bg-mute", className),
19
+ const Row = ({ children, interactive = false }) => /* @__PURE__ */ jsx("tr", {
20
+ className: cn("border-border-mute border-b transition-colors vertical:border-b-0 vertical:border-l", interactive && "hover:bg-bg-mute"),
21
21
  children
22
22
  });
23
- const HeaderCell = ({ align = "left", children, className }) => /* @__PURE__ */ jsx("th", {
24
- className: cn("px-4 py-3 font-medium text-fg-base", align === "center" && "text-center", align === "right" && "text-right", className),
23
+ const HeaderCell = ({ align = "left", children }) => /* @__PURE__ */ jsx("th", {
24
+ className: cn("px-4 py-3 font-medium text-fg-base", align === "center" && "text-center", align === "right" && "text-right"),
25
25
  scope: "col",
26
26
  children
27
27
  });
28
- const Cell = ({ align = "left", children, className, colSpan, tone = "default" }) => /* @__PURE__ */ jsx("td", {
29
- className: cn("px-4 py-3 align-middle", tone === "muted" ? "text-fg-mute" : "text-fg-base", align === "center" && "text-center", align === "right" && "text-right", className),
28
+ const Cell = ({ align = "left", children, colSpan, tone = "default" }) => /* @__PURE__ */ jsx("td", {
29
+ className: cn("px-4 py-3 align-middle", tone === "muted" ? "text-fg-mute" : "text-fg-base", align === "center" && "text-center", align === "right" && "text-right"),
30
30
  colSpan,
31
31
  children
32
32
  });
33
- const Caption = ({ children, className }) => /* @__PURE__ */ jsx("caption", {
34
- className: cn("caption-bottom px-4 py-3 text-fg-mute text-sm", className),
33
+ const Caption = ({ children }) => /* @__PURE__ */ jsx("caption", {
34
+ className: "text-fg-mute caption-bottom px-4 py-3 text-sm",
35
35
  children
36
36
  });
37
- const EmptyState = ({ children, colSpan }) => /* @__PURE__ */ jsx(Row, { children: /* @__PURE__ */ jsx(Cell, {
38
- align: "center",
39
- className: "text-fg-mute py-10",
40
- colSpan,
41
- children
42
- }) });
37
+ const EmptyState = ({ children, colSpan }) => /* @__PURE__ */ jsx("tr", {
38
+ className: "border-border-mute border-b transition-colors",
39
+ children: /* @__PURE__ */ jsx("td", {
40
+ className: "text-fg-mute px-4 py-10 text-center align-middle",
41
+ colSpan,
42
+ children
43
+ })
44
+ });
43
45
  const Table = {
44
46
  Root,
45
47
  Head,
@@ -3,9 +3,9 @@ import { FC, HTMLAttributes } from "react";
3
3
 
4
4
  //#region src/components/feedback/alert/alert.d.ts
5
5
  type Props = {
6
- status: Status;
6
+ tone: Status;
7
7
  message: string | string[];
8
- } & Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'role'>;
8
+ } & Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'role' | 'className' | 'style'>;
9
9
  declare const Alert: FC<Props>;
10
10
  //#endregion
11
11
  export { Alert };
@@ -8,18 +8,18 @@ const STATUS_LABEL = {
8
8
  warning: "警告",
9
9
  error: "エラー"
10
10
  };
11
- const Alert = ({ status, message, className, ...rest }) => /* @__PURE__ */ jsxs("div", {
11
+ const Alert = ({ tone, message, ...rest }) => /* @__PURE__ */ jsxs("div", {
12
12
  ...rest,
13
- className: cn("flex items-center gap-3 rounded-lg p-4", status === "success" && "bg-bg-success", status === "info" && "bg-bg-info", status === "warning" && "bg-bg-warning", status === "error" && "bg-bg-error", className),
14
- role: status === "error" || status === "warning" ? "alert" : "status",
13
+ className: cn("flex items-center gap-3 rounded-lg p-4", tone === "success" && "bg-bg-success", tone === "info" && "bg-bg-info", tone === "warning" && "bg-bg-warning", tone === "error" && "bg-bg-error"),
14
+ role: tone === "error" || tone === "warning" ? "alert" : "status",
15
15
  children: [/* @__PURE__ */ jsxs("span", {
16
- className: cn(status === "success" && "text-fg-success", status === "info" && "text-fg-info", status === "warning" && "text-fg-warning", status === "error" && "text-fg-error"),
16
+ className: cn(tone === "success" && "text-fg-success", tone === "info" && "text-fg-info", tone === "warning" && "text-fg-warning", tone === "error" && "text-fg-error"),
17
17
  children: [/* @__PURE__ */ jsx(AlertIcon, {
18
18
  size: "md",
19
- status
19
+ status: tone
20
20
  }), /* @__PURE__ */ jsx("span", {
21
21
  className: "sr-only",
22
- children: STATUS_LABEL[status]
22
+ children: STATUS_LABEL[tone]
23
23
  })]
24
24
  }), Array.isArray(message) ? message.length > 1 ? /* @__PURE__ */ jsx("ul", {
25
25
  className: "space-y-1",
@@ -6,7 +6,7 @@ type Props = {
6
6
  maxProgress: number;
7
7
  minProgress?: number;
8
8
  label?: string;
9
- } & Omit<HTMLAttributes<HTMLDivElement>, 'children'>;
9
+ } & Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'className' | 'style'>;
10
10
  declare const Progress: FC<Props>;
11
11
  //#endregion
12
12
  export { Progress };
@@ -1,18 +1,17 @@
1
- import { cn } from "../../../helpers/cn.mjs";
2
1
  import { toPrecision } from "../../../internal/to-precision.mjs";
3
2
  import { jsx } from "react/jsx-runtime";
4
3
  //#region src/components/feedback/progress/progress.tsx
5
- const Progress = ({ progress, maxProgress, minProgress = 0, label, className, ...rest }) => /* @__PURE__ */ jsx("div", {
4
+ const Progress = ({ progress, maxProgress, minProgress = 0, label, ...rest }) => /* @__PURE__ */ jsx("div", {
6
5
  ...rest,
7
- className: cn("bg-bg-emphasize w-full rounded-full", className),
6
+ className: "bg-bg-emphasize vertical:inline-48 rounded-full block-4 inline-full",
7
+ style: { "--progress-fill": `${(progress / maxProgress * 100).toString()}%` },
8
8
  children: /* @__PURE__ */ jsx("div", {
9
9
  "aria-label": label ?? `${toPrecision(progress / maxProgress).toString()}%`,
10
10
  "aria-valuemax": maxProgress,
11
11
  "aria-valuemin": minProgress,
12
12
  "aria-valuenow": progress,
13
- className: "bg-primary-bg h-4 rounded-full transition-all",
14
- role: "progressbar",
15
- style: { width: `${(progress / maxProgress * 100).toString()}%` }
13
+ className: "bg-primary-bg rounded-full transition-all block-full inline-(--progress-fill)",
14
+ role: "progressbar"
16
15
  })
17
16
  });
18
17
  //#endregion
@@ -5,7 +5,7 @@ type Props = {
5
5
  animate?: boolean;
6
6
  shape?: 'rect' | 'circle';
7
7
  size?: 'sm' | 'md' | 'lg';
8
- } & Omit<HTMLAttributes<HTMLDivElement>, 'children'>;
8
+ } & Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'className' | 'style'>;
9
9
  declare const Skeleton: FC<Props>;
10
10
  //#endregion
11
11
  export { Skeleton };
@@ -1,10 +1,10 @@
1
1
  import { cn } from "../../../helpers/cn.mjs";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  //#region src/components/feedback/skeleton/skeleton.tsx
4
- const Skeleton = ({ animate = true, shape = "rect", size = "md", className, ...rest }) => /* @__PURE__ */ jsx("div", {
4
+ const Skeleton = ({ animate = true, shape = "rect", size = "md", ...rest }) => /* @__PURE__ */ jsx("div", {
5
5
  ...rest,
6
6
  "aria-hidden": true,
7
- className: cn("bg-bg-mute", animate && "animate-pulse", shape === "rect" && "rounded-lg", shape === "rect" && size === "sm" && "h-3 w-24", shape === "rect" && size === "md" && "h-4 w-40", shape === "rect" && size === "lg" && "h-5 w-56", shape === "circle" && "rounded-full", shape === "circle" && size === "sm" && "size-8", shape === "circle" && size === "md" && "size-12", shape === "circle" && size === "lg" && "size-16", className)
7
+ className: cn("bg-bg-mute", animate && "animate-pulse", shape === "rect" && "rounded-lg", shape === "rect" && size === "sm" && "h-3 w-24", shape === "rect" && size === "md" && "h-4 w-40", shape === "rect" && size === "lg" && "h-5 w-56", shape === "circle" && "rounded-full", shape === "circle" && size === "sm" && "size-8", shape === "circle" && size === "md" && "size-12", shape === "circle" && size === "lg" && "size-16")
8
8
  });
9
9
  //#endregion
10
10
  export { Skeleton };
@@ -4,7 +4,7 @@ import { FC, OutputHTMLAttributes } from "react";
4
4
  type Props = {
5
5
  label?: string;
6
6
  size?: 'sm' | 'md' | 'lg';
7
- } & Omit<OutputHTMLAttributes<HTMLOutputElement>, 'children' | 'aria-label'>;
7
+ } & Omit<OutputHTMLAttributes<HTMLOutputElement>, 'children' | 'aria-label' | 'className' | 'style'>;
8
8
  declare const Spinner: FC<Props>;
9
9
  //#endregion
10
10
  export { Spinner };
@@ -1,11 +1,11 @@
1
1
  import { cn } from "../../../helpers/cn.mjs";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  //#region src/components/feedback/spinner/spinner.tsx
4
- const Spinner = ({ label = "Loading", size = "md", className, ...rest }) => /* @__PURE__ */ jsxs("output", {
4
+ const Spinner = ({ label = "Loading", size = "md", ...rest }) => /* @__PURE__ */ jsxs("output", {
5
5
  ...rest,
6
6
  "aria-label": label,
7
7
  "aria-live": "polite",
8
- className: cn("inline-flex items-center justify-center", className),
8
+ className: "inline-flex items-center justify-center",
9
9
  children: [/* @__PURE__ */ jsx("span", {
10
10
  "aria-hidden": true,
11
11
  className: cn("inline-block animate-spin rounded-full border-4 border-border-base border-t-primary-border", size === "sm" && "size-4", size === "md" && "size-6", size === "lg" && "size-8")
@@ -1,16 +1,15 @@
1
1
  import { Status } from "../../../types/variables.mjs";
2
- import * as _$react from "react";
3
2
  import { Dispatch, SetStateAction } from "react";
4
3
 
5
4
  //#region src/components/feedback/toast/context.d.ts
6
5
  type ToastType = {
7
6
  id: string;
8
- status: Status;
7
+ tone: Status;
9
8
  message: string;
10
9
  };
11
- declare const SetToastContext: _$react.Context<Dispatch<SetStateAction<ToastType[]>> | null>, useSetToast: () => Dispatch<SetStateAction<ToastType[]>>;
10
+ declare const SetToastContext: import("react").Context<Dispatch<SetStateAction<ToastType[]>> | null>, useSetToast: () => Dispatch<SetStateAction<ToastType[]>>;
12
11
  declare const useToast: () => {
13
- onOpen: (status: Status, message: string) => void;
12
+ onOpen: (tone: Status, message: string) => void;
14
13
  onClose: (id: string) => void;
15
14
  onCloseAll: () => void;
16
15
  };
@@ -2,18 +2,17 @@
2
2
  import { createSafeContext } from "../../../helpers/create-safe-context.mjs";
3
3
  import { useCallback } from "react";
4
4
  //#region src/components/feedback/toast/context.ts
5
- const MAX_TOAST_COUNT = 5;
6
5
  const [SetToastContext, useSetToast] = createSafeContext("useToast must be used within a ToastProvider");
7
6
  const useToast = () => {
8
7
  const setToasts = useSetToast();
9
8
  return {
10
- onOpen: useCallback((status, message) => {
9
+ onOpen: useCallback((tone, message) => {
11
10
  setToasts((prev) => {
12
11
  return [...prev, {
13
12
  id: crypto.randomUUID(),
14
- status,
13
+ tone,
15
14
  message
16
- }].slice(-MAX_TOAST_COUNT);
15
+ }].slice(-5);
17
16
  });
18
17
  }, [setToasts]),
19
18
  onClose: useCallback((id) => {
@@ -54,7 +54,7 @@ const ToastProvider = ({ children, portalRef = null, position = "fixed" }) => {
54
54
  children: [children, container ? createPortal(/* @__PURE__ */ jsx("section", {
55
55
  "aria-label": "通知",
56
56
  "aria-live": "polite",
57
- className: cn("absolute bottom-3 z-50 flex w-full flex-col items-center justify-center gap-4", position === "fixed" && "fixed", position === "absolute" && "absolute"),
57
+ className: cn("absolute bottom-3 z-toast flex w-full flex-col items-center justify-center gap-4", position === "fixed" && "fixed", position === "absolute" && "absolute"),
58
58
  children: /* @__PURE__ */ jsx(AnimatePresence, {
59
59
  initial: false,
60
60
  children: toasts.map((toast) => /* @__PURE__ */ jsx(motion$1.div, {
@@ -67,7 +67,7 @@ const ToastProvider = ({ children, portalRef = null, position = "fixed" }) => {
67
67
  children: /* @__PURE__ */ jsx("div", {
68
68
  "aria-atomic": true,
69
69
  className: "shadow-lg",
70
- role: toast.status === "error" || toast.status === "warning" ? "alert" : "status",
70
+ role: toast.tone === "error" || toast.tone === "warning" ? "alert" : "status",
71
71
  children: /* @__PURE__ */ jsx(Toast, { ...toast })
72
72
  })
73
73
  }, toast.id))
@@ -4,7 +4,7 @@ import { FC } from "react";
4
4
  //#region src/components/feedback/toast/toast.d.ts
5
5
  type ToastProps = {
6
6
  id: string;
7
- status: Status;
7
+ tone: Status;
8
8
  message: string;
9
9
  };
10
10
  declare const Toast: FC<ToastProps>;
@@ -6,14 +6,14 @@ import { useCallback } from "react";
6
6
  import { jsx } from "react/jsx-runtime";
7
7
  //#region src/components/feedback/toast/toast.tsx
8
8
  const DELAY_MS = 5e3;
9
- const Toast = ({ id, status, message }) => {
9
+ const Toast = ({ id, tone, message }) => {
10
10
  const { onClose } = useToast();
11
11
  useTimeout(useCallback(() => {
12
12
  onClose(id);
13
13
  }, [id, onClose]), DELAY_MS);
14
14
  return /* @__PURE__ */ jsx(Alert, {
15
15
  message,
16
- status
16
+ tone
17
17
  });
18
18
  };
19
19
  //#endregion
@@ -6,7 +6,7 @@ type BaseProps = {
6
6
  id: string;
7
7
  invalid?: boolean;
8
8
  options: readonly Option[];
9
- } & Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'role' | 'className' | 'value' | 'onChange' | 'defaultValue' | 'children' | 'id' | 'autoComplete' | 'aria-autocomplete' | 'aria-controls' | 'aria-expanded'>;
9
+ } & Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'role' | 'className' | 'style' | 'value' | 'onChange' | 'defaultValue' | 'children' | 'id' | 'autoComplete' | 'aria-autocomplete' | 'aria-controls' | 'aria-expanded'>;
10
10
  type ControlledProps = {
11
11
  value: string[];
12
12
  onChange: (value: string[]) => void;
@@ -1,4 +1,5 @@
1
1
  "use client";
2
+ import { FOCUS_RING_WITHIN } from "../../_internal/focus-ring.mjs";
2
3
  import { cn } from "../../../helpers/cn.mjs";
3
4
  import { useDisclosure } from "../../../hooks/disclosure/index.mjs";
4
5
  import { CloseIcon } from "../../icons/lucide.mjs";
@@ -8,6 +9,7 @@ import { useDeferredDebounce } from "../../../hooks/deferred-debounce/index.mjs"
8
9
  import { useCallback, useEffect, useRef, useState } from "react";
9
10
  import { useFormStatus } from "react-dom";
10
11
  import { jsx, jsxs } from "react/jsx-runtime";
12
+ import { autoUpdate, flip, offset, size, useFloating } from "@floating-ui/react";
11
13
  //#region src/components/form/autocomplete/autocomplete.tsx
12
14
  const Autocomplete = ({ id, name, invalid = false, disabled = false, required = false, options, value, defaultValue, onChange, ...rest }) => {
13
15
  const [currentValue, handleChange] = useControllableState({
@@ -19,6 +21,25 @@ const Autocomplete = ({ id, name, invalid = false, disabled = false, required =
19
21
  const { isOpen, open, close } = useDisclosure();
20
22
  const [text, setText] = useState("");
21
23
  const [selectIndex, setSelectIndex] = useState();
24
+ const { refs, floatingStyles } = useFloating({
25
+ strategy: "fixed",
26
+ placement: "bottom-start",
27
+ open: isOpen,
28
+ whileElementsMounted: autoUpdate,
29
+ middleware: [
30
+ offset(4),
31
+ flip({
32
+ fallbackAxisSideDirection: "end",
33
+ padding: 8
34
+ }),
35
+ size({ apply: ({ rects, elements }) => {
36
+ const referenceEl = elements.reference instanceof HTMLElement ? elements.reference : null;
37
+ const isVertical = referenceEl !== null && getComputedStyle(referenceEl).writingMode.startsWith("vertical");
38
+ Object.assign(elements.floating.style, { inlineSize: `${isVertical ? rects.reference.height : rects.reference.width}px` });
39
+ } })
40
+ ],
41
+ transform: false
42
+ });
22
43
  const [deferredText, isPending] = useDeferredDebounce(text);
23
44
  const filteredOptions = options.filter((option) => option.label.includes(deferredText));
24
45
  const { pending: formPending } = useFormStatus();
@@ -38,9 +59,13 @@ const Autocomplete = ({ id, name, invalid = false, disabled = false, required =
38
59
  document.removeEventListener("click", handleClick);
39
60
  };
40
61
  }, [reset]);
62
+ const setReferenceRef = (node) => {
63
+ ref.current = node;
64
+ refs.setReference(node);
65
+ };
41
66
  return /* @__PURE__ */ jsxs("div", {
42
- className: cn("relative w-full rounded-xl border border-border-base bg-bg-base", "focus-within:border-transparent focus-within:outline-hidden focus-within:ring-2 focus-within:ring-border-info", "has-aria-invalid:border-border-error", "has-disabled:cursor-not-allowed has-disabled:border-border-mute has-disabled:bg-bg-mute hover:has-disabled:has-hover:bg-bg-mute"),
43
- ref,
67
+ className: cn("relative rounded-xl border border-border-base bg-bg-base inline-full", FOCUS_RING_WITHIN, "has-aria-invalid:border-border-error", "has-disabled:cursor-not-allowed has-disabled:border-border-mute has-disabled:bg-bg-mute hover:has-disabled:has-hover:bg-bg-mute"),
68
+ ref: setReferenceRef,
44
69
  children: [
45
70
  name !== void 0 && name !== "" ? currentValue.map((selectedValue) => /* @__PURE__ */ jsx("input", {
46
71
  name,
@@ -148,43 +173,46 @@ const Autocomplete = ({ id, name, invalid = false, disabled = false, required =
148
173
  children: /* @__PURE__ */ jsx(CloseIcon, { size: "sm" })
149
174
  })]
150
175
  }),
151
- /* @__PURE__ */ jsx("div", {
152
- className: "relative w-full",
153
- children: isOpen && /* @__PURE__ */ jsx("div", {
154
- className: "bg-bg-raised absolute top-1 z-10 w-full rounded-xl shadow-md",
155
- role: "presentation",
156
- children: /* @__PURE__ */ jsxs("ul", {
157
- "aria-busy": isPending || void 0,
158
- className: cn("max-h-96 py-2 transition-opacity", isPending && "opacity-60"),
159
- id: `${id}_listbox`,
160
- children: [filteredOptions.length === 0 && /* @__PURE__ */ jsx("li", {
161
- className: "text-fg-mute px-3 py-2",
162
- children: "該当なし"
163
- }), filteredOptions.map((option, idx) => {
164
- const selected = currentValue.includes(option.value);
165
- return /* @__PURE__ */ jsx("li", {
166
- className: cn("cursor-pointer px-3 py-2 transition-colors", selected && "bg-primary-bg-subtle text-primary-fg", selectIndex === idx && !selected && "bg-bg-subtle", selectIndex === idx && selected && "bg-primary-bg-mute text-primary-fg"),
167
- id: `${id}_option_${option.value}`,
168
- onClick: (e) => {
169
- e.stopPropagation();
170
- reset();
171
- if (selected) {
172
- handleChange(currentValue.filter((v) => v !== option.value));
173
- return;
174
- }
175
- handleChange([...currentValue, option.value]);
176
- },
177
- onKeyDown: (e) => {
178
- e.preventDefault();
179
- },
180
- onMouseEnter: () => {
181
- setSelectIndex(idx);
182
- },
183
- tabIndex: -1,
184
- children: option.label
185
- }, option.value);
186
- })]
187
- })
176
+ isOpen && /* @__PURE__ */ jsx("div", {
177
+ className: "bg-bg-raised z-10 rounded-xl shadow-md",
178
+ ref: refs.setFloating,
179
+ role: "presentation",
180
+ style: floatingStyles,
181
+ children: /* @__PURE__ */ jsxs("ul", {
182
+ "aria-busy": isPending || void 0,
183
+ className: cn("max-h-96 py-2 transition-opacity vertical:max-h-none vertical:max-w-96", isPending && "opacity-60"),
184
+ id: `${id}_listbox`,
185
+ role: "listbox",
186
+ children: [filteredOptions.length === 0 && /* @__PURE__ */ jsx("li", {
187
+ className: "text-fg-mute px-3 py-2",
188
+ role: "presentation",
189
+ children: "該当なし"
190
+ }), filteredOptions.map((option, idx) => {
191
+ const selected = currentValue.includes(option.value);
192
+ return /* @__PURE__ */ jsx("li", {
193
+ "aria-selected": selected,
194
+ className: cn("cursor-pointer px-3 py-2 transition-colors", selected && "bg-primary-bg-subtle text-primary-fg", selectIndex === idx && !selected && "bg-bg-subtle", selectIndex === idx && selected && "bg-primary-bg-mute text-primary-fg"),
195
+ id: `${id}_option_${option.value}`,
196
+ role: "option",
197
+ onClick: (e) => {
198
+ e.stopPropagation();
199
+ reset();
200
+ if (selected) {
201
+ handleChange(currentValue.filter((v) => v !== option.value));
202
+ return;
203
+ }
204
+ handleChange([...currentValue, option.value]);
205
+ },
206
+ onKeyDown: (e) => {
207
+ e.preventDefault();
208
+ },
209
+ onMouseEnter: () => {
210
+ setSelectIndex(idx);
211
+ },
212
+ tabIndex: -1,
213
+ children: option.label
214
+ }, option.value);
215
+ })]
188
216
  })
189
217
  })
190
218
  ]