@k8o/arte-odyssey 1.4.2 → 2.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 (72) hide show
  1. package/dist/components/accordion/accordion-button.js +8 -7
  2. package/dist/components/accordion/accordion-item.js +1 -1
  3. package/dist/components/accordion/accordion-panel.js +1 -1
  4. package/dist/components/accordion/accordion.js +1 -11
  5. package/dist/components/alert/alert.js +3 -4
  6. package/dist/components/alert/alert.stories.js +6 -2
  7. package/dist/components/anchor/anchor.js +3 -2
  8. package/dist/components/baseline-status/baseline-status.js +2 -2
  9. package/dist/components/breadcrumb/breadcrumb.js +9 -2
  10. package/dist/components/button/button.js +6 -6
  11. package/dist/components/card/card.js +3 -3
  12. package/dist/components/card/card.stories.js +20 -18
  13. package/dist/components/card/interactive-card.js +4 -12
  14. package/dist/components/dialog/dialog.js +1 -1
  15. package/dist/components/drawer/drawer.stories.js +6 -6
  16. package/dist/components/dropdown-menu/dropdown-menu.js +4 -4
  17. package/dist/components/dropdown-menu/dropdown-menu.stories.js +16 -16
  18. package/dist/components/form/autocomplete/autocomplete.d.ts +11 -3
  19. package/dist/components/form/autocomplete/autocomplete.js +6 -6
  20. package/dist/components/form/autocomplete/autocomplete.stories.js +6 -2
  21. package/dist/components/form/checkbox/checkbox.d.ts +10 -2
  22. package/dist/components/form/checkbox/checkbox.js +16 -6
  23. package/dist/components/form/file-field/file-field.js +3 -3
  24. package/dist/components/form/number-field/number-field.d.ts +12 -4
  25. package/dist/components/form/number-field/number-field.js +21 -13
  26. package/dist/components/form/number-field/number-field.stories.js +2 -7
  27. package/dist/components/form/radio/radio.d.ts +12 -3
  28. package/dist/components/form/radio/radio.js +4 -2
  29. package/dist/components/form/radio/radio.stories.js +14 -39
  30. package/dist/components/form/range-field/range-field.d.ts +13 -5
  31. package/dist/components/form/range-field/range-field.js +19 -9
  32. package/dist/components/form/range-field/range-field.stories.js +11 -104
  33. package/dist/components/form/select/select.d.ts +10 -2
  34. package/dist/components/form/select/select.js +2 -2
  35. package/dist/components/form/select/select.stories.js +1 -4
  36. package/dist/components/form/text-field/text-field.d.ts +10 -2
  37. package/dist/components/form/text-field/text-field.js +1 -1
  38. package/dist/components/form/text-field/text-field.stories.js +1 -5
  39. package/dist/components/form/textarea/textarea.d.ts +10 -2
  40. package/dist/components/form/textarea/textarea.js +1 -1
  41. package/dist/components/form/textarea/textarea.stories.js +1 -5
  42. package/dist/components/icon-button/icon-button.js +3 -3
  43. package/dist/components/icon-button/icon-button.stories.js +1 -4
  44. package/dist/components/icon-link/icon-link.d.ts +1 -1
  45. package/dist/components/icon-link/icon-link.js +3 -2
  46. package/dist/components/icon-link/icon-link.stories.js +7 -1
  47. package/dist/components/icons/icons.stories.js +0 -5
  48. package/dist/components/icons/index.d.ts +0 -1
  49. package/dist/components/icons/index.js +0 -1
  50. package/dist/components/link-button/link-button.d.ts +2 -1
  51. package/dist/components/link-button/link-button.js +9 -6
  52. package/dist/components/link-button/link-button.stories.js +21 -2
  53. package/dist/components/list-box/list-box.js +6 -8
  54. package/dist/components/list-box/list-box.stories.js +10 -19
  55. package/dist/components/modal/modal.js +1 -1
  56. package/dist/components/modal/modal.stories.js +2 -2
  57. package/dist/components/popover/popover.stories.js +3 -3
  58. package/dist/components/progress/progress.js +2 -2
  59. package/dist/components/scroll-linked/scroll-linked.js +1 -1
  60. package/dist/components/scroll-linked/scroll-linked.stories.js +7 -7
  61. package/dist/components/separator/separator.d.ts +1 -0
  62. package/dist/components/separator/separator.js +21 -12
  63. package/dist/components/separator/separator.stories.js +12 -0
  64. package/dist/components/tabs/tabs.js +3 -3
  65. package/dist/components/tabs/tabs.stories.js +33 -26
  66. package/dist/components/text-tag/text-tag.js +1 -1
  67. package/dist/components/tooltip/tooltip.js +1 -1
  68. package/dist/components/tooltip/tooltip.stories.js +3 -3
  69. package/dist/styles/index.css +0 -3
  70. package/package.json +20 -20
  71. package/dist/components/icons/zenn.d.ts +0 -6
  72. package/dist/components/icons/zenn.js +0 -41
