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,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Goodpatch Inc.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import React from "react";
|
|
6
|
+
import { type IconSize } from "@/components/ui/icon";
|
|
7
|
+
export interface SpinnerProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
8
|
+
/**
|
|
9
|
+
* スピナーのサイズ(スケール値 1-12)
|
|
10
|
+
* en: Size of the spinner (scale value 1-12)
|
|
11
|
+
* @see IconSize
|
|
12
|
+
*/
|
|
13
|
+
size?: IconSize;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* **概要 / Overview**
|
|
17
|
+
*
|
|
18
|
+
* - スピナーはダウンロード、アップロードなどのシステムによる処理の進行状況を視覚的に提示するために使用するコンポーネントです。
|
|
19
|
+
* - en: The Spinner component is used to visually present the progress of system processing such as downloads and uploads.
|
|
20
|
+
*
|
|
21
|
+
* **アンチパターン / Anti-patterns**
|
|
22
|
+
*
|
|
23
|
+
* - `size` にピクセル値(24, 32 など)を渡さないでください。スケール値(1-12)を使用してください。
|
|
24
|
+
* en: Do not pass pixel values to `size`. Use scale values (1-12) instead.
|
|
25
|
+
*
|
|
26
|
+
* ```tsx
|
|
27
|
+
* // ✅ Correct - スケール値
|
|
28
|
+
* <Spinner size={6} />
|
|
29
|
+
*
|
|
30
|
+
* // ❌ Wrong - ピクセル値
|
|
31
|
+
* <Spinner size={24} />
|
|
32
|
+
* ```
|
|
33
|
+
|
|
34
|
+
* **使用例 / Usage Example**
|
|
35
|
+
*
|
|
36
|
+
* ```tsx
|
|
37
|
+
* <Spinner size={6} />
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @param {SpinnerProps} props
|
|
41
|
+
*/
|
|
42
|
+
export declare const Spinner: React.ForwardRefExoticComponent<SpinnerProps & React.RefAttributes<HTMLSpanElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import figma from "@figma/code-connect";
|
|
3
|
+
import { Spinner } 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(Spinner, "https://www.figma.com/design/7alBZXZf65YgcII41TWT0r/Sparkle-Design?node-id=1057%3A9546", {
|
|
12
|
+
props: {
|
|
13
|
+
size: 6,
|
|
14
|
+
},
|
|
15
|
+
example: props => _jsx(Spinner, { size: props.size }),
|
|
16
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
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 } 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 { cn } from "../../../lib/utils.js";
|
|
19
|
+
import { Icon } from "../../../components/ui/icon/index.js";
|
|
20
|
+
/**
|
|
21
|
+
* **概要 / Overview**
|
|
22
|
+
*
|
|
23
|
+
* - スピナーはダウンロード、アップロードなどのシステムによる処理の進行状況を視覚的に提示するために使用するコンポーネントです。
|
|
24
|
+
* - en: The Spinner component is used to visually present the progress of system processing such as downloads and uploads.
|
|
25
|
+
*
|
|
26
|
+
* **アンチパターン / Anti-patterns**
|
|
27
|
+
*
|
|
28
|
+
* - `size` にピクセル値(24, 32 など)を渡さないでください。スケール値(1-12)を使用してください。
|
|
29
|
+
* en: Do not pass pixel values to `size`. Use scale values (1-12) instead.
|
|
30
|
+
*
|
|
31
|
+
* ```tsx
|
|
32
|
+
* // ✅ Correct - スケール値
|
|
33
|
+
* <Spinner size={6} />
|
|
34
|
+
*
|
|
35
|
+
* // ❌ Wrong - ピクセル値
|
|
36
|
+
* <Spinner size={24} />
|
|
37
|
+
* ```
|
|
38
|
+
|
|
39
|
+
* **使用例 / Usage Example**
|
|
40
|
+
*
|
|
41
|
+
* ```tsx
|
|
42
|
+
* <Spinner size={6} />
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @param {SpinnerProps} props
|
|
46
|
+
*/
|
|
47
|
+
export const Spinner = React.forwardRef((_a, ref) => {
|
|
48
|
+
var { className, size } = _a, props = __rest(_a, ["className", "size"]);
|
|
49
|
+
return (_jsx("span", Object.assign({ ref: ref, className: cn("inline-flex items-center justify-center"), role: "status", "aria-label": "\u8AAD\u307F\u8FBC\u307F\u4E2D", "data-testid": "loading-spinner" }, props, { children: _jsx(Icon, { icon: "progress_activity", size: size, className: cn("animate-spin text-text-low", className) }) })));
|
|
50
|
+
});
|
|
51
|
+
Spinner.displayName = "Spinner";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Switch as SwitchPrimitive } from "radix-ui";
|
|
3
|
+
import { VariantProps } from "class-variance-authority";
|
|
4
|
+
declare const switchVariants: (props?: ({
|
|
5
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
type SwitchVariants = VariantProps<typeof switchVariants>;
|
|
8
|
+
type ReactSwitchProps = React.ComponentProps<typeof SwitchPrimitive.Root>;
|
|
9
|
+
export interface SwitchProps extends ReactSwitchProps {
|
|
10
|
+
/**
|
|
11
|
+
* スイッチのサイズ(sm、md、lg)
|
|
12
|
+
* en: Switch size (sm, md, lg)
|
|
13
|
+
*/
|
|
14
|
+
size?: SwitchVariants["size"];
|
|
15
|
+
/**
|
|
16
|
+
* スイッチを無効状態にするかどうか
|
|
17
|
+
* en: Whether to disable the switch
|
|
18
|
+
*/
|
|
19
|
+
disabled?: ReactSwitchProps["disabled"];
|
|
20
|
+
/**
|
|
21
|
+
* スイッチをオン状態(チェック状態)にするかどうか
|
|
22
|
+
* en: Whether to make the switch checked (on)
|
|
23
|
+
*/
|
|
24
|
+
checked?: ReactSwitchProps["checked"];
|
|
25
|
+
/**
|
|
26
|
+
* スイッチの状態が変更されたときに呼び出されるコールバック関数
|
|
27
|
+
* en: Callback function called when the switch state changes
|
|
28
|
+
*/
|
|
29
|
+
onCheckedChange?: ReactSwitchProps["onCheckedChange"];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* **概要 / Overview**
|
|
33
|
+
*
|
|
34
|
+
* - スイッチは設定のオンとオフを切り替えるために使用するコンポーネントです。
|
|
35
|
+
* - en: The Switch component is used to toggle settings on and off.
|
|
36
|
+
*
|
|
37
|
+
* **使用例 / Usage Example**
|
|
38
|
+
*
|
|
39
|
+
* ```tsx
|
|
40
|
+
* <Switch size="md" checked={isEnabled} onCheckedChange={setIsEnabled} />
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @param {SwitchProps} props
|
|
44
|
+
*/
|
|
45
|
+
declare function Switch({ className, size, ...props }: SwitchProps): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
export { Switch };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import figma from "@figma/code-connect";
|
|
3
|
+
import { Switch } 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(Switch, "https://www.figma.com/design/7alBZXZf65YgcII41TWT0r/Sparkle-Design?node-id=1075%3A22224", {
|
|
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
|
+
disabled: figma.enum("state", {
|
|
19
|
+
disabled: true,
|
|
20
|
+
}),
|
|
21
|
+
checked: figma.boolean("isChecked"),
|
|
22
|
+
defaultChecked: figma.boolean("isChecked"),
|
|
23
|
+
// No matching props could be found for these Figma properties:
|
|
24
|
+
// "isFocused": figma.boolean('isFocused')
|
|
25
|
+
},
|
|
26
|
+
example: props => (_jsx(Switch, { size: props.size, disabled: props.disabled, checked: props.checked, defaultChecked: props.defaultChecked })),
|
|
27
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
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 { Switch as SwitchPrimitive } from "radix-ui";
|
|
19
|
+
import { cn } from "../../../lib/utils.js";
|
|
20
|
+
import { cva } from "class-variance-authority";
|
|
21
|
+
const switchVariants = cva([
|
|
22
|
+
"relative peer inline-flex shrink-0 cursor-pointer items-center rounded-full border transition-colors",
|
|
23
|
+
"focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-[var(--color-ring-normal)] focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
24
|
+
"data-[state=unchecked]:bg-neutral-500 data-[state=unchecked]:border-neutral-600 data-[state=unchecked]:hover:bg-neutral-600 data-[state=unchecked]:hover:border-neutral-700",
|
|
25
|
+
"data-[state=checked]:bg-primary-500 data-[state=checked]:border-primary-600 data-[state=checked]:hover:bg-primary-600 data-[state=checked]:hover:border-primary-700",
|
|
26
|
+
"disabled:cursor-not-allowed disabled:data-[state=unchecked]:bg-neutral-100 disabled:data-[state=unchecked]:border-transparent disabled:data-[state=checked]:bg-primary-200 disabled:data-[state=checked]:border-transparent",
|
|
27
|
+
].join(" "), {
|
|
28
|
+
variants: {
|
|
29
|
+
size: {
|
|
30
|
+
// smサイズのタッチターゲットを24px以上に拡張(WCAG 2.5.8)
|
|
31
|
+
// en: Expand sm size touch target to 24px minimum (WCAG 2.5.8)
|
|
32
|
+
sm: "h-4 w-7 p-px before:absolute before:content-[''] before:left-0 before:top-1/2 before:-translate-y-1/2 before:w-full before:min-h-6",
|
|
33
|
+
md: "h-6 w-11 p-px",
|
|
34
|
+
lg: "h-8 w-[60px] p-px",
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
defaultVariants: {
|
|
38
|
+
size: "md",
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
const thumbVariants = cva("pointer-events-none block rounded-full bg-white shadow-raise ring-0 transition-transform bg-white", {
|
|
42
|
+
variants: {
|
|
43
|
+
size: {
|
|
44
|
+
sm: "h-3 w-3 data-[state=checked]:translate-x-3 data-[state=unchecked]:translate-x-0",
|
|
45
|
+
md: "h-5 w-5 data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0",
|
|
46
|
+
lg: "h-7 w-7 data-[state=checked]:translate-x-7 data-[state=unchecked]:translate-x-0",
|
|
47
|
+
},
|
|
48
|
+
disabled: {
|
|
49
|
+
true: "data-[state=unchecked]:bg-neutral-50 data-[state=checked]:bg-primary-50",
|
|
50
|
+
false: "",
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
defaultVariants: {
|
|
54
|
+
size: "md",
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
/**
|
|
58
|
+
* **概要 / Overview**
|
|
59
|
+
*
|
|
60
|
+
* - スイッチは設定のオンとオフを切り替えるために使用するコンポーネントです。
|
|
61
|
+
* - en: The Switch component is used to toggle settings on and off.
|
|
62
|
+
*
|
|
63
|
+
* **使用例 / Usage Example**
|
|
64
|
+
*
|
|
65
|
+
* ```tsx
|
|
66
|
+
* <Switch size="md" checked={isEnabled} onCheckedChange={setIsEnabled} />
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* @param {SwitchProps} props
|
|
70
|
+
*/
|
|
71
|
+
function Switch(_a) {
|
|
72
|
+
var { className, size } = _a, props = __rest(_a, ["className", "size"]);
|
|
73
|
+
return (_jsx(SwitchPrimitive.Root, Object.assign({ "data-slot": "switch", className: cn(switchVariants({ size }), className) }, props, { children: _jsx(SwitchPrimitive.Thumb, { "data-slot": "switch-thumb", className: cn(thumbVariants({ size, disabled: props.disabled })) }) })));
|
|
74
|
+
}
|
|
75
|
+
export { Switch };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Tabs as TabsPrimitive } from "radix-ui";
|
|
3
|
+
import { type VariantProps } from "class-variance-authority";
|
|
4
|
+
/**
|
|
5
|
+
* TabsTriggerのバリアント定義
|
|
6
|
+
* en: Variant definitions for TabsTrigger
|
|
7
|
+
*/
|
|
8
|
+
declare const tabsTriggerVariants: (props?: ({
|
|
9
|
+
variant?: "line" | "solid" | "ghost" | null | undefined;
|
|
10
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
11
|
+
type TabsTriggerVariants = VariantProps<typeof tabsTriggerVariants>;
|
|
12
|
+
declare const tabsListVariants: (props?: ({
|
|
13
|
+
variant?: "line" | "solid" | "ghost" | null | undefined;
|
|
14
|
+
scrollable?: boolean | null | undefined;
|
|
15
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
16
|
+
type TabsListVariants = VariantProps<typeof tabsListVariants>;
|
|
17
|
+
/**
|
|
18
|
+
* **概要 / Overview**
|
|
19
|
+
*
|
|
20
|
+
* - タブはユーザーが扱う情報をシンプルに保つためのディスクロージャーとして使用するコンポーネントです。
|
|
21
|
+
* - en: Tabs component is used as a disclosure to keep user-handled information simple.
|
|
22
|
+
*
|
|
23
|
+
* **使用例 / Usage Example**
|
|
24
|
+
*
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <Tabs defaultValue="account">
|
|
27
|
+
* <TabsList variant="solid">
|
|
28
|
+
* <TabsTrigger value="account">Account</TabsTrigger>
|
|
29
|
+
* <TabsTrigger value="password">Password</TabsTrigger>
|
|
30
|
+
* </TabsList>
|
|
31
|
+
* <TabsContent value="account">Account Content</TabsContent>
|
|
32
|
+
* <TabsContent value="password">Password Content</TabsContent>
|
|
33
|
+
* </Tabs>
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @param {React.ComponentProps<typeof TabsPrimitive.Root>} props
|
|
37
|
+
*/
|
|
38
|
+
declare function Tabs({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
declare function TabsList({ className, variant, scrollable, ...props }: React.ComponentProps<typeof TabsPrimitive.List> & TabsListVariants): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
/**
|
|
41
|
+
* タブトリガー(タブボタン)
|
|
42
|
+
* en: Tab trigger (tab button)
|
|
43
|
+
*
|
|
44
|
+
* @param {TabsTriggerProps} props
|
|
45
|
+
*/
|
|
46
|
+
declare const TabsTrigger: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & TabsTriggerVariants & React.RefAttributes<HTMLButtonElement>>;
|
|
47
|
+
/**
|
|
48
|
+
* タブの内容表示エリア
|
|
49
|
+
* en: Tab content display area
|
|
50
|
+
*/
|
|
51
|
+
declare function TabsContent({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
|
|
52
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent };
|
|
53
|
+
export type { TabsListVariants };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import figma from "@figma/code-connect";
|
|
3
|
+
import { TabsList, TabsTrigger } 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(TabsList, "https://www.figma.com/design/7alBZXZf65YgcII41TWT0r/Sparkle-Design?node-id=234%3A3639", {
|
|
11
|
+
props: {
|
|
12
|
+
// These props were automatically mapped based on your linked code:
|
|
13
|
+
variant: figma.enum("variant", {
|
|
14
|
+
solid: "solid",
|
|
15
|
+
line: "line",
|
|
16
|
+
ghost: "ghost",
|
|
17
|
+
}),
|
|
18
|
+
// No matching props could be found for these Figma properties:
|
|
19
|
+
// "units": figma.enum('units', {
|
|
20
|
+
// "2": "2",
|
|
21
|
+
// "3": "3",
|
|
22
|
+
// "4": "4",
|
|
23
|
+
// "5": "5",
|
|
24
|
+
// "6": "6",
|
|
25
|
+
// "7": "7",
|
|
26
|
+
// "8": "8",
|
|
27
|
+
// "9": "9"
|
|
28
|
+
// })
|
|
29
|
+
},
|
|
30
|
+
example: props => _jsx(TabsList, { variant: props.variant }),
|
|
31
|
+
});
|
|
32
|
+
/**
|
|
33
|
+
* -- This file was auto-generated by Code Connect --
|
|
34
|
+
* `props` includes a mapping from your code props to Figma properties.
|
|
35
|
+
* You should check this is correct, and update the `example` function
|
|
36
|
+
* to return the code example you'd like to see in Figma
|
|
37
|
+
*/
|
|
38
|
+
figma.connect(TabsTrigger, "https://www.figma.com/design/7alBZXZf65YgcII41TWT0r/Sparkle-Design?node-id=234%3A3608", {
|
|
39
|
+
props: {
|
|
40
|
+
// These props were automatically mapped based on your linked code:
|
|
41
|
+
disabled: figma.enum("state", {
|
|
42
|
+
disabled: true,
|
|
43
|
+
}),
|
|
44
|
+
label: figma.string("label"),
|
|
45
|
+
variant: figma.enum("variant", {
|
|
46
|
+
line: "line",
|
|
47
|
+
solid: "solid",
|
|
48
|
+
ghost: "ghost",
|
|
49
|
+
}),
|
|
50
|
+
// No matching props could be found for these Figma properties:
|
|
51
|
+
// "label": figma.string('label'),
|
|
52
|
+
// "isSelected": figma.boolean('isSelected')
|
|
53
|
+
},
|
|
54
|
+
example: props => (_jsx(TabsTrigger, { disabled: props.disabled, value: props.label, variant: props.variant, children: props.label })),
|
|
55
|
+
});
|
|
@@ -0,0 +1,164 @@
|
|
|
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 { Tabs as TabsPrimitive } from "radix-ui";
|
|
20
|
+
import { cva } from "class-variance-authority";
|
|
21
|
+
import { cn } from "../../../lib/utils.js";
|
|
22
|
+
import { createContext, useContext } from "react";
|
|
23
|
+
const TabsListVariantContext = createContext(undefined);
|
|
24
|
+
/**
|
|
25
|
+
* TabsTriggerのバリアント定義
|
|
26
|
+
* en: Variant definitions for TabsTrigger
|
|
27
|
+
*/
|
|
28
|
+
const tabsTriggerVariants = cva([
|
|
29
|
+
"inline-flex items-center justify-center gap-1.5 whitespace-nowrap transition-colors duration-150 cursor-pointer disabled:cursor-not-allowed",
|
|
30
|
+
"px-3 py-2 character-3-regular-pro",
|
|
31
|
+
"focus-visible:outline-none",
|
|
32
|
+
], {
|
|
33
|
+
variants: {
|
|
34
|
+
variant: {
|
|
35
|
+
solid: [
|
|
36
|
+
"rounded-t-md",
|
|
37
|
+
// active
|
|
38
|
+
"data-[state=active]:bg-primary-500",
|
|
39
|
+
"data-[state=active]:text-white",
|
|
40
|
+
"hover:data-[state=active]:bg-primary-600",
|
|
41
|
+
"focus-visible:outline-none focus-visible:data-[state=active]:bg-primary-700",
|
|
42
|
+
// inactive
|
|
43
|
+
"data-[state=inactive]:bg-transparent",
|
|
44
|
+
"data-[state=inactive]:text-neutral-700",
|
|
45
|
+
"enabled:hover:data-[state=inactive]:bg-neutral-50",
|
|
46
|
+
"focus-visible:outline-none focus-visible:data-[state=inactive]:bg-neutral-100",
|
|
47
|
+
"focus-visible:data-[state=inactive]:text-primary-700",
|
|
48
|
+
// disabled
|
|
49
|
+
"disabled:data-[state=inactive]:text-neutral-200",
|
|
50
|
+
].join(" "),
|
|
51
|
+
line: [
|
|
52
|
+
"relative rounded-none border-none z-10 focus-visible:outline-none",
|
|
53
|
+
"after:content-[''] after:absolute after:left-0 after:right-0 after:bottom-[-2px] after:h-0.5 after:rounded after:pointer-events-none after:z-10",
|
|
54
|
+
// active
|
|
55
|
+
"data-[state=active]:text-primary-500",
|
|
56
|
+
"data-[state=active]:after:bg-primary-500",
|
|
57
|
+
"data-[state=active]:after:h-0.5",
|
|
58
|
+
// inactive
|
|
59
|
+
"data-[state=inactive]:text-neutral-500",
|
|
60
|
+
"data-[state=inactive]:after:bg-transparent",
|
|
61
|
+
// hover (inactive, not disabled)
|
|
62
|
+
"enabled:hover:data-[state=inactive]:bg-neutral-50",
|
|
63
|
+
"focus-visible:outline-none focus-visible:data-[state=active]:bg-neutral-100",
|
|
64
|
+
"focus-visible:data-[state=active]:text-primary-700",
|
|
65
|
+
"focus-visible:data-[state=inactive]:text-primary-700",
|
|
66
|
+
// disabled
|
|
67
|
+
"disabled:data-[state=active]:text-neutral-200",
|
|
68
|
+
"disabled:data-[state=inactive]:text-neutral-200",
|
|
69
|
+
].join(" "),
|
|
70
|
+
ghost: [
|
|
71
|
+
"rounded-t-md border-x border-t border-b-0 border-transparent text-text-middle",
|
|
72
|
+
// active
|
|
73
|
+
"data-[state=active]:text-text-high",
|
|
74
|
+
"data-[state=active]:border-divider-middle",
|
|
75
|
+
"hover:data-[state=active]:bg-neutral-50",
|
|
76
|
+
"data-[state=active]:rounded-t-md",
|
|
77
|
+
"focus-visible:outline-none focus-visible:data-[state=active]:bg-neutral-200",
|
|
78
|
+
// inactive
|
|
79
|
+
"data-[state=inactive]:text-neutral-500",
|
|
80
|
+
"enabled:hover:data-[state=inactive]:bg-neutral-50",
|
|
81
|
+
"focus-visible:outline-none focus-visible:data-[state=inactive]:bg-neutral-100",
|
|
82
|
+
"focus-visible:data-[state=inactive]:text-primary-700",
|
|
83
|
+
// disabled
|
|
84
|
+
"disabled:data-[state=active]:text-neutral-200",
|
|
85
|
+
"disabled:data-[state=inactive]:text-neutral-200",
|
|
86
|
+
].join(" "),
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
defaultVariants: {
|
|
90
|
+
variant: "solid",
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
const tabsListVariants = cva(["relative inline-flex items-center"], {
|
|
94
|
+
variants: {
|
|
95
|
+
variant: {
|
|
96
|
+
solid: "border-b-2 border-b-primary-500 rounded-none",
|
|
97
|
+
line: "border-b-2 border-b-neutral-200 rounded-none overflow-visible",
|
|
98
|
+
ghost: "",
|
|
99
|
+
},
|
|
100
|
+
scrollable: {
|
|
101
|
+
true: [
|
|
102
|
+
"w-full max-w-full justify-start gap-2 overflow-x-auto overflow-y-visible",
|
|
103
|
+
"whitespace-nowrap overscroll-x-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
104
|
+
].join(" "),
|
|
105
|
+
false: "w-fit justify-center gap-2 overflow-visible",
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
defaultVariants: {
|
|
109
|
+
variant: "solid",
|
|
110
|
+
scrollable: false,
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
/**
|
|
114
|
+
* **概要 / Overview**
|
|
115
|
+
*
|
|
116
|
+
* - タブはユーザーが扱う情報をシンプルに保つためのディスクロージャーとして使用するコンポーネントです。
|
|
117
|
+
* - en: Tabs component is used as a disclosure to keep user-handled information simple.
|
|
118
|
+
*
|
|
119
|
+
* **使用例 / Usage Example**
|
|
120
|
+
*
|
|
121
|
+
* ```tsx
|
|
122
|
+
* <Tabs defaultValue="account">
|
|
123
|
+
* <TabsList variant="solid">
|
|
124
|
+
* <TabsTrigger value="account">Account</TabsTrigger>
|
|
125
|
+
* <TabsTrigger value="password">Password</TabsTrigger>
|
|
126
|
+
* </TabsList>
|
|
127
|
+
* <TabsContent value="account">Account Content</TabsContent>
|
|
128
|
+
* <TabsContent value="password">Password Content</TabsContent>
|
|
129
|
+
* </Tabs>
|
|
130
|
+
* ```
|
|
131
|
+
*
|
|
132
|
+
* @param {React.ComponentProps<typeof TabsPrimitive.Root>} props
|
|
133
|
+
*/
|
|
134
|
+
function Tabs(_a) {
|
|
135
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
136
|
+
return (_jsx(TabsPrimitive.Root, Object.assign({ "data-slot": "tabs", className: cn("flex flex-col gap-2", className) }, props)));
|
|
137
|
+
}
|
|
138
|
+
function TabsList(_a) {
|
|
139
|
+
var { className, variant, scrollable } = _a, props = __rest(_a, ["className", "variant", "scrollable"]);
|
|
140
|
+
return (_jsx(TabsListVariantContext.Provider, { value: variant !== null && variant !== void 0 ? variant : "solid", children: _jsx(TabsPrimitive.List, Object.assign({ "data-slot": "tabs-list", className: cn(tabsListVariants({ variant, scrollable }), className) }, props)) }));
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* タブトリガー(タブボタン)
|
|
144
|
+
* en: Tab trigger (tab button)
|
|
145
|
+
*
|
|
146
|
+
* @param {TabsTriggerProps} props
|
|
147
|
+
*/
|
|
148
|
+
const TabsTrigger = React.forwardRef((_a, ref) => {
|
|
149
|
+
var _b;
|
|
150
|
+
var { className, variant } = _a, props = __rest(_a, ["className", "variant"]);
|
|
151
|
+
const contextVariant = useContext(TabsListVariantContext);
|
|
152
|
+
const effectiveVariant = ((_b = variant !== null && variant !== void 0 ? variant : contextVariant) !== null && _b !== void 0 ? _b : "solid");
|
|
153
|
+
return (_jsx(TabsPrimitive.Trigger, Object.assign({ ref: ref, "data-slot": "tabs-trigger", className: cn(tabsTriggerVariants({ variant: effectiveVariant }), className) }, props)));
|
|
154
|
+
});
|
|
155
|
+
TabsTrigger.displayName = "TabsTrigger";
|
|
156
|
+
/**
|
|
157
|
+
* タブの内容表示エリア
|
|
158
|
+
* en: Tab content display area
|
|
159
|
+
*/
|
|
160
|
+
function TabsContent(_a) {
|
|
161
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
162
|
+
return (_jsx(TabsPrimitive.Content, Object.assign({ "data-slot": "tabs-content", className: cn("flex-1 outline-none", className) }, props)));
|
|
163
|
+
}
|
|
164
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Goodpatch Inc.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { type VariantProps } from "class-variance-authority";
|
|
7
|
+
declare const tagVariants: (props?: ({
|
|
8
|
+
variant?: "solid" | "outline" | "subtle" | null | undefined;
|
|
9
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
10
|
+
status?: "neutral" | "negative" | "info" | "success" | "warning" | null | undefined;
|
|
11
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
12
|
+
export interface TagProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof tagVariants> {
|
|
13
|
+
/**
|
|
14
|
+
* タグのラベルテキスト
|
|
15
|
+
* en: Label text displayed inside the tag
|
|
16
|
+
*/
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* **概要 / Overview**
|
|
21
|
+
*
|
|
22
|
+
* - タグは特定の要素にラベリングをすることで情報を分類・整理したり、情報にステータスを付与するために使用するコンポーネントです。
|
|
23
|
+
* - en: The Tag component is used to categorize and organize information by labeling specific elements, or to assign status to information.
|
|
24
|
+
*
|
|
25
|
+
* **アンチパターン / Anti-patterns**
|
|
26
|
+
*
|
|
27
|
+
* - 通知数や件数などの数値情報には `Tag` を使わず、`Badge` を使ってください。
|
|
28
|
+
* en: Do not use `Tag` for numeric information such as notification counts. Use `Badge` instead.
|
|
29
|
+
*
|
|
30
|
+
* ```tsx
|
|
31
|
+
* // ✅ Correct
|
|
32
|
+
* <>
|
|
33
|
+
* <Tag status="success">完了</Tag>
|
|
34
|
+
* <Badge>3</Badge>
|
|
35
|
+
* </>
|
|
36
|
+
*
|
|
37
|
+
* // ❌ Wrong - 件数表示に Tag を使わない
|
|
38
|
+
* <Tag status="info">3件</Tag>
|
|
39
|
+
* ```
|
|
40
|
+
|
|
41
|
+
* **使用例 / Usage Example**
|
|
42
|
+
*
|
|
43
|
+
* ```tsx
|
|
44
|
+
* <Tag variant="solid" size="md" status="info">情報</Tag>
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @param {TagProps} props
|
|
48
|
+
*/
|
|
49
|
+
declare const Tag: React.ForwardRefExoticComponent<TagProps & React.RefAttributes<HTMLDivElement>>;
|
|
50
|
+
export { Tag, tagVariants };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import figma from "@figma/code-connect";
|
|
3
|
+
import { Tag } 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(Tag, "https://www.figma.com/design/7alBZXZf65YgcII41TWT0r/Sparkle-Design?node-id=558-29098", {
|
|
11
|
+
props: {
|
|
12
|
+
variant: figma.enum("variant", {
|
|
13
|
+
solid: "solid",
|
|
14
|
+
outline: "outline",
|
|
15
|
+
subtle: "subtle",
|
|
16
|
+
}),
|
|
17
|
+
size: figma.enum("size", {
|
|
18
|
+
sm: "sm",
|
|
19
|
+
md: "md",
|
|
20
|
+
lg: "lg",
|
|
21
|
+
}),
|
|
22
|
+
status: figma.enum("status", {
|
|
23
|
+
neutral: "neutral",
|
|
24
|
+
info: "info",
|
|
25
|
+
success: "success",
|
|
26
|
+
warning: "warning",
|
|
27
|
+
negative: "negative",
|
|
28
|
+
}),
|
|
29
|
+
label: figma.string("label"),
|
|
30
|
+
},
|
|
31
|
+
example: props => (_jsx(Tag, { variant: props.variant, size: props.size, status: props.status, children: props.label })),
|
|
32
|
+
});
|