sparkle-design 0.9.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 (125) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +5 -0
  3. package/README.en.md +275 -0
  4. package/README.md +328 -0
  5. package/dist/components/ui/badge/index.d.ts +67 -0
  6. package/dist/components/ui/badge/index.figma.d.ts +1 -0
  7. package/dist/components/ui/badge/index.figma.js +28 -0
  8. package/dist/components/ui/badge/index.js +129 -0
  9. package/dist/components/ui/breadcrumb/index.d.ts +70 -0
  10. package/dist/components/ui/breadcrumb/index.figma.d.ts +1 -0
  11. package/dist/components/ui/breadcrumb/index.figma.js +28 -0
  12. package/dist/components/ui/breadcrumb/index.js +96 -0
  13. package/dist/components/ui/button/index.d.ts +145 -0
  14. package/dist/components/ui/button/index.figma.d.ts +1 -0
  15. package/dist/components/ui/button/index.figma.js +59 -0
  16. package/dist/components/ui/button/index.js +375 -0
  17. package/dist/components/ui/card/index.d.ts +193 -0
  18. package/dist/components/ui/card/index.figma.d.ts +1 -0
  19. package/dist/components/ui/card/index.figma.js +28 -0
  20. package/dist/components/ui/card/index.js +219 -0
  21. package/dist/components/ui/checkbox/index.d.ts +62 -0
  22. package/dist/components/ui/checkbox/index.figma.d.ts +1 -0
  23. package/dist/components/ui/checkbox/index.figma.js +34 -0
  24. package/dist/components/ui/checkbox/index.js +192 -0
  25. package/dist/components/ui/dialog/index.d.ts +106 -0
  26. package/dist/components/ui/dialog/index.figma.d.ts +1 -0
  27. package/dist/components/ui/dialog/index.figma.js +21 -0
  28. package/dist/components/ui/dialog/index.js +157 -0
  29. package/dist/components/ui/divider/index.d.ts +44 -0
  30. package/dist/components/ui/divider/index.figma.d.ts +1 -0
  31. package/dist/components/ui/divider/index.figma.js +39 -0
  32. package/dist/components/ui/divider/index.js +81 -0
  33. package/dist/components/ui/form/index.d.ts +171 -0
  34. package/dist/components/ui/form/index.figma.d.ts +1 -0
  35. package/dist/components/ui/form/index.figma.js +129 -0
  36. package/dist/components/ui/form/index.js +214 -0
  37. package/dist/components/ui/form/label.d.ts +4 -0
  38. package/dist/components/ui/form/label.js +20 -0
  39. package/dist/components/ui/icon/index.d.ts +71 -0
  40. package/dist/components/ui/icon/index.figma.d.ts +1 -0
  41. package/dist/components/ui/icon/index.figma.js +1858 -0
  42. package/dist/components/ui/icon/index.js +57 -0
  43. package/dist/components/ui/icon-button/index.d.ts +77 -0
  44. package/dist/components/ui/icon-button/index.figma.d.ts +1 -0
  45. package/dist/components/ui/icon-button/index.figma.js +43 -0
  46. package/dist/components/ui/icon-button/index.js +341 -0
  47. package/dist/components/ui/inline-message/index.d.ts +83 -0
  48. package/dist/components/ui/inline-message/index.figma.d.ts +1 -0
  49. package/dist/components/ui/inline-message/index.figma.js +26 -0
  50. package/dist/components/ui/inline-message/index.js +154 -0
  51. package/dist/components/ui/input/index.d.ts +118 -0
  52. package/dist/components/ui/input/index.figma.d.ts +1 -0
  53. package/dist/components/ui/input/index.figma.js +36 -0
  54. package/dist/components/ui/input/index.js +256 -0
  55. package/dist/components/ui/input-password/index.d.ts +27 -0
  56. package/dist/components/ui/input-password/index.figma.d.ts +1 -0
  57. package/dist/components/ui/input-password/index.figma.js +36 -0
  58. package/dist/components/ui/input-password/index.js +35 -0
  59. package/dist/components/ui/link/index.d.ts +68 -0
  60. package/dist/components/ui/link/index.figma.d.ts +1 -0
  61. package/dist/components/ui/link/index.figma.js +22 -0
  62. package/dist/components/ui/link/index.js +92 -0
  63. package/dist/components/ui/modal/index.d.ts +83 -0
  64. package/dist/components/ui/modal/index.figma.d.ts +1 -0
  65. package/dist/components/ui/modal/index.figma.js +61 -0
  66. package/dist/components/ui/modal/index.js +143 -0
  67. package/dist/components/ui/overlay/index.d.ts +19 -0
  68. package/dist/components/ui/overlay/index.figma.d.ts +1 -0
  69. package/dist/components/ui/overlay/index.figma.js +14 -0
  70. package/dist/components/ui/overlay/index.js +39 -0
  71. package/dist/components/ui/radio/index.d.ts +94 -0
  72. package/dist/components/ui/radio/index.figma.d.ts +1 -0
  73. package/dist/components/ui/radio/index.figma.js +63 -0
  74. package/dist/components/ui/radio/index.js +204 -0
  75. package/dist/components/ui/select/index.d.ts +175 -0
  76. package/dist/components/ui/select/index.figma.d.ts +1 -0
  77. package/dist/components/ui/select/index.figma.js +30 -0
  78. package/dist/components/ui/select/index.js +281 -0
  79. package/dist/components/ui/skeleton/index.d.ts +21 -0
  80. package/dist/components/ui/skeleton/index.figma.d.ts +1 -0
  81. package/dist/components/ui/skeleton/index.figma.js +14 -0
  82. package/dist/components/ui/skeleton/index.js +32 -0
  83. package/dist/components/ui/slider/index.d.ts +75 -0
  84. package/dist/components/ui/slider/index.figma.d.ts +1 -0
  85. package/dist/components/ui/slider/index.figma.js +28 -0
  86. package/dist/components/ui/slider/index.js +113 -0
  87. package/dist/components/ui/slider/utils.d.ts +16 -0
  88. package/dist/components/ui/slider/utils.js +56 -0
  89. package/dist/components/ui/spinner/index.d.ts +42 -0
  90. package/dist/components/ui/spinner/index.figma.d.ts +1 -0
  91. package/dist/components/ui/spinner/index.figma.js +16 -0
  92. package/dist/components/ui/spinner/index.js +51 -0
  93. package/dist/components/ui/switch/index.d.ts +46 -0
  94. package/dist/components/ui/switch/index.figma.d.ts +1 -0
  95. package/dist/components/ui/switch/index.figma.js +27 -0
  96. package/dist/components/ui/switch/index.js +75 -0
  97. package/dist/components/ui/tabs/index.d.ts +53 -0
  98. package/dist/components/ui/tabs/index.figma.d.ts +1 -0
  99. package/dist/components/ui/tabs/index.figma.js +55 -0
  100. package/dist/components/ui/tabs/index.js +164 -0
  101. package/dist/components/ui/tag/index.d.ts +50 -0
  102. package/dist/components/ui/tag/index.figma.d.ts +1 -0
  103. package/dist/components/ui/tag/index.figma.js +32 -0
  104. package/dist/components/ui/tag/index.js +177 -0
  105. package/dist/components/ui/textarea/index.d.ts +49 -0
  106. package/dist/components/ui/textarea/index.figma.d.ts +1 -0
  107. package/dist/components/ui/textarea/index.figma.js +27 -0
  108. package/dist/components/ui/textarea/index.js +94 -0
  109. package/dist/components/ui/toast/index.d.ts +60 -0
  110. package/dist/components/ui/toast/index.figma.d.ts +1 -0
  111. package/dist/components/ui/toast/index.figma.js +26 -0
  112. package/dist/components/ui/toast/index.js +57 -0
  113. package/dist/components/ui/tooltip/index.d.ts +52 -0
  114. package/dist/components/ui/tooltip/index.figma.d.ts +1 -0
  115. package/dist/components/ui/tooltip/index.figma.js +23 -0
  116. package/dist/components/ui/tooltip/index.js +65 -0
  117. package/dist/index.d.ts +27 -0
  118. package/dist/index.js +27 -0
  119. package/dist/lib/utils.d.ts +2 -0
  120. package/dist/lib/utils.js +5 -0
  121. package/dist/test/helpers.d.ts +56 -0
  122. package/dist/test/helpers.js +182 -0
  123. package/dist/test/setup.d.ts +1 -0
  124. package/dist/test/setup.js +38 -0
  125. package/package.json +253 -0
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Copyright 2026 Goodpatch Inc.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import React from "react";
6
+ export interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
7
+ /**
8
+ * 新しいウィンドウやタブで開くかどうか
9
+ * en: Whether to open the link in a new window or tab
10
+ */
11
+ isOpenInNew?: boolean;
12
+ /**
13
+ * 子要素をルート要素として使う(next/link 等との統合用)
14
+ * en: Render the child element as the root element (for integration with next/link, etc.)
15
+ */
16
+ asChild?: boolean;
17
+ /**
18
+ * 表示するテキスト
19
+ * en: Text to display inside the link
20
+ */
21
+ children: React.ReactNode;
22
+ /**
23
+ * 追加のクラス名
24
+ * en: Additional CSS classes for the link
25
+ */
26
+ className?: string;
27
+ }
28
+ /**
29
+ * **概要 / Overview**
30
+ *
31
+ * - リンクはコンテンツがナビゲーションできることをユーザーに提示するために使用するコンポーネントです。
32
+ * - en: The Link component is used to indicate to users that content is navigable.
33
+ *
34
+ * **アンチパターン / Anti-patterns**
35
+ *
36
+ * - 外部リンクアイコンを手動で追加しないでください。`isOpenInNew` prop が自動で `open_in_new` アイコンを表示します。
37
+ * en: Do not manually add external link icons. The `isOpenInNew` prop automatically displays the `open_in_new` icon.
38
+ * - `asChild` 使用時は `isOpenInNew` のアイコンが自動付与されます。手動で追加しないでください。
39
+ * en: When using `asChild`, the `isOpenInNew` icon is still automatically added. Do not add it manually.
40
+ * - `asChild` の子要素は `<a>` または `next/link` 等のリンク要素を渡してください。`<span>` や `<div>` を渡すとアクセシビリティが損なわれます。
41
+ * en: When using `asChild`, pass a link element (`<a>` or `next/link`, etc.) as the child. Passing `<span>` or `<div>` breaks accessibility.
42
+ *
43
+ * **使用例 / Usage Example**
44
+ *
45
+ * ```tsx
46
+ * // 基本的な使い方
47
+ * <Link href="https://example.com" isOpenInNew>
48
+ * 外部サイトへのリンク
49
+ * </Link>
50
+ *
51
+ * // next/link との統合
52
+ * import NextLink from "next/link";
53
+ *
54
+ * <Link asChild>
55
+ * <NextLink href="/about">About ページ</NextLink>
56
+ * </Link>
57
+ *
58
+ * // next/link + 外部リンク
59
+ * <Link asChild isOpenInNew>
60
+ * <NextLink href="https://example.com" target="_blank" rel="noopener noreferrer">
61
+ * 外部サイト
62
+ * </NextLink>
63
+ * </Link>
64
+ * ```
65
+ *
66
+ * @param {LinkProps} props
67
+ */
68
+ export declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import figma from "@figma/code-connect";
3
+ import { Link } from "./index.js";
4
+ /**
5
+ * -- This file was auto-generated by Code Connect --
6
+ * `props` includes a mapping from your code props to Figma properties.
7
+ * You should check this is correct, and update the `example` function
8
+ * to return the code example you'd like to see in Figma
9
+ */
10
+ figma.connect(Link, "https://www.figma.com/design/7alBZXZf65YgcII41TWT0r/Sparkle-Design?node-id=825%3A16911", {
11
+ props: {
12
+ // No matching props could be found for these Figma properties:
13
+ // "isFocused": figma.boolean('isFocused'),
14
+ label: figma.string("label"),
15
+ isOpenInNew: figma.boolean("isOpenInNew"),
16
+ // "state": figma.enum('state', {
17
+ // "enable": "enable",
18
+ // "hover": "hover"
19
+ // })
20
+ },
21
+ example: props => (_jsx(Link, { href: "https://example.com", isOpenInNew: props.isOpenInNew, children: props.label })),
22
+ });
@@ -0,0 +1,92 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
+ /**
14
+ * Copyright 2026 Goodpatch Inc.
15
+ * SPDX-License-Identifier: Apache-2.0
16
+ */
17
+ import React from "react";
18
+ import { Slot as SlotPrimitive } from "radix-ui";
19
+ import { cn } from "../../../lib/utils.js";
20
+ import { Icon } from "../../../components/ui/icon/index.js";
21
+ /**
22
+ * **概要 / Overview**
23
+ *
24
+ * - リンクはコンテンツがナビゲーションできることをユーザーに提示するために使用するコンポーネントです。
25
+ * - en: The Link component is used to indicate to users that content is navigable.
26
+ *
27
+ * **アンチパターン / Anti-patterns**
28
+ *
29
+ * - 外部リンクアイコンを手動で追加しないでください。`isOpenInNew` prop が自動で `open_in_new` アイコンを表示します。
30
+ * en: Do not manually add external link icons. The `isOpenInNew` prop automatically displays the `open_in_new` icon.
31
+ * - `asChild` 使用時は `isOpenInNew` のアイコンが自動付与されます。手動で追加しないでください。
32
+ * en: When using `asChild`, the `isOpenInNew` icon is still automatically added. Do not add it manually.
33
+ * - `asChild` の子要素は `<a>` または `next/link` 等のリンク要素を渡してください。`<span>` や `<div>` を渡すとアクセシビリティが損なわれます。
34
+ * en: When using `asChild`, pass a link element (`<a>` or `next/link`, etc.) as the child. Passing `<span>` or `<div>` breaks accessibility.
35
+ *
36
+ * **使用例 / Usage Example**
37
+ *
38
+ * ```tsx
39
+ * // 基本的な使い方
40
+ * <Link href="https://example.com" isOpenInNew>
41
+ * 外部サイトへのリンク
42
+ * </Link>
43
+ *
44
+ * // next/link との統合
45
+ * import NextLink from "next/link";
46
+ *
47
+ * <Link asChild>
48
+ * <NextLink href="/about">About ページ</NextLink>
49
+ * </Link>
50
+ *
51
+ * // next/link + 外部リンク
52
+ * <Link asChild isOpenInNew>
53
+ * <NextLink href="https://example.com" target="_blank" rel="noopener noreferrer">
54
+ * 外部サイト
55
+ * </NextLink>
56
+ * </Link>
57
+ * ```
58
+ *
59
+ * @param {LinkProps} props
60
+ */
61
+ export const Link = React.forwardRef((_a, ref) => {
62
+ var { isOpenInNew: isExternalLink = false, asChild = false, children, className = "" } = _a, props = __rest(_a, ["isOpenInNew", "asChild", "children", "className"]);
63
+ // character-*-*-* クラスがあるかチェック
64
+ const hasCharacterClass = className === null || className === void 0 ? void 0 : className.includes("character-");
65
+ // character-X-*-* のXの部分(サイズ)を取得
66
+ const characterSizeMatch = className === null || className === void 0 ? void 0 : className.match(/character-(\d+)-/);
67
+ const parsed = characterSizeMatch
68
+ ? parseInt(characterSizeMatch[1], 10)
69
+ : 3;
70
+ const characterSize = (parsed >= 1 && parsed <= 12 ? parsed : 3);
71
+ // character クラスの生成
72
+ const characterSizeClass = hasCharacterClass
73
+ ? "" // 外部で指定されている場合は付与しない
74
+ : `character-${characterSize}-regular-pro`;
75
+ const linkClassName = cn("inline group", characterSizeClass, className);
76
+ if (asChild &&
77
+ typeof process !== "undefined" &&
78
+ process.env.NODE_ENV !== "production" &&
79
+ React.isValidElement(children)) {
80
+ const childType = children.type;
81
+ if (childType === "span" || childType === "div") {
82
+ console.warn("[Link] asChild の子要素にはリンク要素(<a> や next/link 等)を渡してください。<span> や <div> を渡すとアクセシビリティが損なわれます。");
83
+ }
84
+ }
85
+ const linkContent = (_jsxs(_Fragment, { children: [_jsx("span", { className: "transition-colors text-info-500 group-hover:text-info-600 underline decoration-current underline-offset-2", children: children }), isExternalLink && (_jsx(Icon, { icon: "open_in_new", size: characterSize, className: "ml-1 align-middle inline-block text-info-500 group-hover:text-info-600" }))] }));
86
+ if (asChild) {
87
+ return (_jsx(SlotPrimitive.Slot, Object.assign({ ref: ref, className: linkClassName }, props, { children: React.isValidElement(children) ? (React.cloneElement(children, {}, _jsxs(_Fragment, { children: [_jsx("span", { className: "transition-colors text-info-500 group-hover:text-info-600 underline decoration-current underline-offset-2", children: children
88
+ .props.children }), isExternalLink && (_jsx(Icon, { icon: "open_in_new", size: characterSize, className: "ml-1 align-middle inline-block text-info-500 group-hover:text-info-600" }))] }))) : (linkContent) })));
89
+ }
90
+ return (_jsx("a", Object.assign({ ref: ref, className: linkClassName }, props, { children: linkContent })));
91
+ });
92
+ Link.displayName = "Link";
@@ -0,0 +1,83 @@
1
+ import * as React from "react";
2
+ import { Dialog as DialogPrimitive } from "radix-ui";
3
+ import { IconButton } from "../icon-button";
4
+ /**
5
+ * **概要 / Overview**
6
+ *
7
+ * - モーダルはコンテンツに重ねられたウィンドウを介して、ユーザーの注意を特定の情報に集中させるために使用するコンポーネントです。
8
+ * - en: The Modal component is used to focus user attention on specific information through a window overlaid on content.
9
+ * - 作成/編集フォームや詳細表示など、確認だけではない情報入力・閲覧に使います。
10
+ * - en: Use Modal for forms and detail views such as create/edit flows, not for simple action confirmation.
11
+ *
12
+ * **使用例 / Usage Example**
13
+ *
14
+ * ```tsx
15
+ * <Modal>
16
+ * <ModalTrigger>モーダルを開く</ModalTrigger>
17
+ * <ModalContent size="md">
18
+ * <ModalHeader>
19
+ * <ModalTitle>タイトル</ModalTitle>
20
+ * <ModalClose />
21
+ * </ModalHeader>
22
+ * <ModalBody>
23
+ * <p>モーダルの内容</p>
24
+ * </ModalBody>
25
+ * <ModalFooter>
26
+ * <button>OK</button>
27
+ * </ModalFooter>
28
+ * </ModalContent>
29
+ * </Modal>
30
+ * ```
31
+ *
32
+ * **アンチパターン / Anti-patterns**
33
+ *
34
+ * - 作成/編集フォームや詳細表示など、確認だけではない情報入力・閲覧に使ってください。
35
+ * en: Use Modal for forms and detail views such as create and edit flows, not for simple action confirmation.
36
+ *
37
+ * ```tsx
38
+ * // ✅ Correct
39
+ * <Modal>
40
+ * <ModalContent size="md">
41
+ * <ModalHeader>
42
+ * <ModalTitle>ユーザー作成</ModalTitle>
43
+ * <ModalClose />
44
+ * </ModalHeader>
45
+ * <ModalBody isSpace>
46
+ * <Input />
47
+ * <Select />
48
+ * </ModalBody>
49
+ * <ModalFooter>
50
+ * <Button>作成</Button>
51
+ * </ModalFooter>
52
+ * </ModalContent>
53
+ * </Modal>
54
+ * ```
55
+
56
+ * @param {React.ComponentProps<typeof DialogPrimitive.Root>} props
57
+ */
58
+ declare function Modal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
59
+ declare function ModalTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
60
+ declare function ModalPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
61
+ declare function ModalTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>): import("react/jsx-runtime").JSX.Element;
62
+ declare function ModalClose({ "aria-label": ariaLabel, ...props }: Omit<React.ComponentProps<typeof IconButton>, "icon">): import("react/jsx-runtime").JSX.Element;
63
+ declare function ModalOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>): import("react/jsx-runtime").JSX.Element;
64
+ export type ModalSize = "sm" | "md" | "lg" | "xl" | "full";
65
+ interface ModalContentProps extends React.ComponentProps<typeof DialogPrimitive.Content> {
66
+ /**
67
+ * モーダルのサイズ(sm、md、lg、xl、full)
68
+ * en: Modal size (sm, md, lg, xl, full)
69
+ */
70
+ size?: ModalSize;
71
+ /**
72
+ * オーバーレイクリック時にモーダルを閉じるかどうか
73
+ * en: Determines whether clicking the overlay closes the modal
74
+ */
75
+ closeOnOverlayClick?: boolean;
76
+ }
77
+ declare function ModalContent({ className, children, size, closeOnOverlayClick, onInteractOutside, ...props }: ModalContentProps): import("react/jsx-runtime").JSX.Element;
78
+ declare function ModalHeader({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
79
+ declare function ModalBody({ className, isSpace, ...props }: React.ComponentProps<"div"> & {
80
+ isSpace?: boolean;
81
+ }): import("react/jsx-runtime").JSX.Element;
82
+ declare function ModalFooter({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
83
+ export { Modal, ModalClose, ModalContent, ModalBody, ModalFooter, ModalHeader, ModalOverlay, ModalPortal, ModalTitle, ModalTrigger, };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,61 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import figma from "@figma/code-connect";
3
+ import { Button } from "../button/index.js";
4
+ import { Modal, ModalBody, ModalClose, ModalContent, ModalFooter, ModalHeader, ModalTitle, ModalTrigger, } from "./index.js";
5
+ /**
6
+ * -- This file was auto-generated by Code Connect --
7
+ * None of your props could be automatically mapped to Figma properties.
8
+ * You should update the `props` object to include a mapping from your
9
+ * code props to Figma properties, and update the `example` function to
10
+ * return the code example you'd like to see in Figma
11
+ */
12
+ figma.connect(Modal, "https://www.figma.com/design/7alBZXZf65YgcII41TWT0r/Sparkle-Design?node-id=1306%3A20954", {
13
+ props: {
14
+ // No matching props could be found for these Figma properties:
15
+ // isHeader: figma.boolean("isHeader"),
16
+ // isFooter: figma.boolean("isFooter"),
17
+ // isCloseTrigger: figma.boolean("isCloseTrigger"),
18
+ title: figma.string("title"),
19
+ size: figma.enum("size", {
20
+ sm: "sm",
21
+ md: "md",
22
+ lg: "lg",
23
+ xl: "xl",
24
+ full: "full",
25
+ }),
26
+ },
27
+ example: props => (_jsxs(Modal, { children: [_jsx(ModalTrigger, { children: "\u30E2\u30FC\u30C0\u30EB\u3092\u958B\u304F" }), _jsxs(ModalContent, { size: props.size, children: [_jsxs(ModalHeader, { children: [_jsx(ModalTitle, { children: props.title }), _jsx(ModalClose, {})] }), _jsx(ModalBody, { children: _jsx("p", { children: "\u30B9\u30ED\u30C3\u30C8" }) }), _jsxs(ModalFooter, { children: [_jsx(Button, { size: "sm", theme: "neutral", variant: "ghost", children: "\u30AD\u30E3\u30F3\u30BB\u30EB" }), _jsx(Button, { size: "sm", children: "\u4FDD\u5B58" })] })] })] })),
28
+ });
29
+ /**
30
+ * -- This file was auto-generated by Code Connect --
31
+ * `props` includes a mapping from your code props to Figma properties.
32
+ * You should check this is correct, and update the `example` function
33
+ * to return the code example you'd like to see in Figma
34
+ */
35
+ figma.connect(ModalBody, "https://www.figma.com/design/7alBZXZf65YgcII41TWT0r/Sparkle-Design?node-id=2893%3A25363", {
36
+ props: {
37
+ // These props were automatically mapped based on your linked code:
38
+ isSpace: figma.boolean("isSpaced"),
39
+ // No matching props could be found for these Figma properties:
40
+ // "slot": figma.instance('slot')
41
+ },
42
+ example: props => _jsx(ModalBody, { isSpace: props.isSpace }),
43
+ });
44
+ /**
45
+ * -- This file was auto-generated by Code Connect --
46
+ * None of your props could be automatically mapped to Figma properties.
47
+ * You should update the `props` object to include a mapping from your
48
+ * code props to Figma properties, and update the `example` function to
49
+ * return the code example you'd like to see in Figma
50
+ */
51
+ figma.connect(ModalFooter, "https://www.figma.com/design/7alBZXZf65YgcII41TWT0r/Sparkle-Design?node-id=2893%3A25357", {
52
+ props: {
53
+ // No matching props could be found for these Figma properties:
54
+ // "slot": figma.instance('slot'),
55
+ // "type": figma.enum('type', {
56
+ // "default": "default",
57
+ // "slot": "slot"
58
+ // })
59
+ },
60
+ example: props => _jsx(ModalFooter, {}),
61
+ });
@@ -0,0 +1,143 @@
1
+ /**
2
+ * Copyright 2026 Goodpatch Inc.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ "use client";
6
+ var __rest = (this && this.__rest) || function (s, e) {
7
+ var t = {};
8
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
9
+ t[p] = s[p];
10
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
11
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
12
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
13
+ t[p[i]] = s[p[i]];
14
+ }
15
+ return t;
16
+ };
17
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
18
+ import * as React from "react";
19
+ import { Dialog as DialogPrimitive } from "radix-ui";
20
+ import { cn } from "../../../lib/utils.js";
21
+ import { IconButton } from "../icon-button/index.js";
22
+ /**
23
+ * **概要 / Overview**
24
+ *
25
+ * - モーダルはコンテンツに重ねられたウィンドウを介して、ユーザーの注意を特定の情報に集中させるために使用するコンポーネントです。
26
+ * - en: The Modal component is used to focus user attention on specific information through a window overlaid on content.
27
+ * - 作成/編集フォームや詳細表示など、確認だけではない情報入力・閲覧に使います。
28
+ * - en: Use Modal for forms and detail views such as create/edit flows, not for simple action confirmation.
29
+ *
30
+ * **使用例 / Usage Example**
31
+ *
32
+ * ```tsx
33
+ * <Modal>
34
+ * <ModalTrigger>モーダルを開く</ModalTrigger>
35
+ * <ModalContent size="md">
36
+ * <ModalHeader>
37
+ * <ModalTitle>タイトル</ModalTitle>
38
+ * <ModalClose />
39
+ * </ModalHeader>
40
+ * <ModalBody>
41
+ * <p>モーダルの内容</p>
42
+ * </ModalBody>
43
+ * <ModalFooter>
44
+ * <button>OK</button>
45
+ * </ModalFooter>
46
+ * </ModalContent>
47
+ * </Modal>
48
+ * ```
49
+ *
50
+ * **アンチパターン / Anti-patterns**
51
+ *
52
+ * - 作成/編集フォームや詳細表示など、確認だけではない情報入力・閲覧に使ってください。
53
+ * en: Use Modal for forms and detail views such as create and edit flows, not for simple action confirmation.
54
+ *
55
+ * ```tsx
56
+ * // ✅ Correct
57
+ * <Modal>
58
+ * <ModalContent size="md">
59
+ * <ModalHeader>
60
+ * <ModalTitle>ユーザー作成</ModalTitle>
61
+ * <ModalClose />
62
+ * </ModalHeader>
63
+ * <ModalBody isSpace>
64
+ * <Input />
65
+ * <Select />
66
+ * </ModalBody>
67
+ * <ModalFooter>
68
+ * <Button>作成</Button>
69
+ * </ModalFooter>
70
+ * </ModalContent>
71
+ * </Modal>
72
+ * ```
73
+
74
+ * @param {React.ComponentProps<typeof DialogPrimitive.Root>} props
75
+ */
76
+ function Modal(_a) {
77
+ var props = __rest(_a, []);
78
+ return _jsx(DialogPrimitive.Root, Object.assign({ "data-slot": "modal" }, props));
79
+ }
80
+ /// モーダルのトリガー要素
81
+ function ModalTrigger(_a) {
82
+ var props = __rest(_a, []);
83
+ return _jsx(DialogPrimitive.Trigger, Object.assign({ "data-slot": "modal-trigger" }, props));
84
+ }
85
+ /// モーダルのポータル要素
86
+ function ModalPortal(_a) {
87
+ var props = __rest(_a, []);
88
+ return _jsx(DialogPrimitive.Portal, Object.assign({ "data-slot": "modal-portal" }, props));
89
+ }
90
+ /// モーダルのタイトル要素
91
+ function ModalTitle(_a) {
92
+ var { className } = _a, props = __rest(_a, ["className"]);
93
+ return (_jsx(DialogPrimitive.Title, Object.assign({ "data-slot": "modal-title", className: cn("character-4-bold-pro flex-1", className) }, props)));
94
+ }
95
+ /// モーダルのクローズボタン
96
+ function ModalClose(_a) {
97
+ var { "aria-label": ariaLabel = "閉じる" } = _a, props = __rest(_a, ["aria-label"]);
98
+ return (_jsx(DialogPrimitive.Close, { asChild: true, children: _jsx(IconButton, Object.assign({ icon: "close", "data-slot": "modal-close", size: "xs", variant: "ghost", theme: "neutral", "aria-label": ariaLabel }, props)) }));
99
+ }
100
+ /// モーダルのオーバーレイ要素
101
+ function ModalOverlay(_a) {
102
+ var { className } = _a, props = __rest(_a, ["className"]);
103
+ return (_jsx(DialogPrimitive.Overlay, Object.assign({ "data-slot": "modal-overlay", className: cn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50", className) }, props)));
104
+ }
105
+ /// モーダルの本体
106
+ function ModalContent(_a) {
107
+ var { className, children, size = "md", closeOnOverlayClick = false, onInteractOutside } = _a, props = __rest(_a, ["className", "children", "size", "closeOnOverlayClick", "onInteractOutside"]);
108
+ const handleInteractOutside = React.useCallback(event => {
109
+ onInteractOutside === null || onInteractOutside === void 0 ? void 0 : onInteractOutside(event);
110
+ if (!closeOnOverlayClick && !event.defaultPrevented) {
111
+ event.preventDefault();
112
+ }
113
+ }, [closeOnOverlayClick, onInteractOutside]);
114
+ // Figmaのsizeバリアントに合わせたサイズごとのスタイル定義
115
+ const sizeClass = size === "sm"
116
+ ? "max-w-xs"
117
+ : size === "md"
118
+ ? "max-w-[480px]"
119
+ : size === "lg"
120
+ ? "max-w-[640px]"
121
+ : size === "xl"
122
+ ? "max-w-[960px]"
123
+ : size === "full"
124
+ ? "max-w-[calc(100vw-80px)] h-[calc(100vh-80px)] overflow-hidden"
125
+ : "";
126
+ return (_jsxs(ModalPortal, { "data-slot": "modal-portal", children: [_jsx(ModalOverlay, {}), _jsx(DialogPrimitive.Content, Object.assign({ "data-slot": "modal-content", className: cn(sizeClass, "z-50 flex flex-col gap-0 w-full max-h-[calc(100vh-80px)] bg-white border-divider-low py-4 rounded-modal data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%] shadow-lg duration-200", className), onInteractOutside: handleInteractOutside }, props, { children: children }))] }));
127
+ }
128
+ /// モーダルのヘッダー
129
+ function ModalHeader(_a) {
130
+ var { className } = _a, props = __rest(_a, ["className"]);
131
+ return (_jsx("div", Object.assign({ "data-slot": "modal-header", className: cn("flex gap-2 px-6 py-2 items-center w-full shrink-0 grow-0", className) }, props)));
132
+ }
133
+ /// モーダルのボディ
134
+ function ModalBody(_a) {
135
+ var { className, isSpace = true } = _a, props = __rest(_a, ["className", "isSpace"]);
136
+ return (_jsx("div", Object.assign({ "data-slot": "modal-body", className: cn("grow overflow-auto min-h-0", isSpace ? "px-6 py-2" : "", className) }, props)));
137
+ }
138
+ /// モーダルのフッター
139
+ function ModalFooter(_a) {
140
+ var { className } = _a, props = __rest(_a, ["className"]);
141
+ return (_jsx("div", Object.assign({ "data-slot": "modal-footer", className: cn("flex flex-row justify-end gap-2 px-6 py-2 shrink-0 grow-0", className) }, props)));
142
+ }
143
+ export { Modal, ModalClose, ModalContent, ModalBody, ModalFooter, ModalHeader, ModalOverlay, ModalPortal, ModalTitle, ModalTrigger, };
@@ -0,0 +1,19 @@
1
+ import * as React from "react";
2
+ export interface OverlayProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ }
4
+ /**
5
+ * **概要 / Overview**
6
+ *
7
+ * - オーバーレイはシステムのモードが切り替わったことを伝えるために使用するコンポーネントです。
8
+ * - en: The Overlay component is used to indicate that the system mode has changed.
9
+ *
10
+ * **使用例 / Usage Example**
11
+ *
12
+ * ```tsx
13
+ * <Overlay />
14
+ * ```
15
+ *
16
+ * @param {OverlayProps} props
17
+ */
18
+ declare const Overlay: React.ForwardRefExoticComponent<OverlayProps & React.RefAttributes<HTMLDivElement>>;
19
+ export { Overlay };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import figma from "@figma/code-connect";
3
+ import { Overlay } from "./index.js";
4
+ /**
5
+ * -- This file was auto-generated by Code Connect --
6
+ * None of your props could be automatically mapped to Figma properties.
7
+ * You should update the `props` object to include a mapping from your
8
+ * code props to Figma properties, and update the `example` function to
9
+ * return the code example you'd like to see in Figma
10
+ */
11
+ figma.connect(Overlay, "https://www.figma.com/design/7alBZXZf65YgcII41TWT0r/Sparkle-Design?node-id=2873%3A274", {
12
+ props: {},
13
+ example: props => _jsx(Overlay, {}),
14
+ });
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Copyright 2026 Goodpatch Inc.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ "use client";
6
+ var __rest = (this && this.__rest) || function (s, e) {
7
+ var t = {};
8
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
9
+ t[p] = s[p];
10
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
11
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
12
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
13
+ t[p[i]] = s[p[i]];
14
+ }
15
+ return t;
16
+ };
17
+ import { jsx as _jsx } from "react/jsx-runtime";
18
+ import * as React from "react";
19
+ import { cn } from "../../../lib/utils.js";
20
+ /**
21
+ * **概要 / Overview**
22
+ *
23
+ * - オーバーレイはシステムのモードが切り替わったことを伝えるために使用するコンポーネントです。
24
+ * - en: The Overlay component is used to indicate that the system mode has changed.
25
+ *
26
+ * **使用例 / Usage Example**
27
+ *
28
+ * ```tsx
29
+ * <Overlay />
30
+ * ```
31
+ *
32
+ * @param {OverlayProps} props
33
+ */
34
+ const Overlay = React.forwardRef((_a, ref) => {
35
+ var { className } = _a, props = __rest(_a, ["className"]);
36
+ return (_jsx("div", Object.assign({ ref: ref, "data-slot": "overlay", className: cn("fixed inset-0 bg-[var(--color-black-alpha-300)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0", className) }, props)));
37
+ });
38
+ Overlay.displayName = "Overlay";
39
+ export { Overlay };
@@ -0,0 +1,94 @@
1
+ import * as React from "react";
2
+ import { RadioGroup as RadioPrimitive } from "radix-ui";
3
+ import { type VariantProps } from "class-variance-authority";
4
+ declare const radioItemVariants: (props?: ({
5
+ size?: "sm" | "md" | "lg" | null | undefined;
6
+ isDisabled?: boolean | null | undefined;
7
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
+ declare const radioIndicatorDotVariants: (props?: ({
9
+ size?: "sm" | "md" | "lg" | null | undefined;
10
+ isInvalid?: boolean | null | undefined;
11
+ isDisabled?: boolean | null | undefined;
12
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
13
+ type RadioPrimitiveProps = React.ComponentProps<typeof RadioPrimitive.Root>;
14
+ export interface RadioProps extends RadioPrimitiveProps {
15
+ /**
16
+ * ラジオのデフォルト値
17
+ * en: Default value of the radio group
18
+ */
19
+ defaultValue?: RadioPrimitiveProps["defaultValue"];
20
+ /**
21
+ * ラジオの値が変更されたときのコールバック
22
+ * en: Callback when the radio value changes
23
+ */
24
+ onValueChange?: RadioPrimitiveProps["onValueChange"];
25
+ }
26
+ /**
27
+ * **概要 / Overview**
28
+ *
29
+ * - ラジオボタンは単一選択の形式でユーザーからの入力を取得するために使用するコンポーネントです。
30
+ * - en: The Radio component is used to select one option from multiple choices.
31
+ *
32
+ * **使用例 / Usage Example**
33
+ *
34
+ * ```tsx
35
+ * <Radio value="option1" onValueChange={setValue}>
36
+ * <RadioItem value="option1" label="オプション1" />
37
+ * <RadioItem value="option2" label="オプション2" />
38
+ * </Radio>
39
+ * ```
40
+ *
41
+ * @param {RadioProps} props
42
+ */
43
+ declare function Radio({ className, ...props }: RadioProps): import("react/jsx-runtime").JSX.Element;
44
+ declare namespace Radio {
45
+ var displayName: string | undefined;
46
+ }
47
+ type RadioItemVariantProps = VariantProps<typeof radioItemVariants>;
48
+ type RadioIndicatorDotVariantProps = VariantProps<typeof radioIndicatorDotVariants>;
49
+ type RadioPrimitiveItemProps = React.ComponentPropsWithoutRef<typeof RadioPrimitive.Item>;
50
+ interface RadioItemProps extends RadioPrimitiveItemProps {
51
+ /**
52
+ * ラジオボタンのサイズ
53
+ * en: Radio button size
54
+ * @default "md"
55
+ */
56
+ size?: RadioItemVariantProps["size"];
57
+ /**
58
+ * エラー状態かどうか
59
+ * en: Whether the radio button is in an error state
60
+ * @default false
61
+ */
62
+ isInvalid?: RadioIndicatorDotVariantProps["isInvalid"];
63
+ /**
64
+ * ラジオボタンが無効かどうか
65
+ * en: Whether the radio button is disabled
66
+ * @default false
67
+ */
68
+ disabled?: RadioPrimitiveItemProps["disabled"];
69
+ /**
70
+ * ラベルのテキスト
71
+ * en: Label text for the radio button
72
+ */
73
+ label?: string;
74
+ }
75
+ /**
76
+ * **概要 / Overview**
77
+ *
78
+ * - ラジオボタンのアイテムコンポーネントです。
79
+ * - en: Individual radio button item component.
80
+ *
81
+ * **使用例 / Usage Example**
82
+ *
83
+ * ```tsx
84
+ * <RadioItem value="option1" label="オプション1" size="md" />
85
+ * ```
86
+ *
87
+ * @param {RadioItemProps} props
88
+ */
89
+ declare function RadioItem({ className, size, isInvalid, disabled, label, id, ...props }: RadioItemProps): import("react/jsx-runtime").JSX.Element;
90
+ declare namespace RadioItem {
91
+ var displayName: string | undefined;
92
+ }
93
+ export { Radio, RadioItem };
94
+ export type { RadioItemProps };
@@ -0,0 +1 @@
1
+ export {};