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.
- package/LICENSE +201 -0
- package/NOTICE +5 -0
- package/README.en.md +275 -0
- package/README.md +328 -0
- package/dist/components/ui/badge/index.d.ts +67 -0
- package/dist/components/ui/badge/index.figma.d.ts +1 -0
- package/dist/components/ui/badge/index.figma.js +28 -0
- package/dist/components/ui/badge/index.js +129 -0
- package/dist/components/ui/breadcrumb/index.d.ts +70 -0
- package/dist/components/ui/breadcrumb/index.figma.d.ts +1 -0
- package/dist/components/ui/breadcrumb/index.figma.js +28 -0
- package/dist/components/ui/breadcrumb/index.js +96 -0
- package/dist/components/ui/button/index.d.ts +145 -0
- package/dist/components/ui/button/index.figma.d.ts +1 -0
- package/dist/components/ui/button/index.figma.js +59 -0
- package/dist/components/ui/button/index.js +375 -0
- package/dist/components/ui/card/index.d.ts +193 -0
- package/dist/components/ui/card/index.figma.d.ts +1 -0
- package/dist/components/ui/card/index.figma.js +28 -0
- package/dist/components/ui/card/index.js +219 -0
- package/dist/components/ui/checkbox/index.d.ts +62 -0
- package/dist/components/ui/checkbox/index.figma.d.ts +1 -0
- package/dist/components/ui/checkbox/index.figma.js +34 -0
- package/dist/components/ui/checkbox/index.js +192 -0
- package/dist/components/ui/dialog/index.d.ts +106 -0
- package/dist/components/ui/dialog/index.figma.d.ts +1 -0
- package/dist/components/ui/dialog/index.figma.js +21 -0
- package/dist/components/ui/dialog/index.js +157 -0
- package/dist/components/ui/divider/index.d.ts +44 -0
- package/dist/components/ui/divider/index.figma.d.ts +1 -0
- package/dist/components/ui/divider/index.figma.js +39 -0
- package/dist/components/ui/divider/index.js +81 -0
- package/dist/components/ui/form/index.d.ts +171 -0
- package/dist/components/ui/form/index.figma.d.ts +1 -0
- package/dist/components/ui/form/index.figma.js +129 -0
- package/dist/components/ui/form/index.js +214 -0
- package/dist/components/ui/form/label.d.ts +4 -0
- package/dist/components/ui/form/label.js +20 -0
- package/dist/components/ui/icon/index.d.ts +71 -0
- package/dist/components/ui/icon/index.figma.d.ts +1 -0
- package/dist/components/ui/icon/index.figma.js +1858 -0
- package/dist/components/ui/icon/index.js +57 -0
- package/dist/components/ui/icon-button/index.d.ts +77 -0
- package/dist/components/ui/icon-button/index.figma.d.ts +1 -0
- package/dist/components/ui/icon-button/index.figma.js +43 -0
- package/dist/components/ui/icon-button/index.js +341 -0
- package/dist/components/ui/inline-message/index.d.ts +83 -0
- package/dist/components/ui/inline-message/index.figma.d.ts +1 -0
- package/dist/components/ui/inline-message/index.figma.js +26 -0
- package/dist/components/ui/inline-message/index.js +154 -0
- package/dist/components/ui/input/index.d.ts +118 -0
- package/dist/components/ui/input/index.figma.d.ts +1 -0
- package/dist/components/ui/input/index.figma.js +36 -0
- package/dist/components/ui/input/index.js +256 -0
- package/dist/components/ui/input-password/index.d.ts +27 -0
- package/dist/components/ui/input-password/index.figma.d.ts +1 -0
- package/dist/components/ui/input-password/index.figma.js +36 -0
- package/dist/components/ui/input-password/index.js +35 -0
- package/dist/components/ui/link/index.d.ts +68 -0
- package/dist/components/ui/link/index.figma.d.ts +1 -0
- package/dist/components/ui/link/index.figma.js +22 -0
- package/dist/components/ui/link/index.js +92 -0
- package/dist/components/ui/modal/index.d.ts +83 -0
- package/dist/components/ui/modal/index.figma.d.ts +1 -0
- package/dist/components/ui/modal/index.figma.js +61 -0
- package/dist/components/ui/modal/index.js +143 -0
- package/dist/components/ui/overlay/index.d.ts +19 -0
- package/dist/components/ui/overlay/index.figma.d.ts +1 -0
- package/dist/components/ui/overlay/index.figma.js +14 -0
- package/dist/components/ui/overlay/index.js +39 -0
- package/dist/components/ui/radio/index.d.ts +94 -0
- package/dist/components/ui/radio/index.figma.d.ts +1 -0
- package/dist/components/ui/radio/index.figma.js +63 -0
- package/dist/components/ui/radio/index.js +204 -0
- package/dist/components/ui/select/index.d.ts +175 -0
- package/dist/components/ui/select/index.figma.d.ts +1 -0
- package/dist/components/ui/select/index.figma.js +30 -0
- package/dist/components/ui/select/index.js +281 -0
- package/dist/components/ui/skeleton/index.d.ts +21 -0
- package/dist/components/ui/skeleton/index.figma.d.ts +1 -0
- package/dist/components/ui/skeleton/index.figma.js +14 -0
- package/dist/components/ui/skeleton/index.js +32 -0
- package/dist/components/ui/slider/index.d.ts +75 -0
- package/dist/components/ui/slider/index.figma.d.ts +1 -0
- package/dist/components/ui/slider/index.figma.js +28 -0
- package/dist/components/ui/slider/index.js +113 -0
- package/dist/components/ui/slider/utils.d.ts +16 -0
- package/dist/components/ui/slider/utils.js +56 -0
- package/dist/components/ui/spinner/index.d.ts +42 -0
- package/dist/components/ui/spinner/index.figma.d.ts +1 -0
- package/dist/components/ui/spinner/index.figma.js +16 -0
- package/dist/components/ui/spinner/index.js +51 -0
- package/dist/components/ui/switch/index.d.ts +46 -0
- package/dist/components/ui/switch/index.figma.d.ts +1 -0
- package/dist/components/ui/switch/index.figma.js +27 -0
- package/dist/components/ui/switch/index.js +75 -0
- package/dist/components/ui/tabs/index.d.ts +53 -0
- package/dist/components/ui/tabs/index.figma.d.ts +1 -0
- package/dist/components/ui/tabs/index.figma.js +55 -0
- package/dist/components/ui/tabs/index.js +164 -0
- package/dist/components/ui/tag/index.d.ts +50 -0
- package/dist/components/ui/tag/index.figma.d.ts +1 -0
- package/dist/components/ui/tag/index.figma.js +32 -0
- package/dist/components/ui/tag/index.js +177 -0
- package/dist/components/ui/textarea/index.d.ts +49 -0
- package/dist/components/ui/textarea/index.figma.d.ts +1 -0
- package/dist/components/ui/textarea/index.figma.js +27 -0
- package/dist/components/ui/textarea/index.js +94 -0
- package/dist/components/ui/toast/index.d.ts +60 -0
- package/dist/components/ui/toast/index.figma.d.ts +1 -0
- package/dist/components/ui/toast/index.figma.js +26 -0
- package/dist/components/ui/toast/index.js +57 -0
- package/dist/components/ui/tooltip/index.d.ts +52 -0
- package/dist/components/ui/tooltip/index.figma.d.ts +1 -0
- package/dist/components/ui/tooltip/index.figma.js +23 -0
- package/dist/components/ui/tooltip/index.js +65 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +27 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +5 -0
- package/dist/test/helpers.d.ts +56 -0
- package/dist/test/helpers.js +182 -0
- package/dist/test/setup.d.ts +1 -0
- package/dist/test/setup.js +38 -0
- package/package.json +253 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import figma from "@figma/code-connect";
|
|
3
|
+
import { Radio, RadioItem } 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(Radio, "https://www.figma.com/design/7alBZXZf65YgcII41TWT0r/Sparkle-Design?node-id=2752%3A17458", {
|
|
11
|
+
props: {
|
|
12
|
+
// These props were automatically mapped based on your linked code:
|
|
13
|
+
dir: figma.enum("direction", {
|
|
14
|
+
vertical: "rtl",
|
|
15
|
+
}),
|
|
16
|
+
orientation: figma.enum("direction", {
|
|
17
|
+
horizontal: "horizontal",
|
|
18
|
+
vertical: "vertical",
|
|
19
|
+
}),
|
|
20
|
+
// No matching props could be found for these Figma properties:
|
|
21
|
+
// "units": figma.enum('units', {
|
|
22
|
+
// "2": "2",
|
|
23
|
+
// "3": "3",
|
|
24
|
+
// "4": "4",
|
|
25
|
+
// "5": "5",
|
|
26
|
+
// "6": "6",
|
|
27
|
+
// "7": "7",
|
|
28
|
+
// "8": "8",
|
|
29
|
+
// "9": "9"
|
|
30
|
+
// })
|
|
31
|
+
},
|
|
32
|
+
example: props => _jsx(Radio, { dir: props.dir, orientation: props.orientation }),
|
|
33
|
+
});
|
|
34
|
+
/**
|
|
35
|
+
* -- This file was auto-generated by Code Connect --
|
|
36
|
+
* `props` includes a mapping from your code props to Figma properties.
|
|
37
|
+
* You should check this is correct, and update the `example` function
|
|
38
|
+
* to return the code example you'd like to see in Figma
|
|
39
|
+
*/
|
|
40
|
+
figma.connect(RadioItem, "https://www.figma.com/design/7alBZXZf65YgcII41TWT0r/Sparkle-Design?node-id=176%3A7906", {
|
|
41
|
+
props: {
|
|
42
|
+
// These props were automatically mapped based on your linked code:
|
|
43
|
+
size: figma.enum("size", {
|
|
44
|
+
sm: "sm",
|
|
45
|
+
md: "md",
|
|
46
|
+
lg: "lg",
|
|
47
|
+
}),
|
|
48
|
+
isInvalid: figma.enum("isInvalid", {
|
|
49
|
+
false: false,
|
|
50
|
+
true: true,
|
|
51
|
+
}),
|
|
52
|
+
label: figma.string("label"),
|
|
53
|
+
disabled: figma.enum("state", {
|
|
54
|
+
disabled: true,
|
|
55
|
+
}),
|
|
56
|
+
checked: figma.boolean("isChecked"),
|
|
57
|
+
value: figma.string("label"),
|
|
58
|
+
// No matching props could be found for these Figma properties:
|
|
59
|
+
// "isLabel": figma.boolean('isLabel'),
|
|
60
|
+
// "isFocused": figma.boolean('isFocused')
|
|
61
|
+
},
|
|
62
|
+
example: props => (_jsx(RadioItem, { size: props.size, isInvalid: props.isInvalid, label: props.label, disabled: props.disabled, value: props.value, checked: props.checked })),
|
|
63
|
+
});
|
|
@@ -0,0 +1,204 @@
|
|
|
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 { RadioGroup as RadioPrimitive } from "radix-ui";
|
|
19
|
+
import { cva } from "class-variance-authority";
|
|
20
|
+
import { cn } from "../../../lib/utils.js";
|
|
21
|
+
const labelVariants = cva("cursor-pointer", {
|
|
22
|
+
variants: {
|
|
23
|
+
size: {
|
|
24
|
+
sm: "character-2-regular-pro",
|
|
25
|
+
md: "character-3-regular-pro",
|
|
26
|
+
lg: "character-4-regular-pro",
|
|
27
|
+
},
|
|
28
|
+
isDisabled: {
|
|
29
|
+
true: "text-text-disabled cursor-not-allowed",
|
|
30
|
+
false: "text-text-medium",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
defaultVariants: {
|
|
34
|
+
size: "md",
|
|
35
|
+
isDisabled: false,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
const radioItemVariants = cva([
|
|
39
|
+
"relative rounded-full transition-colors flex items-center justify-center cursor-pointer",
|
|
40
|
+
"focus:outline-none",
|
|
41
|
+
].join(" "), {
|
|
42
|
+
variants: {
|
|
43
|
+
size: {
|
|
44
|
+
sm: "h-8 w-8",
|
|
45
|
+
md: "h-10 w-10",
|
|
46
|
+
lg: "h-12 w-12",
|
|
47
|
+
},
|
|
48
|
+
isDisabled: {
|
|
49
|
+
true: "cursor-not-allowed",
|
|
50
|
+
false: "",
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
defaultVariants: {
|
|
54
|
+
size: "md",
|
|
55
|
+
isDisabled: false,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
const radioIndicatorVariants = cva([
|
|
59
|
+
"flex items-center justify-center rounded-full border border-2 transition-colors",
|
|
60
|
+
"[.group:focus_&]:outline-hidden [.group:focus-visible_&]:ring-2 [.group:focus-visible_&]:ring-[var(--color-ring-normal)] [.group:focus-visible_&]:ring-offset-2",
|
|
61
|
+
].join(" "), {
|
|
62
|
+
variants: {
|
|
63
|
+
size: {
|
|
64
|
+
sm: "h-4 w-4",
|
|
65
|
+
md: "h-5 w-5",
|
|
66
|
+
lg: "h-6 w-6",
|
|
67
|
+
},
|
|
68
|
+
isInvalid: {
|
|
69
|
+
true: "border-negative-500 [.group[data-state=checked]_&]:border-negative-500",
|
|
70
|
+
false: "border-neutral-500",
|
|
71
|
+
},
|
|
72
|
+
isDisabled: {
|
|
73
|
+
true: "",
|
|
74
|
+
false: "",
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
compoundVariants: [
|
|
78
|
+
{
|
|
79
|
+
isDisabled: false,
|
|
80
|
+
isInvalid: false,
|
|
81
|
+
className: "hover:border-neutral-600",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
isDisabled: false,
|
|
85
|
+
isInvalid: true,
|
|
86
|
+
className: "hover:border-negative-600",
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
isDisabled: true,
|
|
90
|
+
isInvalid: false,
|
|
91
|
+
className: "border-neutral-200 [.group[data-state=checked]_&]:border-primary-100",
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
isDisabled: true,
|
|
95
|
+
isInvalid: true,
|
|
96
|
+
className: "border-negative-200 [.group[data-state=checked]_&]:border-negative-200",
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
defaultVariants: {
|
|
100
|
+
size: "md",
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
const radioIndicatorDotVariants = cva("rounded-full transition-colors flex items-center justify-center shrink-0", {
|
|
104
|
+
variants: {
|
|
105
|
+
size: {
|
|
106
|
+
sm: "h-4 w-4",
|
|
107
|
+
md: "h-5 w-5",
|
|
108
|
+
lg: "h-6 w-6",
|
|
109
|
+
},
|
|
110
|
+
isInvalid: {
|
|
111
|
+
true: "[.group[data-state=checked]_&]:bg-negative-500",
|
|
112
|
+
false: "[.group[data-state=checked]_&]:bg-primary-500",
|
|
113
|
+
},
|
|
114
|
+
isDisabled: {
|
|
115
|
+
true: "",
|
|
116
|
+
false: "",
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
compoundVariants: [
|
|
120
|
+
{
|
|
121
|
+
isDisabled: false,
|
|
122
|
+
isInvalid: false,
|
|
123
|
+
className: "[.group[data-state=checked]_&]:hover:bg-primary-600",
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
isDisabled: false,
|
|
127
|
+
isInvalid: true,
|
|
128
|
+
className: "[.group[data-state=checked]_&]:hover:bg-negative-600",
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
isDisabled: true,
|
|
132
|
+
isInvalid: false,
|
|
133
|
+
className: "[.group[data-state=checked]_&]:bg-primary-100",
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
isDisabled: true,
|
|
137
|
+
isInvalid: true,
|
|
138
|
+
className: "[.group[data-state=checked]_&]:bg-negative-200",
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
defaultVariants: {
|
|
142
|
+
size: "md",
|
|
143
|
+
isInvalid: false,
|
|
144
|
+
isDisabled: false,
|
|
145
|
+
},
|
|
146
|
+
});
|
|
147
|
+
const radioIndicatorDotInnerVariants = cva("rounded-full bg-white", {
|
|
148
|
+
variants: {
|
|
149
|
+
size: {
|
|
150
|
+
sm: "h-2 w-2",
|
|
151
|
+
md: "h-2.5 w-2.5",
|
|
152
|
+
lg: "h-3 w-3",
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
defaultVariants: {
|
|
156
|
+
size: "md",
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
/**
|
|
160
|
+
* **概要 / Overview**
|
|
161
|
+
*
|
|
162
|
+
* - ラジオボタンは単一選択の形式でユーザーからの入力を取得するために使用するコンポーネントです。
|
|
163
|
+
* - en: The Radio component is used to select one option from multiple choices.
|
|
164
|
+
*
|
|
165
|
+
* **使用例 / Usage Example**
|
|
166
|
+
*
|
|
167
|
+
* ```tsx
|
|
168
|
+
* <Radio value="option1" onValueChange={setValue}>
|
|
169
|
+
* <RadioItem value="option1" label="オプション1" />
|
|
170
|
+
* <RadioItem value="option2" label="オプション2" />
|
|
171
|
+
* </Radio>
|
|
172
|
+
* ```
|
|
173
|
+
*
|
|
174
|
+
* @param {RadioProps} props
|
|
175
|
+
*/
|
|
176
|
+
function Radio(_a) {
|
|
177
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
178
|
+
return (_jsx(RadioPrimitive.Root, Object.assign({ "data-slot": "radio-group", className: cn("grid gap-y-2 gap-x-4", className) }, props)));
|
|
179
|
+
}
|
|
180
|
+
Radio.displayName = RadioPrimitive.Root.displayName;
|
|
181
|
+
/**
|
|
182
|
+
* **概要 / Overview**
|
|
183
|
+
*
|
|
184
|
+
* - ラジオボタンのアイテムコンポーネントです。
|
|
185
|
+
* - en: Individual radio button item component.
|
|
186
|
+
*
|
|
187
|
+
* **使用例 / Usage Example**
|
|
188
|
+
*
|
|
189
|
+
* ```tsx
|
|
190
|
+
* <RadioItem value="option1" label="オプション1" size="md" />
|
|
191
|
+
* ```
|
|
192
|
+
*
|
|
193
|
+
* @param {RadioItemProps} props
|
|
194
|
+
*/
|
|
195
|
+
function RadioItem(_a) {
|
|
196
|
+
var { className, size = "md", isInvalid = false, disabled = false, label, id } = _a, props = __rest(_a, ["className", "size", "isInvalid", "disabled", "label", "id"]);
|
|
197
|
+
return (_jsxs("div", { className: "flex items-center", children: [_jsx(RadioPrimitive.Item, Object.assign({ "data-slot": "radio-group-item", id: id, className: cn(radioItemVariants({ size, isDisabled: disabled }), "group", className), disabled: disabled }, props, { children: _jsx("div", { className: cn(radioIndicatorVariants({ size, isInvalid, isDisabled: disabled })), children: _jsx(RadioPrimitive.Indicator, { "data-slot": "radio-group-indicator", className: cn(radioIndicatorDotVariants({
|
|
198
|
+
size,
|
|
199
|
+
isInvalid,
|
|
200
|
+
isDisabled: disabled,
|
|
201
|
+
})), children: _jsx("div", { className: cn(radioIndicatorDotInnerVariants({ size })) }) }) }) })), label && (_jsx("label", { htmlFor: id, className: cn(labelVariants({ size, isDisabled: disabled })), children: label }))] }));
|
|
202
|
+
}
|
|
203
|
+
RadioItem.displayName = RadioPrimitive.Item.displayName;
|
|
204
|
+
export { Radio, RadioItem };
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Select as SelectPrimitive } from "radix-ui";
|
|
3
|
+
import { VariantProps } from "class-variance-authority";
|
|
4
|
+
declare const selectTriggerVariants: (props?: ({
|
|
5
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
6
|
+
isInvalid?: boolean | null | undefined;
|
|
7
|
+
isDisabled?: boolean | null | undefined;
|
|
8
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
|
+
/**
|
|
10
|
+
* **概要 / Overview**
|
|
11
|
+
*
|
|
12
|
+
* - セレクトはオプショングループの中から値を選択する形式でユーザーからの入力を取得するために使用するコンポーネントです。
|
|
13
|
+
* - en: The Select component is used to capture user input by selecting a value from a group of options.
|
|
14
|
+
*
|
|
15
|
+
* **アンチパターン / Anti-patterns**
|
|
16
|
+
*
|
|
17
|
+
* - `SelectTrigger` と横並びの Button は原則同じサイズにしてください。デフォルトの `SelectTrigger` に対しては `Button size="md"` を使ってください。
|
|
18
|
+
* en: Keep Button size aligned when placing it next to `SelectTrigger`. Use `Button size="md"` with the default `SelectTrigger` size.
|
|
19
|
+
*
|
|
20
|
+
* ```tsx
|
|
21
|
+
* // ✅ Correct
|
|
22
|
+
* <div className="flex gap-2">
|
|
23
|
+
* <Select>
|
|
24
|
+
* <SelectTrigger size="md" className="w-60">
|
|
25
|
+
* <SelectValue placeholder="選択してください" />
|
|
26
|
+
* </SelectTrigger>
|
|
27
|
+
* </Select>
|
|
28
|
+
* <Button size="md">追加</Button>
|
|
29
|
+
* </div>
|
|
30
|
+
*
|
|
31
|
+
* // ❌ Wrong - 高さが揃わないサイズ不一致
|
|
32
|
+
* <div className="flex gap-2">
|
|
33
|
+
* <Select>
|
|
34
|
+
* <SelectTrigger size="md" className="w-60">
|
|
35
|
+
* <SelectValue placeholder="選択してください" />
|
|
36
|
+
* </SelectTrigger>
|
|
37
|
+
* </Select>
|
|
38
|
+
* <Button size="sm">追加</Button>
|
|
39
|
+
* </div>
|
|
40
|
+
* ```
|
|
41
|
+
|
|
42
|
+
* **使用例 / Usage Example**
|
|
43
|
+
*
|
|
44
|
+
* ```tsx
|
|
45
|
+
* <Select>
|
|
46
|
+
* <SelectTrigger size="md">
|
|
47
|
+
* <SelectValue placeholder="選択してください" />
|
|
48
|
+
* </SelectTrigger>
|
|
49
|
+
* <SelectContent>
|
|
50
|
+
* <SelectItem value="option1">オプション1</SelectItem>
|
|
51
|
+
* <SelectItem value="option2">オプション2</SelectItem>
|
|
52
|
+
* </SelectContent>
|
|
53
|
+
* </Select>
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @param {React.ComponentProps<typeof SelectPrimitive.Root>} props
|
|
57
|
+
*/
|
|
58
|
+
declare function Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
59
|
+
declare function SelectGroup({ ...props }: React.ComponentProps<typeof SelectPrimitive.Group>): import("react/jsx-runtime").JSX.Element;
|
|
60
|
+
declare function SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>): import("react/jsx-runtime").JSX.Element;
|
|
61
|
+
type SelectTriggerVariantProps = VariantProps<typeof selectTriggerVariants>;
|
|
62
|
+
export interface SelectTriggerProps extends React.ComponentProps<typeof SelectPrimitive.Trigger> {
|
|
63
|
+
/**
|
|
64
|
+
* セレクトトリガーのサイズバリエーション
|
|
65
|
+
* en: Size variation of the select trigger
|
|
66
|
+
*/
|
|
67
|
+
size?: SelectTriggerVariantProps["size"];
|
|
68
|
+
/**
|
|
69
|
+
* セレクトトリガーのエラー状態
|
|
70
|
+
* en: Error state of the select trigger
|
|
71
|
+
*/
|
|
72
|
+
isInvalid?: SelectTriggerVariantProps["isInvalid"];
|
|
73
|
+
/**
|
|
74
|
+
* セレクトトリガーの無効化状態
|
|
75
|
+
* en: Disabled state of the select trigger
|
|
76
|
+
*/
|
|
77
|
+
disabled?: boolean;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* **概要 / Overview**
|
|
81
|
+
*
|
|
82
|
+
* - セレクトのトリガー部分で、クリックで選択肢リストを開閉するボタンとして機能します。
|
|
83
|
+
* - en: The trigger part of the select that functions as a button to open/close the option list when clicked.
|
|
84
|
+
*
|
|
85
|
+
* @param {SelectTriggerProps} props
|
|
86
|
+
*/
|
|
87
|
+
declare function SelectTrigger({ className, size, children, isInvalid, disabled, ...props }: SelectTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
88
|
+
/**
|
|
89
|
+
* **概要 / Overview**
|
|
90
|
+
*
|
|
91
|
+
* - セレクトのドロップダウンリスト本体で、選択肢リストの表示・スクロール制御を行います。
|
|
92
|
+
* - en: The main dropdown list body of the select that handles display and scroll control of option lists.
|
|
93
|
+
*
|
|
94
|
+
* **使用例 / Usage Example**
|
|
95
|
+
*
|
|
96
|
+
* ```tsx
|
|
97
|
+
* <SelectContent>
|
|
98
|
+
* <SelectItem value="option1">オプション1</SelectItem>
|
|
99
|
+
* </SelectContent>
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
declare function SelectContent({ className, children, position, ...props }: React.ComponentProps<typeof SelectPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
|
|
103
|
+
/**
|
|
104
|
+
* **概要 / Overview**
|
|
105
|
+
*
|
|
106
|
+
* - セレクトのラベル部分で、グループ化された選択肢のラベル表示に使います。
|
|
107
|
+
* - en: The label part of the select used to display labels for grouped options.
|
|
108
|
+
*
|
|
109
|
+
* **使用例 / Usage Example**
|
|
110
|
+
*
|
|
111
|
+
* ```tsx
|
|
112
|
+
* <SelectLabel>カテゴリー</SelectLabel>
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
declare function SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>): import("react/jsx-runtime").JSX.Element;
|
|
116
|
+
export interface SelectItemProps extends React.ComponentProps<typeof SelectPrimitive.Item> {
|
|
117
|
+
/**
|
|
118
|
+
* 選択肢テキスト部分に適用するクラス名
|
|
119
|
+
* en: Class name applied to the selectable item text area
|
|
120
|
+
*/
|
|
121
|
+
textClassName?: string;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* **概要 / Overview**
|
|
125
|
+
*
|
|
126
|
+
* - セレクトの各選択肢アイテムで、選択可能なリスト項目として機能します。
|
|
127
|
+
* - en: Each selectable item in the select that functions as a selectable list item.
|
|
128
|
+
*
|
|
129
|
+
* **使用例 / Usage Example**
|
|
130
|
+
*
|
|
131
|
+
* ```tsx
|
|
132
|
+
* <SelectItem value="option1">オプション1</SelectItem>
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
declare function SelectItem({ className, children, textClassName, ...props }: SelectItemProps): import("react/jsx-runtime").JSX.Element;
|
|
136
|
+
/**
|
|
137
|
+
* **概要 / Overview**
|
|
138
|
+
*
|
|
139
|
+
* - セレクトの区切り線で、選択肢リスト内の区切り表示に使います。
|
|
140
|
+
* - en: The separator line in the select used to display divisions within the option list.
|
|
141
|
+
*
|
|
142
|
+
* **使用例 / Usage Example**
|
|
143
|
+
*
|
|
144
|
+
* ```tsx
|
|
145
|
+
* <SelectSeparator />
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
declare function SelectSeparator({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Separator>): import("react/jsx-runtime").JSX.Element;
|
|
149
|
+
/**
|
|
150
|
+
* **概要 / Overview**
|
|
151
|
+
*
|
|
152
|
+
* - セレクトの上スクロールボタンで、選択肢が多い場合にリストを上方向にスクロールします。
|
|
153
|
+
* - en: The up scroll button of the select that scrolls the list upward when there are many options.
|
|
154
|
+
*
|
|
155
|
+
* **使用例 / Usage Example**
|
|
156
|
+
*
|
|
157
|
+
* ```tsx
|
|
158
|
+
* <SelectScrollUpButton />
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
declare function SelectScrollUpButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>): import("react/jsx-runtime").JSX.Element;
|
|
162
|
+
/**
|
|
163
|
+
* **概要 / Overview**
|
|
164
|
+
*
|
|
165
|
+
* - セレクトの下スクロールボタンで、選択肢が多い場合にリストを下方向にスクロールします。
|
|
166
|
+
* - en: The down scroll button of the select that scrolls the list downward when there are many options.
|
|
167
|
+
*
|
|
168
|
+
* **使用例 / Usage Example**
|
|
169
|
+
*
|
|
170
|
+
* ```tsx
|
|
171
|
+
* <SelectScrollDownButton />
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
declare function SelectScrollDownButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>): import("react/jsx-runtime").JSX.Element;
|
|
175
|
+
export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, SelectScrollUpButton, SelectScrollDownButton, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import figma from "@figma/code-connect";
|
|
3
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } 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(SelectTrigger, "https://www.figma.com/design/7alBZXZf65YgcII41TWT0r/Sparkle-Design?node-id=139%3A22300", {
|
|
11
|
+
props: {
|
|
12
|
+
// These props were automatically mapped based on your linked code:
|
|
13
|
+
size: figma.enum("size", {
|
|
14
|
+
sm: "sm",
|
|
15
|
+
md: "md",
|
|
16
|
+
lg: "lg",
|
|
17
|
+
}),
|
|
18
|
+
isInvalid: figma.enum("isInvalid", {
|
|
19
|
+
false: false,
|
|
20
|
+
true: true,
|
|
21
|
+
}),
|
|
22
|
+
disabled: figma.enum("state", {
|
|
23
|
+
disabled: true,
|
|
24
|
+
}),
|
|
25
|
+
// No matching props could be found for these Figma properties:
|
|
26
|
+
// "isFocused": figma.boolean('isFocused'),
|
|
27
|
+
value: figma.string("value"),
|
|
28
|
+
},
|
|
29
|
+
example: props => (_jsxs(Select, { children: [_jsx(SelectTrigger, { size: props.size, isInvalid: props.isInvalid, disabled: props.disabled, children: _jsx(SelectValue, { placeholder: props.value }) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "option1", children: "Option 1" }), _jsx(SelectItem, { value: "option2", children: "Option 2" }), _jsx(SelectItem, { value: "option3", children: "Option 3" })] })] })),
|
|
30
|
+
});
|