@@ -1,6 +1,5 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import * as motion from "motion/react-client";
4
3
  import { cn } from "./../../helpers/cn";
5
4
  import { ChevronIcon } from "../icons";
6
5
  import { useItemId, useOpen, useToggleOpen } from "./context";
@@ -14,9 +13,9 @@ const AccordionButton = ({ children }) => {
14
13
  "aria-controls": `${id}-panel`,
15
14
  "aria-expanded": open,
16
15
  className: cn(
17
- "flex w-full flex-row items-center justify-between rounded-md p-2",
18
- "hover:bg-bg-mute",
19
- "focus-visible::first:bordertransparent focus-visible:bg-bg-mute focus-visible::first:outline-none focus-visible::first:ring-2 focus-visible::first:ring-border-info"
16
+ "flex w-full cursor-pointer items-center justify-between rounded-md py-4 text-fg-base",
17
+ "hover:text-primary-fg",
18
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-info"
20
19
  ),
21
20
  id: `${id}-button`,
22
21
  onClick: toggleOpen,
@@ -24,10 +23,12 @@ const AccordionButton = ({ children }) => {
24
23
  children: [
25
24
  children,
26
25
  /* @__PURE__ */ jsx(
27
- motion.span,
26
+ "span",
28
27
  {
29
- animate: open ? { rotate: 180 } : { rotate: 0 },
30
- transition: { duration: 0.3 },
28
+ className: cn(
29
+ "transition-transform duration-150",
30
+ open && "rotate-180"
31
+ ),
31
32
  children: /* @__PURE__ */ jsx(ChevronIcon, { direction: "down" })
32
33
  }
33
34
  )
@@ -4,7 +4,7 @@ import { useId } from "react";
4
4
  import { AccordionItemProvider } from "./context";
5
5
  const AccordionItem = ({ children, defaultOpen = false }) => {
6
6
  const id = useId();
7
- return /* @__PURE__ */ jsx(AccordionItemProvider, { defaultOpen, id, children: /* @__PURE__ */ jsx("div", { className: "border-border-mute border-t last:border-b", children }) });
7
+ return /* @__PURE__ */ jsx(AccordionItemProvider, { defaultOpen, id, children: /* @__PURE__ */ jsx("div", { children }) });
8
8
  };
9
9
  export {
10
10
  AccordionItem
@@ -9,7 +9,7 @@ const AccordionPanel = ({ children }) => {
9
9
  "section",
10
10
  {
11
11
  "aria-labelledby": `${id}-button`,
12
- className: cn({ hidden: !open }, "p-2"),
12
+ className: cn({ hidden: !open }, "pb-4"),
13
13
  hidden: !open,
14
14
  id: `${id}-panel`,
15
15
  children
@@ -1,16 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { cn } from "./../../helpers/cn";
3
2
  const Accordion = ({ children }) => {
4
- return /* @__PURE__ */ jsx(
5
- "div",
6
- {
7
- className: cn(
8
- "rounded-md border-2 border-border-mute bg-bg-base p-2",
9
- "focus-within:bordertransparent focus-within:outline-hidden focus-within:ring-2 focus-within:ring-border-info"
10
- ),
11
- children
12
- }
13
- );
3
+ return /* @__PURE__ */ jsx("div", { className: "divide-y divide-border-mute", children });
14
4
  };
15
5
  export {
16
6
  Accordion
@@ -12,7 +12,7 @@ const Alert = ({ status, message }) => {
12
12
  "div",
13
13
  {
14
14
  className: cn(
15
- "flex items-center gap-2 rounded-md p-4",
15
+ "flex items-center gap-3 rounded-lg p-4",
16
16
  status === "success" && "bg-bg-success",
17
17
  status === "info" && "bg-bg-info",
18
18
  status === "warning" && "bg-bg-warning",
@@ -24,19 +24,18 @@ const Alert = ({ status, message }) => {
24
24
  "span",
25
25
  {
26
26
  className: cn(
27
- "size-8",
28
27
  status === "success" && "text-fg-success",
29
28
  status === "info" && "text-fg-info",
30
29
  status === "warning" && "text-fg-warning",
31
30
  status === "error" && "text-fg-error"
32
31
  ),
33
32
  children: [
34
- /* @__PURE__ */ jsx(AlertIcon, { size: "lg", status }),
33
+ /* @__PURE__ */ jsx(AlertIcon, { size: "md", status }),
35
34
  /* @__PURE__ */ jsx("span", { className: "sr-only", children: STATUS_LABEL[status] })
36
35
  ]
37
36
  }
38
37
  ),
39
- Array.isArray(message) ? message.length > 1 ? /* @__PURE__ */ jsx("ul", { className: "ml-4 list-disc", children: message.map((msg) => /* @__PURE__ */ jsx("li", { className: "text-lg", children: msg }, msg)) }) : /* @__PURE__ */ jsx("p", { className: "font-bold text-lg", children: message[0] }) : /* @__PURE__ */ jsx("p", { className: "font-bold text-lg", children: message })
38
+ Array.isArray(message) ? message.length > 1 ? /* @__PURE__ */ jsx("ul", { className: "space-y-1", children: message.map((msg) => /* @__PURE__ */ jsx("li", { children: msg }, msg)) }) : /* @__PURE__ */ jsx("p", { className: "font-bold", children: message[0] }) : /* @__PURE__ */ jsx("p", { className: "font-bold", children: message })
40
39
  ]
41
40
  }
42
41
  );
@@ -30,8 +30,12 @@ const Error = {
30
30
  };
31
31
  const ArrayMessage = {
32
32
  args: {
33
- status: "success",
34
- message: ["Success1", "Success2", "Success3"]
33
+ status: "error",
34
+ message: [
35
+ "\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u306E\u5F62\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093",
36
+ "\u30D1\u30B9\u30EF\u30FC\u30C9\u306F8\u6587\u5B57\u4EE5\u4E0A\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",
37
+ "\u5229\u7528\u898F\u7D04\u306B\u540C\u610F\u3057\u3066\u304F\u3060\u3055\u3044"
38
+ ]
35
39
  }
36
40
  };
37
41
  const SingleArrayMessage = {
@@ -8,11 +8,12 @@ const Anchor = ({
8
8
  renderAnchor = ({ children: children2, ...props }) => /* @__PURE__ */ jsx("a", { ...props, children: children2 })
9
9
  }) => {
10
10
  const type = isInternalRoute(href) && !openInNewTab ? "internal" : "external";
11
+ const baseClassName = "text-fg-info underline transition-colors hover:text-fg-info/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-info focus-visible:rounded-sm";
11
12
  const props = type === "internal" ? {
12
- className: "text-fg-info cursor-pointer underline",
13
+ className: baseClassName,
13
14
  children
14
15
  } : {
15
- className: "text-fg-info inline-flex cursor-pointer items-center gap-0.5 underline",
16
+ className: `${baseClassName} inline-flex items-center gap-0.5`,
16
17
  target: "_blank",
17
18
  rel: "noopener noreferrer",
18
19
  children: /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -21,7 +21,7 @@ const BaselineStatus = ({ featureId }) => {
21
21
  return /* @__PURE__ */ jsx(
22
22
  "div",
23
23
  {
24
- className: "max-w-full animate-pulse rounded-md border border-border-base bg-bg-base p-4",
24
+ className: "max-w-full animate-pulse rounded-lg border border-border-base bg-bg-base p-4",
25
25
  style: { height: "120px" }
26
26
  }
27
27
  );
@@ -29,7 +29,7 @@ const BaselineStatus = ({ featureId }) => {
29
29
  return /* @__PURE__ */ jsx(
30
30
  "baseline-status",
31
31
  {
32
- className: "wrap-normal max-w-full rounded-md border border-border-base bg-bg-base p-4",
32
+ className: "wrap-normal max-w-full rounded-lg border border-border-base bg-bg-base p-4",
33
33
  featureId
34
34
  }
35
35
  );
@@ -6,7 +6,7 @@ const List = ({ children, size = "md" }) => {
6
6
  "ol",
7
7
  {
8
8
  className: cn(
9
- "flex list-none items-center gap-1 font-bold text-fg-mute",
9
+ "flex list-none items-center gap-1 text-fg-mute",
10
10
  size === "sm" && "text-xs",
11
11
  size === "md" && "text-xs md:text-md",
12
12
  size === "lg" && "text-xl md:text-2xl"
@@ -28,7 +28,14 @@ const _Link = ({
28
28
  component
29
29
  }) => {
30
30
  const Link = component ?? "a";
31
- return current ? /* @__PURE__ */ jsx("span", { className: "text-fg-base", children }) : /* @__PURE__ */ jsx(Link, { className: "text-fg-mute underline hover:text-fg-base", href, children });
31
+ return current ? /* @__PURE__ */ jsx("span", { className: "text-fg-base", children }) : /* @__PURE__ */ jsx(
32
+ Link,
33
+ {
34
+ className: "underline transition-colors hover:text-fg-base focus-visible:rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-info",
35
+ href,
36
+ children
37
+ }
38
+ );
32
39
  };
33
40
  const Breadcrumb = {
34
41
  List,
@@ -18,15 +18,15 @@ const Button = ({
18
18
  "button",
19
19
  {
20
20
  className: cn(
21
- "cursor-pointer rounded-lg text-center font-bold",
21
+ "cursor-pointer rounded-lg border-2 text-center font-bold transition-colors",
22
22
  {
23
- "bg-primary-bg text-fg hover:bg-primary-bg/90 active:bg-primary-bg/80": variant === "contained" && color === "primary",
24
- "bg-bg-subtle text-fg-base hover:bg-bg-mute active:bg-bg-emphasize": variant === "contained" && color === "gray",
23
+ "border-transparent bg-primary-bg text-fg hover:bg-primary-bg/90 active:bg-primary-bg/80": variant === "contained" && color === "primary",
24
+ "border-transparent bg-bg-subtle text-fg-base hover:bg-bg-mute active:bg-bg-emphasize": variant === "contained" && color === "gray",
25
25
  "cursor-not-allowed opacity-35 hover:bg-primary-bg active:bg-primary-bg": disabled && variant === "contained",
26
- "border-2 border-primary-border bg-bg-base text-primary-fg hover:bg-bg-subtle active:bg-bg-emphasize": variant === "outlined" && color === "primary",
27
- "border-2 border-border-base bg-bg-base text-fg-base hover:bg-bg-subtle active:bg-bg-emphasize": variant === "outlined" && color === "gray",
26
+ "border-primary-border bg-bg-base text-primary-fg hover:bg-bg-subtle active:bg-bg-emphasize": variant === "outlined" && color === "primary",
27
+ "border-border-base bg-bg-base text-fg-base hover:bg-bg-subtle active:bg-bg-emphasize": variant === "outlined" && color === "gray",
28
28
  "cursor-not-allowed bg-bg-base opacity-35 hover:bg-bg-base active:bg-bg-base": disabled && variant === "outlined",
29
- "bg-transparent text-fg-mute hover:text-fg-base active:text-fg-base": variant === "skeleton",
29
+ "border-transparent bg-transparent text-fg-mute hover:text-fg-base active:text-fg-base": variant === "skeleton",
30
30
  "cursor-not-allowed bg-transparent text-fg-mute opacity-35 hover:text-fg-mute active:text-fg-mute": disabled && variant === "skeleton"
31
31
  },
32
32
  "focus-visible:border-transparent focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-border-info",
@@ -9,14 +9,14 @@ const Card = ({
9
9
  "section",
10
10
  {
11
11
  className: cn(
12
- "rounded-lg bg-bg-base/90 shadow-md",
12
+ "overflow-hidden rounded-lg border border-border-mute",
13
13
  width === "full" && "w-full",
14
14
  width === "fit" && "w-fit",
15
- variant === "primary" && "bg-bg-base/90",
15
+ variant === "primary" && "bg-bg-base",
16
16
  variant === "secondary" && "bg-bg-mute"
17
17
  ),
18
18
  children: [
19
- title && /* @__PURE__ */ jsx("div", { className: "flex justify-center rounded-t-lg bg-linear-60 from-primary-bg-mute to-secondary-bg-mute p-4", children: /* @__PURE__ */ jsx("p", { className: "font-bold text-xl", children: title }) }),
19
+ title && /* @__PURE__ */ jsx("div", { className: "border-border-mute border-b bg-primary-bg/10 px-4 py-3", children: /* @__PURE__ */ jsx("p", { className: "font-bold", children: title }) }),
20
20
  children
21
21
  ]
22
22
  }
@@ -1,4 +1,4 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Card } from "./card";
3
3
  import { InteractiveCard } from "./interactive-card";
4
4
  const meta = {
@@ -7,32 +7,34 @@ const meta = {
7
7
  };
8
8
  var card_stories_default = meta;
9
9
  const Primary = {
10
- args: {
11
- children: "card"
12
- }
10
+ render: () => /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs("div", { className: "p-4", children: [
11
+ /* @__PURE__ */ jsx("h3", { className: "font-bold text-lg", children: "\u8A18\u4E8B\u30BF\u30A4\u30C8\u30EB" }),
12
+ /* @__PURE__ */ jsx("p", { className: "mt-2 text-fg-mute", children: "\u3053\u308C\u306F\u30AB\u30FC\u30C9\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306E\u8AAC\u660E\u6587\u3067\u3059\u3002\u30B3\u30F3\u30C6\u30F3\u30C4\u3092\u56F2\u3093\u3067\u8996\u899A\u7684\u306B\u30B0\u30EB\u30FC\u30D7\u5316\u3057\u307E\u3059\u3002" })
13
+ ] }) })
13
14
  };
14
- const Title = {
15
- args: {
16
- children: "card",
17
- title: "title"
18
- }
15
+ const WithTitle = {
16
+ render: () => /* @__PURE__ */ jsx(Card, { title: "\u304A\u77E5\u3089\u305B", children: /* @__PURE__ */ jsxs("div", { className: "p-4", children: [
17
+ /* @__PURE__ */ jsx("p", { children: "\u30B7\u30B9\u30C6\u30E0\u30E1\u30F3\u30C6\u30CA\u30F3\u30B9\u306E\u304A\u77E5\u3089\u305B\u3067\u3059\u3002" }),
18
+ /* @__PURE__ */ jsx("p", { className: "mt-2 text-fg-mute text-sm", children: "2024\u5E741\u670820\u65E5 10:00\u301C12:00" })
19
+ ] }) })
19
20
  };
20
21
  const Secondary = {
21
- args: {
22
- children: "card",
23
- variant: "secondary"
24
- }
22
+ render: () => /* @__PURE__ */ jsx(Card, { variant: "secondary", children: /* @__PURE__ */ jsx("div", { className: "p-4", children: /* @__PURE__ */ jsx("p", { className: "text-fg-mute", children: "\u30BB\u30AB\u30F3\u30C0\u30EA\u30D0\u30EA\u30A8\u30FC\u30B7\u30E7\u30F3\u306F\u80CC\u666F\u8272\u304C\u5C11\u3057\u6697\u304F\u306A\u308A\u307E\u3059\u3002" }) }) })
25
23
  };
26
24
  const Interactive = {
27
- args: {
28
- children: "card"
29
- },
30
- render: (props) => /* @__PURE__ */ jsx(InteractiveCard, { ...props })
25
+ render: () => /* @__PURE__ */ jsx(InteractiveCard, { children: /* @__PURE__ */ jsxs("div", { className: "p-4", children: [
26
+ /* @__PURE__ */ jsx("h3", { className: "font-bold", children: "\u30AF\u30EA\u30C3\u30AF\u53EF\u80FD\u306A\u30AB\u30FC\u30C9" }),
27
+ /* @__PURE__ */ jsx("p", { className: "mt-2 text-fg-mute text-sm", children: "\u30DB\u30D0\u30FC\u3067\u5C11\u3057\u62E1\u5927\u3001\u30AF\u30EA\u30C3\u30AF\u3067\u7E2E\u5C0F\u3057\u307E\u3059\u3002" })
28
+ ] }) })
29
+ };
30
+ const FitWidth = {
31
+ render: () => /* @__PURE__ */ jsx(Card, { width: "fit", children: /* @__PURE__ */ jsx("div", { className: "p-4", children: /* @__PURE__ */ jsx("p", { children: "\u5E45\u304C\u30B3\u30F3\u30C6\u30F3\u30C4\u306B\u5408\u308F\u305B\u3066\u8ABF\u6574\u3055\u308C\u307E\u3059\u3002" }) }) })
31
32
  };
32
33
  export {
34
+ FitWidth,
33
35
  Interactive,
34
36
  Primary,
35
37
  Secondary,
36
- Title,
38
+ WithTitle,
37
39
  card_stories_default as default
38
40
  };
@@ -1,5 +1,4 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import * as motion from "motion/react-client";
3
2
  import { cn } from "./../../helpers/cn";
4
3
  const InteractiveCard = ({
5
4
  children,
@@ -7,24 +6,17 @@ const InteractiveCard = ({
7
6
  width = "full",
8
7
  title
9
8
  }) => /* @__PURE__ */ jsxs(
10
- motion.section,
9
+ "section",
11
10
  {
12
11
  className: cn(
13
- "rounded-lg bg-bg-base/90 shadow-md",
12
+ "overflow-hidden rounded-lg border border-border-mute transition-transform hover:scale-[1.02] active:scale-[0.98]",
14
13
  width === "full" && "w-full",
15
14
  width === "fit" && "w-fit",
16
- variant === "primary" && "bg-bg-base/90",
15
+ variant === "primary" && "bg-bg-base",
17
16
  variant === "secondary" && "bg-bg-mute"
18
17
  ),
19
- tabIndex: -1,
20
- whileHover: {
21
- scale: 1.02
22
- },
23
- whileTap: {
24
- scale: 0.98
25
- },
26
18
  children: [
27
- title && /* @__PURE__ */ jsx("div", { className: "flex justify-center rounded-t-lg bg-linear-60 from-primary-bg-mute to-secondary-bg-mute p-4", children: /* @__PURE__ */ jsx("p", { className: "font-bold text-xl", children: title }) }),
19
+ title && /* @__PURE__ */ jsx("div", { className: "border-border-mute border-b bg-primary-bg/10 px-4 py-3", children: /* @__PURE__ */ jsx("p", { className: "font-bold", children: title }) }),
28
20
  children
29
21
  ]
30
22
  }
@@ -23,7 +23,7 @@ const Root = ({ ref, id, children, tabIndex, role = "dialog" }) => {
23
23
  {
24
24
  "aria-describedby": `${rootId}-content`,
25
25
  "aria-labelledby": `${rootId}-header`,
26
- className: "relative w-full rounded-lg border border-border-subtle bg-bg-base shadow-xl",
26
+ className: "relative w-full rounded-lg border border-border-mute bg-bg-base shadow-md",
27
27
  id,
28
28
  ref,
29
29
  role,
@@ -10,12 +10,12 @@ const Default = {
10
10
  args: {
11
11
  isOpen: true,
12
12
  onClose: fn(),
13
- title: "Drawer Title",
14
- children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
15
- /* @__PURE__ */ jsx("p", { className: "text-fg-mute", children: "This is a drawer component. You can put any content here." }),
16
- /* @__PURE__ */ jsx("p", { className: "text-fg-mute", children: "You can use it to display additional information or actions related to the current context." }),
17
- /* @__PURE__ */ jsx("p", { className: "text-fg-mute", children: "You can also use it to display forms, lists, or any other type of content that you want to show in a drawer." }),
18
- /* @__PURE__ */ jsx("p", { className: "text-fg-mute", children: "This is a great way to keep your UI clean and organized while still providing access to important information or actions." })
13
+ title: "\u30E1\u30CB\u30E5\u30FC",
14
+ children: /* @__PURE__ */ jsxs("nav", { className: "flex flex-col gap-2", children: [
15
+ /* @__PURE__ */ jsx("a", { className: "rounded-md px-3 py-2 hover:bg-bg-mute", href: "/", children: "\u30DB\u30FC\u30E0" }),
16
+ /* @__PURE__ */ jsx("a", { className: "rounded-md px-3 py-2 hover:bg-bg-mute", href: "/about", children: "\u3053\u306E\u30B5\u30A4\u30C8\u306B\u3064\u3044\u3066" }),
17
+ /* @__PURE__ */ jsx("a", { className: "rounded-md px-3 py-2 hover:bg-bg-mute", href: "/blog", children: "\u30D6\u30ED\u30B0" }),
18
+ /* @__PURE__ */ jsx("a", { className: "rounded-md px-3 py-2 hover:bg-bg-mute", href: "/contact", children: "\u304A\u554F\u3044\u5408\u308F\u305B" })
19
19
  ] })
20
20
  }
21
21
  };
@@ -64,7 +64,7 @@ const Content = ({ children }) => {
64
64
  {
65
65
  ...props,
66
66
  ...contentProps,
67
- className: "flex min-w-40 flex-col rounded-lg border border-border-mute bg-bg-base py-2 shadow-xl",
67
+ className: "flex min-w-40 flex-col rounded-lg border border-border-mute bg-bg-base py-2 shadow-md",
68
68
  children
69
69
  }
70
70
  )
@@ -80,9 +80,9 @@ const Item = ({
80
80
  "button",
81
81
  {
82
82
  className: cn(
83
- "w-full px-2 py-1 text-left",
84
- "hover:bg-primary-bg",
85
- "focus-visible:border-transparent focus-visible:bg-primary-bg focus-visible:outline-hidden"
83
+ "w-full px-2 py-1 text-left transition-colors",
84
+ "hover:bg-bg-mute",
85
+ "focus-visible:bg-bg-mute focus-visible:outline-none"
86
86
  ),
87
87
  ...props,
88
88
  children: label
@@ -18,32 +18,32 @@ const meta = {
18
18
  var dropdown_menu_stories_default = meta;
19
19
  const Default = {
20
20
  render: () => /* @__PURE__ */ jsxs(DropdownMenu.Root, { children: [
21
- /* @__PURE__ */ jsx(DropdownMenu.Trigger, { text: "Options" }),
21
+ /* @__PURE__ */ jsx(DropdownMenu.Trigger, { text: "\u64CD\u4F5C" }),
22
22
  /* @__PURE__ */ jsxs(DropdownMenu.Content, { children: [
23
23
  /* @__PURE__ */ jsx(
24
24
  DropdownMenu.Item,
25
25
  {
26
- label: "Item 1",
26
+ label: "\u7DE8\u96C6",
27
27
  onClick: () => {
28
- console.log(1);
28
+ console.log("\u7DE8\u96C6");
29
29
  }
30
30
  }
31
31
  ),
32
32
  /* @__PURE__ */ jsx(
33
33
  DropdownMenu.Item,
34
34
  {
35
- label: "Item 2",
35
+ label: "\u8907\u88FD",
36
36
  onClick: () => {
37
- console.log(2);
37
+ console.log("\u8907\u88FD");
38
38
  }
39
39
  }
40
40
  ),
41
41
  /* @__PURE__ */ jsx(
42
42
  DropdownMenu.Item,
43
43
  {
44
- label: "Item 3",
44
+ label: "\u524A\u9664",
45
45
  onClick: () => {
46
- console.log(3);
46
+ console.log("\u524A\u9664");
47
47
  }
48
48
  }
49
49
  )
@@ -51,7 +51,7 @@ const Default = {
51
51
  ] }),
52
52
  play: async ({ canvas, userEvent }) => {
53
53
  const trigger = canvas.getByRole("button", {
54
- name: "Options"
54
+ name: "\u64CD\u4F5C"
55
55
  });
56
56
  trigger.focus();
57
57
  await userEvent.keyboard("{Enter}");
@@ -63,34 +63,34 @@ const TriggerByIcon = {
63
63
  DropdownMenu.IconTrigger,
64
64
  {
65
65
  icon: /* @__PURE__ */ jsx(DarkModeIcon, { size: "lg" }),
66
- label: "Options"
66
+ label: "\u30C6\u30FC\u30DE\u5207\u66FF"
67
67
  }
68
68
  ),
69
69
  /* @__PURE__ */ jsxs(DropdownMenu.Content, { children: [
70
70
  /* @__PURE__ */ jsx(
71
71
  DropdownMenu.Item,
72
72
  {
73
- label: "Item 1",
73
+ label: "\u30E9\u30A4\u30C8",
74
74
  onClick: () => {
75
- console.log(1);
75
+ console.log("\u30E9\u30A4\u30C8");
76
76
  }
77
77
  }
78
78
  ),
79
79
  /* @__PURE__ */ jsx(
80
80
  DropdownMenu.Item,
81
81
  {
82
- label: "Item 2",
82
+ label: "\u30C0\u30FC\u30AF",
83
83
  onClick: () => {
84
- console.log(2);
84
+ console.log("\u30C0\u30FC\u30AF");
85
85
  }
86
86
  }
87
87
  ),
88
88
  /* @__PURE__ */ jsx(
89
89
  DropdownMenu.Item,
90
90
  {
91
- label: "Item 3",
91
+ label: "\u30B7\u30B9\u30C6\u30E0",
92
92
  onClick: () => {
93
- console.log(3);
93
+ console.log("\u30B7\u30B9\u30C6\u30E0");
94
94
  }
95
95
  }
96
96
  )
@@ -98,7 +98,7 @@ const TriggerByIcon = {
98
98
  ] }),
99
99
  play: async ({ canvas, userEvent }) => {
100
100
  const trigger = canvas.getByRole("button", {
101
- name: "Options"
101
+ name: "\u30C6\u30FC\u30DE\u5207\u66FF"
102
102
  });
103
103
  trigger.focus();
104
104
  await userEvent.keyboard("{Enter}");
@@ -1,15 +1,23 @@
1
1
  import { type FC } from 'react';
2
2
  import type { Option } from '../../../types/variables';
3
- type Props = {
3
+ type BaseProps = {
4
4
  id: string;
5
5
  describedbyId: string | undefined;
6
6
  isInvalid: boolean;
7
7
  isDisabled: boolean;
8
8
  isRequired: boolean;
9
9
  options: readonly Option[];
10
- value?: string[];
11
- defaultValue?: string[];
10
+ };
11
+ type ControlledProps = {
12
+ value: string[];
12
13
  onChange: (value: string[]) => void;
14
+ defaultValue?: never;
15
+ };
16
+ type UncontrolledProps = {
17
+ defaultValue?: string[];
18
+ value?: never;
19
+ onChange?: (value: string[]) => void;
13
20
  };
21
+ type Props = BaseProps & (ControlledProps | UncontrolledProps);
14
22
  export declare const Autocomplete: FC<Props>;
15
23
  export {};
@@ -28,7 +28,7 @@ const Autocomplete = ({
28
28
  if (!isControlled) {
29
29
  setInternalValue(newValue);
30
30
  }
31
- onChange(newValue);
31
+ onChange?.(newValue);
32
32
  },
33
33
  [isControlled, onChange]
34
34
  );
@@ -54,8 +54,8 @@ const Autocomplete = ({
54
54
  "div",
55
55
  {
56
56
  className: cn(
57
- "relative w-full rounded-md border border-border-base bg-bg-base shadow-xs",
58
- "focus-within:bordertransparent focus-within:outline-hidden focus-within:ring-2 focus-within:ring-border-info",
57
+ "relative w-full rounded-lg border border-border-base bg-bg-base",
58
+ "focus-within:border-transparent focus-within:outline-hidden focus-within:ring-2 focus-within:ring-border-info",
59
59
  "has-aria-invalid:border-border-error",
60
60
  "has-disabled:cursor-not-allowed has-disabled:border-border-mute has-disabled:bg-bg-mute has-disabled:has-hover:hover:bg-bg-mute"
61
61
  ),
@@ -193,7 +193,7 @@ const Autocomplete = ({
193
193
  /* @__PURE__ */ jsx("div", { className: "relative w-full", children: open && /* @__PURE__ */ jsx(
194
194
  "div",
195
195
  {
196
- className: "absolute top-1 z-10 w-full rounded-md border border-border-mute bg-bg-base shadow-md",
196
+ className: "absolute top-1 z-10 w-full rounded-lg border border-border-mute bg-bg-base shadow-md",
197
197
  role: "presentation",
198
198
  children: /* @__PURE__ */ jsxs("ul", { className: "max-h-96 py-2", id: `${id}_listbox`, children: [
199
199
  filteredOptions.length === 0 && /* @__PURE__ */ jsx("li", { className: "px-3 py-2 text-fg-mute", children: "\u8A72\u5F53\u306A\u3057" }),
@@ -204,9 +204,9 @@ const Autocomplete = ({
204
204
  {
205
205
  className: cn(
206
206
  "cursor-pointer px-3 py-2",
207
- selected && "bg-primary-bg",
207
+ selected && "bg-bg-mute",
208
208
  selectIndex === idx && !selected && "bg-bg-emphasize",
209
- selectIndex === idx && selected && "hover:bg-primary-bg/90"
209
+ selectIndex === idx && selected && "bg-bg-mute"
210
210
  ),
211
211
  id: `${id}_option_${option.value}`,
212
212
  onClick: (e) => {
@@ -4,7 +4,7 @@ import { Autocomplete } from "./autocomplete";
4
4
  const meta = {
5
5
  title: "components/form/autocomplete",
6
6
  component: Autocomplete,
7
- render: (props) => {
7
+ render: ({ id, describedbyId, isInvalid, isDisabled, isRequired }) => {
8
8
  const options = [
9
9
  { value: "2", label: "2\u9032\u6570" },
10
10
  { value: "8", label: "8\u9032\u6570" },
@@ -15,7 +15,11 @@ const meta = {
15
15
  return /* @__PURE__ */ jsx(
16
16
  Autocomplete,
17
17
  {
18
- ...props,
18
+ describedbyId,
19
+ id,
20
+ isDisabled,
21
+ isInvalid,
22
+ isRequired,
19
23
  onChange: setValue,
20
24
  options,
21
25
  value
@@ -1,9 +1,17 @@
1
1
  import { type ChangeEventHandler, type FC } from 'react';
2
- type Props = {
2
+ type BaseProps = {
3
3
  label: string;
4
+ };
5
+ type ControlledProps = {
4
6
  value: boolean;
5
- defaultChecked?: boolean;
6
7
  onChange: ChangeEventHandler<HTMLInputElement>;
8
+ defaultChecked?: never;
9
+ };
10
+ type UncontrolledProps = {
11
+ defaultChecked?: boolean;
12
+ value?: never;
13
+ onChange?: ChangeEventHandler<HTMLInputElement>;
7
14
  };
15
+ type Props = BaseProps & (ControlledProps | UncontrolledProps);
8
16
  export declare const Checkbox: FC<Props>;
9
17
  export {};
@@ -8,18 +8,28 @@ const Checkbox = ({
8
8
  defaultChecked,
9
9
  onChange
10
10
  }) => {
11
+ const [internalChecked, setInternalChecked] = useState(
12
+ defaultChecked ?? false
13
+ );
11
14
  const [isFocus, setIsFocus] = useState(false);
15
+ const isControlled = value !== void 0;
16
+ const checked = isControlled ? value : internalChecked;
12
17
  return /* @__PURE__ */ jsxs("label", { className: "inline-flex cursor-pointer items-center gap-2", children: [
13
18
  /* @__PURE__ */ jsx(
14
19
  "input",
15
20
  {
16
- checked: value,
21
+ checked: isControlled ? value : void 0,
17
22
  className: "sr-only",
18
- defaultChecked,
23
+ defaultChecked: isControlled ? void 0 : defaultChecked,
19
24
  onBlur: () => {
20
25
  setIsFocus(false);
21
26
  },
22
- onChange,
27
+ onChange: (e) => {
28
+ if (!isControlled) {
29
+ setInternalChecked(e.target.checked);
30
+ }
31
+ onChange?.(e);
32
+ },
23
33
  onFocus: () => {
24
34
  setIsFocus(true);
25
35
  },
@@ -32,10 +42,10 @@ const Checkbox = ({
32
42
  "aria-hidden": true,
33
43
  className: cn(
34
44
  "inline-flex size-5 items-center justify-center rounded-md border-2",
35
- isFocus && "bordertransparent outline-hidden ring-2 ring-border-info",
36
- value ? "border-border-base bg-primary-bg text-fg-base" : "border-border-mute bg-bg-base"
45
+ isFocus && "border-transparent outline-hidden ring-2 ring-border-info",
46
+ checked ? "border-border-base bg-primary-bg text-fg-base" : "border-border-mute bg-bg-base"
37
47
  ),
38
- children: value ? /* @__PURE__ */ jsx(CheckIcon, { size: "sm" }) : null
48
+ children: checked ? /* @__PURE__ */ jsx(CheckIcon, { size: "sm" }) : null
39
49
  }
40
50
  ),
41
51
  /* @__PURE__ */ jsx("span", { className: "text-lg", children: label })