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,171 @@
1
+ import * as React from "react";
2
+ import { Slot } from "radix-ui";
3
+ import { FormProvider, type ControllerProps, type FieldPath, type FieldValues } from "react-hook-form";
4
+ /**
5
+ * **概要 / Overview**
6
+ *
7
+ * - フォームはフォームの入力要素・ラベル・ヘルパーテキストを包括して提供するために使用するコンポーネントです。
8
+ * - en: The Form component is used to encapsulate form input elements, labels, and helper text.
9
+ *
10
+ * **使用例 / Usage Example**
11
+ *
12
+ * ```tsx
13
+ * <Form {...form}>
14
+ * <FormField
15
+ * control={form.control}
16
+ * name="example"
17
+ * render={({ field, fieldState }) => (
18
+ * <FormItem>
19
+ * <FormHeader label="ラベル" />
20
+ * <FormHelperMessage>ヘルプメッセージ</FormHelperMessage>
21
+ * <FormControl>
22
+ * <Input
23
+ * placeholder="プレースホルダー"
24
+ * {...field}
25
+ * {...fieldState}
26
+ * isInvalid={fieldState.invalid}
27
+ * />
28
+ * </FormControl>
29
+ * <FormErrorMessage />
30
+ * </FormItem>
31
+ * )}
32
+ * />
33
+ * </Form>
34
+ * ```
35
+ */
36
+ declare function Form(props: React.ComponentProps<typeof FormProvider>): import("react/jsx-runtime").JSX.Element;
37
+ /**
38
+ * **概要 / Overview**
39
+ *
40
+ * - フォームフィールドはフォームの各入力要素を管理するために使用するコンポーネントです。
41
+ * - en: The FormField component is used to manage each input element of the form.
42
+ *
43
+ * **使用例 / Usage Example**
44
+ *
45
+ * ```tsx
46
+ * <FormField
47
+ * control={form.control}
48
+ * name="example"
49
+ * render={({ field, fieldState }) => (
50
+ * <FormItem>
51
+ * <FormHeader label="ラベル" />
52
+ * <FormHelperMessage>ヘルプメッセージ</FormHelperMessage>
53
+ * <FormControl>
54
+ * <Input
55
+ * placeholder="プレースホルダー"
56
+ * {...field}
57
+ * {...fieldState}
58
+ * isInvalid={fieldState.invalid}
59
+ * />
60
+ * </FormControl>
61
+ * <FormErrorMessage />
62
+ * </FormItem>
63
+ * )}
64
+ * />
65
+ * ```
66
+ */
67
+ declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => import("react/jsx-runtime").JSX.Element;
68
+ declare const useFormField: () => {
69
+ invalid: boolean;
70
+ isDirty: boolean;
71
+ isTouched: boolean;
72
+ isValidating: boolean;
73
+ error?: import("react-hook-form").FieldError;
74
+ id: string;
75
+ name: string;
76
+ formItemId: string;
77
+ formDescriptionId: string;
78
+ formMessageId: string;
79
+ };
80
+ /**
81
+ * **概要 / Overview**
82
+ *
83
+ * - フォームアイテムはフォームフィールドのラベル、入力要素、ヘルパーテキストをグループ化するために使用するコンポーネントです。
84
+ * - en: The FormItem component is used to group the label, input elements, and helper text of a form field.
85
+ *
86
+ * **使用例 / Usage Example**
87
+ *
88
+ * ```tsx
89
+ * <FormItem>
90
+ * <FormHeader label="ラベル" />
91
+ * <FormHelperMessage>ヘルプメッセージ</FormHelperMessage>
92
+ * <FormControl>
93
+ * <Input placeholder="プレースホルダー" {...field} {...fieldState} isInvalid={fieldState.invalid} />
94
+ * </FormControl>
95
+ * <FormErrorMessage />
96
+ * </FormItem>
97
+ * ```
98
+ */
99
+ declare function FormItem({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
100
+ export interface FormHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
101
+ /**
102
+ * ラベルのテキスト
103
+ * en: Text of the label
104
+ */
105
+ label: string;
106
+ /**
107
+ * 必須フィールドかどうか
108
+ * en: Whether it is a required field
109
+ */
110
+ isRequired?: boolean;
111
+ /**
112
+ * ヘルプテキスト
113
+ * en: Help text
114
+ */
115
+ helpText?: string;
116
+ }
117
+ /**
118
+ * **概要 / Overview**
119
+ *
120
+ * - フォームヘッダーはフォームフィールドのラベル、必須マーク、ヘルプテキストを表示するために使用するコンポーネントです。
121
+ * - en: The FormHeader component is used to display the label, required mark, and help text of a form field.
122
+ *
123
+ * **使用例 / Usage Example**
124
+ *
125
+ * ```tsx
126
+ * <FormHeader label="ラベル" isRequired helpText="ヘルプテキスト" />
127
+ * ```
128
+ */
129
+ declare function FormHeader({ className, label, isRequired, helpText, ...props }: FormHeaderProps): import("react/jsx-runtime").JSX.Element;
130
+ /**
131
+ * **概要 / Overview**
132
+ *
133
+ * - フォームコントロールはフォームフィールドの入力要素をラップするために使用するコンポーネントです。
134
+ * - en: The FormControl component is used to wrap the input elements of a form field.
135
+ *
136
+ * **使用例 / Usage Example**
137
+ *
138
+ * ```tsx
139
+ * <FormControl>
140
+ * <Input placeholder="プレースホルダー" {...field} {...fieldState} isInvalid={fieldState.invalid} />
141
+ * </FormControl>
142
+ * ```
143
+ */
144
+ declare function FormControl({ ...props }: React.ComponentProps<typeof Slot.Root>): import("react/jsx-runtime").JSX.Element;
145
+ /**
146
+ * **概要 / Overview**
147
+ *
148
+ * - フォームヘルパーメッセージはフォームフィールドの補足説明やヒントを表示するために使用するコンポーネントです。
149
+ * - en: The FormHelperMessage component is used to display supplementary explanations or hints for form fields.
150
+ *
151
+ * **使用例 / Usage Example**
152
+ *
153
+ * ```tsx
154
+ * <FormHelperMessage>ヘルプメッセージ</FormHelperMessage>
155
+ * ```
156
+ */
157
+ declare function FormHelperMessage({ className, ...props }: React.ComponentProps<"p">): import("react/jsx-runtime").JSX.Element;
158
+ /**
159
+ * **概要 / Overview**
160
+ *
161
+ * - フォームエラーメッセージはフォームフィールドのバリデーションエラーを表示するために使用するコンポーネントです。
162
+ * - en: The FormErrorMessage component is used to display validation errors for form fields.
163
+ *
164
+ * **使用例 / Usage Example**
165
+ *
166
+ * ```tsx
167
+ * <FormErrorMessage />
168
+ * ```
169
+ */
170
+ declare function FormErrorMessage({ className, ...props }: React.ComponentProps<"p">): import("react/jsx-runtime").JSX.Element | null;
171
+ export { useFormField, Form, FormItem, FormHeader, FormControl, FormHelperMessage, FormErrorMessage, FormField, };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,129 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import figma from "@figma/code-connect";
3
+ import { Input } from "../input/index.js";
4
+ import { FormErrorMessage, FormHeader, FormHelperMessage, FormControl, } 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(
13
+ // Form,
14
+ // "https://www.figma.com/design/7alBZXZf65YgcII41TWT0r/Sparkle-Design?node-id=1274%3A66278",
15
+ // {
16
+ // props: {
17
+ // // No matching props could be found for these Figma properties:
18
+ // // "isErrorMessage": figma.boolean('isErrorMessage'),
19
+ // // "isHelpMessage": figma.boolean('isHelpMessage')
20
+ // },
21
+ // example: props => {
22
+ // return (
23
+ // <Form {...UseFormReturnType}>
24
+ // <FormField
25
+ // name="example"
26
+ // render={({ field, fieldState }) => (
27
+ // <FormItem>
28
+ // <FormHeader label="ラベル" />
29
+ // <FormHelperMessage>ヘルプメッセージ</FormHelperMessage>
30
+ // <FormControl>
31
+ // <Input
32
+ // placeholder="サンプルテキスト"
33
+ // {...field}
34
+ // {...fieldState}
35
+ // isInvalid={fieldState.invalid}
36
+ // />
37
+ // </FormControl>
38
+ // <FormErrorMessage />
39
+ // </FormItem>
40
+ // )}
41
+ // />
42
+ // </Form>
43
+ // );
44
+ // },
45
+ // }
46
+ // );
47
+ /**
48
+ * -- This file was auto-generated by Code Connect --
49
+ * None of your props could be automatically mapped to Figma properties.
50
+ * You should update the `props` object to include a mapping from your
51
+ * code props to Figma properties, and update the `example` function to
52
+ * return the code example you'd like to see in Figma
53
+ */
54
+ figma.connect(FormErrorMessage, "https://www.figma.com/design/7alBZXZf65YgcII41TWT0r/Sparkle-Design?node-id=573%3A6321", {
55
+ props: {
56
+ // No matching props could be found for these Figma properties:
57
+ // "label": figma.string('label')
58
+ },
59
+ example: props => _jsx(FormErrorMessage, {}),
60
+ });
61
+ /**
62
+ * -- This file was auto-generated by Code Connect --
63
+ * `props` includes a mapping from your code props to Figma properties.
64
+ * You should check this is correct, and update the `example` function
65
+ * to return the code example you'd like to see in Figma
66
+ */
67
+ figma.connect(FormHeader, "https://www.figma.com/design/7alBZXZf65YgcII41TWT0r/Sparkle-Design?node-id=573%3A4867", {
68
+ props: {
69
+ // These props were automatically mapped based on your linked code:
70
+ label: figma.string("label"),
71
+ isRequired: figma.boolean("isRequired"),
72
+ // No matching props could be found for these Figma properties:
73
+ helpText: figma.boolean("isHintTrigger", {
74
+ true: "有効",
75
+ false: undefined,
76
+ }),
77
+ },
78
+ example: props => (_jsx(FormHeader, { label: props.label, isRequired: props.isRequired, helpText: props.helpText })),
79
+ });
80
+ /**
81
+ * -- This file was auto-generated by Code Connect --
82
+ * None of your props could be automatically mapped to Figma properties.
83
+ * You should update the `props` object to include a mapping from your
84
+ * code props to Figma properties, and update the `example` function to
85
+ * return the code example you'd like to see in Figma
86
+ */
87
+ figma.connect(FormHelperMessage, "https://www.figma.com/design/7alBZXZf65YgcII41TWT0r/Sparkle-Design?node-id=574%3A10563", {
88
+ props: {
89
+ // No matching props could be found for these Figma properties:
90
+ label: figma.string("label"),
91
+ },
92
+ example: props => _jsx(FormHelperMessage, { children: props.label }),
93
+ });
94
+ /**
95
+ * -- This file was auto-generated by Code Connect --
96
+ * None of your props could be automatically mapped to Figma properties.
97
+ * You should update the `props` object to include a mapping from your
98
+ * code props to Figma properties, and update the `example` function to
99
+ * return the code example you'd like to see in Figma
100
+ */
101
+ figma.connect(FormControl, "https://www.figma.com/design/7alBZXZf65YgcII41TWT0r/Sparkle-Design?node-id=2831%3A2244", {
102
+ props: {
103
+ // No matching props could be found for these Figma properties:
104
+ // "unitLabel1": figma.string('unitLabel 1'),
105
+ // "unitLabel2": figma.string('unitLabel 2'),
106
+ // "unitLabel3": figma.string('unitLabel 3'),
107
+ // "isShowUnitLabel": figma.boolean('isShowUnitLabel'),
108
+ // "type": figma.enum('type', {
109
+ // "input": "input",
110
+ // "input unit 2": "input-unit-2",
111
+ // "input range": "input-range",
112
+ // "number": "number",
113
+ // "number range": "number-range",
114
+ // "select": "select",
115
+ // "select range": "select-range",
116
+ // "date": "date",
117
+ // "date range": "date-range",
118
+ // "time": "time",
119
+ // "time range": "time-range",
120
+ // "password": "password",
121
+ // "file": "file",
122
+ // "textarea": "textarea",
123
+ // "radio": "radio",
124
+ // "checkbox": "checkbox",
125
+ // "input unit 3": "input-unit-3"
126
+ // })
127
+ },
128
+ example: props => (_jsx(FormControl, { children: _jsx(Input, { placeholder: "\u30B5\u30F3\u30D7\u30EB\u30C6\u30AD\u30B9\u30C8" }) })),
129
+ });
@@ -0,0 +1,214 @@
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 { Slot } from "radix-ui";
20
+ import { Controller, FormProvider, useFormContext, useFormState, } from "react-hook-form";
21
+ import { cn } from "../../../lib/utils.js";
22
+ import { Label } from "../../../components/ui/form/label.js";
23
+ import { Tag } from "../../../components/ui/tag/index.js";
24
+ import { Icon } from "../../../components/ui/icon/index.js";
25
+ import { Tooltip, TooltipContent, TooltipTrigger, } from "../../../components/ui/tooltip/index.js";
26
+ /**
27
+ * **概要 / Overview**
28
+ *
29
+ * - フォームはフォームの入力要素・ラベル・ヘルパーテキストを包括して提供するために使用するコンポーネントです。
30
+ * - en: The Form component is used to encapsulate form input elements, labels, and helper text.
31
+ *
32
+ * **使用例 / Usage Example**
33
+ *
34
+ * ```tsx
35
+ * <Form {...form}>
36
+ * <FormField
37
+ * control={form.control}
38
+ * name="example"
39
+ * render={({ field, fieldState }) => (
40
+ * <FormItem>
41
+ * <FormHeader label="ラベル" />
42
+ * <FormHelperMessage>ヘルプメッセージ</FormHelperMessage>
43
+ * <FormControl>
44
+ * <Input
45
+ * placeholder="プレースホルダー"
46
+ * {...field}
47
+ * {...fieldState}
48
+ * isInvalid={fieldState.invalid}
49
+ * />
50
+ * </FormControl>
51
+ * <FormErrorMessage />
52
+ * </FormItem>
53
+ * )}
54
+ * />
55
+ * </Form>
56
+ * ```
57
+ */
58
+ function Form(props) {
59
+ return _jsx(FormProvider, Object.assign({}, props));
60
+ }
61
+ const FormFieldContext = React.createContext({});
62
+ /**
63
+ * **概要 / Overview**
64
+ *
65
+ * - フォームフィールドはフォームの各入力要素を管理するために使用するコンポーネントです。
66
+ * - en: The FormField component is used to manage each input element of the form.
67
+ *
68
+ * **使用例 / Usage Example**
69
+ *
70
+ * ```tsx
71
+ * <FormField
72
+ * control={form.control}
73
+ * name="example"
74
+ * render={({ field, fieldState }) => (
75
+ * <FormItem>
76
+ * <FormHeader label="ラベル" />
77
+ * <FormHelperMessage>ヘルプメッセージ</FormHelperMessage>
78
+ * <FormControl>
79
+ * <Input
80
+ * placeholder="プレースホルダー"
81
+ * {...field}
82
+ * {...fieldState}
83
+ * isInvalid={fieldState.invalid}
84
+ * />
85
+ * </FormControl>
86
+ * <FormErrorMessage />
87
+ * </FormItem>
88
+ * )}
89
+ * />
90
+ * ```
91
+ */
92
+ const FormField = (_a) => {
93
+ var props = __rest(_a, []);
94
+ return (_jsx(FormFieldContext.Provider, { value: { name: props.name }, children: _jsx(Controller, Object.assign({}, props)) }));
95
+ };
96
+ const useFormField = () => {
97
+ const fieldContext = React.useContext(FormFieldContext);
98
+ const itemContext = React.useContext(FormItemContext);
99
+ const { getFieldState } = useFormContext();
100
+ const formState = useFormState({ name: fieldContext.name });
101
+ const fieldState = getFieldState(fieldContext.name, formState);
102
+ if (!fieldContext) {
103
+ throw new Error("useFormField should be used within <FormField>");
104
+ }
105
+ const { id } = itemContext;
106
+ return Object.assign({ id, name: fieldContext.name, formItemId: `${id}-form-item`, formDescriptionId: `${id}-form-item-description`, formMessageId: `${id}-form-item-message` }, fieldState);
107
+ };
108
+ const FormItemContext = React.createContext({});
109
+ /**
110
+ * **概要 / Overview**
111
+ *
112
+ * - フォームアイテムはフォームフィールドのラベル、入力要素、ヘルパーテキストをグループ化するために使用するコンポーネントです。
113
+ * - en: The FormItem component is used to group the label, input elements, and helper text of a form field.
114
+ *
115
+ * **使用例 / Usage Example**
116
+ *
117
+ * ```tsx
118
+ * <FormItem>
119
+ * <FormHeader label="ラベル" />
120
+ * <FormHelperMessage>ヘルプメッセージ</FormHelperMessage>
121
+ * <FormControl>
122
+ * <Input placeholder="プレースホルダー" {...field} {...fieldState} isInvalid={fieldState.invalid} />
123
+ * </FormControl>
124
+ * <FormErrorMessage />
125
+ * </FormItem>
126
+ * ```
127
+ */
128
+ function FormItem(_a) {
129
+ var { className } = _a, props = __rest(_a, ["className"]);
130
+ const id = React.useId();
131
+ return (_jsx(FormItemContext.Provider, { value: { id }, children: _jsx("div", Object.assign({ "data-slot": "form-item", className: cn("grid content-start", className) }, props)) }));
132
+ }
133
+ function FormLabel(_a) {
134
+ var { className } = _a, props = __rest(_a, ["className"]);
135
+ const { error, formItemId } = useFormField();
136
+ return (_jsx(Label, Object.assign({ "data-slot": "form-label", "data-error": !!error, className: className, htmlFor: formItemId }, props)));
137
+ }
138
+ /**
139
+ * **概要 / Overview**
140
+ *
141
+ * - フォームヘッダーはフォームフィールドのラベル、必須マーク、ヘルプテキストを表示するために使用するコンポーネントです。
142
+ * - en: The FormHeader component is used to display the label, required mark, and help text of a form field.
143
+ *
144
+ * **使用例 / Usage Example**
145
+ *
146
+ * ```tsx
147
+ * <FormHeader label="ラベル" isRequired helpText="ヘルプテキスト" />
148
+ * ```
149
+ */
150
+ function FormHeader(_a) {
151
+ var { className, label, isRequired, helpText } = _a, props = __rest(_a, ["className", "label", "isRequired", "helpText"]);
152
+ return (_jsxs("div", Object.assign({ className: cn("flex gap-2 h-fit items-center", className) }, props, { children: [_jsx(FormLabel, { children: label }), isRequired && (_jsx(Tag, { status: "negative", size: "sm", variant: "subtle", children: "\u5FC5\u9808" })), helpText && (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { className: "flex items-center", children: _jsx(Icon, { icon: "help", size: 5, className: "cursor-help text-text-low" }) }), _jsx(TooltipContent, { children: helpText })] }))] })));
153
+ }
154
+ /**
155
+ * **概要 / Overview**
156
+ *
157
+ * - フォームコントロールはフォームフィールドの入力要素をラップするために使用するコンポーネントです。
158
+ * - en: The FormControl component is used to wrap the input elements of a form field.
159
+ *
160
+ * **使用例 / Usage Example**
161
+ *
162
+ * ```tsx
163
+ * <FormControl>
164
+ * <Input placeholder="プレースホルダー" {...field} {...fieldState} isInvalid={fieldState.invalid} />
165
+ * </FormControl>
166
+ * ```
167
+ */
168
+ function FormControl(_a) {
169
+ var props = __rest(_a, []);
170
+ const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
171
+ return (_jsx("div", { className: "py-1", children: _jsx(Slot.Root, Object.assign({ "data-slot": "form-control", id: formItemId, "aria-describedby": !error
172
+ ? `${formDescriptionId}`
173
+ : `${formDescriptionId} ${formMessageId}`, "aria-invalid": !!error }, props)) }));
174
+ }
175
+ /**
176
+ * **概要 / Overview**
177
+ *
178
+ * - フォームヘルパーメッセージはフォームフィールドの補足説明やヒントを表示するために使用するコンポーネントです。
179
+ * - en: The FormHelperMessage component is used to display supplementary explanations or hints for form fields.
180
+ *
181
+ * **使用例 / Usage Example**
182
+ *
183
+ * ```tsx
184
+ * <FormHelperMessage>ヘルプメッセージ</FormHelperMessage>
185
+ * ```
186
+ */
187
+ function FormHelperMessage(_a) {
188
+ var { className } = _a, props = __rest(_a, ["className"]);
189
+ const { formDescriptionId } = useFormField();
190
+ return (_jsx("p", Object.assign({ "data-slot": "form-description", id: formDescriptionId, className: cn("text-text-low character-2-regular-pro", className) }, props)));
191
+ }
192
+ /**
193
+ * **概要 / Overview**
194
+ *
195
+ * - フォームエラーメッセージはフォームフィールドのバリデーションエラーを表示するために使用するコンポーネントです。
196
+ * - en: The FormErrorMessage component is used to display validation errors for form fields.
197
+ *
198
+ * **使用例 / Usage Example**
199
+ *
200
+ * ```tsx
201
+ * <FormErrorMessage />
202
+ * ```
203
+ */
204
+ function FormErrorMessage(_a) {
205
+ var _b;
206
+ var { className } = _a, props = __rest(_a, ["className"]);
207
+ const { error, formMessageId } = useFormField();
208
+ const body = error ? String((_b = error === null || error === void 0 ? void 0 : error.message) !== null && _b !== void 0 ? _b : "") : props.children;
209
+ if (!body) {
210
+ return null;
211
+ }
212
+ return (_jsxs("p", Object.assign({ "data-slot": "form-message", id: formMessageId, className: cn("flex gap-1 items-center text-negative-500 character-1-regular-pro", className) }, props, { children: [_jsx(Icon, { icon: "error", size: 3 }), body] })));
213
+ }
214
+ export { useFormField, Form, FormItem, FormHeader, FormControl, FormHelperMessage, FormErrorMessage, FormField, };
@@ -0,0 +1,4 @@
1
+ import * as React from "react";
2
+ import { Label as LabelPrimitive } from "radix-ui";
3
+ declare function Label({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
4
+ export { Label };
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { Label as LabelPrimitive } from "radix-ui";
15
+ import { cn } from "../../../lib/utils.js";
16
+ function Label(_a) {
17
+ var { className } = _a, props = __rest(_a, ["className"]);
18
+ return (_jsx(LabelPrimitive.Root, Object.assign({ "data-slot": "label", className: cn("flex items-center gap-2 character-2-regular-pro leading-none select-none text-text-high", "group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50", "peer-disabled:cursor-not-allowed peer-disabled:opacity-50", className) }, props)));
19
+ }
20
+ export { Label };
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Copyright 2026 Goodpatch Inc.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import * as React from "react";
6
+ /**
7
+ * アイコンサイズのスケール値(1-12)
8
+ * en: Icon size scale values (1-12)
9
+ *
10
+ * | scale | px |
11
+ * |-------|-----|
12
+ * | 1 | 12 |
13
+ * | 2 | 14 |
14
+ * | 3 | 16 |
15
+ * | 4 | 18 |
16
+ * | 5 | 20 |
17
+ * | 6 | 24 |
18
+ * | 7 | 28 |
19
+ * | 8 | 32 |
20
+ * | 9 | 36 |
21
+ * | 10 | 42 |
22
+ * | 11 | 48 |
23
+ * | 12 | 54 |
24
+ */
25
+ export type IconSize = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
26
+ export interface IconProps extends React.HTMLAttributes<HTMLSpanElement> {
27
+ /**
28
+ * 表示するアイコン名
29
+ * en: Name of the icon to display
30
+ */
31
+ icon: string;
32
+ /**
33
+ * アイコンサイズ(スケール値 1-12)
34
+ * en: Size of the icon (scale value 1-12)
35
+ * @see IconSize
36
+ */
37
+ size?: IconSize;
38
+ /**
39
+ * 塗りつぶしアイコンかどうか
40
+ * en: Whether the icon is filled
41
+ */
42
+ fill?: boolean;
43
+ }
44
+ /**
45
+ * **概要 / Overview**
46
+ *
47
+ * - アイコンはテキスト情報を視覚表現でユーザーに提示するために使用するコンポーネントです。
48
+ * - en: The Icon component is used to present textual information to users through visual representation.
49
+ *
50
+ * **アンチパターン / Anti-patterns**
51
+ *
52
+ * - `material-symbols-rounded` を `span` に直書きせず、`Icon` を使ってください。
53
+ * en: Use `Icon` instead of writing `material-symbols-rounded` directly on a span.
54
+ *
55
+ * ```tsx
56
+ * // ✅ Correct
57
+ * <Icon icon="content_copy" size={4} />
58
+ *
59
+ * // ❌ Wrong - className を直書きしない
60
+ * <span className="material-symbols-rounded text-sm">content_copy</span>
61
+ * ```
62
+
63
+ * **使用例 / Usage Example**
64
+ *
65
+ * ```tsx
66
+ * <Icon icon="check" size={6} fill={true} />
67
+ * ```
68
+ *
69
+ * @param {IconProps} props
70
+ */
71
+ export declare const Icon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<HTMLSpanElement>>;
@@ -0,0 +1 @@
1
+ export {};