@reopt-ai/opt-ui 1.5.0 → 1.6.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/COMPONENT_CATALOG.md +83 -38
- package/README.md +28 -7
- package/dist/app.css +146 -0
- package/dist/core/index.cjs +164 -324
- package/dist/core/index.d.cts +3 -6
- package/dist/core/index.d.ts +3 -6
- package/dist/core/index.js +3 -323
- package/dist/docs/01-getting-started.md +25 -5
- package/dist/docs/02-components/01-core.md +36 -28
- package/dist/docs/02-components/02-visuals.md +1 -1
- package/dist/docs/02-components/03-shells.md +40 -12
- package/dist/docs/02-components/04-surfaces.md +1 -1
- package/dist/docs/02-components/index.md +1 -1
- package/dist/docs/03-recipes/03-layouts.md +16 -12
- package/dist/docs/05-migration/01-breaking-changes.md +28 -0
- package/dist/id-registry.cjs +1899 -1872
- package/dist/id-registry.d.cts +13 -10
- package/dist/id-registry.d.cts.map +1 -0
- package/dist/id-registry.d.ts +13 -10
- package/dist/id-registry.d.ts.map +1 -0
- package/dist/id-registry.js +1897 -1871
- package/dist/id-registry.js.map +1 -0
- package/dist/id-registry.json +28 -28
- package/dist/index.cjs +8294 -9790
- package/dist/index.d.cts +1486 -1442
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +1486 -1442
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7933 -9777
- package/dist/index.js.map +1 -0
- package/dist/meta.cjs +7461 -6875
- package/dist/meta.d.cts.map +1 -0
- package/dist/meta.d.ts.map +1 -0
- package/dist/meta.js +7460 -6846
- package/dist/meta.js.map +1 -0
- package/dist/pagination-By7Ozv3U.js +3788 -0
- package/dist/pagination-By7Ozv3U.js.map +1 -0
- package/dist/pagination-Uv3CnGJz.cjs +4677 -0
- package/dist/shader-surface-BK1GMt5_.d.cts +1788 -0
- package/dist/shader-surface-BK1GMt5_.d.cts.map +1 -0
- package/dist/shader-surface-BWhO2xkk.js +3715 -0
- package/dist/shader-surface-BWhO2xkk.js.map +1 -0
- package/dist/shader-surface-DIVWtpFl.d.ts +1788 -0
- package/dist/shader-surface-DIVWtpFl.d.ts.map +1 -0
- package/dist/shader-surface-DxLLfrE6.cjs +4108 -0
- package/dist/shells/index.cjs +51 -65
- package/dist/shells/index.d.cts +4 -5
- package/dist/shells/index.d.ts +4 -5
- package/dist/shells/index.js +3 -64
- package/dist/tailwind.css +49 -0
- package/dist/theme/server.cjs +257 -228
- package/dist/theme/server.d.cts +48 -60
- package/dist/theme/server.d.cts.map +1 -0
- package/dist/theme/server.d.ts +48 -60
- package/dist/theme/server.d.ts.map +1 -0
- package/dist/theme/server.js +234 -189
- package/dist/theme/server.js.map +1 -0
- package/dist/types-D0FlcYnM.d.cts +301 -0
- package/dist/types-D0FlcYnM.d.cts.map +1 -0
- package/dist/types-D0FlcYnM.d.ts +301 -0
- package/dist/types-D0FlcYnM.d.ts.map +1 -0
- package/dist/visuals/index.cjs +10 -4
- package/dist/visuals/index.d.cts +2 -1
- package/dist/visuals/index.d.ts +2 -1
- package/dist/visuals/index.js +1 -2
- package/dist/workflow-canvas-3Jeevkgy.cjs +2599 -0
- package/dist/workflow-canvas-BGBAcjf-.js +2403 -0
- package/dist/workflow-canvas-BGBAcjf-.js.map +1 -0
- package/dist/workflow-canvas-Bar_O2SQ.d.ts +494 -0
- package/dist/workflow-canvas-Bar_O2SQ.d.ts.map +1 -0
- package/dist/workflow-canvas-DghDRtHn.d.cts +494 -0
- package/dist/workflow-canvas-DghDRtHn.d.cts.map +1 -0
- package/package.json +11 -6
- package/dist/chunk-3GWWZKX7.js +0 -38
- package/dist/chunk-3QFYBBL6.cjs +0 -4759
- package/dist/chunk-3XD4HIFL.js +0 -3241
- package/dist/chunk-AFF2HPE5.cjs +0 -5008
- package/dist/chunk-NXZJIHEZ.cjs +0 -3241
- package/dist/chunk-ONE3C5RV.cjs +0 -38
- package/dist/chunk-RBM2RNC2.js +0 -5008
- package/dist/chunk-VBGPEW45.js +0 -4759
- package/dist/index-BZ_lBlO1.d.ts +0 -474
- package/dist/index-BuvxoWHf.d.cts +0 -474
- package/dist/index-DWyqDIkH.d.cts +0 -1689
- package/dist/index-Uyijm14M.d.ts +0 -1689
- package/dist/types-D4-0lwaE.d.cts +0 -298
- package/dist/types-D4-0lwaE.d.ts +0 -298
|
@@ -0,0 +1,4677 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
+
get: ((k) => from[k]).bind(null, key),
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
+
value: mod,
|
|
21
|
+
enumerable: true
|
|
22
|
+
}) : target, mod));
|
|
23
|
+
//#endregion
|
|
24
|
+
let clsx = require("clsx");
|
|
25
|
+
let tailwind_merge = require("tailwind-merge");
|
|
26
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
27
|
+
let react = require("react");
|
|
28
|
+
react = __toESM(react, 1);
|
|
29
|
+
let _reopt_ai_opt_ui_primitives = require("@reopt-ai/opt-ui-primitives");
|
|
30
|
+
let lucide_react = require("lucide-react");
|
|
31
|
+
//#region src/lib/cn.ts
|
|
32
|
+
/** Handles cn. */
|
|
33
|
+
function cn(...inputs) {
|
|
34
|
+
return (0, tailwind_merge.twMerge)((0, clsx.clsx)(inputs));
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/core/kbd.tsx
|
|
38
|
+
/** Renders the kbd component. */
|
|
39
|
+
function Kbd({ children, hint = false, className }) {
|
|
40
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("kbd", {
|
|
41
|
+
className: cn("border-border bg-bg-subtle text-text-tertiary inline-flex h-5 items-center gap-0.5 rounded border px-1.5 text-[11px] font-medium", hint && "opt-shortcut-hint", className),
|
|
42
|
+
"data-opt-id": "NPHB8",
|
|
43
|
+
"data-opt-slug": "kbd.Kbd",
|
|
44
|
+
children
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/objectWithoutPropertiesLoose.js
|
|
49
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
50
|
+
if (null == r) return {};
|
|
51
|
+
var t = {};
|
|
52
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
53
|
+
if (e.includes(n)) continue;
|
|
54
|
+
t[n] = r[n];
|
|
55
|
+
}
|
|
56
|
+
return t;
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/objectWithoutProperties.js
|
|
60
|
+
function _objectWithoutProperties(e, t) {
|
|
61
|
+
if (null == e) return {};
|
|
62
|
+
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
63
|
+
if (Object.getOwnPropertySymbols) {
|
|
64
|
+
var s = Object.getOwnPropertySymbols(e);
|
|
65
|
+
for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
66
|
+
}
|
|
67
|
+
return i;
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
|
|
71
|
+
function _typeof(o) {
|
|
72
|
+
"@babel/helpers - typeof";
|
|
73
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
74
|
+
return typeof o;
|
|
75
|
+
} : function(o) {
|
|
76
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
77
|
+
}, _typeof(o);
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
|
|
81
|
+
function toPrimitive(t, r) {
|
|
82
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
83
|
+
var e = t[Symbol.toPrimitive];
|
|
84
|
+
if (void 0 !== e) {
|
|
85
|
+
var i = e.call(t, r || "default");
|
|
86
|
+
if ("object" != _typeof(i)) return i;
|
|
87
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
88
|
+
}
|
|
89
|
+
return ("string" === r ? String : Number)(t);
|
|
90
|
+
}
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
|
|
93
|
+
function toPropertyKey(t) {
|
|
94
|
+
var i = toPrimitive(t, "string");
|
|
95
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
96
|
+
}
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
|
|
99
|
+
function _defineProperty(e, r, t) {
|
|
100
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
101
|
+
value: t,
|
|
102
|
+
enumerable: !0,
|
|
103
|
+
configurable: !0,
|
|
104
|
+
writable: !0
|
|
105
|
+
}) : e[r] = t, e;
|
|
106
|
+
}
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/objectSpread2.js
|
|
109
|
+
function ownKeys(e, r) {
|
|
110
|
+
var t = Object.keys(e);
|
|
111
|
+
if (Object.getOwnPropertySymbols) {
|
|
112
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
113
|
+
r && (o = o.filter(function(r) {
|
|
114
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
115
|
+
})), t.push.apply(t, o);
|
|
116
|
+
}
|
|
117
|
+
return t;
|
|
118
|
+
}
|
|
119
|
+
function _objectSpread2(e) {
|
|
120
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
121
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
122
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
|
|
123
|
+
_defineProperty(e, r, t[r]);
|
|
124
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
|
|
125
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
return e;
|
|
129
|
+
}
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region src/lib/styles.ts
|
|
132
|
+
/**
|
|
133
|
+
* 공유 스타일 토큰 — Primitive 전체에서 중복되는 Tailwind 패턴을 상수화합니다.
|
|
134
|
+
* 각 primitive는 이 토큰을 조합하고, 컴포넌트별 특수 스타일만 로컬에 정의합니다.
|
|
135
|
+
*
|
|
136
|
+
* CSS 변수 기반 — dark: prefix 불필요. 테마 프리셋이 모드별 값을 자동 해석합니다.
|
|
137
|
+
*/
|
|
138
|
+
const OPT_FOCUS = "outline-none data-[focus-visible]:outline-2 data-[focus-visible]:outline-ring data-[focus-visible]:-outline-offset-1";
|
|
139
|
+
const OPT_FOCUS_VISIBLE = "outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-ring-offset";
|
|
140
|
+
const OPT_ACTIVE_ITEM = "data-[active-item]:bg-accent data-[active-item]:text-accent-fg";
|
|
141
|
+
const OPT_HOVER_ITEM = "[@media(any-hover:hover)]:hover:bg-accent-subtle active:bg-accent-subtle";
|
|
142
|
+
const OPT_BORDER = "border border-border";
|
|
143
|
+
const OPT_DIVIDER = "divide-border-subtle";
|
|
144
|
+
const OPT_SURFACE = "rounded-lg bg-surface shadow-sm";
|
|
145
|
+
const OPT_SURFACE_POPOVER = "z-50 rounded-lg border border-border bg-surface-overlay p-2 shadow-lg";
|
|
146
|
+
const OPT_TEXT_PRIMARY = "text-text-primary";
|
|
147
|
+
const OPT_TEXT_SECONDARY = "text-text-secondary";
|
|
148
|
+
const OPT_TEXT_TERTIARY = "text-text-tertiary";
|
|
149
|
+
const OPT_TEXT_LABEL = "text-sm font-medium text-text-primary";
|
|
150
|
+
const OPT_ITEM_BASE = "cursor-default rounded px-2 py-2 text-sm outline-none text-text-primary";
|
|
151
|
+
const OPT_INPUT = "flex h-10 w-full rounded-lg border border-border bg-surface px-4 text-sm text-text-primary outline-none placeholder:text-text-tertiary focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-ring-offset";
|
|
152
|
+
const OPT_INPUT_SIZE = {
|
|
153
|
+
sm: "h-8 px-3 text-xs",
|
|
154
|
+
md: "",
|
|
155
|
+
lg: "h-12 px-5 text-base"
|
|
156
|
+
};
|
|
157
|
+
const OPT_TEXTAREA_SIZE = {
|
|
158
|
+
sm: "px-3 py-2 text-xs",
|
|
159
|
+
md: "",
|
|
160
|
+
lg: "px-5 py-4 text-base"
|
|
161
|
+
};
|
|
162
|
+
const OPT_INPUT_ERROR = "border-danger focus-visible:outline-danger";
|
|
163
|
+
const OPT_BADGE = "inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-medium";
|
|
164
|
+
const OPT_BADGE_BLUE = `${OPT_BADGE} bg-info-subtle text-info-fg`;
|
|
165
|
+
const OPT_BADGE_GREEN = `${OPT_BADGE} bg-success-subtle text-success-fg`;
|
|
166
|
+
const OPT_BADGE_YELLOW = `${OPT_BADGE} bg-warning-subtle text-warning-fg`;
|
|
167
|
+
const OPT_BADGE_RED = `${OPT_BADGE} bg-danger-subtle text-danger-fg`;
|
|
168
|
+
const OPT_BADGE_NEUTRAL = `${OPT_BADGE} bg-bg-subtle text-text-secondary`;
|
|
169
|
+
const OPT_BUTTON_PRIMARY = "inline-flex h-10 items-center justify-center rounded-lg bg-accent px-4 text-sm font-medium text-accent-fg outline-none hover:bg-accent-hover active:bg-accent-active focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2";
|
|
170
|
+
const OPT_BUTTON_SECONDARY = "inline-flex h-10 items-center justify-center rounded-lg border border-border bg-surface px-4 text-sm font-medium text-text-primary outline-none hover:bg-bg-subtle active:bg-bg-muted focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1";
|
|
171
|
+
const OPT_TH = "px-3 py-2.5 text-left text-xs font-semibold uppercase tracking-wider text-text-tertiary";
|
|
172
|
+
const OPT_TD = "px-3 py-2.5 text-sm text-text-primary whitespace-nowrap";
|
|
173
|
+
const OPT_TD_MUTED = "px-3 py-2.5 text-sm text-text-tertiary whitespace-nowrap";
|
|
174
|
+
const OPT_TABLE_ROW_ACTIVE = "outline-none data-[active-item]:bg-accent-subtle data-[focus-visible]:outline-2 data-[focus-visible]:outline-ring data-[focus-visible]:-outline-offset-1";
|
|
175
|
+
const OPT_DISCLOSURE_TRIGGER = "flex w-full items-center justify-between px-4 py-3.5 text-left text-sm font-medium text-text-primary outline-none hover:underline decoration-border underline-offset-2 data-[focus-visible]:outline-2 data-[focus-visible]:outline-ring data-[focus-visible]:-outline-offset-2";
|
|
176
|
+
const OPT_DISCLOSURE_CONTENT = "overflow-hidden data-[enter]:animate-in data-[enter]:fade-in data-[leave]:animate-out data-[leave]:fade-out";
|
|
177
|
+
const OPT_ANIMATE_ENTER_EXIT = "data-[enter]:animate-in data-[enter]:fade-in data-[enter]:slide-in-from-top-1 data-[leave]:animate-out data-[leave]:fade-out";
|
|
178
|
+
const OPT_ANIMATE_DIALOG = "data-[enter]:animate-in data-[enter]:fade-in data-[enter]:slide-in-from-top-2 data-[leave]:animate-out data-[leave]:fade-out data-[leave]:slide-out-to-top-2";
|
|
179
|
+
/**
|
|
180
|
+
* Drawer slide-in/out animations per side. ariakit `data-[enter]/data-[leave]`
|
|
181
|
+
* 패턴으로 `animate-in/animate-out` + `slide-in-from-{side}` 조합을 노출한다.
|
|
182
|
+
*
|
|
183
|
+
* Drawer 컴포넌트가 직접 인라인으로 정의하지 않고 이 토큰을 참조하도록 일관화.
|
|
184
|
+
*/
|
|
185
|
+
const OPT_ANIMATE_DRAWER = {
|
|
186
|
+
right: "data-[enter]:animate-in data-[enter]:slide-in-from-right data-[leave]:animate-out data-[leave]:slide-out-to-right",
|
|
187
|
+
left: "data-[enter]:animate-in data-[enter]:slide-in-from-left data-[leave]:animate-out data-[leave]:slide-out-to-left",
|
|
188
|
+
bottom: "data-[enter]:animate-in data-[enter]:slide-in-from-bottom data-[leave]:animate-out data-[leave]:slide-out-to-bottom"
|
|
189
|
+
};
|
|
190
|
+
const OPT_DOT_GREEN = "h-2 w-2 rounded-full bg-success";
|
|
191
|
+
const OPT_DOT_YELLOW = "h-2 w-2 rounded-full bg-warning";
|
|
192
|
+
const OPT_DOT_RED = "h-2 w-2 rounded-full bg-danger";
|
|
193
|
+
const OPT_DOT_GRAY = "h-2 w-2 rounded-full bg-bg-muted";
|
|
194
|
+
//#endregion
|
|
195
|
+
//#region src/lib/field-messages.tsx
|
|
196
|
+
/**
|
|
197
|
+
* Internal utilities for field label/error/hint rendering.
|
|
198
|
+
* Not exported from the package — used only by Core components.
|
|
199
|
+
*/
|
|
200
|
+
/** Renders a red asterisk for required fields. */
|
|
201
|
+
function RequiredMark() {
|
|
202
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
203
|
+
className: "text-danger-fg ml-0.5",
|
|
204
|
+
"aria-hidden": "true",
|
|
205
|
+
children: "*"
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
/** Computes the aria-describedby value from error/hint state. */
|
|
209
|
+
function getDescribedBy(id, error, hint) {
|
|
210
|
+
if (!id) return void 0;
|
|
211
|
+
if (error) return `${id}-error`;
|
|
212
|
+
if (hint) return `${id}-hint`;
|
|
213
|
+
}
|
|
214
|
+
/** Renders error or hint message below a field. Error takes priority. */
|
|
215
|
+
function FieldMessages({ id, error, hint }) {
|
|
216
|
+
if (!error && !hint) return null;
|
|
217
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [error && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
218
|
+
id: id ? `${id}-error` : void 0,
|
|
219
|
+
className: "text-danger-fg text-sm",
|
|
220
|
+
role: "alert",
|
|
221
|
+
children: error
|
|
222
|
+
}), hint && !error && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
223
|
+
id: id ? `${id}-hint` : void 0,
|
|
224
|
+
className: "text-text-tertiary text-sm",
|
|
225
|
+
children: hint
|
|
226
|
+
})] });
|
|
227
|
+
}
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/lib/use-controlled-state.ts
|
|
230
|
+
/**
|
|
231
|
+
* Manages controlled/uncontrolled state for input components.
|
|
232
|
+
* When `controlledValue` is provided, acts as controlled; otherwise uses internal state.
|
|
233
|
+
*/
|
|
234
|
+
function useControlledState(defaultValue, controlledValue, onChange) {
|
|
235
|
+
const [uncontrolledValue, setUncontrolledValue] = (0, react.useState)(defaultValue);
|
|
236
|
+
const isControlled = controlledValue !== void 0;
|
|
237
|
+
return [isControlled ? controlledValue : uncontrolledValue, (0, react.useCallback)((newValue) => {
|
|
238
|
+
if (!isControlled) setUncontrolledValue(newValue);
|
|
239
|
+
onChange === null || onChange === void 0 || onChange(newValue);
|
|
240
|
+
}, [isControlled, onChange])];
|
|
241
|
+
}
|
|
242
|
+
//#endregion
|
|
243
|
+
//#region src/core/stat-card.tsx
|
|
244
|
+
/** Renders the stat card component. */
|
|
245
|
+
function StatCard({ title, value, change, trend, sparklineData, className }) {
|
|
246
|
+
const trendColor = trend === "up" ? "text-success-fg" : trend === "down" ? "text-danger-fg" : "text-text-tertiary";
|
|
247
|
+
const trendIcon = trend === "up" ? "↑" : trend === "down" ? "↓" : "→";
|
|
248
|
+
const sparkColor = trend === "up" ? "var(--opt-chart-diverging-positive)" : trend === "down" ? "var(--opt-chart-diverging-negative)" : "var(--opt-chart-1)";
|
|
249
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
250
|
+
className: cn(OPT_SURFACE, OPT_BORDER, "flex flex-col gap-1 p-5", className),
|
|
251
|
+
"data-opt-id": "GAX47",
|
|
252
|
+
"data-opt-slug": "stat-card.StatCard",
|
|
253
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
254
|
+
className: "flex items-start justify-between gap-4",
|
|
255
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
256
|
+
className: "flex min-w-0 flex-col gap-1",
|
|
257
|
+
children: [
|
|
258
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
259
|
+
className: cn(OPT_TEXT_SECONDARY, "truncate text-sm"),
|
|
260
|
+
children: title
|
|
261
|
+
}),
|
|
262
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
263
|
+
className: cn(OPT_TEXT_PRIMARY, "text-2xl font-bold"),
|
|
264
|
+
children: value
|
|
265
|
+
}),
|
|
266
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
267
|
+
className: cn("text-sm font-medium", trendColor),
|
|
268
|
+
children: [
|
|
269
|
+
trendIcon,
|
|
270
|
+
" ",
|
|
271
|
+
change
|
|
272
|
+
]
|
|
273
|
+
})
|
|
274
|
+
]
|
|
275
|
+
}), sparklineData && sparklineData.length > 1 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MiniSparkline, {
|
|
276
|
+
data: sparklineData,
|
|
277
|
+
color: sparkColor
|
|
278
|
+
})]
|
|
279
|
+
})
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
function MiniSparkline({ data, color }) {
|
|
283
|
+
const width = 80;
|
|
284
|
+
const height = 32;
|
|
285
|
+
const padding = 2;
|
|
286
|
+
const min = Math.min(...data);
|
|
287
|
+
const range = Math.max(...data) - min || 1;
|
|
288
|
+
const points = data.map((v, i) => {
|
|
289
|
+
return `${padding + i / (data.length - 1) * (width - padding * 2)},${padding + (1 - (v - min) / range) * (height - padding * 2)}`;
|
|
290
|
+
}).join(" ");
|
|
291
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
292
|
+
width,
|
|
293
|
+
height,
|
|
294
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
295
|
+
className: "flex-shrink-0 self-center",
|
|
296
|
+
"aria-hidden": "true",
|
|
297
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("polyline", {
|
|
298
|
+
points,
|
|
299
|
+
fill: "none",
|
|
300
|
+
stroke: color,
|
|
301
|
+
strokeWidth: 1.5,
|
|
302
|
+
strokeLinecap: "round",
|
|
303
|
+
strokeLinejoin: "round"
|
|
304
|
+
})
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
StatCard.displayName = "StatCard";
|
|
308
|
+
//#endregion
|
|
309
|
+
//#region src/i18n/ko.ts
|
|
310
|
+
/**
|
|
311
|
+
* opt-ui Korean default labels.
|
|
312
|
+
*
|
|
313
|
+
* Components consume these as defaults so consumers don't have to pass labels
|
|
314
|
+
* for the most common case. Korean is the package default — other locales
|
|
315
|
+
* should be imported explicitly (e.g. `enLabels`) and passed via component
|
|
316
|
+
* props or wrapped with a labels provider.
|
|
317
|
+
*/
|
|
318
|
+
const koComboboxLabels = { empty: "결과가 없습니다." };
|
|
319
|
+
const koStarRatingLabels = {
|
|
320
|
+
/** {value}/{max}점 — readonly fallback aria-label */
|
|
321
|
+
readonlyAriaLabel: "{value}/{max}점",
|
|
322
|
+
/** rating group aria-label */
|
|
323
|
+
groupAriaLabel: "별점",
|
|
324
|
+
/** {star}점 — individual star aria-label */
|
|
325
|
+
starAriaLabel: "{star}점"
|
|
326
|
+
};
|
|
327
|
+
const koBreadcrumbLabels = {
|
|
328
|
+
/** {label}(으)로 이동 */
|
|
329
|
+
navAriaLabel: "{label}(으)로 이동" };
|
|
330
|
+
//#endregion
|
|
331
|
+
//#region src/core/button.tsx
|
|
332
|
+
const _excluded$14 = [
|
|
333
|
+
"variant",
|
|
334
|
+
"size",
|
|
335
|
+
"loading",
|
|
336
|
+
"leftIcon",
|
|
337
|
+
"rightIcon",
|
|
338
|
+
"className",
|
|
339
|
+
"disabled",
|
|
340
|
+
"children",
|
|
341
|
+
"aria-busy"
|
|
342
|
+
];
|
|
343
|
+
const variantStyles$2 = {
|
|
344
|
+
primary: "bg-accent text-accent-fg hover:bg-accent-hover active:bg-accent-active focus-visible:ring-offset-2",
|
|
345
|
+
secondary: "border border-border bg-surface text-text-primary hover:bg-bg-subtle active:bg-bg-muted focus-visible:ring-offset-1",
|
|
346
|
+
ghost: "text-text-secondary hover:bg-bg-subtle active:bg-bg-muted focus-visible:ring-offset-1",
|
|
347
|
+
danger: "bg-danger text-danger-fg hover:bg-danger active:bg-danger focus-visible:ring-offset-2"
|
|
348
|
+
};
|
|
349
|
+
const sizeStyles$3 = {
|
|
350
|
+
sm: "h-[var(--opt-control-sm)] px-[var(--opt-control-padding-sm)] text-xs gap-[var(--opt-space-1-5)]",
|
|
351
|
+
md: "h-[var(--opt-control-md)] px-[var(--opt-control-padding-md)] text-sm gap-[var(--opt-space-2)]",
|
|
352
|
+
lg: "h-[var(--opt-control-lg)] px-[var(--opt-control-padding-lg)] text-base gap-[var(--opt-space-2)]"
|
|
353
|
+
};
|
|
354
|
+
/** Renders the button component. */
|
|
355
|
+
function Button(_ref) {
|
|
356
|
+
let { variant = "primary", size = "md", loading = false, leftIcon, rightIcon, className, disabled, children, "aria-busy": ariaBusy } = _ref, props = _objectWithoutProperties(_ref, _excluded$14);
|
|
357
|
+
const isDisabled = disabled || loading;
|
|
358
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", _objectSpread2(_objectSpread2({
|
|
359
|
+
type: "button",
|
|
360
|
+
className: cn("inline-flex cursor-pointer items-center justify-center rounded-lg font-medium transition-colors", OPT_FOCUS_VISIBLE, variantStyles$2[variant], sizeStyles$3[size], isDisabled && "pointer-events-none cursor-not-allowed opacity-50", className),
|
|
361
|
+
disabled: isDisabled
|
|
362
|
+
}, props), {}, {
|
|
363
|
+
"aria-busy": loading ? true : ariaBusy,
|
|
364
|
+
"data-opt-id": "RGX84",
|
|
365
|
+
"data-opt-slug": "button.Button",
|
|
366
|
+
"data-opt-component": "button",
|
|
367
|
+
"data-opt-part": "root",
|
|
368
|
+
"data-variant": variant,
|
|
369
|
+
"data-size": size,
|
|
370
|
+
"data-state": loading ? "loading" : isDisabled ? "disabled" : "idle",
|
|
371
|
+
children: [
|
|
372
|
+
loading ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
373
|
+
className: "h-4 w-4 animate-spin",
|
|
374
|
+
viewBox: "0 0 24 24",
|
|
375
|
+
fill: "none",
|
|
376
|
+
"aria-hidden": "true",
|
|
377
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
378
|
+
className: "opacity-25",
|
|
379
|
+
cx: "12",
|
|
380
|
+
cy: "12",
|
|
381
|
+
r: "10",
|
|
382
|
+
stroke: "currentColor",
|
|
383
|
+
strokeWidth: "4"
|
|
384
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
385
|
+
className: "opacity-75",
|
|
386
|
+
fill: "currentColor",
|
|
387
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
388
|
+
})]
|
|
389
|
+
}) : leftIcon,
|
|
390
|
+
children,
|
|
391
|
+
!loading && rightIcon
|
|
392
|
+
]
|
|
393
|
+
}));
|
|
394
|
+
}
|
|
395
|
+
//#endregion
|
|
396
|
+
//#region src/core/empty-state.tsx
|
|
397
|
+
const iconSizeClasses = {
|
|
398
|
+
sm: "text-3xl",
|
|
399
|
+
md: "text-4xl",
|
|
400
|
+
lg: "text-5xl"
|
|
401
|
+
};
|
|
402
|
+
/** Renders the empty state component. */
|
|
403
|
+
function EmptyState({ icon, title, description, actions, className, iconSize = "md", headingLevel = "h3" }) {
|
|
404
|
+
const HeadingTag = headingLevel;
|
|
405
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
406
|
+
role: "status",
|
|
407
|
+
"aria-label": title,
|
|
408
|
+
className: cn("flex flex-col items-center justify-center px-4 py-12 text-center", className),
|
|
409
|
+
"data-opt-id": "5ZK92",
|
|
410
|
+
"data-opt-slug": "empty-state.EmptyState",
|
|
411
|
+
children: [
|
|
412
|
+
icon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
413
|
+
className: cn(`mb-4 text-text-tertiary`, iconSizeClasses[iconSize]),
|
|
414
|
+
"aria-hidden": "true",
|
|
415
|
+
children: icon
|
|
416
|
+
}),
|
|
417
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(HeadingTag, {
|
|
418
|
+
className: `text-lg font-semibold ${OPT_TEXT_PRIMARY}`,
|
|
419
|
+
children: title
|
|
420
|
+
}),
|
|
421
|
+
description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
422
|
+
className: `mt-2 max-w-sm text-sm text-text-secondary`,
|
|
423
|
+
children: description
|
|
424
|
+
}),
|
|
425
|
+
actions && actions.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
426
|
+
className: "mt-6 flex items-center gap-3",
|
|
427
|
+
children: actions.map((action) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
428
|
+
onClick: action.onClick,
|
|
429
|
+
disabled: action.disabled,
|
|
430
|
+
variant: action.variant === "secondary" ? "secondary" : "primary",
|
|
431
|
+
children: action.label
|
|
432
|
+
}, action.id))
|
|
433
|
+
})
|
|
434
|
+
]
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
//#endregion
|
|
438
|
+
//#region src/core/badge.tsx
|
|
439
|
+
const _excluded$13 = [
|
|
440
|
+
"variant",
|
|
441
|
+
"size",
|
|
442
|
+
"dot",
|
|
443
|
+
"progress",
|
|
444
|
+
"progressSize",
|
|
445
|
+
"className",
|
|
446
|
+
"children"
|
|
447
|
+
];
|
|
448
|
+
const variantStyles$1 = {
|
|
449
|
+
default: "bg-bg-subtle text-text-secondary",
|
|
450
|
+
success: "bg-success-subtle text-success-fg",
|
|
451
|
+
warning: "bg-warning-subtle text-warning-fg",
|
|
452
|
+
error: "bg-danger-subtle text-danger-fg",
|
|
453
|
+
info: "bg-info-subtle text-info-fg"
|
|
454
|
+
};
|
|
455
|
+
const dotStyles = {
|
|
456
|
+
default: "bg-text-tertiary",
|
|
457
|
+
success: "bg-success",
|
|
458
|
+
warning: "bg-warning",
|
|
459
|
+
error: "bg-danger",
|
|
460
|
+
info: "bg-info"
|
|
461
|
+
};
|
|
462
|
+
const progressStroke = {
|
|
463
|
+
default: "stroke-text-tertiary",
|
|
464
|
+
success: "stroke-success",
|
|
465
|
+
warning: "stroke-warning",
|
|
466
|
+
error: "stroke-danger",
|
|
467
|
+
info: "stroke-info"
|
|
468
|
+
};
|
|
469
|
+
const sizeStyles$2 = {
|
|
470
|
+
sm: "px-1.5 py-0.5 text-[10px]",
|
|
471
|
+
md: "px-2 py-0.5 text-[11px]"
|
|
472
|
+
};
|
|
473
|
+
/** Renders the badge component. */
|
|
474
|
+
function Badge(_ref) {
|
|
475
|
+
let { variant = "default", size = "md", dot = false, progress, progressSize = 16, className, children } = _ref, props = _objectWithoutProperties(_ref, _excluded$13);
|
|
476
|
+
const hasProgress = progress != null;
|
|
477
|
+
const clampedProgress = hasProgress ? Math.min(100, Math.max(0, progress)) : 0;
|
|
478
|
+
const radius = (progressSize - 3) / 2;
|
|
479
|
+
const circumference = 2 * Math.PI * radius;
|
|
480
|
+
const offset = circumference - clampedProgress / 100 * circumference;
|
|
481
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", _objectSpread2(_objectSpread2({ className: cn(OPT_BADGE, variantStyles$1[variant], sizeStyles$2[size], className) }, props), {}, {
|
|
482
|
+
"data-opt-id": "9GBGZ",
|
|
483
|
+
"data-opt-slug": "badge.Badge",
|
|
484
|
+
children: [
|
|
485
|
+
hasProgress && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
486
|
+
width: progressSize,
|
|
487
|
+
height: progressSize,
|
|
488
|
+
viewBox: `0 0 ${progressSize} ${progressSize}`,
|
|
489
|
+
className: "mr-1 -ml-0.5 shrink-0",
|
|
490
|
+
"aria-hidden": "true",
|
|
491
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
492
|
+
cx: progressSize / 2,
|
|
493
|
+
cy: progressSize / 2,
|
|
494
|
+
r: radius,
|
|
495
|
+
fill: "none",
|
|
496
|
+
strokeWidth: 2,
|
|
497
|
+
className: "stroke-current opacity-20"
|
|
498
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
499
|
+
cx: progressSize / 2,
|
|
500
|
+
cy: progressSize / 2,
|
|
501
|
+
r: radius,
|
|
502
|
+
fill: "none",
|
|
503
|
+
strokeWidth: 2,
|
|
504
|
+
strokeLinecap: "round",
|
|
505
|
+
strokeDasharray: circumference,
|
|
506
|
+
strokeDashoffset: offset,
|
|
507
|
+
className: cn(progressStroke[variant], "transition-all"),
|
|
508
|
+
transform: `rotate(-90 ${progressSize / 2} ${progressSize / 2})`
|
|
509
|
+
})]
|
|
510
|
+
}),
|
|
511
|
+
dot && !hasProgress && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
512
|
+
className: cn("mr-1.5 h-1.5 w-1.5 rounded-full", dotStyles[variant]),
|
|
513
|
+
"aria-hidden": "true"
|
|
514
|
+
}),
|
|
515
|
+
children
|
|
516
|
+
]
|
|
517
|
+
}));
|
|
518
|
+
}
|
|
519
|
+
//#endregion
|
|
520
|
+
//#region src/core/spinner.tsx
|
|
521
|
+
const _excluded$12 = [
|
|
522
|
+
"size",
|
|
523
|
+
"className",
|
|
524
|
+
"role",
|
|
525
|
+
"aria-hidden",
|
|
526
|
+
"aria-label"
|
|
527
|
+
];
|
|
528
|
+
const sizeStyles$1 = {
|
|
529
|
+
sm: "h-4 w-4",
|
|
530
|
+
md: "h-6 w-6",
|
|
531
|
+
lg: "h-8 w-8"
|
|
532
|
+
};
|
|
533
|
+
/** Renders the spinner component. */
|
|
534
|
+
function Spinner(_ref) {
|
|
535
|
+
let { size = "md", className, role, "aria-hidden": ariaHidden, "aria-label": ariaLabel } = _ref, props = _objectWithoutProperties(_ref, _excluded$12);
|
|
536
|
+
const isDecorative = ariaHidden === true || ariaHidden === "true";
|
|
537
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", _objectSpread2(_objectSpread2({
|
|
538
|
+
className: cn("animate-spin text-current", sizeStyles$1[size], className),
|
|
539
|
+
viewBox: "0 0 24 24",
|
|
540
|
+
fill: "none",
|
|
541
|
+
role: isDecorative ? void 0 : role !== null && role !== void 0 ? role : "status",
|
|
542
|
+
"aria-hidden": ariaHidden,
|
|
543
|
+
"aria-label": isDecorative ? void 0 : ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : "Loading"
|
|
544
|
+
}, props), {}, {
|
|
545
|
+
"data-opt-id": "DJS29",
|
|
546
|
+
"data-opt-slug": "spinner.Spinner",
|
|
547
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
548
|
+
className: "opacity-25",
|
|
549
|
+
cx: "12",
|
|
550
|
+
cy: "12",
|
|
551
|
+
r: "10",
|
|
552
|
+
stroke: "currentColor",
|
|
553
|
+
strokeWidth: "4"
|
|
554
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
555
|
+
className: "opacity-75",
|
|
556
|
+
fill: "currentColor",
|
|
557
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
558
|
+
})]
|
|
559
|
+
}));
|
|
560
|
+
}
|
|
561
|
+
//#endregion
|
|
562
|
+
//#region src/core/alert.tsx
|
|
563
|
+
const _excluded$11 = [
|
|
564
|
+
"variant",
|
|
565
|
+
"title",
|
|
566
|
+
"icon",
|
|
567
|
+
"dismissible",
|
|
568
|
+
"onDismiss",
|
|
569
|
+
"className",
|
|
570
|
+
"children"
|
|
571
|
+
];
|
|
572
|
+
const variantStyles = {
|
|
573
|
+
info: "border-info bg-info-subtle text-info-fg",
|
|
574
|
+
success: "border-success bg-success-subtle text-success-fg",
|
|
575
|
+
warning: "border-warning bg-warning-subtle text-warning-fg",
|
|
576
|
+
error: "border-danger bg-danger-subtle text-danger-fg"
|
|
577
|
+
};
|
|
578
|
+
const iconColors = {
|
|
579
|
+
info: "text-info-fg",
|
|
580
|
+
success: "text-success-fg",
|
|
581
|
+
warning: "text-warning-fg",
|
|
582
|
+
error: "text-danger-fg"
|
|
583
|
+
};
|
|
584
|
+
const defaultIcons = {
|
|
585
|
+
info: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
586
|
+
className: "h-5 w-5",
|
|
587
|
+
viewBox: "0 0 20 20",
|
|
588
|
+
fill: "currentColor",
|
|
589
|
+
"aria-hidden": "true",
|
|
590
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
591
|
+
fillRule: "evenodd",
|
|
592
|
+
d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",
|
|
593
|
+
clipRule: "evenodd"
|
|
594
|
+
})
|
|
595
|
+
}),
|
|
596
|
+
success: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
597
|
+
className: "h-5 w-5",
|
|
598
|
+
viewBox: "0 0 20 20",
|
|
599
|
+
fill: "currentColor",
|
|
600
|
+
"aria-hidden": "true",
|
|
601
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
602
|
+
fillRule: "evenodd",
|
|
603
|
+
d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",
|
|
604
|
+
clipRule: "evenodd"
|
|
605
|
+
})
|
|
606
|
+
}),
|
|
607
|
+
warning: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
608
|
+
className: "h-5 w-5",
|
|
609
|
+
viewBox: "0 0 20 20",
|
|
610
|
+
fill: "currentColor",
|
|
611
|
+
"aria-hidden": "true",
|
|
612
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
613
|
+
fillRule: "evenodd",
|
|
614
|
+
d: "M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z",
|
|
615
|
+
clipRule: "evenodd"
|
|
616
|
+
})
|
|
617
|
+
}),
|
|
618
|
+
error: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
619
|
+
className: "h-5 w-5",
|
|
620
|
+
viewBox: "0 0 20 20",
|
|
621
|
+
fill: "currentColor",
|
|
622
|
+
"aria-hidden": "true",
|
|
623
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
624
|
+
fillRule: "evenodd",
|
|
625
|
+
d: "M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z",
|
|
626
|
+
clipRule: "evenodd"
|
|
627
|
+
})
|
|
628
|
+
})
|
|
629
|
+
};
|
|
630
|
+
/** Renders the alert component. */
|
|
631
|
+
function Alert(_ref) {
|
|
632
|
+
let { variant = "info", title, icon, dismissible = false, onDismiss, className, children } = _ref, props = _objectWithoutProperties(_ref, _excluded$11);
|
|
633
|
+
const displayIcon = icon !== null && icon !== void 0 ? icon : defaultIcons[variant];
|
|
634
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", _objectSpread2(_objectSpread2({
|
|
635
|
+
role: "alert",
|
|
636
|
+
className: cn("relative rounded-lg border p-4", variantStyles[variant], className)
|
|
637
|
+
}, props), {}, {
|
|
638
|
+
"data-opt-id": "4SPK6",
|
|
639
|
+
"data-opt-slug": "alert.Alert",
|
|
640
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
641
|
+
className: "flex",
|
|
642
|
+
children: [
|
|
643
|
+
displayIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
644
|
+
className: cn("flex-shrink-0", iconColors[variant]),
|
|
645
|
+
children: displayIcon
|
|
646
|
+
}),
|
|
647
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
648
|
+
className: cn("flex-1", displayIcon && "ml-3"),
|
|
649
|
+
children: [title && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
650
|
+
className: "text-sm font-medium",
|
|
651
|
+
children: title
|
|
652
|
+
}), children && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
653
|
+
className: cn("text-sm", title && "mt-1", "opacity-90"),
|
|
654
|
+
children
|
|
655
|
+
})]
|
|
656
|
+
}),
|
|
657
|
+
dismissible && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
658
|
+
className: "ml-auto pl-3",
|
|
659
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
660
|
+
type: "button",
|
|
661
|
+
onClick: onDismiss,
|
|
662
|
+
className: cn("hover:bg-bg-subtle inline-flex rounded-md p-1.5 transition-colors", "outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-ring-offset"),
|
|
663
|
+
"aria-label": "Dismiss",
|
|
664
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
665
|
+
className: "h-4 w-4",
|
|
666
|
+
viewBox: "0 0 20 20",
|
|
667
|
+
fill: "currentColor",
|
|
668
|
+
"aria-hidden": "true",
|
|
669
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z" })
|
|
670
|
+
})
|
|
671
|
+
})
|
|
672
|
+
})
|
|
673
|
+
]
|
|
674
|
+
})
|
|
675
|
+
}));
|
|
676
|
+
}
|
|
677
|
+
//#endregion
|
|
678
|
+
//#region src/lib/use-input-id.ts
|
|
679
|
+
/**
|
|
680
|
+
* Generates a stable component ID from label text.
|
|
681
|
+
* Eliminates the duplicated `id ?? label?.replace(...)` pattern across input components.
|
|
682
|
+
*/
|
|
683
|
+
function useInputId(id, label, prefix) {
|
|
684
|
+
return id !== null && id !== void 0 ? id : label ? `${prefix}-${label.replace(/\s+/g, "-").toLowerCase()}` : void 0;
|
|
685
|
+
}
|
|
686
|
+
//#endregion
|
|
687
|
+
//#region src/core/star-rating.tsx
|
|
688
|
+
function interpolate(template, values) {
|
|
689
|
+
return template.replace(/\{(\w+)\}/g, (_, key) => key in values ? String(values[key]) : `{${key}}`);
|
|
690
|
+
}
|
|
691
|
+
const sizeMap = {
|
|
692
|
+
sm: "h-4 w-4",
|
|
693
|
+
md: "h-5 w-5",
|
|
694
|
+
lg: "h-6 w-6"
|
|
695
|
+
};
|
|
696
|
+
const gapMap = {
|
|
697
|
+
sm: "gap-0.5",
|
|
698
|
+
md: "gap-1",
|
|
699
|
+
lg: "gap-1"
|
|
700
|
+
};
|
|
701
|
+
function StarIcon({ filled, className }) {
|
|
702
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
703
|
+
viewBox: "0 0 24 24",
|
|
704
|
+
className: cn(filled ? "fill-amber-400 text-amber-400" : "text-text-tertiary fill-none", className),
|
|
705
|
+
stroke: "currentColor",
|
|
706
|
+
strokeWidth: 1.5,
|
|
707
|
+
strokeLinecap: "round",
|
|
708
|
+
strokeLinejoin: "round",
|
|
709
|
+
"aria-hidden": "true",
|
|
710
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z" })
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
/** Renders the star rating component. */
|
|
714
|
+
function StarRating({ value = 0, onChange, max = 5, readOnly = false, size = "md", className, ariaLabel }) {
|
|
715
|
+
const id = (0, react.useId)();
|
|
716
|
+
const [hovered, setHovered] = (0, react.useState)(null);
|
|
717
|
+
const displayValue = hovered !== null && hovered !== void 0 ? hovered : value;
|
|
718
|
+
const iconSize = sizeMap[size];
|
|
719
|
+
const gap = gapMap[size];
|
|
720
|
+
const handleClick = (0, react.useCallback)((star) => {
|
|
721
|
+
if (!readOnly && onChange) onChange(star);
|
|
722
|
+
}, [readOnly, onChange]);
|
|
723
|
+
const handleKeyDown = (0, react.useCallback)((e) => {
|
|
724
|
+
if (readOnly || !onChange) return;
|
|
725
|
+
if (e.key === "ArrowRight" || e.key === "ArrowUp") {
|
|
726
|
+
e.preventDefault();
|
|
727
|
+
onChange(Math.min(value + 1, max));
|
|
728
|
+
} else if (e.key === "ArrowLeft" || e.key === "ArrowDown") {
|
|
729
|
+
e.preventDefault();
|
|
730
|
+
onChange(Math.max(value - 1, 1));
|
|
731
|
+
} else if (e.key === "Home") {
|
|
732
|
+
e.preventDefault();
|
|
733
|
+
onChange(1);
|
|
734
|
+
} else if (e.key === "End") {
|
|
735
|
+
e.preventDefault();
|
|
736
|
+
onChange(max);
|
|
737
|
+
}
|
|
738
|
+
}, [
|
|
739
|
+
readOnly,
|
|
740
|
+
onChange,
|
|
741
|
+
value,
|
|
742
|
+
max
|
|
743
|
+
]);
|
|
744
|
+
if (readOnly) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
745
|
+
className: cn("inline-flex items-center", gap, className),
|
|
746
|
+
role: "img",
|
|
747
|
+
"aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : interpolate(koStarRatingLabels.readonlyAriaLabel, {
|
|
748
|
+
value,
|
|
749
|
+
max
|
|
750
|
+
}),
|
|
751
|
+
"data-opt-id": "B6ZY4",
|
|
752
|
+
"data-opt-slug": "star-rating.StarRating",
|
|
753
|
+
children: Array.from({ length: max }, (_, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StarIcon, {
|
|
754
|
+
filled: i < value,
|
|
755
|
+
className: iconSize
|
|
756
|
+
}, i))
|
|
757
|
+
});
|
|
758
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
759
|
+
className: cn("inline-flex items-center", gap, className),
|
|
760
|
+
role: "radiogroup",
|
|
761
|
+
"aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : koStarRatingLabels.groupAriaLabel,
|
|
762
|
+
onKeyDown: handleKeyDown,
|
|
763
|
+
onMouseLeave: () => setHovered(null),
|
|
764
|
+
"data-opt-id": "B6ZY4",
|
|
765
|
+
"data-opt-slug": "star-rating.StarRating",
|
|
766
|
+
children: [Array.from({ length: max }, (_, i) => {
|
|
767
|
+
const star = i + 1;
|
|
768
|
+
const checked = star === value;
|
|
769
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
770
|
+
type: "button",
|
|
771
|
+
role: "radio",
|
|
772
|
+
"aria-checked": checked,
|
|
773
|
+
"aria-label": interpolate(koStarRatingLabels.starAriaLabel, { star }),
|
|
774
|
+
tabIndex: checked || value === 0 && i === 0 ? 0 : -1,
|
|
775
|
+
className: cn("cursor-pointer rounded-sm transition-transform", "focus-visible:outline-accent hover:scale-110 focus-visible:outline-2 focus-visible:outline-offset-2"),
|
|
776
|
+
onClick: () => handleClick(star),
|
|
777
|
+
onMouseEnter: () => setHovered(star),
|
|
778
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StarIcon, {
|
|
779
|
+
filled: i < displayValue,
|
|
780
|
+
className: iconSize
|
|
781
|
+
})
|
|
782
|
+
}, i);
|
|
783
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
784
|
+
type: "hidden",
|
|
785
|
+
name: `${id}-rating`,
|
|
786
|
+
value
|
|
787
|
+
})]
|
|
788
|
+
});
|
|
789
|
+
}
|
|
790
|
+
//#endregion
|
|
791
|
+
//#region src/core/composite-zone.tsx
|
|
792
|
+
/** Renders the composite zone component. */
|
|
793
|
+
function CompositeZone({ children, label, focusLoop = true, focusWrap = true, className }) {
|
|
794
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.CompositeProvider, {
|
|
795
|
+
focusLoop,
|
|
796
|
+
focusWrap,
|
|
797
|
+
"data-opt-id": "1JZXE",
|
|
798
|
+
"data-opt-slug": "composite-zone.CompositeZone",
|
|
799
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.Composite, {
|
|
800
|
+
role: "grid",
|
|
801
|
+
"aria-label": label,
|
|
802
|
+
className,
|
|
803
|
+
children
|
|
804
|
+
})
|
|
805
|
+
});
|
|
806
|
+
}
|
|
807
|
+
//#endregion
|
|
808
|
+
//#region src/core/disclosure.tsx
|
|
809
|
+
const _excluded$10 = ["className"];
|
|
810
|
+
const _excluded2$8 = ["className"];
|
|
811
|
+
const triggerClass$1 = `flex w-full cursor-pointer items-center justify-between px-4 py-4 text-left text-sm font-medium text-text-primary transition-colors hover:bg-bg-subtle ${OPT_FOCUS} data-[active-item]:bg-bg-subtle data-[disabled]:cursor-not-allowed`;
|
|
812
|
+
const contentClass = `overflow-hidden ${OPT_ANIMATE_ENTER_EXIT}`;
|
|
813
|
+
/** Renders the disclosure root component. */
|
|
814
|
+
function DisclosureRoot(props) {
|
|
815
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.DisclosureRoot, _objectSpread2(_objectSpread2({ animated: true }, props), {}, {
|
|
816
|
+
"data-opt-id": "AS61F",
|
|
817
|
+
"data-opt-slug": "disclosure.DisclosureRoot"
|
|
818
|
+
}));
|
|
819
|
+
}
|
|
820
|
+
/** Renders the disclosure trigger component. */
|
|
821
|
+
function DisclosureTrigger(_ref) {
|
|
822
|
+
let { className } = _ref, props = _objectWithoutProperties(_ref, _excluded$10);
|
|
823
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.DisclosureTrigger, _objectSpread2(_objectSpread2({ className: cn(triggerClass$1, className) }, props), {}, {
|
|
824
|
+
"data-opt-id": "14EZW",
|
|
825
|
+
"data-opt-slug": "disclosure.DisclosureTrigger"
|
|
826
|
+
}));
|
|
827
|
+
}
|
|
828
|
+
/** Renders the disclosure content component. */
|
|
829
|
+
function DisclosureContent(_ref2) {
|
|
830
|
+
let { className } = _ref2, props = _objectWithoutProperties(_ref2, _excluded2$8);
|
|
831
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.DisclosureContent, _objectSpread2(_objectSpread2({ className: cn(contentClass, className) }, props), {}, {
|
|
832
|
+
"data-opt-id": "78HYF",
|
|
833
|
+
"data-opt-slug": "disclosure.DisclosureContent"
|
|
834
|
+
}));
|
|
835
|
+
}
|
|
836
|
+
//#endregion
|
|
837
|
+
//#region src/core/tabs.tsx
|
|
838
|
+
const _excluded$9 = ["variant"];
|
|
839
|
+
const _excluded2$7 = ["className", "actions"];
|
|
840
|
+
const _excluded3$7 = [
|
|
841
|
+
"className",
|
|
842
|
+
"icon",
|
|
843
|
+
"status",
|
|
844
|
+
"statusLabel",
|
|
845
|
+
"children"
|
|
846
|
+
];
|
|
847
|
+
const _excluded4$5 = ["className"];
|
|
848
|
+
const TabsVariantContext = react.createContext("underline");
|
|
849
|
+
const tabClass = `cursor-pointer border-b-2 border-transparent px-4 py-2.5 text-sm text-text-tertiary transition-colors hover:text-text-primary data-[active-item]:text-text-primary data-[active-item]:border-text-primary data-[disabled]:cursor-not-allowed ${OPT_FOCUS}`;
|
|
850
|
+
const tabListClass = "flex border-b border-border-subtle";
|
|
851
|
+
const workspaceTabClass = `group relative inline-flex min-h-9 min-w-33 max-w-54 flex-none cursor-pointer items-center gap-element rounded-t-md border border-b-0 border-transparent px-group py-element font-mono text-xs text-text-tertiary transition-colors data-[disabled]:cursor-not-allowed [&:not([data-active-item]):hover]:bg-raised [&:not([data-active-item]):hover]:text-secondary data-[active-item]:z-10 data-[active-item]:-mb-px data-[active-item]:border-border data-[active-item]:bg-surface data-[active-item]:text-primary before:absolute before:inset-x-group before:top-0 before:h-0.5 before:rounded-b-sm before:bg-accent before:opacity-0 before:transition-opacity before:content-[''] data-[active-item]:before:opacity-100 ${OPT_FOCUS}`;
|
|
852
|
+
const workspaceTabListClass = "flex min-w-0 flex-1 items-end gap-element overflow-x-auto px-element [scrollbar-width:thin]";
|
|
853
|
+
const workspaceBarClass = "flex min-h-11 items-end border-b border-border bg-subtle pt-element";
|
|
854
|
+
const workspaceActionsClass = "flex flex-none items-center gap-element self-stretch border-l border-border-subtle bg-subtle px-element";
|
|
855
|
+
const barClass = "flex items-center justify-between gap-group";
|
|
856
|
+
const actionsClass = "flex flex-none items-center gap-element";
|
|
857
|
+
const tabPanelClass = `pt-4 ${OPT_FOCUS} data-[focus-visible]:rounded-lg`;
|
|
858
|
+
/** Renders the tabs root component. */
|
|
859
|
+
function TabsRoot(_ref) {
|
|
860
|
+
let { variant = "underline" } = _ref, props = _objectWithoutProperties(_ref, _excluded$9);
|
|
861
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TabsVariantContext.Provider, {
|
|
862
|
+
value: variant,
|
|
863
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.TabsRoot, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
864
|
+
"data-opt-id": "DJ8K8",
|
|
865
|
+
"data-opt-slug": "tabs.TabsRoot"
|
|
866
|
+
}))
|
|
867
|
+
});
|
|
868
|
+
}
|
|
869
|
+
/** Renders the tab list component. */
|
|
870
|
+
function TabList(_ref2) {
|
|
871
|
+
let { className, actions } = _ref2, props = _objectWithoutProperties(_ref2, _excluded2$7);
|
|
872
|
+
const variant = react.useContext(TabsVariantContext);
|
|
873
|
+
const list = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.TabList, _objectSpread2(_objectSpread2({ className: cn(variant === "workspace" ? workspaceTabListClass : tabListClass, className) }, props), {}, {
|
|
874
|
+
"data-opt-id": "68K7E",
|
|
875
|
+
"data-opt-slug": "tabs.TabList"
|
|
876
|
+
}));
|
|
877
|
+
if (!actions) return list;
|
|
878
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
879
|
+
className: variant === "workspace" ? workspaceBarClass : barClass,
|
|
880
|
+
children: [list, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
881
|
+
className: variant === "workspace" ? workspaceActionsClass : actionsClass,
|
|
882
|
+
children: actions
|
|
883
|
+
})]
|
|
884
|
+
});
|
|
885
|
+
}
|
|
886
|
+
/** Renders the tab component. */
|
|
887
|
+
function Tab(_ref3) {
|
|
888
|
+
let { className, icon, status, statusLabel, children } = _ref3, props = _objectWithoutProperties(_ref3, _excluded3$7);
|
|
889
|
+
const variant = react.useContext(TabsVariantContext);
|
|
890
|
+
const decorated = icon != null || status != null;
|
|
891
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.Tab, _objectSpread2(_objectSpread2({ className: cn(variant === "workspace" ? workspaceTabClass : tabClass, className) }, props), {}, {
|
|
892
|
+
"data-opt-id": "HZTNP",
|
|
893
|
+
"data-opt-slug": "tabs.Tab",
|
|
894
|
+
children: decorated ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
895
|
+
icon != null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
896
|
+
"aria-hidden": "true",
|
|
897
|
+
className: "text-text-tertiary group-data-[active-item]:text-accent flex flex-none items-center transition-colors",
|
|
898
|
+
children: icon
|
|
899
|
+
}),
|
|
900
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
901
|
+
className: "min-w-0 flex-1 truncate text-left",
|
|
902
|
+
children
|
|
903
|
+
}),
|
|
904
|
+
status != null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
905
|
+
role: "status",
|
|
906
|
+
"aria-label": statusLabel,
|
|
907
|
+
className: cn("size-element flex-none rounded-full", status === "running" ? "bg-accent ring-accent-subtle ring-2" : "bg-text-tertiary")
|
|
908
|
+
})
|
|
909
|
+
] }) : children
|
|
910
|
+
}));
|
|
911
|
+
}
|
|
912
|
+
/** Renders the tab panel component. */
|
|
913
|
+
function TabPanel(_ref4) {
|
|
914
|
+
let { className } = _ref4, props = _objectWithoutProperties(_ref4, _excluded4$5);
|
|
915
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.TabPanel, _objectSpread2(_objectSpread2({ className: cn(tabPanelClass, className) }, props), {}, {
|
|
916
|
+
"data-opt-id": "C0MBP",
|
|
917
|
+
"data-opt-slug": "tabs.TabPanel"
|
|
918
|
+
}));
|
|
919
|
+
}
|
|
920
|
+
//#endregion
|
|
921
|
+
//#region src/core/select.tsx
|
|
922
|
+
const _excluded$8 = [
|
|
923
|
+
"className",
|
|
924
|
+
"minWidth",
|
|
925
|
+
"style"
|
|
926
|
+
];
|
|
927
|
+
const _excluded2$6 = ["className"];
|
|
928
|
+
const _excluded3$6 = ["className"];
|
|
929
|
+
const triggerClass = `${OPT_INPUT} cursor-pointer items-center justify-between data-[disabled]:cursor-not-allowed ${OPT_FOCUS}`;
|
|
930
|
+
const popoverClass$1 = `${OPT_SURFACE_POPOVER} ${OPT_ANIMATE_ENTER_EXIT} z-[120]`;
|
|
931
|
+
const itemClass$1 = `flex cursor-pointer items-center gap-2 data-[disabled]:cursor-not-allowed ${OPT_ITEM_BASE} ${OPT_ACTIVE_ITEM}`;
|
|
932
|
+
/** Renders the select root component. */
|
|
933
|
+
function SelectRoot(props) {
|
|
934
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.SelectRoot, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
935
|
+
"data-opt-id": "A5TYW",
|
|
936
|
+
"data-opt-slug": "select.SelectRoot"
|
|
937
|
+
}));
|
|
938
|
+
}
|
|
939
|
+
/** Renders the select label component. */
|
|
940
|
+
function SelectLabel(props) {
|
|
941
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.SelectLabel, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
942
|
+
"data-opt-id": "SKM59",
|
|
943
|
+
"data-opt-slug": "select.SelectLabel"
|
|
944
|
+
}));
|
|
945
|
+
}
|
|
946
|
+
/** Renders the select trigger component. */
|
|
947
|
+
function SelectTrigger(_ref) {
|
|
948
|
+
let { className, minWidth = 140, style } = _ref, props = _objectWithoutProperties(_ref, _excluded$8);
|
|
949
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.SelectTrigger, _objectSpread2(_objectSpread2({
|
|
950
|
+
className: cn(triggerClass, className),
|
|
951
|
+
style: _objectSpread2({ minWidth: typeof minWidth === "number" ? `${minWidth}px` : minWidth }, style)
|
|
952
|
+
}, props), {}, {
|
|
953
|
+
"data-opt-id": "V6F86",
|
|
954
|
+
"data-opt-slug": "select.SelectTrigger"
|
|
955
|
+
}));
|
|
956
|
+
}
|
|
957
|
+
/** Renders the select popover component. */
|
|
958
|
+
function SelectPopover(_ref2) {
|
|
959
|
+
let { className } = _ref2, props = _objectWithoutProperties(_ref2, _excluded2$6);
|
|
960
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.SelectPopover, _objectSpread2(_objectSpread2({ className: cn(popoverClass$1, className) }, props), {}, {
|
|
961
|
+
"data-opt-id": "P152F",
|
|
962
|
+
"data-opt-slug": "select.SelectPopover"
|
|
963
|
+
}));
|
|
964
|
+
}
|
|
965
|
+
/** Renders the select item component. */
|
|
966
|
+
function SelectItem(_ref3) {
|
|
967
|
+
let { className } = _ref3, props = _objectWithoutProperties(_ref3, _excluded3$6);
|
|
968
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.SelectItem, _objectSpread2(_objectSpread2({ className: cn(itemClass$1, className) }, props), {}, {
|
|
969
|
+
"data-opt-id": "KKBAF",
|
|
970
|
+
"data-opt-slug": "select.SelectItem"
|
|
971
|
+
}));
|
|
972
|
+
}
|
|
973
|
+
//#endregion
|
|
974
|
+
//#region src/core/dialog.tsx
|
|
975
|
+
const _excluded$7 = ["className"];
|
|
976
|
+
const _excluded2$5 = ["className", "size"];
|
|
977
|
+
const _excluded3$5 = ["className", "size"];
|
|
978
|
+
const _excluded4$4 = ["className"];
|
|
979
|
+
const _excluded5$3 = ["className"];
|
|
980
|
+
const _excluded6$2 = ["className"];
|
|
981
|
+
const sizeClasses = {
|
|
982
|
+
xs: "max-w-xs",
|
|
983
|
+
sm: "max-w-sm",
|
|
984
|
+
md: "max-w-lg",
|
|
985
|
+
lg: "max-w-2xl",
|
|
986
|
+
xl: "max-w-4xl",
|
|
987
|
+
full: "max-w-[calc(100vw-2rem)]"
|
|
988
|
+
};
|
|
989
|
+
const panelBase = `fixed inset-auto left-1/2 top-[20%] z-50 m-0 w-full -translate-x-1/2 rounded-xl border border-border bg-surface p-0 shadow-2xl ${OPT_ANIMATE_DIALOG}`;
|
|
990
|
+
/** Renders the dialog root component. */
|
|
991
|
+
function DialogRoot(props) {
|
|
992
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.DialogRoot, _objectSpread2(_objectSpread2({ animated: true }, props), {}, {
|
|
993
|
+
"data-opt-id": "MDC91",
|
|
994
|
+
"data-opt-slug": "dialog.DialogRoot"
|
|
995
|
+
}));
|
|
996
|
+
}
|
|
997
|
+
/** Renders the dialog disclosure component. */
|
|
998
|
+
function DialogDisclosure(_ref) {
|
|
999
|
+
let { className } = _ref, props = _objectWithoutProperties(_ref, _excluded$7);
|
|
1000
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.DialogDisclosure, _objectSpread2(_objectSpread2({ className: cn("inline-flex cursor-pointer items-center justify-center rounded-lg font-medium transition-colors", OPT_BUTTON_PRIMARY, OPT_FOCUS_VISIBLE, className) }, props), {}, {
|
|
1001
|
+
"data-opt-id": "32QJK",
|
|
1002
|
+
"data-opt-slug": "dialog.DialogDisclosure"
|
|
1003
|
+
}));
|
|
1004
|
+
}
|
|
1005
|
+
/** Renders the dialog panel component. */
|
|
1006
|
+
function DialogPanel(_ref2) {
|
|
1007
|
+
let { className, size = "md" } = _ref2, props = _objectWithoutProperties(_ref2, _excluded2$5);
|
|
1008
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.DialogPanel, _objectSpread2(_objectSpread2({ className: cn(panelBase, sizeClasses[size], className) }, props), {}, {
|
|
1009
|
+
"data-opt-id": "BTMTG",
|
|
1010
|
+
"data-opt-slug": "dialog.DialogPanel"
|
|
1011
|
+
}));
|
|
1012
|
+
}
|
|
1013
|
+
/**
|
|
1014
|
+
* A dialog that demands an explicit choice: `role="alertdialog"` with no
|
|
1015
|
+
* backdrop/Escape dismissal. Use for destructive confirmations. Compose with
|
|
1016
|
+
* the other Dialog parts (DialogRoot/Heading/Description/Dismiss/…).
|
|
1017
|
+
*/
|
|
1018
|
+
function AlertDialogPanel(_ref3) {
|
|
1019
|
+
let { className, size = "sm" } = _ref3, props = _objectWithoutProperties(_ref3, _excluded3$5);
|
|
1020
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.AlertDialogPanel, _objectSpread2(_objectSpread2({ className: cn(panelBase, sizeClasses[size], className) }, props), {}, {
|
|
1021
|
+
"data-opt-id": "80HGS",
|
|
1022
|
+
"data-opt-slug": "dialog.AlertDialogPanel"
|
|
1023
|
+
}));
|
|
1024
|
+
}
|
|
1025
|
+
/** Renders the dialog heading component. */
|
|
1026
|
+
function DialogHeading(_ref4) {
|
|
1027
|
+
let { className } = _ref4, props = _objectWithoutProperties(_ref4, _excluded4$4);
|
|
1028
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.DialogHeading, _objectSpread2(_objectSpread2({ className: cn(`text-lg font-semibold ${OPT_TEXT_PRIMARY}`, className) }, props), {}, {
|
|
1029
|
+
"data-opt-id": "4NW4H",
|
|
1030
|
+
"data-opt-slug": "dialog.DialogHeading"
|
|
1031
|
+
}));
|
|
1032
|
+
}
|
|
1033
|
+
/** Renders the dialog description component. */
|
|
1034
|
+
function DialogDescription(_ref5) {
|
|
1035
|
+
let { className } = _ref5, props = _objectWithoutProperties(_ref5, _excluded5$3);
|
|
1036
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.DialogDescription, _objectSpread2(_objectSpread2({ className: cn(`text-sm ${OPT_TEXT_SECONDARY}`, className) }, props), {}, {
|
|
1037
|
+
"data-opt-id": "2BN3X",
|
|
1038
|
+
"data-opt-slug": "dialog.DialogDescription"
|
|
1039
|
+
}));
|
|
1040
|
+
}
|
|
1041
|
+
/** Renders the dialog dismiss component. */
|
|
1042
|
+
function DialogDismiss(_ref6) {
|
|
1043
|
+
let { className } = _ref6, props = _objectWithoutProperties(_ref6, _excluded6$2);
|
|
1044
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.DialogDismiss, _objectSpread2(_objectSpread2({ className: cn("hover:bg-bg-subtle rounded-md p-1.5 transition-colors", "cursor-pointer data-[disabled]:cursor-not-allowed", OPT_FOCUS, className) }, props), {}, {
|
|
1045
|
+
"data-opt-id": "JXT0Y",
|
|
1046
|
+
"data-opt-slug": "dialog.DialogDismiss"
|
|
1047
|
+
}));
|
|
1048
|
+
}
|
|
1049
|
+
/** Renders the dialog header component. */
|
|
1050
|
+
function DialogHeader({ children, className }) {
|
|
1051
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1052
|
+
className: cn("border-border flex items-start justify-between gap-4 border-b px-6 py-4", className),
|
|
1053
|
+
"data-opt-id": "K8NYY",
|
|
1054
|
+
"data-opt-slug": "dialog.DialogHeader",
|
|
1055
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1056
|
+
className: "gap-element flex min-w-0 flex-1 flex-col",
|
|
1057
|
+
children
|
|
1058
|
+
})
|
|
1059
|
+
});
|
|
1060
|
+
}
|
|
1061
|
+
/** Renders the dialog body component. */
|
|
1062
|
+
function DialogBody({ children, className }) {
|
|
1063
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1064
|
+
className: cn("flex-1 overflow-y-auto px-6 py-4", className),
|
|
1065
|
+
"data-opt-id": "EE32H",
|
|
1066
|
+
"data-opt-slug": "dialog.DialogBody",
|
|
1067
|
+
children
|
|
1068
|
+
});
|
|
1069
|
+
}
|
|
1070
|
+
/** Renders the dialog footer component. */
|
|
1071
|
+
function DialogFooter({ children, className }) {
|
|
1072
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1073
|
+
className: cn("border-border gap-element flex items-center justify-end border-t px-6 py-4", className),
|
|
1074
|
+
"data-opt-id": "AYQSR",
|
|
1075
|
+
"data-opt-slug": "dialog.DialogFooter",
|
|
1076
|
+
children
|
|
1077
|
+
});
|
|
1078
|
+
}
|
|
1079
|
+
//#endregion
|
|
1080
|
+
//#region src/core/combobox.tsx
|
|
1081
|
+
const _excluded$6 = ["className"];
|
|
1082
|
+
const _excluded2$4 = ["className"];
|
|
1083
|
+
const _excluded3$4 = ["className"];
|
|
1084
|
+
const _excluded4$3 = ["className"];
|
|
1085
|
+
const inputClass$1 = `${OPT_INPUT} ${OPT_FOCUS}`;
|
|
1086
|
+
const popoverClass = `${OPT_SURFACE_POPOVER} max-h-60 overflow-y-auto ${OPT_ANIMATE_ENTER_EXIT}`;
|
|
1087
|
+
const itemClass = `${OPT_ITEM_BASE} ${OPT_ACTIVE_ITEM}`;
|
|
1088
|
+
const groupLabelClass = "px-2 py-1.5 text-xs font-medium text-text-tertiary";
|
|
1089
|
+
const emptyClass = "py-4 text-center text-sm text-text-tertiary";
|
|
1090
|
+
/** Renders the combobox root component. */
|
|
1091
|
+
function ComboboxRoot(props) {
|
|
1092
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.ComboboxRoot, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1093
|
+
"data-opt-id": "VACXX",
|
|
1094
|
+
"data-opt-slug": "combobox.ComboboxRoot"
|
|
1095
|
+
}));
|
|
1096
|
+
}
|
|
1097
|
+
/** Renders the combobox input component. */
|
|
1098
|
+
function ComboboxInput(_ref) {
|
|
1099
|
+
let { className } = _ref, props = _objectWithoutProperties(_ref, _excluded$6);
|
|
1100
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.ComboboxInput, _objectSpread2(_objectSpread2({ className: cn(inputClass$1, className) }, props), {}, {
|
|
1101
|
+
"data-opt-id": "92FZS",
|
|
1102
|
+
"data-opt-slug": "combobox.ComboboxInput"
|
|
1103
|
+
}));
|
|
1104
|
+
}
|
|
1105
|
+
/** Renders the combobox popover component. */
|
|
1106
|
+
function ComboboxPopover(_ref2) {
|
|
1107
|
+
let { className } = _ref2, props = _objectWithoutProperties(_ref2, _excluded2$4);
|
|
1108
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.ComboboxPopover, _objectSpread2(_objectSpread2({ className: cn(popoverClass, className) }, props), {}, {
|
|
1109
|
+
"data-opt-id": "WS4PD",
|
|
1110
|
+
"data-opt-slug": "combobox.ComboboxPopover"
|
|
1111
|
+
}));
|
|
1112
|
+
}
|
|
1113
|
+
/** Renders the combobox item component. */
|
|
1114
|
+
function ComboboxItem(_ref3) {
|
|
1115
|
+
let { className } = _ref3, props = _objectWithoutProperties(_ref3, _excluded3$4);
|
|
1116
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.ComboboxItem, _objectSpread2(_objectSpread2({ className: cn(itemClass, className) }, props), {}, {
|
|
1117
|
+
"data-opt-id": "MAZJN",
|
|
1118
|
+
"data-opt-slug": "combobox.ComboboxItem"
|
|
1119
|
+
}));
|
|
1120
|
+
}
|
|
1121
|
+
/** Renders the combobox group component. */
|
|
1122
|
+
function ComboboxGroup(props) {
|
|
1123
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.ComboboxGroup, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1124
|
+
"data-opt-id": "SPJQC",
|
|
1125
|
+
"data-opt-slug": "combobox.ComboboxGroup"
|
|
1126
|
+
}));
|
|
1127
|
+
}
|
|
1128
|
+
/** Renders the combobox group label component. */
|
|
1129
|
+
function ComboboxGroupLabel(_ref4) {
|
|
1130
|
+
let { className } = _ref4, props = _objectWithoutProperties(_ref4, _excluded4$3);
|
|
1131
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.ComboboxGroupLabel, _objectSpread2(_objectSpread2({ className: cn(groupLabelClass, className) }, props), {}, {
|
|
1132
|
+
"data-opt-id": "512YF",
|
|
1133
|
+
"data-opt-slug": "combobox.ComboboxGroupLabel"
|
|
1134
|
+
}));
|
|
1135
|
+
}
|
|
1136
|
+
/** Renders the combobox empty component. */
|
|
1137
|
+
function ComboboxEmpty({ className, children = koComboboxLabels.empty }) {
|
|
1138
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1139
|
+
className: cn(emptyClass, className),
|
|
1140
|
+
"data-opt-id": "RZ06M",
|
|
1141
|
+
"data-opt-slug": "combobox.ComboboxEmpty",
|
|
1142
|
+
children
|
|
1143
|
+
});
|
|
1144
|
+
}
|
|
1145
|
+
//#endregion
|
|
1146
|
+
//#region src/core/menu.tsx
|
|
1147
|
+
const _excluded$5 = ["className"];
|
|
1148
|
+
const _excluded2$3 = ["className"];
|
|
1149
|
+
const _excluded3$3 = ["className"];
|
|
1150
|
+
const _excluded4$2 = ["className"];
|
|
1151
|
+
const _excluded5$2 = ["className"];
|
|
1152
|
+
const _excluded6$1 = ["className"];
|
|
1153
|
+
const _excluded7$1 = ["className"];
|
|
1154
|
+
const menuButtonClass = `inline-flex cursor-pointer items-center gap-1 rounded px-3 py-1.5 text-sm text-text-primary hover:bg-bg-subtle data-[active]:bg-bg-subtle data-[disabled]:cursor-not-allowed ${OPT_FOCUS}`;
|
|
1155
|
+
const menuPopoverClass = `${OPT_SURFACE_POPOVER} min-w-[180px] ${OPT_ANIMATE_ENTER_EXIT}`;
|
|
1156
|
+
const menuItemClass = `flex cursor-pointer items-center justify-between rounded-md px-2 py-1.5 text-sm text-text-primary outline-none data-[disabled]:cursor-not-allowed ${OPT_ACTIVE_ITEM}`;
|
|
1157
|
+
const menuSeparatorClass = "my-1 border-t border-border-subtle";
|
|
1158
|
+
const menubarClass = `${OPT_SURFACE} ${OPT_BORDER} flex items-center gap-1 px-1 py-1`;
|
|
1159
|
+
/** Renders the menubar root component. */
|
|
1160
|
+
function MenubarRoot(props) {
|
|
1161
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.MenubarRoot, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1162
|
+
"data-opt-id": "2ERC6",
|
|
1163
|
+
"data-opt-slug": "menu.MenubarRoot"
|
|
1164
|
+
}));
|
|
1165
|
+
}
|
|
1166
|
+
/** Renders the menubar container component. */
|
|
1167
|
+
function MenubarContainer(_ref) {
|
|
1168
|
+
let { className } = _ref, props = _objectWithoutProperties(_ref, _excluded$5);
|
|
1169
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.MenubarContainer, _objectSpread2(_objectSpread2({ className: cn(menubarClass, className) }, props), {}, {
|
|
1170
|
+
"data-opt-id": "4MVQT",
|
|
1171
|
+
"data-opt-slug": "menu.MenubarContainer"
|
|
1172
|
+
}));
|
|
1173
|
+
}
|
|
1174
|
+
/** Renders the menu root component. */
|
|
1175
|
+
function MenuRoot(props) {
|
|
1176
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.MenuRoot, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1177
|
+
"data-opt-id": "H2WRF",
|
|
1178
|
+
"data-opt-slug": "menu.MenuRoot"
|
|
1179
|
+
}));
|
|
1180
|
+
}
|
|
1181
|
+
/** Renders the menu trigger component. */
|
|
1182
|
+
function MenuTrigger(_ref2) {
|
|
1183
|
+
let { className } = _ref2, props = _objectWithoutProperties(_ref2, _excluded2$3);
|
|
1184
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.MenuTrigger, _objectSpread2(_objectSpread2({ className: cn(menuButtonClass, className) }, props), {}, {
|
|
1185
|
+
"data-opt-id": "46BJG",
|
|
1186
|
+
"data-opt-slug": "menu.MenuTrigger"
|
|
1187
|
+
}));
|
|
1188
|
+
}
|
|
1189
|
+
/** Renders the menu button arrow component. */
|
|
1190
|
+
function MenuButtonArrow(props) {
|
|
1191
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.MenuButtonArrow, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1192
|
+
"data-opt-id": "J1AQH",
|
|
1193
|
+
"data-opt-slug": "menu.MenuButtonArrow"
|
|
1194
|
+
}));
|
|
1195
|
+
}
|
|
1196
|
+
/** Renders the menu popover component. */
|
|
1197
|
+
function MenuPopover(_ref3) {
|
|
1198
|
+
let { className } = _ref3, props = _objectWithoutProperties(_ref3, _excluded3$3);
|
|
1199
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.MenuPopover, _objectSpread2(_objectSpread2({ className: cn(menuPopoverClass, className) }, props), {}, {
|
|
1200
|
+
"data-opt-id": "Q1MFY",
|
|
1201
|
+
"data-opt-slug": "menu.MenuPopover"
|
|
1202
|
+
}));
|
|
1203
|
+
}
|
|
1204
|
+
/** Renders the menu item component. */
|
|
1205
|
+
function MenuItem(_ref4) {
|
|
1206
|
+
let { className } = _ref4, props = _objectWithoutProperties(_ref4, _excluded4$2);
|
|
1207
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.MenuItem, _objectSpread2(_objectSpread2({ className: cn(menuItemClass, className) }, props), {}, {
|
|
1208
|
+
"data-opt-id": "71JVB",
|
|
1209
|
+
"data-opt-slug": "menu.MenuItem"
|
|
1210
|
+
}));
|
|
1211
|
+
}
|
|
1212
|
+
/** Renders the menu item checkbox component. */
|
|
1213
|
+
function MenuItemCheckbox(_ref5) {
|
|
1214
|
+
let { className } = _ref5, props = _objectWithoutProperties(_ref5, _excluded5$2);
|
|
1215
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.MenuItemCheckbox, _objectSpread2(_objectSpread2({ className: cn(menuItemClass, className) }, props), {}, {
|
|
1216
|
+
"data-opt-id": "DG8B3",
|
|
1217
|
+
"data-opt-slug": "menu.MenuItemCheckbox"
|
|
1218
|
+
}));
|
|
1219
|
+
}
|
|
1220
|
+
/** Renders the menu item radio component. */
|
|
1221
|
+
function MenuItemRadio(_ref6) {
|
|
1222
|
+
let { className } = _ref6, props = _objectWithoutProperties(_ref6, _excluded6$1);
|
|
1223
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.MenuItemRadio, _objectSpread2(_objectSpread2({ className: cn(menuItemClass, className) }, props), {}, {
|
|
1224
|
+
"data-opt-id": "ZT759",
|
|
1225
|
+
"data-opt-slug": "menu.MenuItemRadio"
|
|
1226
|
+
}));
|
|
1227
|
+
}
|
|
1228
|
+
/** Renders the menu separator component. */
|
|
1229
|
+
function MenuSeparator(_ref7) {
|
|
1230
|
+
let { className } = _ref7, props = _objectWithoutProperties(_ref7, _excluded7$1);
|
|
1231
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.MenuSeparator, _objectSpread2(_objectSpread2({ className: cn(menuSeparatorClass, className) }, props), {}, {
|
|
1232
|
+
"data-opt-id": "AJV8K",
|
|
1233
|
+
"data-opt-slug": "menu.MenuSeparator"
|
|
1234
|
+
}));
|
|
1235
|
+
}
|
|
1236
|
+
//#endregion
|
|
1237
|
+
//#region src/core/toolbar.tsx
|
|
1238
|
+
const _excluded$4 = ["className"];
|
|
1239
|
+
const _excluded2$2 = ["className"];
|
|
1240
|
+
const _excluded3$2 = ["className"];
|
|
1241
|
+
const _excluded4$1 = ["className"];
|
|
1242
|
+
const _excluded5$1 = ["className"];
|
|
1243
|
+
const toolbarClass = `${OPT_SURFACE} ${OPT_BORDER} inline-flex w-fit items-center gap-0.5 px-1.5 py-1`;
|
|
1244
|
+
const buttonClass = `cursor-pointer rounded-md px-2.5 py-1.5 text-text-primary transition-colors data-[disabled]:cursor-not-allowed ${OPT_ACTIVE_ITEM} ${OPT_FOCUS}`;
|
|
1245
|
+
const separatorClass = "mx-1 h-6 w-px bg-border-subtle";
|
|
1246
|
+
const tooltipClass = "z-50 rounded-md bg-foreground px-2 py-1 text-xs text-background shadow-lg";
|
|
1247
|
+
/** Renders the toolbar root component. */
|
|
1248
|
+
function ToolbarRoot(props) {
|
|
1249
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.ToolbarRoot, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1250
|
+
"data-opt-id": "V33Y0",
|
|
1251
|
+
"data-opt-slug": "toolbar.ToolbarRoot"
|
|
1252
|
+
}));
|
|
1253
|
+
}
|
|
1254
|
+
/** Renders the toolbar container component. */
|
|
1255
|
+
function ToolbarContainer(_ref) {
|
|
1256
|
+
let { className } = _ref, props = _objectWithoutProperties(_ref, _excluded$4);
|
|
1257
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.ToolbarContainer, _objectSpread2(_objectSpread2({ className: cn(toolbarClass, className) }, props), {}, {
|
|
1258
|
+
"data-opt-id": "2AVXB",
|
|
1259
|
+
"data-opt-slug": "toolbar.ToolbarContainer"
|
|
1260
|
+
}));
|
|
1261
|
+
}
|
|
1262
|
+
/** Renders the toolbar button component. */
|
|
1263
|
+
function ToolbarButton(_ref2) {
|
|
1264
|
+
let { className } = _ref2, props = _objectWithoutProperties(_ref2, _excluded2$2);
|
|
1265
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.ToolbarButton, _objectSpread2(_objectSpread2({ className: cn(buttonClass, className) }, props), {}, {
|
|
1266
|
+
"data-opt-id": "C212C",
|
|
1267
|
+
"data-opt-slug": "toolbar.ToolbarButton"
|
|
1268
|
+
}));
|
|
1269
|
+
}
|
|
1270
|
+
/** Renders the toolbar separator component. */
|
|
1271
|
+
function ToolbarSeparator(_ref3) {
|
|
1272
|
+
let { className } = _ref3, props = _objectWithoutProperties(_ref3, _excluded3$2);
|
|
1273
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.ToolbarSeparator, _objectSpread2(_objectSpread2({ className: cn(separatorClass, className) }, props), {}, {
|
|
1274
|
+
"data-opt-id": "9J72S",
|
|
1275
|
+
"data-opt-slug": "toolbar.ToolbarSeparator"
|
|
1276
|
+
}));
|
|
1277
|
+
}
|
|
1278
|
+
/** Renders the tooltip provider component. */
|
|
1279
|
+
function TooltipProvider(props) {
|
|
1280
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.TooltipProvider, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1281
|
+
"data-opt-id": "6NKHT",
|
|
1282
|
+
"data-opt-slug": "toolbar.TooltipProvider"
|
|
1283
|
+
}));
|
|
1284
|
+
}
|
|
1285
|
+
/** Renders the tooltip anchor component. */
|
|
1286
|
+
function TooltipAnchor(_ref4) {
|
|
1287
|
+
let { className } = _ref4, props = _objectWithoutProperties(_ref4, _excluded4$1);
|
|
1288
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.TooltipAnchor, _objectSpread2(_objectSpread2({ className }, props), {}, {
|
|
1289
|
+
"data-opt-id": "SAW1B",
|
|
1290
|
+
"data-opt-slug": "toolbar.TooltipAnchor"
|
|
1291
|
+
}));
|
|
1292
|
+
}
|
|
1293
|
+
/** Renders the tooltip component. */
|
|
1294
|
+
function Tooltip(_ref5) {
|
|
1295
|
+
let { className } = _ref5, props = _objectWithoutProperties(_ref5, _excluded5$1);
|
|
1296
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.Tooltip, _objectSpread2(_objectSpread2({ className: cn(tooltipClass, className) }, props), {}, {
|
|
1297
|
+
"data-opt-id": "XSAT4",
|
|
1298
|
+
"data-opt-slug": "toolbar.Tooltip"
|
|
1299
|
+
}));
|
|
1300
|
+
}
|
|
1301
|
+
//#endregion
|
|
1302
|
+
//#region src/core/number-input.tsx
|
|
1303
|
+
/** Number of decimal places a finite number is written with (handles exponents). */
|
|
1304
|
+
function decimalPlaces(n) {
|
|
1305
|
+
if (!Number.isFinite(n)) return 0;
|
|
1306
|
+
const s = String(n);
|
|
1307
|
+
const exp = s.indexOf("e");
|
|
1308
|
+
if (exp >= 0) {
|
|
1309
|
+
const mantissa = s.slice(0, exp);
|
|
1310
|
+
const dot = mantissa.indexOf(".");
|
|
1311
|
+
const mantissaDecimals = dot >= 0 ? mantissa.length - dot - 1 : 0;
|
|
1312
|
+
return Math.max(0, mantissaDecimals - Number(s.slice(exp + 1)));
|
|
1313
|
+
}
|
|
1314
|
+
const dot = s.indexOf(".");
|
|
1315
|
+
return dot >= 0 ? s.length - dot - 1 : 0;
|
|
1316
|
+
}
|
|
1317
|
+
/**
|
|
1318
|
+
* Adds `delta` to `value` without binary floating-point drift (e.g. 0.1 + 0.2).
|
|
1319
|
+
* Rounds to the largest precision present among the operands and `step`.
|
|
1320
|
+
*/
|
|
1321
|
+
function addPrecise(value, delta, step) {
|
|
1322
|
+
const decimals = Math.max(decimalPlaces(value), decimalPlaces(delta), decimalPlaces(step));
|
|
1323
|
+
if (decimals === 0) return value + delta;
|
|
1324
|
+
const factor = 10 ** Math.min(decimals, 15);
|
|
1325
|
+
return Math.round((value + delta) * factor) / factor;
|
|
1326
|
+
}
|
|
1327
|
+
const NUMBER_PATTERN = /^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i;
|
|
1328
|
+
const PARTIAL_NUMBER_PATTERN = /^[+-]?$|^[+-]?\.$|^[+-]?(?:\d+\.?\d*|\.\d+)[eE][+-]?$/;
|
|
1329
|
+
function parseDraftValue(raw) {
|
|
1330
|
+
const value = raw.trim();
|
|
1331
|
+
if (value === "") return { kind: "empty" };
|
|
1332
|
+
if (PARTIAL_NUMBER_PATTERN.test(value)) return { kind: "partial" };
|
|
1333
|
+
if (!NUMBER_PATTERN.test(value)) return { kind: "invalid" };
|
|
1334
|
+
const parsed = Number(value);
|
|
1335
|
+
if (!Number.isFinite(parsed)) return { kind: "invalid" };
|
|
1336
|
+
return {
|
|
1337
|
+
kind: "valid",
|
|
1338
|
+
value: parsed
|
|
1339
|
+
};
|
|
1340
|
+
}
|
|
1341
|
+
const DEFAULT_LABELS$1 = {
|
|
1342
|
+
input: "Number",
|
|
1343
|
+
decrease: "Decrease",
|
|
1344
|
+
increase: "Increase",
|
|
1345
|
+
clear: "Clear value",
|
|
1346
|
+
invalid: "Enter a valid number"
|
|
1347
|
+
};
|
|
1348
|
+
/** Renders the number input component. */
|
|
1349
|
+
function NumberInput({ value: controlledValue, defaultValue, onChange, nullable, clearable = false, min, max, step = 1, largeStep, scrub = false, label, unit, required, error, hint, disabled = false, disabledReason, labels, className, id, "aria-label": ariaLabel }) {
|
|
1350
|
+
var _useInputId, _ref, _ref2;
|
|
1351
|
+
const generatedId = react.useId();
|
|
1352
|
+
const inputId = (_useInputId = useInputId(id, label, "number-input")) !== null && _useInputId !== void 0 ? _useInputId : `${generatedId}-number-input`;
|
|
1353
|
+
const resolvedLabels = _objectSpread2(_objectSpread2({}, DEFAULT_LABELS$1), labels);
|
|
1354
|
+
const isNullable = nullable === true;
|
|
1355
|
+
const nativeDisabled = disabled && !disabledReason;
|
|
1356
|
+
const interactionDisabled = disabled;
|
|
1357
|
+
const [invalidDraft, setInvalidDraft] = react.useState(false);
|
|
1358
|
+
const effectiveError = error !== null && error !== void 0 ? error : invalidDraft ? resolvedLabels.invalid : "";
|
|
1359
|
+
const hasError = Boolean(effectiveError);
|
|
1360
|
+
const clamp = react.useCallback((v) => {
|
|
1361
|
+
let clamped = v;
|
|
1362
|
+
if (min !== void 0) clamped = Math.max(min, clamped);
|
|
1363
|
+
if (max !== void 0) clamped = Math.min(max, clamped);
|
|
1364
|
+
return clamped;
|
|
1365
|
+
}, [min, max]);
|
|
1366
|
+
const [rawValue, setRawValue] = useControlledState((_ref = defaultValue) !== null && _ref !== void 0 ? _ref : isNullable ? null : 0, controlledValue, react.useCallback((next) => {
|
|
1367
|
+
if (isNullable) {
|
|
1368
|
+
onChange === null || onChange === void 0 || onChange(next);
|
|
1369
|
+
return;
|
|
1370
|
+
}
|
|
1371
|
+
if (next !== null) onChange === null || onChange === void 0 || onChange(next);
|
|
1372
|
+
}, [isNullable, onChange]));
|
|
1373
|
+
const value = rawValue;
|
|
1374
|
+
const numericValue = value !== null && value !== void 0 ? value : 0;
|
|
1375
|
+
const setValue = react.useCallback((next) => {
|
|
1376
|
+
setRawValue(next === null ? null : clamp(next));
|
|
1377
|
+
}, [clamp, setRawValue]);
|
|
1378
|
+
const format = react.useCallback((v) => {
|
|
1379
|
+
const decimals = Math.max(decimalPlaces(step), decimalPlaces(v));
|
|
1380
|
+
return v.toFixed(Math.min(decimals, 20));
|
|
1381
|
+
}, [step]);
|
|
1382
|
+
const [inputText, setInputText] = react.useState(null);
|
|
1383
|
+
const focusedRef = react.useRef(false);
|
|
1384
|
+
const displayValue = inputText !== null && inputText !== void 0 ? inputText : value === null ? "" : format(value);
|
|
1385
|
+
const stateRef = react.useRef({
|
|
1386
|
+
step,
|
|
1387
|
+
clamp,
|
|
1388
|
+
format
|
|
1389
|
+
});
|
|
1390
|
+
stateRef.current = {
|
|
1391
|
+
step,
|
|
1392
|
+
clamp,
|
|
1393
|
+
format
|
|
1394
|
+
};
|
|
1395
|
+
const valueRef = react.useRef(value);
|
|
1396
|
+
valueRef.current = value;
|
|
1397
|
+
const getSpinBase = react.useCallback(() => {
|
|
1398
|
+
if (valueRef.current !== null) return valueRef.current;
|
|
1399
|
+
return clamp(min !== null && min !== void 0 ? min : 0);
|
|
1400
|
+
}, [clamp, min]);
|
|
1401
|
+
const spin = react.useCallback((delta) => {
|
|
1402
|
+
if (interactionDisabled) return;
|
|
1403
|
+
const s = stateRef.current;
|
|
1404
|
+
const next = s.clamp(addPrecise(getSpinBase(), delta, s.step));
|
|
1405
|
+
valueRef.current = next;
|
|
1406
|
+
setInvalidDraft(false);
|
|
1407
|
+
setValue(next);
|
|
1408
|
+
if (focusedRef.current) setInputText(s.format(next));
|
|
1409
|
+
}, [
|
|
1410
|
+
getSpinBase,
|
|
1411
|
+
interactionDisabled,
|
|
1412
|
+
setValue
|
|
1413
|
+
]);
|
|
1414
|
+
const setTo = react.useCallback((next) => {
|
|
1415
|
+
if (interactionDisabled) return;
|
|
1416
|
+
const s = stateRef.current;
|
|
1417
|
+
const clamped = s.clamp(next);
|
|
1418
|
+
valueRef.current = clamped;
|
|
1419
|
+
setInvalidDraft(false);
|
|
1420
|
+
setValue(clamped);
|
|
1421
|
+
if (focusedRef.current) setInputText(s.format(clamped));
|
|
1422
|
+
}, [interactionDisabled, setValue]);
|
|
1423
|
+
const handleChange = react.useCallback((e) => {
|
|
1424
|
+
const raw = e.target.value;
|
|
1425
|
+
setInputText(raw);
|
|
1426
|
+
const parsed = parseDraftValue(raw);
|
|
1427
|
+
if (parsed.kind === "empty") {
|
|
1428
|
+
setInvalidDraft(false);
|
|
1429
|
+
if (isNullable) {
|
|
1430
|
+
valueRef.current = null;
|
|
1431
|
+
setValue(null);
|
|
1432
|
+
}
|
|
1433
|
+
return;
|
|
1434
|
+
}
|
|
1435
|
+
if (parsed.kind === "partial") {
|
|
1436
|
+
setInvalidDraft(false);
|
|
1437
|
+
return;
|
|
1438
|
+
}
|
|
1439
|
+
if (parsed.kind === "invalid") {
|
|
1440
|
+
setInvalidDraft(true);
|
|
1441
|
+
return;
|
|
1442
|
+
}
|
|
1443
|
+
setInvalidDraft(false);
|
|
1444
|
+
setValue(parsed.value);
|
|
1445
|
+
}, [isNullable, setValue]);
|
|
1446
|
+
const handleFocus = react.useCallback(() => {
|
|
1447
|
+
focusedRef.current = true;
|
|
1448
|
+
}, []);
|
|
1449
|
+
const handleBlur = react.useCallback(() => {
|
|
1450
|
+
focusedRef.current = false;
|
|
1451
|
+
setInputText(null);
|
|
1452
|
+
setInvalidDraft(false);
|
|
1453
|
+
setValue(valueRef.current);
|
|
1454
|
+
}, [setValue]);
|
|
1455
|
+
const handleClear = react.useCallback(() => {
|
|
1456
|
+
if (!isNullable || interactionDisabled) return;
|
|
1457
|
+
valueRef.current = null;
|
|
1458
|
+
setInvalidDraft(false);
|
|
1459
|
+
setInputText(focusedRef.current ? "" : null);
|
|
1460
|
+
setValue(null);
|
|
1461
|
+
}, [
|
|
1462
|
+
interactionDisabled,
|
|
1463
|
+
isNullable,
|
|
1464
|
+
setValue
|
|
1465
|
+
]);
|
|
1466
|
+
const repeatedRef = react.useRef(false);
|
|
1467
|
+
const timersRef = react.useRef({});
|
|
1468
|
+
const stopRepeat = react.useCallback(() => {
|
|
1469
|
+
const t = timersRef.current;
|
|
1470
|
+
if (t.timeout !== void 0) window.clearTimeout(t.timeout);
|
|
1471
|
+
if (t.interval !== void 0) window.clearInterval(t.interval);
|
|
1472
|
+
timersRef.current = {};
|
|
1473
|
+
}, []);
|
|
1474
|
+
react.useEffect(() => stopRepeat, [stopRepeat]);
|
|
1475
|
+
const handleStepPointerDown = react.useCallback((dir) => (e) => {
|
|
1476
|
+
if (e.button !== 0 || interactionDisabled) return;
|
|
1477
|
+
repeatedRef.current = false;
|
|
1478
|
+
stopRepeat();
|
|
1479
|
+
const delta = () => dir * stateRef.current.step;
|
|
1480
|
+
timersRef.current.timeout = window.setTimeout(() => {
|
|
1481
|
+
timersRef.current.interval = window.setInterval(() => {
|
|
1482
|
+
repeatedRef.current = true;
|
|
1483
|
+
spin(delta());
|
|
1484
|
+
}, 60);
|
|
1485
|
+
}, 300);
|
|
1486
|
+
}, [
|
|
1487
|
+
interactionDisabled,
|
|
1488
|
+
spin,
|
|
1489
|
+
stopRepeat
|
|
1490
|
+
]);
|
|
1491
|
+
const handleStepClick = react.useCallback((dir) => () => {
|
|
1492
|
+
if (interactionDisabled) return;
|
|
1493
|
+
if (repeatedRef.current) {
|
|
1494
|
+
repeatedRef.current = false;
|
|
1495
|
+
return;
|
|
1496
|
+
}
|
|
1497
|
+
spin(dir * stateRef.current.step);
|
|
1498
|
+
}, [interactionDisabled, spin]);
|
|
1499
|
+
const handleKeyDown = react.useCallback((e) => {
|
|
1500
|
+
if (interactionDisabled) return;
|
|
1501
|
+
const s = stateRef.current;
|
|
1502
|
+
const big = largeStep !== null && largeStep !== void 0 ? largeStep : s.step * 10;
|
|
1503
|
+
switch (e.key) {
|
|
1504
|
+
case "ArrowUp":
|
|
1505
|
+
e.preventDefault();
|
|
1506
|
+
spin(s.step);
|
|
1507
|
+
break;
|
|
1508
|
+
case "ArrowDown":
|
|
1509
|
+
e.preventDefault();
|
|
1510
|
+
spin(-s.step);
|
|
1511
|
+
break;
|
|
1512
|
+
case "PageUp":
|
|
1513
|
+
e.preventDefault();
|
|
1514
|
+
spin(big);
|
|
1515
|
+
break;
|
|
1516
|
+
case "PageDown":
|
|
1517
|
+
e.preventDefault();
|
|
1518
|
+
spin(-big);
|
|
1519
|
+
break;
|
|
1520
|
+
case "Home":
|
|
1521
|
+
if (min !== void 0) {
|
|
1522
|
+
e.preventDefault();
|
|
1523
|
+
setTo(min);
|
|
1524
|
+
}
|
|
1525
|
+
break;
|
|
1526
|
+
case "End":
|
|
1527
|
+
if (max !== void 0) {
|
|
1528
|
+
e.preventDefault();
|
|
1529
|
+
setTo(max);
|
|
1530
|
+
}
|
|
1531
|
+
break;
|
|
1532
|
+
default: break;
|
|
1533
|
+
}
|
|
1534
|
+
}, [
|
|
1535
|
+
interactionDisabled,
|
|
1536
|
+
spin,
|
|
1537
|
+
setTo,
|
|
1538
|
+
largeStep,
|
|
1539
|
+
min,
|
|
1540
|
+
max
|
|
1541
|
+
]);
|
|
1542
|
+
const scrubStartRef = react.useRef(null);
|
|
1543
|
+
const handleScrubPointerDown = react.useCallback((e) => {
|
|
1544
|
+
if (e.button !== 0 || interactionDisabled) return;
|
|
1545
|
+
e.preventDefault();
|
|
1546
|
+
scrubStartRef.current = {
|
|
1547
|
+
x: e.clientX,
|
|
1548
|
+
value: getSpinBase()
|
|
1549
|
+
};
|
|
1550
|
+
try {
|
|
1551
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
1552
|
+
} catch (_unused) {}
|
|
1553
|
+
}, [getSpinBase, interactionDisabled]);
|
|
1554
|
+
const handleScrubPointerMove = react.useCallback((e) => {
|
|
1555
|
+
const start = scrubStartRef.current;
|
|
1556
|
+
if (!start) return;
|
|
1557
|
+
const s = stateRef.current;
|
|
1558
|
+
const steps = Math.round((e.clientX - start.x) / 6);
|
|
1559
|
+
setInvalidDraft(false);
|
|
1560
|
+
setValue(s.clamp(addPrecise(start.value, steps * s.step, s.step)));
|
|
1561
|
+
}, [setValue]);
|
|
1562
|
+
const handleScrubPointerUp = react.useCallback((e) => {
|
|
1563
|
+
scrubStartRef.current = null;
|
|
1564
|
+
try {
|
|
1565
|
+
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
1566
|
+
} catch (_unused2) {}
|
|
1567
|
+
}, []);
|
|
1568
|
+
const canDecrement = value === null || min === void 0 || numericValue > min;
|
|
1569
|
+
const canIncrement = value === null || max === void 0 || numericValue < max;
|
|
1570
|
+
const decrementUnavailable = interactionDisabled || !canDecrement;
|
|
1571
|
+
const incrementUnavailable = interactionDisabled || !canIncrement;
|
|
1572
|
+
const showClear = isNullable && clearable && value !== null;
|
|
1573
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1574
|
+
className: cn("flex flex-col gap-1.5", className),
|
|
1575
|
+
"data-opt-id": "GKPSV",
|
|
1576
|
+
"data-opt-slug": "number-input.NumberInput",
|
|
1577
|
+
children: [
|
|
1578
|
+
label && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1579
|
+
className: cn("text-sm font-medium text-text-primary", scrub && !interactionDisabled && "w-fit cursor-ew-resize touch-none select-none"),
|
|
1580
|
+
onPointerDown: scrub ? handleScrubPointerDown : void 0,
|
|
1581
|
+
onPointerMove: scrub ? handleScrubPointerMove : void 0,
|
|
1582
|
+
onPointerUp: scrub ? handleScrubPointerUp : void 0,
|
|
1583
|
+
onPointerCancel: scrub ? handleScrubPointerUp : void 0,
|
|
1584
|
+
children: [label, required && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RequiredMark, {})]
|
|
1585
|
+
}),
|
|
1586
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1587
|
+
className: "flex items-center",
|
|
1588
|
+
children: [
|
|
1589
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1590
|
+
type: "button",
|
|
1591
|
+
onClick: handleStepClick(-1),
|
|
1592
|
+
onPointerDown: handleStepPointerDown(-1),
|
|
1593
|
+
onPointerUp: stopRepeat,
|
|
1594
|
+
onPointerLeave: stopRepeat,
|
|
1595
|
+
onPointerCancel: stopRepeat,
|
|
1596
|
+
disabled: nativeDisabled || !canDecrement,
|
|
1597
|
+
"aria-disabled": decrementUnavailable || void 0,
|
|
1598
|
+
"aria-label": resolvedLabels.decrease,
|
|
1599
|
+
title: disabledReason,
|
|
1600
|
+
className: cn("border-border bg-surface text-text-secondary flex h-10 w-10 items-center justify-center rounded-l-lg border border-r-0 text-sm font-medium", decrementUnavailable ? "cursor-not-allowed opacity-40" : "hover:bg-bg-subtle cursor-pointer", nativeDisabled && "pointer-events-none", OPT_FOCUS_VISIBLE),
|
|
1601
|
+
children: "−"
|
|
1602
|
+
}),
|
|
1603
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1604
|
+
className: "relative min-w-0 flex-1",
|
|
1605
|
+
children: [
|
|
1606
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1607
|
+
type: "text",
|
|
1608
|
+
inputMode: "decimal",
|
|
1609
|
+
id: inputId,
|
|
1610
|
+
value: displayValue,
|
|
1611
|
+
onChange: handleChange,
|
|
1612
|
+
onFocus: handleFocus,
|
|
1613
|
+
onBlur: handleBlur,
|
|
1614
|
+
onKeyDown: handleKeyDown,
|
|
1615
|
+
disabled: nativeDisabled,
|
|
1616
|
+
readOnly: interactionDisabled,
|
|
1617
|
+
"aria-disabled": interactionDisabled || void 0,
|
|
1618
|
+
"aria-label": (_ref2 = ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : label) !== null && _ref2 !== void 0 ? _ref2 : resolvedLabels.input,
|
|
1619
|
+
"aria-invalid": hasError,
|
|
1620
|
+
"aria-required": required,
|
|
1621
|
+
"aria-describedby": getDescribedBy(inputId, effectiveError, hint),
|
|
1622
|
+
min,
|
|
1623
|
+
max,
|
|
1624
|
+
step,
|
|
1625
|
+
title: disabledReason,
|
|
1626
|
+
className: cn(OPT_INPUT, "[appearance:textfield] rounded-none border-x-0 text-center [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none", (unit || showClear) && "pr-10", unit && showClear && "pr-16", interactionDisabled && "cursor-not-allowed opacity-60", hasError && "border-danger focus-visible:outline-danger")
|
|
1627
|
+
}),
|
|
1628
|
+
unit && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1629
|
+
className: cn("text-text-tertiary pointer-events-none absolute top-1/2 -translate-y-1/2 text-sm", showClear ? "right-10" : "right-3"),
|
|
1630
|
+
"aria-hidden": "true",
|
|
1631
|
+
children: unit
|
|
1632
|
+
}),
|
|
1633
|
+
showClear && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1634
|
+
type: "button",
|
|
1635
|
+
onClick: handleClear,
|
|
1636
|
+
disabled: nativeDisabled,
|
|
1637
|
+
"aria-disabled": interactionDisabled || void 0,
|
|
1638
|
+
"aria-label": resolvedLabels.clear,
|
|
1639
|
+
title: disabledReason,
|
|
1640
|
+
className: cn("text-text-tertiary absolute top-1/2 right-2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded text-sm", interactionDisabled ? "cursor-not-allowed opacity-40" : "hover:bg-bg-subtle hover:text-text-primary cursor-pointer", nativeDisabled && "pointer-events-none", "outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-ring-offset"),
|
|
1641
|
+
children: "×"
|
|
1642
|
+
})
|
|
1643
|
+
]
|
|
1644
|
+
}),
|
|
1645
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1646
|
+
type: "button",
|
|
1647
|
+
onClick: handleStepClick(1),
|
|
1648
|
+
onPointerDown: handleStepPointerDown(1),
|
|
1649
|
+
onPointerUp: stopRepeat,
|
|
1650
|
+
onPointerLeave: stopRepeat,
|
|
1651
|
+
onPointerCancel: stopRepeat,
|
|
1652
|
+
disabled: nativeDisabled || !canIncrement,
|
|
1653
|
+
"aria-disabled": incrementUnavailable || void 0,
|
|
1654
|
+
"aria-label": resolvedLabels.increase,
|
|
1655
|
+
title: disabledReason,
|
|
1656
|
+
className: cn("border-border bg-surface text-text-secondary flex h-10 w-10 items-center justify-center rounded-r-lg border border-l-0 text-sm font-medium", incrementUnavailable ? "cursor-not-allowed opacity-40" : "hover:bg-bg-subtle cursor-pointer", nativeDisabled && "pointer-events-none", OPT_FOCUS_VISIBLE),
|
|
1657
|
+
children: "+"
|
|
1658
|
+
})
|
|
1659
|
+
]
|
|
1660
|
+
}),
|
|
1661
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldMessages, {
|
|
1662
|
+
id: inputId,
|
|
1663
|
+
error: effectiveError,
|
|
1664
|
+
hint
|
|
1665
|
+
})
|
|
1666
|
+
]
|
|
1667
|
+
});
|
|
1668
|
+
}
|
|
1669
|
+
NumberInput.displayName = "NumberInput";
|
|
1670
|
+
//#endregion
|
|
1671
|
+
//#region src/core/slider.tsx
|
|
1672
|
+
function getSliderState(value, min, max, step) {
|
|
1673
|
+
const safeMin = Number.isFinite(min) ? min : 0;
|
|
1674
|
+
const rawMax = Number.isFinite(max) ? max : 100;
|
|
1675
|
+
const safeMax = rawMax >= safeMin ? rawMax : safeMin;
|
|
1676
|
+
const safeStep = Number.isFinite(step) && step > 0 ? step : 1;
|
|
1677
|
+
const clampedValue = Math.min(Math.max(Number.isFinite(value) ? value : safeMin, safeMin), safeMax);
|
|
1678
|
+
return {
|
|
1679
|
+
value: clampedValue,
|
|
1680
|
+
min: safeMin,
|
|
1681
|
+
max: safeMax,
|
|
1682
|
+
step: safeStep,
|
|
1683
|
+
percentage: safeMax === safeMin ? 0 : (clampedValue - safeMin) / (safeMax - safeMin) * 100
|
|
1684
|
+
};
|
|
1685
|
+
}
|
|
1686
|
+
/** Renders the slider component. */
|
|
1687
|
+
function Slider({ value: controlledValue, defaultValue = 0, onChange, min = 0, max = 100, step = 1, label, showValue = false, formatValue, disabled = false, className, "aria-label": ariaLabel }) {
|
|
1688
|
+
var _ref;
|
|
1689
|
+
const [localValue, setLocalValue] = (0, react.useState)(defaultValue);
|
|
1690
|
+
const sliderState = getSliderState(controlledValue !== null && controlledValue !== void 0 ? controlledValue : localValue, min, max, step);
|
|
1691
|
+
const handleChange = (0, react.useCallback)((e) => {
|
|
1692
|
+
const next = getSliderState(parseFloat(e.target.value), min, max, step).value;
|
|
1693
|
+
if (controlledValue === void 0) setLocalValue(next);
|
|
1694
|
+
onChange === null || onChange === void 0 || onChange(next);
|
|
1695
|
+
}, [
|
|
1696
|
+
controlledValue,
|
|
1697
|
+
min,
|
|
1698
|
+
max,
|
|
1699
|
+
step,
|
|
1700
|
+
onChange
|
|
1701
|
+
]);
|
|
1702
|
+
const displayValue = formatValue ? formatValue(sliderState.value) : String(sliderState.value);
|
|
1703
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1704
|
+
className: cn("flex flex-col gap-1.5", className),
|
|
1705
|
+
"data-opt-id": "VJCDH",
|
|
1706
|
+
"data-opt-slug": "slider.Slider",
|
|
1707
|
+
children: [(label || showValue) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1708
|
+
className: "flex items-center justify-between",
|
|
1709
|
+
children: [label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1710
|
+
className: "text-sm font-medium text-text-primary",
|
|
1711
|
+
children: label
|
|
1712
|
+
}), showValue && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1713
|
+
className: "text-text-tertiary text-sm",
|
|
1714
|
+
children: displayValue
|
|
1715
|
+
})]
|
|
1716
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1717
|
+
type: "range",
|
|
1718
|
+
min: sliderState.min,
|
|
1719
|
+
max: sliderState.max,
|
|
1720
|
+
step: sliderState.step,
|
|
1721
|
+
value: sliderState.value,
|
|
1722
|
+
onChange: handleChange,
|
|
1723
|
+
disabled,
|
|
1724
|
+
"aria-label": (_ref = ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : label) !== null && _ref !== void 0 ? _ref : "Slider",
|
|
1725
|
+
"aria-valuemin": sliderState.min,
|
|
1726
|
+
"aria-valuemax": sliderState.max,
|
|
1727
|
+
"aria-valuenow": sliderState.value,
|
|
1728
|
+
"aria-valuetext": displayValue,
|
|
1729
|
+
className: cn("h-2 w-full cursor-pointer appearance-none rounded-full", "bg-bg-subtle", "[&::-webkit-slider-thumb]:bg-accent [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:shadow-sm", "[&::-moz-range-thumb]:bg-accent [&::-moz-range-thumb]:h-4 [&::-moz-range-thumb]:w-4 [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-0 [&::-moz-range-thumb]:shadow-sm", "disabled:cursor-not-allowed disabled:opacity-40", OPT_FOCUS_VISIBLE),
|
|
1730
|
+
style: { background: disabled ? void 0 : `linear-gradient(to right, var(--color-accent) ${sliderState.percentage}%, var(--color-bg-subtle) ${sliderState.percentage}%)` }
|
|
1731
|
+
})]
|
|
1732
|
+
});
|
|
1733
|
+
}
|
|
1734
|
+
Slider.displayName = "Slider";
|
|
1735
|
+
//#endregion
|
|
1736
|
+
//#region src/core/popover.tsx
|
|
1737
|
+
const _excluded$3 = ["className"];
|
|
1738
|
+
const _excluded2$1 = ["className"];
|
|
1739
|
+
const _excluded3$1 = ["className"];
|
|
1740
|
+
/** Renders the popover root component. */
|
|
1741
|
+
function PopoverRoot(props) {
|
|
1742
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.PopoverRoot, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1743
|
+
"data-opt-id": "DWJD5",
|
|
1744
|
+
"data-opt-slug": "popover.PopoverRoot"
|
|
1745
|
+
}));
|
|
1746
|
+
}
|
|
1747
|
+
const PopoverTrigger = (0, react.forwardRef)((_ref, ref) => {
|
|
1748
|
+
let { className } = _ref, props = _objectWithoutProperties(_ref, _excluded$3);
|
|
1749
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.PopoverTrigger, _objectSpread2(_objectSpread2({
|
|
1750
|
+
ref,
|
|
1751
|
+
className: cn("inline-flex items-center gap-1.5 rounded-lg px-3 py-2 text-sm", "cursor-pointer data-[disabled]:cursor-not-allowed", OPT_FOCUS_VISIBLE, className)
|
|
1752
|
+
}, props), {}, {
|
|
1753
|
+
"data-opt-id": "2W9BZ",
|
|
1754
|
+
"data-opt-slug": "popover.PopoverTrigger"
|
|
1755
|
+
}));
|
|
1756
|
+
});
|
|
1757
|
+
PopoverTrigger.displayName = "PopoverTrigger";
|
|
1758
|
+
/** Renders the popover content component. */
|
|
1759
|
+
function PopoverContent(_ref2) {
|
|
1760
|
+
let { className } = _ref2, props = _objectWithoutProperties(_ref2, _excluded2$1);
|
|
1761
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.PopoverContent, _objectSpread2(_objectSpread2({ className: cn("bg-surface-overlay z-50 rounded-lg p-4 shadow-lg", OPT_BORDER, OPT_ANIMATE_ENTER_EXIT, className) }, props), {}, {
|
|
1762
|
+
"data-opt-id": "E03EY",
|
|
1763
|
+
"data-opt-slug": "popover.PopoverContent"
|
|
1764
|
+
}));
|
|
1765
|
+
}
|
|
1766
|
+
/** Renders the popover close component. */
|
|
1767
|
+
function PopoverClose(_ref3) {
|
|
1768
|
+
let { className } = _ref3, props = _objectWithoutProperties(_ref3, _excluded3$1);
|
|
1769
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.PopoverClose, _objectSpread2(_objectSpread2({ className: cn("text-text-tertiary hover:bg-bg-subtle inline-flex items-center justify-center rounded-md p-1 text-sm", "cursor-pointer data-[disabled]:cursor-not-allowed", OPT_FOCUS_VISIBLE, className) }, props), {}, {
|
|
1770
|
+
"data-opt-id": "FP4KF",
|
|
1771
|
+
"data-opt-slug": "popover.PopoverClose"
|
|
1772
|
+
}));
|
|
1773
|
+
}
|
|
1774
|
+
//#endregion
|
|
1775
|
+
//#region src/core/color-picker.tsx
|
|
1776
|
+
const DEFAULT_PRESETS$1 = [
|
|
1777
|
+
"#3b82f6",
|
|
1778
|
+
"#10b981",
|
|
1779
|
+
"#f59e0b",
|
|
1780
|
+
"#8b5cf6",
|
|
1781
|
+
"#ef4444",
|
|
1782
|
+
"#06b6d4",
|
|
1783
|
+
"#f97316",
|
|
1784
|
+
"#ec4899",
|
|
1785
|
+
"#84cc16",
|
|
1786
|
+
"#6366f1",
|
|
1787
|
+
"#14b8a6",
|
|
1788
|
+
"#a855f7",
|
|
1789
|
+
"#78716c",
|
|
1790
|
+
"#000000",
|
|
1791
|
+
"#6b7280",
|
|
1792
|
+
"#ffffff"
|
|
1793
|
+
];
|
|
1794
|
+
const ColorPicker = (0, react.forwardRef)(({ value, onChange, presets = DEFAULT_PRESETS$1, label, required, error, hint, placeholder = "#000000", disabled = false, className, id, "aria-label": ariaLabel }, ref) => {
|
|
1795
|
+
var _useInputId, _ref;
|
|
1796
|
+
const [color, setColor] = useControlledState("#3b82f6", value, onChange);
|
|
1797
|
+
const fallbackId = (0, react.useId)().replace(/:/g, "");
|
|
1798
|
+
const pickerId = (_useInputId = useInputId(id, label, "color-picker")) !== null && _useInputId !== void 0 ? _useInputId : `color-picker-${fallbackId}`;
|
|
1799
|
+
const hasError = Boolean(error);
|
|
1800
|
+
const [inputValue, setInputValue] = (0, react.useState)(color);
|
|
1801
|
+
const inputRef = (0, react.useRef)(null);
|
|
1802
|
+
const handlePresetClick = (0, react.useCallback)((preset) => {
|
|
1803
|
+
setColor(preset);
|
|
1804
|
+
setInputValue(preset);
|
|
1805
|
+
}, [setColor]);
|
|
1806
|
+
const handleInputChange = (0, react.useCallback)((e) => {
|
|
1807
|
+
const val = e.target.value;
|
|
1808
|
+
setInputValue(val);
|
|
1809
|
+
if (/^#[0-9a-fA-F]{6}$/.test(val)) setColor(val);
|
|
1810
|
+
}, [setColor]);
|
|
1811
|
+
const handleInputBlur = (0, react.useCallback)(() => {
|
|
1812
|
+
if (!/^#[0-9a-fA-F]{6}$/.test(inputValue)) setInputValue(color);
|
|
1813
|
+
}, [inputValue, color]);
|
|
1814
|
+
const lastValueRef = (0, react.useRef)(value);
|
|
1815
|
+
if (value !== void 0 && value !== lastValueRef.current) {
|
|
1816
|
+
lastValueRef.current = value;
|
|
1817
|
+
if (value !== inputValue) setInputValue(value);
|
|
1818
|
+
}
|
|
1819
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1820
|
+
className: cn("flex flex-col gap-1.5", className),
|
|
1821
|
+
"data-opt-id": "V2CSG",
|
|
1822
|
+
"data-opt-slug": "color-picker.ColorPicker",
|
|
1823
|
+
children: [
|
|
1824
|
+
label && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1825
|
+
className: "text-sm font-medium text-text-primary",
|
|
1826
|
+
children: [label, required && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RequiredMark, {})]
|
|
1827
|
+
}),
|
|
1828
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PopoverRoot, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PopoverTrigger, {
|
|
1829
|
+
id: pickerId,
|
|
1830
|
+
className: cn(OPT_INPUT, "cursor-pointer items-center gap-2", hasError && "border-danger focus-visible:outline-danger", disabled && "pointer-events-none opacity-50"),
|
|
1831
|
+
disabled,
|
|
1832
|
+
"aria-label": (_ref = ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : label) !== null && _ref !== void 0 ? _ref : "Color picker",
|
|
1833
|
+
"aria-required": required,
|
|
1834
|
+
"aria-invalid": hasError,
|
|
1835
|
+
"aria-describedby": getDescribedBy(pickerId, error, hint),
|
|
1836
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1837
|
+
className: "border-border inline-block h-5 w-5 rounded border",
|
|
1838
|
+
style: { backgroundColor: color },
|
|
1839
|
+
"aria-hidden": "true"
|
|
1840
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1841
|
+
className: OPT_TEXT_PRIMARY,
|
|
1842
|
+
children: color
|
|
1843
|
+
})]
|
|
1844
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PopoverContent, {
|
|
1845
|
+
className: cn("bg-surface-overlay z-50 rounded-lg p-3 shadow-lg", OPT_BORDER),
|
|
1846
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1847
|
+
className: "mb-3 grid grid-cols-8 gap-1.5",
|
|
1848
|
+
role: "listbox",
|
|
1849
|
+
"aria-label": "Color presets",
|
|
1850
|
+
children: presets.map((preset) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1851
|
+
type: "button",
|
|
1852
|
+
onClick: () => handlePresetClick(preset),
|
|
1853
|
+
className: cn("h-7 w-7 rounded-md border transition-transform hover:scale-110", OPT_FOCUS_VISIBLE, preset === color ? "border-accent ring-ring ring-offset-ring-offset ring-2 ring-offset-1" : "border-border", preset === "#ffffff" && "border-black/20"),
|
|
1854
|
+
style: { backgroundColor: preset },
|
|
1855
|
+
role: "option",
|
|
1856
|
+
"aria-selected": preset === color,
|
|
1857
|
+
"aria-label": preset
|
|
1858
|
+
}, preset))
|
|
1859
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1860
|
+
className: "flex items-center gap-2",
|
|
1861
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1862
|
+
className: "border-border h-8 w-8 rounded-md border",
|
|
1863
|
+
style: { backgroundColor: color },
|
|
1864
|
+
"aria-hidden": "true"
|
|
1865
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1866
|
+
ref: ref !== null && ref !== void 0 ? ref : inputRef,
|
|
1867
|
+
type: "text",
|
|
1868
|
+
value: inputValue,
|
|
1869
|
+
onChange: handleInputChange,
|
|
1870
|
+
onBlur: handleInputBlur,
|
|
1871
|
+
placeholder,
|
|
1872
|
+
maxLength: 7,
|
|
1873
|
+
className: cn("border-border bg-surface flex-1 rounded-md border px-2 py-1.5 font-mono text-sm", OPT_TEXT_PRIMARY, OPT_FOCUS_VISIBLE),
|
|
1874
|
+
"aria-label": "Hex color value"
|
|
1875
|
+
})]
|
|
1876
|
+
})]
|
|
1877
|
+
})] }),
|
|
1878
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldMessages, {
|
|
1879
|
+
id: pickerId,
|
|
1880
|
+
error,
|
|
1881
|
+
hint
|
|
1882
|
+
})
|
|
1883
|
+
]
|
|
1884
|
+
});
|
|
1885
|
+
});
|
|
1886
|
+
ColorPicker.displayName = "ColorPicker";
|
|
1887
|
+
//#endregion
|
|
1888
|
+
//#region src/lib/icon-registry.tsx
|
|
1889
|
+
const defaultIconEntries = [
|
|
1890
|
+
{
|
|
1891
|
+
id: "click",
|
|
1892
|
+
label: "Click",
|
|
1893
|
+
Icon: lucide_react.MousePointerClick,
|
|
1894
|
+
group: "Actions"
|
|
1895
|
+
},
|
|
1896
|
+
{
|
|
1897
|
+
id: "view",
|
|
1898
|
+
label: "View",
|
|
1899
|
+
Icon: lucide_react.Eye,
|
|
1900
|
+
group: "Actions"
|
|
1901
|
+
},
|
|
1902
|
+
{
|
|
1903
|
+
id: "cart",
|
|
1904
|
+
label: "Cart",
|
|
1905
|
+
Icon: lucide_react.ShoppingCart,
|
|
1906
|
+
group: "Actions"
|
|
1907
|
+
},
|
|
1908
|
+
{
|
|
1909
|
+
id: "purchase",
|
|
1910
|
+
label: "Purchase",
|
|
1911
|
+
Icon: lucide_react.CreditCard,
|
|
1912
|
+
group: "Actions"
|
|
1913
|
+
},
|
|
1914
|
+
{
|
|
1915
|
+
id: "signup",
|
|
1916
|
+
label: "Sign Up",
|
|
1917
|
+
Icon: lucide_react.UserPlus,
|
|
1918
|
+
group: "Actions"
|
|
1919
|
+
},
|
|
1920
|
+
{
|
|
1921
|
+
id: "login",
|
|
1922
|
+
label: "Login",
|
|
1923
|
+
Icon: lucide_react.LogIn,
|
|
1924
|
+
group: "Actions"
|
|
1925
|
+
},
|
|
1926
|
+
{
|
|
1927
|
+
id: "search",
|
|
1928
|
+
label: "Search",
|
|
1929
|
+
Icon: lucide_react.Search,
|
|
1930
|
+
group: "Actions"
|
|
1931
|
+
},
|
|
1932
|
+
{
|
|
1933
|
+
id: "download",
|
|
1934
|
+
label: "Download",
|
|
1935
|
+
Icon: lucide_react.Download,
|
|
1936
|
+
group: "Actions"
|
|
1937
|
+
},
|
|
1938
|
+
{
|
|
1939
|
+
id: "share",
|
|
1940
|
+
label: "Share",
|
|
1941
|
+
Icon: lucide_react.Share2,
|
|
1942
|
+
group: "Social"
|
|
1943
|
+
},
|
|
1944
|
+
{
|
|
1945
|
+
id: "like",
|
|
1946
|
+
label: "Like",
|
|
1947
|
+
Icon: lucide_react.Heart,
|
|
1948
|
+
group: "Social"
|
|
1949
|
+
},
|
|
1950
|
+
{
|
|
1951
|
+
id: "comment",
|
|
1952
|
+
label: "Comment",
|
|
1953
|
+
Icon: lucide_react.MessageCircle,
|
|
1954
|
+
group: "Social"
|
|
1955
|
+
},
|
|
1956
|
+
{
|
|
1957
|
+
id: "follow",
|
|
1958
|
+
label: "Follow",
|
|
1959
|
+
Icon: lucide_react.UserPlus,
|
|
1960
|
+
group: "Social"
|
|
1961
|
+
},
|
|
1962
|
+
{
|
|
1963
|
+
id: "star",
|
|
1964
|
+
label: "Star",
|
|
1965
|
+
Icon: lucide_react.Star,
|
|
1966
|
+
group: "Status"
|
|
1967
|
+
},
|
|
1968
|
+
{
|
|
1969
|
+
id: "flag",
|
|
1970
|
+
label: "Flag",
|
|
1971
|
+
Icon: lucide_react.Flag,
|
|
1972
|
+
group: "Status"
|
|
1973
|
+
},
|
|
1974
|
+
{
|
|
1975
|
+
id: "check",
|
|
1976
|
+
label: "Check",
|
|
1977
|
+
Icon: lucide_react.Check,
|
|
1978
|
+
group: "Status"
|
|
1979
|
+
},
|
|
1980
|
+
{
|
|
1981
|
+
id: "error",
|
|
1982
|
+
label: "Error",
|
|
1983
|
+
Icon: lucide_react.CircleAlert,
|
|
1984
|
+
group: "Status"
|
|
1985
|
+
},
|
|
1986
|
+
{
|
|
1987
|
+
id: "warning",
|
|
1988
|
+
label: "Warning",
|
|
1989
|
+
Icon: lucide_react.TriangleAlert,
|
|
1990
|
+
group: "Status"
|
|
1991
|
+
},
|
|
1992
|
+
{
|
|
1993
|
+
id: "info",
|
|
1994
|
+
label: "Info",
|
|
1995
|
+
Icon: lucide_react.Info,
|
|
1996
|
+
group: "Status"
|
|
1997
|
+
},
|
|
1998
|
+
{
|
|
1999
|
+
id: "bell",
|
|
2000
|
+
label: "Bell",
|
|
2001
|
+
Icon: lucide_react.Bell,
|
|
2002
|
+
group: "Objects"
|
|
2003
|
+
},
|
|
2004
|
+
{
|
|
2005
|
+
id: "mail",
|
|
2006
|
+
label: "Mail",
|
|
2007
|
+
Icon: lucide_react.Mail,
|
|
2008
|
+
group: "Objects"
|
|
2009
|
+
},
|
|
2010
|
+
{
|
|
2011
|
+
id: "file",
|
|
2012
|
+
label: "File",
|
|
2013
|
+
Icon: lucide_react.FileText,
|
|
2014
|
+
group: "Objects"
|
|
2015
|
+
},
|
|
2016
|
+
{
|
|
2017
|
+
id: "folder",
|
|
2018
|
+
label: "Folder",
|
|
2019
|
+
Icon: lucide_react.Folder,
|
|
2020
|
+
group: "Objects"
|
|
2021
|
+
},
|
|
2022
|
+
{
|
|
2023
|
+
id: "settings",
|
|
2024
|
+
label: "Settings",
|
|
2025
|
+
Icon: lucide_react.Settings,
|
|
2026
|
+
group: "Objects"
|
|
2027
|
+
},
|
|
2028
|
+
{
|
|
2029
|
+
id: "link",
|
|
2030
|
+
label: "Link",
|
|
2031
|
+
Icon: lucide_react.Link2,
|
|
2032
|
+
group: "Objects"
|
|
2033
|
+
}
|
|
2034
|
+
];
|
|
2035
|
+
const extraIconEntries = [
|
|
2036
|
+
{
|
|
2037
|
+
id: "eye",
|
|
2038
|
+
label: "Eye",
|
|
2039
|
+
Icon: lucide_react.Eye
|
|
2040
|
+
},
|
|
2041
|
+
{
|
|
2042
|
+
id: "user",
|
|
2043
|
+
label: "User",
|
|
2044
|
+
Icon: lucide_react.User
|
|
2045
|
+
},
|
|
2046
|
+
{
|
|
2047
|
+
id: "shopping-cart",
|
|
2048
|
+
label: "Shopping Cart",
|
|
2049
|
+
Icon: lucide_react.ShoppingCart
|
|
2050
|
+
},
|
|
2051
|
+
{
|
|
2052
|
+
id: "credit-card",
|
|
2053
|
+
label: "Credit Card",
|
|
2054
|
+
Icon: lucide_react.CreditCard
|
|
2055
|
+
},
|
|
2056
|
+
{
|
|
2057
|
+
id: "heart",
|
|
2058
|
+
label: "Heart",
|
|
2059
|
+
Icon: lucide_react.Heart
|
|
2060
|
+
},
|
|
2061
|
+
{
|
|
2062
|
+
id: "upload",
|
|
2063
|
+
label: "Upload",
|
|
2064
|
+
Icon: lucide_react.Upload
|
|
2065
|
+
},
|
|
2066
|
+
{
|
|
2067
|
+
id: "globe",
|
|
2068
|
+
label: "Globe",
|
|
2069
|
+
Icon: lucide_react.Globe
|
|
2070
|
+
},
|
|
2071
|
+
{
|
|
2072
|
+
id: "zap",
|
|
2073
|
+
label: "Zap",
|
|
2074
|
+
Icon: lucide_react.Zap
|
|
2075
|
+
},
|
|
2076
|
+
{
|
|
2077
|
+
id: "trending-up",
|
|
2078
|
+
label: "Trending Up",
|
|
2079
|
+
Icon: lucide_react.TrendingUp
|
|
2080
|
+
},
|
|
2081
|
+
{
|
|
2082
|
+
id: "bar-chart",
|
|
2083
|
+
label: "Bar Chart",
|
|
2084
|
+
Icon: lucide_react.ChartColumn
|
|
2085
|
+
},
|
|
2086
|
+
{
|
|
2087
|
+
id: "check-circle",
|
|
2088
|
+
label: "Check Circle",
|
|
2089
|
+
Icon: lucide_react.CircleCheck
|
|
2090
|
+
},
|
|
2091
|
+
{
|
|
2092
|
+
id: "x-circle",
|
|
2093
|
+
label: "X Circle",
|
|
2094
|
+
Icon: lucide_react.XCircle
|
|
2095
|
+
}
|
|
2096
|
+
];
|
|
2097
|
+
const iconRegistry = new Map([...defaultIconEntries, ...extraIconEntries].map((entry) => [entry.id, entry]));
|
|
2098
|
+
const defaultIconRegistry = defaultIconEntries;
|
|
2099
|
+
/** Returns icon registry entry. */
|
|
2100
|
+
function getIconRegistryEntry(id) {
|
|
2101
|
+
return iconRegistry.get(id);
|
|
2102
|
+
}
|
|
2103
|
+
//#endregion
|
|
2104
|
+
//#region src/core/icon-picker.tsx
|
|
2105
|
+
const DEFAULT_ICONS = [...defaultIconRegistry.map(({ id, label, Icon, group }) => ({
|
|
2106
|
+
id,
|
|
2107
|
+
label,
|
|
2108
|
+
group,
|
|
2109
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {})
|
|
2110
|
+
}))];
|
|
2111
|
+
function renderIconPreview(icon, options) {
|
|
2112
|
+
if (typeof icon === "string" || typeof icon === "number") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2113
|
+
className: cn(options.textClassName, "leading-none"),
|
|
2114
|
+
"aria-hidden": true,
|
|
2115
|
+
children: icon
|
|
2116
|
+
});
|
|
2117
|
+
if (react.isValidElement(icon)) return react.cloneElement(icon, {
|
|
2118
|
+
"aria-hidden": true,
|
|
2119
|
+
className: cn(options.elementClassName, icon.props.className)
|
|
2120
|
+
});
|
|
2121
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2122
|
+
className: cn("flex items-center justify-center", options.elementClassName),
|
|
2123
|
+
"aria-hidden": true,
|
|
2124
|
+
children: icon
|
|
2125
|
+
});
|
|
2126
|
+
}
|
|
2127
|
+
/** Renders the icon picker component. */
|
|
2128
|
+
function IconPicker({ value, onChange, icons = DEFAULT_ICONS, label, required, error, hint, placeholder = "Select icon", disabled = false, className, id, "aria-label": ariaLabel }) {
|
|
2129
|
+
var _useInputId, _ref;
|
|
2130
|
+
const [selected, setSelected] = useControlledState("", value, onChange);
|
|
2131
|
+
const fallbackId = react.useId().replace(/:/g, "");
|
|
2132
|
+
const pickerId = (_useInputId = useInputId(id, label, "icon-picker")) !== null && _useInputId !== void 0 ? _useInputId : `icon-picker-${fallbackId}`;
|
|
2133
|
+
const hasError = Boolean(error);
|
|
2134
|
+
const [search, setSearch] = react.useState("");
|
|
2135
|
+
const selectedIcon = react.useMemo(() => icons.find((i) => i.id === selected), [icons, selected]);
|
|
2136
|
+
const filteredIcons = react.useMemo(() => {
|
|
2137
|
+
if (!search) return icons;
|
|
2138
|
+
const q = search.toLowerCase();
|
|
2139
|
+
return icons.filter((i) => {
|
|
2140
|
+
var _i$group;
|
|
2141
|
+
return i.label.toLowerCase().includes(q) || i.id.toLowerCase().includes(q) || ((_i$group = i.group) === null || _i$group === void 0 ? void 0 : _i$group.toLowerCase().includes(q));
|
|
2142
|
+
});
|
|
2143
|
+
}, [icons, search]);
|
|
2144
|
+
const groups = react.useMemo(() => {
|
|
2145
|
+
const map = /* @__PURE__ */ new Map();
|
|
2146
|
+
for (const icon of filteredIcons) {
|
|
2147
|
+
var _icon$group;
|
|
2148
|
+
const group = (_icon$group = icon.group) !== null && _icon$group !== void 0 ? _icon$group : "Other";
|
|
2149
|
+
if (!map.has(group)) map.set(group, []);
|
|
2150
|
+
map.get(group).push(icon);
|
|
2151
|
+
}
|
|
2152
|
+
return map;
|
|
2153
|
+
}, [filteredIcons]);
|
|
2154
|
+
const handleSelect = react.useCallback((iconId) => {
|
|
2155
|
+
setSelected(iconId);
|
|
2156
|
+
}, [setSelected]);
|
|
2157
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2158
|
+
className: cn("flex flex-col gap-1.5", className),
|
|
2159
|
+
"data-opt-id": "0DRGP",
|
|
2160
|
+
"data-opt-slug": "icon-picker.IconPicker",
|
|
2161
|
+
children: [
|
|
2162
|
+
label && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
2163
|
+
className: "text-sm font-medium text-text-primary",
|
|
2164
|
+
children: [label, required && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RequiredMark, {})]
|
|
2165
|
+
}),
|
|
2166
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PopoverRoot, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(PopoverTrigger, {
|
|
2167
|
+
id: pickerId,
|
|
2168
|
+
className: cn(OPT_INPUT, "cursor-pointer items-center gap-2", !selectedIcon && "text-text-tertiary", hasError && "border-danger focus-visible:outline-danger", disabled && "pointer-events-none opacity-50"),
|
|
2169
|
+
disabled,
|
|
2170
|
+
"aria-label": (_ref = ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : label) !== null && _ref !== void 0 ? _ref : "Icon picker",
|
|
2171
|
+
"aria-required": required,
|
|
2172
|
+
"aria-invalid": hasError,
|
|
2173
|
+
"aria-describedby": getDescribedBy(pickerId, error, hint),
|
|
2174
|
+
children: selectedIcon ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [renderIconPreview(selectedIcon.icon, {
|
|
2175
|
+
elementClassName: "size-5 shrink-0",
|
|
2176
|
+
textClassName: "text-lg"
|
|
2177
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2178
|
+
className: OPT_TEXT_PRIMARY,
|
|
2179
|
+
children: selectedIcon.label
|
|
2180
|
+
})] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: placeholder })
|
|
2181
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PopoverContent, {
|
|
2182
|
+
className: cn("bg-surface-overlay z-50 w-72 rounded-lg p-3 shadow-lg", OPT_BORDER),
|
|
2183
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
2184
|
+
type: "text",
|
|
2185
|
+
value: search,
|
|
2186
|
+
onChange: (e) => setSearch(e.target.value),
|
|
2187
|
+
placeholder: "Search icons...",
|
|
2188
|
+
className: cn("border-border bg-surface mb-2 w-full rounded-md border px-3 py-1.5 text-sm outline-transparent", OPT_TEXT_PRIMARY, "placeholder:text-text-tertiary", OPT_FOCUS_VISIBLE),
|
|
2189
|
+
"aria-label": "Search icons"
|
|
2190
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2191
|
+
className: "max-h-56 overflow-y-auto",
|
|
2192
|
+
children: filteredIcons.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2193
|
+
className: cn(OPT_TEXT_SECONDARY, "py-4 text-center text-sm"),
|
|
2194
|
+
children: "No icons found"
|
|
2195
|
+
}) : Array.from(groups.entries()).map(([groupName, groupIcons]) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2196
|
+
className: "mb-2",
|
|
2197
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2198
|
+
className: cn(OPT_TEXT_TERTIARY, "mb-1 block text-[10px] font-semibold tracking-wider uppercase"),
|
|
2199
|
+
children: groupName
|
|
2200
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2201
|
+
className: "grid grid-cols-6 gap-1",
|
|
2202
|
+
children: groupIcons.map((icon) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2203
|
+
type: "button",
|
|
2204
|
+
onClick: () => handleSelect(icon.id),
|
|
2205
|
+
className: cn("flex h-9 w-9 items-center justify-center rounded-md text-lg transition-colors", OPT_FOCUS_VISIBLE, icon.id === selected ? "bg-accent-subtle ring-ring ring-2" : "hover:bg-bg-subtle"),
|
|
2206
|
+
title: icon.label,
|
|
2207
|
+
"aria-label": icon.label,
|
|
2208
|
+
"aria-selected": icon.id === selected || void 0,
|
|
2209
|
+
children: renderIconPreview(icon.icon, {
|
|
2210
|
+
elementClassName: "size-4",
|
|
2211
|
+
textClassName: "text-lg"
|
|
2212
|
+
})
|
|
2213
|
+
}, icon.id))
|
|
2214
|
+
})]
|
|
2215
|
+
}, groupName))
|
|
2216
|
+
})]
|
|
2217
|
+
})] }),
|
|
2218
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldMessages, {
|
|
2219
|
+
id: pickerId,
|
|
2220
|
+
error,
|
|
2221
|
+
hint
|
|
2222
|
+
})
|
|
2223
|
+
]
|
|
2224
|
+
});
|
|
2225
|
+
}
|
|
2226
|
+
IconPicker.displayName = "IconPicker";
|
|
2227
|
+
//#endregion
|
|
2228
|
+
//#region src/core/tag-input.tsx
|
|
2229
|
+
const DEFAULT_DELIMITERS = [
|
|
2230
|
+
",",
|
|
2231
|
+
";",
|
|
2232
|
+
"\n"
|
|
2233
|
+
];
|
|
2234
|
+
function splitByDelimiters(text, delimiters) {
|
|
2235
|
+
const pattern = delimiters.map((d) => d instanceof RegExp ? d.source : d.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
2236
|
+
return text.split(new RegExp(pattern)).map((s) => s.trim()).filter(Boolean);
|
|
2237
|
+
}
|
|
2238
|
+
const TagInput = (0, react.forwardRef)(({ value, onChange, placeholder = "Add tag...", label, required, error, hint, maxTags, disabled = false, className, id, "aria-label": ariaLabel, suggestions, delimiters = DEFAULT_DELIMITERS, allowDuplicates = false }, ref) => {
|
|
2239
|
+
var _useInputId, _ref, _ref2, _ref3, _ref4;
|
|
2240
|
+
const [tags, setTags] = useControlledState([], value, onChange);
|
|
2241
|
+
const fallbackId = (0, react.useId)().replace(/:/g, "");
|
|
2242
|
+
const tagInputId = (_useInputId = useInputId(id, label, "tag-input")) !== null && _useInputId !== void 0 ? _useInputId : `tag-input-${fallbackId}`;
|
|
2243
|
+
const hasError = Boolean(error);
|
|
2244
|
+
const describedBy = getDescribedBy(tagInputId, error, hint);
|
|
2245
|
+
const [inputValue, setInputValue] = (0, react.useState)("");
|
|
2246
|
+
const [highlightIndex, setHighlightIndex] = (0, react.useState)(-1);
|
|
2247
|
+
const [showSuggestions, setShowSuggestions] = (0, react.useState)(false);
|
|
2248
|
+
const innerRef = (0, react.useRef)(null);
|
|
2249
|
+
const inputRef = (_ref = ref) !== null && _ref !== void 0 ? _ref : innerRef;
|
|
2250
|
+
const listboxRef = (0, react.useRef)(null);
|
|
2251
|
+
const listboxId = (0, react.useId)();
|
|
2252
|
+
const undoStack = (0, react.useRef)([]);
|
|
2253
|
+
const redoStack = (0, react.useRef)([]);
|
|
2254
|
+
const tagRefs = (0, react.useRef)(/* @__PURE__ */ new Map());
|
|
2255
|
+
function pushUndo(prev) {
|
|
2256
|
+
undoStack.current.push(prev);
|
|
2257
|
+
redoStack.current = [];
|
|
2258
|
+
}
|
|
2259
|
+
const undo = (0, react.useCallback)(() => {
|
|
2260
|
+
if (undoStack.current.length === 0) return;
|
|
2261
|
+
const prev = undoStack.current.pop();
|
|
2262
|
+
redoStack.current.push([...tags]);
|
|
2263
|
+
setTags(prev);
|
|
2264
|
+
}, [tags, setTags]);
|
|
2265
|
+
const redo = (0, react.useCallback)(() => {
|
|
2266
|
+
if (redoStack.current.length === 0) return;
|
|
2267
|
+
const next = redoStack.current.pop();
|
|
2268
|
+
undoStack.current.push([...tags]);
|
|
2269
|
+
setTags(next);
|
|
2270
|
+
}, [tags, setTags]);
|
|
2271
|
+
const filtered = suggestions && inputValue.trim() ? suggestions.filter((s) => s.toLowerCase().includes(inputValue.trim().toLowerCase()) && (allowDuplicates || !tags.includes(s))) : [];
|
|
2272
|
+
const isOpen = showSuggestions && filtered.length > 0;
|
|
2273
|
+
(0, react.useEffect)(() => {
|
|
2274
|
+
setHighlightIndex(-1);
|
|
2275
|
+
}, [inputValue]);
|
|
2276
|
+
const addTag = (0, react.useCallback)((tag) => {
|
|
2277
|
+
const trimmed = tag.trim();
|
|
2278
|
+
if (!trimmed) return;
|
|
2279
|
+
if (!allowDuplicates && tags.includes(trimmed)) return;
|
|
2280
|
+
if (maxTags && tags.length >= maxTags) return;
|
|
2281
|
+
pushUndo([...tags]);
|
|
2282
|
+
setTags([...tags, trimmed]);
|
|
2283
|
+
setInputValue("");
|
|
2284
|
+
setShowSuggestions(false);
|
|
2285
|
+
}, [
|
|
2286
|
+
tags,
|
|
2287
|
+
setTags,
|
|
2288
|
+
maxTags,
|
|
2289
|
+
allowDuplicates
|
|
2290
|
+
]);
|
|
2291
|
+
const removeTag = (0, react.useCallback)((index) => {
|
|
2292
|
+
pushUndo([...tags]);
|
|
2293
|
+
setTags(tags.filter((_, i) => i !== index));
|
|
2294
|
+
}, [tags, setTags]);
|
|
2295
|
+
const handleTagKeyDown = (0, react.useCallback)((e, index) => {
|
|
2296
|
+
if (e.key === "Backspace" || e.key === "Delete") {
|
|
2297
|
+
e.preventDefault();
|
|
2298
|
+
const nextTags = tags.filter((_, i) => i !== index);
|
|
2299
|
+
pushUndo([...tags]);
|
|
2300
|
+
setTags(nextTags);
|
|
2301
|
+
requestAnimationFrame(() => {
|
|
2302
|
+
if (nextTags.length === 0) {
|
|
2303
|
+
var _inputRef$current;
|
|
2304
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
|
|
2305
|
+
} else if (index < nextTags.length) {
|
|
2306
|
+
var _tagRefs$current$get;
|
|
2307
|
+
(_tagRefs$current$get = tagRefs.current.get(index)) === null || _tagRefs$current$get === void 0 || _tagRefs$current$get.focus();
|
|
2308
|
+
} else {
|
|
2309
|
+
var _tagRefs$current$get2;
|
|
2310
|
+
(_tagRefs$current$get2 = tagRefs.current.get(nextTags.length - 1)) === null || _tagRefs$current$get2 === void 0 || _tagRefs$current$get2.focus();
|
|
2311
|
+
}
|
|
2312
|
+
});
|
|
2313
|
+
return;
|
|
2314
|
+
}
|
|
2315
|
+
if ((e.ctrlKey || e.metaKey) && e.key === "z" && !e.shiftKey) {
|
|
2316
|
+
e.preventDefault();
|
|
2317
|
+
undo();
|
|
2318
|
+
requestAnimationFrame(() => {
|
|
2319
|
+
var _inputRef$current2;
|
|
2320
|
+
return (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.focus();
|
|
2321
|
+
});
|
|
2322
|
+
return;
|
|
2323
|
+
}
|
|
2324
|
+
if ((e.ctrlKey || e.metaKey) && (e.key === "Z" || e.key === "z" && e.shiftKey || e.key === "y")) {
|
|
2325
|
+
e.preventDefault();
|
|
2326
|
+
redo();
|
|
2327
|
+
requestAnimationFrame(() => {
|
|
2328
|
+
var _inputRef$current3;
|
|
2329
|
+
return (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.focus();
|
|
2330
|
+
});
|
|
2331
|
+
return;
|
|
2332
|
+
}
|
|
2333
|
+
if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {
|
|
2334
|
+
var _inputRef$current4;
|
|
2335
|
+
(_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 || _inputRef$current4.focus();
|
|
2336
|
+
}
|
|
2337
|
+
}, [
|
|
2338
|
+
tags,
|
|
2339
|
+
setTags,
|
|
2340
|
+
undo,
|
|
2341
|
+
redo,
|
|
2342
|
+
inputRef
|
|
2343
|
+
]);
|
|
2344
|
+
const handleInputKeyDown = (0, react.useCallback)((e) => {
|
|
2345
|
+
var _inputRef$current5;
|
|
2346
|
+
if ((e.ctrlKey || e.metaKey) && e.key === "z" && !e.shiftKey) {
|
|
2347
|
+
e.preventDefault();
|
|
2348
|
+
undo();
|
|
2349
|
+
return;
|
|
2350
|
+
}
|
|
2351
|
+
if ((e.ctrlKey || e.metaKey) && (e.key === "Z" || e.key === "z" && e.shiftKey || e.key === "y")) {
|
|
2352
|
+
e.preventDefault();
|
|
2353
|
+
redo();
|
|
2354
|
+
return;
|
|
2355
|
+
}
|
|
2356
|
+
if (isOpen) {
|
|
2357
|
+
if (e.key === "ArrowDown") {
|
|
2358
|
+
e.preventDefault();
|
|
2359
|
+
setHighlightIndex((prev) => prev < filtered.length - 1 ? prev + 1 : 0);
|
|
2360
|
+
return;
|
|
2361
|
+
}
|
|
2362
|
+
if (e.key === "ArrowUp") {
|
|
2363
|
+
e.preventDefault();
|
|
2364
|
+
setHighlightIndex((prev) => prev > 0 ? prev - 1 : filtered.length - 1);
|
|
2365
|
+
return;
|
|
2366
|
+
}
|
|
2367
|
+
if (e.key === "Enter" && highlightIndex >= 0) {
|
|
2368
|
+
e.preventDefault();
|
|
2369
|
+
addTag(filtered[highlightIndex]);
|
|
2370
|
+
return;
|
|
2371
|
+
}
|
|
2372
|
+
if (e.key === "Escape") {
|
|
2373
|
+
e.preventDefault();
|
|
2374
|
+
setShowSuggestions(false);
|
|
2375
|
+
return;
|
|
2376
|
+
}
|
|
2377
|
+
}
|
|
2378
|
+
if (e.key === "Enter") {
|
|
2379
|
+
e.preventDefault();
|
|
2380
|
+
addTag(inputValue);
|
|
2381
|
+
} else if (e.key === "Backspace" && inputValue === "" && tags.length > 0) removeTag(tags.length - 1);
|
|
2382
|
+
else if (e.key === "ArrowLeft" && ((_inputRef$current5 = inputRef.current) === null || _inputRef$current5 === void 0 ? void 0 : _inputRef$current5.selectionStart) === 0 && tags.length > 0) {
|
|
2383
|
+
var _tagRefs$current$get3;
|
|
2384
|
+
e.preventDefault();
|
|
2385
|
+
(_tagRefs$current$get3 = tagRefs.current.get(tags.length - 1)) === null || _tagRefs$current$get3 === void 0 || _tagRefs$current$get3.focus();
|
|
2386
|
+
}
|
|
2387
|
+
}, [
|
|
2388
|
+
inputValue,
|
|
2389
|
+
tags,
|
|
2390
|
+
addTag,
|
|
2391
|
+
removeTag,
|
|
2392
|
+
isOpen,
|
|
2393
|
+
highlightIndex,
|
|
2394
|
+
filtered,
|
|
2395
|
+
undo,
|
|
2396
|
+
redo,
|
|
2397
|
+
inputRef
|
|
2398
|
+
]);
|
|
2399
|
+
const handlePaste = (0, react.useCallback)((e) => {
|
|
2400
|
+
const parts = splitByDelimiters(e.clipboardData.getData("text/plain"), delimiters);
|
|
2401
|
+
if (parts.length < 2) return;
|
|
2402
|
+
e.preventDefault();
|
|
2403
|
+
const prev = [...tags];
|
|
2404
|
+
let next = [...tags];
|
|
2405
|
+
const remaining = maxTags ? maxTags - next.length : Infinity;
|
|
2406
|
+
for (const part of parts.slice(0, remaining)) {
|
|
2407
|
+
if (!allowDuplicates && next.includes(part)) continue;
|
|
2408
|
+
next = [...next, part];
|
|
2409
|
+
}
|
|
2410
|
+
if (next.length !== prev.length) {
|
|
2411
|
+
pushUndo(prev);
|
|
2412
|
+
setTags(next);
|
|
2413
|
+
setInputValue("");
|
|
2414
|
+
}
|
|
2415
|
+
}, [
|
|
2416
|
+
tags,
|
|
2417
|
+
setTags,
|
|
2418
|
+
maxTags,
|
|
2419
|
+
delimiters,
|
|
2420
|
+
allowDuplicates
|
|
2421
|
+
]);
|
|
2422
|
+
(0, react.useEffect)(() => {
|
|
2423
|
+
if (highlightIndex >= 0 && listboxRef.current) {
|
|
2424
|
+
var _el$scrollIntoView;
|
|
2425
|
+
const el = listboxRef.current.children[highlightIndex];
|
|
2426
|
+
el === null || el === void 0 || (_el$scrollIntoView = el.scrollIntoView) === null || _el$scrollIntoView === void 0 || _el$scrollIntoView.call(el, { block: "nearest" });
|
|
2427
|
+
}
|
|
2428
|
+
}, [highlightIndex]);
|
|
2429
|
+
const atLimit = Boolean(maxTags && tags.length >= maxTags);
|
|
2430
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2431
|
+
className: cn("relative flex flex-col gap-1.5", className),
|
|
2432
|
+
"data-opt-id": "3TDWF",
|
|
2433
|
+
"data-opt-slug": "tag-input.TagInput",
|
|
2434
|
+
children: [
|
|
2435
|
+
label && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
2436
|
+
className: "text-sm font-medium text-text-primary",
|
|
2437
|
+
children: [label, required && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RequiredMark, {})]
|
|
2438
|
+
}),
|
|
2439
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2440
|
+
className: cn("border-border bg-surface flex min-h-10 flex-wrap items-center gap-1.5 rounded-lg border px-3 py-1.5", "focus-within:ring-ring focus-within:ring-offset-ring-offset focus-within:ring-2 focus-within:ring-offset-1", hasError && "border-danger", disabled && "pointer-events-none opacity-50"),
|
|
2441
|
+
onMouseDown: () => {
|
|
2442
|
+
var _inputRef$current6;
|
|
2443
|
+
return (_inputRef$current6 = inputRef.current) === null || _inputRef$current6 === void 0 ? void 0 : _inputRef$current6.focus();
|
|
2444
|
+
},
|
|
2445
|
+
role: "group",
|
|
2446
|
+
"aria-label": (_ref2 = ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : label) !== null && _ref2 !== void 0 ? _ref2 : "Tag input",
|
|
2447
|
+
"aria-required": required,
|
|
2448
|
+
"aria-invalid": hasError,
|
|
2449
|
+
"aria-describedby": describedBy,
|
|
2450
|
+
children: [tags.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.CompositeProvider, {
|
|
2451
|
+
focusLoop: true,
|
|
2452
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.Composite, {
|
|
2453
|
+
"aria-label": "Selected tags",
|
|
2454
|
+
className: "contents",
|
|
2455
|
+
children: tags.map((tag, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_reopt_ai_opt_ui_primitives.CompositeItem, {
|
|
2456
|
+
render: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { ref: (el) => {
|
|
2457
|
+
if (el) tagRefs.current.set(i, el);
|
|
2458
|
+
else tagRefs.current.delete(i);
|
|
2459
|
+
} }),
|
|
2460
|
+
className: cn(OPT_BADGE_BLUE, "flex items-center gap-1 py-1", "outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-ring-offset", "rounded-md"),
|
|
2461
|
+
onKeyDown: (e) => handleTagKeyDown(e, i),
|
|
2462
|
+
children: [tag, !disabled && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2463
|
+
type: "button",
|
|
2464
|
+
tabIndex: -1,
|
|
2465
|
+
onClick: (e) => {
|
|
2466
|
+
var _inputRef$current7;
|
|
2467
|
+
e.stopPropagation();
|
|
2468
|
+
removeTag(i);
|
|
2469
|
+
(_inputRef$current7 = inputRef.current) === null || _inputRef$current7 === void 0 || _inputRef$current7.focus();
|
|
2470
|
+
},
|
|
2471
|
+
className: "hover:bg-accent-subtle ml-0.5 rounded-full p-0.5",
|
|
2472
|
+
"aria-label": `Remove ${tag}`,
|
|
2473
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
2474
|
+
width: "10",
|
|
2475
|
+
height: "10",
|
|
2476
|
+
viewBox: "0 0 10 10",
|
|
2477
|
+
fill: "none",
|
|
2478
|
+
stroke: "currentColor",
|
|
2479
|
+
strokeWidth: "1.5",
|
|
2480
|
+
strokeLinecap: "round",
|
|
2481
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M2.5 2.5L7.5 7.5M7.5 2.5L2.5 7.5" })
|
|
2482
|
+
})
|
|
2483
|
+
})]
|
|
2484
|
+
}, `${tag}-${i}`))
|
|
2485
|
+
})
|
|
2486
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
2487
|
+
ref: inputRef,
|
|
2488
|
+
type: "text",
|
|
2489
|
+
value: inputValue,
|
|
2490
|
+
onChange: (e) => {
|
|
2491
|
+
setInputValue(e.target.value);
|
|
2492
|
+
setShowSuggestions(true);
|
|
2493
|
+
},
|
|
2494
|
+
onKeyDown: handleInputKeyDown,
|
|
2495
|
+
onPaste: handlePaste,
|
|
2496
|
+
onFocus: () => setShowSuggestions(true),
|
|
2497
|
+
onBlur: () => {
|
|
2498
|
+
setTimeout(() => setShowSuggestions(false), 150);
|
|
2499
|
+
},
|
|
2500
|
+
placeholder: tags.length === 0 ? placeholder : atLimit ? "" : "",
|
|
2501
|
+
disabled: disabled || atLimit,
|
|
2502
|
+
className: cn("min-w-[60px] flex-1 border-none bg-transparent text-sm outline-transparent", OPT_TEXT_PRIMARY, OPT_FOCUS_VISIBLE, "placeholder:text-text-tertiary"),
|
|
2503
|
+
"aria-label": (_ref3 = ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : label) !== null && _ref3 !== void 0 ? _ref3 : "Tag input",
|
|
2504
|
+
role: suggestions ? "combobox" : void 0,
|
|
2505
|
+
"aria-describedby": describedBy,
|
|
2506
|
+
"aria-expanded": suggestions ? isOpen : void 0,
|
|
2507
|
+
"aria-controls": suggestions ? listboxId : void 0,
|
|
2508
|
+
"aria-activedescendant": isOpen && highlightIndex >= 0 ? `${listboxId}-${highlightIndex}` : void 0,
|
|
2509
|
+
"aria-autocomplete": suggestions ? "list" : void 0
|
|
2510
|
+
})]
|
|
2511
|
+
}),
|
|
2512
|
+
isOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
2513
|
+
ref: listboxRef,
|
|
2514
|
+
id: listboxId,
|
|
2515
|
+
role: "listbox",
|
|
2516
|
+
"aria-label": (_ref4 = ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : label) !== null && _ref4 !== void 0 ? _ref4 : "Tag suggestions",
|
|
2517
|
+
className: "border-border bg-surface absolute top-full z-50 mt-1 max-h-48 w-full overflow-auto rounded-lg border shadow-md",
|
|
2518
|
+
children: filtered.map((suggestion, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
|
|
2519
|
+
id: `${listboxId}-${i}`,
|
|
2520
|
+
role: "option",
|
|
2521
|
+
"aria-selected": i === highlightIndex,
|
|
2522
|
+
className: cn("cursor-pointer px-3 py-1.5 text-sm", "text-text-primary", i === highlightIndex && "bg-accent-subtle"),
|
|
2523
|
+
onMouseDown: (e) => {
|
|
2524
|
+
e.preventDefault();
|
|
2525
|
+
addTag(suggestion);
|
|
2526
|
+
},
|
|
2527
|
+
onMouseEnter: () => setHighlightIndex(i),
|
|
2528
|
+
children: suggestion
|
|
2529
|
+
}, suggestion))
|
|
2530
|
+
}),
|
|
2531
|
+
maxTags && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
2532
|
+
className: "text-text-tertiary text-xs",
|
|
2533
|
+
children: [
|
|
2534
|
+
tags.length,
|
|
2535
|
+
"/",
|
|
2536
|
+
maxTags
|
|
2537
|
+
]
|
|
2538
|
+
}),
|
|
2539
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldMessages, {
|
|
2540
|
+
id: tagInputId,
|
|
2541
|
+
error,
|
|
2542
|
+
hint
|
|
2543
|
+
})
|
|
2544
|
+
]
|
|
2545
|
+
});
|
|
2546
|
+
});
|
|
2547
|
+
TagInput.displayName = "TagInput";
|
|
2548
|
+
//#endregion
|
|
2549
|
+
//#region src/core/date-range-picker.tsx
|
|
2550
|
+
const DAYS = [
|
|
2551
|
+
"Su",
|
|
2552
|
+
"Mo",
|
|
2553
|
+
"Tu",
|
|
2554
|
+
"We",
|
|
2555
|
+
"Th",
|
|
2556
|
+
"Fr",
|
|
2557
|
+
"Sa"
|
|
2558
|
+
];
|
|
2559
|
+
function defaultFormat(date) {
|
|
2560
|
+
return date.toLocaleDateString("en-US", {
|
|
2561
|
+
year: "numeric",
|
|
2562
|
+
month: "short",
|
|
2563
|
+
day: "numeric"
|
|
2564
|
+
});
|
|
2565
|
+
}
|
|
2566
|
+
function isSameDay(a, b) {
|
|
2567
|
+
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
2568
|
+
}
|
|
2569
|
+
function isInRange(date, start, end) {
|
|
2570
|
+
if (!start || !end) return false;
|
|
2571
|
+
const t = date.getTime();
|
|
2572
|
+
return t >= start.getTime() && t <= end.getTime();
|
|
2573
|
+
}
|
|
2574
|
+
function getDaysInMonth(year, month) {
|
|
2575
|
+
return new Date(year, month + 1, 0).getDate();
|
|
2576
|
+
}
|
|
2577
|
+
function getFirstDayOfMonth(year, month) {
|
|
2578
|
+
return new Date(year, month, 1).getDay();
|
|
2579
|
+
}
|
|
2580
|
+
function startOfDay(date) {
|
|
2581
|
+
const normalized = new Date(date);
|
|
2582
|
+
normalized.setHours(0, 0, 0, 0);
|
|
2583
|
+
return normalized;
|
|
2584
|
+
}
|
|
2585
|
+
function getDateKey(date) {
|
|
2586
|
+
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
|
|
2587
|
+
}
|
|
2588
|
+
function createDateInMonth(year, month, day) {
|
|
2589
|
+
return startOfDay(new Date(year, month, Math.min(day, getDaysInMonth(year, month))));
|
|
2590
|
+
}
|
|
2591
|
+
const DEFAULT_PRESETS = [
|
|
2592
|
+
{
|
|
2593
|
+
label: "Today",
|
|
2594
|
+
range: () => {
|
|
2595
|
+
const now = /* @__PURE__ */ new Date();
|
|
2596
|
+
now.setHours(0, 0, 0, 0);
|
|
2597
|
+
return {
|
|
2598
|
+
start: now,
|
|
2599
|
+
end: new Date(now)
|
|
2600
|
+
};
|
|
2601
|
+
}
|
|
2602
|
+
},
|
|
2603
|
+
{
|
|
2604
|
+
label: "Last 7 days",
|
|
2605
|
+
range: () => {
|
|
2606
|
+
const end = /* @__PURE__ */ new Date();
|
|
2607
|
+
end.setHours(0, 0, 0, 0);
|
|
2608
|
+
const start = new Date(end);
|
|
2609
|
+
start.setDate(start.getDate() - 6);
|
|
2610
|
+
return {
|
|
2611
|
+
start,
|
|
2612
|
+
end
|
|
2613
|
+
};
|
|
2614
|
+
}
|
|
2615
|
+
},
|
|
2616
|
+
{
|
|
2617
|
+
label: "Last 30 days",
|
|
2618
|
+
range: () => {
|
|
2619
|
+
const end = /* @__PURE__ */ new Date();
|
|
2620
|
+
end.setHours(0, 0, 0, 0);
|
|
2621
|
+
const start = new Date(end);
|
|
2622
|
+
start.setDate(start.getDate() - 29);
|
|
2623
|
+
return {
|
|
2624
|
+
start,
|
|
2625
|
+
end
|
|
2626
|
+
};
|
|
2627
|
+
}
|
|
2628
|
+
},
|
|
2629
|
+
{
|
|
2630
|
+
label: "Last 90 days",
|
|
2631
|
+
range: () => {
|
|
2632
|
+
const end = /* @__PURE__ */ new Date();
|
|
2633
|
+
end.setHours(0, 0, 0, 0);
|
|
2634
|
+
const start = new Date(end);
|
|
2635
|
+
start.setDate(start.getDate() - 89);
|
|
2636
|
+
return {
|
|
2637
|
+
start,
|
|
2638
|
+
end
|
|
2639
|
+
};
|
|
2640
|
+
}
|
|
2641
|
+
},
|
|
2642
|
+
{
|
|
2643
|
+
label: "This month",
|
|
2644
|
+
range: () => {
|
|
2645
|
+
const now = /* @__PURE__ */ new Date();
|
|
2646
|
+
now.setHours(0, 0, 0, 0);
|
|
2647
|
+
return {
|
|
2648
|
+
start: new Date(now.getFullYear(), now.getMonth(), 1),
|
|
2649
|
+
end: now
|
|
2650
|
+
};
|
|
2651
|
+
}
|
|
2652
|
+
},
|
|
2653
|
+
{
|
|
2654
|
+
label: "Last month",
|
|
2655
|
+
range: () => {
|
|
2656
|
+
const now = /* @__PURE__ */ new Date();
|
|
2657
|
+
return {
|
|
2658
|
+
start: new Date(now.getFullYear(), now.getMonth() - 1, 1),
|
|
2659
|
+
end: new Date(now.getFullYear(), now.getMonth(), 0)
|
|
2660
|
+
};
|
|
2661
|
+
}
|
|
2662
|
+
}
|
|
2663
|
+
];
|
|
2664
|
+
const GRANULARITY_OPTIONS = [
|
|
2665
|
+
{
|
|
2666
|
+
value: "hour",
|
|
2667
|
+
label: "Hour"
|
|
2668
|
+
},
|
|
2669
|
+
{
|
|
2670
|
+
value: "day",
|
|
2671
|
+
label: "Day"
|
|
2672
|
+
},
|
|
2673
|
+
{
|
|
2674
|
+
value: "week",
|
|
2675
|
+
label: "Week"
|
|
2676
|
+
},
|
|
2677
|
+
{
|
|
2678
|
+
value: "month",
|
|
2679
|
+
label: "Month"
|
|
2680
|
+
}
|
|
2681
|
+
];
|
|
2682
|
+
const COMPARISON_OPTIONS = [{
|
|
2683
|
+
value: "previous",
|
|
2684
|
+
label: "vs Previous period"
|
|
2685
|
+
}, {
|
|
2686
|
+
value: "year-over-year",
|
|
2687
|
+
label: "vs Same period last year"
|
|
2688
|
+
}];
|
|
2689
|
+
/** Renders the date range picker component. */
|
|
2690
|
+
function DateRangePicker({ value, onChange, presets = DEFAULT_PRESETS, placeholder = "Select date range", label, required, error, hint, className, id, triggerClassName, "aria-label": ariaLabel, disabled = false, format = defaultFormat, comparison = false, comparisonMode, onComparisonChange, showGranularity = false, granularity, onGranularityChange }) {
|
|
2691
|
+
var _useInputId, _ref3;
|
|
2692
|
+
const fallbackId = (0, react.useId)().replace(/:/g, "");
|
|
2693
|
+
const pickerId = (_useInputId = useInputId(id, label, "date-range-picker")) !== null && _useInputId !== void 0 ? _useInputId : `date-range-picker-${fallbackId}`;
|
|
2694
|
+
const hasError = Boolean(error);
|
|
2695
|
+
const [range, setRange] = useControlledState({
|
|
2696
|
+
start: null,
|
|
2697
|
+
end: null
|
|
2698
|
+
}, value, onChange);
|
|
2699
|
+
const [selecting, setSelecting] = (0, react.useState)("start");
|
|
2700
|
+
const [viewDate, setViewDate] = (0, react.useState)(() => {
|
|
2701
|
+
var _range$start;
|
|
2702
|
+
const d = (_range$start = range.start) !== null && _range$start !== void 0 ? _range$start : /* @__PURE__ */ new Date();
|
|
2703
|
+
return {
|
|
2704
|
+
year: d.getFullYear(),
|
|
2705
|
+
month: d.getMonth()
|
|
2706
|
+
};
|
|
2707
|
+
});
|
|
2708
|
+
const [focusedDate, setFocusedDate] = (0, react.useState)(() => {
|
|
2709
|
+
var _ref, _range$start2;
|
|
2710
|
+
return startOfDay((_ref = (_range$start2 = range.start) !== null && _range$start2 !== void 0 ? _range$start2 : range.end) !== null && _ref !== void 0 ? _ref : /* @__PURE__ */ new Date());
|
|
2711
|
+
});
|
|
2712
|
+
const dayButtonRefs = (0, react.useRef)({});
|
|
2713
|
+
const granularityButtonRefs = (0, react.useRef)({
|
|
2714
|
+
hour: null,
|
|
2715
|
+
day: null,
|
|
2716
|
+
week: null,
|
|
2717
|
+
month: null
|
|
2718
|
+
});
|
|
2719
|
+
const pendingFocusDateRef = (0, react.useRef)(null);
|
|
2720
|
+
const displayText = (0, react.useMemo)(() => {
|
|
2721
|
+
if (range.start && range.end) return `${format(range.start)} — ${format(range.end)}`;
|
|
2722
|
+
if (range.start) return `${format(range.start)} — ...`;
|
|
2723
|
+
return placeholder;
|
|
2724
|
+
}, [
|
|
2725
|
+
range,
|
|
2726
|
+
format,
|
|
2727
|
+
placeholder
|
|
2728
|
+
]);
|
|
2729
|
+
const handleDayClick = (0, react.useCallback)((day) => {
|
|
2730
|
+
setFocusedDate(day);
|
|
2731
|
+
if (selecting === "start") {
|
|
2732
|
+
setRange({
|
|
2733
|
+
start: day,
|
|
2734
|
+
end: null
|
|
2735
|
+
});
|
|
2736
|
+
setSelecting("end");
|
|
2737
|
+
} else {
|
|
2738
|
+
if (range.start && day.getTime() < range.start.getTime()) setRange({
|
|
2739
|
+
start: day,
|
|
2740
|
+
end: range.start
|
|
2741
|
+
});
|
|
2742
|
+
else setRange({
|
|
2743
|
+
start: range.start,
|
|
2744
|
+
end: day
|
|
2745
|
+
});
|
|
2746
|
+
setSelecting("start");
|
|
2747
|
+
}
|
|
2748
|
+
}, [
|
|
2749
|
+
selecting,
|
|
2750
|
+
range.start,
|
|
2751
|
+
setRange
|
|
2752
|
+
]);
|
|
2753
|
+
const handlePresetClick = (0, react.useCallback)((preset) => {
|
|
2754
|
+
var _ref2, _newRange$start;
|
|
2755
|
+
const newRange = preset.range();
|
|
2756
|
+
const nextFocusDate = startOfDay((_ref2 = (_newRange$start = newRange.start) !== null && _newRange$start !== void 0 ? _newRange$start : newRange.end) !== null && _ref2 !== void 0 ? _ref2 : /* @__PURE__ */ new Date());
|
|
2757
|
+
setRange(newRange);
|
|
2758
|
+
setViewDate({
|
|
2759
|
+
year: nextFocusDate.getFullYear(),
|
|
2760
|
+
month: nextFocusDate.getMonth()
|
|
2761
|
+
});
|
|
2762
|
+
setFocusedDate(nextFocusDate);
|
|
2763
|
+
setSelecting("start");
|
|
2764
|
+
}, [setRange]);
|
|
2765
|
+
const moveFocusToDate = (0, react.useCallback)((date) => {
|
|
2766
|
+
const nextDate = startOfDay(date);
|
|
2767
|
+
pendingFocusDateRef.current = nextDate;
|
|
2768
|
+
setViewDate({
|
|
2769
|
+
year: nextDate.getFullYear(),
|
|
2770
|
+
month: nextDate.getMonth()
|
|
2771
|
+
});
|
|
2772
|
+
setFocusedDate(nextDate);
|
|
2773
|
+
}, []);
|
|
2774
|
+
const prevMonth = (0, react.useCallback)(() => {
|
|
2775
|
+
setViewDate((v) => {
|
|
2776
|
+
const m = v.month - 1;
|
|
2777
|
+
const nextViewDate = m < 0 ? {
|
|
2778
|
+
year: v.year - 1,
|
|
2779
|
+
month: 11
|
|
2780
|
+
} : {
|
|
2781
|
+
year: v.year,
|
|
2782
|
+
month: m
|
|
2783
|
+
};
|
|
2784
|
+
setFocusedDate((currentFocusedDate) => createDateInMonth(nextViewDate.year, nextViewDate.month, currentFocusedDate.getDate()));
|
|
2785
|
+
return nextViewDate;
|
|
2786
|
+
});
|
|
2787
|
+
}, []);
|
|
2788
|
+
const nextMonth = (0, react.useCallback)(() => {
|
|
2789
|
+
setViewDate((v) => {
|
|
2790
|
+
const m = v.month + 1;
|
|
2791
|
+
const nextViewDate = m > 11 ? {
|
|
2792
|
+
year: v.year + 1,
|
|
2793
|
+
month: 0
|
|
2794
|
+
} : {
|
|
2795
|
+
year: v.year,
|
|
2796
|
+
month: m
|
|
2797
|
+
};
|
|
2798
|
+
setFocusedDate((currentFocusedDate) => createDateInMonth(nextViewDate.year, nextViewDate.month, currentFocusedDate.getDate()));
|
|
2799
|
+
return nextViewDate;
|
|
2800
|
+
});
|
|
2801
|
+
}, []);
|
|
2802
|
+
const { daysInMonth, firstDay, monthLabel } = (0, react.useMemo)(() => {
|
|
2803
|
+
return {
|
|
2804
|
+
daysInMonth: getDaysInMonth(viewDate.year, viewDate.month),
|
|
2805
|
+
firstDay: getFirstDayOfMonth(viewDate.year, viewDate.month),
|
|
2806
|
+
monthLabel: new Date(viewDate.year, viewDate.month).toLocaleDateString("en-US", {
|
|
2807
|
+
month: "long",
|
|
2808
|
+
year: "numeric"
|
|
2809
|
+
})
|
|
2810
|
+
};
|
|
2811
|
+
}, [viewDate.year, viewDate.month]);
|
|
2812
|
+
const today = (0, react.useMemo)(() => {
|
|
2813
|
+
const d = /* @__PURE__ */ new Date();
|
|
2814
|
+
d.setHours(0, 0, 0, 0);
|
|
2815
|
+
return d;
|
|
2816
|
+
}, []);
|
|
2817
|
+
const calendarWeeks = (0, react.useMemo)(() => {
|
|
2818
|
+
const leadingDays = Array.from({ length: firstDay }, () => null);
|
|
2819
|
+
const monthDays = Array.from({ length: daysInMonth }, (_, index) => startOfDay(new Date(viewDate.year, viewDate.month, index + 1)));
|
|
2820
|
+
const trailingDays = Array.from({ length: (7 - ((leadingDays.length + monthDays.length) % 7 || 7)) % 7 }, () => null);
|
|
2821
|
+
const cells = [
|
|
2822
|
+
...leadingDays,
|
|
2823
|
+
...monthDays,
|
|
2824
|
+
...trailingDays
|
|
2825
|
+
];
|
|
2826
|
+
return Array.from({ length: cells.length / 7 }, (_, rowIndex) => cells.slice(rowIndex * 7, rowIndex * 7 + 7));
|
|
2827
|
+
}, [
|
|
2828
|
+
daysInMonth,
|
|
2829
|
+
firstDay,
|
|
2830
|
+
viewDate.month,
|
|
2831
|
+
viewDate.year
|
|
2832
|
+
]);
|
|
2833
|
+
const handleDayKeyDown = (0, react.useCallback)((event, day) => {
|
|
2834
|
+
const nextDateFactory = {
|
|
2835
|
+
ArrowLeft: () => startOfDay(new Date(day.getFullYear(), day.getMonth(), day.getDate() - 1)),
|
|
2836
|
+
ArrowRight: () => startOfDay(new Date(day.getFullYear(), day.getMonth(), day.getDate() + 1)),
|
|
2837
|
+
ArrowUp: () => startOfDay(new Date(day.getFullYear(), day.getMonth(), day.getDate() - 7)),
|
|
2838
|
+
ArrowDown: () => startOfDay(new Date(day.getFullYear(), day.getMonth(), day.getDate() + 7)),
|
|
2839
|
+
Home: () => startOfDay(new Date(day.getFullYear(), day.getMonth(), day.getDate() - day.getDay())),
|
|
2840
|
+
End: () => startOfDay(new Date(day.getFullYear(), day.getMonth(), day.getDate() + (6 - day.getDay()))),
|
|
2841
|
+
PageUp: () => createDateInMonth(day.getFullYear(), day.getMonth() - 1, day.getDate()),
|
|
2842
|
+
PageDown: () => createDateInMonth(day.getFullYear(), day.getMonth() + 1, day.getDate())
|
|
2843
|
+
}[event.key];
|
|
2844
|
+
if (!nextDateFactory) return;
|
|
2845
|
+
event.preventDefault();
|
|
2846
|
+
moveFocusToDate(nextDateFactory());
|
|
2847
|
+
}, [moveFocusToDate]);
|
|
2848
|
+
const handleGranularityKeyDown = (0, react.useCallback)((event, currentValue) => {
|
|
2849
|
+
const currentIndex = GRANULARITY_OPTIONS.findIndex((opt) => opt.value === currentValue);
|
|
2850
|
+
if (currentIndex < 0) return;
|
|
2851
|
+
let nextIndex = -1;
|
|
2852
|
+
switch (event.key) {
|
|
2853
|
+
case "ArrowRight":
|
|
2854
|
+
case "ArrowDown":
|
|
2855
|
+
nextIndex = (currentIndex + 1) % GRANULARITY_OPTIONS.length;
|
|
2856
|
+
break;
|
|
2857
|
+
case "ArrowLeft":
|
|
2858
|
+
case "ArrowUp":
|
|
2859
|
+
nextIndex = (currentIndex - 1 + GRANULARITY_OPTIONS.length) % GRANULARITY_OPTIONS.length;
|
|
2860
|
+
break;
|
|
2861
|
+
case "Home":
|
|
2862
|
+
nextIndex = 0;
|
|
2863
|
+
break;
|
|
2864
|
+
case "End":
|
|
2865
|
+
nextIndex = GRANULARITY_OPTIONS.length - 1;
|
|
2866
|
+
break;
|
|
2867
|
+
default: return;
|
|
2868
|
+
}
|
|
2869
|
+
event.preventDefault();
|
|
2870
|
+
const nextValue = GRANULARITY_OPTIONS[nextIndex].value;
|
|
2871
|
+
onGranularityChange === null || onGranularityChange === void 0 || onGranularityChange(nextValue);
|
|
2872
|
+
requestAnimationFrame(() => {
|
|
2873
|
+
var _granularityButtonRef;
|
|
2874
|
+
(_granularityButtonRef = granularityButtonRefs.current[nextValue]) === null || _granularityButtonRef === void 0 || _granularityButtonRef.focus();
|
|
2875
|
+
});
|
|
2876
|
+
}, [onGranularityChange]);
|
|
2877
|
+
(0, react.useEffect)(() => {
|
|
2878
|
+
var _dayButtonRefs$curren;
|
|
2879
|
+
if (!pendingFocusDateRef.current) return;
|
|
2880
|
+
const button = (_dayButtonRefs$curren = dayButtonRefs.current[getDateKey(pendingFocusDateRef.current)]) !== null && _dayButtonRefs$curren !== void 0 ? _dayButtonRefs$curren : null;
|
|
2881
|
+
if (!button) return;
|
|
2882
|
+
button.focus();
|
|
2883
|
+
pendingFocusDateRef.current = null;
|
|
2884
|
+
}, [
|
|
2885
|
+
calendarWeeks,
|
|
2886
|
+
focusedDate,
|
|
2887
|
+
monthLabel
|
|
2888
|
+
]);
|
|
2889
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2890
|
+
className: cn("flex flex-col gap-1.5", className),
|
|
2891
|
+
"data-opt-id": "0KKZ0",
|
|
2892
|
+
"data-opt-slug": "date-range-picker.DateRangePicker",
|
|
2893
|
+
children: [
|
|
2894
|
+
label && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
2895
|
+
className: "text-text-primary text-sm font-medium",
|
|
2896
|
+
children: [label, required && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RequiredMark, {})]
|
|
2897
|
+
}),
|
|
2898
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PopoverRoot, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PopoverTrigger, {
|
|
2899
|
+
id: pickerId,
|
|
2900
|
+
className: cn(triggerClassName !== null && triggerClassName !== void 0 ? triggerClassName : OPT_INPUT, "cursor-pointer justify-between gap-2 text-left", !range.start && "text-text-tertiary", hasError && "border-danger focus-visible:outline-danger", disabled && "pointer-events-none opacity-50"),
|
|
2901
|
+
disabled,
|
|
2902
|
+
"aria-label": (_ref3 = ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : label) !== null && _ref3 !== void 0 ? _ref3 : "Date range picker",
|
|
2903
|
+
"aria-required": required,
|
|
2904
|
+
"aria-invalid": hasError,
|
|
2905
|
+
"aria-describedby": getDescribedBy(pickerId, error, hint),
|
|
2906
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2907
|
+
className: "truncate",
|
|
2908
|
+
children: displayText
|
|
2909
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CalendarDays, {
|
|
2910
|
+
"aria-hidden": "true",
|
|
2911
|
+
className: "text-text-tertiary size-4 shrink-0"
|
|
2912
|
+
})]
|
|
2913
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PopoverContent, {
|
|
2914
|
+
className: cn("bg-surface-overlay z-50 rounded-lg p-4 shadow-lg", OPT_BORDER),
|
|
2915
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2916
|
+
className: "flex gap-4",
|
|
2917
|
+
children: [presets.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2918
|
+
className: "border-border-subtle flex flex-col gap-1 border-r pr-4",
|
|
2919
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2920
|
+
className: cn("text-text-secondary", "mb-1 text-xs font-semibold tracking-wider uppercase"),
|
|
2921
|
+
children: "Presets"
|
|
2922
|
+
}), presets.map((preset) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2923
|
+
type: "button",
|
|
2924
|
+
onClick: () => handlePresetClick(preset),
|
|
2925
|
+
className: cn("rounded-md px-3 py-1.5 text-left text-sm", "text-text-primary", "hover:bg-accent-subtle", "outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-ring-offset"),
|
|
2926
|
+
children: preset.label
|
|
2927
|
+
}, preset.label))]
|
|
2928
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2929
|
+
className: "flex flex-col gap-2",
|
|
2930
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2931
|
+
className: "flex items-center justify-between",
|
|
2932
|
+
children: [
|
|
2933
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2934
|
+
type: "button",
|
|
2935
|
+
onClick: prevMonth,
|
|
2936
|
+
className: cn("rounded-md p-1", OPT_TEXT_SECONDARY, "hover:bg-bg-subtle", OPT_FOCUS_VISIBLE),
|
|
2937
|
+
"aria-label": "Previous month",
|
|
2938
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronLeft, {
|
|
2939
|
+
"aria-hidden": "true",
|
|
2940
|
+
className: "size-4 rtl:-scale-x-100"
|
|
2941
|
+
})
|
|
2942
|
+
}),
|
|
2943
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2944
|
+
className: cn(OPT_TEXT_PRIMARY, "text-sm font-medium"),
|
|
2945
|
+
children: monthLabel
|
|
2946
|
+
}),
|
|
2947
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2948
|
+
type: "button",
|
|
2949
|
+
onClick: nextMonth,
|
|
2950
|
+
className: cn("rounded-md p-1", OPT_TEXT_SECONDARY, "hover:bg-bg-subtle", OPT_FOCUS_VISIBLE),
|
|
2951
|
+
"aria-label": "Next month",
|
|
2952
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronRight, {
|
|
2953
|
+
"aria-hidden": "true",
|
|
2954
|
+
className: "size-4 rtl:-scale-x-100"
|
|
2955
|
+
})
|
|
2956
|
+
})
|
|
2957
|
+
]
|
|
2958
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2959
|
+
className: "flex flex-col gap-0",
|
|
2960
|
+
role: "grid",
|
|
2961
|
+
"aria-label": monthLabel,
|
|
2962
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2963
|
+
className: "grid grid-cols-7 gap-0",
|
|
2964
|
+
role: "row",
|
|
2965
|
+
children: DAYS.map((d) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2966
|
+
className: cn(OPT_TEXT_TERTIARY, "flex h-8 w-8 items-center justify-center text-xs font-medium"),
|
|
2967
|
+
role: "columnheader",
|
|
2968
|
+
children: d
|
|
2969
|
+
}, d))
|
|
2970
|
+
}), calendarWeeks.map((week, weekIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2971
|
+
className: "grid grid-cols-7 gap-0",
|
|
2972
|
+
role: "row",
|
|
2973
|
+
children: week.map((day, dayIndex) => {
|
|
2974
|
+
if (!day) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2975
|
+
className: "h-8 w-8",
|
|
2976
|
+
role: "gridcell",
|
|
2977
|
+
"aria-hidden": "true"
|
|
2978
|
+
}, `${monthLabel}-empty-${weekIndex + 1}-${dayIndex + 1}`);
|
|
2979
|
+
const isToday = isSameDay(day, today);
|
|
2980
|
+
const isSelected = range.start && isSameDay(day, range.start) || range.end && isSameDay(day, range.end);
|
|
2981
|
+
const inRange = isInRange(day, range.start, range.end);
|
|
2982
|
+
const isFocused = isSameDay(day, focusedDate);
|
|
2983
|
+
const dayLabel = day.toLocaleDateString("en-US", {
|
|
2984
|
+
weekday: "long",
|
|
2985
|
+
year: "numeric",
|
|
2986
|
+
month: "long",
|
|
2987
|
+
day: "numeric"
|
|
2988
|
+
});
|
|
2989
|
+
const dateKey = getDateKey(day);
|
|
2990
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2991
|
+
role: "gridcell",
|
|
2992
|
+
"aria-selected": isSelected || void 0,
|
|
2993
|
+
className: "flex h-8 w-8 items-center justify-center",
|
|
2994
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2995
|
+
ref: (node) => {
|
|
2996
|
+
dayButtonRefs.current[dateKey] = node;
|
|
2997
|
+
},
|
|
2998
|
+
type: "button",
|
|
2999
|
+
onClick: () => handleDayClick(day),
|
|
3000
|
+
onFocus: () => setFocusedDate(day),
|
|
3001
|
+
onKeyDown: (event) => handleDayKeyDown(event, day),
|
|
3002
|
+
tabIndex: isFocused ? 0 : -1,
|
|
3003
|
+
className: cn("flex h-8 w-8 items-center justify-center rounded-md text-sm", OPT_FOCUS_VISIBLE, isSelected && "bg-accent text-accent-fg font-medium", !isSelected && inRange && "bg-accent-subtle text-accent-fg", !isSelected && !inRange && "text-text-primary hover:bg-bg-subtle", isToday && !isSelected && "decoration-accent font-semibold underline underline-offset-2"),
|
|
3004
|
+
"aria-label": dayLabel,
|
|
3005
|
+
"aria-current": isToday ? "date" : void 0,
|
|
3006
|
+
children: day.getDate()
|
|
3007
|
+
})
|
|
3008
|
+
}, dateKey);
|
|
3009
|
+
})
|
|
3010
|
+
}, `${monthLabel}-week-${weekIndex + 1}`))]
|
|
3011
|
+
})]
|
|
3012
|
+
})]
|
|
3013
|
+
}), (showGranularity || comparison) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3014
|
+
className: "border-border-subtle mt-3 flex flex-wrap items-center gap-3 border-t pt-3",
|
|
3015
|
+
children: [showGranularity && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3016
|
+
className: "flex items-center gap-1.5",
|
|
3017
|
+
role: "radiogroup",
|
|
3018
|
+
"aria-label": "Time granularity",
|
|
3019
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3020
|
+
className: cn("text-text-secondary", "text-xs font-medium"),
|
|
3021
|
+
children: "Granularity"
|
|
3022
|
+
}), GRANULARITY_OPTIONS.map((opt) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3023
|
+
ref: (node) => {
|
|
3024
|
+
granularityButtonRefs.current[opt.value] = node;
|
|
3025
|
+
},
|
|
3026
|
+
type: "button",
|
|
3027
|
+
role: "radio",
|
|
3028
|
+
"aria-checked": granularity === opt.value,
|
|
3029
|
+
onKeyDown: (event) => handleGranularityKeyDown(event, opt.value),
|
|
3030
|
+
onClick: () => onGranularityChange === null || onGranularityChange === void 0 ? void 0 : onGranularityChange(opt.value),
|
|
3031
|
+
className: cn("rounded-md px-2 py-1 text-xs", "outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-ring-offset", granularity === opt.value ? "bg-accent text-accent-fg font-medium" : cn("text-text-primary", "hover:bg-bg-subtle")),
|
|
3032
|
+
children: opt.label
|
|
3033
|
+
}, opt.value))]
|
|
3034
|
+
}), comparison && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3035
|
+
className: "flex items-center gap-1.5",
|
|
3036
|
+
role: "group",
|
|
3037
|
+
"aria-label": "Comparison mode",
|
|
3038
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3039
|
+
className: cn("text-text-secondary", "text-xs font-medium"),
|
|
3040
|
+
children: "Compare"
|
|
3041
|
+
}), COMPARISON_OPTIONS.map((opt) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3042
|
+
type: "button",
|
|
3043
|
+
"aria-pressed": comparisonMode === opt.value,
|
|
3044
|
+
onClick: () => onComparisonChange === null || onComparisonChange === void 0 ? void 0 : onComparisonChange(comparisonMode === opt.value ? null : opt.value),
|
|
3045
|
+
className: cn("rounded-md px-2 py-1 text-xs", "outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-ring-offset", comparisonMode === opt.value ? "bg-accent text-accent-fg font-medium" : cn("text-text-primary", "hover:bg-bg-subtle")),
|
|
3046
|
+
children: opt.label
|
|
3047
|
+
}, opt.value))]
|
|
3048
|
+
})]
|
|
3049
|
+
})]
|
|
3050
|
+
})] }),
|
|
3051
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldMessages, {
|
|
3052
|
+
id: pickerId,
|
|
3053
|
+
error,
|
|
3054
|
+
hint
|
|
3055
|
+
})
|
|
3056
|
+
]
|
|
3057
|
+
});
|
|
3058
|
+
}
|
|
3059
|
+
DateRangePicker.displayName = "DateRangePicker";
|
|
3060
|
+
//#endregion
|
|
3061
|
+
//#region src/core/form.tsx
|
|
3062
|
+
const _excluded$2 = ["className", "store"];
|
|
3063
|
+
const _excluded2 = ["className"];
|
|
3064
|
+
const _excluded3 = [
|
|
3065
|
+
"className",
|
|
3066
|
+
"resize",
|
|
3067
|
+
"rows",
|
|
3068
|
+
"name"
|
|
3069
|
+
];
|
|
3070
|
+
const _excluded4 = ["className"];
|
|
3071
|
+
const _excluded5 = ["className"];
|
|
3072
|
+
const _excluded6 = [
|
|
3073
|
+
"className",
|
|
3074
|
+
"size",
|
|
3075
|
+
"name"
|
|
3076
|
+
];
|
|
3077
|
+
const _excluded7 = ["className"];
|
|
3078
|
+
const _excluded8 = ["className"];
|
|
3079
|
+
const _excluded9 = [
|
|
3080
|
+
"className",
|
|
3081
|
+
"disabled",
|
|
3082
|
+
"children"
|
|
3083
|
+
];
|
|
3084
|
+
const _excluded10 = ["className"];
|
|
3085
|
+
const _excluded11 = ["className"];
|
|
3086
|
+
const _excluded12 = ["className"];
|
|
3087
|
+
const _excluded13 = ["className"];
|
|
3088
|
+
const _excluded14 = ["className"];
|
|
3089
|
+
const _excluded15 = ["className"];
|
|
3090
|
+
const _excluded16 = ["className"];
|
|
3091
|
+
const _excluded17 = ["className"];
|
|
3092
|
+
const _excluded18 = ["className"];
|
|
3093
|
+
const _excluded19 = ["className"];
|
|
3094
|
+
const _excluded20 = ["className"];
|
|
3095
|
+
const _excluded21 = ["name"];
|
|
3096
|
+
const _excluded22 = ["name"];
|
|
3097
|
+
const _excluded23 = ["name"];
|
|
3098
|
+
const _excluded24 = ["name"];
|
|
3099
|
+
const _excluded25 = ["name"];
|
|
3100
|
+
const _excluded26 = ["name"];
|
|
3101
|
+
const _excluded27 = ["name"];
|
|
3102
|
+
const inputClass = `${OPT_INPUT} aria-[invalid=true]:border-danger`;
|
|
3103
|
+
const labelClass = OPT_TEXT_LABEL;
|
|
3104
|
+
const descriptionClass = "text-xs text-text-tertiary";
|
|
3105
|
+
const errorClass = "text-xs text-danger-fg";
|
|
3106
|
+
const submitClass = OPT_BUTTON_PRIMARY;
|
|
3107
|
+
const checkboxClass = `h-4 w-4 rounded accent-accent ${OPT_FOCUS_VISIBLE}`;
|
|
3108
|
+
const radioClass = `h-4 w-4 accent-accent ${OPT_FOCUS_VISIBLE}`;
|
|
3109
|
+
function useRequiredFormContext(componentName) {
|
|
3110
|
+
const form = (0, _reopt_ai_opt_ui_primitives.useFormContext)();
|
|
3111
|
+
if (!form) throw new Error(`${componentName} must be used within FormRoot or FormProvider with a store.`);
|
|
3112
|
+
return form;
|
|
3113
|
+
}
|
|
3114
|
+
/** Renders the form root component. */
|
|
3115
|
+
function FormRoot(_ref) {
|
|
3116
|
+
let { className, store } = _ref, props = _objectWithoutProperties(_ref, _excluded$2);
|
|
3117
|
+
const form = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.FormRoot, _objectSpread2({ className: cn("gap-section flex flex-col", className) }, props));
|
|
3118
|
+
if (store) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.FormProvider, {
|
|
3119
|
+
store,
|
|
3120
|
+
"data-opt-id": "YBT1H",
|
|
3121
|
+
"data-opt-slug": "form.FormRoot",
|
|
3122
|
+
children: form
|
|
3123
|
+
});
|
|
3124
|
+
return form;
|
|
3125
|
+
}
|
|
3126
|
+
/** Renders the form input component. */
|
|
3127
|
+
function FormInput(_ref2) {
|
|
3128
|
+
let { className } = _ref2, props = _objectWithoutProperties(_ref2, _excluded2);
|
|
3129
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.FormInput, _objectSpread2(_objectSpread2({ className: cn(inputClass, className) }, props), {}, {
|
|
3130
|
+
"data-opt-id": "D7Z8F",
|
|
3131
|
+
"data-opt-slug": "form.FormInput"
|
|
3132
|
+
}));
|
|
3133
|
+
}
|
|
3134
|
+
const resizeStyles = {
|
|
3135
|
+
none: "resize-none",
|
|
3136
|
+
vertical: "resize-y",
|
|
3137
|
+
horizontal: "resize-x",
|
|
3138
|
+
both: "resize"
|
|
3139
|
+
};
|
|
3140
|
+
/** Renders the form textarea component. */
|
|
3141
|
+
function FormTextarea(_ref3) {
|
|
3142
|
+
var _ref4;
|
|
3143
|
+
let { className, resize = "vertical", rows = 4, name } = _ref3, props = _objectWithoutProperties(_ref3, _excluded3);
|
|
3144
|
+
const form = useRequiredFormContext("FormTextarea");
|
|
3145
|
+
const value = (_ref4 = (0, _reopt_ai_opt_ui_primitives.useFieldValue)(form, name)) !== null && _ref4 !== void 0 ? _ref4 : "";
|
|
3146
|
+
const error = form === null || form === void 0 ? void 0 : form.getError(name);
|
|
3147
|
+
const touched = form === null || form === void 0 ? void 0 : form.getFieldTouched(name);
|
|
3148
|
+
const hasError = Boolean(error && touched);
|
|
3149
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", _objectSpread2(_objectSpread2({
|
|
3150
|
+
name,
|
|
3151
|
+
value,
|
|
3152
|
+
onChange: (e) => form === null || form === void 0 ? void 0 : form.setValue(name, e.target.value),
|
|
3153
|
+
className: cn("border-border bg-surface flex w-full rounded-lg border px-4 py-3", "text-text-primary placeholder:text-text-tertiary focus-visible:ring-ring focus-visible:ring-offset-ring-offset text-sm outline-none focus-visible:ring-2 focus-visible:ring-offset-1", OPT_FOCUS_VISIBLE, resizeStyles[resize], hasError && "border-danger", className),
|
|
3154
|
+
rows,
|
|
3155
|
+
"aria-invalid": hasError || void 0
|
|
3156
|
+
}, props), {}, {
|
|
3157
|
+
"data-opt-id": "Q8G2A",
|
|
3158
|
+
"data-opt-slug": "form.FormTextarea"
|
|
3159
|
+
}));
|
|
3160
|
+
}
|
|
3161
|
+
/** Renders the form select component. */
|
|
3162
|
+
function FormSelect({ name, children, className, placeholder, minWidth = 140, "aria-label": ariaLabel }) {
|
|
3163
|
+
var _ref5;
|
|
3164
|
+
const form = useRequiredFormContext("FormSelect");
|
|
3165
|
+
const value = (_ref5 = (0, _reopt_ai_opt_ui_primitives.useFieldValue)(form, name)) !== null && _ref5 !== void 0 ? _ref5 : "";
|
|
3166
|
+
const error = form === null || form === void 0 ? void 0 : form.getError(name);
|
|
3167
|
+
const touched = form === null || form === void 0 ? void 0 : form.getFieldTouched(name);
|
|
3168
|
+
const hasError = Boolean(error && touched);
|
|
3169
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(SelectRoot, {
|
|
3170
|
+
value,
|
|
3171
|
+
onValueChange: (0, react.useCallback)((v) => {
|
|
3172
|
+
var _v$;
|
|
3173
|
+
return form.setValue(name, Array.isArray(v) ? (_v$ = v[0]) !== null && _v$ !== void 0 ? _v$ : "" : v);
|
|
3174
|
+
}, [form, name]),
|
|
3175
|
+
"data-opt-id": "A2XF7",
|
|
3176
|
+
"data-opt-slug": "form.FormSelect",
|
|
3177
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectTrigger, {
|
|
3178
|
+
"aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : name,
|
|
3179
|
+
"aria-invalid": hasError || void 0,
|
|
3180
|
+
className: cn("inline-flex cursor-pointer items-center justify-between data-[disabled]:cursor-not-allowed", hasError && "border-danger", className),
|
|
3181
|
+
style: { minWidth: typeof minWidth === "number" ? `${minWidth}px` : minWidth },
|
|
3182
|
+
children: value || placeholder || "Select…"
|
|
3183
|
+
}), children]
|
|
3184
|
+
});
|
|
3185
|
+
}
|
|
3186
|
+
/** Renders the form select popover component. */
|
|
3187
|
+
function FormSelectPopover(_ref6) {
|
|
3188
|
+
let { className } = _ref6, props = _objectWithoutProperties(_ref6, _excluded4);
|
|
3189
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectPopover, _objectSpread2(_objectSpread2({ className: cn(OPT_SURFACE_POPOVER, OPT_ANIMATE_ENTER_EXIT, "z-[120]", className) }, props), {}, {
|
|
3190
|
+
"data-opt-id": "CQSPJ",
|
|
3191
|
+
"data-opt-slug": "form.FormSelectPopover"
|
|
3192
|
+
}));
|
|
3193
|
+
}
|
|
3194
|
+
/** Renders the form select item component. */
|
|
3195
|
+
function FormSelectItem(_ref7) {
|
|
3196
|
+
let { className } = _ref7, props = _objectWithoutProperties(_ref7, _excluded5);
|
|
3197
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectItem, _objectSpread2(_objectSpread2({ className: cn("flex cursor-pointer items-center gap-2 data-[disabled]:cursor-not-allowed", OPT_ITEM_BASE, OPT_ACTIVE_ITEM, className) }, props), {}, {
|
|
3198
|
+
"data-opt-id": "J3970",
|
|
3199
|
+
"data-opt-slug": "form.FormSelectItem"
|
|
3200
|
+
}));
|
|
3201
|
+
}
|
|
3202
|
+
const switchSizeStyles = {
|
|
3203
|
+
sm: {
|
|
3204
|
+
track: "h-5 w-9",
|
|
3205
|
+
thumb: "h-4 w-4"
|
|
3206
|
+
},
|
|
3207
|
+
md: {
|
|
3208
|
+
track: "h-6 w-11",
|
|
3209
|
+
thumb: "h-5 w-5"
|
|
3210
|
+
},
|
|
3211
|
+
lg: {
|
|
3212
|
+
track: "h-7 w-14",
|
|
3213
|
+
thumb: "h-6 w-6"
|
|
3214
|
+
}
|
|
3215
|
+
};
|
|
3216
|
+
/** Renders the form switch component. */
|
|
3217
|
+
function FormSwitch(_ref8) {
|
|
3218
|
+
let { className, size = "md", name } = _ref8, props = _objectWithoutProperties(_ref8, _excluded6);
|
|
3219
|
+
const styles = switchSizeStyles[size];
|
|
3220
|
+
const form = useRequiredFormContext("FormSwitch");
|
|
3221
|
+
const checked = Boolean((0, _reopt_ai_opt_ui_primitives.useFieldValue)(form, name));
|
|
3222
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.FormSwitch, _objectSpread2(_objectSpread2({
|
|
3223
|
+
name,
|
|
3224
|
+
className: cn("group relative inline-flex shrink-0 cursor-pointer rounded-full p-0.5 transition-colors", styles.track, "bg-bg-muted", "aria-[checked=true]:bg-accent", "disabled:cursor-not-allowed disabled:opacity-50", OPT_FOCUS_VISIBLE, className),
|
|
3225
|
+
"aria-checked": checked
|
|
3226
|
+
}, props), {}, {
|
|
3227
|
+
"data-opt-id": "48T40",
|
|
3228
|
+
"data-opt-slug": "form.FormSwitch",
|
|
3229
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: cn("pointer-events-none inline-block transform rounded-full bg-white shadow-sm ring-0 transition-transform", styles.thumb, "translate-x-0", size === "sm" && "group-aria-[checked=true]:translate-x-4", size === "md" && "group-aria-[checked=true]:translate-x-5", size === "lg" && "group-aria-[checked=true]:translate-x-7") })
|
|
3230
|
+
}));
|
|
3231
|
+
}
|
|
3232
|
+
/** Renders the form label component. */
|
|
3233
|
+
function FormLabel(_ref9) {
|
|
3234
|
+
let { className } = _ref9, props = _objectWithoutProperties(_ref9, _excluded7);
|
|
3235
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.FormLabel, _objectSpread2(_objectSpread2({ className: cn(labelClass, className) }, props), {}, {
|
|
3236
|
+
"data-opt-id": "JHRKM",
|
|
3237
|
+
"data-opt-slug": "form.FormLabel"
|
|
3238
|
+
}));
|
|
3239
|
+
}
|
|
3240
|
+
/** Renders the form error component. */
|
|
3241
|
+
function FormError(_ref10) {
|
|
3242
|
+
let { className } = _ref10, props = _objectWithoutProperties(_ref10, _excluded8);
|
|
3243
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.FormError, _objectSpread2(_objectSpread2({ className: cn(errorClass, className) }, props), {}, {
|
|
3244
|
+
"data-opt-id": "E9NM4",
|
|
3245
|
+
"data-opt-slug": "form.FormError"
|
|
3246
|
+
}));
|
|
3247
|
+
}
|
|
3248
|
+
/** Renders the form submit component. */
|
|
3249
|
+
function FormSubmit(_ref11) {
|
|
3250
|
+
var _form$isSubmitting;
|
|
3251
|
+
let { className, disabled, children } = _ref11, props = _objectWithoutProperties(_ref11, _excluded9);
|
|
3252
|
+
const form = (0, _reopt_ai_opt_ui_primitives.useFormContext)();
|
|
3253
|
+
const isSubmitting = (_form$isSubmitting = form === null || form === void 0 ? void 0 : form.isSubmitting()) !== null && _form$isSubmitting !== void 0 ? _form$isSubmitting : false;
|
|
3254
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.FormSubmit, _objectSpread2(_objectSpread2({
|
|
3255
|
+
className: cn(submitClass, className),
|
|
3256
|
+
disabled: disabled !== null && disabled !== void 0 ? disabled : isSubmitting
|
|
3257
|
+
}, props), {}, {
|
|
3258
|
+
"data-opt-id": "K580M",
|
|
3259
|
+
"data-opt-slug": "form.FormSubmit",
|
|
3260
|
+
children
|
|
3261
|
+
}));
|
|
3262
|
+
}
|
|
3263
|
+
/** Renders the form provider component. */
|
|
3264
|
+
function FormProvider(props) {
|
|
3265
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.FormProvider, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
3266
|
+
"data-opt-id": "G0DQ4",
|
|
3267
|
+
"data-opt-slug": "form.FormProvider"
|
|
3268
|
+
}));
|
|
3269
|
+
}
|
|
3270
|
+
/** Renders the form group component. */
|
|
3271
|
+
function FormGroup(_ref12) {
|
|
3272
|
+
let { className } = _ref12, props = _objectWithoutProperties(_ref12, _excluded10);
|
|
3273
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.FormGroup, _objectSpread2(_objectSpread2({ className: cn("gap-group flex flex-col", className) }, props), {}, {
|
|
3274
|
+
"data-opt-id": "89E8Q",
|
|
3275
|
+
"data-opt-slug": "form.FormGroup"
|
|
3276
|
+
}));
|
|
3277
|
+
}
|
|
3278
|
+
/** Renders the form group label component. */
|
|
3279
|
+
function FormGroupLabel(_ref13) {
|
|
3280
|
+
let { className } = _ref13, props = _objectWithoutProperties(_ref13, _excluded11);
|
|
3281
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.FormGroupLabel, _objectSpread2(_objectSpread2({ className: cn(labelClass, "font-semibold", className) }, props), {}, {
|
|
3282
|
+
"data-opt-id": "W95BH",
|
|
3283
|
+
"data-opt-slug": "form.FormGroupLabel"
|
|
3284
|
+
}));
|
|
3285
|
+
}
|
|
3286
|
+
/** Renders the form description component. */
|
|
3287
|
+
function FormDescription(_ref14) {
|
|
3288
|
+
let { className } = _ref14, props = _objectWithoutProperties(_ref14, _excluded12);
|
|
3289
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.FormDescription, _objectSpread2(_objectSpread2({ className: cn(descriptionClass, className) }, props), {}, {
|
|
3290
|
+
"data-opt-id": "RFB40",
|
|
3291
|
+
"data-opt-slug": "form.FormDescription"
|
|
3292
|
+
}));
|
|
3293
|
+
}
|
|
3294
|
+
/** Renders the form field component. */
|
|
3295
|
+
function FormField(_ref15) {
|
|
3296
|
+
let { className } = _ref15, props = _objectWithoutProperties(_ref15, _excluded13);
|
|
3297
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.FormField, _objectSpread2(_objectSpread2({ className: cn("gap-element flex flex-col", className) }, props), {}, {
|
|
3298
|
+
"data-opt-id": "C68GP",
|
|
3299
|
+
"data-opt-slug": "form.FormField"
|
|
3300
|
+
}));
|
|
3301
|
+
}
|
|
3302
|
+
/** Renders the form control component. */
|
|
3303
|
+
function FormControl(_ref16) {
|
|
3304
|
+
let { className } = _ref16, props = _objectWithoutProperties(_ref16, _excluded14);
|
|
3305
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.FormControl, _objectSpread2(_objectSpread2({ className: cn(inputClass, className) }, props), {}, {
|
|
3306
|
+
"data-opt-id": "XNF0F",
|
|
3307
|
+
"data-opt-slug": "form.FormControl"
|
|
3308
|
+
}));
|
|
3309
|
+
}
|
|
3310
|
+
/** Renders the form push component. */
|
|
3311
|
+
function FormPush(_ref17) {
|
|
3312
|
+
let { className } = _ref17, props = _objectWithoutProperties(_ref17, _excluded15);
|
|
3313
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.FormPush, _objectSpread2(_objectSpread2({ className: cn(OPT_BUTTON_SECONDARY, className) }, props), {}, {
|
|
3314
|
+
"data-opt-id": "5SV8S",
|
|
3315
|
+
"data-opt-slug": "form.FormPush"
|
|
3316
|
+
}));
|
|
3317
|
+
}
|
|
3318
|
+
/** Renders the form remove component. */
|
|
3319
|
+
function FormRemove(_ref18) {
|
|
3320
|
+
let { className } = _ref18, props = _objectWithoutProperties(_ref18, _excluded16);
|
|
3321
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.FormRemove, _objectSpread2(_objectSpread2({ className: cn("text-danger-fg hover:text-danger focus-visible:ring-ring focus-visible:ring-offset-ring-offset inline-flex items-center text-sm outline-none focus-visible:ring-2 focus-visible:ring-offset-1", OPT_FOCUS_VISIBLE, className) }, props), {}, {
|
|
3322
|
+
"data-opt-id": "FEW6V",
|
|
3323
|
+
"data-opt-slug": "form.FormRemove"
|
|
3324
|
+
}));
|
|
3325
|
+
}
|
|
3326
|
+
/** Renders the form reset component. */
|
|
3327
|
+
function FormReset(_ref19) {
|
|
3328
|
+
let { className } = _ref19, props = _objectWithoutProperties(_ref19, _excluded17);
|
|
3329
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.FormReset, _objectSpread2(_objectSpread2({ className: cn(OPT_BUTTON_SECONDARY, className) }, props), {}, {
|
|
3330
|
+
"data-opt-id": "M3FVB",
|
|
3331
|
+
"data-opt-slug": "form.FormReset"
|
|
3332
|
+
}));
|
|
3333
|
+
}
|
|
3334
|
+
/** Renders the form checkbox component. */
|
|
3335
|
+
function FormCheckbox(_ref20) {
|
|
3336
|
+
let { className } = _ref20, props = _objectWithoutProperties(_ref20, _excluded18);
|
|
3337
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.FormCheckbox, _objectSpread2(_objectSpread2({ className: cn(checkboxClass, className) }, props), {}, {
|
|
3338
|
+
"data-opt-id": "3BZS1",
|
|
3339
|
+
"data-opt-slug": "form.FormCheckbox"
|
|
3340
|
+
}));
|
|
3341
|
+
}
|
|
3342
|
+
/** Renders the form radio group component. */
|
|
3343
|
+
function FormRadioGroup(_ref21) {
|
|
3344
|
+
let { className } = _ref21, props = _objectWithoutProperties(_ref21, _excluded19);
|
|
3345
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.FormRadioGroup, _objectSpread2(_objectSpread2({ className: cn("gap-group flex flex-col", className) }, props), {}, {
|
|
3346
|
+
"data-opt-id": "J8XRP",
|
|
3347
|
+
"data-opt-slug": "form.FormRadioGroup"
|
|
3348
|
+
}));
|
|
3349
|
+
}
|
|
3350
|
+
/** Renders the form radio component. */
|
|
3351
|
+
function FormRadio(_ref22) {
|
|
3352
|
+
let { className } = _ref22, props = _objectWithoutProperties(_ref22, _excluded20);
|
|
3353
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_reopt_ai_opt_ui_primitives.FormRadio, _objectSpread2(_objectSpread2({ className: cn(radioClass, className) }, props), {}, {
|
|
3354
|
+
"data-opt-id": "YTN4Q",
|
|
3355
|
+
"data-opt-slug": "form.FormRadio"
|
|
3356
|
+
}));
|
|
3357
|
+
}
|
|
3358
|
+
/** Renders the form number input component. */
|
|
3359
|
+
function FormNumberInput(_ref23) {
|
|
3360
|
+
var _ref24;
|
|
3361
|
+
let { name } = _ref23, props = _objectWithoutProperties(_ref23, _excluded21);
|
|
3362
|
+
const form = useRequiredFormContext("FormNumberInput");
|
|
3363
|
+
const value = (_ref24 = (0, _reopt_ai_opt_ui_primitives.useFieldValue)(form, name)) !== null && _ref24 !== void 0 ? _ref24 : 0;
|
|
3364
|
+
const error = form === null || form === void 0 ? void 0 : form.getError(name);
|
|
3365
|
+
const touched = form === null || form === void 0 ? void 0 : form.getFieldTouched(name);
|
|
3366
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NumberInput, _objectSpread2(_objectSpread2({
|
|
3367
|
+
value,
|
|
3368
|
+
onChange: (v) => form.setValue(name, v),
|
|
3369
|
+
error: error && touched ? error : void 0
|
|
3370
|
+
}, props), {}, {
|
|
3371
|
+
"data-opt-id": "FJ2A2",
|
|
3372
|
+
"data-opt-slug": "form.FormNumberInput"
|
|
3373
|
+
}));
|
|
3374
|
+
}
|
|
3375
|
+
/** Renders the form slider component. */
|
|
3376
|
+
function FormSlider(_ref25) {
|
|
3377
|
+
var _ref26;
|
|
3378
|
+
let { name } = _ref25, props = _objectWithoutProperties(_ref25, _excluded22);
|
|
3379
|
+
const form = useRequiredFormContext("FormSlider");
|
|
3380
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Slider, _objectSpread2(_objectSpread2({
|
|
3381
|
+
value: (_ref26 = (0, _reopt_ai_opt_ui_primitives.useFieldValue)(form, name)) !== null && _ref26 !== void 0 ? _ref26 : 0,
|
|
3382
|
+
onChange: (v) => form.setValue(name, v)
|
|
3383
|
+
}, props), {}, {
|
|
3384
|
+
"data-opt-id": "3XQ3A",
|
|
3385
|
+
"data-opt-slug": "form.FormSlider"
|
|
3386
|
+
}));
|
|
3387
|
+
}
|
|
3388
|
+
/** Renders the form star rating component. */
|
|
3389
|
+
function FormStarRating(_ref27) {
|
|
3390
|
+
var _ref28;
|
|
3391
|
+
let { name } = _ref27, props = _objectWithoutProperties(_ref27, _excluded23);
|
|
3392
|
+
const form = useRequiredFormContext("FormStarRating");
|
|
3393
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StarRating, _objectSpread2(_objectSpread2({
|
|
3394
|
+
value: (_ref28 = (0, _reopt_ai_opt_ui_primitives.useFieldValue)(form, name)) !== null && _ref28 !== void 0 ? _ref28 : 0,
|
|
3395
|
+
onChange: (v) => form.setValue(name, v)
|
|
3396
|
+
}, props), {}, {
|
|
3397
|
+
"data-opt-id": "EKNJJ",
|
|
3398
|
+
"data-opt-slug": "form.FormStarRating"
|
|
3399
|
+
}));
|
|
3400
|
+
}
|
|
3401
|
+
/** Renders the form color picker component. */
|
|
3402
|
+
function FormColorPicker(_ref29) {
|
|
3403
|
+
var _ref30;
|
|
3404
|
+
let { name } = _ref29, props = _objectWithoutProperties(_ref29, _excluded24);
|
|
3405
|
+
const form = useRequiredFormContext("FormColorPicker");
|
|
3406
|
+
const value = (_ref30 = (0, _reopt_ai_opt_ui_primitives.useFieldValue)(form, name)) !== null && _ref30 !== void 0 ? _ref30 : "#000000";
|
|
3407
|
+
const error = form === null || form === void 0 ? void 0 : form.getError(name);
|
|
3408
|
+
const touched = form === null || form === void 0 ? void 0 : form.getFieldTouched(name);
|
|
3409
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ColorPicker, _objectSpread2(_objectSpread2({
|
|
3410
|
+
value,
|
|
3411
|
+
onChange: (v) => form.setValue(name, v),
|
|
3412
|
+
error: error && touched ? error : void 0
|
|
3413
|
+
}, props), {}, {
|
|
3414
|
+
"data-opt-id": "4ATTC",
|
|
3415
|
+
"data-opt-slug": "form.FormColorPicker"
|
|
3416
|
+
}));
|
|
3417
|
+
}
|
|
3418
|
+
/** Renders the form icon picker component. */
|
|
3419
|
+
function FormIconPicker(_ref31) {
|
|
3420
|
+
var _ref32;
|
|
3421
|
+
let { name } = _ref31, props = _objectWithoutProperties(_ref31, _excluded25);
|
|
3422
|
+
const form = useRequiredFormContext("FormIconPicker");
|
|
3423
|
+
const value = (_ref32 = (0, _reopt_ai_opt_ui_primitives.useFieldValue)(form, name)) !== null && _ref32 !== void 0 ? _ref32 : "";
|
|
3424
|
+
const error = form === null || form === void 0 ? void 0 : form.getError(name);
|
|
3425
|
+
const touched = form === null || form === void 0 ? void 0 : form.getFieldTouched(name);
|
|
3426
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconPicker, _objectSpread2(_objectSpread2({
|
|
3427
|
+
value,
|
|
3428
|
+
onChange: (v) => form.setValue(name, v),
|
|
3429
|
+
error: error && touched ? error : void 0
|
|
3430
|
+
}, props), {}, {
|
|
3431
|
+
"data-opt-id": "7Q41M",
|
|
3432
|
+
"data-opt-slug": "form.FormIconPicker"
|
|
3433
|
+
}));
|
|
3434
|
+
}
|
|
3435
|
+
/** Renders the form tag input component. */
|
|
3436
|
+
function FormTagInput(_ref33) {
|
|
3437
|
+
var _ref34;
|
|
3438
|
+
let { name } = _ref33, props = _objectWithoutProperties(_ref33, _excluded26);
|
|
3439
|
+
const form = useRequiredFormContext("FormTagInput");
|
|
3440
|
+
const value = (_ref34 = (0, _reopt_ai_opt_ui_primitives.useFieldValue)(form, name)) !== null && _ref34 !== void 0 ? _ref34 : [];
|
|
3441
|
+
const error = form === null || form === void 0 ? void 0 : form.getError(name);
|
|
3442
|
+
const touched = form === null || form === void 0 ? void 0 : form.getFieldTouched(name);
|
|
3443
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TagInput, _objectSpread2(_objectSpread2({
|
|
3444
|
+
value,
|
|
3445
|
+
onChange: (v) => form.setValue(name, v),
|
|
3446
|
+
error: error && touched ? error : void 0
|
|
3447
|
+
}, props), {}, {
|
|
3448
|
+
"data-opt-id": "W05M1",
|
|
3449
|
+
"data-opt-slug": "form.FormTagInput"
|
|
3450
|
+
}));
|
|
3451
|
+
}
|
|
3452
|
+
/** Renders the form date range picker component. */
|
|
3453
|
+
function FormDateRangePicker(_ref35) {
|
|
3454
|
+
var _ref36;
|
|
3455
|
+
let { name } = _ref35, props = _objectWithoutProperties(_ref35, _excluded27);
|
|
3456
|
+
const form = useRequiredFormContext("FormDateRangePicker");
|
|
3457
|
+
const value = (_ref36 = (0, _reopt_ai_opt_ui_primitives.useFieldValue)(form, name)) !== null && _ref36 !== void 0 ? _ref36 : {
|
|
3458
|
+
start: null,
|
|
3459
|
+
end: null
|
|
3460
|
+
};
|
|
3461
|
+
const error = form === null || form === void 0 ? void 0 : form.getError(name);
|
|
3462
|
+
const touched = form === null || form === void 0 ? void 0 : form.getFieldTouched(name);
|
|
3463
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DateRangePicker, _objectSpread2(_objectSpread2({
|
|
3464
|
+
value,
|
|
3465
|
+
onChange: (v) => form.setValue(name, v),
|
|
3466
|
+
error: error && touched ? error : void 0
|
|
3467
|
+
}, props), {}, {
|
|
3468
|
+
"data-opt-id": "4NE9A",
|
|
3469
|
+
"data-opt-slug": "form.FormDateRangePicker"
|
|
3470
|
+
}));
|
|
3471
|
+
}
|
|
3472
|
+
//#endregion
|
|
3473
|
+
//#region src/core/checkbox.tsx
|
|
3474
|
+
const _excluded$1 = [
|
|
3475
|
+
"label",
|
|
3476
|
+
"required",
|
|
3477
|
+
"error",
|
|
3478
|
+
"hint",
|
|
3479
|
+
"description",
|
|
3480
|
+
"checked",
|
|
3481
|
+
"defaultChecked",
|
|
3482
|
+
"onChange",
|
|
3483
|
+
"size",
|
|
3484
|
+
"disabled",
|
|
3485
|
+
"className",
|
|
3486
|
+
"id",
|
|
3487
|
+
"value",
|
|
3488
|
+
"indeterminate"
|
|
3489
|
+
];
|
|
3490
|
+
const CheckboxGroupContext = (0, react.createContext)(null);
|
|
3491
|
+
function setForwardedRef(ref, value) {
|
|
3492
|
+
if (typeof ref === "function") ref(value);
|
|
3493
|
+
else if (ref) ref.current = value;
|
|
3494
|
+
}
|
|
3495
|
+
const sizeStyles = {
|
|
3496
|
+
sm: {
|
|
3497
|
+
box: "h-4 w-4",
|
|
3498
|
+
icon: "h-3 w-3",
|
|
3499
|
+
text: "text-sm"
|
|
3500
|
+
},
|
|
3501
|
+
md: {
|
|
3502
|
+
box: "h-5 w-5",
|
|
3503
|
+
icon: "h-3.5 w-3.5",
|
|
3504
|
+
text: "text-sm"
|
|
3505
|
+
},
|
|
3506
|
+
lg: {
|
|
3507
|
+
box: "h-6 w-6",
|
|
3508
|
+
icon: "h-4 w-4",
|
|
3509
|
+
text: "text-base"
|
|
3510
|
+
}
|
|
3511
|
+
};
|
|
3512
|
+
function CheckIcon({ className }) {
|
|
3513
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
3514
|
+
"aria-hidden": "true",
|
|
3515
|
+
className,
|
|
3516
|
+
viewBox: "0 0 16 16",
|
|
3517
|
+
fill: "none",
|
|
3518
|
+
stroke: "currentColor",
|
|
3519
|
+
strokeWidth: 2.5,
|
|
3520
|
+
strokeLinecap: "round",
|
|
3521
|
+
strokeLinejoin: "round",
|
|
3522
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3.5 8.5L6.5 11.5L12.5 4.5" })
|
|
3523
|
+
});
|
|
3524
|
+
}
|
|
3525
|
+
function IndeterminateIcon({ className }) {
|
|
3526
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
3527
|
+
"aria-hidden": "true",
|
|
3528
|
+
className,
|
|
3529
|
+
viewBox: "0 0 16 16",
|
|
3530
|
+
fill: "none",
|
|
3531
|
+
stroke: "currentColor",
|
|
3532
|
+
strokeWidth: 2.5,
|
|
3533
|
+
strokeLinecap: "round",
|
|
3534
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M4 8H12" })
|
|
3535
|
+
});
|
|
3536
|
+
}
|
|
3537
|
+
const Checkbox = (0, react.forwardRef)((_ref, ref) => {
|
|
3538
|
+
var _groupContext$size, _groupContext$disable, _useInputId;
|
|
3539
|
+
let { label, required, error, hint, description, checked: checkedProp, defaultChecked, onChange, size: sizeProp = "md", disabled: disabledProp, className, id, value, indeterminate } = _ref, props = _objectWithoutProperties(_ref, _excluded$1);
|
|
3540
|
+
const groupContext = (0, react.useContext)(CheckboxGroupContext);
|
|
3541
|
+
const size = (_groupContext$size = groupContext === null || groupContext === void 0 ? void 0 : groupContext.size) !== null && _groupContext$size !== void 0 ? _groupContext$size : sizeProp;
|
|
3542
|
+
const disabled = (_groupContext$disable = groupContext === null || groupContext === void 0 ? void 0 : groupContext.disabled) !== null && _groupContext$disable !== void 0 ? _groupContext$disable : disabledProp;
|
|
3543
|
+
const isInGroup = groupContext !== null && value !== void 0;
|
|
3544
|
+
const [internalChecked, setInternalChecked] = (0, react.useState)(defaultChecked !== null && defaultChecked !== void 0 ? defaultChecked : false);
|
|
3545
|
+
const checked = isInGroup ? groupContext.value.includes(value) : checkedProp !== null && checkedProp !== void 0 ? checkedProp : internalChecked;
|
|
3546
|
+
const handleChange = (event) => {
|
|
3547
|
+
const newChecked = event.target.checked;
|
|
3548
|
+
if (isInGroup && value) {
|
|
3549
|
+
const newValue = newChecked ? [...groupContext.value, value] : groupContext.value.filter((v) => v !== value);
|
|
3550
|
+
groupContext.onChange(newValue);
|
|
3551
|
+
} else if (checkedProp !== void 0) onChange === null || onChange === void 0 || onChange(newChecked);
|
|
3552
|
+
else {
|
|
3553
|
+
setInternalChecked(newChecked);
|
|
3554
|
+
onChange === null || onChange === void 0 || onChange(newChecked);
|
|
3555
|
+
}
|
|
3556
|
+
};
|
|
3557
|
+
const fallbackId = (0, react.useId)().replace(/:/g, "");
|
|
3558
|
+
const checkboxId = (_useInputId = useInputId(id, label, "checkbox")) !== null && _useInputId !== void 0 ? _useInputId : `checkbox-${fallbackId}`;
|
|
3559
|
+
const hintText = hint !== null && hint !== void 0 ? hint : description;
|
|
3560
|
+
const hasError = Boolean(error);
|
|
3561
|
+
const styles = sizeStyles[size];
|
|
3562
|
+
const isIndeterminate = Boolean(indeterminate);
|
|
3563
|
+
const inputRef = (0, react.useCallback)((node) => {
|
|
3564
|
+
if (node) node.indeterminate = isIndeterminate;
|
|
3565
|
+
setForwardedRef(ref, node);
|
|
3566
|
+
}, [isIndeterminate, ref]);
|
|
3567
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3568
|
+
className: cn("flex flex-col gap-1.5", className),
|
|
3569
|
+
"data-opt-id": "3P3MA",
|
|
3570
|
+
"data-opt-slug": "checkbox.Checkbox",
|
|
3571
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3572
|
+
className: "flex items-start gap-3",
|
|
3573
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
3574
|
+
className: cn("relative inline-flex shrink-0 cursor-pointer items-center justify-center", disabled && "cursor-not-allowed"),
|
|
3575
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", _objectSpread2({
|
|
3576
|
+
ref: inputRef,
|
|
3577
|
+
type: "checkbox",
|
|
3578
|
+
id: checkboxId,
|
|
3579
|
+
checked,
|
|
3580
|
+
onChange: handleChange,
|
|
3581
|
+
disabled,
|
|
3582
|
+
"aria-invalid": hasError,
|
|
3583
|
+
"aria-required": required,
|
|
3584
|
+
"aria-describedby": getDescribedBy(checkboxId, error, hintText),
|
|
3585
|
+
className: "peer sr-only"
|
|
3586
|
+
}, props)), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3587
|
+
className: cn("inline-flex items-center justify-center rounded", styles.box, "border-border border-2", "bg-surface", "peer-checked:border-accent peer-checked:bg-accent", isIndeterminate && "border-accent bg-accent", "peer-disabled:cursor-not-allowed peer-disabled:opacity-50", "peer-focus-visible:ring-ring peer-focus-visible:ring-2 peer-focus-visible:ring-offset-1", "transition-colors"),
|
|
3588
|
+
children: isIndeterminate ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IndeterminateIcon, { className: cn(styles.icon, "text-accent-fg opacity-0 transition-opacity", "opacity-100") }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CheckIcon, { className: cn(styles.icon, "text-accent-fg opacity-0 transition-opacity", checked && "opacity-100") })
|
|
3589
|
+
})]
|
|
3590
|
+
}), (label || hintText) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3591
|
+
className: "flex flex-col",
|
|
3592
|
+
children: [label && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
3593
|
+
htmlFor: checkboxId,
|
|
3594
|
+
className: cn("text-text-primary cursor-pointer font-medium", styles.text, disabled && "cursor-not-allowed opacity-50"),
|
|
3595
|
+
children: [label, required && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RequiredMark, {})]
|
|
3596
|
+
}), hintText && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
3597
|
+
id: `${checkboxId}-hint`,
|
|
3598
|
+
className: cn("text-text-tertiary text-sm", disabled && "opacity-50"),
|
|
3599
|
+
children: hintText
|
|
3600
|
+
})]
|
|
3601
|
+
})]
|
|
3602
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldMessages, {
|
|
3603
|
+
id: checkboxId,
|
|
3604
|
+
error
|
|
3605
|
+
})]
|
|
3606
|
+
});
|
|
3607
|
+
});
|
|
3608
|
+
Checkbox.displayName = "Checkbox";
|
|
3609
|
+
const EMPTY_STRING_ARRAY = [];
|
|
3610
|
+
/** Renders the checkbox group component. */
|
|
3611
|
+
function CheckboxGroup({ children, value: valueProp, defaultValue = EMPTY_STRING_ARRAY, onChange, disabled, size = "md", error, required, className, orientation = "vertical", label }) {
|
|
3612
|
+
const [value, setValue] = useControlledState(defaultValue, valueProp, onChange);
|
|
3613
|
+
const hasError = Boolean(error);
|
|
3614
|
+
const groupId = label ? `checkbox-group-${label.replace(/\s+/g, "-").toLowerCase()}` : void 0;
|
|
3615
|
+
const ctxValue = (0, react.useMemo)(() => ({
|
|
3616
|
+
value,
|
|
3617
|
+
onChange: setValue,
|
|
3618
|
+
disabled,
|
|
3619
|
+
size
|
|
3620
|
+
}), [
|
|
3621
|
+
value,
|
|
3622
|
+
setValue,
|
|
3623
|
+
disabled,
|
|
3624
|
+
size
|
|
3625
|
+
]);
|
|
3626
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CheckboxGroupContext.Provider, {
|
|
3627
|
+
value: ctxValue,
|
|
3628
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3629
|
+
className: cn("flex flex-col gap-1.5", className),
|
|
3630
|
+
"data-opt-id": "V6NSW",
|
|
3631
|
+
"data-opt-slug": "checkbox.CheckboxGroup",
|
|
3632
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3633
|
+
role: "group",
|
|
3634
|
+
"aria-label": label,
|
|
3635
|
+
"aria-required": required,
|
|
3636
|
+
"aria-invalid": hasError,
|
|
3637
|
+
"aria-describedby": hasError && groupId ? `${groupId}-error` : void 0,
|
|
3638
|
+
className: cn("flex", orientation === "vertical" ? "flex-col gap-3" : "flex-row gap-6"),
|
|
3639
|
+
children: [label && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3640
|
+
className: "text-text-secondary mb-1 text-sm font-medium",
|
|
3641
|
+
children: [label, required && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RequiredMark, {})]
|
|
3642
|
+
}), children]
|
|
3643
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FieldMessages, {
|
|
3644
|
+
id: groupId,
|
|
3645
|
+
error
|
|
3646
|
+
})]
|
|
3647
|
+
})
|
|
3648
|
+
});
|
|
3649
|
+
}
|
|
3650
|
+
//#endregion
|
|
3651
|
+
//#region src/core/pagination.tsx
|
|
3652
|
+
const _excluded = [
|
|
3653
|
+
"totalItems",
|
|
3654
|
+
"totalPages",
|
|
3655
|
+
"hasMore",
|
|
3656
|
+
"pageSize",
|
|
3657
|
+
"currentPage",
|
|
3658
|
+
"onPageChange",
|
|
3659
|
+
"showPageNumbers",
|
|
3660
|
+
"siblingCount",
|
|
3661
|
+
"variant",
|
|
3662
|
+
"isDisabled",
|
|
3663
|
+
"label",
|
|
3664
|
+
"labels",
|
|
3665
|
+
"className"
|
|
3666
|
+
];
|
|
3667
|
+
const DEFAULT_LABELS = {
|
|
3668
|
+
previous: "Previous page",
|
|
3669
|
+
next: "Next page",
|
|
3670
|
+
page: (page) => `Go to page ${page}`,
|
|
3671
|
+
currentPage: (page) => `Page ${page}, current page`,
|
|
3672
|
+
compact: (page, totalPages) => totalPages === void 0 ? `Page ${page}` : `Page ${page} of ${totalPages}`,
|
|
3673
|
+
count: (start, end, totalItems) => `${start}-${end} of ${totalItems}`
|
|
3674
|
+
};
|
|
3675
|
+
function buildPageRange(current, total, siblings) {
|
|
3676
|
+
if (total <= 1) return [1];
|
|
3677
|
+
const range = [];
|
|
3678
|
+
const left = Math.max(2, current - siblings);
|
|
3679
|
+
const right = Math.min(total - 1, current + siblings);
|
|
3680
|
+
range.push(1);
|
|
3681
|
+
if (left > 2) range.push("ellipsis");
|
|
3682
|
+
for (let i = left; i <= right; i++) range.push(i);
|
|
3683
|
+
if (right < total - 1) range.push("ellipsis");
|
|
3684
|
+
if (total > 1) range.push(total);
|
|
3685
|
+
return range;
|
|
3686
|
+
}
|
|
3687
|
+
function positiveInteger(value) {
|
|
3688
|
+
if (!Number.isFinite(value) || value === void 0 || value <= 0) return;
|
|
3689
|
+
return Math.max(1, Math.floor(value));
|
|
3690
|
+
}
|
|
3691
|
+
function resolveTotalPages({ totalItems, totalPages, pageSize, currentPage, hasMore }) {
|
|
3692
|
+
const explicitTotalPages = positiveInteger(totalPages);
|
|
3693
|
+
if (explicitTotalPages !== void 0) return explicitTotalPages;
|
|
3694
|
+
const safePageSize = positiveInteger(pageSize);
|
|
3695
|
+
if (safePageSize !== void 0 && Number.isFinite(totalItems) && totalItems !== void 0) return Math.max(1, Math.ceil(Math.max(0, totalItems) / safePageSize));
|
|
3696
|
+
if (hasMore) return Math.max(1, Math.floor(currentPage) + 1);
|
|
3697
|
+
return Math.max(1, Math.floor(currentPage));
|
|
3698
|
+
}
|
|
3699
|
+
function clampPage(page, totalPages) {
|
|
3700
|
+
if (!Number.isFinite(page)) return 1;
|
|
3701
|
+
return Math.min(Math.max(1, Math.floor(page)), totalPages);
|
|
3702
|
+
}
|
|
3703
|
+
const btnBase = `inline-flex h-8 min-w-8 items-center justify-center rounded-md px-2 text-sm transition-colors ${OPT_FOCUS_VISIBLE}`;
|
|
3704
|
+
const btnEnabled = "text-text-primary hover:bg-bg-subtle active:bg-bg-muted cursor-pointer";
|
|
3705
|
+
const btnDisabled = "text-text-tertiary cursor-not-allowed opacity-50";
|
|
3706
|
+
const btnActive = "bg-accent text-accent-fg hover:bg-accent-hover cursor-default";
|
|
3707
|
+
/** Renders the pagination component. */
|
|
3708
|
+
function Pagination(_ref) {
|
|
3709
|
+
let { totalItems, totalPages: totalPagesProp, hasMore, pageSize, currentPage, onPageChange, showPageNumbers = true, siblingCount = 1, variant, isDisabled = false, label = "Pagination", labels, className } = _ref, props = _objectWithoutProperties(_ref, _excluded);
|
|
3710
|
+
const resolvedLabels = _objectSpread2(_objectSpread2({}, DEFAULT_LABELS), labels);
|
|
3711
|
+
const totalPages = resolveTotalPages({
|
|
3712
|
+
totalItems,
|
|
3713
|
+
totalPages: totalPagesProp,
|
|
3714
|
+
pageSize,
|
|
3715
|
+
currentPage,
|
|
3716
|
+
hasMore
|
|
3717
|
+
});
|
|
3718
|
+
const safeCurrentPage = clampPage(currentPage, totalPages);
|
|
3719
|
+
const resolvedVariant = variant !== null && variant !== void 0 ? variant : showPageNumbers ? "pages" : "none";
|
|
3720
|
+
const itemRange = Number.isFinite(totalItems) && totalItems !== void 0 && positiveInteger(pageSize) !== void 0 ? {
|
|
3721
|
+
start: totalItems === 0 ? 0 : (safeCurrentPage - 1) * pageSize + 1,
|
|
3722
|
+
end: Math.min(safeCurrentPage * pageSize, totalItems)
|
|
3723
|
+
} : null;
|
|
3724
|
+
const pages = (0, react.useMemo)(() => buildPageRange(safeCurrentPage, totalPages, siblingCount), [
|
|
3725
|
+
safeCurrentPage,
|
|
3726
|
+
totalPages,
|
|
3727
|
+
siblingCount
|
|
3728
|
+
]);
|
|
3729
|
+
const hasPrev = safeCurrentPage > 1;
|
|
3730
|
+
const hasNext = hasMore === true || safeCurrentPage < totalPages;
|
|
3731
|
+
const prevDisabled = isDisabled || !hasPrev;
|
|
3732
|
+
const nextDisabled = isDisabled || !hasNext;
|
|
3733
|
+
const handlePageChange = (page) => {
|
|
3734
|
+
if (isDisabled) return;
|
|
3735
|
+
const next = hasMore ? Math.max(1, Math.floor(page)) : clampPage(page, totalPages);
|
|
3736
|
+
if (next !== safeCurrentPage) onPageChange(next);
|
|
3737
|
+
};
|
|
3738
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("nav", _objectSpread2(_objectSpread2({
|
|
3739
|
+
"aria-label": label,
|
|
3740
|
+
className: cn("gap-element flex items-center", className)
|
|
3741
|
+
}, props), {}, {
|
|
3742
|
+
"data-opt-id": "QBEE2",
|
|
3743
|
+
"data-opt-slug": "pagination.Pagination",
|
|
3744
|
+
children: [
|
|
3745
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3746
|
+
type: "button",
|
|
3747
|
+
className: cn(btnBase, prevDisabled ? btnDisabled : btnEnabled),
|
|
3748
|
+
disabled: prevDisabled,
|
|
3749
|
+
onClick: () => handlePageChange(safeCurrentPage - 1),
|
|
3750
|
+
"aria-label": resolvedLabels.previous,
|
|
3751
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
3752
|
+
width: "16",
|
|
3753
|
+
height: "16",
|
|
3754
|
+
viewBox: "0 0 16 16",
|
|
3755
|
+
fill: "none",
|
|
3756
|
+
stroke: "currentColor",
|
|
3757
|
+
strokeWidth: "2",
|
|
3758
|
+
strokeLinecap: "round",
|
|
3759
|
+
strokeLinejoin: "round",
|
|
3760
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M10 12 6 8l4-4" })
|
|
3761
|
+
})
|
|
3762
|
+
}),
|
|
3763
|
+
resolvedVariant === "pages" && pages.map((p, i) => p === "ellipsis" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3764
|
+
className: "text-text-tertiary px-1",
|
|
3765
|
+
"aria-hidden": "true",
|
|
3766
|
+
children: "…"
|
|
3767
|
+
}, `e${i}`) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3768
|
+
type: "button",
|
|
3769
|
+
className: cn(btnBase, p === safeCurrentPage ? btnActive : btnEnabled),
|
|
3770
|
+
"aria-current": p === safeCurrentPage ? "page" : void 0,
|
|
3771
|
+
"aria-label": p === safeCurrentPage ? resolvedLabels.currentPage(p) : resolvedLabels.page(p),
|
|
3772
|
+
disabled: isDisabled,
|
|
3773
|
+
onClick: () => handlePageChange(p),
|
|
3774
|
+
children: p
|
|
3775
|
+
}, p)),
|
|
3776
|
+
resolvedVariant === "count" && itemRange && totalItems !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3777
|
+
className: "text-text-secondary px-2 text-sm",
|
|
3778
|
+
"aria-live": "polite",
|
|
3779
|
+
children: resolvedLabels.count(itemRange.start, itemRange.end, totalItems)
|
|
3780
|
+
}),
|
|
3781
|
+
resolvedVariant === "compact" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3782
|
+
className: "text-text-secondary px-2 text-sm",
|
|
3783
|
+
"aria-live": "polite",
|
|
3784
|
+
children: resolvedLabels.compact(safeCurrentPage, hasMore && totalPages === safeCurrentPage + 1 ? void 0 : totalPages)
|
|
3785
|
+
}),
|
|
3786
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3787
|
+
type: "button",
|
|
3788
|
+
className: cn(btnBase, nextDisabled ? btnDisabled : btnEnabled),
|
|
3789
|
+
disabled: nextDisabled,
|
|
3790
|
+
onClick: () => handlePageChange(safeCurrentPage + 1),
|
|
3791
|
+
"aria-label": resolvedLabels.next,
|
|
3792
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
3793
|
+
width: "16",
|
|
3794
|
+
height: "16",
|
|
3795
|
+
viewBox: "0 0 16 16",
|
|
3796
|
+
fill: "none",
|
|
3797
|
+
stroke: "currentColor",
|
|
3798
|
+
strokeWidth: "2",
|
|
3799
|
+
strokeLinecap: "round",
|
|
3800
|
+
strokeLinejoin: "round",
|
|
3801
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M6 4l4 4-4 4" })
|
|
3802
|
+
})
|
|
3803
|
+
})
|
|
3804
|
+
]
|
|
3805
|
+
}));
|
|
3806
|
+
}
|
|
3807
|
+
//#endregion
|
|
3808
|
+
Object.defineProperty(exports, "Alert", {
|
|
3809
|
+
enumerable: true,
|
|
3810
|
+
get: function() {
|
|
3811
|
+
return Alert;
|
|
3812
|
+
}
|
|
3813
|
+
});
|
|
3814
|
+
Object.defineProperty(exports, "AlertDialogPanel", {
|
|
3815
|
+
enumerable: true,
|
|
3816
|
+
get: function() {
|
|
3817
|
+
return AlertDialogPanel;
|
|
3818
|
+
}
|
|
3819
|
+
});
|
|
3820
|
+
Object.defineProperty(exports, "Badge", {
|
|
3821
|
+
enumerable: true,
|
|
3822
|
+
get: function() {
|
|
3823
|
+
return Badge;
|
|
3824
|
+
}
|
|
3825
|
+
});
|
|
3826
|
+
Object.defineProperty(exports, "Button", {
|
|
3827
|
+
enumerable: true,
|
|
3828
|
+
get: function() {
|
|
3829
|
+
return Button;
|
|
3830
|
+
}
|
|
3831
|
+
});
|
|
3832
|
+
Object.defineProperty(exports, "Checkbox", {
|
|
3833
|
+
enumerable: true,
|
|
3834
|
+
get: function() {
|
|
3835
|
+
return Checkbox;
|
|
3836
|
+
}
|
|
3837
|
+
});
|
|
3838
|
+
Object.defineProperty(exports, "CheckboxGroup", {
|
|
3839
|
+
enumerable: true,
|
|
3840
|
+
get: function() {
|
|
3841
|
+
return CheckboxGroup;
|
|
3842
|
+
}
|
|
3843
|
+
});
|
|
3844
|
+
Object.defineProperty(exports, "ColorPicker", {
|
|
3845
|
+
enumerable: true,
|
|
3846
|
+
get: function() {
|
|
3847
|
+
return ColorPicker;
|
|
3848
|
+
}
|
|
3849
|
+
});
|
|
3850
|
+
Object.defineProperty(exports, "ComboboxEmpty", {
|
|
3851
|
+
enumerable: true,
|
|
3852
|
+
get: function() {
|
|
3853
|
+
return ComboboxEmpty;
|
|
3854
|
+
}
|
|
3855
|
+
});
|
|
3856
|
+
Object.defineProperty(exports, "ComboboxGroup", {
|
|
3857
|
+
enumerable: true,
|
|
3858
|
+
get: function() {
|
|
3859
|
+
return ComboboxGroup;
|
|
3860
|
+
}
|
|
3861
|
+
});
|
|
3862
|
+
Object.defineProperty(exports, "ComboboxGroupLabel", {
|
|
3863
|
+
enumerable: true,
|
|
3864
|
+
get: function() {
|
|
3865
|
+
return ComboboxGroupLabel;
|
|
3866
|
+
}
|
|
3867
|
+
});
|
|
3868
|
+
Object.defineProperty(exports, "ComboboxInput", {
|
|
3869
|
+
enumerable: true,
|
|
3870
|
+
get: function() {
|
|
3871
|
+
return ComboboxInput;
|
|
3872
|
+
}
|
|
3873
|
+
});
|
|
3874
|
+
Object.defineProperty(exports, "ComboboxItem", {
|
|
3875
|
+
enumerable: true,
|
|
3876
|
+
get: function() {
|
|
3877
|
+
return ComboboxItem;
|
|
3878
|
+
}
|
|
3879
|
+
});
|
|
3880
|
+
Object.defineProperty(exports, "ComboboxPopover", {
|
|
3881
|
+
enumerable: true,
|
|
3882
|
+
get: function() {
|
|
3883
|
+
return ComboboxPopover;
|
|
3884
|
+
}
|
|
3885
|
+
});
|
|
3886
|
+
Object.defineProperty(exports, "ComboboxRoot", {
|
|
3887
|
+
enumerable: true,
|
|
3888
|
+
get: function() {
|
|
3889
|
+
return ComboboxRoot;
|
|
3890
|
+
}
|
|
3891
|
+
});
|
|
3892
|
+
Object.defineProperty(exports, "CompositeZone", {
|
|
3893
|
+
enumerable: true,
|
|
3894
|
+
get: function() {
|
|
3895
|
+
return CompositeZone;
|
|
3896
|
+
}
|
|
3897
|
+
});
|
|
3898
|
+
Object.defineProperty(exports, "DEFAULT_PRESETS", {
|
|
3899
|
+
enumerable: true,
|
|
3900
|
+
get: function() {
|
|
3901
|
+
return DEFAULT_PRESETS;
|
|
3902
|
+
}
|
|
3903
|
+
});
|
|
3904
|
+
Object.defineProperty(exports, "DateRangePicker", {
|
|
3905
|
+
enumerable: true,
|
|
3906
|
+
get: function() {
|
|
3907
|
+
return DateRangePicker;
|
|
3908
|
+
}
|
|
3909
|
+
});
|
|
3910
|
+
Object.defineProperty(exports, "DialogBody", {
|
|
3911
|
+
enumerable: true,
|
|
3912
|
+
get: function() {
|
|
3913
|
+
return DialogBody;
|
|
3914
|
+
}
|
|
3915
|
+
});
|
|
3916
|
+
Object.defineProperty(exports, "DialogDescription", {
|
|
3917
|
+
enumerable: true,
|
|
3918
|
+
get: function() {
|
|
3919
|
+
return DialogDescription;
|
|
3920
|
+
}
|
|
3921
|
+
});
|
|
3922
|
+
Object.defineProperty(exports, "DialogDisclosure", {
|
|
3923
|
+
enumerable: true,
|
|
3924
|
+
get: function() {
|
|
3925
|
+
return DialogDisclosure;
|
|
3926
|
+
}
|
|
3927
|
+
});
|
|
3928
|
+
Object.defineProperty(exports, "DialogDismiss", {
|
|
3929
|
+
enumerable: true,
|
|
3930
|
+
get: function() {
|
|
3931
|
+
return DialogDismiss;
|
|
3932
|
+
}
|
|
3933
|
+
});
|
|
3934
|
+
Object.defineProperty(exports, "DialogFooter", {
|
|
3935
|
+
enumerable: true,
|
|
3936
|
+
get: function() {
|
|
3937
|
+
return DialogFooter;
|
|
3938
|
+
}
|
|
3939
|
+
});
|
|
3940
|
+
Object.defineProperty(exports, "DialogHeader", {
|
|
3941
|
+
enumerable: true,
|
|
3942
|
+
get: function() {
|
|
3943
|
+
return DialogHeader;
|
|
3944
|
+
}
|
|
3945
|
+
});
|
|
3946
|
+
Object.defineProperty(exports, "DialogHeading", {
|
|
3947
|
+
enumerable: true,
|
|
3948
|
+
get: function() {
|
|
3949
|
+
return DialogHeading;
|
|
3950
|
+
}
|
|
3951
|
+
});
|
|
3952
|
+
Object.defineProperty(exports, "DialogPanel", {
|
|
3953
|
+
enumerable: true,
|
|
3954
|
+
get: function() {
|
|
3955
|
+
return DialogPanel;
|
|
3956
|
+
}
|
|
3957
|
+
});
|
|
3958
|
+
Object.defineProperty(exports, "DialogRoot", {
|
|
3959
|
+
enumerable: true,
|
|
3960
|
+
get: function() {
|
|
3961
|
+
return DialogRoot;
|
|
3962
|
+
}
|
|
3963
|
+
});
|
|
3964
|
+
Object.defineProperty(exports, "DisclosureContent", {
|
|
3965
|
+
enumerable: true,
|
|
3966
|
+
get: function() {
|
|
3967
|
+
return DisclosureContent;
|
|
3968
|
+
}
|
|
3969
|
+
});
|
|
3970
|
+
Object.defineProperty(exports, "DisclosureRoot", {
|
|
3971
|
+
enumerable: true,
|
|
3972
|
+
get: function() {
|
|
3973
|
+
return DisclosureRoot;
|
|
3974
|
+
}
|
|
3975
|
+
});
|
|
3976
|
+
Object.defineProperty(exports, "DisclosureTrigger", {
|
|
3977
|
+
enumerable: true,
|
|
3978
|
+
get: function() {
|
|
3979
|
+
return DisclosureTrigger;
|
|
3980
|
+
}
|
|
3981
|
+
});
|
|
3982
|
+
Object.defineProperty(exports, "EmptyState", {
|
|
3983
|
+
enumerable: true,
|
|
3984
|
+
get: function() {
|
|
3985
|
+
return EmptyState;
|
|
3986
|
+
}
|
|
3987
|
+
});
|
|
3988
|
+
Object.defineProperty(exports, "FieldMessages", {
|
|
3989
|
+
enumerable: true,
|
|
3990
|
+
get: function() {
|
|
3991
|
+
return FieldMessages;
|
|
3992
|
+
}
|
|
3993
|
+
});
|
|
3994
|
+
Object.defineProperty(exports, "FormCheckbox", {
|
|
3995
|
+
enumerable: true,
|
|
3996
|
+
get: function() {
|
|
3997
|
+
return FormCheckbox;
|
|
3998
|
+
}
|
|
3999
|
+
});
|
|
4000
|
+
Object.defineProperty(exports, "FormColorPicker", {
|
|
4001
|
+
enumerable: true,
|
|
4002
|
+
get: function() {
|
|
4003
|
+
return FormColorPicker;
|
|
4004
|
+
}
|
|
4005
|
+
});
|
|
4006
|
+
Object.defineProperty(exports, "FormControl", {
|
|
4007
|
+
enumerable: true,
|
|
4008
|
+
get: function() {
|
|
4009
|
+
return FormControl;
|
|
4010
|
+
}
|
|
4011
|
+
});
|
|
4012
|
+
Object.defineProperty(exports, "FormDateRangePicker", {
|
|
4013
|
+
enumerable: true,
|
|
4014
|
+
get: function() {
|
|
4015
|
+
return FormDateRangePicker;
|
|
4016
|
+
}
|
|
4017
|
+
});
|
|
4018
|
+
Object.defineProperty(exports, "FormDescription", {
|
|
4019
|
+
enumerable: true,
|
|
4020
|
+
get: function() {
|
|
4021
|
+
return FormDescription;
|
|
4022
|
+
}
|
|
4023
|
+
});
|
|
4024
|
+
Object.defineProperty(exports, "FormError", {
|
|
4025
|
+
enumerable: true,
|
|
4026
|
+
get: function() {
|
|
4027
|
+
return FormError;
|
|
4028
|
+
}
|
|
4029
|
+
});
|
|
4030
|
+
Object.defineProperty(exports, "FormField", {
|
|
4031
|
+
enumerable: true,
|
|
4032
|
+
get: function() {
|
|
4033
|
+
return FormField;
|
|
4034
|
+
}
|
|
4035
|
+
});
|
|
4036
|
+
Object.defineProperty(exports, "FormGroup", {
|
|
4037
|
+
enumerable: true,
|
|
4038
|
+
get: function() {
|
|
4039
|
+
return FormGroup;
|
|
4040
|
+
}
|
|
4041
|
+
});
|
|
4042
|
+
Object.defineProperty(exports, "FormGroupLabel", {
|
|
4043
|
+
enumerable: true,
|
|
4044
|
+
get: function() {
|
|
4045
|
+
return FormGroupLabel;
|
|
4046
|
+
}
|
|
4047
|
+
});
|
|
4048
|
+
Object.defineProperty(exports, "FormIconPicker", {
|
|
4049
|
+
enumerable: true,
|
|
4050
|
+
get: function() {
|
|
4051
|
+
return FormIconPicker;
|
|
4052
|
+
}
|
|
4053
|
+
});
|
|
4054
|
+
Object.defineProperty(exports, "FormInput", {
|
|
4055
|
+
enumerable: true,
|
|
4056
|
+
get: function() {
|
|
4057
|
+
return FormInput;
|
|
4058
|
+
}
|
|
4059
|
+
});
|
|
4060
|
+
Object.defineProperty(exports, "FormLabel", {
|
|
4061
|
+
enumerable: true,
|
|
4062
|
+
get: function() {
|
|
4063
|
+
return FormLabel;
|
|
4064
|
+
}
|
|
4065
|
+
});
|
|
4066
|
+
Object.defineProperty(exports, "FormNumberInput", {
|
|
4067
|
+
enumerable: true,
|
|
4068
|
+
get: function() {
|
|
4069
|
+
return FormNumberInput;
|
|
4070
|
+
}
|
|
4071
|
+
});
|
|
4072
|
+
Object.defineProperty(exports, "FormProvider", {
|
|
4073
|
+
enumerable: true,
|
|
4074
|
+
get: function() {
|
|
4075
|
+
return FormProvider;
|
|
4076
|
+
}
|
|
4077
|
+
});
|
|
4078
|
+
Object.defineProperty(exports, "FormPush", {
|
|
4079
|
+
enumerable: true,
|
|
4080
|
+
get: function() {
|
|
4081
|
+
return FormPush;
|
|
4082
|
+
}
|
|
4083
|
+
});
|
|
4084
|
+
Object.defineProperty(exports, "FormRadio", {
|
|
4085
|
+
enumerable: true,
|
|
4086
|
+
get: function() {
|
|
4087
|
+
return FormRadio;
|
|
4088
|
+
}
|
|
4089
|
+
});
|
|
4090
|
+
Object.defineProperty(exports, "FormRadioGroup", {
|
|
4091
|
+
enumerable: true,
|
|
4092
|
+
get: function() {
|
|
4093
|
+
return FormRadioGroup;
|
|
4094
|
+
}
|
|
4095
|
+
});
|
|
4096
|
+
Object.defineProperty(exports, "FormRemove", {
|
|
4097
|
+
enumerable: true,
|
|
4098
|
+
get: function() {
|
|
4099
|
+
return FormRemove;
|
|
4100
|
+
}
|
|
4101
|
+
});
|
|
4102
|
+
Object.defineProperty(exports, "FormReset", {
|
|
4103
|
+
enumerable: true,
|
|
4104
|
+
get: function() {
|
|
4105
|
+
return FormReset;
|
|
4106
|
+
}
|
|
4107
|
+
});
|
|
4108
|
+
Object.defineProperty(exports, "FormRoot", {
|
|
4109
|
+
enumerable: true,
|
|
4110
|
+
get: function() {
|
|
4111
|
+
return FormRoot;
|
|
4112
|
+
}
|
|
4113
|
+
});
|
|
4114
|
+
Object.defineProperty(exports, "FormSelect", {
|
|
4115
|
+
enumerable: true,
|
|
4116
|
+
get: function() {
|
|
4117
|
+
return FormSelect;
|
|
4118
|
+
}
|
|
4119
|
+
});
|
|
4120
|
+
Object.defineProperty(exports, "FormSelectItem", {
|
|
4121
|
+
enumerable: true,
|
|
4122
|
+
get: function() {
|
|
4123
|
+
return FormSelectItem;
|
|
4124
|
+
}
|
|
4125
|
+
});
|
|
4126
|
+
Object.defineProperty(exports, "FormSelectPopover", {
|
|
4127
|
+
enumerable: true,
|
|
4128
|
+
get: function() {
|
|
4129
|
+
return FormSelectPopover;
|
|
4130
|
+
}
|
|
4131
|
+
});
|
|
4132
|
+
Object.defineProperty(exports, "FormSlider", {
|
|
4133
|
+
enumerable: true,
|
|
4134
|
+
get: function() {
|
|
4135
|
+
return FormSlider;
|
|
4136
|
+
}
|
|
4137
|
+
});
|
|
4138
|
+
Object.defineProperty(exports, "FormStarRating", {
|
|
4139
|
+
enumerable: true,
|
|
4140
|
+
get: function() {
|
|
4141
|
+
return FormStarRating;
|
|
4142
|
+
}
|
|
4143
|
+
});
|
|
4144
|
+
Object.defineProperty(exports, "FormSubmit", {
|
|
4145
|
+
enumerable: true,
|
|
4146
|
+
get: function() {
|
|
4147
|
+
return FormSubmit;
|
|
4148
|
+
}
|
|
4149
|
+
});
|
|
4150
|
+
Object.defineProperty(exports, "FormSwitch", {
|
|
4151
|
+
enumerable: true,
|
|
4152
|
+
get: function() {
|
|
4153
|
+
return FormSwitch;
|
|
4154
|
+
}
|
|
4155
|
+
});
|
|
4156
|
+
Object.defineProperty(exports, "FormTagInput", {
|
|
4157
|
+
enumerable: true,
|
|
4158
|
+
get: function() {
|
|
4159
|
+
return FormTagInput;
|
|
4160
|
+
}
|
|
4161
|
+
});
|
|
4162
|
+
Object.defineProperty(exports, "FormTextarea", {
|
|
4163
|
+
enumerable: true,
|
|
4164
|
+
get: function() {
|
|
4165
|
+
return FormTextarea;
|
|
4166
|
+
}
|
|
4167
|
+
});
|
|
4168
|
+
Object.defineProperty(exports, "IconPicker", {
|
|
4169
|
+
enumerable: true,
|
|
4170
|
+
get: function() {
|
|
4171
|
+
return IconPicker;
|
|
4172
|
+
}
|
|
4173
|
+
});
|
|
4174
|
+
Object.defineProperty(exports, "Kbd", {
|
|
4175
|
+
enumerable: true,
|
|
4176
|
+
get: function() {
|
|
4177
|
+
return Kbd;
|
|
4178
|
+
}
|
|
4179
|
+
});
|
|
4180
|
+
Object.defineProperty(exports, "MenuButtonArrow", {
|
|
4181
|
+
enumerable: true,
|
|
4182
|
+
get: function() {
|
|
4183
|
+
return MenuButtonArrow;
|
|
4184
|
+
}
|
|
4185
|
+
});
|
|
4186
|
+
Object.defineProperty(exports, "MenuItem", {
|
|
4187
|
+
enumerable: true,
|
|
4188
|
+
get: function() {
|
|
4189
|
+
return MenuItem;
|
|
4190
|
+
}
|
|
4191
|
+
});
|
|
4192
|
+
Object.defineProperty(exports, "MenuItemCheckbox", {
|
|
4193
|
+
enumerable: true,
|
|
4194
|
+
get: function() {
|
|
4195
|
+
return MenuItemCheckbox;
|
|
4196
|
+
}
|
|
4197
|
+
});
|
|
4198
|
+
Object.defineProperty(exports, "MenuItemRadio", {
|
|
4199
|
+
enumerable: true,
|
|
4200
|
+
get: function() {
|
|
4201
|
+
return MenuItemRadio;
|
|
4202
|
+
}
|
|
4203
|
+
});
|
|
4204
|
+
Object.defineProperty(exports, "MenuPopover", {
|
|
4205
|
+
enumerable: true,
|
|
4206
|
+
get: function() {
|
|
4207
|
+
return MenuPopover;
|
|
4208
|
+
}
|
|
4209
|
+
});
|
|
4210
|
+
Object.defineProperty(exports, "MenuRoot", {
|
|
4211
|
+
enumerable: true,
|
|
4212
|
+
get: function() {
|
|
4213
|
+
return MenuRoot;
|
|
4214
|
+
}
|
|
4215
|
+
});
|
|
4216
|
+
Object.defineProperty(exports, "MenuSeparator", {
|
|
4217
|
+
enumerable: true,
|
|
4218
|
+
get: function() {
|
|
4219
|
+
return MenuSeparator;
|
|
4220
|
+
}
|
|
4221
|
+
});
|
|
4222
|
+
Object.defineProperty(exports, "MenuTrigger", {
|
|
4223
|
+
enumerable: true,
|
|
4224
|
+
get: function() {
|
|
4225
|
+
return MenuTrigger;
|
|
4226
|
+
}
|
|
4227
|
+
});
|
|
4228
|
+
Object.defineProperty(exports, "MenubarContainer", {
|
|
4229
|
+
enumerable: true,
|
|
4230
|
+
get: function() {
|
|
4231
|
+
return MenubarContainer;
|
|
4232
|
+
}
|
|
4233
|
+
});
|
|
4234
|
+
Object.defineProperty(exports, "MenubarRoot", {
|
|
4235
|
+
enumerable: true,
|
|
4236
|
+
get: function() {
|
|
4237
|
+
return MenubarRoot;
|
|
4238
|
+
}
|
|
4239
|
+
});
|
|
4240
|
+
Object.defineProperty(exports, "NumberInput", {
|
|
4241
|
+
enumerable: true,
|
|
4242
|
+
get: function() {
|
|
4243
|
+
return NumberInput;
|
|
4244
|
+
}
|
|
4245
|
+
});
|
|
4246
|
+
Object.defineProperty(exports, "OPT_ACTIVE_ITEM", {
|
|
4247
|
+
enumerable: true,
|
|
4248
|
+
get: function() {
|
|
4249
|
+
return OPT_ACTIVE_ITEM;
|
|
4250
|
+
}
|
|
4251
|
+
});
|
|
4252
|
+
Object.defineProperty(exports, "OPT_ANIMATE_DRAWER", {
|
|
4253
|
+
enumerable: true,
|
|
4254
|
+
get: function() {
|
|
4255
|
+
return OPT_ANIMATE_DRAWER;
|
|
4256
|
+
}
|
|
4257
|
+
});
|
|
4258
|
+
Object.defineProperty(exports, "OPT_ANIMATE_ENTER_EXIT", {
|
|
4259
|
+
enumerable: true,
|
|
4260
|
+
get: function() {
|
|
4261
|
+
return OPT_ANIMATE_ENTER_EXIT;
|
|
4262
|
+
}
|
|
4263
|
+
});
|
|
4264
|
+
Object.defineProperty(exports, "OPT_BADGE_BLUE", {
|
|
4265
|
+
enumerable: true,
|
|
4266
|
+
get: function() {
|
|
4267
|
+
return OPT_BADGE_BLUE;
|
|
4268
|
+
}
|
|
4269
|
+
});
|
|
4270
|
+
Object.defineProperty(exports, "OPT_BADGE_GREEN", {
|
|
4271
|
+
enumerable: true,
|
|
4272
|
+
get: function() {
|
|
4273
|
+
return OPT_BADGE_GREEN;
|
|
4274
|
+
}
|
|
4275
|
+
});
|
|
4276
|
+
Object.defineProperty(exports, "OPT_BADGE_NEUTRAL", {
|
|
4277
|
+
enumerable: true,
|
|
4278
|
+
get: function() {
|
|
4279
|
+
return OPT_BADGE_NEUTRAL;
|
|
4280
|
+
}
|
|
4281
|
+
});
|
|
4282
|
+
Object.defineProperty(exports, "OPT_BADGE_RED", {
|
|
4283
|
+
enumerable: true,
|
|
4284
|
+
get: function() {
|
|
4285
|
+
return OPT_BADGE_RED;
|
|
4286
|
+
}
|
|
4287
|
+
});
|
|
4288
|
+
Object.defineProperty(exports, "OPT_BADGE_YELLOW", {
|
|
4289
|
+
enumerable: true,
|
|
4290
|
+
get: function() {
|
|
4291
|
+
return OPT_BADGE_YELLOW;
|
|
4292
|
+
}
|
|
4293
|
+
});
|
|
4294
|
+
Object.defineProperty(exports, "OPT_BORDER", {
|
|
4295
|
+
enumerable: true,
|
|
4296
|
+
get: function() {
|
|
4297
|
+
return OPT_BORDER;
|
|
4298
|
+
}
|
|
4299
|
+
});
|
|
4300
|
+
Object.defineProperty(exports, "OPT_DISCLOSURE_CONTENT", {
|
|
4301
|
+
enumerable: true,
|
|
4302
|
+
get: function() {
|
|
4303
|
+
return OPT_DISCLOSURE_CONTENT;
|
|
4304
|
+
}
|
|
4305
|
+
});
|
|
4306
|
+
Object.defineProperty(exports, "OPT_DISCLOSURE_TRIGGER", {
|
|
4307
|
+
enumerable: true,
|
|
4308
|
+
get: function() {
|
|
4309
|
+
return OPT_DISCLOSURE_TRIGGER;
|
|
4310
|
+
}
|
|
4311
|
+
});
|
|
4312
|
+
Object.defineProperty(exports, "OPT_DIVIDER", {
|
|
4313
|
+
enumerable: true,
|
|
4314
|
+
get: function() {
|
|
4315
|
+
return OPT_DIVIDER;
|
|
4316
|
+
}
|
|
4317
|
+
});
|
|
4318
|
+
Object.defineProperty(exports, "OPT_DOT_GRAY", {
|
|
4319
|
+
enumerable: true,
|
|
4320
|
+
get: function() {
|
|
4321
|
+
return OPT_DOT_GRAY;
|
|
4322
|
+
}
|
|
4323
|
+
});
|
|
4324
|
+
Object.defineProperty(exports, "OPT_DOT_GREEN", {
|
|
4325
|
+
enumerable: true,
|
|
4326
|
+
get: function() {
|
|
4327
|
+
return OPT_DOT_GREEN;
|
|
4328
|
+
}
|
|
4329
|
+
});
|
|
4330
|
+
Object.defineProperty(exports, "OPT_DOT_RED", {
|
|
4331
|
+
enumerable: true,
|
|
4332
|
+
get: function() {
|
|
4333
|
+
return OPT_DOT_RED;
|
|
4334
|
+
}
|
|
4335
|
+
});
|
|
4336
|
+
Object.defineProperty(exports, "OPT_DOT_YELLOW", {
|
|
4337
|
+
enumerable: true,
|
|
4338
|
+
get: function() {
|
|
4339
|
+
return OPT_DOT_YELLOW;
|
|
4340
|
+
}
|
|
4341
|
+
});
|
|
4342
|
+
Object.defineProperty(exports, "OPT_FOCUS", {
|
|
4343
|
+
enumerable: true,
|
|
4344
|
+
get: function() {
|
|
4345
|
+
return OPT_FOCUS;
|
|
4346
|
+
}
|
|
4347
|
+
});
|
|
4348
|
+
Object.defineProperty(exports, "OPT_FOCUS_VISIBLE", {
|
|
4349
|
+
enumerable: true,
|
|
4350
|
+
get: function() {
|
|
4351
|
+
return OPT_FOCUS_VISIBLE;
|
|
4352
|
+
}
|
|
4353
|
+
});
|
|
4354
|
+
Object.defineProperty(exports, "OPT_HOVER_ITEM", {
|
|
4355
|
+
enumerable: true,
|
|
4356
|
+
get: function() {
|
|
4357
|
+
return OPT_HOVER_ITEM;
|
|
4358
|
+
}
|
|
4359
|
+
});
|
|
4360
|
+
Object.defineProperty(exports, "OPT_INPUT", {
|
|
4361
|
+
enumerable: true,
|
|
4362
|
+
get: function() {
|
|
4363
|
+
return OPT_INPUT;
|
|
4364
|
+
}
|
|
4365
|
+
});
|
|
4366
|
+
Object.defineProperty(exports, "OPT_INPUT_ERROR", {
|
|
4367
|
+
enumerable: true,
|
|
4368
|
+
get: function() {
|
|
4369
|
+
return OPT_INPUT_ERROR;
|
|
4370
|
+
}
|
|
4371
|
+
});
|
|
4372
|
+
Object.defineProperty(exports, "OPT_INPUT_SIZE", {
|
|
4373
|
+
enumerable: true,
|
|
4374
|
+
get: function() {
|
|
4375
|
+
return OPT_INPUT_SIZE;
|
|
4376
|
+
}
|
|
4377
|
+
});
|
|
4378
|
+
Object.defineProperty(exports, "OPT_ITEM_BASE", {
|
|
4379
|
+
enumerable: true,
|
|
4380
|
+
get: function() {
|
|
4381
|
+
return OPT_ITEM_BASE;
|
|
4382
|
+
}
|
|
4383
|
+
});
|
|
4384
|
+
Object.defineProperty(exports, "OPT_SURFACE", {
|
|
4385
|
+
enumerable: true,
|
|
4386
|
+
get: function() {
|
|
4387
|
+
return OPT_SURFACE;
|
|
4388
|
+
}
|
|
4389
|
+
});
|
|
4390
|
+
Object.defineProperty(exports, "OPT_SURFACE_POPOVER", {
|
|
4391
|
+
enumerable: true,
|
|
4392
|
+
get: function() {
|
|
4393
|
+
return OPT_SURFACE_POPOVER;
|
|
4394
|
+
}
|
|
4395
|
+
});
|
|
4396
|
+
Object.defineProperty(exports, "OPT_TABLE_ROW_ACTIVE", {
|
|
4397
|
+
enumerable: true,
|
|
4398
|
+
get: function() {
|
|
4399
|
+
return OPT_TABLE_ROW_ACTIVE;
|
|
4400
|
+
}
|
|
4401
|
+
});
|
|
4402
|
+
Object.defineProperty(exports, "OPT_TD", {
|
|
4403
|
+
enumerable: true,
|
|
4404
|
+
get: function() {
|
|
4405
|
+
return OPT_TD;
|
|
4406
|
+
}
|
|
4407
|
+
});
|
|
4408
|
+
Object.defineProperty(exports, "OPT_TD_MUTED", {
|
|
4409
|
+
enumerable: true,
|
|
4410
|
+
get: function() {
|
|
4411
|
+
return OPT_TD_MUTED;
|
|
4412
|
+
}
|
|
4413
|
+
});
|
|
4414
|
+
Object.defineProperty(exports, "OPT_TEXTAREA_SIZE", {
|
|
4415
|
+
enumerable: true,
|
|
4416
|
+
get: function() {
|
|
4417
|
+
return OPT_TEXTAREA_SIZE;
|
|
4418
|
+
}
|
|
4419
|
+
});
|
|
4420
|
+
Object.defineProperty(exports, "OPT_TEXT_LABEL", {
|
|
4421
|
+
enumerable: true,
|
|
4422
|
+
get: function() {
|
|
4423
|
+
return OPT_TEXT_LABEL;
|
|
4424
|
+
}
|
|
4425
|
+
});
|
|
4426
|
+
Object.defineProperty(exports, "OPT_TEXT_PRIMARY", {
|
|
4427
|
+
enumerable: true,
|
|
4428
|
+
get: function() {
|
|
4429
|
+
return OPT_TEXT_PRIMARY;
|
|
4430
|
+
}
|
|
4431
|
+
});
|
|
4432
|
+
Object.defineProperty(exports, "OPT_TEXT_SECONDARY", {
|
|
4433
|
+
enumerable: true,
|
|
4434
|
+
get: function() {
|
|
4435
|
+
return OPT_TEXT_SECONDARY;
|
|
4436
|
+
}
|
|
4437
|
+
});
|
|
4438
|
+
Object.defineProperty(exports, "OPT_TEXT_TERTIARY", {
|
|
4439
|
+
enumerable: true,
|
|
4440
|
+
get: function() {
|
|
4441
|
+
return OPT_TEXT_TERTIARY;
|
|
4442
|
+
}
|
|
4443
|
+
});
|
|
4444
|
+
Object.defineProperty(exports, "OPT_TH", {
|
|
4445
|
+
enumerable: true,
|
|
4446
|
+
get: function() {
|
|
4447
|
+
return OPT_TH;
|
|
4448
|
+
}
|
|
4449
|
+
});
|
|
4450
|
+
Object.defineProperty(exports, "Pagination", {
|
|
4451
|
+
enumerable: true,
|
|
4452
|
+
get: function() {
|
|
4453
|
+
return Pagination;
|
|
4454
|
+
}
|
|
4455
|
+
});
|
|
4456
|
+
Object.defineProperty(exports, "PopoverClose", {
|
|
4457
|
+
enumerable: true,
|
|
4458
|
+
get: function() {
|
|
4459
|
+
return PopoverClose;
|
|
4460
|
+
}
|
|
4461
|
+
});
|
|
4462
|
+
Object.defineProperty(exports, "PopoverContent", {
|
|
4463
|
+
enumerable: true,
|
|
4464
|
+
get: function() {
|
|
4465
|
+
return PopoverContent;
|
|
4466
|
+
}
|
|
4467
|
+
});
|
|
4468
|
+
Object.defineProperty(exports, "PopoverRoot", {
|
|
4469
|
+
enumerable: true,
|
|
4470
|
+
get: function() {
|
|
4471
|
+
return PopoverRoot;
|
|
4472
|
+
}
|
|
4473
|
+
});
|
|
4474
|
+
Object.defineProperty(exports, "PopoverTrigger", {
|
|
4475
|
+
enumerable: true,
|
|
4476
|
+
get: function() {
|
|
4477
|
+
return PopoverTrigger;
|
|
4478
|
+
}
|
|
4479
|
+
});
|
|
4480
|
+
Object.defineProperty(exports, "RequiredMark", {
|
|
4481
|
+
enumerable: true,
|
|
4482
|
+
get: function() {
|
|
4483
|
+
return RequiredMark;
|
|
4484
|
+
}
|
|
4485
|
+
});
|
|
4486
|
+
Object.defineProperty(exports, "SelectItem", {
|
|
4487
|
+
enumerable: true,
|
|
4488
|
+
get: function() {
|
|
4489
|
+
return SelectItem;
|
|
4490
|
+
}
|
|
4491
|
+
});
|
|
4492
|
+
Object.defineProperty(exports, "SelectLabel", {
|
|
4493
|
+
enumerable: true,
|
|
4494
|
+
get: function() {
|
|
4495
|
+
return SelectLabel;
|
|
4496
|
+
}
|
|
4497
|
+
});
|
|
4498
|
+
Object.defineProperty(exports, "SelectPopover", {
|
|
4499
|
+
enumerable: true,
|
|
4500
|
+
get: function() {
|
|
4501
|
+
return SelectPopover;
|
|
4502
|
+
}
|
|
4503
|
+
});
|
|
4504
|
+
Object.defineProperty(exports, "SelectRoot", {
|
|
4505
|
+
enumerable: true,
|
|
4506
|
+
get: function() {
|
|
4507
|
+
return SelectRoot;
|
|
4508
|
+
}
|
|
4509
|
+
});
|
|
4510
|
+
Object.defineProperty(exports, "SelectTrigger", {
|
|
4511
|
+
enumerable: true,
|
|
4512
|
+
get: function() {
|
|
4513
|
+
return SelectTrigger;
|
|
4514
|
+
}
|
|
4515
|
+
});
|
|
4516
|
+
Object.defineProperty(exports, "Slider", {
|
|
4517
|
+
enumerable: true,
|
|
4518
|
+
get: function() {
|
|
4519
|
+
return Slider;
|
|
4520
|
+
}
|
|
4521
|
+
});
|
|
4522
|
+
Object.defineProperty(exports, "Spinner", {
|
|
4523
|
+
enumerable: true,
|
|
4524
|
+
get: function() {
|
|
4525
|
+
return Spinner;
|
|
4526
|
+
}
|
|
4527
|
+
});
|
|
4528
|
+
Object.defineProperty(exports, "StarRating", {
|
|
4529
|
+
enumerable: true,
|
|
4530
|
+
get: function() {
|
|
4531
|
+
return StarRating;
|
|
4532
|
+
}
|
|
4533
|
+
});
|
|
4534
|
+
Object.defineProperty(exports, "StatCard", {
|
|
4535
|
+
enumerable: true,
|
|
4536
|
+
get: function() {
|
|
4537
|
+
return StatCard;
|
|
4538
|
+
}
|
|
4539
|
+
});
|
|
4540
|
+
Object.defineProperty(exports, "Tab", {
|
|
4541
|
+
enumerable: true,
|
|
4542
|
+
get: function() {
|
|
4543
|
+
return Tab;
|
|
4544
|
+
}
|
|
4545
|
+
});
|
|
4546
|
+
Object.defineProperty(exports, "TabList", {
|
|
4547
|
+
enumerable: true,
|
|
4548
|
+
get: function() {
|
|
4549
|
+
return TabList;
|
|
4550
|
+
}
|
|
4551
|
+
});
|
|
4552
|
+
Object.defineProperty(exports, "TabPanel", {
|
|
4553
|
+
enumerable: true,
|
|
4554
|
+
get: function() {
|
|
4555
|
+
return TabPanel;
|
|
4556
|
+
}
|
|
4557
|
+
});
|
|
4558
|
+
Object.defineProperty(exports, "TabsRoot", {
|
|
4559
|
+
enumerable: true,
|
|
4560
|
+
get: function() {
|
|
4561
|
+
return TabsRoot;
|
|
4562
|
+
}
|
|
4563
|
+
});
|
|
4564
|
+
Object.defineProperty(exports, "TagInput", {
|
|
4565
|
+
enumerable: true,
|
|
4566
|
+
get: function() {
|
|
4567
|
+
return TagInput;
|
|
4568
|
+
}
|
|
4569
|
+
});
|
|
4570
|
+
Object.defineProperty(exports, "ToolbarButton", {
|
|
4571
|
+
enumerable: true,
|
|
4572
|
+
get: function() {
|
|
4573
|
+
return ToolbarButton;
|
|
4574
|
+
}
|
|
4575
|
+
});
|
|
4576
|
+
Object.defineProperty(exports, "ToolbarContainer", {
|
|
4577
|
+
enumerable: true,
|
|
4578
|
+
get: function() {
|
|
4579
|
+
return ToolbarContainer;
|
|
4580
|
+
}
|
|
4581
|
+
});
|
|
4582
|
+
Object.defineProperty(exports, "ToolbarRoot", {
|
|
4583
|
+
enumerable: true,
|
|
4584
|
+
get: function() {
|
|
4585
|
+
return ToolbarRoot;
|
|
4586
|
+
}
|
|
4587
|
+
});
|
|
4588
|
+
Object.defineProperty(exports, "ToolbarSeparator", {
|
|
4589
|
+
enumerable: true,
|
|
4590
|
+
get: function() {
|
|
4591
|
+
return ToolbarSeparator;
|
|
4592
|
+
}
|
|
4593
|
+
});
|
|
4594
|
+
Object.defineProperty(exports, "Tooltip", {
|
|
4595
|
+
enumerable: true,
|
|
4596
|
+
get: function() {
|
|
4597
|
+
return Tooltip;
|
|
4598
|
+
}
|
|
4599
|
+
});
|
|
4600
|
+
Object.defineProperty(exports, "TooltipAnchor", {
|
|
4601
|
+
enumerable: true,
|
|
4602
|
+
get: function() {
|
|
4603
|
+
return TooltipAnchor;
|
|
4604
|
+
}
|
|
4605
|
+
});
|
|
4606
|
+
Object.defineProperty(exports, "TooltipProvider", {
|
|
4607
|
+
enumerable: true,
|
|
4608
|
+
get: function() {
|
|
4609
|
+
return TooltipProvider;
|
|
4610
|
+
}
|
|
4611
|
+
});
|
|
4612
|
+
Object.defineProperty(exports, "__toESM", {
|
|
4613
|
+
enumerable: true,
|
|
4614
|
+
get: function() {
|
|
4615
|
+
return __toESM;
|
|
4616
|
+
}
|
|
4617
|
+
});
|
|
4618
|
+
Object.defineProperty(exports, "_objectSpread2", {
|
|
4619
|
+
enumerable: true,
|
|
4620
|
+
get: function() {
|
|
4621
|
+
return _objectSpread2;
|
|
4622
|
+
}
|
|
4623
|
+
});
|
|
4624
|
+
Object.defineProperty(exports, "_objectWithoutProperties", {
|
|
4625
|
+
enumerable: true,
|
|
4626
|
+
get: function() {
|
|
4627
|
+
return _objectWithoutProperties;
|
|
4628
|
+
}
|
|
4629
|
+
});
|
|
4630
|
+
Object.defineProperty(exports, "cn", {
|
|
4631
|
+
enumerable: true,
|
|
4632
|
+
get: function() {
|
|
4633
|
+
return cn;
|
|
4634
|
+
}
|
|
4635
|
+
});
|
|
4636
|
+
Object.defineProperty(exports, "getDescribedBy", {
|
|
4637
|
+
enumerable: true,
|
|
4638
|
+
get: function() {
|
|
4639
|
+
return getDescribedBy;
|
|
4640
|
+
}
|
|
4641
|
+
});
|
|
4642
|
+
Object.defineProperty(exports, "getIconRegistryEntry", {
|
|
4643
|
+
enumerable: true,
|
|
4644
|
+
get: function() {
|
|
4645
|
+
return getIconRegistryEntry;
|
|
4646
|
+
}
|
|
4647
|
+
});
|
|
4648
|
+
Object.defineProperty(exports, "koBreadcrumbLabels", {
|
|
4649
|
+
enumerable: true,
|
|
4650
|
+
get: function() {
|
|
4651
|
+
return koBreadcrumbLabels;
|
|
4652
|
+
}
|
|
4653
|
+
});
|
|
4654
|
+
Object.defineProperty(exports, "koComboboxLabels", {
|
|
4655
|
+
enumerable: true,
|
|
4656
|
+
get: function() {
|
|
4657
|
+
return koComboboxLabels;
|
|
4658
|
+
}
|
|
4659
|
+
});
|
|
4660
|
+
Object.defineProperty(exports, "koStarRatingLabels", {
|
|
4661
|
+
enumerable: true,
|
|
4662
|
+
get: function() {
|
|
4663
|
+
return koStarRatingLabels;
|
|
4664
|
+
}
|
|
4665
|
+
});
|
|
4666
|
+
Object.defineProperty(exports, "useControlledState", {
|
|
4667
|
+
enumerable: true,
|
|
4668
|
+
get: function() {
|
|
4669
|
+
return useControlledState;
|
|
4670
|
+
}
|
|
4671
|
+
});
|
|
4672
|
+
Object.defineProperty(exports, "useInputId", {
|
|
4673
|
+
enumerable: true,
|
|
4674
|
+
get: function() {
|
|
4675
|
+
return useInputId;
|
|
4676
|
+
}
|
|
4677
|
+
});
|