@g4rcez/components 0.0.70 → 0.0.72
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 +53 -58
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8050 -7899
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +51 -56
- package/dist/index.umd.js.map +1 -1
- package/dist/preset/preset.tailwind.js +3 -3
- package/dist/preset/src/styles/dark.d.ts.map +1 -1
- package/dist/preset/src/styles/dark.js +18 -1
- package/dist/preset/src/styles/light.d.ts.map +1 -1
- package/dist/preset/src/styles/light.js +18 -1
- package/dist/preset/src/styles/theme.types.d.ts +4 -1
- package/dist/preset/src/styles/theme.types.d.ts.map +1 -1
- package/dist/preset.tailwind.js +3 -3
- package/dist/src/components/core/button.d.ts +1 -1
- package/dist/src/components/core/button.d.ts.map +1 -1
- package/dist/src/components/core/button.js +4 -3
- package/dist/src/components/core/polymorph.d.ts +1 -1
- package/dist/src/components/core/polymorph.d.ts.map +1 -1
- package/dist/src/components/core/tag.d.ts +2 -2
- package/dist/src/components/core/tag.d.ts.map +1 -1
- package/dist/src/components/core/tag.js +3 -1
- package/dist/src/components/display/calendar.d.ts.map +1 -1
- package/dist/src/components/display/calendar.js +1 -1
- package/dist/src/components/display/step.d.ts +2 -2
- package/dist/src/components/display/step.d.ts.map +1 -1
- package/dist/src/components/display/step.js +7 -7
- package/dist/src/components/display/tabs.d.ts.map +1 -1
- package/dist/src/components/display/tabs.js +3 -3
- package/dist/src/components/floating/menu.d.ts.map +1 -1
- package/dist/src/components/floating/menu.js +19 -16
- package/dist/src/components/floating/modal.d.ts +11 -8
- package/dist/src/components/floating/modal.d.ts.map +1 -1
- package/dist/src/components/floating/modal.js +8 -8
- package/dist/src/components/floating/tooltip.d.ts +2 -2
- package/dist/src/components/floating/tooltip.d.ts.map +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 +91 -30
- 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} +93 -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/form/task-list.js +3 -3
- 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/table-lib.d.ts.map +1 -1
- package/dist/src/components/table/table-lib.js +9 -2
- 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 +15 -0
- package/dist/src/hooks/use-components-provider.d.ts.map +1 -1
- package/dist/src/hooks/use-components-provider.js +26 -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 +18 -1
- package/dist/src/styles/light.d.ts.map +1 -1
- package/dist/src/styles/light.js +18 -1
- package/dist/src/styles/theme.types.d.ts +4 -1
- 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,19 @@ 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
|
+
const displayList = list.filter((x) => x.hidden !== true);
|
|
188
|
+
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
189
|
...props,
|
|
160
|
-
onChange,
|
|
161
190
|
onFocus,
|
|
162
|
-
pattern,
|
|
163
|
-
ref: refs.setReference,
|
|
164
|
-
name: `${id}-shadow`,
|
|
165
191
|
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({
|
|
192
|
+
name: `${id}-shadow`,
|
|
193
|
+
ref: refs.setReference,
|
|
194
|
+
}), 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
195
|
ref: refs.setFloating,
|
|
199
196
|
style: {
|
|
200
197
|
...transitions.styles,
|
|
@@ -202,9 +199,38 @@ export const VirtualAutocomplete = forwardRef(({ options, dynamicOption = false,
|
|
|
202
199
|
left: (x ?? 0) + (!!value ? 26 : 18),
|
|
203
200
|
top: y ?? 0,
|
|
204
201
|
},
|
|
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: [
|
|
202
|
+
}), "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) => {
|
|
203
|
+
if (event.key === "ArrowDown") {
|
|
204
|
+
let next = index + 1;
|
|
205
|
+
if (next > list.length - 1)
|
|
206
|
+
next = 0;
|
|
207
|
+
virtuoso.current?.scrollIntoView({ index: next });
|
|
208
|
+
return setIndex(next);
|
|
209
|
+
}
|
|
210
|
+
if (event.key === "ArrowUp") {
|
|
211
|
+
let next = index - 1;
|
|
212
|
+
if (next < 0)
|
|
213
|
+
next = list.length - 1;
|
|
214
|
+
virtuoso.current?.scrollIntoView({ index: next });
|
|
215
|
+
return setIndex(next);
|
|
216
|
+
}
|
|
217
|
+
if (event.key === "Escape") {
|
|
218
|
+
event.currentTarget.blur();
|
|
219
|
+
return setOpen(false);
|
|
220
|
+
}
|
|
221
|
+
if (event.key === "Enter") {
|
|
222
|
+
if (index !== null && list[index]) {
|
|
223
|
+
event.preventDefault();
|
|
224
|
+
return onSelect(list[index], index);
|
|
225
|
+
}
|
|
226
|
+
if (list.length === 1) {
|
|
227
|
+
event.preventDefault();
|
|
228
|
+
return onSelect(list[0], 0);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}, 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, { ref: virtuoso, data: displayList, components: components, hidden: displayList.length === 0, style: { height: value.size === 0 ? h - 49 : h - 86 }, className: "border-floating-border bg-floating-background p-0 text-foreground", itemContent: (i, option) => {
|
|
206
232
|
const Label = option.Render ?? Frag;
|
|
207
|
-
const active = value
|
|
233
|
+
const active = value.has(option.value) || value.has(option.label ?? "");
|
|
208
234
|
const selected = index === i;
|
|
209
235
|
const children = option.label ?? option.value;
|
|
210
236
|
return (_jsx("button", { "data-value": option.value, ...getItemProps({
|
|
@@ -216,7 +242,6 @@ export const VirtualAutocomplete = forwardRef(({ options, dynamicOption = false,
|
|
|
216
242
|
"aria-selected": active,
|
|
217
243
|
"aria-busy": option.disabled,
|
|
218
244
|
onClick: () => onSelect(option, i),
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
} })] }) })) : null })] }));
|
|
245
|
+
}), 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 }) }) }));
|
|
246
|
+
} }), 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
247
|
});
|
|
@@ -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
|
});
|
|
@@ -10,11 +10,11 @@ export const TaskList = (props) => {
|
|
|
10
10
|
return;
|
|
11
11
|
const handler = (e) => {
|
|
12
12
|
const input = e.target;
|
|
13
|
-
const items = Array.from(container.querySelectorAll("input"));
|
|
14
|
-
const allTaskChecked = items.every((el) => el.checked
|
|
13
|
+
const items = Array.from(container.querySelectorAll("input[data-task=true]"));
|
|
14
|
+
const allTaskChecked = items.every((el) => el.checked);
|
|
15
15
|
const index = items.indexOf(input);
|
|
16
16
|
if (allTaskChecked && index !== -1) {
|
|
17
|
-
animate("input", { scale: [1, 1.35, 1], rotate: [0,
|
|
17
|
+
animate("input", { scale: [1, 1.35, 1], rotate: [0, 20, -20, 0] }, {
|
|
18
18
|
duration: 0.5,
|
|
19
19
|
delay: stagger(0.075, { from: index }),
|
|
20
20
|
});
|
|
@@ -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":"table-lib.d.ts","sourceRoot":"","sources":["../../../../src/components/table/table-lib.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAItC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC,+HAAuD,CAAC;AAE5G,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,IAAI,EAAE,CAAC,SAAS,IAAI,GAAG,EAAE,IAAI,CAAC,GAAG;IACtE,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IACf,OAAO,EAAE,WAAW,EAAE,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,IAAI,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE,KAAG,WAAW,EAItE,CAAC;AAER,oBAAY,OAAO;IACf,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,IAAI,SAAS;CAChB;AAED,eAAO,MAAM,aAAa,UAAW,gBAAgB,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AAC,CAAC,GAAG;IACd,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;CACtC,GAAG;IACA,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;CACzB,CACR,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,IAAI,YAAY,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,IAAI;;;;;;;;;mEArDtC,KAAK,CAAC,SAAS;GA2D9D,CAAC;AA0BF,eAAO,MAAM,mBAAmB,GAAI,CAAC,SAAS,IAAI,QAAQ,MAAM,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE,YAAW,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;;uEArFnE,KAAK,CAAC,SAAS;;;;;gBAgC/C,eAAe,GAAG,IAAI;CA6ErC,CAAC"}
|
|
@@ -27,10 +27,16 @@ const noop = {};
|
|
|
27
27
|
const mergeCols = (cols, saved) => {
|
|
28
28
|
if (!Array.isArray(saved))
|
|
29
29
|
return cols;
|
|
30
|
+
const savedSet = new Set(saved.map((x) => x.id));
|
|
31
|
+
if (!cols.every((x) => savedSet.has(x.id))) {
|
|
32
|
+
return cols;
|
|
33
|
+
}
|
|
30
34
|
const map = new Map(cols.map((x) => [x.id, x]));
|
|
31
|
-
return saved.map((mock) => {
|
|
35
|
+
return saved.map((mock, index) => {
|
|
32
36
|
const original = map.get(mock.id);
|
|
33
|
-
|
|
37
|
+
if (original === undefined)
|
|
38
|
+
return cols[index];
|
|
39
|
+
return original;
|
|
34
40
|
});
|
|
35
41
|
};
|
|
36
42
|
export const useTablePreferences = (name, cols, options = noop) => {
|
|
@@ -49,6 +55,7 @@ export const useTablePreferences = (name, cols, options = noop) => {
|
|
|
49
55
|
LocalStorage.set(`@components/table-${prev.name}`, result);
|
|
50
56
|
return result;
|
|
51
57
|
};
|
|
58
|
+
intercept(get.state());
|
|
52
59
|
return {
|
|
53
60
|
set: (getters) => intercept(getters),
|
|
54
61
|
};
|
|
@@ -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,19 @@ declare const defaultTranslations: {
|
|
|
51
51
|
calendarFromDate: string;
|
|
52
52
|
calendarToDate: string;
|
|
53
53
|
calendarToday: string;
|
|
54
|
+
calendarBackMonth: string;
|
|
55
|
+
calendarNextMonth: string;
|
|
56
|
+
multiComboboxSelectedLabel: string;
|
|
57
|
+
multiComboboxInnerPlaceholder: string;
|
|
54
58
|
};
|
|
55
59
|
export type Translations = typeof defaultTranslations;
|
|
60
|
+
export type Tweaks = {
|
|
61
|
+
input: {
|
|
62
|
+
iconFeedback: boolean;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
56
65
|
type ContextProps = Partial<{
|
|
66
|
+
tweaks: Partial<Tweaks>;
|
|
57
67
|
map: Partial<Translations>;
|
|
58
68
|
locale: Locales | undefined;
|
|
59
69
|
parser: typeof parsers.hsla;
|
|
@@ -110,7 +120,12 @@ export declare const useTranslations: () => {
|
|
|
110
120
|
calendarFromDate: string;
|
|
111
121
|
calendarToDate: string;
|
|
112
122
|
calendarToday: string;
|
|
123
|
+
calendarBackMonth: string;
|
|
124
|
+
calendarNextMonth: string;
|
|
125
|
+
multiComboboxSelectedLabel: string;
|
|
126
|
+
multiComboboxInnerPlaceholder: string;
|
|
113
127
|
};
|
|
114
128
|
export declare const useColorParser: () => (v: string) => `hsla(${string})`;
|
|
129
|
+
export declare const useTweaks: () => Tweaks;
|
|
115
130
|
export {};
|
|
116
131
|
//# 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,KAAK,EAAE,EAA2B,iBAAiB,EAAuB,MAAM,OAAO,CAAC;AAC/F,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"use-components-provider.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-components-provider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAA2B,iBAAiB,EAAuB,MAAM,OAAO,CAAC;AAC/F,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCAgDa;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;;;;;;;;CActI,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,OAAO,mBAAmB,CAAC;AAEtD,MAAM,MAAM,MAAM,GAAG;IACnB,KAAK,EAAE;QACL,YAAY,EAAE,OAAO,CAAC;KACvB,CAAC;CACH,CAAC;AAeF,KAAK,YAAY,GAAG,OAAO,CAAC;IAC1B,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACxB,GAAG,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC3B,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,MAAM,EAAE,OAAO,OAAO,CAAC,IAAI,CAAC;CAC7B,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCAvEU;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;;;;;;;;CA2EtI,CAAC;AAEF,eAAO,MAAM,cAAc,wCAI1B,CAAC;AAEF,eAAO,MAAM,SAAS,QAAO,MAI5B,CAAC"}
|
|
@@ -46,14 +46,29 @@ const defaultTranslations = {
|
|
|
46
46
|
calendarFromDate: "From",
|
|
47
47
|
calendarToDate: "To",
|
|
48
48
|
calendarToday: "Today",
|
|
49
|
+
calendarBackMonth: "Back month",
|
|
50
|
+
calendarNextMonth: "Next month",
|
|
51
|
+
multiComboboxSelectedLabel: "Selected",
|
|
52
|
+
multiComboboxInnerPlaceholder: "Search...",
|
|
53
|
+
};
|
|
54
|
+
const defaultTweaks = {
|
|
55
|
+
input: {
|
|
56
|
+
iconFeedback: true,
|
|
57
|
+
},
|
|
49
58
|
};
|
|
50
59
|
const Context = createContext({
|
|
51
|
-
|
|
52
|
-
|
|
60
|
+
tweaks: defaultTweaks,
|
|
61
|
+
parser: parsers.hsla,
|
|
62
|
+
map: defaultTranslations,
|
|
53
63
|
locale: undefined,
|
|
54
64
|
});
|
|
55
65
|
export const ComponentsProvider = (props) => {
|
|
56
|
-
const memoMap = useMemo(() => ({
|
|
66
|
+
const memoMap = useMemo(() => ({
|
|
67
|
+
locale: props.locale,
|
|
68
|
+
tweaks: { ...defaultTweaks, ...props.tweaks },
|
|
69
|
+
parser: props.parser || parsers.hsla,
|
|
70
|
+
map: { ...defaultTranslations, ...props.map },
|
|
71
|
+
}), [props]);
|
|
57
72
|
return _jsx(Context.Provider, { value: memoMap, children: props.children });
|
|
58
73
|
};
|
|
59
74
|
export const useLocale = (locale) => {
|
|
@@ -68,11 +83,17 @@ export const useTranslations = () => {
|
|
|
68
83
|
const ctx = useContext(Context);
|
|
69
84
|
if (!ctx)
|
|
70
85
|
return defaultTranslations;
|
|
71
|
-
return ctx.
|
|
86
|
+
return ctx.map;
|
|
72
87
|
};
|
|
73
88
|
export const useColorParser = () => {
|
|
74
89
|
const ctx = useContext(Context);
|
|
75
90
|
if (!ctx)
|
|
76
91
|
return parsers.hsla;
|
|
77
|
-
return ctx.
|
|
92
|
+
return ctx.parser;
|
|
93
|
+
};
|
|
94
|
+
export const useTweaks = () => {
|
|
95
|
+
const ctx = useContext(Context);
|
|
96
|
+
if (!ctx)
|
|
97
|
+
return defaultTweaks;
|
|
98
|
+
return ctx.tweaks;
|
|
78
99
|
};
|
|
@@ -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,YAyMxB,CAAC"}
|