@g4rcez/components 0.0.70 → 0.0.71
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/index.css +1 -1
- package/dist/index.js +51 -56
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7528 -7447
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +47 -52
- package/dist/index.umd.js.map +1 -1
- package/dist/preset/src/styles/dark.d.ts.map +1 -1
- package/dist/preset/src/styles/dark.js +2 -0
- package/dist/preset/src/styles/light.d.ts.map +1 -1
- package/dist/preset/src/styles/light.js +2 -0
- package/dist/preset/src/styles/theme.types.d.ts +1 -0
- package/dist/preset/src/styles/theme.types.d.ts.map +1 -1
- package/dist/src/components/display/calendar.js +1 -1
- package/dist/src/components/floating/modal.js +1 -1
- package/dist/src/components/form/autocomplete.d.ts +1 -7
- package/dist/src/components/form/autocomplete.d.ts.map +1 -1
- package/dist/src/components/form/autocomplete.js +77 -27
- package/dist/src/components/form/free-text.d.ts.map +1 -1
- package/dist/src/components/form/free-text.js +2 -2
- package/dist/src/components/form/input-field.d.ts +5 -5
- package/dist/src/components/form/input-field.d.ts.map +1 -1
- package/dist/src/components/form/input-field.js +5 -3
- package/dist/src/components/form/multi-combobox.d.ts +24 -0
- package/dist/src/components/form/multi-combobox.d.ts.map +1 -0
- package/dist/src/components/form/{virtual-autocomplete.js → multi-combobox.js} +92 -68
- package/dist/src/components/form/select.d.ts.map +1 -1
- package/dist/src/components/form/select.js +1 -1
- package/dist/src/components/index.d.ts +1 -1
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +1 -1
- package/dist/src/components/table/thead.d.ts.map +1 -1
- package/dist/src/components/table/thead.js +1 -1
- package/dist/src/hooks/use-components-provider.d.ts +9 -0
- package/dist/src/hooks/use-components-provider.d.ts.map +1 -1
- package/dist/src/hooks/use-components-provider.js +22 -5
- package/dist/src/lib/dict.d.ts +9 -0
- package/dist/src/lib/dict.d.ts.map +1 -0
- package/dist/src/lib/dict.js +28 -0
- package/dist/src/styles/dark.d.ts.map +1 -1
- package/dist/src/styles/dark.js +2 -0
- package/dist/src/styles/light.d.ts.map +1 -1
- package/dist/src/styles/light.js +2 -0
- package/dist/src/styles/theme.types.d.ts +1 -0
- package/dist/src/styles/theme.types.d.ts.map +1 -1
- package/package.json +1 -2
- package/dist/src/components/form/virtual-autocomplete.d.ts +0 -15
- package/dist/src/components/form/virtual-autocomplete.d.ts.map +0 -1
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { autoUpdate, FloatingFocusManager, FloatingPortal, offset, size, useDismiss, useFloating, useInteractions, useListNavigation, useRole, useTransitionStyles, } from "@floating-ui/react";
|
|
4
|
-
import { flushSync } from "react-dom";
|
|
5
4
|
import Fuzzy from "fuzzy-search";
|
|
6
5
|
import { ChevronDown } from "lucide-react";
|
|
7
|
-
import { forwardRef, Fragment, useEffect, useRef, useState } from "react";
|
|
8
6
|
import { AnimatePresence, motion } from "motion/react";
|
|
7
|
+
import React, { forwardRef, Fragment, useEffect, useMemo, useRef, useState } from "react";
|
|
8
|
+
import { flushSync } from "react-dom";
|
|
9
9
|
import { Virtuoso } from "react-virtuoso";
|
|
10
10
|
import { useTranslations } from "../../hooks/use-components-provider";
|
|
11
|
+
import { Dict } from "../../lib/dict";
|
|
11
12
|
import { css, dispatchInput, initializeInputDataset } from "../../lib/dom";
|
|
12
|
-
import {
|
|
13
|
+
import { Tag } from "../core/tag";
|
|
14
|
+
import { Checkbox } from "./checkbox";
|
|
13
15
|
import { InputField } from "./input-field";
|
|
14
16
|
const Frag = (props) => _jsx(Fragment, { children: props.children });
|
|
15
17
|
const transitionStyles = {
|
|
@@ -21,22 +23,54 @@ const transitionStyles = {
|
|
|
21
23
|
const fuzzyOptions = { caseSensitive: false, sort: false };
|
|
22
24
|
const emptyRef = [];
|
|
23
25
|
const List = forwardRef(function VirtualList(props, ref) {
|
|
24
|
-
return (_jsx(motion.ul, { ...props, ref: ref, className: "w-full border-b border-tooltip-border last:border-transparent
|
|
26
|
+
return (_jsx(motion.ul, { ...props, ref: ref, className: "w-full rounded-b-lg border-b border-tooltip-border last:border-transparent", children: _jsx(AnimatePresence, { children: props.children }) }));
|
|
25
27
|
});
|
|
26
|
-
const Item = forwardRef(function VirtualItem(props, ref) {
|
|
27
|
-
return
|
|
28
|
+
const Item = forwardRef(function VirtualItem({ item, context, ...props }, ref) {
|
|
29
|
+
return _jsx(motion.li, { ...props, ref: ref, className: "last:rounded-t-lg" });
|
|
28
30
|
});
|
|
29
31
|
const components = { List, Item };
|
|
30
|
-
|
|
32
|
+
const OverflowControl = (props) => {
|
|
33
|
+
const translate = useTranslations();
|
|
34
|
+
const ref = useRef(null);
|
|
35
|
+
const countable = React.Children.count(props.children);
|
|
36
|
+
const [normalView, setNormalView] = useState(false);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (ref.current === null)
|
|
39
|
+
return;
|
|
40
|
+
const parent = ref.current.parentElement.getBoundingClientRect();
|
|
41
|
+
const items = Array.from(ref.current.querySelectorAll("[data-component='tag']"));
|
|
42
|
+
const child = items.reduce((acc, el) => acc + el.getBoundingClientRect().width, 0);
|
|
43
|
+
const hasOnlyCounter = ref.current.querySelectorAll("[data-multicounter]").length;
|
|
44
|
+
if (hasOnlyCounter && countable <= 3)
|
|
45
|
+
return setNormalView(false);
|
|
46
|
+
if (child > parent.width)
|
|
47
|
+
return setNormalView(true);
|
|
48
|
+
}, [countable]);
|
|
49
|
+
return (_jsx("span", { ref: ref, className: "flex flex-nowrap gap-x-2", children: !normalView ? (props.children) : (_jsxs(Tag, { size: "small", "data-multicounter": "true", children: [countable, " ", translate.multiComboboxSelectedLabel] })) }));
|
|
50
|
+
};
|
|
51
|
+
const noop = () => { };
|
|
52
|
+
export const MultiCombobox = forwardRef(({ left, error, right, options, container, rightLabel, interactive, emptyMessage, optionalText, selectedLabel, labelClassName, feedback = null, hideLeft = false, required = false, dynamicOption = false, ...props }, externalRef) => {
|
|
53
|
+
const map = useMemo(() => new Dict(options.map((x) => [x.value, x])), [options]);
|
|
31
54
|
const fieldset = useRef(null);
|
|
32
55
|
const virtuoso = useRef(null);
|
|
33
|
-
const defaults = props.value ?? props.defaultValue ??
|
|
56
|
+
const defaults = props.value ?? props.defaultValue ?? emptyRef;
|
|
34
57
|
const translation = useTranslations();
|
|
35
58
|
const [h, setH] = useState(0);
|
|
36
59
|
const [open, setOpen] = useState(false);
|
|
37
60
|
const [shadow, setShadow] = useState("");
|
|
38
|
-
const [value, setValue] = useState(
|
|
39
|
-
|
|
61
|
+
const [value, setValue] = useState(() => {
|
|
62
|
+
const d = new Dict();
|
|
63
|
+
defaults.forEach((x) => {
|
|
64
|
+
const result = map.get(x);
|
|
65
|
+
return result ? d.set(x, result) : undefined;
|
|
66
|
+
});
|
|
67
|
+
return d;
|
|
68
|
+
});
|
|
69
|
+
const deriveValue = useMemo(() => Array.from(value.keys()), [value]);
|
|
70
|
+
const [label, setLabel] = useState(() => {
|
|
71
|
+
const d = new Set(defaults);
|
|
72
|
+
return options.reduce((acc, x) => (d.has(x.value) ? [...acc, x.label ?? x.value] : acc), []) ?? defaults;
|
|
73
|
+
});
|
|
40
74
|
const [index, setIndex] = useState(null);
|
|
41
75
|
const listRef = useRef(emptyRef);
|
|
42
76
|
const innerOptions = dynamicOption && shadow !== ""
|
|
@@ -50,19 +84,15 @@ export const VirtualAutocomplete = forwardRef(({ options, dynamicOption = false,
|
|
|
50
84
|
]
|
|
51
85
|
: options;
|
|
52
86
|
const list = new Fuzzy(innerOptions, ["value", "label"], fuzzyOptions).search(shadow);
|
|
53
|
-
const pattern = dynamicOption
|
|
54
|
-
? undefined
|
|
55
|
-
: `^(${options.map((x) => `${safeRegex(x.value)}${x.label ? "|" + safeRegex(x.label) : ""}`).join("|")})$`;
|
|
56
87
|
useEffect(() => {
|
|
57
88
|
if (!open)
|
|
58
89
|
setH(0);
|
|
59
90
|
}, [open]);
|
|
60
91
|
useEffect(() => {
|
|
61
92
|
if (props.value) {
|
|
62
|
-
|
|
63
|
-
setValue(item?.label ?? props.value);
|
|
93
|
+
setValue(new Dict(props.value.map((x) => [x, map.get(x)])));
|
|
64
94
|
}
|
|
65
|
-
}, [props.value]);
|
|
95
|
+
}, [props.value, map]);
|
|
66
96
|
const { x, y, strategy, refs, context } = useFloating({
|
|
67
97
|
open,
|
|
68
98
|
transform: true,
|
|
@@ -76,14 +106,13 @@ export const VirtualAutocomplete = forwardRef(({ options, dynamicOption = false,
|
|
|
76
106
|
elementContext: "reference",
|
|
77
107
|
apply(a) {
|
|
78
108
|
const w = fieldset.current?.getBoundingClientRect().width;
|
|
79
|
-
const
|
|
80
|
-
const fullSize = ul?.getBoundingClientRect().height || 0;
|
|
81
|
-
const maxH = Math.min(fullSize < 40 ? 300 : fullSize, 300);
|
|
109
|
+
const maxH = 360;
|
|
82
110
|
flushSync(() => setTimeout(() => setH(maxH), 200));
|
|
83
111
|
Object.assign(a.elements.floating.style, {
|
|
84
112
|
width: `${w}px`,
|
|
85
113
|
maxWidth: `${w}px`,
|
|
86
114
|
maxHeight: `${maxH}px`,
|
|
115
|
+
height: `${maxH}px`,
|
|
87
116
|
});
|
|
88
117
|
},
|
|
89
118
|
}),
|
|
@@ -114,18 +143,19 @@ export const VirtualAutocomplete = forwardRef(({ options, dynamicOption = false,
|
|
|
114
143
|
return initializeInputDataset(input);
|
|
115
144
|
}, []);
|
|
116
145
|
const onSelect = (opt, i) => {
|
|
117
|
-
|
|
146
|
+
const clone = value.clone();
|
|
147
|
+
value.has(opt.value) ? clone.delete(opt.value) : clone.set(opt.value, opt);
|
|
148
|
+
setValue(clone);
|
|
118
149
|
const input = refs.reference.current;
|
|
119
150
|
if (!input)
|
|
120
151
|
return;
|
|
121
152
|
input?.setAttribute("data-value", opt.value);
|
|
122
|
-
input.value =
|
|
153
|
+
input.value = Array.from(clone.values());
|
|
123
154
|
const event = new Event("change", { bubbles: false, cancelable: true });
|
|
124
155
|
input.dispatchEvent(event);
|
|
125
156
|
if (props.onChange)
|
|
126
157
|
props.onChange(event);
|
|
127
|
-
setLabel(opt.label ?? "");
|
|
128
|
-
setOpen(false);
|
|
158
|
+
setLabel((prev) => prev.concat(opt.label ?? ""));
|
|
129
159
|
setShadow("");
|
|
130
160
|
setIndex(i);
|
|
131
161
|
};
|
|
@@ -135,7 +165,7 @@ export const VirtualAutocomplete = forwardRef(({ options, dynamicOption = false,
|
|
|
135
165
|
if (!open && value === "")
|
|
136
166
|
return setOpen(true);
|
|
137
167
|
event.target.name = props.name || "";
|
|
138
|
-
return value ? setOpen(true) :
|
|
168
|
+
return value ? setOpen(true) : undefined;
|
|
139
169
|
};
|
|
140
170
|
const onCaretDownClick = () => {
|
|
141
171
|
setOpen(true);
|
|
@@ -149,52 +179,18 @@ export const VirtualAutocomplete = forwardRef(({ options, dynamicOption = false,
|
|
|
149
179
|
const onClose = () => {
|
|
150
180
|
refs.reference.current?.setAttribute("data-value", "");
|
|
151
181
|
setShadow("");
|
|
152
|
-
setValue("");
|
|
153
|
-
setLabel("");
|
|
154
182
|
dispatchInput(refs.reference.current, "");
|
|
155
183
|
setOpen(false);
|
|
156
184
|
};
|
|
157
185
|
const id = props.id || props.name;
|
|
158
|
-
|
|
186
|
+
const tags = value.map((x) => (_jsx(Tag, { size: "small", children: x.label ?? x.value }, `multicombobox-${x.value}-x`)));
|
|
187
|
+
return (_jsxs(InputField, { ...props, left: left, error: error, ref: fieldset, form: props.form, name: props.name, feedback: feedback, hideLeft: hideLeft, required: required, title: props.title, container: container, rightLabel: rightLabel, interactive: interactive, id: props.name || props.id, optionalText: optionalText, componentName: "autocomplete", labelClassName: labelClassName, placeholder: props.placeholder, right: _jsxs("span", { className: "flex items-center gap-0.5", children: [_jsxs("button", { type: "button", className: "transition-colors link:text-primary", onClick: onCaretDownClick, children: [_jsx(ChevronDown, { size: 20 }), _jsx("span", { className: "sr-only", children: translation.inputCaretDown })] }), value ? (_jsx("button", { type: "button", onClick: onClose, className: "transition-colors link:text-danger", children: _jsx("svg", { width: "15", height: "15", viewBox: "0 0 15 15", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z", fill: "currentColor", fillRule: "evenodd", clipRule: "evenodd" }) }) })) : null] }), children: [_jsx("button", { ...getReferenceProps({
|
|
159
188
|
...props,
|
|
160
|
-
onChange,
|
|
161
189
|
onFocus,
|
|
162
|
-
pattern,
|
|
163
|
-
ref: refs.setReference,
|
|
164
|
-
name: `${id}-shadow`,
|
|
165
190
|
id: `${id}-shadow`,
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
let next = index + 1;
|
|
170
|
-
if (next > list.length - 1)
|
|
171
|
-
next = 0;
|
|
172
|
-
virtuoso.current?.scrollIntoView({ index: next });
|
|
173
|
-
return setIndex(next);
|
|
174
|
-
}
|
|
175
|
-
if (event.key === "ArrowUp") {
|
|
176
|
-
let next = index - 1;
|
|
177
|
-
if (next < 0)
|
|
178
|
-
next = list.length - 1;
|
|
179
|
-
virtuoso.current?.scrollIntoView({ index: next });
|
|
180
|
-
return setIndex(next);
|
|
181
|
-
}
|
|
182
|
-
if (event.key === "Escape") {
|
|
183
|
-
event.currentTarget.blur();
|
|
184
|
-
return setOpen(false);
|
|
185
|
-
}
|
|
186
|
-
if (event.key === "Enter") {
|
|
187
|
-
if (index !== null && list[index]) {
|
|
188
|
-
event.preventDefault();
|
|
189
|
-
return onSelect(list[index], index);
|
|
190
|
-
}
|
|
191
|
-
if (list.length === 1) {
|
|
192
|
-
event.preventDefault();
|
|
193
|
-
return onSelect(list[0], 0);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
},
|
|
197
|
-
}), "data-value": value, "data-error": !!error, "data-name": id, "data-target": id, required: required, value: open ? shadow : label || value, "aria-autocomplete": "list", autoComplete: "off", className: css("input placeholder-input-mask group h-input-height w-full flex-1", "rounded-md bg-transparent px-input-x py-input-y text-foreground", "outline-none transition-colors focus:ring-2 focus:ring-inset focus:ring-primary", "group-error:text-danger group-error:placeholder-input-mask-error", "group-focus-within:border-primary group-hover:border-primary", props.className) }), _jsx("input", { id: id, name: id, type: "hidden", "data-origin": id, ref: externalRef, required: required, defaultValue: props.value || value || undefined }), _jsx(FloatingPortal, { preserveTabOrder: true, children: open ? (_jsx(FloatingFocusManager, { guards: true, returnFocus: false, context: context, initialFocus: -1, visuallyHiddenDismiss: true, children: _jsxs("div", { ...getFloatingProps({
|
|
191
|
+
name: `${id}-shadow`,
|
|
192
|
+
ref: refs.setReference,
|
|
193
|
+
}), type: "button", "data-name": id, "data-target": id, "data-shadow": "true", "data-error": !!error, "aria-autocomplete": "list", "data-value": deriveValue.join(","), value: open ? shadow : label || value, className: css("input placeholder-input-mask group h-input-height w-full", "rounded-md bg-transparent px-input-x py-input-y text-foreground", "outline-none transition-colors focus:ring-2 focus:ring-inset focus:ring-primary", "group-error:text-danger group-error:placeholder-input-mask-error", "group-focus-within:border-primary group-hover:border-primary", "flex flex-row items-center gap-2 whitespace-nowrap text-left", "truncate overflow-ellipsis", props.className), children: _jsx(OverflowControl, { label: selectedLabel, children: tags }) }), _jsx("input", { id: id, name: id, type: "hidden", "data-origin": id, ref: externalRef, required: required, defaultValue: props.value || deriveValue || undefined }), _jsx(FloatingPortal, { preserveTabOrder: true, children: open ? (_jsx(FloatingFocusManager, { guards: true, returnFocus: false, context: context, initialFocus: -1, visuallyHiddenDismiss: true, children: _jsxs("div", { ...getFloatingProps({
|
|
198
194
|
ref: refs.setFloating,
|
|
199
195
|
style: {
|
|
200
196
|
...transitions.styles,
|
|
@@ -202,9 +198,38 @@ export const VirtualAutocomplete = forwardRef(({ options, dynamicOption = false,
|
|
|
202
198
|
left: (x ?? 0) + (!!value ? 26 : 18),
|
|
203
199
|
top: y ?? 0,
|
|
204
200
|
},
|
|
205
|
-
}), "data-floating": "true", className: "z-floating m-0 origin-[top_center] list-none overscroll-contain rounded-b-lg rounded-t-lg border border-floating-border bg-floating-background p-0 text-foreground shadow-floating", children: [
|
|
201
|
+
}), "data-floating": "true", className: "z-floating m-0 w-full origin-[top_center] list-none overscroll-contain rounded-b-lg rounded-t-lg border border-floating-border bg-floating-background p-0 text-foreground shadow-floating", children: [_jsx("input", { autoFocus: true, value: shadow, onChange: onChange, title: props.title, placeholder: translation.multiComboboxInnerPlaceholder, onKeyDown: (event) => {
|
|
202
|
+
if (event.key === "ArrowDown") {
|
|
203
|
+
let next = index + 1;
|
|
204
|
+
if (next > list.length - 1)
|
|
205
|
+
next = 0;
|
|
206
|
+
virtuoso.current?.scrollIntoView({ index: next });
|
|
207
|
+
return setIndex(next);
|
|
208
|
+
}
|
|
209
|
+
if (event.key === "ArrowUp") {
|
|
210
|
+
let next = index - 1;
|
|
211
|
+
if (next < 0)
|
|
212
|
+
next = list.length - 1;
|
|
213
|
+
virtuoso.current?.scrollIntoView({ index: next });
|
|
214
|
+
return setIndex(next);
|
|
215
|
+
}
|
|
216
|
+
if (event.key === "Escape") {
|
|
217
|
+
event.currentTarget.blur();
|
|
218
|
+
return setOpen(false);
|
|
219
|
+
}
|
|
220
|
+
if (event.key === "Enter") {
|
|
221
|
+
if (index !== null && list[index]) {
|
|
222
|
+
event.preventDefault();
|
|
223
|
+
return onSelect(list[index], index);
|
|
224
|
+
}
|
|
225
|
+
if (list.length === 1) {
|
|
226
|
+
event.preventDefault();
|
|
227
|
+
return onSelect(list[0], 0);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}, className: "input placeholder-input-mask group mb-1 h-10 w-full flex-1 border-b border-input-border bg-transparent px-input-x py-input-y outline-none transition-colors focus:ring-2 focus:ring-inset focus:ring-primary" }), list.length === 0 ? (_jsx("li", { role: "option", className: "w-full border-b border-tooltip-border last:border-transparent", children: _jsx("span", { className: "flex w-full justify-between p-2 text-left text-disabled", children: emptyMessage || translation.autocompleteEmpty }) })) : null, _jsx(Virtuoso, { data: list, ref: virtuoso, hidden: list.length === 0, style: { height: value.size === 0 ? h - 49 : h - 86 }, components: components, className: "border-floating-border bg-floating-background p-0 text-foreground", itemContent: (i, option) => {
|
|
206
231
|
const Label = option.Render ?? Frag;
|
|
207
|
-
const active = value
|
|
232
|
+
const active = value.has(option.value) || value.has(option.label ?? "");
|
|
208
233
|
const selected = index === i;
|
|
209
234
|
const children = option.label ?? option.value;
|
|
210
235
|
return (_jsx("button", { "data-value": option.value, ...getItemProps({
|
|
@@ -216,7 +241,6 @@ export const VirtualAutocomplete = forwardRef(({ options, dynamicOption = false,
|
|
|
216
241
|
"aria-selected": active,
|
|
217
242
|
"aria-busy": option.disabled,
|
|
218
243
|
onClick: () => onSelect(option, i),
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
} })] }) })) : null })] }));
|
|
244
|
+
}), className: `focus:bg-floating-hover hover:bg-floating-hover w-full cursor-pointer p-2 text-left ${active || selected ? "bg-floating-hover text-floating-foreground" : ""}`, children: _jsx(Checkbox, { onChange: noop, checked: active, "aria-checked": active, onClick: (e) => void (e.stopPropagation(), e.preventDefault()), children: _jsx(Label, { ...props, label: option.label, value: option.value, children: children }) }) }));
|
|
245
|
+
} }), value.size === 0 ? null : (_jsx("div", { className: "sticky bottom-0 flex w-full flex-nowrap items-center gap-2 overflow-x-auto rounded-b-lg bg-floating-background p-2", children: tags }))] }) })) : null })] }));
|
|
222
246
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../../src/components/form/select.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA6D,MAAM,OAAO,CAAC;AAGlF,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAc,eAAe,EAAE,MAAM,eAAe,CAAC;AAE5D,MAAM,MAAM,WAAW,GAAG,QAAQ,CAC9B,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EAC9B;IACI,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC,CAChD,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,QAAQ,CAC9B,eAAe,CAAC,QAAQ,CAAC,EACzB;IACI,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B,CACJ,CAAC;AAEF,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../../src/components/form/select.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA6D,MAAM,OAAO,CAAC;AAGlF,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAc,eAAe,EAAE,MAAM,eAAe,CAAC;AAE5D,MAAM,MAAM,WAAW,GAAG,QAAQ,CAC9B,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EAC9B;IACI,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC,CAChD,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,QAAQ,CAC9B,eAAe,CAAC,QAAQ,CAAC,EACzB;IACI,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B,CACJ,CAAC;AAEF,eAAO,MAAM,MAAM,oGAwGlB,CAAC"}
|
|
@@ -27,5 +27,5 @@ export const Select = forwardRef(({ required = true, options, info, selectContai
|
|
|
27
27
|
};
|
|
28
28
|
}, []);
|
|
29
29
|
const onClickLabel = () => inputRef.current?.focus();
|
|
30
|
-
return (_jsx(InputField, { info: info, left: left, error: error, form: props.form, name: props.name, feedback: feedback, hideLeft: hideLeft, required: required, title: props.title, container: container, componentName: "select", rightLabel: rightLabel, interactive: interactive, id: props.name || props.id, optionalText: optionalText, labelClassName: labelClassName, placeholder: props.placeholder, right: _jsx("label", { htmlFor: id, children: _jsxs("button", { onClick: onClickLabel, type: "button", className: "mt-2 transition-colors hover:text-primary", children: [_jsx(ChevronDownIcon, { size: 20 }), _jsx("span", { className: "sr-only", children: translation.inputCaretDown })] }) }), children: _jsxs("select", { ...props, id: id, name: id, value: props.value, required: required, ref: mergeRefs(ref, inputRef), "data-selected": !!props.value || false, defaultValue: props.value ? undefined : "", className: css("input select group h-10 w-full flex-1 appearance-none rounded-md", "bg-transparent px-2 py-1 text-foreground placeholder-input-placeholder", "outline-none transition-colors group-error:text-danger group-error:placeholder-input-mask-error", "data-[selected=false]:text-input-placeholder", props.className), children: [_jsx("option", { value: "", disabled: true, hidden: true, children: props.placeholder }), options.map((option) => (_createElement("option", { ...option, value: option.value, children: option.label ?? option.value, key: `${id}-select-option-${option.value}` })))] }) }));
|
|
30
|
+
return (_jsx(InputField, { info: info, left: left, error: error, form: props.form, name: props.name, feedback: feedback, hideLeft: hideLeft, required: required, title: props.title, container: container, componentName: "select", rightLabel: rightLabel, interactive: interactive, id: props.name || props.id, optionalText: optionalText, labelClassName: labelClassName, placeholder: props.placeholder, right: _jsx("label", { htmlFor: id, children: _jsxs("button", { onClick: onClickLabel, type: "button", className: "mt-2 transition-colors hover:text-primary", children: [_jsx(ChevronDownIcon, { size: 20 }), _jsx("span", { className: "sr-only", children: translation.inputCaretDown })] }) }), children: _jsxs("select", { ...props, id: id, name: id, value: props.value, required: required, ref: mergeRefs(ref, inputRef), "data-selected": !!props.value || false, defaultValue: props.value ? undefined : "", title: typeof props.title === "string" ? props.title : undefined, className: css("input select group h-10 w-full flex-1 appearance-none rounded-md", "bg-transparent px-2 py-1 text-foreground placeholder-input-placeholder", "outline-none transition-colors group-error:text-danger group-error:placeholder-input-mask-error", "data-[selected=false]:text-input-placeholder", props.className), children: [_jsx("option", { value: "", disabled: true, hidden: true, children: props.placeholder }), options.map((option) => (_createElement("option", { ...option, value: option.value, children: option.label ?? option.value, key: `${id}-select-option-${option.value}` })))] }) }));
|
|
31
31
|
});
|
|
@@ -16,7 +16,7 @@ export * from "./floating/modal";
|
|
|
16
16
|
export * from "./floating/toolbar";
|
|
17
17
|
export * from "./floating/tooltip";
|
|
18
18
|
export * from "./form/autocomplete";
|
|
19
|
-
export * from "./form/
|
|
19
|
+
export * from "./form/multi-combobox";
|
|
20
20
|
export * from "./form/checkbox";
|
|
21
21
|
export * from "./form/date-picker";
|
|
22
22
|
export * from "./form/file-upload";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,KAAK,OAAO,EAAE,mBAAmB,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -16,7 +16,7 @@ export * from "./floating/modal";
|
|
|
16
16
|
export * from "./floating/toolbar";
|
|
17
17
|
export * from "./floating/tooltip";
|
|
18
18
|
export * from "./form/autocomplete";
|
|
19
|
-
export * from "./form/
|
|
19
|
+
export * from "./form/multi-combobox";
|
|
20
20
|
export * from "./form/checkbox";
|
|
21
21
|
export * from "./form/date-picker";
|
|
22
22
|
export * from "./form/file-upload";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thead.d.ts","sourceRoot":"","sources":["../../../../src/components/table/thead.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,GAAG,EAAY,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAIjE,KAAK,gBAAgB,CAAC,CAAC,SAAS,EAAE,IAAI;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;CACrB,GAAG,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,SAAS,GAAG,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,GAAG,cAAc,GAAG,cAAc,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"thead.d.ts","sourceRoot":"","sources":["../../../../src/components/table/thead.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,GAAG,EAAY,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAIjE,KAAK,gBAAgB,CAAC,CAAC,SAAS,EAAE,IAAI;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;CACrB,GAAG,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,SAAS,GAAG,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,GAAG,cAAc,GAAG,cAAc,CAAC,CAAC;AA0IpI,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,EAAE,SAAS,gBAAgB,CAAC,CAAC,CAAC,4CA6BnE,CAAC"}
|
|
@@ -39,7 +39,7 @@ const HeaderChild = (props) => {
|
|
|
39
39
|
const ariaSort = !ownSorter?.type ? "none" : ownSorter.type === Order.Asc ? "ascending" : "descending";
|
|
40
40
|
const label = getLabel(props.header);
|
|
41
41
|
const width = useMotionValue(undefined);
|
|
42
|
-
return (_jsxs(Reorder.Item, { ...props.header.thProps, as: "th", ref: dragRef, initial: false, dragSnapToOrigin: true, dragDirectionLock: true, style: { width }, role: "columnheader", "aria-sort": ariaSort, value: props.header, "aria-busy": props.loading, className: `relative hidden min-w-0 border border-b border-transparent border-b-table-border border-r-table-border font-medium first:table-cell last:border-r-transparent md:table-cell ${props.header.thProps?.className ?? ""}`, children: [_jsx("span", { className: "flex h-full items-center justify-between px-2 py-4", children: _jsxs("span", { className: "flex items-center gap-1", children: [props.inlineFilter && defaultAllowFilter ? (_jsx(Dropdown, { arrow: true, trigger: _jsxs("span", { children: [_jsxs("span", { id: `${props.header.id}-filter-dropdown-button`, className: "sr-only", children: [translation.tableFilterDropdownTitleUnique, " ", label] }), _jsx(FilterIcon, { "aria-labelledby": `${props.header.id}-filter-dropdown-button`, size: 14 })] }), title: _jsxs("span", { className: "text-lg font-medium", children: [translation.tableFilterDropdownTitleUnique, " ", _jsx("span", { className: "text-primary", children: label })] }), children: (ownFilters.length === 0) === null ? null : (_jsxs("ul", { className: "font-medium", children: [ownFilters.map((filter) => (_jsx("li", { className: "my-1", children: _jsx(ColumnHeaderFilter, { onDelete: onDelete, filter: filter, set: props.setFilters }) }, `thead-filter-${filter.id}`))), _jsx("li", { children: _jsxs("button", { type: "button", className: "flex items-center gap-1 text-primary", onClick: () => props.setFilters((prev) => prev.concat(createFilterFromCol(props.header, operators.options, operators.operations))), children: [_jsx(PlusIcon, { size: 14 }), " ", translation.tableFilterNewFilter] }) })] })) })) : null, _jsx("span", { className: "pointer-events-auto text-balance text-base", children: props.header.thead }), props.inlineSorter && defaultAllowSort ? (_jsx(SorterHead, { col: props.header, setSorters: props.setSorters, sorters: props.sorters })) : null] }) }), _jsx(motion.button, { drag: "x", draggable: true, dragListener: true, dragMomentum: true, type: "button", animate: false, dragElastic: 0, dragPropagation: true, initial: false, dragSnapToOrigin: true, dragDirectionLock: true, "data-type": "resizer", dragConstraints: dragConstraints, whileDrag: { cursor: "grabbing" }, className: "absolute right-0 top-0 block h-full w-1 cursor-col-resize hover:bg-primary active:bg-primary", onDrag: (e, info) => {
|
|
42
|
+
return (_jsxs(Reorder.Item, { ...props.header.thProps, as: "th", ref: dragRef, initial: false, dragSnapToOrigin: true, dragDirectionLock: true, style: { width }, role: "columnheader", "aria-sort": ariaSort, value: props.header, "aria-busy": props.loading, className: `relative hidden min-w-0 border border-b border-transparent border-b-table-border border-r-table-border font-medium first:table-cell last:border-r-transparent md:table-cell ${props.header.thProps?.className ?? ""}`, children: [_jsx("span", { className: "flex h-full items-center justify-between px-2 py-4", children: _jsxs("span", { className: "flex items-center gap-1", children: [props.inlineFilter && defaultAllowFilter ? (_jsx(Dropdown, { arrow: true, trigger: _jsxs("span", { children: [_jsxs("span", { id: `${props.header.id}-filter-dropdown-button`, className: "sr-only", children: [translation.tableFilterDropdownTitleUnique, " ", label] }), _jsx(FilterIcon, { "aria-labelledby": `${props.header.id}-filter-dropdown-button`, size: 14 })] }), title: _jsxs("span", { className: "text-lg font-medium", children: [translation.tableFilterDropdownTitleUnique, " ", _jsx("span", { className: "text-primary", children: label })] }), children: (ownFilters.length === 0) === null ? null : (_jsxs("ul", { className: "font-medium", children: [ownFilters.map((filter) => (_jsx("li", { className: "my-1", children: _jsx(ColumnHeaderFilter, { onDelete: onDelete, filter: filter, set: props.setFilters }) }, `thead-filter-${filter.id}`))), _jsx("li", { children: _jsxs("button", { type: "button", className: "flex items-center gap-1 text-primary", onClick: () => props.setFilters((prev) => prev.concat(createFilterFromCol(props.header, operators.options, operators.operations))), children: [_jsx(PlusIcon, { size: 14 }), " ", translation.tableFilterNewFilter] }) })] })) })) : null, _jsx("span", { className: "pointer-events-auto text-balance text-base", children: props.header.thead }), props.inlineSorter && defaultAllowSort ? (_jsx(SorterHead, { col: props.header, setSorters: props.setSorters, sorters: props.sorters })) : null] }) }), _jsx(motion.button, { drag: "x", draggable: true, dragListener: true, dragMomentum: true, type: "button", animate: false, dragElastic: 0, dragPropagation: true, initial: false, dragSnapToOrigin: true, dragDirectionLock: true, "data-type": "resizer", title: props.header.id, dragConstraints: dragConstraints, whileDrag: { cursor: "grabbing" }, className: "absolute right-0 top-0 block h-full w-1 cursor-col-resize hover:bg-primary active:bg-primary", onDrag: (e, info) => {
|
|
43
43
|
const div = e.target;
|
|
44
44
|
const v = width.get() || div.getBoundingClientRect().width;
|
|
45
45
|
const delta = info.delta.x;
|
|
@@ -51,9 +51,15 @@ declare const defaultTranslations: {
|
|
|
51
51
|
calendarFromDate: string;
|
|
52
52
|
calendarToDate: string;
|
|
53
53
|
calendarToday: string;
|
|
54
|
+
multiComboboxSelectedLabel: string;
|
|
55
|
+
multiComboboxInnerPlaceholder: string;
|
|
54
56
|
};
|
|
55
57
|
export type Translations = typeof defaultTranslations;
|
|
58
|
+
type Tweaks = {
|
|
59
|
+
inputIconFeedback: boolean;
|
|
60
|
+
};
|
|
56
61
|
type ContextProps = Partial<{
|
|
62
|
+
tweaks: Partial<Tweaks>;
|
|
57
63
|
map: Partial<Translations>;
|
|
58
64
|
locale: Locales | undefined;
|
|
59
65
|
parser: typeof parsers.hsla;
|
|
@@ -110,7 +116,10 @@ export declare const useTranslations: () => {
|
|
|
110
116
|
calendarFromDate: string;
|
|
111
117
|
calendarToDate: string;
|
|
112
118
|
calendarToday: string;
|
|
119
|
+
multiComboboxSelectedLabel: string;
|
|
120
|
+
multiComboboxInnerPlaceholder: string;
|
|
113
121
|
};
|
|
114
122
|
export declare const useColorParser: () => (v: string) => `hsla(${string})`;
|
|
123
|
+
export declare const useTweaks: () => Tweaks;
|
|
115
124
|
export {};
|
|
116
125
|
//# sourceMappingURL=use-components-provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-components-provider.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-components-provider.tsx"],"names":[],"mappings":"AACA,OAAO,KA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AO,GAAG,SAAS,CAAC;IAC5B,MAAM,EAAE,OAAO,OAAO,CAAC,IAAI,CAAC;CAC/B,CAAC,CAAC;AASH,eAAO,MAAM,kBAAkB,UAAW,iBAAiB,CAAC,YAAY,CAAC,4CAWxE,CAAC;AAEF,eAAO,MAAM,SAAS,YAAa,OAAO,KAAG,OAAO,GAAG,SAKtD,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCAjEY;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE;;;;;;CAqExI,CAAC;AAEF,eAAO,MAAM,cAAc,wCAI1B,CAAC;AAEF,eAAO,MAAM,SAAS,QAAO,MAI5B,CAAC"}
|
|
@@ -46,14 +46,25 @@ const defaultTranslations = {
|
|
|
46
46
|
calendarFromDate: "From",
|
|
47
47
|
calendarToDate: "To",
|
|
48
48
|
calendarToday: "Today",
|
|
49
|
+
multiComboboxSelectedLabel: "Selected",
|
|
50
|
+
multiComboboxInnerPlaceholder: "Search...",
|
|
51
|
+
};
|
|
52
|
+
const defaultTweaks = {
|
|
53
|
+
inputIconFeedback: true,
|
|
49
54
|
};
|
|
50
55
|
const Context = createContext({
|
|
51
|
-
|
|
52
|
-
|
|
56
|
+
tweaks: defaultTweaks,
|
|
57
|
+
parser: parsers.hsla,
|
|
58
|
+
map: defaultTranslations,
|
|
53
59
|
locale: undefined,
|
|
54
60
|
});
|
|
55
61
|
export const ComponentsProvider = (props) => {
|
|
56
|
-
const memoMap = useMemo(() => ({
|
|
62
|
+
const memoMap = useMemo(() => ({
|
|
63
|
+
locale: props.locale,
|
|
64
|
+
tweaks: { ...defaultTweaks, ...props.tweaks },
|
|
65
|
+
colorTokenParser: props.parser || parsers.hsla,
|
|
66
|
+
map: { ...defaultTranslations, ...props.map },
|
|
67
|
+
}), [props]);
|
|
57
68
|
return _jsx(Context.Provider, { value: memoMap, children: props.children });
|
|
58
69
|
};
|
|
59
70
|
export const useLocale = (locale) => {
|
|
@@ -68,11 +79,17 @@ export const useTranslations = () => {
|
|
|
68
79
|
const ctx = useContext(Context);
|
|
69
80
|
if (!ctx)
|
|
70
81
|
return defaultTranslations;
|
|
71
|
-
return ctx.
|
|
82
|
+
return ctx.map;
|
|
72
83
|
};
|
|
73
84
|
export const useColorParser = () => {
|
|
74
85
|
const ctx = useContext(Context);
|
|
75
86
|
if (!ctx)
|
|
76
87
|
return parsers.hsla;
|
|
77
|
-
return ctx.
|
|
88
|
+
return ctx.parser;
|
|
89
|
+
};
|
|
90
|
+
export const useTweaks = () => {
|
|
91
|
+
const ctx = useContext(Context);
|
|
92
|
+
if (!ctx)
|
|
93
|
+
return defaultTweaks;
|
|
94
|
+
return ctx.tweaks;
|
|
78
95
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare class Dict<K, V> extends Map<K, V> {
|
|
2
|
+
private list;
|
|
3
|
+
constructor(init?: [K, V][] | Dict<K, V>);
|
|
4
|
+
set(key: K, value: V): this;
|
|
5
|
+
delete(key: K): boolean;
|
|
6
|
+
map(callback: (v: V) => any): any[];
|
|
7
|
+
clone(): Dict<K, V>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=dict.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dict.d.ts","sourceRoot":"","sources":["../../../src/lib/dict.ts"],"names":[],"mappings":"AAAA,qBAAa,IAAI,CAAC,CAAC,EAAE,CAAC,CAAE,SAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAgB;gBAET,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;IAOxC,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI;IAM3B,MAAM,CAAC,GAAG,EAAE,CAAC;IAMb,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,GAAG;IAI3B,KAAK;CAGf"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export class Dict extends Map {
|
|
2
|
+
list = [];
|
|
3
|
+
constructor(init) {
|
|
4
|
+
super(init);
|
|
5
|
+
this.list = [];
|
|
6
|
+
if (Array.isArray(init))
|
|
7
|
+
this.list = init;
|
|
8
|
+
if (init instanceof Dict)
|
|
9
|
+
this.list = Array.from(init.entries());
|
|
10
|
+
}
|
|
11
|
+
set(key, value) {
|
|
12
|
+
super.set(key, value);
|
|
13
|
+
this.list = (this.list ?? []).concat([[key, value]]);
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
delete(key) {
|
|
17
|
+
const o = super.delete(key);
|
|
18
|
+
this.list = Array.from(this.entries()) ?? [];
|
|
19
|
+
return o;
|
|
20
|
+
}
|
|
21
|
+
map(callback) {
|
|
22
|
+
return this.list.map((x) => callback(x[1]));
|
|
23
|
+
}
|
|
24
|
+
clone() {
|
|
25
|
+
return new Dict(this);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const m = new Map();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dark.d.ts","sourceRoot":"","sources":["../../../src/styles/dark.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,eAAO,MAAM,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"dark.d.ts","sourceRoot":"","sources":["../../../src/styles/dark.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,eAAO,MAAM,UAAU,EAAE,YA0LxB,CAAC"}
|
package/dist/src/styles/dark.js
CHANGED
|
@@ -71,12 +71,14 @@ export const DARK_THEME = {
|
|
|
71
71
|
floating: {
|
|
72
72
|
foreground: "hsla(210, 40%, 98%)",
|
|
73
73
|
background: "hsla(0, 0%, 14%)",
|
|
74
|
+
hover: "hsla(221, 10%, 22%)",
|
|
74
75
|
border: "hsla(240, 7%, 27%)",
|
|
75
76
|
overlay: "hsla(0, 0%, 0%)",
|
|
76
77
|
},
|
|
77
78
|
tooltip: {
|
|
78
79
|
foreground: "hsla(210, 40%, 98%)",
|
|
79
80
|
background: "hsla(0, 0%, 8%)",
|
|
81
|
+
hover: "hsla(221, 10%, 35%)",
|
|
80
82
|
border: "hsla(0, 0%, 19%)",
|
|
81
83
|
overlay: "hsla(0, 0%, 0%)",
|
|
82
84
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"light.d.ts","sourceRoot":"","sources":["../../../src/styles/light.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,eAAO,MAAM,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"light.d.ts","sourceRoot":"","sources":["../../../src/styles/light.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,eAAO,MAAM,WAAW,EAAE,YA0LzB,CAAC"}
|
package/dist/src/styles/light.js
CHANGED
|
@@ -71,12 +71,14 @@ export const LIGHT_THEME = {
|
|
|
71
71
|
floating: {
|
|
72
72
|
foreground: "hsla(217, 15%, 20%)",
|
|
73
73
|
background: "hsla(0, 0%, 100%)",
|
|
74
|
+
hover: "hsla(0, 0%, 92%)",
|
|
74
75
|
border: "hsla(210, 25%, 88%)",
|
|
75
76
|
overlay: "hsla(0, 0%, 0%)",
|
|
76
77
|
},
|
|
77
78
|
tooltip: {
|
|
78
79
|
foreground: "hsla(217, 15%, 20%)",
|
|
79
80
|
background: "hsla(210, 25%, 98%)",
|
|
81
|
+
hover: "hsla(210, 25%, 92%)",
|
|
80
82
|
border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O,EAAE,MAAM,KAAK,KAAK,CAAC;AAEzF,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AAE/B,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,aAAa,EAAE,CAAC,SAAS,EAAE,IAAI;KAC1D,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,aAAa,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,UAAU,CAAC,EAAE,CAAC;CACnF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@g4rcez/components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.71",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"private": false,
|
|
6
6
|
"packageManager": "pnpm@8.15.3",
|
|
@@ -42,7 +42,6 @@
|
|
|
42
42
|
"@floating-ui/react": "0.26.20",
|
|
43
43
|
"@radix-ui/react-slot": "1.1.0",
|
|
44
44
|
"@radix-ui/react-toast": "1.2.1",
|
|
45
|
-
"@tanstack/react-virtual": "3.11.2",
|
|
46
45
|
"class-variance-authority": "0.7.0",
|
|
47
46
|
"clsx": "2.1.1",
|
|
48
47
|
"date-fns": "3.6.0",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Label } from "../../types";
|
|
3
|
-
import { InputFieldProps } from "./input-field";
|
|
4
|
-
import { type OptionProps } from "./select";
|
|
5
|
-
export type VirtualAutocompleteItemProps = OptionProps & {
|
|
6
|
-
Render?: React.FC<OptionProps>;
|
|
7
|
-
};
|
|
8
|
-
export type VirtualAutocomplete = Omit<InputFieldProps<"input">, "value"> & {
|
|
9
|
-
value?: string;
|
|
10
|
-
emptyMessage?: Label;
|
|
11
|
-
dynamicOption?: boolean;
|
|
12
|
-
options: VirtualAutocompleteItemProps[];
|
|
13
|
-
};
|
|
14
|
-
export declare const VirtualAutocomplete: React.ForwardRefExoticComponent<Omit<VirtualAutocomplete, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
15
|
-
//# sourceMappingURL=virtual-autocomplete.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-autocomplete.d.ts","sourceRoot":"","sources":["../../../../src/components/form/virtual-autocomplete.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAoF,MAAM,OAAO,CAAC;AAMzG,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAc,eAAe,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,MAAM,MAAM,4BAA4B,GAAG,WAAW,GAAG;IAAE,MAAM,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,CAAA;CAAE,CAAC;AAI5F,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,GAAG;IACxE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,4BAA4B,EAAE,CAAC;CAC3C,CAAC;AA+BF,eAAO,MAAM,mBAAmB,2GAuU/B,CAAC"}
|