@helpwave/hightide 0.1.27 → 0.1.28
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/dist/coloring/index.d.mts +2 -0
- package/dist/coloring/index.d.ts +2 -0
- package/dist/coloring/index.js +85 -0
- package/dist/coloring/index.js.map +1 -0
- package/dist/coloring/index.mjs +48 -0
- package/dist/coloring/index.mjs.map +1 -0
- package/dist/components/branding/index.d.mts +3 -0
- package/dist/components/branding/index.d.ts +3 -0
- package/dist/components/branding/index.js +140 -0
- package/dist/components/branding/index.js.map +1 -0
- package/dist/components/branding/index.mjs +104 -0
- package/dist/components/branding/index.mjs.map +1 -0
- package/dist/components/date/index.d.mts +10 -0
- package/dist/components/date/index.d.ts +10 -0
- package/dist/components/date/index.js +1168 -0
- package/dist/components/date/index.js.map +1 -0
- package/dist/components/date/index.mjs +1124 -0
- package/dist/components/date/index.mjs.map +1 -0
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/form/index.d.mts +5 -0
- package/dist/components/form/index.d.ts +5 -0
- package/dist/components/form/index.js +100 -0
- package/dist/components/form/index.js.map +1 -0
- package/dist/components/form/index.mjs +64 -0
- package/dist/components/form/index.mjs.map +1 -0
- package/dist/components/icons-and-geometry/index.d.mts +7 -0
- package/dist/components/icons-and-geometry/index.d.ts +7 -0
- package/dist/components/icons-and-geometry/index.js +3955 -0
- package/dist/components/icons-and-geometry/index.js.map +1 -0
- package/dist/components/icons-and-geometry/index.mjs +3939 -0
- package/dist/components/icons-and-geometry/index.mjs.map +1 -0
- package/dist/components/index.d.mts +83 -0
- package/dist/components/index.d.ts +83 -0
- package/dist/components/index.js +15471 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index.mjs +15377 -0
- package/dist/components/index.mjs.map +1 -0
- package/dist/components/layout/index.d.mts +18 -0
- package/dist/components/layout/index.d.ts +18 -0
- package/dist/components/layout/index.js +3111 -0
- package/dist/components/layout/index.js.map +1 -0
- package/dist/components/layout/index.mjs +3064 -0
- package/dist/components/layout/index.mjs.map +1 -0
- package/dist/components/loading-states/index.d.mts +12 -0
- package/dist/components/loading-states/index.d.ts +12 -0
- package/dist/components/loading-states/index.js +614 -0
- package/dist/components/loading-states/index.js.map +1 -0
- package/dist/components/loading-states/index.mjs +573 -0
- package/dist/components/loading-states/index.mjs.map +1 -0
- package/dist/components/navigation/index.d.mts +9 -0
- package/dist/components/navigation/index.d.ts +9 -0
- package/dist/components/navigation/index.js +4660 -0
- package/dist/components/navigation/index.js.map +1 -0
- package/dist/components/navigation/index.mjs +4648 -0
- package/dist/components/navigation/index.mjs.map +1 -0
- package/dist/components/properties/index.d.mts +12 -0
- package/dist/components/properties/index.d.ts +12 -0
- package/dist/components/properties/index.js +2983 -0
- package/dist/components/properties/index.js.map +1 -0
- package/dist/components/properties/index.mjs +2951 -0
- package/dist/components/properties/index.mjs.map +1 -0
- package/dist/components/table/index.d.mts +10 -0
- package/dist/components/table/index.d.ts +10 -0
- package/dist/components/table/index.js +2329 -0
- package/dist/components/table/index.js.map +1 -0
- package/dist/components/table/index.mjs +2293 -0
- package/dist/components/table/index.mjs.map +1 -0
- package/dist/components/user-action/index.d.mts +30 -0
- package/dist/components/user-action/index.d.ts +30 -0
- package/dist/components/user-action/index.js +4257 -0
- package/dist/components/user-action/index.js.map +1 -0
- package/dist/components/user-action/index.mjs +4195 -0
- package/dist/components/user-action/index.mjs.map +1 -0
- package/dist/components/user-action/input/index.d.mts +6 -0
- package/dist/components/user-action/input/index.d.ts +6 -0
- package/dist/components/user-action/input/index.js +398 -0
- package/dist/components/user-action/input/index.js.map +1 -0
- package/dist/components/user-action/input/index.mjs +357 -0
- package/dist/components/user-action/input/index.mjs.map +1 -0
- package/dist/components/user-action/select/index.d.mts +4 -0
- package/dist/components/user-action/select/index.d.ts +4 -0
- package/dist/components/user-action/select/index.js +1369 -0
- package/dist/components/user-action/select/index.js.map +1 -0
- package/dist/components/user-action/select/index.mjs +1333 -0
- package/dist/components/user-action/select/index.mjs.map +1 -0
- package/dist/components/utils/index.d.mts +4 -0
- package/dist/components/utils/index.d.ts +4 -0
- package/dist/components/utils/index.js +302 -0
- package/dist/components/utils/index.js.map +1 -0
- package/dist/components/utils/index.mjs +275 -0
- package/dist/components/utils/index.mjs.map +1 -0
- package/dist/hooks/focus/index.d.mts +6 -0
- package/dist/hooks/focus/index.d.ts +6 -0
- package/dist/hooks/focus/index.js +379 -0
- package/dist/hooks/focus/index.js.map +1 -0
- package/dist/hooks/focus/index.mjs +339 -0
- package/dist/hooks/focus/index.mjs.map +1 -0
- package/dist/hooks/index.d.mts +16 -0
- package/dist/hooks/index.d.ts +16 -0
- package/dist/hooks/index.js +844 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/index.mjs +794 -0
- package/dist/hooks/index.mjs.map +1 -0
- package/dist/index.d.mts +110 -0
- package/dist/index.d.ts +110 -0
- package/dist/index.js +16101 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +15941 -0
- package/dist/index.mjs.map +1 -0
- package/dist/localization/defaults/index.d.mts +4 -0
- package/dist/localization/defaults/index.d.ts +4 -0
- package/dist/localization/defaults/index.js +223 -0
- package/dist/localization/defaults/index.js.map +1 -0
- package/dist/localization/defaults/index.mjs +195 -0
- package/dist/localization/defaults/index.mjs.map +1 -0
- package/dist/localization/index.d.mts +7 -0
- package/dist/localization/index.d.ts +7 -0
- package/dist/localization/index.js +415 -0
- package/dist/localization/index.js.map +1 -0
- package/dist/localization/index.mjs +380 -0
- package/dist/localization/index.mjs.map +1 -0
- package/dist/theming/index.d.mts +5 -0
- package/dist/theming/index.d.ts +5 -0
- package/dist/theming/index.js +174 -0
- package/dist/theming/index.js.map +1 -0
- package/dist/theming/index.mjs +145 -0
- package/dist/theming/index.mjs.map +1 -0
- package/dist/utils/index.d.mts +15 -0
- package/dist/utils/index.d.ts +15 -0
- package/dist/utils/index.js +553 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/index.mjs +493 -0
- package/dist/utils/index.mjs.map +1 -0
- package/package.json +25 -24
|
@@ -0,0 +1,2983 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/properties/index.ts
|
|
30
|
+
var properties_exports = {};
|
|
31
|
+
__export(properties_exports, {
|
|
32
|
+
CheckboxProperty: () => CheckboxProperty,
|
|
33
|
+
DateProperty: () => DateProperty,
|
|
34
|
+
MultiSelectProperty: () => MultiSelectProperty,
|
|
35
|
+
NumberProperty: () => NumberProperty,
|
|
36
|
+
PropertyBase: () => PropertyBase,
|
|
37
|
+
SingleSelectProperty: () => SingleSelectProperty,
|
|
38
|
+
TextProperty: () => TextProperty
|
|
39
|
+
});
|
|
40
|
+
module.exports = __toCommonJS(properties_exports);
|
|
41
|
+
|
|
42
|
+
// src/components/properties/CheckboxProperty.tsx
|
|
43
|
+
var import_lucide_react3 = require("lucide-react");
|
|
44
|
+
|
|
45
|
+
// src/utils/noop.ts
|
|
46
|
+
var noop = () => void 0;
|
|
47
|
+
|
|
48
|
+
// src/components/user-action/Checkbox.tsx
|
|
49
|
+
var import_react = require("react");
|
|
50
|
+
var import_lucide_react = require("lucide-react");
|
|
51
|
+
var import_clsx = __toESM(require("clsx"));
|
|
52
|
+
|
|
53
|
+
// node_modules/@radix-ui/react-checkbox/dist/index.mjs
|
|
54
|
+
var React10 = __toESM(require("react"), 1);
|
|
55
|
+
|
|
56
|
+
// node_modules/@radix-ui/react-compose-refs/dist/index.mjs
|
|
57
|
+
var React = __toESM(require("react"), 1);
|
|
58
|
+
function setRef(ref, value) {
|
|
59
|
+
if (typeof ref === "function") {
|
|
60
|
+
return ref(value);
|
|
61
|
+
} else if (ref !== null && ref !== void 0) {
|
|
62
|
+
ref.current = value;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function composeRefs(...refs) {
|
|
66
|
+
return (node) => {
|
|
67
|
+
let hasCleanup = false;
|
|
68
|
+
const cleanups = refs.map((ref) => {
|
|
69
|
+
const cleanup = setRef(ref, node);
|
|
70
|
+
if (!hasCleanup && typeof cleanup == "function") {
|
|
71
|
+
hasCleanup = true;
|
|
72
|
+
}
|
|
73
|
+
return cleanup;
|
|
74
|
+
});
|
|
75
|
+
if (hasCleanup) {
|
|
76
|
+
return () => {
|
|
77
|
+
for (let i = 0; i < cleanups.length; i++) {
|
|
78
|
+
const cleanup = cleanups[i];
|
|
79
|
+
if (typeof cleanup == "function") {
|
|
80
|
+
cleanup();
|
|
81
|
+
} else {
|
|
82
|
+
setRef(refs[i], null);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function useComposedRefs(...refs) {
|
|
90
|
+
return React.useCallback(composeRefs(...refs), refs);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// node_modules/@radix-ui/react-context/dist/index.mjs
|
|
94
|
+
var React2 = __toESM(require("react"), 1);
|
|
95
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
96
|
+
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
97
|
+
let defaultContexts = [];
|
|
98
|
+
function createContext32(rootComponentName, defaultContext) {
|
|
99
|
+
const BaseContext = React2.createContext(defaultContext);
|
|
100
|
+
const index = defaultContexts.length;
|
|
101
|
+
defaultContexts = [...defaultContexts, defaultContext];
|
|
102
|
+
const Provider = (props) => {
|
|
103
|
+
const { scope, children, ...context } = props;
|
|
104
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
105
|
+
const value = React2.useMemo(() => context, Object.values(context));
|
|
106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Context.Provider, { value, children });
|
|
107
|
+
};
|
|
108
|
+
Provider.displayName = rootComponentName + "Provider";
|
|
109
|
+
function useContext22(consumerName, scope) {
|
|
110
|
+
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
111
|
+
const context = React2.useContext(Context);
|
|
112
|
+
if (context) return context;
|
|
113
|
+
if (defaultContext !== void 0) return defaultContext;
|
|
114
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
115
|
+
}
|
|
116
|
+
return [Provider, useContext22];
|
|
117
|
+
}
|
|
118
|
+
const createScope = () => {
|
|
119
|
+
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
120
|
+
return React2.createContext(defaultContext);
|
|
121
|
+
});
|
|
122
|
+
return function useScope(scope) {
|
|
123
|
+
const contexts = scope?.[scopeName] || scopeContexts;
|
|
124
|
+
return React2.useMemo(
|
|
125
|
+
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
126
|
+
[scope, contexts]
|
|
127
|
+
);
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
createScope.scopeName = scopeName;
|
|
131
|
+
return [createContext32, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
132
|
+
}
|
|
133
|
+
function composeContextScopes(...scopes) {
|
|
134
|
+
const baseScope = scopes[0];
|
|
135
|
+
if (scopes.length === 1) return baseScope;
|
|
136
|
+
const createScope = () => {
|
|
137
|
+
const scopeHooks = scopes.map((createScope2) => ({
|
|
138
|
+
useScope: createScope2(),
|
|
139
|
+
scopeName: createScope2.scopeName
|
|
140
|
+
}));
|
|
141
|
+
return function useComposedScopes(overrideScopes) {
|
|
142
|
+
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
143
|
+
const scopeProps = useScope(overrideScopes);
|
|
144
|
+
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
145
|
+
return { ...nextScopes2, ...currentScope };
|
|
146
|
+
}, {});
|
|
147
|
+
return React2.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
createScope.scopeName = baseScope.scopeName;
|
|
151
|
+
return createScope;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// node_modules/@radix-ui/primitive/dist/index.mjs
|
|
155
|
+
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
156
|
+
return function handleEvent(event) {
|
|
157
|
+
originalEventHandler?.(event);
|
|
158
|
+
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
159
|
+
return ourEventHandler?.(event);
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
|
|
165
|
+
var React4 = __toESM(require("react"), 1);
|
|
166
|
+
|
|
167
|
+
// node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs
|
|
168
|
+
var React3 = __toESM(require("react"), 1);
|
|
169
|
+
var useLayoutEffect2 = globalThis?.document ? React3.useLayoutEffect : () => {
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
// node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
|
|
173
|
+
var React22 = __toESM(require("react"), 1);
|
|
174
|
+
var useInsertionEffect = React4[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
|
|
175
|
+
function useControllableState({
|
|
176
|
+
prop,
|
|
177
|
+
defaultProp,
|
|
178
|
+
onChange = () => {
|
|
179
|
+
},
|
|
180
|
+
caller
|
|
181
|
+
}) {
|
|
182
|
+
const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState({
|
|
183
|
+
defaultProp,
|
|
184
|
+
onChange
|
|
185
|
+
});
|
|
186
|
+
const isControlled = prop !== void 0;
|
|
187
|
+
const value = isControlled ? prop : uncontrolledProp;
|
|
188
|
+
if (true) {
|
|
189
|
+
const isControlledRef = React4.useRef(prop !== void 0);
|
|
190
|
+
React4.useEffect(() => {
|
|
191
|
+
const wasControlled = isControlledRef.current;
|
|
192
|
+
if (wasControlled !== isControlled) {
|
|
193
|
+
const from = wasControlled ? "controlled" : "uncontrolled";
|
|
194
|
+
const to = isControlled ? "controlled" : "uncontrolled";
|
|
195
|
+
console.warn(
|
|
196
|
+
`${caller} is changing from ${from} to ${to}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
isControlledRef.current = isControlled;
|
|
200
|
+
}, [isControlled, caller]);
|
|
201
|
+
}
|
|
202
|
+
const setValue = React4.useCallback(
|
|
203
|
+
(nextValue) => {
|
|
204
|
+
if (isControlled) {
|
|
205
|
+
const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue;
|
|
206
|
+
if (value2 !== prop) {
|
|
207
|
+
onChangeRef.current?.(value2);
|
|
208
|
+
}
|
|
209
|
+
} else {
|
|
210
|
+
setUncontrolledProp(nextValue);
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
[isControlled, prop, setUncontrolledProp, onChangeRef]
|
|
214
|
+
);
|
|
215
|
+
return [value, setValue];
|
|
216
|
+
}
|
|
217
|
+
function useUncontrolledState({
|
|
218
|
+
defaultProp,
|
|
219
|
+
onChange
|
|
220
|
+
}) {
|
|
221
|
+
const [value, setValue] = React4.useState(defaultProp);
|
|
222
|
+
const prevValueRef = React4.useRef(value);
|
|
223
|
+
const onChangeRef = React4.useRef(onChange);
|
|
224
|
+
useInsertionEffect(() => {
|
|
225
|
+
onChangeRef.current = onChange;
|
|
226
|
+
}, [onChange]);
|
|
227
|
+
React4.useEffect(() => {
|
|
228
|
+
if (prevValueRef.current !== value) {
|
|
229
|
+
onChangeRef.current?.(value);
|
|
230
|
+
prevValueRef.current = value;
|
|
231
|
+
}
|
|
232
|
+
}, [value, prevValueRef]);
|
|
233
|
+
return [value, setValue, onChangeRef];
|
|
234
|
+
}
|
|
235
|
+
function isFunction(value) {
|
|
236
|
+
return typeof value === "function";
|
|
237
|
+
}
|
|
238
|
+
var SYNC_STATE = Symbol("RADIX:SYNC_STATE");
|
|
239
|
+
|
|
240
|
+
// node_modules/@radix-ui/react-use-previous/dist/index.mjs
|
|
241
|
+
var React5 = __toESM(require("react"), 1);
|
|
242
|
+
function usePrevious(value) {
|
|
243
|
+
const ref = React5.useRef({ value, previous: value });
|
|
244
|
+
return React5.useMemo(() => {
|
|
245
|
+
if (ref.current.value !== value) {
|
|
246
|
+
ref.current.previous = ref.current.value;
|
|
247
|
+
ref.current.value = value;
|
|
248
|
+
}
|
|
249
|
+
return ref.current.previous;
|
|
250
|
+
}, [value]);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// node_modules/@radix-ui/react-use-size/dist/index.mjs
|
|
254
|
+
var React6 = __toESM(require("react"), 1);
|
|
255
|
+
function useSize(element) {
|
|
256
|
+
const [size, setSize] = React6.useState(void 0);
|
|
257
|
+
useLayoutEffect2(() => {
|
|
258
|
+
if (element) {
|
|
259
|
+
setSize({ width: element.offsetWidth, height: element.offsetHeight });
|
|
260
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
261
|
+
if (!Array.isArray(entries)) {
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
if (!entries.length) {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
const entry = entries[0];
|
|
268
|
+
let width;
|
|
269
|
+
let height;
|
|
270
|
+
if ("borderBoxSize" in entry) {
|
|
271
|
+
const borderSizeEntry = entry["borderBoxSize"];
|
|
272
|
+
const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
|
|
273
|
+
width = borderSize["inlineSize"];
|
|
274
|
+
height = borderSize["blockSize"];
|
|
275
|
+
} else {
|
|
276
|
+
width = element.offsetWidth;
|
|
277
|
+
height = element.offsetHeight;
|
|
278
|
+
}
|
|
279
|
+
setSize({ width, height });
|
|
280
|
+
});
|
|
281
|
+
resizeObserver.observe(element, { box: "border-box" });
|
|
282
|
+
return () => resizeObserver.unobserve(element);
|
|
283
|
+
} else {
|
|
284
|
+
setSize(void 0);
|
|
285
|
+
}
|
|
286
|
+
}, [element]);
|
|
287
|
+
return size;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// node_modules/@radix-ui/react-presence/dist/index.mjs
|
|
291
|
+
var React23 = __toESM(require("react"), 1);
|
|
292
|
+
var React7 = __toESM(require("react"), 1);
|
|
293
|
+
function useStateMachine(initialState, machine) {
|
|
294
|
+
return React7.useReducer((state, event) => {
|
|
295
|
+
const nextState = machine[state][event];
|
|
296
|
+
return nextState ?? state;
|
|
297
|
+
}, initialState);
|
|
298
|
+
}
|
|
299
|
+
var Presence = (props) => {
|
|
300
|
+
const { present, children } = props;
|
|
301
|
+
const presence = usePresence(present);
|
|
302
|
+
const child = typeof children === "function" ? children({ present: presence.isPresent }) : React23.Children.only(children);
|
|
303
|
+
const ref = useComposedRefs(presence.ref, getElementRef(child));
|
|
304
|
+
const forceMount = typeof children === "function";
|
|
305
|
+
return forceMount || presence.isPresent ? React23.cloneElement(child, { ref }) : null;
|
|
306
|
+
};
|
|
307
|
+
Presence.displayName = "Presence";
|
|
308
|
+
function usePresence(present) {
|
|
309
|
+
const [node, setNode] = React23.useState();
|
|
310
|
+
const stylesRef = React23.useRef(null);
|
|
311
|
+
const prevPresentRef = React23.useRef(present);
|
|
312
|
+
const prevAnimationNameRef = React23.useRef("none");
|
|
313
|
+
const initialState = present ? "mounted" : "unmounted";
|
|
314
|
+
const [state, send] = useStateMachine(initialState, {
|
|
315
|
+
mounted: {
|
|
316
|
+
UNMOUNT: "unmounted",
|
|
317
|
+
ANIMATION_OUT: "unmountSuspended"
|
|
318
|
+
},
|
|
319
|
+
unmountSuspended: {
|
|
320
|
+
MOUNT: "mounted",
|
|
321
|
+
ANIMATION_END: "unmounted"
|
|
322
|
+
},
|
|
323
|
+
unmounted: {
|
|
324
|
+
MOUNT: "mounted"
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
React23.useEffect(() => {
|
|
328
|
+
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
329
|
+
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
330
|
+
}, [state]);
|
|
331
|
+
useLayoutEffect2(() => {
|
|
332
|
+
const styles = stylesRef.current;
|
|
333
|
+
const wasPresent = prevPresentRef.current;
|
|
334
|
+
const hasPresentChanged = wasPresent !== present;
|
|
335
|
+
if (hasPresentChanged) {
|
|
336
|
+
const prevAnimationName = prevAnimationNameRef.current;
|
|
337
|
+
const currentAnimationName = getAnimationName(styles);
|
|
338
|
+
if (present) {
|
|
339
|
+
send("MOUNT");
|
|
340
|
+
} else if (currentAnimationName === "none" || styles?.display === "none") {
|
|
341
|
+
send("UNMOUNT");
|
|
342
|
+
} else {
|
|
343
|
+
const isAnimating = prevAnimationName !== currentAnimationName;
|
|
344
|
+
if (wasPresent && isAnimating) {
|
|
345
|
+
send("ANIMATION_OUT");
|
|
346
|
+
} else {
|
|
347
|
+
send("UNMOUNT");
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
prevPresentRef.current = present;
|
|
351
|
+
}
|
|
352
|
+
}, [present, send]);
|
|
353
|
+
useLayoutEffect2(() => {
|
|
354
|
+
if (node) {
|
|
355
|
+
let timeoutId;
|
|
356
|
+
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
357
|
+
const handleAnimationEnd = (event) => {
|
|
358
|
+
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
359
|
+
const isCurrentAnimation = currentAnimationName.includes(event.animationName);
|
|
360
|
+
if (event.target === node && isCurrentAnimation) {
|
|
361
|
+
send("ANIMATION_END");
|
|
362
|
+
if (!prevPresentRef.current) {
|
|
363
|
+
const currentFillMode = node.style.animationFillMode;
|
|
364
|
+
node.style.animationFillMode = "forwards";
|
|
365
|
+
timeoutId = ownerWindow.setTimeout(() => {
|
|
366
|
+
if (node.style.animationFillMode === "forwards") {
|
|
367
|
+
node.style.animationFillMode = currentFillMode;
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
const handleAnimationStart = (event) => {
|
|
374
|
+
if (event.target === node) {
|
|
375
|
+
prevAnimationNameRef.current = getAnimationName(stylesRef.current);
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
node.addEventListener("animationstart", handleAnimationStart);
|
|
379
|
+
node.addEventListener("animationcancel", handleAnimationEnd);
|
|
380
|
+
node.addEventListener("animationend", handleAnimationEnd);
|
|
381
|
+
return () => {
|
|
382
|
+
ownerWindow.clearTimeout(timeoutId);
|
|
383
|
+
node.removeEventListener("animationstart", handleAnimationStart);
|
|
384
|
+
node.removeEventListener("animationcancel", handleAnimationEnd);
|
|
385
|
+
node.removeEventListener("animationend", handleAnimationEnd);
|
|
386
|
+
};
|
|
387
|
+
} else {
|
|
388
|
+
send("ANIMATION_END");
|
|
389
|
+
}
|
|
390
|
+
}, [node, send]);
|
|
391
|
+
return {
|
|
392
|
+
isPresent: ["mounted", "unmountSuspended"].includes(state),
|
|
393
|
+
ref: React23.useCallback((node2) => {
|
|
394
|
+
stylesRef.current = node2 ? getComputedStyle(node2) : null;
|
|
395
|
+
setNode(node2);
|
|
396
|
+
}, [])
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
function getAnimationName(styles) {
|
|
400
|
+
return styles?.animationName || "none";
|
|
401
|
+
}
|
|
402
|
+
function getElementRef(element) {
|
|
403
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
404
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
405
|
+
if (mayWarn) {
|
|
406
|
+
return element.ref;
|
|
407
|
+
}
|
|
408
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
409
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
410
|
+
if (mayWarn) {
|
|
411
|
+
return element.props.ref;
|
|
412
|
+
}
|
|
413
|
+
return element.props.ref || element.ref;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
// node_modules/@radix-ui/react-primitive/dist/index.mjs
|
|
417
|
+
var React9 = __toESM(require("react"), 1);
|
|
418
|
+
var ReactDOM = __toESM(require("react-dom"), 1);
|
|
419
|
+
|
|
420
|
+
// node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
421
|
+
var React8 = __toESM(require("react"), 1);
|
|
422
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
423
|
+
// @__NO_SIDE_EFFECTS__
|
|
424
|
+
function createSlot(ownerName) {
|
|
425
|
+
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
426
|
+
const Slot2 = React8.forwardRef((props, forwardedRef) => {
|
|
427
|
+
const { children, ...slotProps } = props;
|
|
428
|
+
const childrenArray = React8.Children.toArray(children);
|
|
429
|
+
const slottable = childrenArray.find(isSlottable);
|
|
430
|
+
if (slottable) {
|
|
431
|
+
const newElement = slottable.props.children;
|
|
432
|
+
const newChildren = childrenArray.map((child) => {
|
|
433
|
+
if (child === slottable) {
|
|
434
|
+
if (React8.Children.count(newElement) > 1) return React8.Children.only(null);
|
|
435
|
+
return React8.isValidElement(newElement) ? newElement.props.children : null;
|
|
436
|
+
} else {
|
|
437
|
+
return child;
|
|
438
|
+
}
|
|
439
|
+
});
|
|
440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children: React8.isValidElement(newElement) ? React8.cloneElement(newElement, void 0, newChildren) : null });
|
|
441
|
+
}
|
|
442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
443
|
+
});
|
|
444
|
+
Slot2.displayName = `${ownerName}.Slot`;
|
|
445
|
+
return Slot2;
|
|
446
|
+
}
|
|
447
|
+
// @__NO_SIDE_EFFECTS__
|
|
448
|
+
function createSlotClone(ownerName) {
|
|
449
|
+
const SlotClone = React8.forwardRef((props, forwardedRef) => {
|
|
450
|
+
const { children, ...slotProps } = props;
|
|
451
|
+
if (React8.isValidElement(children)) {
|
|
452
|
+
const childrenRef = getElementRef2(children);
|
|
453
|
+
const props2 = mergeProps(slotProps, children.props);
|
|
454
|
+
if (children.type !== React8.Fragment) {
|
|
455
|
+
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
456
|
+
}
|
|
457
|
+
return React8.cloneElement(children, props2);
|
|
458
|
+
}
|
|
459
|
+
return React8.Children.count(children) > 1 ? React8.Children.only(null) : null;
|
|
460
|
+
});
|
|
461
|
+
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
462
|
+
return SlotClone;
|
|
463
|
+
}
|
|
464
|
+
var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
465
|
+
function isSlottable(child) {
|
|
466
|
+
return React8.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
467
|
+
}
|
|
468
|
+
function mergeProps(slotProps, childProps) {
|
|
469
|
+
const overrideProps = { ...childProps };
|
|
470
|
+
for (const propName in childProps) {
|
|
471
|
+
const slotPropValue = slotProps[propName];
|
|
472
|
+
const childPropValue = childProps[propName];
|
|
473
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
474
|
+
if (isHandler) {
|
|
475
|
+
if (slotPropValue && childPropValue) {
|
|
476
|
+
overrideProps[propName] = (...args) => {
|
|
477
|
+
const result = childPropValue(...args);
|
|
478
|
+
slotPropValue(...args);
|
|
479
|
+
return result;
|
|
480
|
+
};
|
|
481
|
+
} else if (slotPropValue) {
|
|
482
|
+
overrideProps[propName] = slotPropValue;
|
|
483
|
+
}
|
|
484
|
+
} else if (propName === "style") {
|
|
485
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
486
|
+
} else if (propName === "className") {
|
|
487
|
+
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
return { ...slotProps, ...overrideProps };
|
|
491
|
+
}
|
|
492
|
+
function getElementRef2(element) {
|
|
493
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
494
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
495
|
+
if (mayWarn) {
|
|
496
|
+
return element.ref;
|
|
497
|
+
}
|
|
498
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
499
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
500
|
+
if (mayWarn) {
|
|
501
|
+
return element.props.ref;
|
|
502
|
+
}
|
|
503
|
+
return element.props.ref || element.ref;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
// node_modules/@radix-ui/react-primitive/dist/index.mjs
|
|
507
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
508
|
+
var NODES = [
|
|
509
|
+
"a",
|
|
510
|
+
"button",
|
|
511
|
+
"div",
|
|
512
|
+
"form",
|
|
513
|
+
"h2",
|
|
514
|
+
"h3",
|
|
515
|
+
"img",
|
|
516
|
+
"input",
|
|
517
|
+
"label",
|
|
518
|
+
"li",
|
|
519
|
+
"nav",
|
|
520
|
+
"ol",
|
|
521
|
+
"p",
|
|
522
|
+
"select",
|
|
523
|
+
"span",
|
|
524
|
+
"svg",
|
|
525
|
+
"ul"
|
|
526
|
+
];
|
|
527
|
+
var Primitive = NODES.reduce((primitive, node) => {
|
|
528
|
+
const Slot = createSlot(`Primitive.${node}`);
|
|
529
|
+
const Node2 = React9.forwardRef((props, forwardedRef) => {
|
|
530
|
+
const { asChild, ...primitiveProps } = props;
|
|
531
|
+
const Comp = asChild ? Slot : node;
|
|
532
|
+
if (typeof window !== "undefined") {
|
|
533
|
+
window[Symbol.for("radix-ui")] = true;
|
|
534
|
+
}
|
|
535
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
536
|
+
});
|
|
537
|
+
Node2.displayName = `Primitive.${node}`;
|
|
538
|
+
return { ...primitive, [node]: Node2 };
|
|
539
|
+
}, {});
|
|
540
|
+
|
|
541
|
+
// node_modules/@radix-ui/react-checkbox/dist/index.mjs
|
|
542
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
543
|
+
var CHECKBOX_NAME = "Checkbox";
|
|
544
|
+
var [createCheckboxContext, createCheckboxScope] = createContextScope(CHECKBOX_NAME);
|
|
545
|
+
var [CheckboxProviderImpl, useCheckboxContext] = createCheckboxContext(CHECKBOX_NAME);
|
|
546
|
+
function CheckboxProvider(props) {
|
|
547
|
+
const {
|
|
548
|
+
__scopeCheckbox,
|
|
549
|
+
checked: checkedProp,
|
|
550
|
+
children,
|
|
551
|
+
defaultChecked,
|
|
552
|
+
disabled,
|
|
553
|
+
form,
|
|
554
|
+
name,
|
|
555
|
+
onCheckedChange,
|
|
556
|
+
required,
|
|
557
|
+
value = "on",
|
|
558
|
+
// @ts-expect-error
|
|
559
|
+
internal_do_not_use_render
|
|
560
|
+
} = props;
|
|
561
|
+
const [checked, setChecked] = useControllableState({
|
|
562
|
+
prop: checkedProp,
|
|
563
|
+
defaultProp: defaultChecked ?? false,
|
|
564
|
+
onChange: onCheckedChange,
|
|
565
|
+
caller: CHECKBOX_NAME
|
|
566
|
+
});
|
|
567
|
+
const [control, setControl] = React10.useState(null);
|
|
568
|
+
const [bubbleInput, setBubbleInput] = React10.useState(null);
|
|
569
|
+
const hasConsumerStoppedPropagationRef = React10.useRef(false);
|
|
570
|
+
const isFormControl = control ? !!form || !!control.closest("form") : (
|
|
571
|
+
// We set this to true by default so that events bubble to forms without JS (SSR)
|
|
572
|
+
true
|
|
573
|
+
);
|
|
574
|
+
const context = {
|
|
575
|
+
checked,
|
|
576
|
+
disabled,
|
|
577
|
+
setChecked,
|
|
578
|
+
control,
|
|
579
|
+
setControl,
|
|
580
|
+
name,
|
|
581
|
+
form,
|
|
582
|
+
value,
|
|
583
|
+
hasConsumerStoppedPropagationRef,
|
|
584
|
+
required,
|
|
585
|
+
defaultChecked: isIndeterminate(defaultChecked) ? false : defaultChecked,
|
|
586
|
+
isFormControl,
|
|
587
|
+
bubbleInput,
|
|
588
|
+
setBubbleInput
|
|
589
|
+
};
|
|
590
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
591
|
+
CheckboxProviderImpl,
|
|
592
|
+
{
|
|
593
|
+
scope: __scopeCheckbox,
|
|
594
|
+
...context,
|
|
595
|
+
children: isFunction2(internal_do_not_use_render) ? internal_do_not_use_render(context) : children
|
|
596
|
+
}
|
|
597
|
+
);
|
|
598
|
+
}
|
|
599
|
+
var TRIGGER_NAME = "CheckboxTrigger";
|
|
600
|
+
var CheckboxTrigger = React10.forwardRef(
|
|
601
|
+
({ __scopeCheckbox, onKeyDown, onClick, ...checkboxProps }, forwardedRef) => {
|
|
602
|
+
const {
|
|
603
|
+
control,
|
|
604
|
+
value,
|
|
605
|
+
disabled,
|
|
606
|
+
checked,
|
|
607
|
+
required,
|
|
608
|
+
setControl,
|
|
609
|
+
setChecked,
|
|
610
|
+
hasConsumerStoppedPropagationRef,
|
|
611
|
+
isFormControl,
|
|
612
|
+
bubbleInput
|
|
613
|
+
} = useCheckboxContext(TRIGGER_NAME, __scopeCheckbox);
|
|
614
|
+
const composedRefs = useComposedRefs(forwardedRef, setControl);
|
|
615
|
+
const initialCheckedStateRef = React10.useRef(checked);
|
|
616
|
+
React10.useEffect(() => {
|
|
617
|
+
const form = control?.form;
|
|
618
|
+
if (form) {
|
|
619
|
+
const reset = () => setChecked(initialCheckedStateRef.current);
|
|
620
|
+
form.addEventListener("reset", reset);
|
|
621
|
+
return () => form.removeEventListener("reset", reset);
|
|
622
|
+
}
|
|
623
|
+
}, [control, setChecked]);
|
|
624
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
625
|
+
Primitive.button,
|
|
626
|
+
{
|
|
627
|
+
type: "button",
|
|
628
|
+
role: "checkbox",
|
|
629
|
+
"aria-checked": isIndeterminate(checked) ? "mixed" : checked,
|
|
630
|
+
"aria-required": required,
|
|
631
|
+
"data-state": getState(checked),
|
|
632
|
+
"data-disabled": disabled ? "" : void 0,
|
|
633
|
+
disabled,
|
|
634
|
+
value,
|
|
635
|
+
...checkboxProps,
|
|
636
|
+
ref: composedRefs,
|
|
637
|
+
onKeyDown: composeEventHandlers(onKeyDown, (event) => {
|
|
638
|
+
if (event.key === "Enter") event.preventDefault();
|
|
639
|
+
}),
|
|
640
|
+
onClick: composeEventHandlers(onClick, (event) => {
|
|
641
|
+
setChecked((prevChecked) => isIndeterminate(prevChecked) ? true : !prevChecked);
|
|
642
|
+
if (bubbleInput && isFormControl) {
|
|
643
|
+
hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
|
|
644
|
+
if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
|
|
645
|
+
}
|
|
646
|
+
})
|
|
647
|
+
}
|
|
648
|
+
);
|
|
649
|
+
}
|
|
650
|
+
);
|
|
651
|
+
CheckboxTrigger.displayName = TRIGGER_NAME;
|
|
652
|
+
var Checkbox = React10.forwardRef(
|
|
653
|
+
(props, forwardedRef) => {
|
|
654
|
+
const {
|
|
655
|
+
__scopeCheckbox,
|
|
656
|
+
name,
|
|
657
|
+
checked,
|
|
658
|
+
defaultChecked,
|
|
659
|
+
required,
|
|
660
|
+
disabled,
|
|
661
|
+
value,
|
|
662
|
+
onCheckedChange,
|
|
663
|
+
form,
|
|
664
|
+
...checkboxProps
|
|
665
|
+
} = props;
|
|
666
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
667
|
+
CheckboxProvider,
|
|
668
|
+
{
|
|
669
|
+
__scopeCheckbox,
|
|
670
|
+
checked,
|
|
671
|
+
defaultChecked,
|
|
672
|
+
disabled,
|
|
673
|
+
required,
|
|
674
|
+
onCheckedChange,
|
|
675
|
+
name,
|
|
676
|
+
form,
|
|
677
|
+
value,
|
|
678
|
+
internal_do_not_use_render: ({ isFormControl }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
679
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
680
|
+
CheckboxTrigger,
|
|
681
|
+
{
|
|
682
|
+
...checkboxProps,
|
|
683
|
+
ref: forwardedRef,
|
|
684
|
+
__scopeCheckbox
|
|
685
|
+
}
|
|
686
|
+
),
|
|
687
|
+
isFormControl && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
688
|
+
CheckboxBubbleInput,
|
|
689
|
+
{
|
|
690
|
+
__scopeCheckbox
|
|
691
|
+
}
|
|
692
|
+
)
|
|
693
|
+
] })
|
|
694
|
+
}
|
|
695
|
+
);
|
|
696
|
+
}
|
|
697
|
+
);
|
|
698
|
+
Checkbox.displayName = CHECKBOX_NAME;
|
|
699
|
+
var INDICATOR_NAME = "CheckboxIndicator";
|
|
700
|
+
var CheckboxIndicator = React10.forwardRef(
|
|
701
|
+
(props, forwardedRef) => {
|
|
702
|
+
const { __scopeCheckbox, forceMount, ...indicatorProps } = props;
|
|
703
|
+
const context = useCheckboxContext(INDICATOR_NAME, __scopeCheckbox);
|
|
704
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
705
|
+
Presence,
|
|
706
|
+
{
|
|
707
|
+
present: forceMount || isIndeterminate(context.checked) || context.checked === true,
|
|
708
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
709
|
+
Primitive.span,
|
|
710
|
+
{
|
|
711
|
+
"data-state": getState(context.checked),
|
|
712
|
+
"data-disabled": context.disabled ? "" : void 0,
|
|
713
|
+
...indicatorProps,
|
|
714
|
+
ref: forwardedRef,
|
|
715
|
+
style: { pointerEvents: "none", ...props.style }
|
|
716
|
+
}
|
|
717
|
+
)
|
|
718
|
+
}
|
|
719
|
+
);
|
|
720
|
+
}
|
|
721
|
+
);
|
|
722
|
+
CheckboxIndicator.displayName = INDICATOR_NAME;
|
|
723
|
+
var BUBBLE_INPUT_NAME = "CheckboxBubbleInput";
|
|
724
|
+
var CheckboxBubbleInput = React10.forwardRef(
|
|
725
|
+
({ __scopeCheckbox, ...props }, forwardedRef) => {
|
|
726
|
+
const {
|
|
727
|
+
control,
|
|
728
|
+
hasConsumerStoppedPropagationRef,
|
|
729
|
+
checked,
|
|
730
|
+
defaultChecked,
|
|
731
|
+
required,
|
|
732
|
+
disabled,
|
|
733
|
+
name,
|
|
734
|
+
value,
|
|
735
|
+
form,
|
|
736
|
+
bubbleInput,
|
|
737
|
+
setBubbleInput
|
|
738
|
+
} = useCheckboxContext(BUBBLE_INPUT_NAME, __scopeCheckbox);
|
|
739
|
+
const composedRefs = useComposedRefs(forwardedRef, setBubbleInput);
|
|
740
|
+
const prevChecked = usePrevious(checked);
|
|
741
|
+
const controlSize = useSize(control);
|
|
742
|
+
React10.useEffect(() => {
|
|
743
|
+
const input = bubbleInput;
|
|
744
|
+
if (!input) return;
|
|
745
|
+
const inputProto = window.HTMLInputElement.prototype;
|
|
746
|
+
const descriptor = Object.getOwnPropertyDescriptor(
|
|
747
|
+
inputProto,
|
|
748
|
+
"checked"
|
|
749
|
+
);
|
|
750
|
+
const setChecked = descriptor.set;
|
|
751
|
+
const bubbles = !hasConsumerStoppedPropagationRef.current;
|
|
752
|
+
if (prevChecked !== checked && setChecked) {
|
|
753
|
+
const event = new Event("click", { bubbles });
|
|
754
|
+
input.indeterminate = isIndeterminate(checked);
|
|
755
|
+
setChecked.call(input, isIndeterminate(checked) ? false : checked);
|
|
756
|
+
input.dispatchEvent(event);
|
|
757
|
+
}
|
|
758
|
+
}, [bubbleInput, prevChecked, checked, hasConsumerStoppedPropagationRef]);
|
|
759
|
+
const defaultCheckedRef = React10.useRef(isIndeterminate(checked) ? false : checked);
|
|
760
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
761
|
+
Primitive.input,
|
|
762
|
+
{
|
|
763
|
+
type: "checkbox",
|
|
764
|
+
"aria-hidden": true,
|
|
765
|
+
defaultChecked: defaultChecked ?? defaultCheckedRef.current,
|
|
766
|
+
required,
|
|
767
|
+
disabled,
|
|
768
|
+
name,
|
|
769
|
+
value,
|
|
770
|
+
form,
|
|
771
|
+
...props,
|
|
772
|
+
tabIndex: -1,
|
|
773
|
+
ref: composedRefs,
|
|
774
|
+
style: {
|
|
775
|
+
...props.style,
|
|
776
|
+
...controlSize,
|
|
777
|
+
position: "absolute",
|
|
778
|
+
pointerEvents: "none",
|
|
779
|
+
opacity: 0,
|
|
780
|
+
margin: 0,
|
|
781
|
+
// We transform because the input is absolutely positioned but we have
|
|
782
|
+
// rendered it **after** the button. This pulls it back to sit on top
|
|
783
|
+
// of the button.
|
|
784
|
+
transform: "translateX(-100%)"
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
);
|
|
788
|
+
}
|
|
789
|
+
);
|
|
790
|
+
CheckboxBubbleInput.displayName = BUBBLE_INPUT_NAME;
|
|
791
|
+
function isFunction2(value) {
|
|
792
|
+
return typeof value === "function";
|
|
793
|
+
}
|
|
794
|
+
function isIndeterminate(checked) {
|
|
795
|
+
return checked === "indeterminate";
|
|
796
|
+
}
|
|
797
|
+
function getState(checked) {
|
|
798
|
+
return isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked";
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
// src/components/user-action/Checkbox.tsx
|
|
802
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
803
|
+
var checkboxSizeMapping = {
|
|
804
|
+
sm: "size-5 border-1",
|
|
805
|
+
md: "size-6 border-1",
|
|
806
|
+
lg: "size-8 border-2"
|
|
807
|
+
};
|
|
808
|
+
var checkboxIconSizeMapping = {
|
|
809
|
+
sm: "size-4 stroke-3",
|
|
810
|
+
md: "size-5 stroke-3",
|
|
811
|
+
lg: "size-7 stroke-3"
|
|
812
|
+
};
|
|
813
|
+
var Checkbox2 = ({
|
|
814
|
+
disabled,
|
|
815
|
+
checked = false,
|
|
816
|
+
indeterminate = false,
|
|
817
|
+
onChange,
|
|
818
|
+
size = "md",
|
|
819
|
+
className = "",
|
|
820
|
+
...props
|
|
821
|
+
}) => {
|
|
822
|
+
const usedSizeClass = checkboxSizeMapping[size];
|
|
823
|
+
const innerIconSize = checkboxIconSizeMapping[size];
|
|
824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
825
|
+
Checkbox,
|
|
826
|
+
{
|
|
827
|
+
...props,
|
|
828
|
+
disabled,
|
|
829
|
+
checked: indeterminate ? "indeterminate" : checked,
|
|
830
|
+
onCheckedChange: onChange,
|
|
831
|
+
className: (0, import_clsx.default)(
|
|
832
|
+
usedSizeClass,
|
|
833
|
+
`flex-col-0 items-center justify-center rounded outline-none`,
|
|
834
|
+
{
|
|
835
|
+
"text-disabled-text border-disabled-outline bg-disabled-background cursor-not-allowed": disabled,
|
|
836
|
+
"hover:border-primary": !disabled,
|
|
837
|
+
"bg-input-background": !disabled && !checked,
|
|
838
|
+
"bg-primary/30 border-primary text-primary": !disabled && (checked || indeterminate)
|
|
839
|
+
},
|
|
840
|
+
className
|
|
841
|
+
),
|
|
842
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(CheckboxIndicator, { children: [
|
|
843
|
+
!checked && !indeterminate && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: (0, import_clsx.default)("bg-input-background", innerIconSize) }),
|
|
844
|
+
checked && !indeterminate && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.Check, { className: innerIconSize }),
|
|
845
|
+
indeterminate && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.Minus, { className: innerIconSize })
|
|
846
|
+
] })
|
|
847
|
+
}
|
|
848
|
+
);
|
|
849
|
+
};
|
|
850
|
+
|
|
851
|
+
// src/localization/LanguageProvider.tsx
|
|
852
|
+
var import_react3 = require("react");
|
|
853
|
+
|
|
854
|
+
// src/hooks/useLocalStorage.ts
|
|
855
|
+
var import_react2 = require("react");
|
|
856
|
+
|
|
857
|
+
// src/localization/util.ts
|
|
858
|
+
var languages = ["en", "de"];
|
|
859
|
+
var languagesLocalNames = {
|
|
860
|
+
en: "English",
|
|
861
|
+
de: "Deutsch"
|
|
862
|
+
};
|
|
863
|
+
var DEFAULT_LANGUAGE = "en";
|
|
864
|
+
var LanguageUtil = {
|
|
865
|
+
languages,
|
|
866
|
+
DEFAULT_LANGUAGE,
|
|
867
|
+
languagesLocalNames
|
|
868
|
+
};
|
|
869
|
+
|
|
870
|
+
// src/localization/LanguageProvider.tsx
|
|
871
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
872
|
+
var LanguageContext = (0, import_react3.createContext)({
|
|
873
|
+
language: LanguageUtil.DEFAULT_LANGUAGE,
|
|
874
|
+
setLanguage: (v) => v
|
|
875
|
+
});
|
|
876
|
+
var useLanguage = () => (0, import_react3.useContext)(LanguageContext);
|
|
877
|
+
|
|
878
|
+
// src/localization/useTranslation.ts
|
|
879
|
+
var TranslationPluralCount = {
|
|
880
|
+
zero: 0,
|
|
881
|
+
one: 1,
|
|
882
|
+
two: 2,
|
|
883
|
+
few: 3,
|
|
884
|
+
many: 11,
|
|
885
|
+
other: -1
|
|
886
|
+
};
|
|
887
|
+
var useTranslation = (translations, overwriteTranslation = {}) => {
|
|
888
|
+
const { language: languageProp, translation: overwrite } = overwriteTranslation;
|
|
889
|
+
const { language: inferredLanguage } = useLanguage();
|
|
890
|
+
const usedLanguage = languageProp ?? inferredLanguage;
|
|
891
|
+
const usedTranslations = [...translations];
|
|
892
|
+
if (overwrite) {
|
|
893
|
+
usedTranslations.push(overwrite);
|
|
894
|
+
}
|
|
895
|
+
return (key, options) => {
|
|
896
|
+
const { count, replacements } = { ...{ count: 0, replacements: {} }, ...options };
|
|
897
|
+
try {
|
|
898
|
+
for (let i = translations.length - 1; i >= 0; i--) {
|
|
899
|
+
const translation = translations[i];
|
|
900
|
+
const localizedTranslation = translation[usedLanguage];
|
|
901
|
+
if (!localizedTranslation) {
|
|
902
|
+
continue;
|
|
903
|
+
}
|
|
904
|
+
const value = localizedTranslation[key];
|
|
905
|
+
if (!value) {
|
|
906
|
+
continue;
|
|
907
|
+
}
|
|
908
|
+
let forProcessing;
|
|
909
|
+
if (typeof value !== "string") {
|
|
910
|
+
if (count === TranslationPluralCount.zero && value?.zero) {
|
|
911
|
+
forProcessing = value.zero;
|
|
912
|
+
} else if (count === TranslationPluralCount.one && value?.one) {
|
|
913
|
+
forProcessing = value.one;
|
|
914
|
+
} else if (count === TranslationPluralCount.two && value?.two) {
|
|
915
|
+
forProcessing = value.two;
|
|
916
|
+
} else if (TranslationPluralCount.few <= count && count < TranslationPluralCount.many && value?.few) {
|
|
917
|
+
forProcessing = value.few;
|
|
918
|
+
} else if (count > TranslationPluralCount.many && value?.many) {
|
|
919
|
+
forProcessing = value.many;
|
|
920
|
+
} else {
|
|
921
|
+
forProcessing = value.other;
|
|
922
|
+
}
|
|
923
|
+
} else {
|
|
924
|
+
forProcessing = value;
|
|
925
|
+
}
|
|
926
|
+
forProcessing = forProcessing.replace(/\{\{(\w+)}}/g, (_, placeholder) => {
|
|
927
|
+
return replacements[placeholder] ?? `{{key:${placeholder}}}`;
|
|
928
|
+
});
|
|
929
|
+
return forProcessing;
|
|
930
|
+
}
|
|
931
|
+
} catch (e) {
|
|
932
|
+
console.error(e);
|
|
933
|
+
}
|
|
934
|
+
return `{{${usedLanguage}:${key}}}`;
|
|
935
|
+
};
|
|
936
|
+
};
|
|
937
|
+
|
|
938
|
+
// src/components/properties/PropertyBase.tsx
|
|
939
|
+
var import_lucide_react2 = require("lucide-react");
|
|
940
|
+
var import_clsx3 = __toESM(require("clsx"));
|
|
941
|
+
|
|
942
|
+
// src/components/user-action/Button.tsx
|
|
943
|
+
var import_react4 = require("react");
|
|
944
|
+
var import_clsx2 = __toESM(require("clsx"));
|
|
945
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
946
|
+
var ButtonColorUtil = {
|
|
947
|
+
solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
|
|
948
|
+
text: ["primary", "negative", "neutral"],
|
|
949
|
+
outline: ["primary"]
|
|
950
|
+
};
|
|
951
|
+
var IconButtonUtil = {
|
|
952
|
+
icon: [...ButtonColorUtil.solid, "transparent"]
|
|
953
|
+
};
|
|
954
|
+
var paddingMapping = {
|
|
955
|
+
small: "btn-sm",
|
|
956
|
+
medium: "btn-md",
|
|
957
|
+
large: "btn-lg"
|
|
958
|
+
};
|
|
959
|
+
var iconPaddingMapping = {
|
|
960
|
+
tiny: "icon-btn-xs",
|
|
961
|
+
small: "icon-btn-sm",
|
|
962
|
+
medium: "icon-btn-md",
|
|
963
|
+
large: "icon-btn-lg"
|
|
964
|
+
};
|
|
965
|
+
var ButtonUtil = {
|
|
966
|
+
paddingMapping,
|
|
967
|
+
iconPaddingMapping
|
|
968
|
+
};
|
|
969
|
+
var SolidButton = (0, import_react4.forwardRef)(function SolidButton2({
|
|
970
|
+
children,
|
|
971
|
+
color = "primary",
|
|
972
|
+
size = "medium",
|
|
973
|
+
startIcon,
|
|
974
|
+
endIcon,
|
|
975
|
+
onClick,
|
|
976
|
+
className,
|
|
977
|
+
...restProps
|
|
978
|
+
}, ref) {
|
|
979
|
+
const colorClasses = {
|
|
980
|
+
primary: "not-disabled:bg-button-solid-primary-background not-disabled:text-button-solid-primary-text",
|
|
981
|
+
secondary: "not-disabled:bg-button-solid-secondary-background not-disabled:text-button-solid-secondary-text",
|
|
982
|
+
tertiary: "not-disabled:bg-button-solid-tertiary-background not-disabled:text-button-solid-tertiary-text",
|
|
983
|
+
positive: "not-disabled:bg-button-solid-positive-background not-disabled:text-button-solid-positive-text",
|
|
984
|
+
warning: "not-disabled:bg-button-solid-warning-background not-disabled:text-button-solid-warning-text",
|
|
985
|
+
negative: "not-disabled:bg-button-solid-negative-background not-disabled:text-button-solid-negative-text",
|
|
986
|
+
neutral: "not-disabled:bg-button-solid-neutral-background not-disabled:text-button-solid-neutral-text"
|
|
987
|
+
}[color];
|
|
988
|
+
const iconColorClasses = {
|
|
989
|
+
primary: "not-group-disabled:text-button-solid-primary-icon",
|
|
990
|
+
secondary: "not-group-disabled:text-button-solid-secondary-icon",
|
|
991
|
+
tertiary: "not-group-disabled:text-button-solid-tertiary-icon",
|
|
992
|
+
positive: "not-group-disabled:text-button-solid-positive-icon",
|
|
993
|
+
warning: "not-group-disabled:text-button-solid-warning-icon",
|
|
994
|
+
negative: "not-group-disabled:text-button-solid-negative-icon",
|
|
995
|
+
neutral: "not-group-disabled:text-button-solid-neutral-icon"
|
|
996
|
+
}[color];
|
|
997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
998
|
+
"button",
|
|
999
|
+
{
|
|
1000
|
+
ref,
|
|
1001
|
+
onClick,
|
|
1002
|
+
className: (0, import_clsx2.default)(
|
|
1003
|
+
"group font-semibold",
|
|
1004
|
+
colorClasses,
|
|
1005
|
+
"not-disabled:hover:brightness-90",
|
|
1006
|
+
"disabled:text-disabled-text disabled:bg-disabled-background",
|
|
1007
|
+
ButtonUtil.paddingMapping[size],
|
|
1008
|
+
className
|
|
1009
|
+
),
|
|
1010
|
+
...restProps,
|
|
1011
|
+
children: [
|
|
1012
|
+
startIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1013
|
+
"span",
|
|
1014
|
+
{
|
|
1015
|
+
className: (0, import_clsx2.default)(
|
|
1016
|
+
iconColorClasses,
|
|
1017
|
+
"group-disabled:text-disabled-icon"
|
|
1018
|
+
),
|
|
1019
|
+
children: startIcon
|
|
1020
|
+
}
|
|
1021
|
+
),
|
|
1022
|
+
children,
|
|
1023
|
+
endIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1024
|
+
"span",
|
|
1025
|
+
{
|
|
1026
|
+
className: (0, import_clsx2.default)(
|
|
1027
|
+
iconColorClasses,
|
|
1028
|
+
"group-disabled:text-disabled-icon"
|
|
1029
|
+
),
|
|
1030
|
+
children: endIcon
|
|
1031
|
+
}
|
|
1032
|
+
)
|
|
1033
|
+
]
|
|
1034
|
+
}
|
|
1035
|
+
);
|
|
1036
|
+
});
|
|
1037
|
+
var TextButton = ({
|
|
1038
|
+
children,
|
|
1039
|
+
color = "neutral",
|
|
1040
|
+
size = "medium",
|
|
1041
|
+
startIcon,
|
|
1042
|
+
endIcon,
|
|
1043
|
+
onClick,
|
|
1044
|
+
coloredHoverBackground = true,
|
|
1045
|
+
className,
|
|
1046
|
+
...restProps
|
|
1047
|
+
}) => {
|
|
1048
|
+
const colorClasses = {
|
|
1049
|
+
primary: "not-disabled:bg-transparent not-disabled:text-button-text-primary-text focus-style-none focus-visible:ring-2 not-disabled:focus-visible:ring-button-text-primary-text",
|
|
1050
|
+
negative: "not-disabled:bg-transparent not-disabled:text-button-text-negative-text focus-style-none focus-visible:ring-2 not-disabled:focus-visible:ring-button-text-negative-text",
|
|
1051
|
+
neutral: "not-disabled:bg-transparent not-disabled:text-button-text-neutral-text focus-style-none focus-visible:ring-2 not-disabled:focus-visible:ring-button-text-neutral-text"
|
|
1052
|
+
}[color];
|
|
1053
|
+
const backgroundColor = {
|
|
1054
|
+
primary: "not-disabled:hover:bg-button-text-primary-text/20 not-disabled:focus-visible:bg-button-text-primary-text/20",
|
|
1055
|
+
negative: "not-disabled:hover:bg-button-text-negative-text/20 not-disabled:focus-visible:bg-button-text-negative-text/20",
|
|
1056
|
+
neutral: "not-disabled:hover:bg-button-text-neutral-text/20 not-disabled:focus-visible:bg-button-text-neutral-text/20"
|
|
1057
|
+
}[color];
|
|
1058
|
+
const iconColorClasses = {
|
|
1059
|
+
primary: "not-group-disabled:text-button-text-primary-icon",
|
|
1060
|
+
negative: "not-group-disabled:text-button-text-negative-icon",
|
|
1061
|
+
neutral: "not-group-disabled:text-button-text-neutral-icon"
|
|
1062
|
+
}[color];
|
|
1063
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1064
|
+
"button",
|
|
1065
|
+
{
|
|
1066
|
+
onClick,
|
|
1067
|
+
className: (0, import_clsx2.default)(
|
|
1068
|
+
"group font-semibold",
|
|
1069
|
+
"disabled:text-disabled-text",
|
|
1070
|
+
colorClasses,
|
|
1071
|
+
{
|
|
1072
|
+
[backgroundColor]: coloredHoverBackground,
|
|
1073
|
+
"not-disabled:hover:bg-button-text-hover-background": !coloredHoverBackground
|
|
1074
|
+
},
|
|
1075
|
+
ButtonUtil.paddingMapping[size],
|
|
1076
|
+
className
|
|
1077
|
+
),
|
|
1078
|
+
...restProps,
|
|
1079
|
+
children: [
|
|
1080
|
+
startIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1081
|
+
"span",
|
|
1082
|
+
{
|
|
1083
|
+
className: (0, import_clsx2.default)(
|
|
1084
|
+
iconColorClasses,
|
|
1085
|
+
"group-disabled:text-disabled-icon"
|
|
1086
|
+
),
|
|
1087
|
+
children: startIcon
|
|
1088
|
+
}
|
|
1089
|
+
),
|
|
1090
|
+
children,
|
|
1091
|
+
endIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1092
|
+
"span",
|
|
1093
|
+
{
|
|
1094
|
+
className: (0, import_clsx2.default)(
|
|
1095
|
+
iconColorClasses,
|
|
1096
|
+
"group-disabled:text-disabled-icon"
|
|
1097
|
+
),
|
|
1098
|
+
children: endIcon
|
|
1099
|
+
}
|
|
1100
|
+
)
|
|
1101
|
+
]
|
|
1102
|
+
}
|
|
1103
|
+
);
|
|
1104
|
+
};
|
|
1105
|
+
var IconButton = (0, import_react4.forwardRef)(function IconButton2({
|
|
1106
|
+
children,
|
|
1107
|
+
color = "primary",
|
|
1108
|
+
size = "medium",
|
|
1109
|
+
className,
|
|
1110
|
+
...restProps
|
|
1111
|
+
}, ref) {
|
|
1112
|
+
const colorClasses = {
|
|
1113
|
+
primary: "not-disabled:bg-button-solid-primary-background not-disabled:text-button-solid-primary-text",
|
|
1114
|
+
secondary: "not-disabled:bg-button-solid-secondary-background not-disabled:text-button-solid-secondary-text",
|
|
1115
|
+
tertiary: "not-disabled:bg-button-solid-tertiary-background not-disabled:text-button-solid-tertiary-text",
|
|
1116
|
+
positive: "not-disabled:bg-button-solid-positive-background not-disabled:text-button-solid-positive-text",
|
|
1117
|
+
warning: "not-disabled:bg-button-solid-warning-background not-disabled:text-button-solid-warning-text",
|
|
1118
|
+
negative: "not-disabled:bg-button-solid-negative-background not-disabled:text-button-solid-negative-text",
|
|
1119
|
+
neutral: "not-disabled:bg-button-solid-neutral-background not-disabled:text-button-solid-neutral-text",
|
|
1120
|
+
transparent: "not-disabled:bg-transparent"
|
|
1121
|
+
}[color];
|
|
1122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1123
|
+
"button",
|
|
1124
|
+
{
|
|
1125
|
+
ref,
|
|
1126
|
+
className: (0, import_clsx2.default)(
|
|
1127
|
+
colorClasses,
|
|
1128
|
+
"not-disabled:hover:brightness-90",
|
|
1129
|
+
"disabled:text-disabled-text",
|
|
1130
|
+
{
|
|
1131
|
+
"disabled:bg-disabled-background": color !== "transparent",
|
|
1132
|
+
"disabled:opacity-70": color === "transparent",
|
|
1133
|
+
"not-disabled:hover:bg-button-text-hover-background": color === "transparent"
|
|
1134
|
+
},
|
|
1135
|
+
ButtonUtil.iconPaddingMapping[size],
|
|
1136
|
+
className
|
|
1137
|
+
),
|
|
1138
|
+
...restProps,
|
|
1139
|
+
children
|
|
1140
|
+
}
|
|
1141
|
+
);
|
|
1142
|
+
});
|
|
1143
|
+
|
|
1144
|
+
// src/localization/defaults/form.ts
|
|
1145
|
+
var formTranslation = {
|
|
1146
|
+
en: {
|
|
1147
|
+
add: "Add",
|
|
1148
|
+
all: "All",
|
|
1149
|
+
apply: "Apply",
|
|
1150
|
+
back: "Back",
|
|
1151
|
+
cancel: "Cancel",
|
|
1152
|
+
change: "Change",
|
|
1153
|
+
clear: "Clear",
|
|
1154
|
+
click: "Click",
|
|
1155
|
+
clickToCopy: "Click to Copy",
|
|
1156
|
+
close: "Close",
|
|
1157
|
+
confirm: "Confirm",
|
|
1158
|
+
copy: "Copy",
|
|
1159
|
+
copied: "Copied",
|
|
1160
|
+
create: "Create",
|
|
1161
|
+
decline: "Decline",
|
|
1162
|
+
delete: "Delete",
|
|
1163
|
+
discard: "Discard",
|
|
1164
|
+
discardChanges: "Discard Changes",
|
|
1165
|
+
done: "Done",
|
|
1166
|
+
edit: "Edit",
|
|
1167
|
+
enterText: "Enter text here",
|
|
1168
|
+
error: "Error",
|
|
1169
|
+
exit: "Exit",
|
|
1170
|
+
fieldRequiredError: "This field is required.",
|
|
1171
|
+
invalidEmailError: "Please enter a valid email address.",
|
|
1172
|
+
less: "Less",
|
|
1173
|
+
loading: "Loading",
|
|
1174
|
+
maxLengthError: "Maximum length exceeded.",
|
|
1175
|
+
minLengthError: "Minimum length not met.",
|
|
1176
|
+
more: "More",
|
|
1177
|
+
next: "Next",
|
|
1178
|
+
no: "No",
|
|
1179
|
+
none: "None",
|
|
1180
|
+
nothingFound: "Nothing found",
|
|
1181
|
+
of: "of",
|
|
1182
|
+
optional: "Optional",
|
|
1183
|
+
pleaseWait: "Please wait...",
|
|
1184
|
+
previous: "Previous",
|
|
1185
|
+
remove: "Remove",
|
|
1186
|
+
required: "Required",
|
|
1187
|
+
reset: "Reset",
|
|
1188
|
+
save: "Save",
|
|
1189
|
+
saved: "Saved",
|
|
1190
|
+
search: "Search",
|
|
1191
|
+
select: "Select",
|
|
1192
|
+
selectOption: "Select an option",
|
|
1193
|
+
show: "Show",
|
|
1194
|
+
showMore: "Show more",
|
|
1195
|
+
showLess: "Show less",
|
|
1196
|
+
submit: "Submit",
|
|
1197
|
+
success: "Success",
|
|
1198
|
+
update: "Update",
|
|
1199
|
+
unsavedChanges: "Unsaved Changes",
|
|
1200
|
+
unsavedChangesSaveQuestion: "Do you want to save your changes?",
|
|
1201
|
+
yes: "Yes"
|
|
1202
|
+
},
|
|
1203
|
+
de: {
|
|
1204
|
+
add: "Hinzuf\xFCgen",
|
|
1205
|
+
all: "Alle",
|
|
1206
|
+
apply: "Anwenden",
|
|
1207
|
+
back: "Zur\xFCck",
|
|
1208
|
+
cancel: "Abbrechen",
|
|
1209
|
+
change: "\xC4ndern",
|
|
1210
|
+
clear: "L\xF6schen",
|
|
1211
|
+
click: "Klicken",
|
|
1212
|
+
clickToCopy: "Zum kopieren klicken",
|
|
1213
|
+
close: "Schlie\xDFen",
|
|
1214
|
+
confirm: "Best\xE4tigen",
|
|
1215
|
+
copy: "Kopieren",
|
|
1216
|
+
copied: "Kopiert",
|
|
1217
|
+
create: "Erstellen",
|
|
1218
|
+
decline: "Ablehnen",
|
|
1219
|
+
delete: "L\xF6schen",
|
|
1220
|
+
discard: "Verwerfen",
|
|
1221
|
+
discardChanges: "\xC4nderungen Verwerfen",
|
|
1222
|
+
done: "Fertig",
|
|
1223
|
+
edit: "Bearbeiten",
|
|
1224
|
+
enterText: "Text hier eingeben",
|
|
1225
|
+
error: "Fehler",
|
|
1226
|
+
exit: "Beenden",
|
|
1227
|
+
fieldRequiredError: "Dieses Feld ist erforderlich.",
|
|
1228
|
+
invalidEmailError: "Bitte geben Sie eine g\xFCltige E-Mail-Adresse ein.",
|
|
1229
|
+
less: "Weniger",
|
|
1230
|
+
loading: "L\xE4dt",
|
|
1231
|
+
maxLengthError: "Maximale L\xE4nge \xFCberschritten.",
|
|
1232
|
+
minLengthError: "Mindestl\xE4nge nicht erreicht.",
|
|
1233
|
+
more: "Mehr",
|
|
1234
|
+
next: "Weiter",
|
|
1235
|
+
no: "Nein",
|
|
1236
|
+
none: "Nichts",
|
|
1237
|
+
nothingFound: "Nichts gefunden",
|
|
1238
|
+
of: "von",
|
|
1239
|
+
optional: "Optional",
|
|
1240
|
+
pleaseWait: "Bitte warten...",
|
|
1241
|
+
previous: "Vorherige",
|
|
1242
|
+
remove: "Entfernen",
|
|
1243
|
+
required: "Erforderlich",
|
|
1244
|
+
reset: "Zur\xFCcksetzen",
|
|
1245
|
+
save: "Speichern",
|
|
1246
|
+
saved: "Gespeichert",
|
|
1247
|
+
search: "Suche",
|
|
1248
|
+
select: "Select",
|
|
1249
|
+
selectOption: "Option ausw\xE4hlen",
|
|
1250
|
+
show: "Anzeigen",
|
|
1251
|
+
showMore: "Mehr anzeigen",
|
|
1252
|
+
showLess: "Weniger anzeigen",
|
|
1253
|
+
submit: "Abschicken",
|
|
1254
|
+
success: "Erfolg",
|
|
1255
|
+
update: "Update",
|
|
1256
|
+
unsavedChanges: "Ungespeicherte \xC4nderungen",
|
|
1257
|
+
unsavedChangesSaveQuestion: "M\xF6chtest du die \xC4nderungen speichern?",
|
|
1258
|
+
yes: "Ja"
|
|
1259
|
+
}
|
|
1260
|
+
};
|
|
1261
|
+
|
|
1262
|
+
// src/components/properties/PropertyBase.tsx
|
|
1263
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1264
|
+
var PropertyBase = ({
|
|
1265
|
+
overwriteTranslation,
|
|
1266
|
+
name,
|
|
1267
|
+
input,
|
|
1268
|
+
softRequired = false,
|
|
1269
|
+
hasValue,
|
|
1270
|
+
icon,
|
|
1271
|
+
readOnly,
|
|
1272
|
+
onRemove,
|
|
1273
|
+
className = ""
|
|
1274
|
+
}) => {
|
|
1275
|
+
const translation = useTranslation([formTranslation], overwriteTranslation);
|
|
1276
|
+
const requiredAndNoValue = softRequired && !hasValue;
|
|
1277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: (0, import_clsx3.default)("flex-row-0 group", className), children: [
|
|
1278
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1279
|
+
"div",
|
|
1280
|
+
{
|
|
1281
|
+
className: (0, import_clsx3.default)(
|
|
1282
|
+
"flex-row-2 max-w-48 min-w-48 px-3 py-2 items-center rounded-l-xl border-2 border-r-0",
|
|
1283
|
+
{
|
|
1284
|
+
"bg-property-title-background text-property-title-text group-hover:border-primary": !requiredAndNoValue,
|
|
1285
|
+
"bg-warning text-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
|
|
1286
|
+
},
|
|
1287
|
+
className
|
|
1288
|
+
),
|
|
1289
|
+
children: [
|
|
1290
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "max-w-6 min-w-6 text-text-primary", children: icon }),
|
|
1291
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "font-semibold", children: name })
|
|
1292
|
+
]
|
|
1293
|
+
}
|
|
1294
|
+
),
|
|
1295
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1296
|
+
"div",
|
|
1297
|
+
{
|
|
1298
|
+
className: (0, import_clsx3.default)(
|
|
1299
|
+
"flex-row-2 grow px-3 py-2 justify-between items-center rounded-r-xl border-2 border-l-0 min-h-15",
|
|
1300
|
+
{
|
|
1301
|
+
"bg-input-background text-input-text group-hover:border-primary": !requiredAndNoValue,
|
|
1302
|
+
"bg-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
|
|
1303
|
+
},
|
|
1304
|
+
className
|
|
1305
|
+
),
|
|
1306
|
+
children: [
|
|
1307
|
+
input({ softRequired, hasValue }),
|
|
1308
|
+
requiredAndNoValue && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "text-warning", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.AlertTriangle, { size: 24 }) }),
|
|
1309
|
+
onRemove && !readOnly && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1310
|
+
TextButton,
|
|
1311
|
+
{
|
|
1312
|
+
onClick: onRemove,
|
|
1313
|
+
color: "negative",
|
|
1314
|
+
className: (0, import_clsx3.default)("items-center"),
|
|
1315
|
+
disabled: !hasValue,
|
|
1316
|
+
children: translation("remove")
|
|
1317
|
+
}
|
|
1318
|
+
)
|
|
1319
|
+
]
|
|
1320
|
+
}
|
|
1321
|
+
)
|
|
1322
|
+
] });
|
|
1323
|
+
};
|
|
1324
|
+
|
|
1325
|
+
// src/components/properties/CheckboxProperty.tsx
|
|
1326
|
+
var import_react5 = require("react");
|
|
1327
|
+
|
|
1328
|
+
// src/components/user-action/Label.tsx
|
|
1329
|
+
var import_clsx4 = __toESM(require("clsx"));
|
|
1330
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1331
|
+
var styleMapping = {
|
|
1332
|
+
sm: "typography-label-xs color-label-text",
|
|
1333
|
+
md: "typography-label-md color-label-text"
|
|
1334
|
+
};
|
|
1335
|
+
var Label = ({
|
|
1336
|
+
children,
|
|
1337
|
+
size = "md",
|
|
1338
|
+
className,
|
|
1339
|
+
...props
|
|
1340
|
+
}) => {
|
|
1341
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { ...props, className: (0, import_clsx4.default)(styleMapping[size], className), children });
|
|
1342
|
+
};
|
|
1343
|
+
|
|
1344
|
+
// src/components/properties/CheckboxProperty.tsx
|
|
1345
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1346
|
+
var CheckboxProperty = ({
|
|
1347
|
+
overwriteTranslation,
|
|
1348
|
+
value,
|
|
1349
|
+
onChange = noop,
|
|
1350
|
+
readOnly,
|
|
1351
|
+
...baseProps
|
|
1352
|
+
}) => {
|
|
1353
|
+
const translation = useTranslation([formTranslation], overwriteTranslation);
|
|
1354
|
+
const id = (0, import_react5.useId)();
|
|
1355
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1356
|
+
PropertyBase,
|
|
1357
|
+
{
|
|
1358
|
+
...baseProps,
|
|
1359
|
+
hasValue: true,
|
|
1360
|
+
readOnly,
|
|
1361
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.Check, { size: 24 }),
|
|
1362
|
+
input: () => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex-row-2 items-center", children: [
|
|
1363
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1364
|
+
Checkbox2,
|
|
1365
|
+
{
|
|
1366
|
+
id,
|
|
1367
|
+
checked: value ?? true,
|
|
1368
|
+
disabled: readOnly,
|
|
1369
|
+
onChange,
|
|
1370
|
+
"aria-labelledby": id + "label"
|
|
1371
|
+
}
|
|
1372
|
+
),
|
|
1373
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Label, { id: id + "label", children: `${translation("yes")}/${translation("no")}` })
|
|
1374
|
+
] })
|
|
1375
|
+
}
|
|
1376
|
+
);
|
|
1377
|
+
};
|
|
1378
|
+
|
|
1379
|
+
// src/components/properties/DateProperty.tsx
|
|
1380
|
+
var import_lucide_react4 = require("lucide-react");
|
|
1381
|
+
var import_clsx6 = __toESM(require("clsx"));
|
|
1382
|
+
|
|
1383
|
+
// src/utils/date.ts
|
|
1384
|
+
var formatDate = (date) => {
|
|
1385
|
+
const year = date.getFullYear().toString().padStart(4, "0");
|
|
1386
|
+
const month = (date.getMonth() + 1).toString().padStart(2, "0");
|
|
1387
|
+
const day = date.getDate().toString().padStart(2, "0");
|
|
1388
|
+
return `${year}-${month}-${day}`;
|
|
1389
|
+
};
|
|
1390
|
+
var formatDateTime = (date) => {
|
|
1391
|
+
const dateString = formatDate(date);
|
|
1392
|
+
const hours = date.getHours().toString().padStart(2, "0");
|
|
1393
|
+
const minutes = date.getMinutes().toString().padStart(2, "0");
|
|
1394
|
+
return `${dateString}T${hours}:${minutes}`;
|
|
1395
|
+
};
|
|
1396
|
+
|
|
1397
|
+
// src/components/user-action/input/Input.tsx
|
|
1398
|
+
var import_react8 = require("react");
|
|
1399
|
+
var import_clsx5 = __toESM(require("clsx"));
|
|
1400
|
+
|
|
1401
|
+
// src/hooks/useDelay.ts
|
|
1402
|
+
var import_react6 = require("react");
|
|
1403
|
+
var defaultOptions = {
|
|
1404
|
+
delay: 3e3,
|
|
1405
|
+
disabled: false
|
|
1406
|
+
};
|
|
1407
|
+
function useDelay(options) {
|
|
1408
|
+
const [timer, setTimer] = (0, import_react6.useState)(void 0);
|
|
1409
|
+
const { delay, disabled } = {
|
|
1410
|
+
...defaultOptions,
|
|
1411
|
+
...options
|
|
1412
|
+
};
|
|
1413
|
+
const clearTimer = () => {
|
|
1414
|
+
clearTimeout(timer);
|
|
1415
|
+
setTimer(void 0);
|
|
1416
|
+
};
|
|
1417
|
+
const restartTimer = (onDelayFinish) => {
|
|
1418
|
+
if (disabled) {
|
|
1419
|
+
return;
|
|
1420
|
+
}
|
|
1421
|
+
clearTimeout(timer);
|
|
1422
|
+
setTimer(setTimeout(() => {
|
|
1423
|
+
onDelayFinish();
|
|
1424
|
+
setTimer(void 0);
|
|
1425
|
+
}, delay));
|
|
1426
|
+
};
|
|
1427
|
+
(0, import_react6.useEffect)(() => {
|
|
1428
|
+
return () => {
|
|
1429
|
+
clearTimeout(timer);
|
|
1430
|
+
};
|
|
1431
|
+
}, [timer]);
|
|
1432
|
+
(0, import_react6.useEffect)(() => {
|
|
1433
|
+
if (disabled) {
|
|
1434
|
+
clearTimeout(timer);
|
|
1435
|
+
setTimer(void 0);
|
|
1436
|
+
}
|
|
1437
|
+
}, [disabled, timer]);
|
|
1438
|
+
return { restartTimer, clearTimer, hasActiveTimer: !!timer };
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
// src/hooks/focus/useFocusManagement.ts
|
|
1442
|
+
var import_react7 = require("react");
|
|
1443
|
+
function useFocusManagement() {
|
|
1444
|
+
const getFocusableElements = (0, import_react7.useCallback)(() => {
|
|
1445
|
+
return Array.from(
|
|
1446
|
+
document.querySelectorAll(
|
|
1447
|
+
'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])'
|
|
1448
|
+
)
|
|
1449
|
+
).filter(
|
|
1450
|
+
(el) => el instanceof HTMLElement && !el.hasAttribute("disabled") && !el.hasAttribute("hidden") && el.tabIndex !== -1
|
|
1451
|
+
);
|
|
1452
|
+
}, []);
|
|
1453
|
+
const getNextFocusElement = (0, import_react7.useCallback)(() => {
|
|
1454
|
+
const elements = getFocusableElements();
|
|
1455
|
+
if (elements.length === 0) {
|
|
1456
|
+
return void 0;
|
|
1457
|
+
}
|
|
1458
|
+
let nextElement = elements[0];
|
|
1459
|
+
if (document.activeElement instanceof HTMLElement) {
|
|
1460
|
+
const currentIndex = elements.indexOf(document.activeElement);
|
|
1461
|
+
nextElement = elements[(currentIndex + 1) % elements.length];
|
|
1462
|
+
}
|
|
1463
|
+
return nextElement;
|
|
1464
|
+
}, [getFocusableElements]);
|
|
1465
|
+
const focusNext = (0, import_react7.useCallback)(() => {
|
|
1466
|
+
const nextElement = getNextFocusElement();
|
|
1467
|
+
nextElement?.focus();
|
|
1468
|
+
}, [getNextFocusElement]);
|
|
1469
|
+
const getPreviousFocusElement = (0, import_react7.useCallback)(() => {
|
|
1470
|
+
const elements = getFocusableElements();
|
|
1471
|
+
if (elements.length === 0) {
|
|
1472
|
+
return void 0;
|
|
1473
|
+
}
|
|
1474
|
+
let previousElement = elements[0];
|
|
1475
|
+
if (document.activeElement instanceof HTMLElement) {
|
|
1476
|
+
const currentIndex = elements.indexOf(document.activeElement);
|
|
1477
|
+
if (currentIndex === 0) {
|
|
1478
|
+
previousElement = elements[elements.length - 1];
|
|
1479
|
+
} else {
|
|
1480
|
+
previousElement = elements[currentIndex - 1];
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
return previousElement;
|
|
1484
|
+
}, [getFocusableElements]);
|
|
1485
|
+
const focusPrevious = (0, import_react7.useCallback)(() => {
|
|
1486
|
+
const previousElement = getPreviousFocusElement();
|
|
1487
|
+
if (previousElement) previousElement.focus();
|
|
1488
|
+
}, [getPreviousFocusElement]);
|
|
1489
|
+
return {
|
|
1490
|
+
getFocusableElements,
|
|
1491
|
+
getNextFocusElement,
|
|
1492
|
+
getPreviousFocusElement,
|
|
1493
|
+
focusNext,
|
|
1494
|
+
focusPrevious
|
|
1495
|
+
};
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
// src/components/user-action/input/Input.tsx
|
|
1499
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1500
|
+
var defaultEditCompleteOptions = {
|
|
1501
|
+
allowEnterComplete: false,
|
|
1502
|
+
onBlur: true,
|
|
1503
|
+
afterDelay: true,
|
|
1504
|
+
delay: 2500
|
|
1505
|
+
};
|
|
1506
|
+
var Input = (0, import_react8.forwardRef)(function Input2({
|
|
1507
|
+
value,
|
|
1508
|
+
onChange,
|
|
1509
|
+
onChangeText,
|
|
1510
|
+
onEditCompleted,
|
|
1511
|
+
editCompleteOptions,
|
|
1512
|
+
disabled = false,
|
|
1513
|
+
invalid = false,
|
|
1514
|
+
defaultStyle = true,
|
|
1515
|
+
className,
|
|
1516
|
+
...props
|
|
1517
|
+
}, forwardedRef) {
|
|
1518
|
+
const {
|
|
1519
|
+
onBlur: allowEditCompleteOnBlur,
|
|
1520
|
+
afterDelay,
|
|
1521
|
+
delay,
|
|
1522
|
+
allowEnterComplete
|
|
1523
|
+
} = { ...defaultEditCompleteOptions, ...editCompleteOptions };
|
|
1524
|
+
const {
|
|
1525
|
+
restartTimer,
|
|
1526
|
+
clearTimer
|
|
1527
|
+
} = useDelay({ delay, disabled: !afterDelay });
|
|
1528
|
+
const innerRef = (0, import_react8.useRef)(null);
|
|
1529
|
+
(0, import_react8.useImperativeHandle)(forwardedRef, () => innerRef.current);
|
|
1530
|
+
const { focusNext } = useFocusManagement();
|
|
1531
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1532
|
+
"input",
|
|
1533
|
+
{
|
|
1534
|
+
...props,
|
|
1535
|
+
ref: innerRef,
|
|
1536
|
+
value,
|
|
1537
|
+
disabled,
|
|
1538
|
+
className: defaultStyle ? (0, import_clsx5.default)(
|
|
1539
|
+
"px-2.5 py-1.75 rounded-md border-1 text-sm",
|
|
1540
|
+
{
|
|
1541
|
+
"bg-input-background text-input-text hover:border-primary focus:border-primary": !disabled && !invalid,
|
|
1542
|
+
"bg-on-negative text-negative border-negative-border hover:border-negative-border-hover focus-visible:ring-negative-border": !disabled && invalid,
|
|
1543
|
+
"bg-disabled-background text-disabled-text border-disabled-border": disabled
|
|
1544
|
+
},
|
|
1545
|
+
className
|
|
1546
|
+
) : className,
|
|
1547
|
+
onKeyDown: (event) => {
|
|
1548
|
+
props.onKeyDown?.(event);
|
|
1549
|
+
if (!allowEnterComplete) {
|
|
1550
|
+
return;
|
|
1551
|
+
}
|
|
1552
|
+
if (event.key === "Enter" && !event.shiftKey) {
|
|
1553
|
+
event.preventDefault();
|
|
1554
|
+
innerRef.current?.blur();
|
|
1555
|
+
onEditCompleted?.(event.target.value);
|
|
1556
|
+
focusNext();
|
|
1557
|
+
}
|
|
1558
|
+
},
|
|
1559
|
+
onBlur: (event) => {
|
|
1560
|
+
props.onBlur?.(event);
|
|
1561
|
+
if (allowEditCompleteOnBlur) {
|
|
1562
|
+
onEditCompleted?.(event.target.value);
|
|
1563
|
+
clearTimer();
|
|
1564
|
+
}
|
|
1565
|
+
},
|
|
1566
|
+
onChange: (event) => {
|
|
1567
|
+
onChange?.(event);
|
|
1568
|
+
const value2 = event.target.value;
|
|
1569
|
+
restartTimer(() => {
|
|
1570
|
+
innerRef.current?.blur();
|
|
1571
|
+
onEditCompleted?.(value2);
|
|
1572
|
+
});
|
|
1573
|
+
onChangeText?.(value2);
|
|
1574
|
+
},
|
|
1575
|
+
"aria-invalid": props["aria-invalid"] ?? invalid,
|
|
1576
|
+
"aria-disabled": props["aria-disabled"] ?? disabled
|
|
1577
|
+
}
|
|
1578
|
+
);
|
|
1579
|
+
});
|
|
1580
|
+
|
|
1581
|
+
// src/components/properties/DateProperty.tsx
|
|
1582
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1583
|
+
var DateProperty = ({
|
|
1584
|
+
value,
|
|
1585
|
+
onChange = noop,
|
|
1586
|
+
onEditComplete = noop,
|
|
1587
|
+
readOnly,
|
|
1588
|
+
type = "dateTime",
|
|
1589
|
+
...baseProps
|
|
1590
|
+
}) => {
|
|
1591
|
+
const hasValue = !!value;
|
|
1592
|
+
const dateText = value ? type === "dateTime" ? formatDateTime(value) : formatDate(value) : "";
|
|
1593
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1594
|
+
PropertyBase,
|
|
1595
|
+
{
|
|
1596
|
+
...baseProps,
|
|
1597
|
+
hasValue,
|
|
1598
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react4.CalendarDays, { size: 24 }),
|
|
1599
|
+
input: ({ softRequired }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1600
|
+
Input,
|
|
1601
|
+
{
|
|
1602
|
+
className: (0, import_clsx6.default)("!ring-0 !border-0 !outline-0 !p-0 !m-0 !shadow-none !w-fit !rounded-none", { "bg-surface-warning": softRequired && !hasValue }),
|
|
1603
|
+
value: dateText,
|
|
1604
|
+
type: type === "dateTime" ? "datetime-local" : "date",
|
|
1605
|
+
readOnly,
|
|
1606
|
+
onChange: (event) => {
|
|
1607
|
+
const value2 = event.target.value;
|
|
1608
|
+
if (!value2) {
|
|
1609
|
+
event.preventDefault();
|
|
1610
|
+
return;
|
|
1611
|
+
}
|
|
1612
|
+
const dueDate = new Date(value2);
|
|
1613
|
+
onChange(dueDate);
|
|
1614
|
+
},
|
|
1615
|
+
onEditCompleted: (value2) => onEditComplete(new Date(value2))
|
|
1616
|
+
}
|
|
1617
|
+
)
|
|
1618
|
+
}
|
|
1619
|
+
);
|
|
1620
|
+
};
|
|
1621
|
+
|
|
1622
|
+
// src/components/properties/MultiSelectProperty.tsx
|
|
1623
|
+
var import_lucide_react7 = require("lucide-react");
|
|
1624
|
+
var import_clsx10 = __toESM(require("clsx"));
|
|
1625
|
+
|
|
1626
|
+
// src/components/user-action/select/Select.tsx
|
|
1627
|
+
var import_react13 = require("react");
|
|
1628
|
+
var import_clsx9 = __toESM(require("clsx"));
|
|
1629
|
+
|
|
1630
|
+
// src/components/layout/Expandable.tsx
|
|
1631
|
+
var import_react9 = require("react");
|
|
1632
|
+
var import_lucide_react5 = require("lucide-react");
|
|
1633
|
+
var import_clsx7 = __toESM(require("clsx"));
|
|
1634
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1635
|
+
var ExpansionIcon = ({ isExpanded, className }) => {
|
|
1636
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1637
|
+
import_lucide_react5.ChevronDown,
|
|
1638
|
+
{
|
|
1639
|
+
"aria-hidden": true,
|
|
1640
|
+
className: (0, import_clsx7.default)(
|
|
1641
|
+
"min-w-6 w-6 min-h-6 h-6 transition-transform motion-safe:duration-200 motion-reduce:duration-0 ease-in-out",
|
|
1642
|
+
{ "rotate-180": isExpanded },
|
|
1643
|
+
className
|
|
1644
|
+
)
|
|
1645
|
+
}
|
|
1646
|
+
);
|
|
1647
|
+
};
|
|
1648
|
+
var Expandable = (0, import_react9.forwardRef)(function Expandable2({
|
|
1649
|
+
children,
|
|
1650
|
+
id: providedId,
|
|
1651
|
+
label,
|
|
1652
|
+
icon,
|
|
1653
|
+
isExpanded = false,
|
|
1654
|
+
onChange = noop,
|
|
1655
|
+
clickOnlyOnHeader = true,
|
|
1656
|
+
disabled = false,
|
|
1657
|
+
className,
|
|
1658
|
+
headerClassName,
|
|
1659
|
+
contentClassName,
|
|
1660
|
+
contentExpandedClassName
|
|
1661
|
+
}, ref) {
|
|
1662
|
+
const defaultIcon = (0, import_react9.useCallback)((expanded) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ExpansionIcon, { isExpanded: expanded }), []);
|
|
1663
|
+
icon ??= defaultIcon;
|
|
1664
|
+
const generatedId = (0, import_react9.useId)();
|
|
1665
|
+
const id = providedId ?? generatedId;
|
|
1666
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1667
|
+
"div",
|
|
1668
|
+
{
|
|
1669
|
+
ref,
|
|
1670
|
+
onClick: () => !clickOnlyOnHeader && !disabled && onChange(!isExpanded),
|
|
1671
|
+
className: (0, import_clsx7.default)(
|
|
1672
|
+
"flex-col-0 bg-surface text-on-surface group rounded-lg shadow-sm",
|
|
1673
|
+
{ "cursor-pointer": !clickOnlyOnHeader && !disabled },
|
|
1674
|
+
className
|
|
1675
|
+
),
|
|
1676
|
+
children: [
|
|
1677
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1678
|
+
"button",
|
|
1679
|
+
{
|
|
1680
|
+
onClick: () => clickOnlyOnHeader && !disabled && onChange(!isExpanded),
|
|
1681
|
+
className: (0, import_clsx7.default)(
|
|
1682
|
+
"flex-row-2 py-2 px-4 rounded-lg justify-between items-center bg-surface text-on-surface select-none",
|
|
1683
|
+
{
|
|
1684
|
+
"group-hover:brightness-97": !isExpanded,
|
|
1685
|
+
"hover:brightness-97": isExpanded && !disabled,
|
|
1686
|
+
"cursor-pointer": clickOnlyOnHeader && !disabled
|
|
1687
|
+
},
|
|
1688
|
+
headerClassName
|
|
1689
|
+
),
|
|
1690
|
+
"aria-expanded": isExpanded,
|
|
1691
|
+
"aria-controls": `${id}-content`,
|
|
1692
|
+
"aria-disabled": disabled ?? void 0,
|
|
1693
|
+
children: [
|
|
1694
|
+
label,
|
|
1695
|
+
icon(isExpanded)
|
|
1696
|
+
]
|
|
1697
|
+
}
|
|
1698
|
+
),
|
|
1699
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1700
|
+
"div",
|
|
1701
|
+
{
|
|
1702
|
+
id: `${id}-content`,
|
|
1703
|
+
className: (0, import_clsx7.default)(
|
|
1704
|
+
"flex-col-2 px-4 transition-all duration-300 ease-in-out",
|
|
1705
|
+
{
|
|
1706
|
+
[(0, import_clsx7.default)("max-h-96 opacity-100 pb-2 overflow-y-auto", contentExpandedClassName)]: isExpanded,
|
|
1707
|
+
"max-h-0 opacity-0 overflow-hidden": !isExpanded
|
|
1708
|
+
},
|
|
1709
|
+
contentClassName
|
|
1710
|
+
),
|
|
1711
|
+
role: "region",
|
|
1712
|
+
children
|
|
1713
|
+
}
|
|
1714
|
+
)
|
|
1715
|
+
]
|
|
1716
|
+
}
|
|
1717
|
+
);
|
|
1718
|
+
});
|
|
1719
|
+
var ExpandableUncontrolled = (0, import_react9.forwardRef)(function ExpandableUncontrolled2({
|
|
1720
|
+
isExpanded,
|
|
1721
|
+
onChange = noop,
|
|
1722
|
+
...props
|
|
1723
|
+
}, ref) {
|
|
1724
|
+
const [usedIsExpanded, setUsedIsExpanded] = (0, import_react9.useState)(isExpanded);
|
|
1725
|
+
(0, import_react9.useEffect)(() => {
|
|
1726
|
+
setUsedIsExpanded(isExpanded);
|
|
1727
|
+
}, [isExpanded]);
|
|
1728
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1729
|
+
Expandable,
|
|
1730
|
+
{
|
|
1731
|
+
...props,
|
|
1732
|
+
ref,
|
|
1733
|
+
isExpanded: usedIsExpanded,
|
|
1734
|
+
onChange: (value) => {
|
|
1735
|
+
onChange(value);
|
|
1736
|
+
setUsedIsExpanded(value);
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
);
|
|
1740
|
+
});
|
|
1741
|
+
|
|
1742
|
+
// src/hooks/focus/useFocusTrap.ts
|
|
1743
|
+
var import_react11 = require("react");
|
|
1744
|
+
|
|
1745
|
+
// src/hooks/focus/useIsMounted.ts
|
|
1746
|
+
var import_react10 = require("react");
|
|
1747
|
+
var isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
1748
|
+
var useIsomorphicEffect = isClient ? import_react10.useLayoutEffect : import_react10.useEffect;
|
|
1749
|
+
var useIsMounted = () => {
|
|
1750
|
+
const [isMounted, setIsMounted] = (0, import_react10.useState)(false);
|
|
1751
|
+
useIsomorphicEffect(() => {
|
|
1752
|
+
setIsMounted(true);
|
|
1753
|
+
return () => {
|
|
1754
|
+
setIsMounted(false);
|
|
1755
|
+
};
|
|
1756
|
+
}, []);
|
|
1757
|
+
return isMounted;
|
|
1758
|
+
};
|
|
1759
|
+
|
|
1760
|
+
// src/hooks/focus/useFocusTrap.ts
|
|
1761
|
+
var createFocusGuard = () => {
|
|
1762
|
+
const div = document.createElement("div");
|
|
1763
|
+
Object.assign(div.style, {
|
|
1764
|
+
opacity: "0",
|
|
1765
|
+
outline: "none",
|
|
1766
|
+
boxShadow: "none",
|
|
1767
|
+
position: "fixed",
|
|
1768
|
+
pointerEvents: "none",
|
|
1769
|
+
touchAction: "none"
|
|
1770
|
+
});
|
|
1771
|
+
div.tabIndex = 0;
|
|
1772
|
+
div.setAttribute("data-hw-focus-guard", "");
|
|
1773
|
+
document.body.appendChild(div);
|
|
1774
|
+
return div;
|
|
1775
|
+
};
|
|
1776
|
+
function getContainedFocusableElements(element) {
|
|
1777
|
+
return element?.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
|
|
1778
|
+
}
|
|
1779
|
+
var FocusTrapService = class {
|
|
1780
|
+
constructor() {
|
|
1781
|
+
// The last entry is always the active one
|
|
1782
|
+
this.listeners = [];
|
|
1783
|
+
this.onFocusIn = (event) => {
|
|
1784
|
+
const active = this.getActive();
|
|
1785
|
+
if (!active || !active.container.current) return;
|
|
1786
|
+
const { container } = active;
|
|
1787
|
+
if (!container.current.contains(event.target)) {
|
|
1788
|
+
this.focusElement();
|
|
1789
|
+
}
|
|
1790
|
+
};
|
|
1791
|
+
}
|
|
1792
|
+
getActive() {
|
|
1793
|
+
if (this.listeners.length === 0) return void 0;
|
|
1794
|
+
return this.listeners[this.listeners.length - 1];
|
|
1795
|
+
}
|
|
1796
|
+
focusElement() {
|
|
1797
|
+
const active = this.getActive();
|
|
1798
|
+
if (!active) return;
|
|
1799
|
+
const { container, initialFocusElement } = active;
|
|
1800
|
+
const containerElement = container.current;
|
|
1801
|
+
if (initialFocusElement?.current) {
|
|
1802
|
+
initialFocusElement.current.focus();
|
|
1803
|
+
} else {
|
|
1804
|
+
const elements = getContainedFocusableElements(containerElement);
|
|
1805
|
+
if (elements && elements.length > 0) {
|
|
1806
|
+
const first = elements.item(0);
|
|
1807
|
+
first.focus();
|
|
1808
|
+
} else {
|
|
1809
|
+
containerElement.focus();
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
removeGuards() {
|
|
1814
|
+
document.querySelectorAll("[data-hw-focus-guard]").forEach((node) => node.remove());
|
|
1815
|
+
}
|
|
1816
|
+
addGuards() {
|
|
1817
|
+
document.body.insertAdjacentElement("afterbegin", createFocusGuard());
|
|
1818
|
+
document.body.insertAdjacentElement("beforeend", createFocusGuard());
|
|
1819
|
+
}
|
|
1820
|
+
activate() {
|
|
1821
|
+
document.addEventListener("focusin", this.onFocusIn);
|
|
1822
|
+
this.addGuards();
|
|
1823
|
+
}
|
|
1824
|
+
deactivate() {
|
|
1825
|
+
document.removeEventListener("focusin", this.onFocusIn);
|
|
1826
|
+
this.removeGuards();
|
|
1827
|
+
}
|
|
1828
|
+
register(listener) {
|
|
1829
|
+
this.listeners.push(listener);
|
|
1830
|
+
if (this.listeners.length === 1) {
|
|
1831
|
+
this.activate();
|
|
1832
|
+
}
|
|
1833
|
+
const active = listener;
|
|
1834
|
+
this.listeners.forEach((listener2) => {
|
|
1835
|
+
const { focus, pause } = listener2;
|
|
1836
|
+
if (listener2 === active) {
|
|
1837
|
+
focus();
|
|
1838
|
+
} else {
|
|
1839
|
+
pause();
|
|
1840
|
+
}
|
|
1841
|
+
});
|
|
1842
|
+
}
|
|
1843
|
+
unregister(id) {
|
|
1844
|
+
const index = this.listeners.findIndex((trap) => trap.id === id);
|
|
1845
|
+
if (index !== -1) {
|
|
1846
|
+
const isActive = index === this.listeners.length - 1;
|
|
1847
|
+
const listener = this.listeners[index];
|
|
1848
|
+
this.listeners = this.listeners.filter((listener2) => listener2.id !== id);
|
|
1849
|
+
if (isActive) {
|
|
1850
|
+
this.deactivate();
|
|
1851
|
+
listener.focusLast();
|
|
1852
|
+
const active = this.getActive();
|
|
1853
|
+
this.listeners.forEach((listener2) => {
|
|
1854
|
+
const { pause, unpause } = listener2;
|
|
1855
|
+
if (listener2 === active) {
|
|
1856
|
+
unpause();
|
|
1857
|
+
} else {
|
|
1858
|
+
pause();
|
|
1859
|
+
}
|
|
1860
|
+
});
|
|
1861
|
+
if (this.listeners.length > 0) {
|
|
1862
|
+
this.activate();
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
} else {
|
|
1866
|
+
console.warn(`Unable to unregister id ${id}: not found`);
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
};
|
|
1870
|
+
var service = new FocusTrapService();
|
|
1871
|
+
var useFocusTrap = ({
|
|
1872
|
+
container,
|
|
1873
|
+
active = true,
|
|
1874
|
+
initialFocus,
|
|
1875
|
+
focusFirst = true
|
|
1876
|
+
}) => {
|
|
1877
|
+
const lastFocusRef = (0, import_react11.useRef)(null);
|
|
1878
|
+
const [paused, setPaused] = (0, import_react11.useState)(false);
|
|
1879
|
+
const isMounted = useIsMounted();
|
|
1880
|
+
const id = (0, import_react11.useId)();
|
|
1881
|
+
const focusElement = (0, import_react11.useCallback)(() => {
|
|
1882
|
+
const containerElement = container.current;
|
|
1883
|
+
if (initialFocus?.current) {
|
|
1884
|
+
initialFocus.current.focus();
|
|
1885
|
+
} else {
|
|
1886
|
+
const elements = getContainedFocusableElements(containerElement);
|
|
1887
|
+
if (elements && elements.length > 0) {
|
|
1888
|
+
const first = elements.item(0);
|
|
1889
|
+
first.focus();
|
|
1890
|
+
} else {
|
|
1891
|
+
containerElement.focus();
|
|
1892
|
+
}
|
|
1893
|
+
}
|
|
1894
|
+
}, [container, initialFocus]);
|
|
1895
|
+
(0, import_react11.useEffect)(() => {
|
|
1896
|
+
if (active && isMounted) {
|
|
1897
|
+
let pause = function() {
|
|
1898
|
+
setPaused(true);
|
|
1899
|
+
}, unpause = function() {
|
|
1900
|
+
setPaused(false);
|
|
1901
|
+
if (!container.current.contains(document.activeElement)) {
|
|
1902
|
+
focusElement();
|
|
1903
|
+
}
|
|
1904
|
+
}, focus = function() {
|
|
1905
|
+
focusElement();
|
|
1906
|
+
setPaused(false);
|
|
1907
|
+
}, focusLast = function() {
|
|
1908
|
+
lastFocusRef.current?.focus();
|
|
1909
|
+
};
|
|
1910
|
+
if (!lastFocusRef.current) {
|
|
1911
|
+
lastFocusRef.current = document.activeElement;
|
|
1912
|
+
}
|
|
1913
|
+
service.register({ id, pause, focus, focusLast, unpause, container, initialFocusElement: initialFocus });
|
|
1914
|
+
return () => {
|
|
1915
|
+
service.unregister(id);
|
|
1916
|
+
lastFocusRef.current = void 0;
|
|
1917
|
+
};
|
|
1918
|
+
}
|
|
1919
|
+
}, [active, container, focusElement, id, initialFocus, isMounted]);
|
|
1920
|
+
(0, import_react11.useEffect)(() => {
|
|
1921
|
+
if (active && !paused && isMounted) {
|
|
1922
|
+
let onKeyDown = function(event) {
|
|
1923
|
+
const key = event.key;
|
|
1924
|
+
const elements = getContainedFocusableElements(containerElement);
|
|
1925
|
+
const active2 = document.activeElement;
|
|
1926
|
+
const index = [...elements].findIndex((value) => value === active2);
|
|
1927
|
+
if (index === -1 || event.altKey || event.ctrlKey || event.metaKey) {
|
|
1928
|
+
return;
|
|
1929
|
+
}
|
|
1930
|
+
if (key === "Tab") {
|
|
1931
|
+
const next = event.shiftKey ? -1 : 1;
|
|
1932
|
+
const nextIndex = (index + next + elements.length) % elements.length;
|
|
1933
|
+
const nextElement = elements[nextIndex];
|
|
1934
|
+
nextElement.focus();
|
|
1935
|
+
event.preventDefault();
|
|
1936
|
+
}
|
|
1937
|
+
};
|
|
1938
|
+
const containerElement = container.current;
|
|
1939
|
+
containerElement.addEventListener("keydown", onKeyDown);
|
|
1940
|
+
return () => {
|
|
1941
|
+
containerElement.removeEventListener("keydown", onKeyDown);
|
|
1942
|
+
};
|
|
1943
|
+
}
|
|
1944
|
+
}, [active, paused, isMounted, container, initialFocus, focusFirst, focusElement]);
|
|
1945
|
+
};
|
|
1946
|
+
|
|
1947
|
+
// src/utils/match.ts
|
|
1948
|
+
var match = (key, values) => {
|
|
1949
|
+
return values[key];
|
|
1950
|
+
};
|
|
1951
|
+
|
|
1952
|
+
// src/components/user-action/select/Select.tsx
|
|
1953
|
+
var import_lucide_react6 = require("lucide-react");
|
|
1954
|
+
|
|
1955
|
+
// src/components/layout/Chip.tsx
|
|
1956
|
+
var import_clsx8 = __toESM(require("clsx"));
|
|
1957
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1958
|
+
var Chip = ({
|
|
1959
|
+
children,
|
|
1960
|
+
trailingIcon,
|
|
1961
|
+
color = "default",
|
|
1962
|
+
size = "md",
|
|
1963
|
+
icon = false,
|
|
1964
|
+
variant = "normal",
|
|
1965
|
+
className = "",
|
|
1966
|
+
...restProps
|
|
1967
|
+
}) => {
|
|
1968
|
+
const colorMapping = {
|
|
1969
|
+
default: "text-tag-default-text bg-tag-default-background",
|
|
1970
|
+
dark: "text-tag-dark-text bg-tag-dark-background",
|
|
1971
|
+
red: "text-tag-red-text bg-tag-red-background",
|
|
1972
|
+
yellow: "text-tag-yellow-text bg-tag-yellow-background",
|
|
1973
|
+
green: "text-tag-green-text bg-tag-green-background",
|
|
1974
|
+
blue: "text-tag-blue-text bg-tag-blue-background",
|
|
1975
|
+
pink: "text-tag-pink-text bg-tag-pink-background",
|
|
1976
|
+
orange: "text-tag-orange-text bg-tag-orange-background"
|
|
1977
|
+
}[color];
|
|
1978
|
+
const colorMappingIcon = {
|
|
1979
|
+
default: "text-tag-default-icon",
|
|
1980
|
+
dark: "text-tag-dark-icon",
|
|
1981
|
+
red: "text-tag-red-icon",
|
|
1982
|
+
yellow: "text-tag-yellow-icon",
|
|
1983
|
+
green: "text-tag-green-icon",
|
|
1984
|
+
blue: "text-tag-blue-icon",
|
|
1985
|
+
pink: "text-tag-pink-icon",
|
|
1986
|
+
orange: "text-tag-orange-icon"
|
|
1987
|
+
}[color];
|
|
1988
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1989
|
+
"div",
|
|
1990
|
+
{
|
|
1991
|
+
...restProps,
|
|
1992
|
+
className: (0, import_clsx8.default)(
|
|
1993
|
+
`flex-row-0 w-fit font-semibold`,
|
|
1994
|
+
colorMapping,
|
|
1995
|
+
!icon ? {
|
|
1996
|
+
"px-1 py-0.5": size === "sm",
|
|
1997
|
+
"px-2 py-1": size === "md",
|
|
1998
|
+
"px-4 py-2": size === "lg"
|
|
1999
|
+
} : {
|
|
2000
|
+
"p-0.5": size === "sm",
|
|
2001
|
+
"p-1": size === "md",
|
|
2002
|
+
"p-2": size === "lg"
|
|
2003
|
+
},
|
|
2004
|
+
{
|
|
2005
|
+
"rounded-md": variant === "normal",
|
|
2006
|
+
"rounded-full": variant === "fullyRounded"
|
|
2007
|
+
},
|
|
2008
|
+
className
|
|
2009
|
+
),
|
|
2010
|
+
children: [
|
|
2011
|
+
children,
|
|
2012
|
+
trailingIcon && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: colorMappingIcon, children: trailingIcon })
|
|
2013
|
+
]
|
|
2014
|
+
}
|
|
2015
|
+
);
|
|
2016
|
+
};
|
|
2017
|
+
|
|
2018
|
+
// src/hooks/useFloatingElement.ts
|
|
2019
|
+
var import_react12 = require("react");
|
|
2020
|
+
|
|
2021
|
+
// src/utils/math.ts
|
|
2022
|
+
var clamp = (value, range = [0, 1]) => {
|
|
2023
|
+
const [min, max] = range;
|
|
2024
|
+
return Math.min(Math.max(value, min), max);
|
|
2025
|
+
};
|
|
2026
|
+
|
|
2027
|
+
// src/hooks/useFloatingElement.ts
|
|
2028
|
+
function calculatePosition({
|
|
2029
|
+
windowRect,
|
|
2030
|
+
containerRect,
|
|
2031
|
+
anchorRect,
|
|
2032
|
+
options
|
|
2033
|
+
}) {
|
|
2034
|
+
const { verticalAlignment, horizontalAlignment, gap, screenPadding } = options;
|
|
2035
|
+
const windowWidth = windowRect.width;
|
|
2036
|
+
const windowHeight = windowRect.height;
|
|
2037
|
+
const maxWidth = windowWidth - 2 * screenPadding;
|
|
2038
|
+
const maxHeight = windowHeight - 2 * screenPadding;
|
|
2039
|
+
const width = Math.min(containerRect.width, maxWidth);
|
|
2040
|
+
const height = Math.min(containerRect.height, maxHeight);
|
|
2041
|
+
const leftSuggestion = {
|
|
2042
|
+
beforeStart: anchorRect.left - width - gap,
|
|
2043
|
+
afterStart: anchorRect.left,
|
|
2044
|
+
center: anchorRect.left + anchorRect.width / 2 - width / 2,
|
|
2045
|
+
beforeEnd: anchorRect.right - width,
|
|
2046
|
+
afterEnd: anchorRect.right + gap
|
|
2047
|
+
}[horizontalAlignment];
|
|
2048
|
+
const topSuggestion = {
|
|
2049
|
+
beforeStart: anchorRect.top - height - gap,
|
|
2050
|
+
afterStart: anchorRect.top,
|
|
2051
|
+
center: anchorRect.top + anchorRect.height / 2 - height / 2,
|
|
2052
|
+
beforeEnd: anchorRect.bottom - height,
|
|
2053
|
+
afterEnd: anchorRect.bottom + gap
|
|
2054
|
+
}[verticalAlignment];
|
|
2055
|
+
const left = clamp(leftSuggestion, [
|
|
2056
|
+
screenPadding,
|
|
2057
|
+
windowWidth - screenPadding - width
|
|
2058
|
+
]);
|
|
2059
|
+
const top = clamp(topSuggestion, [
|
|
2060
|
+
screenPadding,
|
|
2061
|
+
windowHeight - screenPadding - height
|
|
2062
|
+
]);
|
|
2063
|
+
return {
|
|
2064
|
+
left,
|
|
2065
|
+
top,
|
|
2066
|
+
maxWidth,
|
|
2067
|
+
maxHeight
|
|
2068
|
+
};
|
|
2069
|
+
}
|
|
2070
|
+
function useFloatingElement({
|
|
2071
|
+
active = true,
|
|
2072
|
+
windowRef,
|
|
2073
|
+
anchorRef,
|
|
2074
|
+
containerRef,
|
|
2075
|
+
isPolling = false,
|
|
2076
|
+
pollingInterval = 100,
|
|
2077
|
+
verticalAlignment = "afterEnd",
|
|
2078
|
+
horizontalAlignment = "afterStart",
|
|
2079
|
+
screenPadding = 16,
|
|
2080
|
+
gap = 4
|
|
2081
|
+
}) {
|
|
2082
|
+
const [style, setStyle] = (0, import_react12.useState)();
|
|
2083
|
+
const isMounted = useIsMounted();
|
|
2084
|
+
const calculate = (0, import_react12.useCallback)(() => {
|
|
2085
|
+
const containerRect = containerRef.current.getBoundingClientRect();
|
|
2086
|
+
const windowRect = windowRef?.current.getBoundingClientRect() ?? {
|
|
2087
|
+
top: 0,
|
|
2088
|
+
bottom: window.innerHeight,
|
|
2089
|
+
left: 0,
|
|
2090
|
+
right: window.innerWidth,
|
|
2091
|
+
width: window.innerWidth,
|
|
2092
|
+
height: window.innerHeight
|
|
2093
|
+
};
|
|
2094
|
+
const anchorElement = anchorRef?.current;
|
|
2095
|
+
if (anchorRef && !anchorElement) {
|
|
2096
|
+
console.warn("FloatingContainer anchor provided, but its value is undefined");
|
|
2097
|
+
}
|
|
2098
|
+
const anchorRect = anchorElement?.getBoundingClientRect() ?? windowRect;
|
|
2099
|
+
const calculateProps = {
|
|
2100
|
+
windowRect,
|
|
2101
|
+
anchorRect,
|
|
2102
|
+
containerRect,
|
|
2103
|
+
options: {
|
|
2104
|
+
horizontalAlignment,
|
|
2105
|
+
verticalAlignment,
|
|
2106
|
+
screenPadding,
|
|
2107
|
+
gap
|
|
2108
|
+
}
|
|
2109
|
+
};
|
|
2110
|
+
setStyle(calculatePosition(calculateProps));
|
|
2111
|
+
}, [anchorRef, containerRef, gap, horizontalAlignment, screenPadding, verticalAlignment, windowRef]);
|
|
2112
|
+
const height = containerRef.current?.getBoundingClientRect().height;
|
|
2113
|
+
const width = containerRef.current?.getBoundingClientRect().width;
|
|
2114
|
+
(0, import_react12.useEffect)(() => {
|
|
2115
|
+
if (active && isMounted) {
|
|
2116
|
+
calculate();
|
|
2117
|
+
} else {
|
|
2118
|
+
setStyle(void 0);
|
|
2119
|
+
}
|
|
2120
|
+
}, [calculate, active, isMounted, height, width]);
|
|
2121
|
+
(0, import_react12.useEffect)(() => {
|
|
2122
|
+
window.addEventListener("resize", calculate);
|
|
2123
|
+
let timeout;
|
|
2124
|
+
if (isPolling) {
|
|
2125
|
+
timeout = setInterval(calculate, pollingInterval);
|
|
2126
|
+
}
|
|
2127
|
+
return () => {
|
|
2128
|
+
window.removeEventListener("resize", calculate);
|
|
2129
|
+
if (timeout) {
|
|
2130
|
+
clearInterval(timeout);
|
|
2131
|
+
}
|
|
2132
|
+
};
|
|
2133
|
+
}, [calculate, isPolling, pollingInterval]);
|
|
2134
|
+
return style;
|
|
2135
|
+
}
|
|
2136
|
+
|
|
2137
|
+
// src/components/user-action/select/Select.tsx
|
|
2138
|
+
var import_react_dom = require("react-dom");
|
|
2139
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2140
|
+
var defaultToggleOpenOptions = {
|
|
2141
|
+
highlightStartPosition: "first"
|
|
2142
|
+
};
|
|
2143
|
+
var SelectContext = (0, import_react13.createContext)(null);
|
|
2144
|
+
function useSelectContext() {
|
|
2145
|
+
const ctx = (0, import_react13.useContext)(SelectContext);
|
|
2146
|
+
if (!ctx) {
|
|
2147
|
+
throw new Error("SelectContext must be used within a ListBoxPrimitive");
|
|
2148
|
+
}
|
|
2149
|
+
return ctx;
|
|
2150
|
+
}
|
|
2151
|
+
var SelectRoot = ({
|
|
2152
|
+
children,
|
|
2153
|
+
id,
|
|
2154
|
+
value,
|
|
2155
|
+
onValueChanged,
|
|
2156
|
+
values,
|
|
2157
|
+
onValuesChanged,
|
|
2158
|
+
isOpen = false,
|
|
2159
|
+
disabled = false,
|
|
2160
|
+
invalid = false,
|
|
2161
|
+
isMultiSelect = false,
|
|
2162
|
+
iconAppearance = "left"
|
|
2163
|
+
}) => {
|
|
2164
|
+
const optionsRef = (0, import_react13.useRef)([]);
|
|
2165
|
+
const triggerRef = (0, import_react13.useRef)(null);
|
|
2166
|
+
const generatedId = (0, import_react13.useId)();
|
|
2167
|
+
const usedId = id ?? generatedId;
|
|
2168
|
+
const [internalState, setInternalState] = (0, import_react13.useState)({
|
|
2169
|
+
isOpen
|
|
2170
|
+
});
|
|
2171
|
+
const state = {
|
|
2172
|
+
...internalState,
|
|
2173
|
+
id: usedId,
|
|
2174
|
+
disabled,
|
|
2175
|
+
invalid,
|
|
2176
|
+
value: isMultiSelect ? values ?? [] : [value].filter(Boolean)
|
|
2177
|
+
};
|
|
2178
|
+
const config = {
|
|
2179
|
+
isMultiSelect,
|
|
2180
|
+
iconAppearance
|
|
2181
|
+
};
|
|
2182
|
+
const registerItem = (0, import_react13.useCallback)((item) => {
|
|
2183
|
+
optionsRef.current.push(item);
|
|
2184
|
+
optionsRef.current.sort((a, b) => {
|
|
2185
|
+
const aEl = a.ref.current;
|
|
2186
|
+
const bEl = b.ref.current;
|
|
2187
|
+
if (!aEl || !bEl) return 0;
|
|
2188
|
+
return aEl.compareDocumentPosition(bEl) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
|
|
2189
|
+
});
|
|
2190
|
+
}, []);
|
|
2191
|
+
const unregisterItem = (0, import_react13.useCallback)((value2) => {
|
|
2192
|
+
optionsRef.current = optionsRef.current.filter((i) => i.value !== value2);
|
|
2193
|
+
}, []);
|
|
2194
|
+
const toggleSelection = (value2, isSelected) => {
|
|
2195
|
+
if (disabled) {
|
|
2196
|
+
return;
|
|
2197
|
+
}
|
|
2198
|
+
const option = optionsRef.current.find((i) => i.value === value2);
|
|
2199
|
+
if (!option) {
|
|
2200
|
+
console.error(`SelectOption with value: ${value2} not found`);
|
|
2201
|
+
return;
|
|
2202
|
+
}
|
|
2203
|
+
let newValue;
|
|
2204
|
+
if (isMultiSelect) {
|
|
2205
|
+
const isSelectedBefore = state.value.includes(value2);
|
|
2206
|
+
const isSelectedAfter = isSelected ?? !isSelectedBefore;
|
|
2207
|
+
if (!isSelectedAfter) {
|
|
2208
|
+
newValue = state.value.filter((v) => v !== value2);
|
|
2209
|
+
} else {
|
|
2210
|
+
newValue = [...state.value, value2];
|
|
2211
|
+
}
|
|
2212
|
+
} else {
|
|
2213
|
+
newValue = [value2];
|
|
2214
|
+
}
|
|
2215
|
+
if (!isMultiSelect) {
|
|
2216
|
+
onValueChanged?.(newValue[0]);
|
|
2217
|
+
} else {
|
|
2218
|
+
onValuesChanged?.(newValue);
|
|
2219
|
+
}
|
|
2220
|
+
setInternalState((prevState) => ({
|
|
2221
|
+
...prevState,
|
|
2222
|
+
highlightedValue: value2
|
|
2223
|
+
}));
|
|
2224
|
+
};
|
|
2225
|
+
const highlightItem = (value2) => {
|
|
2226
|
+
if (disabled) {
|
|
2227
|
+
return;
|
|
2228
|
+
}
|
|
2229
|
+
setInternalState((prevState) => ({
|
|
2230
|
+
...prevState,
|
|
2231
|
+
highlightedValue: value2
|
|
2232
|
+
}));
|
|
2233
|
+
};
|
|
2234
|
+
const registerTrigger = (0, import_react13.useCallback)((ref) => {
|
|
2235
|
+
triggerRef.current = ref.current;
|
|
2236
|
+
}, []);
|
|
2237
|
+
const unregisterTrigger = (0, import_react13.useCallback)(() => {
|
|
2238
|
+
triggerRef.current = null;
|
|
2239
|
+
}, []);
|
|
2240
|
+
const toggleOpen = (isOpen2, options) => {
|
|
2241
|
+
const { highlightStartPosition } = { ...defaultToggleOpenOptions, ...options };
|
|
2242
|
+
let highlightedIndex;
|
|
2243
|
+
if (highlightStartPosition === "first") {
|
|
2244
|
+
highlightedIndex = optionsRef.current.findIndex((option) => !option.disabled);
|
|
2245
|
+
} else {
|
|
2246
|
+
highlightedIndex = optionsRef.current.length - 1 - [...optionsRef.current].reverse().findIndex((option) => !option.disabled);
|
|
2247
|
+
}
|
|
2248
|
+
if (highlightedIndex === -1 || highlightedIndex === optionsRef.current.length) {
|
|
2249
|
+
highlightedIndex = 0;
|
|
2250
|
+
}
|
|
2251
|
+
setInternalState((prevState) => ({
|
|
2252
|
+
...prevState,
|
|
2253
|
+
isOpen: isOpen2 ?? !prevState.isOpen,
|
|
2254
|
+
highlightedValue: optionsRef.current[highlightedIndex].value
|
|
2255
|
+
}));
|
|
2256
|
+
};
|
|
2257
|
+
const moveHighlightedIndex = (delta) => {
|
|
2258
|
+
let highlightedIndex = optionsRef.current.findIndex((value2) => value2.value === internalState.highlightedValue);
|
|
2259
|
+
if (highlightedIndex === -1) {
|
|
2260
|
+
highlightedIndex = 0;
|
|
2261
|
+
}
|
|
2262
|
+
const optionLength = optionsRef.current.length;
|
|
2263
|
+
const startIndex = (highlightedIndex + delta % optionLength + optionLength) % optionLength;
|
|
2264
|
+
const isForward = delta >= 0;
|
|
2265
|
+
let highlightedValue = optionsRef.current[startIndex].value;
|
|
2266
|
+
for (let i = 0; i < optionsRef.current.length; i++) {
|
|
2267
|
+
const index = (startIndex + (isForward ? i : -i) + optionLength) % optionLength;
|
|
2268
|
+
if (!optionsRef.current[index].disabled) {
|
|
2269
|
+
highlightedValue = optionsRef.current[index].value;
|
|
2270
|
+
break;
|
|
2271
|
+
}
|
|
2272
|
+
}
|
|
2273
|
+
setInternalState((prevState) => ({
|
|
2274
|
+
...prevState,
|
|
2275
|
+
highlightedValue
|
|
2276
|
+
}));
|
|
2277
|
+
};
|
|
2278
|
+
(0, import_react13.useEffect)(() => {
|
|
2279
|
+
if (!internalState.highlightedValue) return;
|
|
2280
|
+
const highlighted = optionsRef.current.find((value2) => value2.value === internalState.highlightedValue);
|
|
2281
|
+
if (highlighted) {
|
|
2282
|
+
highlighted.ref.current.scrollIntoView({ behavior: "instant", block: "nearest" });
|
|
2283
|
+
} else {
|
|
2284
|
+
console.error(`SelectRoot: Could not find highlighted value (${internalState.highlightedValue})`);
|
|
2285
|
+
}
|
|
2286
|
+
}, [internalState.highlightedValue]);
|
|
2287
|
+
const contextValue = {
|
|
2288
|
+
state,
|
|
2289
|
+
config,
|
|
2290
|
+
item: {
|
|
2291
|
+
register: registerItem,
|
|
2292
|
+
unregister: unregisterItem,
|
|
2293
|
+
toggleSelection,
|
|
2294
|
+
highlightItem,
|
|
2295
|
+
moveHighlightedIndex
|
|
2296
|
+
},
|
|
2297
|
+
trigger: {
|
|
2298
|
+
ref: triggerRef,
|
|
2299
|
+
register: registerTrigger,
|
|
2300
|
+
unregister: unregisterTrigger,
|
|
2301
|
+
toggleOpen
|
|
2302
|
+
}
|
|
2303
|
+
};
|
|
2304
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SelectContext.Provider, { value: contextValue, children });
|
|
2305
|
+
};
|
|
2306
|
+
var SelectOption = (0, import_react13.forwardRef)(
|
|
2307
|
+
function SelectOption2({ children, value, disabled = false, iconAppearance, className, ...restProps }, ref) {
|
|
2308
|
+
const { state, config, item, trigger } = useSelectContext();
|
|
2309
|
+
const { register, unregister, toggleSelection, highlightItem } = item;
|
|
2310
|
+
const itemRef = (0, import_react13.useRef)(null);
|
|
2311
|
+
iconAppearance ??= config.iconAppearance;
|
|
2312
|
+
(0, import_react13.useEffect)(() => {
|
|
2313
|
+
register({
|
|
2314
|
+
value,
|
|
2315
|
+
disabled,
|
|
2316
|
+
ref: itemRef
|
|
2317
|
+
});
|
|
2318
|
+
return () => unregister(value);
|
|
2319
|
+
}, [value, disabled, register, unregister, children]);
|
|
2320
|
+
const isHighlighted = state.highlightedValue === value;
|
|
2321
|
+
const isSelected = state.value.includes(value);
|
|
2322
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2323
|
+
"li",
|
|
2324
|
+
{
|
|
2325
|
+
...restProps,
|
|
2326
|
+
ref: (node) => {
|
|
2327
|
+
itemRef.current = node;
|
|
2328
|
+
if (typeof ref === "function") ref(node);
|
|
2329
|
+
else if (ref) ref.current = node;
|
|
2330
|
+
},
|
|
2331
|
+
id: value,
|
|
2332
|
+
role: "option",
|
|
2333
|
+
"aria-disabled": disabled,
|
|
2334
|
+
"aria-selected": isSelected,
|
|
2335
|
+
"data-highlighted": isHighlighted ? "" : void 0,
|
|
2336
|
+
"data-selected": isSelected ? "" : void 0,
|
|
2337
|
+
"data-disabled": disabled ? "" : void 0,
|
|
2338
|
+
className: (0, import_clsx9.default)(
|
|
2339
|
+
"flex-row-1 items-center px-2 py-1 rounded-md",
|
|
2340
|
+
"data-highlighted:bg-primary/20",
|
|
2341
|
+
"data-disabled:text-disabled data-disabled:cursor-not-allowed",
|
|
2342
|
+
"not-data-disabled:cursor-pointer",
|
|
2343
|
+
className
|
|
2344
|
+
),
|
|
2345
|
+
onClick: (event) => {
|
|
2346
|
+
if (!disabled) {
|
|
2347
|
+
toggleSelection(value);
|
|
2348
|
+
if (!config.isMultiSelect) {
|
|
2349
|
+
trigger.toggleOpen(false);
|
|
2350
|
+
}
|
|
2351
|
+
restProps.onClick?.(event);
|
|
2352
|
+
}
|
|
2353
|
+
},
|
|
2354
|
+
onMouseEnter: (event) => {
|
|
2355
|
+
if (!disabled) {
|
|
2356
|
+
highlightItem(value);
|
|
2357
|
+
restProps.onMouseEnter?.(event);
|
|
2358
|
+
}
|
|
2359
|
+
},
|
|
2360
|
+
children: [
|
|
2361
|
+
iconAppearance === "left" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2362
|
+
import_lucide_react6.CheckIcon,
|
|
2363
|
+
{
|
|
2364
|
+
className: (0, import_clsx9.default)("w-4 h-4", { "opacity-0": !isSelected || disabled }),
|
|
2365
|
+
"aria-hidden": true
|
|
2366
|
+
}
|
|
2367
|
+
),
|
|
2368
|
+
children ?? value,
|
|
2369
|
+
iconAppearance === "right" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2370
|
+
import_lucide_react6.CheckIcon,
|
|
2371
|
+
{
|
|
2372
|
+
className: (0, import_clsx9.default)("w-4 h-4", { "opacity-0": !isSelected || disabled }),
|
|
2373
|
+
"aria-hidden": true
|
|
2374
|
+
}
|
|
2375
|
+
)
|
|
2376
|
+
]
|
|
2377
|
+
}
|
|
2378
|
+
);
|
|
2379
|
+
}
|
|
2380
|
+
);
|
|
2381
|
+
var defaultSelectButtonTranslation = {
|
|
2382
|
+
en: {
|
|
2383
|
+
clickToSelect: "Click to select"
|
|
2384
|
+
},
|
|
2385
|
+
de: {
|
|
2386
|
+
clickToSelect: "Zum ausw\xE4hlen dr\xFCcken"
|
|
2387
|
+
}
|
|
2388
|
+
};
|
|
2389
|
+
var SelectButton = (0, import_react13.forwardRef)(function SelectButton2({ placeholder, selectedDisplay, ...props }, ref) {
|
|
2390
|
+
const translation = useTranslation([defaultSelectButtonTranslation]);
|
|
2391
|
+
const { state, trigger } = useSelectContext();
|
|
2392
|
+
const { register, unregister, toggleOpen } = trigger;
|
|
2393
|
+
const innerRef = (0, import_react13.useRef)(null);
|
|
2394
|
+
(0, import_react13.useImperativeHandle)(ref, () => innerRef.current);
|
|
2395
|
+
(0, import_react13.useEffect)(() => {
|
|
2396
|
+
register(innerRef);
|
|
2397
|
+
return () => unregister();
|
|
2398
|
+
}, [register, unregister]);
|
|
2399
|
+
const disabled = !!props?.disabled || !!state.disabled;
|
|
2400
|
+
const invalid = state.invalid;
|
|
2401
|
+
const hasValue = state.value.length > 0;
|
|
2402
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2403
|
+
"button",
|
|
2404
|
+
{
|
|
2405
|
+
...props,
|
|
2406
|
+
ref: innerRef,
|
|
2407
|
+
id: state.id,
|
|
2408
|
+
className: (0, import_clsx9.default)(
|
|
2409
|
+
"flex-row-2 items-center justify-between bg-input-background text-input-text rounded-md px-2.5 py-2.5",
|
|
2410
|
+
"data-placeholder:text-description",
|
|
2411
|
+
props.className
|
|
2412
|
+
),
|
|
2413
|
+
onClick: () => toggleOpen(!state.isOpen),
|
|
2414
|
+
onKeyDown: (event) => {
|
|
2415
|
+
switch (event.key) {
|
|
2416
|
+
case "ArrowDown":
|
|
2417
|
+
toggleOpen(true, { highlightStartPosition: "first" });
|
|
2418
|
+
break;
|
|
2419
|
+
case "ArrowUp":
|
|
2420
|
+
toggleOpen(true, { highlightStartPosition: "last" });
|
|
2421
|
+
break;
|
|
2422
|
+
}
|
|
2423
|
+
},
|
|
2424
|
+
"data-placeholder": !hasValue ? "" : void 0,
|
|
2425
|
+
"data-disabled": disabled ? "" : void 0,
|
|
2426
|
+
"data-invalid": invalid ? "" : void 0,
|
|
2427
|
+
"aria-invalid": invalid,
|
|
2428
|
+
"aria-disabled": disabled,
|
|
2429
|
+
"aria-haspopup": "listbox",
|
|
2430
|
+
"aria-expanded": state.isOpen,
|
|
2431
|
+
"aria-controls": state.isOpen ? `${state.id}-listbox` : void 0,
|
|
2432
|
+
children: [
|
|
2433
|
+
hasValue ? selectedDisplay?.(state.value) ?? state.value.join(", ") : placeholder ?? translation("clickToSelect"),
|
|
2434
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ExpansionIcon, { isExpanded: state.isOpen })
|
|
2435
|
+
]
|
|
2436
|
+
}
|
|
2437
|
+
);
|
|
2438
|
+
});
|
|
2439
|
+
var SelectChipDisplay = (0, import_react13.forwardRef)(function SelectChipDisplay2({ ...props }, ref) {
|
|
2440
|
+
const { state, trigger, item } = useSelectContext();
|
|
2441
|
+
const { register, unregister, toggleOpen } = trigger;
|
|
2442
|
+
const innerRef = (0, import_react13.useRef)(null);
|
|
2443
|
+
(0, import_react13.useImperativeHandle)(ref, () => innerRef.current);
|
|
2444
|
+
(0, import_react13.useEffect)(() => {
|
|
2445
|
+
register(innerRef);
|
|
2446
|
+
return () => unregister();
|
|
2447
|
+
}, [register, unregister]);
|
|
2448
|
+
const disabled = !!props?.disabled || !!state.disabled;
|
|
2449
|
+
const invalid = state.invalid;
|
|
2450
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2451
|
+
"div",
|
|
2452
|
+
{
|
|
2453
|
+
...props,
|
|
2454
|
+
ref: innerRef,
|
|
2455
|
+
className: (0, import_clsx9.default)(
|
|
2456
|
+
"flex flex-wrap flex-row gap-2 items-center bg-input-background text-input-text rounded-md px-2.5 py-2.5",
|
|
2457
|
+
props.className
|
|
2458
|
+
),
|
|
2459
|
+
"data-disabled": disabled ? "" : void 0,
|
|
2460
|
+
"data-invalid": invalid ? "" : void 0,
|
|
2461
|
+
"aria-invalid": invalid,
|
|
2462
|
+
"aria-disabled": disabled,
|
|
2463
|
+
children: [
|
|
2464
|
+
state.value.map((value) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Chip, { className: "gap-x-2", children: [
|
|
2465
|
+
value,
|
|
2466
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2467
|
+
"button",
|
|
2468
|
+
{
|
|
2469
|
+
onClick: () => {
|
|
2470
|
+
item.toggleSelection(value, false);
|
|
2471
|
+
},
|
|
2472
|
+
className: "focus-within:text-negative hover:bg-negative/20 hover:text-negative rounded-md focus-style-none focus-visible:ring-2 focus-visible:ring-negative focus-visible:bg-negative/20",
|
|
2473
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react6.XIcon, {})
|
|
2474
|
+
}
|
|
2475
|
+
)
|
|
2476
|
+
] }, value)),
|
|
2477
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2478
|
+
IconButton,
|
|
2479
|
+
{
|
|
2480
|
+
id: state.id,
|
|
2481
|
+
onClick: () => toggleOpen(),
|
|
2482
|
+
onKeyDown: (event) => {
|
|
2483
|
+
switch (event.key) {
|
|
2484
|
+
case "ArrowDown":
|
|
2485
|
+
toggleOpen(true, { highlightStartPosition: "first" });
|
|
2486
|
+
break;
|
|
2487
|
+
case "ArrowUp":
|
|
2488
|
+
toggleOpen(true, { highlightStartPosition: "last" });
|
|
2489
|
+
}
|
|
2490
|
+
},
|
|
2491
|
+
size: "small",
|
|
2492
|
+
color: "neutral",
|
|
2493
|
+
"aria-invalid": invalid,
|
|
2494
|
+
"aria-disabled": disabled,
|
|
2495
|
+
"aria-haspopup": "listbox",
|
|
2496
|
+
"aria-expanded": state.isOpen,
|
|
2497
|
+
"aria-controls": state.isOpen ? `${state.id}-listbox` : void 0,
|
|
2498
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react6.Plus, {})
|
|
2499
|
+
}
|
|
2500
|
+
)
|
|
2501
|
+
]
|
|
2502
|
+
}
|
|
2503
|
+
);
|
|
2504
|
+
});
|
|
2505
|
+
var SelectContent = (0, import_react13.forwardRef)(
|
|
2506
|
+
function SelectContent2({
|
|
2507
|
+
alignment,
|
|
2508
|
+
orientation = "vertical",
|
|
2509
|
+
...props
|
|
2510
|
+
}, ref) {
|
|
2511
|
+
const innerRef = (0, import_react13.useRef)(null);
|
|
2512
|
+
(0, import_react13.useImperativeHandle)(ref, () => innerRef.current);
|
|
2513
|
+
const { trigger, state, config, item } = useSelectContext();
|
|
2514
|
+
const position = useFloatingElement({
|
|
2515
|
+
active: state.isOpen,
|
|
2516
|
+
anchorRef: trigger.ref,
|
|
2517
|
+
containerRef: innerRef,
|
|
2518
|
+
...alignment
|
|
2519
|
+
});
|
|
2520
|
+
useFocusTrap({
|
|
2521
|
+
container: innerRef,
|
|
2522
|
+
active: state.isOpen && !!position
|
|
2523
|
+
});
|
|
2524
|
+
return (0, import_react_dom.createPortal)(
|
|
2525
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
2526
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2527
|
+
"div",
|
|
2528
|
+
{
|
|
2529
|
+
hidden: !state.isOpen,
|
|
2530
|
+
onClick: () => trigger.toggleOpen(false),
|
|
2531
|
+
className: (0, import_clsx9.default)("fixed w-screen h-screen inset-0")
|
|
2532
|
+
}
|
|
2533
|
+
),
|
|
2534
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2535
|
+
"ul",
|
|
2536
|
+
{
|
|
2537
|
+
...props,
|
|
2538
|
+
id: `${state.id}-listbox`,
|
|
2539
|
+
ref: innerRef,
|
|
2540
|
+
hidden: !state.isOpen,
|
|
2541
|
+
onKeyDown: (event) => {
|
|
2542
|
+
switch (event.key) {
|
|
2543
|
+
case "Escape":
|
|
2544
|
+
trigger.toggleOpen(false);
|
|
2545
|
+
event.preventDefault();
|
|
2546
|
+
event.stopPropagation();
|
|
2547
|
+
break;
|
|
2548
|
+
case match(orientation, {
|
|
2549
|
+
vertical: "ArrowDown",
|
|
2550
|
+
horizontal: "ArrowUp"
|
|
2551
|
+
}):
|
|
2552
|
+
item.moveHighlightedIndex(1);
|
|
2553
|
+
event.preventDefault();
|
|
2554
|
+
break;
|
|
2555
|
+
case match(orientation, {
|
|
2556
|
+
vertical: "ArrowUp",
|
|
2557
|
+
horizontal: "ArrowDown"
|
|
2558
|
+
}):
|
|
2559
|
+
item.moveHighlightedIndex(-1);
|
|
2560
|
+
event.preventDefault();
|
|
2561
|
+
break;
|
|
2562
|
+
case "Home":
|
|
2563
|
+
event.preventDefault();
|
|
2564
|
+
break;
|
|
2565
|
+
case "End":
|
|
2566
|
+
event.preventDefault();
|
|
2567
|
+
break;
|
|
2568
|
+
case "Enter":
|
|
2569
|
+
// Fall through
|
|
2570
|
+
case " ":
|
|
2571
|
+
if (state.highlightedValue) {
|
|
2572
|
+
item.toggleSelection(state.highlightedValue);
|
|
2573
|
+
if (!config.isMultiSelect) {
|
|
2574
|
+
trigger.toggleOpen(false);
|
|
2575
|
+
}
|
|
2576
|
+
event.preventDefault();
|
|
2577
|
+
}
|
|
2578
|
+
break;
|
|
2579
|
+
}
|
|
2580
|
+
},
|
|
2581
|
+
className: (0, import_clsx9.default)("flex-col-0 p-2 bg-menu-background text-menu-text rounded-md shadow-hw-bottom focus-style-within overflow-auto", props.className),
|
|
2582
|
+
style: {
|
|
2583
|
+
opacity: position ? void 0 : 0,
|
|
2584
|
+
position: "fixed",
|
|
2585
|
+
...position
|
|
2586
|
+
},
|
|
2587
|
+
role: "listbox",
|
|
2588
|
+
"aria-multiselectable": config.isMultiSelect,
|
|
2589
|
+
"aria-orientation": orientation,
|
|
2590
|
+
tabIndex: position ? 0 : void 0,
|
|
2591
|
+
children: props.children
|
|
2592
|
+
}
|
|
2593
|
+
)
|
|
2594
|
+
] }),
|
|
2595
|
+
document.body
|
|
2596
|
+
);
|
|
2597
|
+
}
|
|
2598
|
+
);
|
|
2599
|
+
var Select = (0, import_react13.forwardRef)(function Select2({
|
|
2600
|
+
children,
|
|
2601
|
+
contentPanelProps,
|
|
2602
|
+
buttonProps,
|
|
2603
|
+
...props
|
|
2604
|
+
}, ref) {
|
|
2605
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(SelectRoot, { ...props, isMultiSelect: false, children: [
|
|
2606
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2607
|
+
SelectButton,
|
|
2608
|
+
{
|
|
2609
|
+
ref,
|
|
2610
|
+
...buttonProps,
|
|
2611
|
+
selectedDisplay: (values) => {
|
|
2612
|
+
const value = values[0];
|
|
2613
|
+
if (!buttonProps?.selectedDisplay) return void 0;
|
|
2614
|
+
return buttonProps.selectedDisplay(value);
|
|
2615
|
+
}
|
|
2616
|
+
}
|
|
2617
|
+
),
|
|
2618
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SelectContent, { ...contentPanelProps, children })
|
|
2619
|
+
] });
|
|
2620
|
+
});
|
|
2621
|
+
var SelectUncontrolled = (0, import_react13.forwardRef)(function SelectUncontrolled2({
|
|
2622
|
+
value: initialValue,
|
|
2623
|
+
onValueChanged,
|
|
2624
|
+
...props
|
|
2625
|
+
}, ref) {
|
|
2626
|
+
const [value, setValue] = (0, import_react13.useState)(initialValue);
|
|
2627
|
+
(0, import_react13.useEffect)(() => {
|
|
2628
|
+
setValue(initialValue);
|
|
2629
|
+
}, [initialValue]);
|
|
2630
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2631
|
+
Select,
|
|
2632
|
+
{
|
|
2633
|
+
...props,
|
|
2634
|
+
ref,
|
|
2635
|
+
value,
|
|
2636
|
+
onValueChanged: (value2) => {
|
|
2637
|
+
setValue(value2);
|
|
2638
|
+
onValueChanged?.(value2);
|
|
2639
|
+
}
|
|
2640
|
+
}
|
|
2641
|
+
);
|
|
2642
|
+
});
|
|
2643
|
+
var MultiSelect = (0, import_react13.forwardRef)(function MultiSelect2({
|
|
2644
|
+
children,
|
|
2645
|
+
contentPanelProps,
|
|
2646
|
+
buttonProps,
|
|
2647
|
+
...props
|
|
2648
|
+
}, ref) {
|
|
2649
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(SelectRoot, { ...props, isMultiSelect: true, children: [
|
|
2650
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SelectButton, { ref, ...buttonProps }),
|
|
2651
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SelectContent, { ...contentPanelProps, children })
|
|
2652
|
+
] });
|
|
2653
|
+
});
|
|
2654
|
+
var MultiSelectUncontrolled = (0, import_react13.forwardRef)(function MultiSelectUncontrolled2({
|
|
2655
|
+
values: initialValues,
|
|
2656
|
+
onValuesChanged,
|
|
2657
|
+
...props
|
|
2658
|
+
}, ref) {
|
|
2659
|
+
const [values, setValues] = (0, import_react13.useState)(initialValues);
|
|
2660
|
+
(0, import_react13.useEffect)(() => {
|
|
2661
|
+
setValues(initialValues);
|
|
2662
|
+
}, [initialValues]);
|
|
2663
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2664
|
+
MultiSelect,
|
|
2665
|
+
{
|
|
2666
|
+
...props,
|
|
2667
|
+
ref,
|
|
2668
|
+
values,
|
|
2669
|
+
onValuesChanged: (value) => {
|
|
2670
|
+
setValues(value);
|
|
2671
|
+
onValuesChanged?.(value);
|
|
2672
|
+
}
|
|
2673
|
+
}
|
|
2674
|
+
);
|
|
2675
|
+
});
|
|
2676
|
+
var MultiSelectChipDisplay = (0, import_react13.forwardRef)(function MultiSelectChipDisplay2({
|
|
2677
|
+
children,
|
|
2678
|
+
contentPanelProps,
|
|
2679
|
+
chipDisplayProps,
|
|
2680
|
+
...props
|
|
2681
|
+
}, ref) {
|
|
2682
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(SelectRoot, { ...props, isMultiSelect: true, children: [
|
|
2683
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SelectChipDisplay, { ref, ...chipDisplayProps }),
|
|
2684
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SelectContent, { ...contentPanelProps, children })
|
|
2685
|
+
] });
|
|
2686
|
+
});
|
|
2687
|
+
var MultiSelectChipDisplayUncontrolled = (0, import_react13.forwardRef)(function MultiSelectChipDisplayUncontrolled2({
|
|
2688
|
+
values: initialValues,
|
|
2689
|
+
onValuesChanged,
|
|
2690
|
+
...props
|
|
2691
|
+
}, ref) {
|
|
2692
|
+
const [values, setValues] = (0, import_react13.useState)(initialValues);
|
|
2693
|
+
(0, import_react13.useEffect)(() => {
|
|
2694
|
+
setValues(initialValues);
|
|
2695
|
+
}, [initialValues]);
|
|
2696
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2697
|
+
MultiSelectChipDisplay,
|
|
2698
|
+
{
|
|
2699
|
+
...props,
|
|
2700
|
+
ref,
|
|
2701
|
+
values,
|
|
2702
|
+
onValuesChanged: (value) => {
|
|
2703
|
+
setValues(value);
|
|
2704
|
+
onValuesChanged?.(value);
|
|
2705
|
+
}
|
|
2706
|
+
}
|
|
2707
|
+
);
|
|
2708
|
+
});
|
|
2709
|
+
|
|
2710
|
+
// src/components/properties/MultiSelectProperty.tsx
|
|
2711
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2712
|
+
var MultiSelectProperty = ({
|
|
2713
|
+
values,
|
|
2714
|
+
options,
|
|
2715
|
+
onValuesChanged,
|
|
2716
|
+
...props
|
|
2717
|
+
}) => {
|
|
2718
|
+
const hasValue = values.length > 0;
|
|
2719
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2720
|
+
PropertyBase,
|
|
2721
|
+
{
|
|
2722
|
+
...props,
|
|
2723
|
+
hasValue,
|
|
2724
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react7.List, { size: 24 }),
|
|
2725
|
+
input: ({ softRequired }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2726
|
+
MultiSelectChipDisplay,
|
|
2727
|
+
{
|
|
2728
|
+
values,
|
|
2729
|
+
onValuesChanged,
|
|
2730
|
+
disabled: props.readOnly,
|
|
2731
|
+
contentPanelProps: {
|
|
2732
|
+
className: (0, import_clsx10.default)(
|
|
2733
|
+
"!border-none !min-h-10"
|
|
2734
|
+
)
|
|
2735
|
+
},
|
|
2736
|
+
chipDisplayProps: {
|
|
2737
|
+
className: (0, import_clsx10.default)({
|
|
2738
|
+
"!bg-warning !text-surface-warning": softRequired && !hasValue
|
|
2739
|
+
})
|
|
2740
|
+
},
|
|
2741
|
+
children: options.map((value) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SelectOption, { value }, value))
|
|
2742
|
+
}
|
|
2743
|
+
)
|
|
2744
|
+
}
|
|
2745
|
+
);
|
|
2746
|
+
};
|
|
2747
|
+
|
|
2748
|
+
// src/components/properties/NumberProperty.tsx
|
|
2749
|
+
var import_lucide_react8 = require("lucide-react");
|
|
2750
|
+
var import_clsx11 = __toESM(require("clsx"));
|
|
2751
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2752
|
+
var defaultNumberPropertyTranslation = {
|
|
2753
|
+
en: {
|
|
2754
|
+
value: "Value"
|
|
2755
|
+
},
|
|
2756
|
+
de: {
|
|
2757
|
+
value: "Wert"
|
|
2758
|
+
}
|
|
2759
|
+
};
|
|
2760
|
+
var NumberProperty = ({
|
|
2761
|
+
overwriteTranslation,
|
|
2762
|
+
value,
|
|
2763
|
+
onChange = noop,
|
|
2764
|
+
onRemove = noop,
|
|
2765
|
+
onEditComplete = noop,
|
|
2766
|
+
readOnly,
|
|
2767
|
+
suffix,
|
|
2768
|
+
...baseProps
|
|
2769
|
+
}) => {
|
|
2770
|
+
const translation = useTranslation([defaultNumberPropertyTranslation], overwriteTranslation);
|
|
2771
|
+
const hasValue = value !== void 0;
|
|
2772
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2773
|
+
PropertyBase,
|
|
2774
|
+
{
|
|
2775
|
+
...baseProps,
|
|
2776
|
+
onRemove,
|
|
2777
|
+
hasValue,
|
|
2778
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react8.Binary, { size: 24 }),
|
|
2779
|
+
input: ({ softRequired }) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2780
|
+
"div",
|
|
2781
|
+
{
|
|
2782
|
+
className: (0, import_clsx11.default)("flex-row-2 grow", { "text-warning": softRequired && !hasValue }),
|
|
2783
|
+
children: [
|
|
2784
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2785
|
+
Input,
|
|
2786
|
+
{
|
|
2787
|
+
className: (0, import_clsx11.default)("!ring-0 !border-0 !outline-0 !p-0 !m-0 !w-fit !shadow-none !rounded-none", { "bg-surface-warning placeholder-warning": softRequired && !hasValue }),
|
|
2788
|
+
value: value?.toString() ?? "",
|
|
2789
|
+
type: "number",
|
|
2790
|
+
readOnly,
|
|
2791
|
+
placeholder: `${translation("value")}...`,
|
|
2792
|
+
onChangeText: (value2) => {
|
|
2793
|
+
const numberValue = parseFloat(value2);
|
|
2794
|
+
if (isNaN(numberValue)) {
|
|
2795
|
+
onRemove();
|
|
2796
|
+
} else {
|
|
2797
|
+
onChange(numberValue);
|
|
2798
|
+
}
|
|
2799
|
+
},
|
|
2800
|
+
onEditCompleted: (value2) => {
|
|
2801
|
+
const numberValue = parseFloat(value2);
|
|
2802
|
+
if (isNaN(numberValue)) {
|
|
2803
|
+
onRemove();
|
|
2804
|
+
} else {
|
|
2805
|
+
onEditComplete(numberValue);
|
|
2806
|
+
}
|
|
2807
|
+
}
|
|
2808
|
+
}
|
|
2809
|
+
),
|
|
2810
|
+
suffix && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: (0, import_clsx11.default)("ml-1", { "bg-surface-warning": softRequired && !hasValue }), children: suffix })
|
|
2811
|
+
]
|
|
2812
|
+
}
|
|
2813
|
+
)
|
|
2814
|
+
}
|
|
2815
|
+
);
|
|
2816
|
+
};
|
|
2817
|
+
|
|
2818
|
+
// src/components/properties/SelectProperty.tsx
|
|
2819
|
+
var import_lucide_react9 = require("lucide-react");
|
|
2820
|
+
var import_clsx12 = __toESM(require("clsx"));
|
|
2821
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2822
|
+
var SingleSelectProperty = ({
|
|
2823
|
+
value,
|
|
2824
|
+
options,
|
|
2825
|
+
onValueChanged,
|
|
2826
|
+
...props
|
|
2827
|
+
}) => {
|
|
2828
|
+
const hasValue = value !== void 0;
|
|
2829
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2830
|
+
PropertyBase,
|
|
2831
|
+
{
|
|
2832
|
+
...props,
|
|
2833
|
+
hasValue,
|
|
2834
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react9.List, { size: 24 }),
|
|
2835
|
+
input: ({ softRequired }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2836
|
+
Select,
|
|
2837
|
+
{
|
|
2838
|
+
value,
|
|
2839
|
+
onValueChanged,
|
|
2840
|
+
disabled: props.readOnly,
|
|
2841
|
+
buttonProps: {
|
|
2842
|
+
className: (0, import_clsx12.default)(
|
|
2843
|
+
"border-none w-full",
|
|
2844
|
+
{
|
|
2845
|
+
"!bg-warning !text-surface-warning": softRequired && !hasValue
|
|
2846
|
+
}
|
|
2847
|
+
)
|
|
2848
|
+
},
|
|
2849
|
+
children: options.map((value2) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectOption, { value: value2 }, value2))
|
|
2850
|
+
}
|
|
2851
|
+
)
|
|
2852
|
+
}
|
|
2853
|
+
);
|
|
2854
|
+
};
|
|
2855
|
+
|
|
2856
|
+
// src/components/properties/TextProperty.tsx
|
|
2857
|
+
var import_lucide_react10 = require("lucide-react");
|
|
2858
|
+
var import_clsx14 = __toESM(require("clsx"));
|
|
2859
|
+
|
|
2860
|
+
// src/components/user-action/Textarea.tsx
|
|
2861
|
+
var import_react14 = require("react");
|
|
2862
|
+
var import_clsx13 = __toESM(require("clsx"));
|
|
2863
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2864
|
+
var Textarea = (0, import_react14.forwardRef)(function Textarea2({
|
|
2865
|
+
id,
|
|
2866
|
+
onChange,
|
|
2867
|
+
onChangeText,
|
|
2868
|
+
onBlur,
|
|
2869
|
+
onEditCompleted,
|
|
2870
|
+
saveDelayOptions,
|
|
2871
|
+
defaultStyle = true,
|
|
2872
|
+
invalid = false,
|
|
2873
|
+
disabled = false,
|
|
2874
|
+
className,
|
|
2875
|
+
...props
|
|
2876
|
+
}, ref) {
|
|
2877
|
+
const { restartTimer, clearTimer } = useDelay(saveDelayOptions);
|
|
2878
|
+
const onEditCompletedWrapper = (text) => {
|
|
2879
|
+
onEditCompleted?.(text);
|
|
2880
|
+
clearTimer();
|
|
2881
|
+
};
|
|
2882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2883
|
+
"textarea",
|
|
2884
|
+
{
|
|
2885
|
+
ref,
|
|
2886
|
+
id,
|
|
2887
|
+
className: (0, import_clsx13.default)(
|
|
2888
|
+
"resize-none w-full h-32 overflow-y-scroll",
|
|
2889
|
+
"py-2 px-3 rounded-md border-1",
|
|
2890
|
+
{
|
|
2891
|
+
"bg-input-background text-input-text hover:border-primary focus-within:border-primary focus-within:ring-2 ring-focus": !disabled && !invalid,
|
|
2892
|
+
"bg-on-negative text-negative border-negative-border hover:border-negative-border-hover focus-visible:ring-negative-border": invalid && !disabled && defaultStyle,
|
|
2893
|
+
"text-disabled-text bg-disabled-background border-disabled-border": disabled && defaultStyle
|
|
2894
|
+
},
|
|
2895
|
+
className
|
|
2896
|
+
),
|
|
2897
|
+
onChange: (event) => {
|
|
2898
|
+
const value = event.target.value;
|
|
2899
|
+
restartTimer(() => {
|
|
2900
|
+
onEditCompletedWrapper(value);
|
|
2901
|
+
});
|
|
2902
|
+
onChange?.(event);
|
|
2903
|
+
onChangeText?.(value);
|
|
2904
|
+
},
|
|
2905
|
+
onBlur: (event) => {
|
|
2906
|
+
onBlur?.(event);
|
|
2907
|
+
onEditCompletedWrapper(event.target.value);
|
|
2908
|
+
},
|
|
2909
|
+
disabled,
|
|
2910
|
+
...props
|
|
2911
|
+
}
|
|
2912
|
+
);
|
|
2913
|
+
});
|
|
2914
|
+
|
|
2915
|
+
// src/components/properties/TextProperty.tsx
|
|
2916
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2917
|
+
var defaultTextPropertyTranslation = {
|
|
2918
|
+
en: {
|
|
2919
|
+
text: "Text"
|
|
2920
|
+
},
|
|
2921
|
+
de: {
|
|
2922
|
+
text: "Text"
|
|
2923
|
+
}
|
|
2924
|
+
};
|
|
2925
|
+
var TextProperty = ({
|
|
2926
|
+
overwriteTranslation,
|
|
2927
|
+
value,
|
|
2928
|
+
readOnly,
|
|
2929
|
+
onChange = noop,
|
|
2930
|
+
onRemove = noop,
|
|
2931
|
+
onEditComplete = noop,
|
|
2932
|
+
...baseProps
|
|
2933
|
+
}) => {
|
|
2934
|
+
const translation = useTranslation([defaultTextPropertyTranslation], overwriteTranslation);
|
|
2935
|
+
const hasValue = value !== void 0;
|
|
2936
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2937
|
+
PropertyBase,
|
|
2938
|
+
{
|
|
2939
|
+
...baseProps,
|
|
2940
|
+
onRemove,
|
|
2941
|
+
hasValue,
|
|
2942
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react10.Text, { size: 24 }),
|
|
2943
|
+
input: ({ softRequired }) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2944
|
+
Textarea,
|
|
2945
|
+
{
|
|
2946
|
+
className: (0, import_clsx14.default)({
|
|
2947
|
+
"bg-surface-warning placeholder-warning": softRequired && !hasValue
|
|
2948
|
+
}),
|
|
2949
|
+
rows: 5,
|
|
2950
|
+
defaultStyle: false,
|
|
2951
|
+
value: value ?? "",
|
|
2952
|
+
readOnly,
|
|
2953
|
+
placeholder: `${translation("text")}...`,
|
|
2954
|
+
onChangeText: (value2) => {
|
|
2955
|
+
if (!value2) {
|
|
2956
|
+
onRemove();
|
|
2957
|
+
} else {
|
|
2958
|
+
onChange(value2);
|
|
2959
|
+
}
|
|
2960
|
+
},
|
|
2961
|
+
onEditCompleted: (value2) => {
|
|
2962
|
+
if (!value2) {
|
|
2963
|
+
onRemove();
|
|
2964
|
+
} else {
|
|
2965
|
+
onEditComplete(value2);
|
|
2966
|
+
}
|
|
2967
|
+
}
|
|
2968
|
+
}
|
|
2969
|
+
)
|
|
2970
|
+
}
|
|
2971
|
+
);
|
|
2972
|
+
};
|
|
2973
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
2974
|
+
0 && (module.exports = {
|
|
2975
|
+
CheckboxProperty,
|
|
2976
|
+
DateProperty,
|
|
2977
|
+
MultiSelectProperty,
|
|
2978
|
+
NumberProperty,
|
|
2979
|
+
PropertyBase,
|
|
2980
|
+
SingleSelectProperty,
|
|
2981
|
+
TextProperty
|
|
2982
|
+
});
|
|
2983
|
+
//# sourceMappingURL=index.js.map
|