@karakuri-ui/react 0.2.2 → 0.2.4
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/README.md +9 -0
- package/dist/components/ui/accordion.d.mts +49 -0
- package/dist/components/ui/accordion.d.ts +49 -0
- package/dist/components/ui/accordion.js +220 -0
- package/dist/components/ui/accordion.js.map +1 -0
- package/dist/components/ui/accordion.mjs +181 -0
- package/dist/components/ui/accordion.mjs.map +1 -0
- package/dist/components/ui/alert.d.mts +47 -0
- package/dist/components/ui/alert.d.ts +47 -0
- package/dist/components/ui/alert.js +223 -0
- package/dist/components/ui/alert.js.map +1 -0
- package/dist/components/ui/alert.mjs +185 -0
- package/dist/components/ui/alert.mjs.map +1 -0
- package/dist/components/ui/avatar.d.mts +232 -0
- package/dist/components/ui/avatar.d.ts +232 -0
- package/dist/components/ui/avatar.js +250 -0
- package/dist/components/ui/avatar.js.map +1 -0
- package/dist/components/ui/avatar.mjs +209 -0
- package/dist/components/ui/avatar.mjs.map +1 -0
- package/dist/components/ui/badge.d.mts +31 -0
- package/dist/components/ui/badge.d.ts +31 -0
- package/dist/components/ui/badge.js +205 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/badge.mjs +170 -0
- package/dist/components/ui/badge.mjs.map +1 -0
- package/dist/components/ui/breadcrumb.d.mts +57 -0
- package/dist/components/ui/breadcrumb.d.ts +57 -0
- package/dist/components/ui/breadcrumb.js +209 -0
- package/dist/components/ui/breadcrumb.js.map +1 -0
- package/dist/components/ui/breadcrumb.mjs +168 -0
- package/dist/components/ui/breadcrumb.mjs.map +1 -0
- package/dist/components/ui/button-group.d.mts +22 -0
- package/dist/components/ui/button-group.d.ts +22 -0
- package/dist/components/ui/button-group.js +107 -0
- package/dist/components/ui/button-group.js.map +1 -0
- package/dist/components/ui/button-group.mjs +72 -0
- package/dist/components/ui/button-group.mjs.map +1 -0
- package/dist/components/ui/button.d.mts +31 -0
- package/dist/components/ui/button.d.ts +31 -0
- package/dist/components/ui/button.js +176 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/button.mjs +141 -0
- package/dist/components/ui/button.mjs.map +1 -0
- package/dist/components/ui/card.d.mts +77 -0
- package/dist/components/ui/card.d.ts +77 -0
- package/dist/components/ui/card.js +370 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/card.mjs +328 -0
- package/dist/components/ui/card.mjs.map +1 -0
- package/dist/{chart.js → components/ui/chart.js} +29 -39
- package/dist/components/ui/chart.js.map +1 -0
- package/dist/{chart.mjs → components/ui/chart.mjs} +21 -31
- package/dist/components/ui/chart.mjs.map +1 -0
- package/dist/components/ui/checkbox.d.mts +24 -0
- package/dist/components/ui/checkbox.d.ts +24 -0
- package/dist/components/ui/checkbox.js +173 -0
- package/dist/components/ui/checkbox.js.map +1 -0
- package/dist/components/ui/checkbox.mjs +138 -0
- package/dist/components/ui/checkbox.mjs.map +1 -0
- package/dist/components/ui/divider.d.mts +27 -0
- package/dist/components/ui/divider.d.ts +27 -0
- package/dist/components/ui/divider.js +147 -0
- package/dist/components/ui/divider.js.map +1 -0
- package/dist/components/ui/divider.mjs +112 -0
- package/dist/components/ui/divider.mjs.map +1 -0
- package/dist/components/ui/drawer.d.mts +51 -0
- package/dist/components/ui/drawer.d.ts +51 -0
- package/dist/components/ui/drawer.js +225 -0
- package/dist/components/ui/drawer.js.map +1 -0
- package/dist/components/ui/drawer.mjs +178 -0
- package/dist/components/ui/drawer.mjs.map +1 -0
- package/dist/components/ui/dropdown.d.mts +59 -0
- package/dist/components/ui/dropdown.d.ts +59 -0
- package/dist/components/ui/dropdown.js +310 -0
- package/dist/components/ui/dropdown.js.map +1 -0
- package/dist/components/ui/dropdown.mjs +263 -0
- package/dist/components/ui/dropdown.mjs.map +1 -0
- package/dist/components/ui/field.d.mts +33 -0
- package/dist/components/ui/field.d.ts +33 -0
- package/dist/components/ui/field.js +146 -0
- package/dist/components/ui/field.js.map +1 -0
- package/dist/components/ui/field.mjs +108 -0
- package/dist/components/ui/field.mjs.map +1 -0
- package/dist/components/ui/icon-button.d.mts +20 -0
- package/dist/components/ui/icon-button.d.ts +20 -0
- package/dist/components/ui/icon-button.js +147 -0
- package/dist/components/ui/icon-button.js.map +1 -0
- package/dist/components/ui/icon-button.mjs +112 -0
- package/dist/components/ui/icon-button.mjs.map +1 -0
- package/dist/components/ui/index.d.mts +55 -0
- package/dist/components/ui/index.d.ts +55 -0
- package/dist/components/ui/index.js +476 -0
- package/dist/components/ui/index.js.map +1 -0
- package/dist/components/ui/index.mjs +246 -0
- package/dist/components/ui/index.mjs.map +1 -0
- package/dist/components/ui/input.d.mts +20 -0
- package/dist/components/ui/input.d.ts +20 -0
- package/dist/components/ui/input.js +250 -0
- package/dist/components/ui/input.js.map +1 -0
- package/dist/components/ui/input.mjs +215 -0
- package/dist/components/ui/input.mjs.map +1 -0
- package/dist/components/ui/metric-card.d.mts +53 -0
- package/dist/components/ui/metric-card.d.ts +53 -0
- package/dist/components/ui/metric-card.js +258 -0
- package/dist/components/ui/metric-card.js.map +1 -0
- package/dist/components/ui/metric-card.mjs +217 -0
- package/dist/components/ui/metric-card.mjs.map +1 -0
- package/dist/components/ui/modal.d.mts +77 -0
- package/dist/components/ui/modal.d.ts +77 -0
- package/dist/components/ui/modal.js +396 -0
- package/dist/components/ui/modal.js.map +1 -0
- package/dist/components/ui/modal.mjs +338 -0
- package/dist/components/ui/modal.mjs.map +1 -0
- package/dist/components/ui/navigation-menu.d.mts +139 -0
- package/dist/components/ui/navigation-menu.d.ts +139 -0
- package/dist/components/ui/navigation-menu.js +531 -0
- package/dist/components/ui/navigation-menu.js.map +1 -0
- package/dist/components/ui/navigation-menu.mjs +488 -0
- package/dist/components/ui/navigation-menu.mjs.map +1 -0
- package/dist/components/ui/pagination.d.mts +130 -0
- package/dist/components/ui/pagination.d.ts +130 -0
- package/dist/components/ui/pagination.js +495 -0
- package/dist/components/ui/pagination.js.map +1 -0
- package/dist/components/ui/pagination.mjs +449 -0
- package/dist/components/ui/pagination.mjs.map +1 -0
- package/dist/components/ui/popover.d.mts +41 -0
- package/dist/components/ui/popover.d.ts +41 -0
- package/dist/components/ui/popover.js +175 -0
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/popover.mjs +133 -0
- package/dist/components/ui/popover.mjs.map +1 -0
- package/dist/components/ui/progress.d.mts +35 -0
- package/dist/components/ui/progress.d.ts +35 -0
- package/dist/components/ui/progress.js +194 -0
- package/dist/components/ui/progress.js.map +1 -0
- package/dist/components/ui/progress.mjs +159 -0
- package/dist/components/ui/progress.mjs.map +1 -0
- package/dist/components/ui/radio-group.d.mts +40 -0
- package/dist/components/ui/radio-group.d.ts +40 -0
- package/dist/components/ui/radio-group.js +177 -0
- package/dist/components/ui/radio-group.js.map +1 -0
- package/dist/components/ui/radio-group.mjs +140 -0
- package/dist/components/ui/radio-group.mjs.map +1 -0
- package/dist/components/ui/segmented.d.mts +30 -0
- package/dist/components/ui/segmented.d.ts +30 -0
- package/dist/components/ui/segmented.js +241 -0
- package/dist/components/ui/segmented.js.map +1 -0
- package/dist/components/ui/segmented.mjs +204 -0
- package/dist/components/ui/segmented.mjs.map +1 -0
- package/dist/components/ui/select.d.mts +31 -0
- package/dist/components/ui/select.d.ts +31 -0
- package/dist/components/ui/select.js +317 -0
- package/dist/components/ui/select.js.map +1 -0
- package/dist/components/ui/select.mjs +276 -0
- package/dist/components/ui/select.mjs.map +1 -0
- package/dist/components/ui/skeleton.d.mts +26 -0
- package/dist/components/ui/skeleton.d.ts +26 -0
- package/dist/components/ui/skeleton.js +144 -0
- package/dist/components/ui/skeleton.js.map +1 -0
- package/dist/components/ui/skeleton.mjs +109 -0
- package/dist/components/ui/skeleton.mjs.map +1 -0
- package/dist/components/ui/slider.d.mts +38 -0
- package/dist/components/ui/slider.d.ts +38 -0
- package/dist/components/ui/slider.js +180 -0
- package/dist/components/ui/slider.js.map +1 -0
- package/dist/components/ui/slider.mjs +145 -0
- package/dist/components/ui/slider.mjs.map +1 -0
- package/dist/components/ui/spinner.d.mts +23 -0
- package/dist/components/ui/spinner.d.ts +23 -0
- package/dist/components/ui/spinner.js +471 -0
- package/dist/components/ui/spinner.js.map +1 -0
- package/dist/components/ui/spinner.mjs +436 -0
- package/dist/components/ui/spinner.mjs.map +1 -0
- package/dist/components/ui/switch.d.mts +22 -0
- package/dist/components/ui/switch.d.ts +22 -0
- package/dist/components/ui/switch.js +173 -0
- package/dist/components/ui/switch.js.map +1 -0
- package/dist/components/ui/switch.mjs +138 -0
- package/dist/components/ui/switch.mjs.map +1 -0
- package/dist/components/ui/table.d.mts +74 -0
- package/dist/components/ui/table.d.ts +74 -0
- package/dist/components/ui/table.js +240 -0
- package/dist/components/ui/table.js.map +1 -0
- package/dist/components/ui/table.mjs +199 -0
- package/dist/components/ui/table.mjs.map +1 -0
- package/dist/components/ui/tabs.d.mts +40 -0
- package/dist/components/ui/tabs.d.ts +40 -0
- package/dist/components/ui/tabs.js +238 -0
- package/dist/components/ui/tabs.js.map +1 -0
- package/dist/components/ui/tabs.mjs +199 -0
- package/dist/components/ui/tabs.mjs.map +1 -0
- package/dist/components/ui/textarea.d.mts +19 -0
- package/dist/components/ui/textarea.d.ts +19 -0
- package/dist/components/ui/textarea.js +181 -0
- package/dist/components/ui/textarea.js.map +1 -0
- package/dist/components/ui/textarea.mjs +146 -0
- package/dist/components/ui/textarea.mjs.map +1 -0
- package/dist/components/ui/toast.d.mts +93 -0
- package/dist/components/ui/toast.d.ts +93 -0
- package/dist/components/ui/toast.js +429 -0
- package/dist/components/ui/toast.js.map +1 -0
- package/dist/components/ui/toast.mjs +393 -0
- package/dist/components/ui/toast.mjs.map +1 -0
- package/dist/components/ui/toggle-group.d.mts +47 -0
- package/dist/components/ui/toggle-group.d.ts +47 -0
- package/dist/components/ui/toggle-group.js +186 -0
- package/dist/components/ui/toggle-group.js.map +1 -0
- package/dist/components/ui/toggle-group.mjs +149 -0
- package/dist/components/ui/toggle-group.mjs.map +1 -0
- package/dist/components/ui/toggle.d.mts +19 -0
- package/dist/components/ui/toggle.d.ts +19 -0
- package/dist/components/ui/toggle.js +194 -0
- package/dist/components/ui/toggle.js.map +1 -0
- package/dist/components/ui/toggle.mjs +159 -0
- package/dist/components/ui/toggle.mjs.map +1 -0
- package/dist/components/ui/tooltip.d.mts +37 -0
- package/dist/components/ui/tooltip.d.ts +37 -0
- package/dist/components/ui/tooltip.js +137 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/components/ui/tooltip.mjs +96 -0
- package/dist/components/ui/tooltip.mjs.map +1 -0
- package/dist/lib/utils.d.mts +10 -0
- package/dist/lib/utils.d.ts +10 -0
- package/dist/lib/utils.js +33 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/utils.mjs +9 -0
- package/dist/lib/utils.mjs.map +1 -0
- package/package.json +11 -11
- package/dist/chart.js.map +0 -1
- package/dist/chart.mjs.map +0 -1
- package/dist/index.d.mts +0 -1636
- package/dist/index.d.ts +0 -1636
- package/dist/index.js +0 -7291
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -7048
- package/dist/index.mjs.map +0 -1
- /package/dist/{chart.d.mts → components/ui/chart.d.mts} +0 -0
- /package/dist/{chart.d.ts → components/ui/chart.d.ts} +0 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var toggle_group_exports = {};
|
|
31
|
+
__export(toggle_group_exports, {
|
|
32
|
+
ToggleGroup: () => ToggleGroup,
|
|
33
|
+
ToggleGroupItem: () => ToggleGroupItem,
|
|
34
|
+
toggleGroupItemVariants: () => toggleGroupItemVariants,
|
|
35
|
+
toggleGroupVariants: () => toggleGroupVariants
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(toggle_group_exports);
|
|
38
|
+
var React = __toESM(require("react"));
|
|
39
|
+
var ToggleGroupPrimitive = __toESM(require("@radix-ui/react-toggle-group"));
|
|
40
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
41
|
+
var import_utils = require("../../lib/utils");
|
|
42
|
+
const toggleGroupVariants = (0, import_class_variance_authority.cva)(
|
|
43
|
+
"inline-flex items-center justify-center",
|
|
44
|
+
{
|
|
45
|
+
variants: {
|
|
46
|
+
orientation: {
|
|
47
|
+
horizontal: "flex-row",
|
|
48
|
+
vertical: "flex-col"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
defaultVariants: {
|
|
52
|
+
orientation: "horizontal"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
const toggleGroupItemVariants = (0, import_class_variance_authority.cva)(
|
|
57
|
+
"inline-flex items-center justify-center text-sm text-text-muted transition-all duration-micro focus-visible:focus-ring disabled:pointer-events-none disabled:opacity-50",
|
|
58
|
+
{
|
|
59
|
+
variants: {
|
|
60
|
+
variant: {
|
|
61
|
+
default: "bg-transparent hover:bg-background-muted hover:text-foreground data-[state=on]:bg-background-muted data-[state=on]:text-foreground",
|
|
62
|
+
outline: "border border-border-form bg-transparent hover:bg-background-muted hover:text-foreground data-[state=on]:bg-background-muted data-[state=on]:text-foreground"
|
|
63
|
+
},
|
|
64
|
+
fontWeight: {
|
|
65
|
+
normal: "font-normal",
|
|
66
|
+
semibold: "font-semibold"
|
|
67
|
+
},
|
|
68
|
+
size: {
|
|
69
|
+
xs: "h-7 px-2.5 text-xs gap-1",
|
|
70
|
+
// 28px height, 10px paddingX, 12px font
|
|
71
|
+
sm: "h-8 px-3 text-sm gap-2",
|
|
72
|
+
// 32px height, 12px paddingX, 13px font
|
|
73
|
+
md: "h-9 px-3.5 text-md gap-2",
|
|
74
|
+
// 36px height, 14px paddingX, 14px font
|
|
75
|
+
default: "h-10 px-4 text-md gap-2",
|
|
76
|
+
// 40px height, 16px paddingX, 14px font
|
|
77
|
+
lg: "h-12 px-6 text-base gap-2"
|
|
78
|
+
// 48px height, 24px paddingX, 16px font
|
|
79
|
+
},
|
|
80
|
+
radius: {
|
|
81
|
+
none: "rounded-none",
|
|
82
|
+
sm: "rounded-sm",
|
|
83
|
+
base: "rounded",
|
|
84
|
+
default: "rounded-md",
|
|
85
|
+
lg: "rounded-lg",
|
|
86
|
+
xl: "rounded-xl",
|
|
87
|
+
"2xl": "rounded-2xl",
|
|
88
|
+
"3xl": "rounded-3xl",
|
|
89
|
+
full: "rounded-full"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
defaultVariants: {
|
|
93
|
+
variant: "default",
|
|
94
|
+
size: "default",
|
|
95
|
+
radius: "default",
|
|
96
|
+
fontWeight: "normal"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
const ToggleGroupContext = React.createContext({
|
|
101
|
+
variant: "default",
|
|
102
|
+
size: "default",
|
|
103
|
+
radius: "default",
|
|
104
|
+
fontWeight: "normal"
|
|
105
|
+
});
|
|
106
|
+
const ToggleGroupRoot = React.forwardRef(({ className, orientation, variant, size, radius, fontWeight, children, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
107
|
+
ToggleGroupPrimitive.Root,
|
|
108
|
+
{
|
|
109
|
+
ref,
|
|
110
|
+
className: (0, import_utils.cn)(
|
|
111
|
+
toggleGroupVariants({ orientation }),
|
|
112
|
+
// Attached style for horizontal
|
|
113
|
+
orientation !== "vertical" && [
|
|
114
|
+
"[&>*:not(:first-child)]:rounded-l-none",
|
|
115
|
+
"[&>*:not(:last-child)]:rounded-r-none",
|
|
116
|
+
"[&>*:not(:first-child)]:-ml-px",
|
|
117
|
+
"[&>*]:relative",
|
|
118
|
+
"[&>*:hover]:z-10",
|
|
119
|
+
"[&>*:focus-visible]:z-10",
|
|
120
|
+
"[&>*:active]:scale-none"
|
|
121
|
+
],
|
|
122
|
+
// Attached style for vertical
|
|
123
|
+
orientation === "vertical" && [
|
|
124
|
+
"[&>*:not(:first-child)]:rounded-t-none",
|
|
125
|
+
"[&>*:not(:last-child)]:rounded-b-none",
|
|
126
|
+
"[&>*:not(:first-child)]:-mt-px",
|
|
127
|
+
"[&>*]:relative",
|
|
128
|
+
"[&>*]:w-full",
|
|
129
|
+
"[&>*:hover]:z-10",
|
|
130
|
+
"[&>*:focus-visible]:z-10",
|
|
131
|
+
"[&>*:active]:scale-none"
|
|
132
|
+
],
|
|
133
|
+
className
|
|
134
|
+
),
|
|
135
|
+
orientation,
|
|
136
|
+
...props
|
|
137
|
+
},
|
|
138
|
+
/* @__PURE__ */ React.createElement(ToggleGroupContext.Provider, { value: { variant, size, radius, fontWeight } }, children)
|
|
139
|
+
));
|
|
140
|
+
ToggleGroupRoot.displayName = ToggleGroupPrimitive.Root.displayName;
|
|
141
|
+
const iconSizeClasses = {
|
|
142
|
+
xs: "[&>svg]:icon-xs",
|
|
143
|
+
// 14px
|
|
144
|
+
sm: "[&>svg]:icon-xs",
|
|
145
|
+
// 14px
|
|
146
|
+
md: "[&>svg]:icon-sm",
|
|
147
|
+
// 16px
|
|
148
|
+
default: "[&>svg]:icon-sm",
|
|
149
|
+
// 16px
|
|
150
|
+
lg: "[&>svg]:icon-sm"
|
|
151
|
+
// 16px
|
|
152
|
+
};
|
|
153
|
+
const ToggleGroupItem = React.forwardRef(({ className, variant, size, radius, fontWeight, children, ...props }, ref) => {
|
|
154
|
+
const context = React.useContext(ToggleGroupContext);
|
|
155
|
+
const resolvedSize = size || context.size || "default";
|
|
156
|
+
return /* @__PURE__ */ React.createElement(
|
|
157
|
+
ToggleGroupPrimitive.Item,
|
|
158
|
+
{
|
|
159
|
+
ref,
|
|
160
|
+
className: (0, import_utils.cn)(
|
|
161
|
+
toggleGroupItemVariants({
|
|
162
|
+
variant: variant || context.variant,
|
|
163
|
+
size: resolvedSize,
|
|
164
|
+
radius: radius || context.radius,
|
|
165
|
+
fontWeight: fontWeight || context.fontWeight
|
|
166
|
+
}),
|
|
167
|
+
iconSizeClasses[resolvedSize],
|
|
168
|
+
className
|
|
169
|
+
),
|
|
170
|
+
...props
|
|
171
|
+
},
|
|
172
|
+
children
|
|
173
|
+
);
|
|
174
|
+
});
|
|
175
|
+
ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
|
|
176
|
+
const ToggleGroup = Object.assign(ToggleGroupRoot, {
|
|
177
|
+
Item: ToggleGroupItem
|
|
178
|
+
});
|
|
179
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
180
|
+
0 && (module.exports = {
|
|
181
|
+
ToggleGroup,
|
|
182
|
+
ToggleGroupItem,
|
|
183
|
+
toggleGroupItemVariants,
|
|
184
|
+
toggleGroupVariants
|
|
185
|
+
});
|
|
186
|
+
//# sourceMappingURL=toggle-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/toggle-group.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\n\nconst toggleGroupVariants = cva(\n 'inline-flex items-center justify-center',\n {\n variants: {\n orientation: {\n horizontal: 'flex-row',\n vertical: 'flex-col',\n },\n },\n defaultVariants: {\n orientation: 'horizontal',\n },\n }\n)\n\nconst toggleGroupItemVariants = cva(\n 'inline-flex items-center justify-center text-sm text-text-muted transition-all duration-micro focus-visible:focus-ring disabled:pointer-events-none disabled:opacity-50',\n {\n variants: {\n variant: {\n default: 'bg-transparent hover:bg-background-muted hover:text-foreground data-[state=on]:bg-background-muted data-[state=on]:text-foreground',\n outline: 'border border-border-form bg-transparent hover:bg-background-muted hover:text-foreground data-[state=on]:bg-background-muted data-[state=on]:text-foreground',\n },\n fontWeight: {\n normal: 'font-normal',\n semibold: 'font-semibold',\n },\n size: {\n xs: 'h-7 px-2.5 text-xs gap-1', // 28px height, 10px paddingX, 12px font\n sm: 'h-8 px-3 text-sm gap-2', // 32px height, 12px paddingX, 13px font\n md: 'h-9 px-3.5 text-md gap-2', // 36px height, 14px paddingX, 14px font\n default: 'h-10 px-4 text-md gap-2', // 40px height, 16px paddingX, 14px font\n lg: 'h-12 px-6 text-base gap-2', // 48px height, 24px paddingX, 16px font\n },\n radius: {\n none: 'rounded-none',\n sm: 'rounded-sm',\n base: 'rounded',\n default: 'rounded-md',\n lg: 'rounded-lg',\n xl: 'rounded-xl',\n '2xl': 'rounded-2xl',\n '3xl': 'rounded-3xl',\n full: 'rounded-full',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n radius: 'default',\n fontWeight: 'normal',\n },\n }\n)\n\nconst ToggleGroupContext = React.createContext<\n VariantProps<typeof toggleGroupItemVariants>\n>({\n variant: 'default',\n size: 'default',\n radius: 'default',\n fontWeight: 'normal',\n})\n\ntype ToggleGroupSingleProps = {\n type: 'single'\n value?: string\n defaultValue?: string\n onValueChange?: (value: string) => void\n}\n\ntype ToggleGroupMultipleProps = {\n type: 'multiple'\n value?: string[]\n defaultValue?: string[]\n onValueChange?: (value: string[]) => void\n}\n\ntype ToggleGroupBaseProps = Omit<\n React.ComponentPropsWithoutRef<'div'>,\n 'defaultValue' | 'dir'\n> & {\n disabled?: boolean\n rovingFocus?: boolean\n orientation?: 'horizontal' | 'vertical'\n dir?: 'ltr' | 'rtl'\n loop?: boolean\n children?: React.ReactNode\n}\n\nexport type ToggleGroupProps = ToggleGroupBaseProps &\n VariantProps<typeof toggleGroupVariants> &\n VariantProps<typeof toggleGroupItemVariants> &\n (ToggleGroupSingleProps | ToggleGroupMultipleProps)\n\nconst ToggleGroupRoot = React.forwardRef<\n React.ElementRef<typeof ToggleGroupPrimitive.Root>,\n ToggleGroupProps\n>(({ className, orientation, variant, size, radius, fontWeight, children, ...props }, ref) => (\n <ToggleGroupPrimitive.Root\n ref={ref}\n className={cn(\n toggleGroupVariants({ orientation }),\n // Attached style for horizontal\n orientation !== 'vertical' && [\n '[&>*:not(:first-child)]:rounded-l-none',\n '[&>*:not(:last-child)]:rounded-r-none',\n '[&>*:not(:first-child)]:-ml-px',\n '[&>*]:relative',\n '[&>*:hover]:z-10',\n '[&>*:focus-visible]:z-10',\n '[&>*:active]:scale-none',\n ],\n // Attached style for vertical\n orientation === 'vertical' && [\n '[&>*:not(:first-child)]:rounded-t-none',\n '[&>*:not(:last-child)]:rounded-b-none',\n '[&>*:not(:first-child)]:-mt-px',\n '[&>*]:relative',\n '[&>*]:w-full',\n '[&>*:hover]:z-10',\n '[&>*:focus-visible]:z-10',\n '[&>*:active]:scale-none',\n ],\n className\n )}\n orientation={orientation}\n {...(props as React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root>)}\n >\n <ToggleGroupContext.Provider value={{ variant, size, radius, fontWeight }}>\n {children}\n </ToggleGroupContext.Provider>\n </ToggleGroupPrimitive.Root>\n))\nToggleGroupRoot.displayName = ToggleGroupPrimitive.Root.displayName\n\nexport interface ToggleGroupItemProps\n extends React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item>,\n Omit<VariantProps<typeof toggleGroupItemVariants>, 'fontWeight'> {\n fontWeight?: 'normal' | 'semibold'\n}\n\n// Icon size for toggle group (5-step scale, Icon+Text mode)\n// xs~sm: 14px, md~default~lg: 16px\nconst iconSizeClasses = {\n xs: '[&>svg]:icon-xs', // 14px\n sm: '[&>svg]:icon-xs', // 14px\n md: '[&>svg]:icon-sm', // 16px\n default: '[&>svg]:icon-sm', // 16px\n lg: '[&>svg]:icon-sm', // 16px\n}\n\nconst ToggleGroupItem = React.forwardRef<\n React.ElementRef<typeof ToggleGroupPrimitive.Item>,\n ToggleGroupItemProps\n>(({ className, variant, size, radius, fontWeight, children, ...props }, ref) => {\n const context = React.useContext(ToggleGroupContext)\n const resolvedSize = size || context.size || 'default'\n\n return (\n <ToggleGroupPrimitive.Item\n ref={ref}\n className={cn(\n toggleGroupItemVariants({\n variant: variant || context.variant,\n size: resolvedSize,\n radius: radius || context.radius,\n fontWeight: fontWeight || context.fontWeight,\n }),\n iconSizeClasses[resolvedSize],\n className\n )}\n {...props}\n >\n {children}\n </ToggleGroupPrimitive.Item>\n )\n})\nToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName\n\n// ─── Namespace ──────────────────────────────────────────\nconst ToggleGroup = Object.assign(ToggleGroupRoot, {\n Item: ToggleGroupItem,\n})\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nnamespace ToggleGroup {\n export type ItemProps = ToggleGroupItemProps\n}\n\nexport { ToggleGroup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C;AACD,gBAAgB,cAAc,qBAAqB,KAAK;AAGxD,MAAM,cAAc,OAAO,OAAO,iBAAiB;AAAA,EACjD,MAAM;AACR,CAAC;","names":[]}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../../lib/utils";
|
|
6
|
+
const toggleGroupVariants = cva(
|
|
7
|
+
"inline-flex items-center justify-center",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
orientation: {
|
|
11
|
+
horizontal: "flex-row",
|
|
12
|
+
vertical: "flex-col"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
orientation: "horizontal"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
const toggleGroupItemVariants = cva(
|
|
21
|
+
"inline-flex items-center justify-center text-sm text-text-muted transition-all duration-micro focus-visible:focus-ring disabled:pointer-events-none disabled:opacity-50",
|
|
22
|
+
{
|
|
23
|
+
variants: {
|
|
24
|
+
variant: {
|
|
25
|
+
default: "bg-transparent hover:bg-background-muted hover:text-foreground data-[state=on]:bg-background-muted data-[state=on]:text-foreground",
|
|
26
|
+
outline: "border border-border-form bg-transparent hover:bg-background-muted hover:text-foreground data-[state=on]:bg-background-muted data-[state=on]:text-foreground"
|
|
27
|
+
},
|
|
28
|
+
fontWeight: {
|
|
29
|
+
normal: "font-normal",
|
|
30
|
+
semibold: "font-semibold"
|
|
31
|
+
},
|
|
32
|
+
size: {
|
|
33
|
+
xs: "h-7 px-2.5 text-xs gap-1",
|
|
34
|
+
// 28px height, 10px paddingX, 12px font
|
|
35
|
+
sm: "h-8 px-3 text-sm gap-2",
|
|
36
|
+
// 32px height, 12px paddingX, 13px font
|
|
37
|
+
md: "h-9 px-3.5 text-md gap-2",
|
|
38
|
+
// 36px height, 14px paddingX, 14px font
|
|
39
|
+
default: "h-10 px-4 text-md gap-2",
|
|
40
|
+
// 40px height, 16px paddingX, 14px font
|
|
41
|
+
lg: "h-12 px-6 text-base gap-2"
|
|
42
|
+
// 48px height, 24px paddingX, 16px font
|
|
43
|
+
},
|
|
44
|
+
radius: {
|
|
45
|
+
none: "rounded-none",
|
|
46
|
+
sm: "rounded-sm",
|
|
47
|
+
base: "rounded",
|
|
48
|
+
default: "rounded-md",
|
|
49
|
+
lg: "rounded-lg",
|
|
50
|
+
xl: "rounded-xl",
|
|
51
|
+
"2xl": "rounded-2xl",
|
|
52
|
+
"3xl": "rounded-3xl",
|
|
53
|
+
full: "rounded-full"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
defaultVariants: {
|
|
57
|
+
variant: "default",
|
|
58
|
+
size: "default",
|
|
59
|
+
radius: "default",
|
|
60
|
+
fontWeight: "normal"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
const ToggleGroupContext = React.createContext({
|
|
65
|
+
variant: "default",
|
|
66
|
+
size: "default",
|
|
67
|
+
radius: "default",
|
|
68
|
+
fontWeight: "normal"
|
|
69
|
+
});
|
|
70
|
+
const ToggleGroupRoot = React.forwardRef(({ className, orientation, variant, size, radius, fontWeight, children, ...props }, ref) => /* @__PURE__ */ React.createElement(
|
|
71
|
+
ToggleGroupPrimitive.Root,
|
|
72
|
+
{
|
|
73
|
+
ref,
|
|
74
|
+
className: cn(
|
|
75
|
+
toggleGroupVariants({ orientation }),
|
|
76
|
+
// Attached style for horizontal
|
|
77
|
+
orientation !== "vertical" && [
|
|
78
|
+
"[&>*:not(:first-child)]:rounded-l-none",
|
|
79
|
+
"[&>*:not(:last-child)]:rounded-r-none",
|
|
80
|
+
"[&>*:not(:first-child)]:-ml-px",
|
|
81
|
+
"[&>*]:relative",
|
|
82
|
+
"[&>*:hover]:z-10",
|
|
83
|
+
"[&>*:focus-visible]:z-10",
|
|
84
|
+
"[&>*:active]:scale-none"
|
|
85
|
+
],
|
|
86
|
+
// Attached style for vertical
|
|
87
|
+
orientation === "vertical" && [
|
|
88
|
+
"[&>*:not(:first-child)]:rounded-t-none",
|
|
89
|
+
"[&>*:not(:last-child)]:rounded-b-none",
|
|
90
|
+
"[&>*:not(:first-child)]:-mt-px",
|
|
91
|
+
"[&>*]:relative",
|
|
92
|
+
"[&>*]:w-full",
|
|
93
|
+
"[&>*:hover]:z-10",
|
|
94
|
+
"[&>*:focus-visible]:z-10",
|
|
95
|
+
"[&>*:active]:scale-none"
|
|
96
|
+
],
|
|
97
|
+
className
|
|
98
|
+
),
|
|
99
|
+
orientation,
|
|
100
|
+
...props
|
|
101
|
+
},
|
|
102
|
+
/* @__PURE__ */ React.createElement(ToggleGroupContext.Provider, { value: { variant, size, radius, fontWeight } }, children)
|
|
103
|
+
));
|
|
104
|
+
ToggleGroupRoot.displayName = ToggleGroupPrimitive.Root.displayName;
|
|
105
|
+
const iconSizeClasses = {
|
|
106
|
+
xs: "[&>svg]:icon-xs",
|
|
107
|
+
// 14px
|
|
108
|
+
sm: "[&>svg]:icon-xs",
|
|
109
|
+
// 14px
|
|
110
|
+
md: "[&>svg]:icon-sm",
|
|
111
|
+
// 16px
|
|
112
|
+
default: "[&>svg]:icon-sm",
|
|
113
|
+
// 16px
|
|
114
|
+
lg: "[&>svg]:icon-sm"
|
|
115
|
+
// 16px
|
|
116
|
+
};
|
|
117
|
+
const ToggleGroupItem = React.forwardRef(({ className, variant, size, radius, fontWeight, children, ...props }, ref) => {
|
|
118
|
+
const context = React.useContext(ToggleGroupContext);
|
|
119
|
+
const resolvedSize = size || context.size || "default";
|
|
120
|
+
return /* @__PURE__ */ React.createElement(
|
|
121
|
+
ToggleGroupPrimitive.Item,
|
|
122
|
+
{
|
|
123
|
+
ref,
|
|
124
|
+
className: cn(
|
|
125
|
+
toggleGroupItemVariants({
|
|
126
|
+
variant: variant || context.variant,
|
|
127
|
+
size: resolvedSize,
|
|
128
|
+
radius: radius || context.radius,
|
|
129
|
+
fontWeight: fontWeight || context.fontWeight
|
|
130
|
+
}),
|
|
131
|
+
iconSizeClasses[resolvedSize],
|
|
132
|
+
className
|
|
133
|
+
),
|
|
134
|
+
...props
|
|
135
|
+
},
|
|
136
|
+
children
|
|
137
|
+
);
|
|
138
|
+
});
|
|
139
|
+
ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
|
|
140
|
+
const ToggleGroup = Object.assign(ToggleGroupRoot, {
|
|
141
|
+
Item: ToggleGroupItem
|
|
142
|
+
});
|
|
143
|
+
export {
|
|
144
|
+
ToggleGroup,
|
|
145
|
+
ToggleGroupItem,
|
|
146
|
+
toggleGroupItemVariants,
|
|
147
|
+
toggleGroupVariants
|
|
148
|
+
};
|
|
149
|
+
//# sourceMappingURL=toggle-group.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/toggle-group.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\n\nconst toggleGroupVariants = cva(\n 'inline-flex items-center justify-center',\n {\n variants: {\n orientation: {\n horizontal: 'flex-row',\n vertical: 'flex-col',\n },\n },\n defaultVariants: {\n orientation: 'horizontal',\n },\n }\n)\n\nconst toggleGroupItemVariants = cva(\n 'inline-flex items-center justify-center text-sm text-text-muted transition-all duration-micro focus-visible:focus-ring disabled:pointer-events-none disabled:opacity-50',\n {\n variants: {\n variant: {\n default: 'bg-transparent hover:bg-background-muted hover:text-foreground data-[state=on]:bg-background-muted data-[state=on]:text-foreground',\n outline: 'border border-border-form bg-transparent hover:bg-background-muted hover:text-foreground data-[state=on]:bg-background-muted data-[state=on]:text-foreground',\n },\n fontWeight: {\n normal: 'font-normal',\n semibold: 'font-semibold',\n },\n size: {\n xs: 'h-7 px-2.5 text-xs gap-1', // 28px height, 10px paddingX, 12px font\n sm: 'h-8 px-3 text-sm gap-2', // 32px height, 12px paddingX, 13px font\n md: 'h-9 px-3.5 text-md gap-2', // 36px height, 14px paddingX, 14px font\n default: 'h-10 px-4 text-md gap-2', // 40px height, 16px paddingX, 14px font\n lg: 'h-12 px-6 text-base gap-2', // 48px height, 24px paddingX, 16px font\n },\n radius: {\n none: 'rounded-none',\n sm: 'rounded-sm',\n base: 'rounded',\n default: 'rounded-md',\n lg: 'rounded-lg',\n xl: 'rounded-xl',\n '2xl': 'rounded-2xl',\n '3xl': 'rounded-3xl',\n full: 'rounded-full',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n radius: 'default',\n fontWeight: 'normal',\n },\n }\n)\n\nconst ToggleGroupContext = React.createContext<\n VariantProps<typeof toggleGroupItemVariants>\n>({\n variant: 'default',\n size: 'default',\n radius: 'default',\n fontWeight: 'normal',\n})\n\ntype ToggleGroupSingleProps = {\n type: 'single'\n value?: string\n defaultValue?: string\n onValueChange?: (value: string) => void\n}\n\ntype ToggleGroupMultipleProps = {\n type: 'multiple'\n value?: string[]\n defaultValue?: string[]\n onValueChange?: (value: string[]) => void\n}\n\ntype ToggleGroupBaseProps = Omit<\n React.ComponentPropsWithoutRef<'div'>,\n 'defaultValue' | 'dir'\n> & {\n disabled?: boolean\n rovingFocus?: boolean\n orientation?: 'horizontal' | 'vertical'\n dir?: 'ltr' | 'rtl'\n loop?: boolean\n children?: React.ReactNode\n}\n\nexport type ToggleGroupProps = ToggleGroupBaseProps &\n VariantProps<typeof toggleGroupVariants> &\n VariantProps<typeof toggleGroupItemVariants> &\n (ToggleGroupSingleProps | ToggleGroupMultipleProps)\n\nconst ToggleGroupRoot = React.forwardRef<\n React.ElementRef<typeof ToggleGroupPrimitive.Root>,\n ToggleGroupProps\n>(({ className, orientation, variant, size, radius, fontWeight, children, ...props }, ref) => (\n <ToggleGroupPrimitive.Root\n ref={ref}\n className={cn(\n toggleGroupVariants({ orientation }),\n // Attached style for horizontal\n orientation !== 'vertical' && [\n '[&>*:not(:first-child)]:rounded-l-none',\n '[&>*:not(:last-child)]:rounded-r-none',\n '[&>*:not(:first-child)]:-ml-px',\n '[&>*]:relative',\n '[&>*:hover]:z-10',\n '[&>*:focus-visible]:z-10',\n '[&>*:active]:scale-none',\n ],\n // Attached style for vertical\n orientation === 'vertical' && [\n '[&>*:not(:first-child)]:rounded-t-none',\n '[&>*:not(:last-child)]:rounded-b-none',\n '[&>*:not(:first-child)]:-mt-px',\n '[&>*]:relative',\n '[&>*]:w-full',\n '[&>*:hover]:z-10',\n '[&>*:focus-visible]:z-10',\n '[&>*:active]:scale-none',\n ],\n className\n )}\n orientation={orientation}\n {...(props as React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root>)}\n >\n <ToggleGroupContext.Provider value={{ variant, size, radius, fontWeight }}>\n {children}\n </ToggleGroupContext.Provider>\n </ToggleGroupPrimitive.Root>\n))\nToggleGroupRoot.displayName = ToggleGroupPrimitive.Root.displayName\n\nexport interface ToggleGroupItemProps\n extends React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item>,\n Omit<VariantProps<typeof toggleGroupItemVariants>, 'fontWeight'> {\n fontWeight?: 'normal' | 'semibold'\n}\n\n// Icon size for toggle group (5-step scale, Icon+Text mode)\n// xs~sm: 14px, md~default~lg: 16px\nconst iconSizeClasses = {\n xs: '[&>svg]:icon-xs', // 14px\n sm: '[&>svg]:icon-xs', // 14px\n md: '[&>svg]:icon-sm', // 16px\n default: '[&>svg]:icon-sm', // 16px\n lg: '[&>svg]:icon-sm', // 16px\n}\n\nconst ToggleGroupItem = React.forwardRef<\n React.ElementRef<typeof ToggleGroupPrimitive.Item>,\n ToggleGroupItemProps\n>(({ className, variant, size, radius, fontWeight, children, ...props }, ref) => {\n const context = React.useContext(ToggleGroupContext)\n const resolvedSize = size || context.size || 'default'\n\n return (\n <ToggleGroupPrimitive.Item\n ref={ref}\n className={cn(\n toggleGroupItemVariants({\n variant: variant || context.variant,\n size: resolvedSize,\n radius: radius || context.radius,\n fontWeight: fontWeight || context.fontWeight,\n }),\n iconSizeClasses[resolvedSize],\n className\n )}\n {...props}\n >\n {children}\n </ToggleGroupPrimitive.Item>\n )\n})\nToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName\n\n// ─── Namespace ──────────────────────────────────────────\nconst ToggleGroup = Object.assign(ToggleGroupRoot, {\n Item: ToggleGroupItem,\n})\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nnamespace ToggleGroup {\n export type ItemProps = ToggleGroupItemProps\n}\n\nexport { ToggleGroup, ToggleGroupItem, toggleGroupVariants, toggleGroupItemVariants }\n"],"mappings":";AAEA,YAAY,WAAW;AACvB,YAAY,0BAA0B;AACtC,SAAS,WAA8B;AACvC,SAAS,UAAU;AAEnB,MAAM,sBAAsB;AAAA,EAC1B;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,aAAa;AAAA,QACX,YAAY;AAAA,QACZ,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,aAAa;AAAA,IACf;AAAA,EACF;AACF;AAEA,MAAM,0BAA0B;AAAA,EAC9B;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,SAAS;AAAA,MACX;AAAA,MACA,YAAY;AAAA,QACV,QAAQ;AAAA,QACR,UAAU;AAAA,MACZ;AAAA,MACA,MAAM;AAAA,QACJ,IAAI;AAAA;AAAA,QACJ,IAAI;AAAA;AAAA,QACJ,IAAI;AAAA;AAAA,QACJ,SAAS;AAAA;AAAA,QACT,IAAI;AAAA;AAAA,MACN;AAAA,MACA,QAAQ;AAAA,QACN,MAAM;AAAA,QACN,IAAI;AAAA,QACJ,MAAM;AAAA,QACN,SAAS;AAAA,QACT,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,OAAO;AAAA,QACP,OAAO;AAAA,QACP,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,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AAqB;AAAA,IAArB;AAAA,MACC;AAAA,MACA,WAAW;AAAA,QACT,wBAAwB;AAAA,UACtB,SAAS,WAAW,QAAQ;AAAA,UAC5B,MAAM;AAAA,UACN,QAAQ,UAAU,QAAQ;AAAA,UAC1B,YAAY,cAAc,QAAQ;AAAA,QACpC,CAAC;AAAA,QACD,gBAAgB,YAAY;AAAA,QAC5B;AAAA,MACF;AAAA,MACC,GAAG;AAAA;AAAA,IAEH;AAAA,EACH;AAEJ,CAAC;AACD,gBAAgB,cAAc,qBAAqB,KAAK;AAGxD,MAAM,cAAc,OAAO,OAAO,iBAAiB;AAAA,EACjD,MAAM;AACR,CAAC;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import * as TogglePrimitive from '@radix-ui/react-toggle';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
|
|
6
|
+
declare const toggleVariants: (props?: ({
|
|
7
|
+
variant?: "default" | "outline" | "ghost" | "outline-ghost" | null | undefined;
|
|
8
|
+
fontWeight?: "normal" | "semibold" | null | undefined;
|
|
9
|
+
size?: "default" | "sm" | "lg" | "md" | "xs" | null | undefined;
|
|
10
|
+
radius?: "default" | "sm" | "lg" | "base" | "none" | "xl" | "2xl" | "3xl" | "full" | null | undefined;
|
|
11
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
12
|
+
interface ToggleProps extends React.ComponentPropsWithoutRef<typeof TogglePrimitive.Root>, Omit<VariantProps<typeof toggleVariants>, 'fontWeight'> {
|
|
13
|
+
iconOnly?: boolean;
|
|
14
|
+
fontWeight?: 'normal' | 'semibold';
|
|
15
|
+
pressEffect?: boolean;
|
|
16
|
+
}
|
|
17
|
+
declare const Toggle: React.ForwardRefExoticComponent<ToggleProps & React.RefAttributes<HTMLButtonElement>>;
|
|
18
|
+
|
|
19
|
+
export { Toggle, type ToggleProps, toggleVariants };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import * as TogglePrimitive from '@radix-ui/react-toggle';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
|
|
6
|
+
declare const toggleVariants: (props?: ({
|
|
7
|
+
variant?: "default" | "outline" | "ghost" | "outline-ghost" | null | undefined;
|
|
8
|
+
fontWeight?: "normal" | "semibold" | null | undefined;
|
|
9
|
+
size?: "default" | "sm" | "lg" | "md" | "xs" | null | undefined;
|
|
10
|
+
radius?: "default" | "sm" | "lg" | "base" | "none" | "xl" | "2xl" | "3xl" | "full" | null | undefined;
|
|
11
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
12
|
+
interface ToggleProps extends React.ComponentPropsWithoutRef<typeof TogglePrimitive.Root>, Omit<VariantProps<typeof toggleVariants>, 'fontWeight'> {
|
|
13
|
+
iconOnly?: boolean;
|
|
14
|
+
fontWeight?: 'normal' | 'semibold';
|
|
15
|
+
pressEffect?: boolean;
|
|
16
|
+
}
|
|
17
|
+
declare const Toggle: React.ForwardRefExoticComponent<ToggleProps & React.RefAttributes<HTMLButtonElement>>;
|
|
18
|
+
|
|
19
|
+
export { Toggle, type ToggleProps, toggleVariants };
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var toggle_exports = {};
|
|
31
|
+
__export(toggle_exports, {
|
|
32
|
+
Toggle: () => Toggle,
|
|
33
|
+
toggleVariants: () => toggleVariants
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(toggle_exports);
|
|
36
|
+
var React = __toESM(require("react"));
|
|
37
|
+
var TogglePrimitive = __toESM(require("@radix-ui/react-toggle"));
|
|
38
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
39
|
+
var import_utils = require("../../lib/utils");
|
|
40
|
+
const toggleBaseStyles = "inline-flex items-center justify-center text-text-muted transition-all duration-micro focus-visible:focus-ring disabled:pointer-events-none disabled:opacity-50";
|
|
41
|
+
const toggleVariants = (0, import_class_variance_authority.cva)(
|
|
42
|
+
toggleBaseStyles,
|
|
43
|
+
{
|
|
44
|
+
variants: {
|
|
45
|
+
variant: {
|
|
46
|
+
default: "bg-transparent hover:bg-background-muted hover:text-foreground data-[state=on]:bg-background-muted data-[state=on]:text-foreground",
|
|
47
|
+
outline: "border border-border-form bg-transparent hover:bg-background-muted hover:text-foreground data-[state=on]:bg-background-muted data-[state=on]:text-foreground",
|
|
48
|
+
ghost: "bg-transparent hover:text-foreground data-[state=on]:bg-transparent data-[state=on]:text-foreground",
|
|
49
|
+
"outline-ghost": "border border-border-form bg-transparent hover:text-foreground data-[state=on]:bg-transparent data-[state=on]:text-foreground data-[state=on]:border-border-form"
|
|
50
|
+
},
|
|
51
|
+
fontWeight: {
|
|
52
|
+
normal: "font-normal",
|
|
53
|
+
semibold: "font-semibold"
|
|
54
|
+
},
|
|
55
|
+
size: {
|
|
56
|
+
xs: "h-7 px-2.5 text-xs gap-1",
|
|
57
|
+
// 28px height, 10px paddingX, 12px font
|
|
58
|
+
sm: "h-8 px-3 text-sm gap-2",
|
|
59
|
+
// 32px height, 12px paddingX, 13px font
|
|
60
|
+
md: "h-9 px-3.5 text-md gap-2",
|
|
61
|
+
// 36px height, 14px paddingX, 14px font
|
|
62
|
+
default: "h-10 px-4 text-md gap-2",
|
|
63
|
+
// 40px height, 16px paddingX, 14px font
|
|
64
|
+
lg: "h-12 px-6 text-base gap-2"
|
|
65
|
+
// 48px height, 24px paddingX, 16px font
|
|
66
|
+
},
|
|
67
|
+
radius: {
|
|
68
|
+
none: "rounded-none",
|
|
69
|
+
// 0px - primitive.borderRadius.none
|
|
70
|
+
sm: "rounded-sm",
|
|
71
|
+
// 2px - primitive.borderRadius.sm
|
|
72
|
+
base: "rounded",
|
|
73
|
+
// 4px - primitive.borderRadius.base
|
|
74
|
+
default: "rounded-md",
|
|
75
|
+
// 6px - primitive.borderRadius.md
|
|
76
|
+
lg: "rounded-lg",
|
|
77
|
+
// 8px - primitive.borderRadius.lg
|
|
78
|
+
xl: "rounded-xl",
|
|
79
|
+
// 12px - primitive.borderRadius.xl
|
|
80
|
+
"2xl": "rounded-2xl",
|
|
81
|
+
// 16px - primitive.borderRadius.2xl
|
|
82
|
+
"3xl": "rounded-3xl",
|
|
83
|
+
// 24px - primitive.borderRadius.3xl
|
|
84
|
+
full: "rounded-full"
|
|
85
|
+
// 9999px - primitive.borderRadius.full
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
defaultVariants: {
|
|
89
|
+
variant: "default",
|
|
90
|
+
size: "default",
|
|
91
|
+
radius: "default",
|
|
92
|
+
// 6px - primitive.borderRadius.md (Figma button default)
|
|
93
|
+
fontWeight: "normal"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
const iconOnlySizes = {
|
|
98
|
+
xs: "h-7 w-7",
|
|
99
|
+
// 28px × 28px - spacing.7
|
|
100
|
+
sm: "h-8 w-8",
|
|
101
|
+
// 32px × 32px - spacing.8
|
|
102
|
+
md: "h-9 w-9",
|
|
103
|
+
// 36px × 36px - spacing.9
|
|
104
|
+
default: "h-10 w-10",
|
|
105
|
+
// 40px × 40px - spacing.10
|
|
106
|
+
lg: "h-12 w-12"
|
|
107
|
+
// 48px × 48px - spacing.12
|
|
108
|
+
};
|
|
109
|
+
const radiusClasses = {
|
|
110
|
+
none: "rounded-none",
|
|
111
|
+
sm: "rounded-sm",
|
|
112
|
+
base: "rounded",
|
|
113
|
+
default: "rounded-md",
|
|
114
|
+
lg: "rounded-lg",
|
|
115
|
+
xl: "rounded-xl",
|
|
116
|
+
"2xl": "rounded-2xl",
|
|
117
|
+
"3xl": "rounded-3xl",
|
|
118
|
+
full: "rounded-full"
|
|
119
|
+
};
|
|
120
|
+
const variantClasses = {
|
|
121
|
+
default: "bg-transparent hover:bg-background-muted hover:text-foreground data-[state=on]:bg-background-muted data-[state=on]:text-foreground",
|
|
122
|
+
outline: "border border-border-form bg-transparent hover:bg-background-muted hover:text-foreground data-[state=on]:bg-background-muted data-[state=on]:text-foreground",
|
|
123
|
+
ghost: "bg-transparent hover:text-foreground data-[state=on]:bg-transparent data-[state=on]:text-foreground",
|
|
124
|
+
"outline-ghost": "border border-border-form bg-transparent hover:text-foreground data-[state=on]:bg-transparent data-[state=on]:text-foreground data-[state=on]:border-border-form"
|
|
125
|
+
};
|
|
126
|
+
const iconSizeClasses = {
|
|
127
|
+
xs: "[&>svg]:icon-xs",
|
|
128
|
+
// 14px
|
|
129
|
+
sm: "[&>svg]:icon-xs",
|
|
130
|
+
// 14px
|
|
131
|
+
md: "[&>svg]:icon-sm",
|
|
132
|
+
// 16px
|
|
133
|
+
default: "[&>svg]:icon-sm",
|
|
134
|
+
// 16px
|
|
135
|
+
lg: "[&>svg]:icon-sm"
|
|
136
|
+
// 16px
|
|
137
|
+
};
|
|
138
|
+
const Toggle = React.forwardRef(({ className, variant, size, radius, fontWeight, iconOnly, pressEffect, ...props }, ref) => {
|
|
139
|
+
const sizeKey = size || "default";
|
|
140
|
+
const radiusKey = radius || "default";
|
|
141
|
+
const variantKey = variant || "default";
|
|
142
|
+
const fontWeightClass = fontWeight === "normal" ? "font-normal" : fontWeight === "semibold" ? "font-semibold" : "font-normal";
|
|
143
|
+
if (iconOnly) {
|
|
144
|
+
const iconOnlyIconSize = {
|
|
145
|
+
xs: "[&>svg]:icon-xs",
|
|
146
|
+
// 14px
|
|
147
|
+
sm: "[&>svg]:icon-sm",
|
|
148
|
+
// 16px
|
|
149
|
+
md: "[&>svg]:icon-sm",
|
|
150
|
+
// 16px
|
|
151
|
+
default: "[&>svg]:icon-md",
|
|
152
|
+
// 20px
|
|
153
|
+
lg: "[&>svg]:icon-lg"
|
|
154
|
+
// 24px
|
|
155
|
+
}[sizeKey];
|
|
156
|
+
return /* @__PURE__ */ React.createElement(
|
|
157
|
+
TogglePrimitive.Root,
|
|
158
|
+
{
|
|
159
|
+
ref,
|
|
160
|
+
className: (0, import_utils.cn)(
|
|
161
|
+
toggleBaseStyles,
|
|
162
|
+
pressEffect !== false && "active:scale-pressed",
|
|
163
|
+
fontWeightClass,
|
|
164
|
+
variantClasses[variantKey],
|
|
165
|
+
iconOnlySizes[sizeKey],
|
|
166
|
+
radiusClasses[radiusKey],
|
|
167
|
+
iconOnlyIconSize,
|
|
168
|
+
className
|
|
169
|
+
),
|
|
170
|
+
...props
|
|
171
|
+
}
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
return /* @__PURE__ */ React.createElement(
|
|
175
|
+
TogglePrimitive.Root,
|
|
176
|
+
{
|
|
177
|
+
ref,
|
|
178
|
+
className: (0, import_utils.cn)(
|
|
179
|
+
toggleVariants({ variant, size, radius, fontWeight }),
|
|
180
|
+
pressEffect !== false && "active:scale-pressed",
|
|
181
|
+
iconSizeClasses[sizeKey],
|
|
182
|
+
className
|
|
183
|
+
),
|
|
184
|
+
...props
|
|
185
|
+
}
|
|
186
|
+
);
|
|
187
|
+
});
|
|
188
|
+
Toggle.displayName = TogglePrimitive.Root.displayName;
|
|
189
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
190
|
+
0 && (module.exports = {
|
|
191
|
+
Toggle,
|
|
192
|
+
toggleVariants
|
|
193
|
+
});
|
|
194
|
+
//# sourceMappingURL=toggle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/toggle.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport * as TogglePrimitive from '@radix-ui/react-toggle'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\n\n// Base styles without size (for iconOnly mode)\nconst toggleBaseStyles = 'inline-flex items-center justify-center text-text-muted transition-all duration-micro focus-visible:focus-ring disabled:pointer-events-none disabled:opacity-50'\n\nconst toggleVariants = cva(\n toggleBaseStyles,\n {\n variants: {\n variant: {\n default: 'bg-transparent hover:bg-background-muted hover:text-foreground data-[state=on]:bg-background-muted data-[state=on]:text-foreground',\n outline: 'border border-border-form bg-transparent hover:bg-background-muted hover:text-foreground data-[state=on]:bg-background-muted data-[state=on]:text-foreground',\n ghost: 'bg-transparent hover:text-foreground data-[state=on]:bg-transparent data-[state=on]:text-foreground',\n 'outline-ghost': 'border border-border-form bg-transparent hover:text-foreground data-[state=on]:bg-transparent data-[state=on]:text-foreground data-[state=on]:border-border-form',\n },\n fontWeight: {\n normal: 'font-normal',\n semibold: 'font-semibold',\n },\n size: {\n xs: 'h-7 px-2.5 text-xs gap-1', // 28px height, 10px paddingX, 12px font\n sm: 'h-8 px-3 text-sm gap-2', // 32px height, 12px paddingX, 13px font\n md: 'h-9 px-3.5 text-md gap-2', // 36px height, 14px paddingX, 14px font\n default: 'h-10 px-4 text-md gap-2', // 40px height, 16px paddingX, 14px font\n lg: 'h-12 px-6 text-base gap-2', // 48px height, 24px paddingX, 16px font\n },\n radius: {\n none: 'rounded-none', // 0px - primitive.borderRadius.none\n sm: 'rounded-sm', // 2px - primitive.borderRadius.sm\n base: 'rounded', // 4px - primitive.borderRadius.base\n default: 'rounded-md', // 6px - primitive.borderRadius.md\n lg: 'rounded-lg', // 8px - primitive.borderRadius.lg\n xl: 'rounded-xl', // 12px - primitive.borderRadius.xl\n '2xl': 'rounded-2xl', // 16px - primitive.borderRadius.2xl\n '3xl': 'rounded-3xl', // 24px - primitive.borderRadius.3xl\n full: 'rounded-full', // 9999px - primitive.borderRadius.full\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n radius: 'default', // 6px - primitive.borderRadius.md (Figma button default)\n fontWeight: 'normal',\n },\n }\n)\n\n// iconOnly sizes - square like IconButton (same width and height, no padding)\nconst iconOnlySizes = {\n xs: 'h-7 w-7', // 28px × 28px - spacing.7\n sm: 'h-8 w-8', // 32px × 32px - spacing.8\n md: 'h-9 w-9', // 36px × 36px - spacing.9\n default: 'h-10 w-10', // 40px × 40px - spacing.10\n lg: 'h-12 w-12', // 48px × 48px - spacing.12\n}\n\n// Radius classes for iconOnly mode\nconst radiusClasses = {\n none: 'rounded-none',\n sm: 'rounded-sm',\n base: 'rounded',\n default: 'rounded-md',\n lg: 'rounded-lg',\n xl: 'rounded-xl',\n '2xl': 'rounded-2xl',\n '3xl': 'rounded-3xl',\n full: 'rounded-full',\n}\n\n// Variant classes for iconOnly mode\nconst variantClasses = {\n default: 'bg-transparent hover:bg-background-muted hover:text-foreground data-[state=on]:bg-background-muted data-[state=on]:text-foreground',\n outline: 'border border-border-form bg-transparent hover:bg-background-muted hover:text-foreground data-[state=on]:bg-background-muted data-[state=on]:text-foreground',\n ghost: 'bg-transparent hover:text-foreground data-[state=on]:bg-transparent data-[state=on]:text-foreground',\n 'outline-ghost': 'border border-border-form bg-transparent hover:text-foreground data-[state=on]:bg-transparent data-[state=on]:text-foreground data-[state=on]:border-border-form',\n}\n\nexport interface ToggleProps\n extends React.ComponentPropsWithoutRef<typeof TogglePrimitive.Root>,\n Omit<VariantProps<typeof toggleVariants>, 'fontWeight'> {\n iconOnly?: boolean\n fontWeight?: 'normal' | 'semibold'\n pressEffect?: boolean\n}\n\n// Icon size for text+icon mode (5-step scale)\n// xs~sm: 14px, md~default~lg: 16px\nconst iconSizeClasses = {\n xs: '[&>svg]:icon-xs', // 14px\n sm: '[&>svg]:icon-xs', // 14px\n md: '[&>svg]:icon-sm', // 16px\n default: '[&>svg]:icon-sm', // 16px\n lg: '[&>svg]:icon-sm', // 16px\n}\n\nconst Toggle = React.forwardRef<\n React.ElementRef<typeof TogglePrimitive.Root>,\n ToggleProps\n>(({ className, variant, size, radius, fontWeight, iconOnly, pressEffect, ...props }, ref) => {\n const sizeKey = size || 'default'\n const radiusKey = radius || 'default'\n const variantKey = variant || 'default'\n const fontWeightClass = fontWeight === 'normal' ? 'font-normal' : fontWeight === 'semibold' ? 'font-semibold' : 'font-normal'\n\n // When iconOnly, build classes manually without padding\n if (iconOnly) {\n // Icon only uses larger icon sizes (like IconButton, 5-step scale)\n // XS: 14px, SM~MD: 16px, Default: 20px, LG: 24px\n const iconOnlyIconSize = {\n xs: '[&>svg]:icon-xs', // 14px\n sm: '[&>svg]:icon-sm', // 16px\n md: '[&>svg]:icon-sm', // 16px\n default: '[&>svg]:icon-md', // 20px\n lg: '[&>svg]:icon-lg', // 24px\n }[sizeKey]\n\n return (\n <TogglePrimitive.Root\n ref={ref}\n className={cn(\n toggleBaseStyles,\n pressEffect !== false && 'active:scale-pressed',\n fontWeightClass,\n variantClasses[variantKey],\n iconOnlySizes[sizeKey],\n radiusClasses[radiusKey],\n iconOnlyIconSize,\n className\n )}\n {...props}\n />\n )\n }\n\n // Normal mode with padding\n return (\n <TogglePrimitive.Root\n ref={ref}\n className={cn(\n toggleVariants({ variant, size, radius, fontWeight }),\n pressEffect !== false && 'active:scale-pressed',\n iconSizeClasses[sizeKey],\n className\n )}\n {...props}\n />\n )\n})\n\nToggle.displayName = TogglePrimitive.Root.displayName\n\nexport { Toggle, toggleVariants }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AACvB,sBAAiC;AACjC,sCAAuC;AACvC,mBAAmB;AAGnB,MAAM,mBAAmB;AAEzB,MAAM,qBAAiB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,SAAS;AAAA,QACT,OAAO;AAAA,QACP,iBAAiB;AAAA,MACnB;AAAA,MACA,YAAY;AAAA,QACV,QAAQ;AAAA,QACR,UAAU;AAAA,MACZ;AAAA,MACA,MAAM;AAAA,QACJ,IAAI;AAAA;AAAA,QACJ,IAAI;AAAA;AAAA,QACJ,IAAI;AAAA;AAAA,QACJ,SAAS;AAAA;AAAA,QACT,IAAI;AAAA;AAAA,MACN;AAAA,MACA,QAAQ;AAAA,QACN,MAAM;AAAA;AAAA,QACN,IAAI;AAAA;AAAA,QACJ,MAAM;AAAA;AAAA,QACN,SAAS;AAAA;AAAA,QACT,IAAI;AAAA;AAAA,QACJ,IAAI;AAAA;AAAA,QACJ,OAAO;AAAA;AAAA,QACP,OAAO;AAAA;AAAA,QACP,MAAM;AAAA;AAAA,MACR;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;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