kaze-design-system 0.9.0 → 0.10.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/CHANGELOG.md +19 -0
- package/components.css +2 -1
- package/dist/components/Alert/Alert.js +21 -7
- package/dist/components/Badge/Badge.js +5 -2
- package/dist/components/Button/Button.js +12 -3
- package/dist/components/CommandPalette/CommandPalette.js +1 -0
- package/dist/components/Dialog/Dialog.js +35 -15
- package/dist/components/Disclosure/Disclosure.js +2 -0
- package/dist/components/Dropdown/Dropdown.js +2 -0
- package/dist/components/FAB/FAB.js +17 -5
- package/dist/components/FilterPill/FilterPill.js +1 -0
- package/dist/components/HelpButton/HelpButton.js +2 -0
- package/dist/components/List/List.js +22 -18
- package/dist/components/Meter/Meter.js +5 -6
- package/dist/components/Navbar/Navbar.js +4 -1
- package/dist/components/NumberField/NumberField.js +11 -2
- package/dist/components/Pagination/Pagination.js +22 -5
- package/dist/components/Progress/Progress.js +5 -3
- package/dist/components/Search/Search.js +13 -3
- package/dist/components/SegmentedControl/SegmentedControl.js +1 -0
- package/dist/components/Sidebar/Sidebar.js +7 -6
- package/dist/components/StatusBadge/StatusBadge.js +6 -6
- package/dist/components/Stepper/Stepper.js +40 -36
- package/dist/components/Tabs/Tabs.js +46 -11
- package/dist/components/Timeline/Timeline.js +15 -14
- package/dist/components/Toast/Toast.js +12 -8
- package/dist/components/Tooltip/Tooltip.js +25 -6
- package/dist/components/Tracker/Tracker.js +18 -10
- package/dist/index.js +2 -0
- package/dist/lib/Slot.js +52 -0
- package/dist/lib/deprecate.js +26 -0
- package/dist/types/components/Alert/Alert.d.ts +6 -2
- package/dist/types/components/Avatar/Avatar.d.ts +2 -1
- package/dist/types/components/Badge/Badge.d.ts +6 -2
- package/dist/types/components/Button/Button.d.ts +4 -1
- package/dist/types/components/Dialog/Dialog.d.ts +4 -1
- package/dist/types/components/Disclosure/Disclosure.d.ts +2 -1
- package/dist/types/components/EmptyState/EmptyState.d.ts +2 -1
- package/dist/types/components/FAB/FAB.d.ts +4 -1
- package/dist/types/components/HelpButton/HelpButton.d.ts +2 -1
- package/dist/types/components/Icon/Icon.d.ts +2 -1
- package/dist/types/components/List/List.d.ts +2 -0
- package/dist/types/components/Logo/Logo.d.ts +3 -1
- package/dist/types/components/Logo/index.d.ts +1 -1
- package/dist/types/components/Meter/Meter.d.ts +9 -4
- package/dist/types/components/Meter/index.d.ts +1 -1
- package/dist/types/components/Navbar/Navbar.d.ts +2 -0
- package/dist/types/components/NumberField/NumberField.d.ts +3 -1
- package/dist/types/components/Pagination/Pagination.d.ts +6 -1
- package/dist/types/components/Progress/Progress.d.ts +7 -3
- package/dist/types/components/Search/Search.d.ts +5 -1
- package/dist/types/components/Section/Section.d.ts +2 -1
- package/dist/types/components/SegmentedControl/SegmentedControl.d.ts +2 -1
- package/dist/types/components/Sidebar/Sidebar.d.ts +2 -0
- package/dist/types/components/StatusBadge/StatusBadge.d.ts +1 -1
- package/dist/types/components/Stepper/Stepper.d.ts +4 -1
- package/dist/types/components/Tabs/Tabs.d.ts +18 -7
- package/dist/types/components/Timeline/Timeline.d.ts +6 -2
- package/dist/types/components/Toast/Toast.d.ts +9 -3
- package/dist/types/components/Tooltip/Tooltip.d.ts +5 -0
- package/dist/types/components/Tracker/Tracker.d.ts +7 -3
- package/dist/types/components/index.d.ts +5 -2
- package/dist/types/lib/Slot.d.ts +16 -0
- package/dist/types/lib/deprecate.d.ts +8 -0
- package/dist/types/lib/types.d.ts +4 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -16,6 +16,25 @@ CHANGELOG entries and version bumps are generated automatically by `.github/work
|
|
|
16
16
|
### 0.x policy
|
|
17
17
|
|
|
18
18
|
While the major version is 0, a **minor** release may include breaking changes (they are called out in the release notes with a migration note); a **patch** release never does. The public API will be frozen at 1.0.
|
|
19
|
+
## [0.10.0] - 2026-10-29
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
- feat: unify the component API vocabulary (tone, Size, value/onValueChange, asChild, data-state) (#50)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## [0.9.1] - 2026-10-29
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
|
|
30
|
+
- fix: drop the lucide Github icon and split major dependency bumps (#44)
|
|
31
|
+
|
|
32
|
+
### Other
|
|
33
|
+
|
|
34
|
+
- chore(deps): bump actions/setup-node from 4 to 7 (#42)
|
|
35
|
+
- chore(deps): bump actions/checkout from 4 to 7 (#41)
|
|
36
|
+
|
|
37
|
+
|
|
19
38
|
## [0.9.0] - 2026-10-29
|
|
20
39
|
|
|
21
40
|
### Features
|
package/components.css
CHANGED
|
@@ -1,14 +1,28 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
+
import { renamedProp } from "../../lib/deprecate.js";
|
|
3
4
|
import { cn } from "../../lib/utils.js";
|
|
4
5
|
const Alert = forwardRef(
|
|
5
|
-
({
|
|
6
|
-
|
|
7
|
-
/* @__PURE__ */ jsxs(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
({ tone: toneProp, variant, icon, title, className, children, ...rest }, ref) => {
|
|
7
|
+
const tone = renamedProp("Alert", "variant", "tone", variant, toneProp) ?? "info";
|
|
8
|
+
return /* @__PURE__ */ jsxs(
|
|
9
|
+
"div",
|
|
10
|
+
{
|
|
11
|
+
ref,
|
|
12
|
+
role: "alert",
|
|
13
|
+
"data-tone": tone,
|
|
14
|
+
className: cn("alert", `alert--${tone}`, className),
|
|
15
|
+
...rest,
|
|
16
|
+
children: [
|
|
17
|
+
icon && /* @__PURE__ */ jsx("span", { className: "alert__icon", children: icon }),
|
|
18
|
+
/* @__PURE__ */ jsxs("div", { className: "alert__content", children: [
|
|
19
|
+
title && /* @__PURE__ */ jsx("p", { className: "alert__title", children: title }),
|
|
20
|
+
/* @__PURE__ */ jsx("div", { className: "alert__description", children })
|
|
21
|
+
] })
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
}
|
|
12
26
|
);
|
|
13
27
|
Alert.displayName = "Alert";
|
|
14
28
|
export {
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
+
import { renamedProp } from "../../lib/deprecate.js";
|
|
3
4
|
import { cn } from "../../lib/utils.js";
|
|
4
5
|
const Badge = forwardRef(
|
|
5
|
-
({
|
|
6
|
+
({ tone: toneProp, variant, dot, solid, live, className, children, ...rest }, ref) => {
|
|
7
|
+
const tone = renamedProp("Badge", "variant", "tone", variant, toneProp) ?? "default";
|
|
6
8
|
return /* @__PURE__ */ jsxs(
|
|
7
9
|
"span",
|
|
8
10
|
{
|
|
9
11
|
ref,
|
|
10
12
|
...live ? { role: "status" } : {},
|
|
11
|
-
|
|
13
|
+
"data-tone": tone,
|
|
14
|
+
className: cn("badge", `badge--${tone}`, solid && "badge--solid", className),
|
|
12
15
|
...rest,
|
|
13
16
|
children: [
|
|
14
17
|
dot && /* @__PURE__ */ jsx("span", { className: "badge__dot", "aria-hidden": "true" }),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { cn } from "../../lib/utils.js";
|
|
4
|
+
import { Slot } from "../../lib/Slot.js";
|
|
4
5
|
const Button = forwardRef(
|
|
5
6
|
({
|
|
6
7
|
variant = "primary",
|
|
@@ -8,16 +9,24 @@ const Button = forwardRef(
|
|
|
8
9
|
fullWidth,
|
|
9
10
|
iconOnly,
|
|
10
11
|
disabled,
|
|
12
|
+
asChild,
|
|
11
13
|
className,
|
|
12
14
|
children,
|
|
15
|
+
onClick,
|
|
13
16
|
...rest
|
|
14
17
|
}, ref) => {
|
|
18
|
+
const Comp = asChild ? Slot : "button";
|
|
19
|
+
const disabledProps = asChild ? {
|
|
20
|
+
"aria-disabled": true,
|
|
21
|
+
"data-disabled": "",
|
|
22
|
+
onClick: (e) => e.preventDefault()
|
|
23
|
+
} : { disabled, "aria-disabled": true };
|
|
15
24
|
return /* @__PURE__ */ jsx(
|
|
16
|
-
|
|
25
|
+
Comp,
|
|
17
26
|
{
|
|
18
27
|
ref,
|
|
19
|
-
|
|
20
|
-
...disabled ?
|
|
28
|
+
onClick,
|
|
29
|
+
...disabled ? disabledProps : {},
|
|
21
30
|
className: cn(
|
|
22
31
|
"btn",
|
|
23
32
|
`btn--${variant}`,
|
|
@@ -143,6 +143,7 @@ const CommandPalette = forwardRef(
|
|
|
143
143
|
"aria-modal": "true",
|
|
144
144
|
"aria-label": label ?? "コマンドパレット",
|
|
145
145
|
className: cn("command-palette", className),
|
|
146
|
+
"data-state": "open",
|
|
146
147
|
...rest,
|
|
147
148
|
onKeyDown: composeEventHandlers(onKeyDown, handleKeyDown),
|
|
148
149
|
children: [
|
|
@@ -5,14 +5,25 @@ import { createPortal } from "react-dom";
|
|
|
5
5
|
import { cn } from "../../lib/utils.js";
|
|
6
6
|
import { useFocusTrap } from "../../hooks/useFocusTrap.js";
|
|
7
7
|
import { lockScroll } from "../../utils/scrollLock.js";
|
|
8
|
+
import { warnDeprecated } from "../../lib/deprecate.js";
|
|
8
9
|
const CLOSE_ANIMATION_MS = 200;
|
|
9
10
|
const dialogStack = [];
|
|
10
11
|
const Dialog = forwardRef(
|
|
11
|
-
({ open, onClose, returnFocusRef: _returnFocusRef, className, children, ...rest }, ref) => {
|
|
12
|
+
({ open, onOpenChange, onClose, returnFocusRef: _returnFocusRef, className, children, ...rest }, ref) => {
|
|
12
13
|
const titleId = useId();
|
|
13
14
|
const internalRef = useRef(null);
|
|
14
15
|
const [visible, setVisible] = useState(false);
|
|
15
16
|
const [closing, setClosing] = useState(false);
|
|
17
|
+
const requestClose = useCallback(() => {
|
|
18
|
+
if (onClose) {
|
|
19
|
+
warnDeprecated(
|
|
20
|
+
"Dialog.onClose",
|
|
21
|
+
"Dialog の `onClose` は `onOpenChange` に改名しました。次のマイナーバージョンで削除します"
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
onOpenChange?.(false);
|
|
25
|
+
onClose?.();
|
|
26
|
+
}, [onOpenChange, onClose]);
|
|
16
27
|
const mergedRef = useCallback(
|
|
17
28
|
(node) => {
|
|
18
29
|
internalRef.current = node;
|
|
@@ -67,7 +78,7 @@ const Dialog = forwardRef(
|
|
|
67
78
|
const onKeyDown = (e) => {
|
|
68
79
|
if (e.key !== "Escape" || dialogStack[dialogStack.length - 1] !== token) return;
|
|
69
80
|
e.stopPropagation();
|
|
70
|
-
|
|
81
|
+
requestClose();
|
|
71
82
|
};
|
|
72
83
|
document.addEventListener("keydown", onKeyDown);
|
|
73
84
|
return () => {
|
|
@@ -75,33 +86,42 @@ const Dialog = forwardRef(
|
|
|
75
86
|
const i = dialogStack.indexOf(token);
|
|
76
87
|
if (i >= 0) dialogStack.splice(i, 1);
|
|
77
88
|
};
|
|
78
|
-
}, [trapActive,
|
|
89
|
+
}, [trapActive, requestClose]);
|
|
79
90
|
const handleOverlayClick = useCallback(
|
|
80
91
|
(e) => {
|
|
81
92
|
if (e.target === e.currentTarget) {
|
|
82
|
-
|
|
93
|
+
requestClose();
|
|
83
94
|
}
|
|
84
95
|
},
|
|
85
|
-
[
|
|
96
|
+
[requestClose]
|
|
86
97
|
);
|
|
87
98
|
if (!visible) return null;
|
|
88
99
|
if (typeof document === "undefined") return null;
|
|
89
100
|
return createPortal(
|
|
90
101
|
// biome-ignore lint/a11y/useKeyWithClickEvents: Escape is handled on document (see above), so the backdrop needs no key handler.
|
|
91
102
|
// biome-ignore lint/a11y/noStaticElementInteractions: the backdrop only handles click-outside-to-close; keyboard users close the dialog with Escape, and the backdrop itself must not be focusable.
|
|
92
|
-
/* @__PURE__ */ jsx(
|
|
103
|
+
/* @__PURE__ */ jsx(
|
|
93
104
|
"div",
|
|
94
105
|
{
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
106
|
+
className: cn("overlay", closing && "overlay--closing"),
|
|
107
|
+
"data-state": open && !closing ? "open" : "closed",
|
|
108
|
+
onClick: handleOverlayClick,
|
|
109
|
+
children: /* @__PURE__ */ jsx(
|
|
110
|
+
"div",
|
|
111
|
+
{
|
|
112
|
+
ref: mergedRef,
|
|
113
|
+
role: "dialog",
|
|
114
|
+
"aria-modal": "true",
|
|
115
|
+
"aria-labelledby": titleId,
|
|
116
|
+
tabIndex: -1,
|
|
117
|
+
className: cn("dialog", className),
|
|
118
|
+
"data-state": open && !closing ? "open" : "closed",
|
|
119
|
+
...rest,
|
|
120
|
+
children: /* @__PURE__ */ jsx(DialogTitleIdContext.Provider, { value: titleId, children })
|
|
121
|
+
}
|
|
122
|
+
)
|
|
103
123
|
}
|
|
104
|
-
)
|
|
124
|
+
),
|
|
105
125
|
document.body
|
|
106
126
|
);
|
|
107
127
|
}
|
|
@@ -93,6 +93,7 @@ const Disclosure = forwardRef(
|
|
|
93
93
|
triggerClassName
|
|
94
94
|
),
|
|
95
95
|
"aria-expanded": isOpen,
|
|
96
|
+
"data-state": isOpen ? "open" : "closed",
|
|
96
97
|
"aria-controls": contentId,
|
|
97
98
|
disabled,
|
|
98
99
|
onClick: toggle,
|
|
@@ -129,6 +130,7 @@ const Disclosure = forwardRef(
|
|
|
129
130
|
"aria-labelledby": triggerId,
|
|
130
131
|
className: cn("disclosure__content", contentClassName),
|
|
131
132
|
hidden: !isOpen,
|
|
133
|
+
"data-state": isOpen ? "open" : "closed",
|
|
132
134
|
children: /* @__PURE__ */ jsx("div", { className: "disclosure__content-inner", children })
|
|
133
135
|
}
|
|
134
136
|
)
|
|
@@ -85,6 +85,7 @@ const DropdownTrigger = forwardRef(
|
|
|
85
85
|
"aria-haspopup": "menu",
|
|
86
86
|
"aria-expanded": open,
|
|
87
87
|
"aria-controls": open ? menuId : void 0,
|
|
88
|
+
"data-state": open ? "open" : "closed",
|
|
88
89
|
onClick: composeEventHandlers(childProps?.onClick, handleClick),
|
|
89
90
|
onKeyDown: composeEventHandlers(childProps?.onKeyDown, handleKeyDown)
|
|
90
91
|
};
|
|
@@ -191,6 +192,7 @@ const DropdownMenu = forwardRef(
|
|
|
191
192
|
tabIndex: -1,
|
|
192
193
|
"aria-labelledby": rest["aria-labelledby"] ?? triggerId,
|
|
193
194
|
className: cn("dropdown__menu", className),
|
|
195
|
+
"data-state": "open",
|
|
194
196
|
style: { ...style, top: position.top, left: position.left },
|
|
195
197
|
onKeyDown: composeEventHandlers(onKeyDown, handleKeyDown),
|
|
196
198
|
children
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { jsxs,
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { cn } from "../../lib/utils.js";
|
|
4
|
+
import { Slot } from "../../lib/Slot.js";
|
|
4
5
|
const FAB = forwardRef(
|
|
5
6
|
({
|
|
6
7
|
label,
|
|
@@ -8,14 +9,25 @@ const FAB = forwardRef(
|
|
|
8
9
|
size = "md",
|
|
9
10
|
position = "bottom-right",
|
|
10
11
|
extended,
|
|
12
|
+
disabled,
|
|
13
|
+
asChild,
|
|
11
14
|
className,
|
|
12
15
|
children,
|
|
16
|
+
onClick,
|
|
13
17
|
...rest
|
|
14
18
|
}, ref) => {
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
const Comp = asChild ? Slot : "button";
|
|
20
|
+
const disabledProps = asChild ? {
|
|
21
|
+
"aria-disabled": true,
|
|
22
|
+
"data-disabled": "",
|
|
23
|
+
onClick: (e) => e.preventDefault()
|
|
24
|
+
} : { disabled, "aria-disabled": true };
|
|
25
|
+
return /* @__PURE__ */ jsx(
|
|
26
|
+
Comp,
|
|
17
27
|
{
|
|
18
28
|
ref,
|
|
29
|
+
onClick,
|
|
30
|
+
...disabled ? disabledProps : {},
|
|
19
31
|
"aria-label": extended ? void 0 : label,
|
|
20
32
|
className: cn(
|
|
21
33
|
"fab",
|
|
@@ -26,10 +38,10 @@ const FAB = forwardRef(
|
|
|
26
38
|
className
|
|
27
39
|
),
|
|
28
40
|
...rest,
|
|
29
|
-
children: [
|
|
41
|
+
children: asChild ? children : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
30
42
|
children,
|
|
31
43
|
extended && /* @__PURE__ */ jsx("span", { className: "fab__label", children: label })
|
|
32
|
-
]
|
|
44
|
+
] })
|
|
33
45
|
}
|
|
34
46
|
);
|
|
35
47
|
}
|
|
@@ -12,6 +12,7 @@ const FilterPill = forwardRef(
|
|
|
12
12
|
className: cn("filter-pill", active && "filter-pill--active", className),
|
|
13
13
|
style: pillStyle,
|
|
14
14
|
"aria-pressed": active,
|
|
15
|
+
"data-state": active ? "on" : "off",
|
|
15
16
|
...rest,
|
|
16
17
|
children: [
|
|
17
18
|
dot && /* @__PURE__ */ jsx("span", { className: "filter-pill__dot", "aria-hidden": "true" }),
|
|
@@ -87,6 +87,7 @@ const HelpButton = forwardRef(
|
|
|
87
87
|
className: cn("help-button", className),
|
|
88
88
|
"aria-label": ariaLabel,
|
|
89
89
|
"aria-expanded": open,
|
|
90
|
+
"data-state": open ? "open" : "closed",
|
|
90
91
|
"aria-controls": open ? popoverId : void 0,
|
|
91
92
|
onClick: () => setOpen((v) => !v),
|
|
92
93
|
children: icon ?? "?"
|
|
@@ -100,6 +101,7 @@ const HelpButton = forwardRef(
|
|
|
100
101
|
id: popoverId,
|
|
101
102
|
role: "dialog",
|
|
102
103
|
"aria-modal": "false",
|
|
104
|
+
"data-state": "open",
|
|
103
105
|
className: cn("help-popover", `help-popover--${size}`),
|
|
104
106
|
style: { top: coords.top, left: coords.left },
|
|
105
107
|
children: [
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, Children, isValidElement, cloneElement } from "react";
|
|
3
3
|
import { cn } from "../../lib/utils.js";
|
|
4
|
+
import { Slot } from "../../lib/Slot.js";
|
|
4
5
|
const List = forwardRef(
|
|
5
6
|
({ divided, marker, className, children, ...rest }, ref) => {
|
|
6
7
|
const Tag = marker === "decimal" ? "ol" : "ul";
|
|
@@ -22,23 +23,26 @@ const List = forwardRef(
|
|
|
22
23
|
);
|
|
23
24
|
List.displayName = "List";
|
|
24
25
|
const ListItem = forwardRef(
|
|
25
|
-
({ leading, trailing, title, description, interactive, className, children, ...rest }, ref) =>
|
|
26
|
-
"
|
|
27
|
-
{
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
26
|
+
({ leading, trailing, title, description, interactive, asChild, className, children, ...rest }, ref) => {
|
|
27
|
+
const classes = cn("list-item", interactive && "list-item--interactive", className);
|
|
28
|
+
const row = (content) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
29
|
+
leading && /* @__PURE__ */ jsx("span", { className: "list-item__leading", children: leading }),
|
|
30
|
+
/* @__PURE__ */ jsxs("span", { className: "list-item__content", children: [
|
|
31
|
+
title && /* @__PURE__ */ jsx("span", { className: "list-item__title", children: title }),
|
|
32
|
+
description && /* @__PURE__ */ jsx("span", { className: "list-item__description", children: description }),
|
|
33
|
+
content
|
|
34
|
+
] }),
|
|
35
|
+
trailing && /* @__PURE__ */ jsx("span", { className: "list-item__trailing", children: trailing })
|
|
36
|
+
] });
|
|
37
|
+
if (asChild) {
|
|
38
|
+
const child = Children.only(children);
|
|
39
|
+
if (!isValidElement(child)) {
|
|
40
|
+
throw new Error("[kaze] ListItem (asChild) には React 要素を 1 つだけ渡してください");
|
|
41
|
+
}
|
|
42
|
+
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Slot, { ref, className: classes, ...rest, children: cloneElement(child, void 0, row(child.props.children)) }) });
|
|
40
43
|
}
|
|
41
|
-
|
|
44
|
+
return /* @__PURE__ */ jsx("li", { ref, className: classes, ...rest, children: row(children) });
|
|
45
|
+
}
|
|
42
46
|
);
|
|
43
47
|
ListItem.displayName = "ListItem";
|
|
44
48
|
export {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
+
import { renamedProp } from "../../lib/deprecate.js";
|
|
3
4
|
import { cn } from "../../lib/utils.js";
|
|
4
5
|
function autoColor(pct, warn, danger) {
|
|
5
6
|
if (pct >= danger) return "negative";
|
|
@@ -15,6 +16,7 @@ const Meter = forwardRef(
|
|
|
15
16
|
dangerThreshold = 0.9,
|
|
16
17
|
label,
|
|
17
18
|
showValue,
|
|
19
|
+
tone: toneProp,
|
|
18
20
|
color,
|
|
19
21
|
size = "md",
|
|
20
22
|
className,
|
|
@@ -22,8 +24,8 @@ const Meter = forwardRef(
|
|
|
22
24
|
}, ref) => {
|
|
23
25
|
const range = max - min || 1;
|
|
24
26
|
const pct = Math.min(1, Math.max(0, (value - min) / range));
|
|
25
|
-
const
|
|
26
|
-
return /* @__PURE__ */ jsxs("div", { ref, className: cn("meter", className), ...rest, children: [
|
|
27
|
+
const tone = renamedProp("Meter", "color", "tone", color, toneProp) ?? autoColor(pct, warningThreshold, dangerThreshold);
|
|
28
|
+
return /* @__PURE__ */ jsxs("div", { ref, "data-tone": tone, className: cn("meter", className), ...rest, children: [
|
|
27
29
|
(label || showValue) && /* @__PURE__ */ jsxs("div", { className: "meter__label-row", children: [
|
|
28
30
|
label && /* @__PURE__ */ jsx("span", { className: "meter__label", children: label }),
|
|
29
31
|
showValue && /* @__PURE__ */ jsxs("span", { className: "meter__value-text", children: [
|
|
@@ -45,10 +47,7 @@ const Meter = forwardRef(
|
|
|
45
47
|
/* @__PURE__ */ jsx(
|
|
46
48
|
"div",
|
|
47
49
|
{
|
|
48
|
-
className: cn(
|
|
49
|
-
"meter__fill",
|
|
50
|
-
resolvedColor !== "default" && `meter__fill--${resolvedColor}`
|
|
51
|
-
),
|
|
50
|
+
className: cn("meter__fill", tone !== "default" && `meter__fill--${tone}`),
|
|
52
51
|
style: { width: `${pct * 100}%` }
|
|
53
52
|
}
|
|
54
53
|
),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { cn } from "../../lib/utils.js";
|
|
4
|
+
import { Slot } from "../../lib/Slot.js";
|
|
4
5
|
const Navbar = forwardRef(
|
|
5
6
|
({ logo, actions, transparent, className, children, ...rest }, ref) => {
|
|
6
7
|
return /* @__PURE__ */ jsxs(
|
|
@@ -28,12 +29,14 @@ const NavbarLinks = forwardRef(
|
|
|
28
29
|
);
|
|
29
30
|
NavbarLinks.displayName = "NavbarLinks";
|
|
30
31
|
const NavbarLink = forwardRef(
|
|
31
|
-
({ active, as:
|
|
32
|
+
({ active, as: asProp = "a", asChild, className, children, ...rest }, ref) => {
|
|
33
|
+
const Component = asChild ? Slot : asProp;
|
|
32
34
|
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
33
35
|
Component,
|
|
34
36
|
{
|
|
35
37
|
ref,
|
|
36
38
|
className: cn("navbar__link", active && "navbar__link--active", className),
|
|
39
|
+
"aria-current": active ? "page" : void 0,
|
|
37
40
|
...rest,
|
|
38
41
|
children
|
|
39
42
|
}
|
|
@@ -3,6 +3,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { forwardRef, useId, useState, useRef, useCallback, useEffect } from "react";
|
|
4
4
|
import { cn } from "../../lib/utils.js";
|
|
5
5
|
import { composeEventHandlers } from "../../lib/composeEventHandlers.js";
|
|
6
|
+
import { renamedProp } from "../../lib/deprecate.js";
|
|
6
7
|
import { normalizeNumericInput, isComposingEvent } from "../../lib/jaText.js";
|
|
7
8
|
const currencyConfig = {
|
|
8
9
|
JPY: { locale: "ja-JP", symbol: "¥", decimals: 0 },
|
|
@@ -49,6 +50,7 @@ const NumberField = forwardRef(
|
|
|
49
50
|
({
|
|
50
51
|
value: valueProp,
|
|
51
52
|
defaultValue,
|
|
53
|
+
onValueChange,
|
|
52
54
|
onChange,
|
|
53
55
|
min,
|
|
54
56
|
max,
|
|
@@ -81,12 +83,19 @@ const NumberField = forwardRef(
|
|
|
81
83
|
const [internalValue, setInternalValue] = useState(defaultValue ?? null);
|
|
82
84
|
const value = isControlled ? valueProp : internalValue;
|
|
83
85
|
const numberLocale = resolveLocale(locale, currency);
|
|
86
|
+
const handleValueChange = renamedProp(
|
|
87
|
+
"NumberField",
|
|
88
|
+
"onChange",
|
|
89
|
+
"onValueChange",
|
|
90
|
+
onChange,
|
|
91
|
+
onValueChange
|
|
92
|
+
);
|
|
84
93
|
const emit = useCallback(
|
|
85
94
|
(next) => {
|
|
86
95
|
if (!isControlled) setInternalValue(next);
|
|
87
|
-
|
|
96
|
+
handleValueChange?.(next);
|
|
88
97
|
},
|
|
89
|
-
[isControlled,
|
|
98
|
+
[isControlled, handleValueChange]
|
|
90
99
|
);
|
|
91
100
|
const resolvedPrefix = prefixProp ?? (currency ? currencyConfig[currency].symbol : void 0);
|
|
92
101
|
const clamp = useCallback(
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
|
+
import { forwardRef, useState } from "react";
|
|
3
4
|
import { cn } from "../../lib/utils.js";
|
|
5
|
+
import { renamedProp } from "../../lib/deprecate.js";
|
|
4
6
|
function getPages(current, total, siblings) {
|
|
5
7
|
const range = [];
|
|
6
8
|
const left = Math.max(2, current - siblings);
|
|
@@ -15,7 +17,9 @@ function getPages(current, total, siblings) {
|
|
|
15
17
|
const defaultPageLabel = (page) => `${page}ページ目`;
|
|
16
18
|
const Pagination = forwardRef(
|
|
17
19
|
({
|
|
18
|
-
|
|
20
|
+
page: pageProp,
|
|
21
|
+
defaultPage = 1,
|
|
22
|
+
currentPage: currentPageProp,
|
|
19
23
|
totalPages,
|
|
20
24
|
onPageChange,
|
|
21
25
|
siblingCount = 1,
|
|
@@ -26,6 +30,19 @@ const Pagination = forwardRef(
|
|
|
26
30
|
className,
|
|
27
31
|
...rest
|
|
28
32
|
}, ref) => {
|
|
33
|
+
const controlledPage = renamedProp(
|
|
34
|
+
"Pagination",
|
|
35
|
+
"currentPage",
|
|
36
|
+
"page",
|
|
37
|
+
currentPageProp,
|
|
38
|
+
pageProp
|
|
39
|
+
);
|
|
40
|
+
const [internalPage, setInternalPage] = useState(defaultPage);
|
|
41
|
+
const currentPage = controlledPage ?? internalPage;
|
|
42
|
+
const goTo = (next) => {
|
|
43
|
+
if (controlledPage === void 0) setInternalPage(next);
|
|
44
|
+
onPageChange?.(next);
|
|
45
|
+
};
|
|
29
46
|
const pages = getPages(currentPage, totalPages, siblingCount);
|
|
30
47
|
return /* @__PURE__ */ jsxs("nav", { ref, "aria-label": label, className: cn("pagination", className), ...rest, children: [
|
|
31
48
|
/* @__PURE__ */ jsx(
|
|
@@ -34,7 +51,7 @@ const Pagination = forwardRef(
|
|
|
34
51
|
type: "button",
|
|
35
52
|
className: "pagination__btn",
|
|
36
53
|
disabled: currentPage <= 1,
|
|
37
|
-
onClick: () =>
|
|
54
|
+
onClick: () => goTo(currentPage - 1),
|
|
38
55
|
"aria-label": prevLabel,
|
|
39
56
|
children: "‹"
|
|
40
57
|
}
|
|
@@ -45,7 +62,7 @@ const Pagination = forwardRef(
|
|
|
45
62
|
{
|
|
46
63
|
type: "button",
|
|
47
64
|
className: cn("pagination__btn", page === currentPage && "pagination__btn--active"),
|
|
48
|
-
onClick: () =>
|
|
65
|
+
onClick: () => goTo(page),
|
|
49
66
|
"aria-label": pageLabel(page),
|
|
50
67
|
"aria-current": page === currentPage ? "page" : void 0,
|
|
51
68
|
children: page
|
|
@@ -59,7 +76,7 @@ const Pagination = forwardRef(
|
|
|
59
76
|
type: "button",
|
|
60
77
|
className: "pagination__btn",
|
|
61
78
|
disabled: currentPage >= totalPages,
|
|
62
|
-
onClick: () =>
|
|
79
|
+
onClick: () => goTo(currentPage + 1),
|
|
63
80
|
"aria-label": nextLabel,
|
|
64
81
|
children: "›"
|
|
65
82
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
+
import { renamedProp } from "../../lib/deprecate.js";
|
|
3
4
|
import { cn } from "../../lib/utils.js";
|
|
4
5
|
const Progress = forwardRef(
|
|
5
|
-
({ value, max = 100, label, showValue,
|
|
6
|
+
({ value, max = 100, label, showValue, tone: toneProp, color, size = "md", className, ...rest }, ref) => {
|
|
7
|
+
const tone = renamedProp("Progress", "color", "tone", color, toneProp) ?? "default";
|
|
6
8
|
const pct = Math.min(100, Math.max(0, value / max * 100));
|
|
7
|
-
return /* @__PURE__ */ jsxs("div", { ref, className: cn("progress", className), ...rest, children: [
|
|
9
|
+
return /* @__PURE__ */ jsxs("div", { ref, "data-tone": tone, className: cn("progress", className), ...rest, children: [
|
|
8
10
|
(label || showValue) && /* @__PURE__ */ jsxs("div", { className: "progress__label-row", children: [
|
|
9
11
|
label && /* @__PURE__ */ jsx("span", { className: "progress__label", children: label }),
|
|
10
12
|
showValue && /* @__PURE__ */ jsxs("span", { className: "progress__value-text", children: [
|
|
@@ -24,7 +26,7 @@ const Progress = forwardRef(
|
|
|
24
26
|
children: /* @__PURE__ */ jsx(
|
|
25
27
|
"div",
|
|
26
28
|
{
|
|
27
|
-
className: cn("progress__fill",
|
|
29
|
+
className: cn("progress__fill", tone !== "default" && `progress__fill--${tone}`),
|
|
28
30
|
style: { width: `${pct}%` }
|
|
29
31
|
}
|
|
30
32
|
)
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef, useState, useCallback } from "react";
|
|
4
4
|
import { cn } from "../../lib/utils.js";
|
|
5
|
+
import { renamedProp } from "../../lib/deprecate.js";
|
|
5
6
|
import { composeEventHandlers } from "../../lib/composeEventHandlers.js";
|
|
6
7
|
import { isComposingEvent } from "../../lib/jaText.js";
|
|
7
8
|
const Search = forwardRef(
|
|
@@ -10,24 +11,33 @@ const Search = forwardRef(
|
|
|
10
11
|
shortcut,
|
|
11
12
|
onSearch,
|
|
12
13
|
value: valueProp,
|
|
14
|
+
defaultValue = "",
|
|
15
|
+
onValueChange,
|
|
13
16
|
onChange: onChangeProp,
|
|
14
17
|
"aria-label": ariaLabel,
|
|
15
18
|
inputProps,
|
|
16
19
|
className,
|
|
17
20
|
...rest
|
|
18
21
|
}, ref) => {
|
|
19
|
-
const [internalValue, setInternalValue] = useState(
|
|
22
|
+
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
20
23
|
const isControlled = valueProp !== void 0;
|
|
21
24
|
const currentValue = isControlled ? valueProp : internalValue;
|
|
25
|
+
const onValueChangeResolved = renamedProp(
|
|
26
|
+
"Search",
|
|
27
|
+
"onChange",
|
|
28
|
+
"onValueChange",
|
|
29
|
+
onChangeProp,
|
|
30
|
+
onValueChange
|
|
31
|
+
);
|
|
22
32
|
const handleChange = useCallback(
|
|
23
33
|
(e) => {
|
|
24
34
|
const newValue = e.target.value;
|
|
25
35
|
if (!isControlled) {
|
|
26
36
|
setInternalValue(newValue);
|
|
27
37
|
}
|
|
28
|
-
|
|
38
|
+
onValueChangeResolved?.(newValue);
|
|
29
39
|
},
|
|
30
|
-
[isControlled,
|
|
40
|
+
[isControlled, onValueChangeResolved]
|
|
31
41
|
);
|
|
32
42
|
const handleKeyDown = useCallback(
|
|
33
43
|
(e) => {
|
|
@@ -98,6 +98,7 @@ const SegmentedControl = forwardRef(
|
|
|
98
98
|
role: "radio",
|
|
99
99
|
"aria-checked": checked,
|
|
100
100
|
"data-value": o.value,
|
|
101
|
+
"data-state": checked ? "on" : "off",
|
|
101
102
|
disabled: o.disabled,
|
|
102
103
|
tabIndex: o.value === tabStop ? 0 : -1,
|
|
103
104
|
className: "segmented-control__option",
|