@g4rcez/components 3.0.0-0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/core/button.d.ts +2 -8
- package/dist/components/core/button.d.ts.map +1 -1
- package/dist/components/core/button.jsx +11 -18
- package/dist/components/core/polymorph.d.ts.map +1 -1
- package/dist/components/core/slot.d.ts +1 -1
- package/dist/components/core/slot.d.ts.map +1 -1
- package/dist/components/core/slot.jsx +28 -35
- package/dist/components/core/tag.d.ts +1 -1
- package/dist/components/core/tag.d.ts.map +1 -1
- package/dist/components/core/tag.jsx +3 -3
- package/dist/components/core/typography.d.ts.map +1 -1
- package/dist/components/core/typography.jsx +16 -20
- package/dist/components/display/alert.d.ts.map +1 -1
- package/dist/components/display/alert.jsx +19 -17
- package/dist/components/display/calendar.d.ts.map +1 -1
- package/dist/components/display/calendar.jsx +6 -8
- package/dist/components/display/card.d.ts.map +1 -1
- package/dist/components/display/card.jsx +6 -6
- package/dist/components/display/empty.jsx +1 -1
- package/dist/components/display/notifications.d.ts +2 -0
- package/dist/components/display/notifications.d.ts.map +1 -1
- package/dist/components/display/notifications.jsx +76 -48
- package/dist/components/display/progress.d.ts.map +1 -1
- package/dist/components/display/progress.jsx +7 -9
- package/dist/components/display/shortcut.jsx +1 -1
- package/dist/components/display/skeleton.d.ts.map +1 -1
- package/dist/components/display/skeleton.jsx +3 -5
- package/dist/components/display/step.d.ts.map +1 -1
- package/dist/components/display/step.jsx +27 -27
- package/dist/components/display/tabs.d.ts.map +1 -1
- package/dist/components/display/tabs.jsx +5 -7
- package/dist/components/display/timeline.jsx +1 -1
- package/dist/components/floating/command-palette.d.ts +1 -0
- package/dist/components/floating/command-palette.d.ts.map +1 -1
- package/dist/components/floating/command-palette.jsx +92 -70
- package/dist/components/floating/dropdown.d.ts.map +1 -1
- package/dist/components/floating/dropdown.jsx +15 -15
- package/dist/components/floating/menu.d.ts +2 -2
- package/dist/components/floating/menu.jsx +2 -2
- package/dist/components/floating/modal.d.ts +20 -53
- package/dist/components/floating/modal.d.ts.map +1 -1
- package/dist/components/floating/modal.jsx +109 -51
- package/dist/components/floating/tooltip.d.ts.map +1 -1
- package/dist/components/floating/tooltip.jsx +2 -8
- package/dist/components/floating/wizard.d.ts +1 -1
- package/dist/components/floating/wizard.d.ts.map +1 -1
- package/dist/components/floating/wizard.jsx +50 -53
- package/dist/components/form/autocomplete.d.ts.map +1 -1
- package/dist/components/form/autocomplete.jsx +42 -38
- package/dist/components/form/checkbox.jsx +3 -3
- package/dist/components/form/date-picker.d.ts.map +1 -1
- package/dist/components/form/date-picker.jsx +14 -14
- package/dist/components/form/file-upload.jsx +13 -13
- package/dist/components/form/free-text.d.ts.map +1 -1
- package/dist/components/form/free-text.jsx +3 -3
- package/dist/components/form/input-field.d.ts +3 -2
- package/dist/components/form/input-field.d.ts.map +1 -1
- package/dist/components/form/input-field.jsx +43 -41
- package/dist/components/form/multi-select.d.ts.map +1 -1
- package/dist/components/form/multi-select.jsx +56 -56
- package/dist/components/form/select.d.ts.map +1 -1
- package/dist/components/form/select.jsx +3 -3
- package/dist/components/form/slider.d.ts.map +1 -1
- package/dist/components/form/slider.jsx +10 -10
- package/dist/components/form/switch.jsx +2 -2
- package/dist/components/form/transfer-list.jsx +3 -3
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +2 -0
- package/dist/components/page-calendar/calendar-header.d.ts +16 -0
- package/dist/components/page-calendar/calendar-header.d.ts.map +1 -0
- package/dist/components/page-calendar/calendar-header.jsx +81 -0
- package/dist/components/page-calendar/day-view.d.ts +12 -0
- package/dist/components/page-calendar/day-view.d.ts.map +1 -0
- package/dist/components/page-calendar/day-view.jsx +87 -0
- package/dist/components/page-calendar/event-pill.d.ts +9 -0
- package/dist/components/page-calendar/event-pill.d.ts.map +1 -0
- package/dist/components/page-calendar/event-pill.jsx +25 -0
- package/dist/components/page-calendar/index.d.ts +4 -0
- package/dist/components/page-calendar/index.d.ts.map +1 -0
- package/dist/components/page-calendar/index.js +2 -0
- package/dist/components/page-calendar/month-view.d.ts +11 -0
- package/dist/components/page-calendar/month-view.d.ts.map +1 -0
- package/dist/components/page-calendar/month-view.jsx +47 -0
- package/dist/components/page-calendar/page-calendar.d.ts +18 -0
- package/dist/components/page-calendar/page-calendar.d.ts.map +1 -0
- package/dist/components/page-calendar/page-calendar.jsx +41 -0
- package/dist/components/page-calendar/page-calendar.types.d.ts +18 -0
- package/dist/components/page-calendar/page-calendar.types.d.ts.map +1 -0
- package/dist/components/page-calendar/page-calendar.types.js +1 -0
- package/dist/components/page-calendar/page-calendar.utils.d.ts +18 -0
- package/dist/components/page-calendar/page-calendar.utils.d.ts.map +1 -0
- package/dist/components/page-calendar/page-calendar.utils.js +71 -0
- package/dist/components/page-calendar/week-view.d.ts +11 -0
- package/dist/components/page-calendar/week-view.d.ts.map +1 -0
- package/dist/components/page-calendar/week-view.jsx +64 -0
- package/dist/components/table/filter.jsx +4 -4
- package/dist/components/table/index.d.ts.map +1 -1
- package/dist/components/table/index.jsx +10 -10
- package/dist/components/table/inner-table.d.ts.map +1 -1
- package/dist/components/table/inner-table.jsx +18 -18
- package/dist/components/table/metadata.d.ts.map +1 -1
- package/dist/components/table/metadata.jsx +29 -30
- package/dist/components/table/pagination.jsx +1 -1
- package/dist/components/table/row.d.ts.map +1 -1
- package/dist/components/table/row.jsx +17 -17
- package/dist/components/table/sort.jsx +1 -1
- package/dist/components/table/table-lib.d.ts.map +1 -1
- package/dist/components/table/table-lib.js +1 -2
- package/dist/components/table/thead.d.ts.map +1 -1
- package/dist/components/table/thead.jsx +6 -6
- package/dist/config/context.d.ts.map +1 -1
- package/dist/config/default-translations.d.ts +17 -0
- package/dist/config/default-translations.d.ts.map +1 -1
- package/dist/config/default-translations.jsx +18 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/hooks/use-components-provider.d.ts.map +1 -1
- package/dist/hooks/use-components-provider.jsx +4 -1
- package/dist/hooks/use-form.d.ts +11 -11
- package/dist/hooks/use-form.d.ts.map +1 -1
- package/dist/hooks/use-form.js +1 -0
- package/dist/hooks/use-input-id.d.ts.map +1 -1
- package/dist/hooks/use-is-coarse-device.js +1 -1
- package/dist/hooks/use-preferences.d.ts.map +1 -1
- package/dist/hooks/use-previous.d.ts.map +1 -1
- package/dist/hooks/use-previous.js +1 -0
- package/dist/hooks/use-reactive.d.ts.map +1 -1
- package/dist/hooks/use-reactive.js +1 -0
- package/dist/hooks/use-resize-observer.d.ts.map +1 -1
- package/dist/hooks/use-stable-ref.d.ts.map +1 -1
- package/dist/hooks/use-stable-ref.js +1 -0
- package/dist/hooks/use-swipe.d.ts.map +1 -1
- package/dist/hooks/use-swipe.js +1 -0
- package/dist/hooks/use-translations.d.ts +17 -0
- package/dist/hooks/use-translations.d.ts.map +1 -1
- package/dist/index.css +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13689 -12344
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +24 -17
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/dom.d.ts +1 -0
- package/dist/lib/dom.d.ts.map +1 -1
- package/dist/lib/dom.js +20 -2
- package/dist/lib/fns.d.ts.map +1 -1
- package/dist/lib/fns.js +2 -2
- package/dist/preset/plugin.tailwind.d.ts +9 -0
- package/dist/preset/plugin.tailwind.d.ts.map +1 -0
- package/dist/preset/plugin.tailwind.js +27 -0
- package/dist/preset/preset.tailwind.d.ts +8 -0
- package/dist/preset/preset.tailwind.d.ts.map +1 -0
- package/dist/preset/preset.tailwind.js +54 -0
- package/dist/preset/src/styles/common.d.ts +2 -14
- package/dist/preset/src/styles/common.d.ts.map +1 -1
- package/dist/preset/src/styles/common.js +1 -0
- package/dist/preset/src/styles/dark.d.ts.map +1 -1
- package/dist/preset/src/styles/dark.js +119 -114
- package/dist/preset/src/styles/light.d.ts.map +1 -1
- package/dist/preset/src/styles/light.js +111 -106
- package/dist/preset/src/styles/theme.types.d.ts +17 -8
- package/dist/preset/src/styles/theme.types.d.ts.map +1 -1
- package/dist/styles/common.d.ts +2 -14
- package/dist/styles/common.d.ts.map +1 -1
- package/dist/styles/common.js +1 -0
- package/dist/styles/dark.d.ts.map +1 -1
- package/dist/styles/dark.js +119 -114
- package/dist/styles/light.d.ts.map +1 -1
- package/dist/styles/light.js +111 -106
- package/dist/styles/theme.types.d.ts +17 -8
- package/dist/styles/theme.types.d.ts.map +1 -1
- package/package.json +299 -301
- package/dist/preset/tailwindcssv4.d.ts +0 -3
- package/dist/preset/tailwindcssv4.d.ts.map +0 -1
- package/dist/preset/tailwindcssv4.js +0 -75
|
@@ -35,8 +35,8 @@ const partValues = {
|
|
|
35
35
|
};
|
|
36
36
|
const formatParts = (datetimeFormat, date) => {
|
|
37
37
|
try {
|
|
38
|
-
return datetimeFormat.formatToParts(date).map(x => {
|
|
39
|
-
if (
|
|
38
|
+
return datetimeFormat.formatToParts(date).map((x) => {
|
|
39
|
+
if (x.type === "literal" && x.value === ", ") {
|
|
40
40
|
return { type: x.type, value: " " };
|
|
41
41
|
}
|
|
42
42
|
return x;
|
|
@@ -98,18 +98,18 @@ export const DatePicker = forwardRef(({ date, locale: inputLocal, disabledDate,
|
|
|
98
98
|
};
|
|
99
99
|
const validDate = isValid(innerDate);
|
|
100
100
|
const htmlValue = validDate ? innerDate.toISOString() : undefined;
|
|
101
|
-
const CalendarComponent = <Calendar {...props} type={type} locale={locale} changeOnlyOnClick markToday={markToday} onChange={onChangeDate} disabledDate={disabledDate} date={validDate ? innerDate : undefined}
|
|
101
|
+
const CalendarComponent = (<Calendar {...props} type={type} locale={locale} changeOnlyOnClick markToday={markToday} onChange={onChangeDate} disabledDate={disabledDate} date={validDate ? innerDate : undefined}/>);
|
|
102
102
|
return (<Fragment>
|
|
103
|
-
<Input {...props} mask={mask} value={value} id={undefined} name={undefined} data-value={htmlValue} formNoValidate={!open} data-target={props.name} data-component="date-picker" onChange={onChangeDateInput} required={props.required ?? true} error={open ? undefined : props.error} placeholder={props.placeholder || translation.datepickerPlaceholder(placeholder)} right={floating ? <Fragment>
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
103
|
+
<Input {...props} mask={mask} value={value} id={undefined} name={undefined} data-value={htmlValue} formNoValidate={!open} data-target={props.name} data-component="date-picker" onChange={onChangeDateInput} required={props.required ?? true} error={open ? undefined : props.error} placeholder={props.placeholder || translation.datepickerPlaceholder(placeholder)} right={floating ? (<Fragment>
|
|
104
|
+
<input data-origin={props.name} defaultValue={htmlValue} form={props.form} hidden id={props.name} name={props.name} ref={externalRef} type="date"/>
|
|
105
|
+
<Dropdown open={open} onChange={setOpen} buttonProps={{ "aria-describedby": labelId }} trigger={<span aria-labelledby={labelId}>
|
|
106
|
+
<span id={labelId} className="sr-only">
|
|
107
|
+
{translation.datePickerCalendarButtonLabel}
|
|
108
|
+
</span>
|
|
109
|
+
<CalendarIcon />
|
|
110
|
+
</span>}>
|
|
111
|
+
{CalendarComponent}
|
|
112
|
+
</Dropdown>
|
|
113
|
+
</Fragment>) : null}/>
|
|
114
114
|
</Fragment>);
|
|
115
115
|
});
|
|
@@ -47,30 +47,30 @@ const ItemViewer = (props) => {
|
|
|
47
47
|
props.onDeleteFile?.(props.file);
|
|
48
48
|
};
|
|
49
49
|
const Icon = extensionMap[props.file.name.split(".").at(-1)] ?? FileIcon;
|
|
50
|
-
const Element = info.type === "img" ? (<img src={info.url} className="object-contain
|
|
51
|
-
return (<li className="flex flex-row
|
|
50
|
+
const Element = info.type === "img" ? (<img src={info.url} className="w-full object-contain" alt={props.file.name}/>) : (<Icon strokeWidth={2} absoluteStrokeWidth size={48}/>);
|
|
51
|
+
return (<li className="flex w-full flex-row justify-between gap-4 border-b border-card-border last:border-b-transparent">
|
|
52
52
|
<div className="flex flex-col gap-4">
|
|
53
|
-
<div className="flex flex-row gap-4
|
|
54
|
-
<button type="button" onClick={onViewFile} className="
|
|
53
|
+
<div className="flex flex-row items-center gap-4">
|
|
54
|
+
<button type="button" onClick={onViewFile} className="m-2 flex size-16 max-w-16 items-center justify-center overflow-hidden">
|
|
55
55
|
{Element}
|
|
56
56
|
</button>
|
|
57
|
-
<div className="flex flex-col
|
|
57
|
+
<div className="flex flex-col items-start justify-start text-left">
|
|
58
58
|
<span>{props.file.name}</span>
|
|
59
59
|
<span className="text-sm italic">{info.size}</span>
|
|
60
60
|
</div>
|
|
61
61
|
</div>
|
|
62
|
-
{props.File ? (<div className="
|
|
62
|
+
{props.File ? (<div className="min-w-full flex-1">
|
|
63
63
|
<props.File file={props.file}/>
|
|
64
64
|
</div>) : null}
|
|
65
65
|
</div>
|
|
66
|
-
<div className="flex justify-start py-4 transition-colors duration-300 ease-linear
|
|
67
|
-
<button onClick={onDeleteFile} type="button" className="flex
|
|
66
|
+
<div className="align-start flex justify-start py-4 transition-colors duration-300 ease-linear hover:text-danger-hover">
|
|
67
|
+
<button onClick={onDeleteFile} type="button" className="flex size-6 items-center justify-center">
|
|
68
68
|
<XIcon size={16}/>
|
|
69
69
|
</button>
|
|
70
70
|
</div>
|
|
71
71
|
</li>);
|
|
72
72
|
};
|
|
73
|
-
const FilesList = (props) => (<ul className="space-y-8
|
|
73
|
+
const FilesList = (props) => (<ul className="w-full space-y-8">
|
|
74
74
|
{props.files.map((file) => {
|
|
75
75
|
return <ItemViewer File={props.File} onDeleteFile={props.onDeleteFile} key={file.name} file={file}/>;
|
|
76
76
|
})}
|
|
@@ -78,13 +78,13 @@ const FilesList = (props) => (<ul className="space-y-8 w-full">
|
|
|
78
78
|
const Idle = (props) => {
|
|
79
79
|
const t = useTranslations();
|
|
80
80
|
const Icon = props.dragging ? FolderOpenIcon : FolderIcon;
|
|
81
|
-
return (<div className="flex flex-col
|
|
82
|
-
<div className="flex flex-col
|
|
81
|
+
return (<div className="flex flex-col items-center justify-center">
|
|
82
|
+
<div className="flex flex-col items-center justify-center gap-2">
|
|
83
83
|
<Icon className="text-primary" size={80}/>
|
|
84
84
|
</div>
|
|
85
|
-
<div className="flex flex-col
|
|
85
|
+
<div className="my-4 flex flex-col items-center gap-1">
|
|
86
86
|
<p>{t.uploadIdle}</p>
|
|
87
|
-
<button className="
|
|
87
|
+
<button className="text-primary underline" type="button">
|
|
88
88
|
{t.uploadIdleButton}
|
|
89
89
|
</button>
|
|
90
90
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"free-text.d.ts","sourceRoot":"","sources":["../../../src/components/form/free-text.tsx"],"names":[],"mappings":"AAEA,OAAO,SAAS,EAAE,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAc,eAAe,EAAE,MAAM,eAAe,CAAC;AAE3E,KAAK,WAAW,GAAG,OAAO,GAAG,UAAU,CAAC;AAExC,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,WAAW,EAAE,UAAU,SAAS,GAAG,IAAI,QAAQ,CAC/E,eAAe,CAAC,CAAC,CAAC,GAAG,aAAa,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,EAChF,UAAU,CACb,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,KAAK,CAAC,CAAC,SAAS,WAAW,EAAE,KAAK,CAAC,IAAI,SAAS,gBAAgB,GAAG,mBAAmB,EAAE,KAAK,SAAS,GAAG,EACpI,SAAS,OAAO,GAAG,UAAU,GAAG,OAAO,SAAS,EAChD,aAAa,OAAO,GAAG,UAAU,EACjC,cAAc,aAAa,CAAC,CAAC,EAAE,KAAK,CAAC,EACrC,WAAW,CAAC,EAAE,EAAE,IAAI,KAAK,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"free-text.d.ts","sourceRoot":"","sources":["../../../src/components/form/free-text.tsx"],"names":[],"mappings":"AAEA,OAAO,SAAS,EAAE,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAc,eAAe,EAAE,MAAM,eAAe,CAAC;AAE3E,KAAK,WAAW,GAAG,OAAO,GAAG,UAAU,CAAC;AAExC,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,WAAW,EAAE,UAAU,SAAS,GAAG,IAAI,QAAQ,CAC/E,eAAe,CAAC,CAAC,CAAC,GAAG,aAAa,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,EAChF,UAAU,CACb,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,KAAK,CAAC,CAAC,SAAS,WAAW,EAAE,KAAK,CAAC,IAAI,SAAS,gBAAgB,GAAG,mBAAmB,EAAE,KAAK,SAAS,GAAG,EACpI,SAAS,OAAO,GAAG,UAAU,GAAG,OAAO,SAAS,EAChD,aAAa,OAAO,GAAG,UAAU,EACjC,cAAc,aAAa,CAAC,CAAC,EAAE,KAAK,CAAC,EACrC,WAAW,CAAC,EAAE,EAAE,IAAI,KAAK,MAAM,IAAI,4CAyGtC,CAAC"}
|
|
@@ -3,7 +3,7 @@ import React, { forwardRef, useEffect, useRef } from "react";
|
|
|
3
3
|
import { css, initializeInputDataset, mergeRefs } from "../../lib/dom";
|
|
4
4
|
import { InputField } from "./input-field";
|
|
5
5
|
export const createFreeText = (Element, elementName, defaultProps, register) => {
|
|
6
|
-
const FreeText = forwardRef(({ info, left, next, error, right, container, rightLabel, interactive, optionalText, type = "text", labelClassName, feedback = null, hideLeft = false, loading, ...props }, ref) => {
|
|
6
|
+
const FreeText = forwardRef(({ info, left, next, error, right, container, rightLabel, interactive, optionalText, type = "text", labelClassName, feedback = null, hideLeft = false, loading, hiddenLabel, ...props }, ref) => {
|
|
7
7
|
const Render = Element;
|
|
8
8
|
const id = props.id ?? props.name;
|
|
9
9
|
const inputRef = useRef(null);
|
|
@@ -33,8 +33,8 @@ export const createFreeText = (Element, elementName, defaultProps, register) =>
|
|
|
33
33
|
input.removeEventListener("keydown", goNextInputImpl);
|
|
34
34
|
};
|
|
35
35
|
}, []);
|
|
36
|
-
return (<InputField {...defaultProps} info={info} left={left} error={error} right={right}
|
|
37
|
-
<Render {...defaultProps} {...props} id={id} name={id} type={type} data-next={next} aria-busy={props.disabled} aria-disabled={props.disabled} aria-readonly={props.readOnly} ref={mergeRefs(ref, inputRef)} 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-base text-foreground", "outline-
|
|
36
|
+
return (<InputField {...defaultProps} info={info} left={left} error={error} right={right} form={props.form} loading={loading} name={props.name} feedback={feedback} hideLeft={hideLeft} title={props.title} rightLabel={rightLabel} disabled={props.disabled} hiddenLabel={hiddenLabel} interactive={interactive} required={props.required} componentName={elementName} id={props.name || props.id} optionalText={optionalText} labelClassName={labelClassName} placeholder={props.placeholder} container={css(container, defaultProps.container)}>
|
|
37
|
+
<Render {...defaultProps} {...props} id={id} name={id} type={type} data-next={next} aria-busy={props.disabled} aria-disabled={props.disabled} aria-readonly={props.readOnly} ref={mergeRefs(ref, inputRef)} 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-base 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", "resize-y group-focus-within:border-primary group-hover:border-primary", "disabled:cursor-not-allowed disabled:text-disabled", props.className)}/>
|
|
38
38
|
</InputField>);
|
|
39
39
|
});
|
|
40
40
|
return FreeText;
|
|
@@ -5,10 +5,11 @@ export type FeedbackProps = React.PropsWithChildren<Partial<{
|
|
|
5
5
|
id: string;
|
|
6
6
|
info: Label;
|
|
7
7
|
title: Label;
|
|
8
|
-
hideLeft
|
|
9
|
-
className
|
|
8
|
+
hideLeft: boolean;
|
|
9
|
+
className: string;
|
|
10
10
|
placeholder: string;
|
|
11
11
|
reportStatus: boolean;
|
|
12
|
+
hiddenLabel: boolean;
|
|
12
13
|
}>>;
|
|
13
14
|
export declare const InputFeedback: ({ reportStatus, id, hideLeft, className, info, children, title }: FeedbackProps) => React.JSX.Element;
|
|
14
15
|
export type InputFieldProps<T extends "input" | "select" | "textarea"> = PolymorphicProps<Partial<Override<FeedbackProps, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-field.d.ts","sourceRoot":"","sources":["../../../src/components/form/input-field.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAwB,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAI5E,OAAO,EAAE,KAAK,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,iBAAiB,
|
|
1
|
+
{"version":3,"file":"input-field.d.ts","sourceRoot":"","sources":["../../../src/components/form/input-field.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAwB,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAI5E,OAAO,EAAE,KAAK,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,iBAAiB,CAC/C,OAAO,CAAC;IACJ,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,KAAK,CAAC;IACZ,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;CACxB,CAAC,CACL,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,kEAA0E,aAAa,sBAmDpH,CAAC;AAEF,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,OAAO,GAAG,QAAQ,GAAG,UAAU,IAAI,gBAAgB,CACrF,OAAO,CACH,QAAQ,CACJ,aAAa,EACb;IACI,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,KAAK,CAAC;IACZ,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,KAAK,CAAC;IACZ,QAAQ,EAAE,KAAK,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,KAAK,CAAC;IACb,UAAU,EAAE,KAAK,CAAC;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACvB,CACJ,CACJ,EACD,CAAC,CACJ,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,CAAC,CAAC,SAAS,OAAO,GAAG,QAAQ,GAAG,UAAU,EAAE,KAAK,EAAE,iBAAiB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,YAmFpH,CAAC"}
|
|
@@ -5,50 +5,52 @@ import { useTranslations } from "../../hooks/use-translations";
|
|
|
5
5
|
import { useTweaks } from "../../hooks/use-tweaks";
|
|
6
6
|
import { css } from "../../lib/dom";
|
|
7
7
|
import { Tooltip } from "../floating/tooltip";
|
|
8
|
-
export const InputFeedback = ({ reportStatus, id, hideLeft = false, className, info, children, title }) => (<span className={css("
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
8
|
+
export const InputFeedback = ({ reportStatus, id, hideLeft = false, className, info, children, title }) => (<span className={css("w-full justify-between", hideLeft && children === null ? "hidden" : "flex", className)}>
|
|
9
|
+
{hideLeft ? null : (<span className="flex items-center gap-1 transition-colors group-focus-within:text-primary group-hover:text-primary group-disabled:text-disabled group-error:text-danger">
|
|
10
|
+
{title}
|
|
11
|
+
{reportStatus || info ? (<span className="flex items-center justify-center gap-1">
|
|
12
|
+
{info ? (<Tooltip as="button" type="button" aria-label={typeof info === "string" ? info : undefined} aria-describedby={typeof info === "string" ? undefined : id ? `tooltip-info-content-${id}` : undefined} title={<span className="cursor-help">
|
|
13
|
+
<InfoIcon className="aspect-square size-3" aria-hidden="true" size={16} strokeWidth={1} absoluteStrokeWidth/>
|
|
14
|
+
</span>}>
|
|
15
|
+
<div id={id ? `tooltip-info-content-${id}` : undefined} className="w-full max-w-48 whitespace-break-spaces break-words">
|
|
16
|
+
{info}
|
|
17
|
+
</div>
|
|
18
|
+
</Tooltip>) : null}
|
|
19
|
+
{reportStatus ? (<span className="flex h-3 min-w-6 items-center">
|
|
20
|
+
<CheckCircle className="hidden aspect-square size-3 opacity-0 transition-opacity group-assert:block group-assert:text-success group-assert:opacity-100" aria-hidden="true" size={16} strokeWidth={1} absoluteStrokeWidth/>
|
|
21
|
+
<XCircle className="hidden aspect-square size-3 opacity-0 transition-opacity group-error:block group-error:opacity-100" aria-hidden="true" size={16} strokeWidth={1} absoluteStrokeWidth/>
|
|
22
|
+
</span>) : null}
|
|
23
|
+
</span>) : null}
|
|
24
|
+
</span>)}
|
|
25
|
+
{children}
|
|
26
|
+
</span>);
|
|
27
|
+
export const InputField = forwardRef(({ optionalText: _optionalText, left, rightLabel, container, feedback, interactive, right, info, children, error, form, id, labelClassName = "", name, title, componentName, placeholder, hideLeft = false, required, disabled, reportStatus, hiddenLabel, }, ref) => {
|
|
26
28
|
const tweaks = useTweaks();
|
|
27
29
|
const reportStatusDefault = reportStatus !== undefined ? reportStatus : tweaks.input.iconFeedback;
|
|
28
30
|
const ID = id ?? name;
|
|
29
31
|
const translation = useTranslations();
|
|
30
32
|
const optionalText = _optionalText ?? translation.inputOptionalLabel;
|
|
31
|
-
return (<fieldset ref={ref} form={form} disabled={disabled} data-error={!!error} aria-disabled={disabled} data-component={componentName} data-interactive={!!interactive} className={css("group flex min-h-0
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
33
|
+
return (<fieldset ref={ref} form={form} disabled={disabled} data-error={!!error} aria-disabled={disabled} data-component={componentName} data-interactive={!!interactive} className={css("group flex min-h-0 min-w-0 max-w-full flex-col items-start", container)}>
|
|
34
|
+
<label form={form} htmlFor={ID} className="relative inline-flex w-full max-w-full cursor-text flex-row flex-wrap justify-between gap-1 text-field-label text-sm transition-colors empty:hidden group-disabled:cursor-not-allowed group-error:text-danger">
|
|
35
|
+
{hiddenLabel ? null : (<InputFeedback info={info} hideLeft={hideLeft} reportStatus={reportStatusDefault} title={title} placeholder={placeholder}>
|
|
36
|
+
{optionalText || rightLabel ? (<Fragment>
|
|
37
|
+
{!required ? (<span aria-disabled={disabled} className="text-opacity-70 transition-colors group-focus-within:text-primary group-hover:text-primary aria-disabled:text-disabled">
|
|
38
|
+
{optionalText}
|
|
39
|
+
</span>) : null}
|
|
40
|
+
{rightLabel ? <Fragment>{rightLabel}</Fragment> : null}
|
|
41
|
+
</Fragment>) : null}
|
|
42
|
+
</InputFeedback>)}
|
|
43
|
+
<div className={`group relative flex w-full flex-row flex-nowrap items-center gap-x-2 gap-y-1 rounded-md border border-input-border bg-transparent transition-colors group-hover:border-primary group-disabled:border-disabled group-error:border-danger ${labelClassName}`}>
|
|
44
|
+
{left ? <span className="flex flex-nowrap gap-1 whitespace-nowrap pl-2">{left}</span> : null}
|
|
45
|
+
{children}
|
|
46
|
+
{right ? <span className="flex flex-nowrap gap-2 whitespace-nowrap pr-2">{right}</span> : null}
|
|
47
|
+
</div>
|
|
48
|
+
</label>
|
|
49
|
+
<p className="mt-input-gap hidden whitespace-pre-wrap text-wrap text-xs empty:mt-0 empty:hidden group-has-[input:not(:focus):invalid[data-initialized=true]]:flex group-error:flex group-error:text-danger">
|
|
50
|
+
{error}
|
|
51
|
+
</p>
|
|
52
|
+
<p className="mt-input-gap text-xs empty:mt-0 empty:hidden group-has-[input:not(:focus):valid[data-initialized=true]]:block group-assert:block group-error:hidden">
|
|
53
|
+
{feedback}
|
|
54
|
+
</p>
|
|
55
|
+
</fieldset>);
|
|
54
56
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multi-select.d.ts","sourceRoot":"","sources":["../../../src/components/form/multi-select.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAA6F,MAAM,OAAO,CAAC;AASlH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,EAAc,eAAe,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,MAAM,MAAM,oBAAoB,GAAG,WAAW,GAAG;IAAE,MAAM,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,CAAA;CAAE,CAAC;AAEpF,MAAM,MAAM,gBAAgB,GAAG,QAAQ,
|
|
1
|
+
{"version":3,"file":"multi-select.d.ts","sourceRoot":"","sources":["../../../src/components/form/multi-select.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAA6F,MAAM,OAAO,CAAC;AASlH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,EAAc,eAAe,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,MAAM,MAAM,oBAAoB,GAAG,WAAW,GAAG;IAAE,MAAM,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,CAAA;CAAE,CAAC;AAEpF,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CACnC,eAAe,CAAC,OAAO,CAAC,EACxB;IACI,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,oBAAoB,EAAE,CAAC;IAChC,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CACjD,CACJ,CAAC;AA0DF,eAAO,MAAM,WAAW,wGAuavB,CAAC"}
|
|
@@ -24,9 +24,9 @@ const transitionStyles = {
|
|
|
24
24
|
};
|
|
25
25
|
const emptyRef = [];
|
|
26
26
|
const List = forwardRef(function VirtualList(props, ref) {
|
|
27
|
-
return (<motion.ul {...props} role="listbox" ref={ref} className="w-full rounded-b-lg border-b last:border-transparent
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
return (<motion.ul {...props} role="listbox" ref={ref} className="w-full rounded-b-lg border-b border-tooltip-border last:border-transparent">
|
|
28
|
+
<AnimatePresence>{props.children}</AnimatePresence>
|
|
29
|
+
</motion.ul>);
|
|
30
30
|
});
|
|
31
31
|
const Item = forwardRef(function VirtualItem({ item, context, ...props }, ref) {
|
|
32
32
|
return <motion.li {...props} ref={ref} className="last:rounded-t-lg"/>;
|
|
@@ -50,10 +50,10 @@ const OverflowControl = (props) => {
|
|
|
50
50
|
return setNormalView(true);
|
|
51
51
|
}, [countable]);
|
|
52
52
|
return (<span ref={ref} className="flex flex-nowrap gap-x-2">
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
{!normalView ? (props.children) : (<Tag size="small" data-multicounter="true">
|
|
54
|
+
{countable} {translate.multiSelectSelectedLabel}
|
|
55
|
+
</Tag>)}
|
|
56
|
+
</span>);
|
|
57
57
|
};
|
|
58
58
|
export const MultiSelect = forwardRef(({ left, error, right, options, container, rightLabel, interactive, emptyMessage, optionalText, selectedLabel, labelClassName, feedback = null, hideLeft = false, required = false, dynamicOption = false, onChangeOptions, ...props }, externalRef) => {
|
|
59
59
|
const map = useMemo(() => new Dict(options.map((x) => [x.value, x])), [options]);
|
|
@@ -208,38 +208,38 @@ export const MultiSelect = forwardRef(({ left, error, right, options, container,
|
|
|
208
208
|
e.stopPropagation();
|
|
209
209
|
onSelect(x, i);
|
|
210
210
|
}}>
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
211
|
+
<XIcon size={14}/>
|
|
212
|
+
</button>}>
|
|
213
|
+
{x.label ?? x.value}
|
|
214
|
+
</Tag>));
|
|
215
215
|
const scrollableContainerStyle = { height: isEmpty ? "0" : value.size === 0 ? h - 49 : h - 86 };
|
|
216
|
-
return (<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={<span className="flex gap-0.5
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
216
|
+
return (<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={<span className="flex items-center gap-0.5">
|
|
217
|
+
{right}
|
|
218
|
+
<button type="button" className="transition-colors link:text-primary" onClick={onCaretDownClick}>
|
|
219
|
+
<ChevronDown size={20}/>
|
|
220
|
+
<span className="sr-only">{translation.inputCaretDown}</span>
|
|
221
|
+
</button>
|
|
222
|
+
{value ? (<button type="button" onClick={onClose} className="transition-colors link:text-danger">
|
|
223
|
+
<svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
224
|
+
<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"/>
|
|
225
|
+
</svg>
|
|
226
|
+
</button>) : null}
|
|
227
|
+
</span>}>
|
|
228
|
+
<ul {...getReferenceProps({
|
|
229
229
|
...props,
|
|
230
230
|
onFocus,
|
|
231
231
|
id: `${id}-shadow`,
|
|
232
232
|
name: `${id}-shadow`,
|
|
233
233
|
ref: refs.setReference,
|
|
234
|
-
})} tabIndex={0} role="button" data-name={id} data-target={id} data-shadow="true" data-error={!!error} aria-autocomplete="list" data-value={values.join(",")} className={css("input
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
234
|
+
})} tabIndex={0} role="button" data-name={id} data-target={id} data-shadow="true" data-error={!!error} aria-autocomplete="list" data-value={values.join(",")} className={css("input placeholder-input-mask group h-input-height w-full text-base", "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", "max-w-full overflow-x-auto truncate overflow-ellipsis", props.className)}>
|
|
235
|
+
{values.length > 0 ? null : <li className="text-input-placeholder">{props.placeholder}</li>}
|
|
236
|
+
<OverflowControl label={selectedLabel}>{tags}</OverflowControl>
|
|
237
|
+
</ul>
|
|
238
|
+
<input id={id} name={id} type="hidden" data-origin={id} ref={externalRef} required={required} defaultValue={props.value || values || undefined}/>
|
|
239
|
+
<FloatingPortal preserveTabOrder>
|
|
240
|
+
{open ? (<FloatingOverlay lockScroll>
|
|
241
|
+
<FloatingFocusManager modal guards returnFocus={false} context={context} initialFocus={-1} visuallyHiddenDismiss>
|
|
242
|
+
<div {...getFloatingProps({
|
|
243
243
|
ref: refs.setFloating,
|
|
244
244
|
style: {
|
|
245
245
|
...transitions.styles,
|
|
@@ -248,8 +248,8 @@ export const MultiSelect = forwardRef(({ left, error, right, options, container,
|
|
|
248
248
|
left: x,
|
|
249
249
|
height: h - (values.length === 0 ? 65 : 30),
|
|
250
250
|
},
|
|
251
|
-
})} data-floating="true" className="
|
|
252
|
-
|
|
251
|
+
})} data-floating="true" className="shadow-floating isolate z-floating m-0 max-h-96 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">
|
|
252
|
+
<input autoFocus value={shadow} onChange={onChange} title={props.title} placeholder={translation.multiSelectInnerPlaceholder} className="input placeholder-input-mask group mb-1 h-10 w-full flex-1 rounded 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" onKeyDown={(event) => {
|
|
253
253
|
if (event.key === "ArrowDown") {
|
|
254
254
|
let next = index + 1;
|
|
255
255
|
if (next > displayList.length - 1)
|
|
@@ -279,12 +279,12 @@ export const MultiSelect = forwardRef(({ left, error, right, options, container,
|
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
281
|
}}/>
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
282
|
+
{isEmpty ? (<li role="option" className="w-full border-b border-tooltip-border last:border-transparent">
|
|
283
|
+
<span className="flex w-full justify-between p-2 text-left text-disabled">
|
|
284
|
+
{emptyMessage || translation.autocompleteEmpty}
|
|
285
|
+
</span>
|
|
286
|
+
</li>) : null}
|
|
287
|
+
{isEmpty ? null : (<motion.div initial={false} data-floating="true" ref={removeScrollRef} animate={{ height: isEmpty ? "auto" : h }} style={scrollableContainerStyle} className="max-h-72 w-full overscroll-contain" onAnimationComplete={() => {
|
|
288
288
|
if (!open)
|
|
289
289
|
return setH(0);
|
|
290
290
|
const ul = refs.floating.current;
|
|
@@ -292,7 +292,7 @@ export const MultiSelect = forwardRef(({ left, error, right, options, container,
|
|
|
292
292
|
const sum = (li ? li.getBoundingClientRect().height : 40) * displayList.length;
|
|
293
293
|
return flushSync(() => setH(sum + 2));
|
|
294
294
|
}}>
|
|
295
|
-
|
|
295
|
+
<Virtuoso ref={virtuoso} hidden={isEmpty} data={displayList} components={components} style={scrollableContainerStyle} className="max-h-72 border-floating-border bg-floating-background p-0 text-foreground" itemContent={(i, option) => {
|
|
296
296
|
const Label = option.Render ?? Frag;
|
|
297
297
|
const active = value.has(option.value) || value.has(option.label ?? "");
|
|
298
298
|
const selected = index === i;
|
|
@@ -307,22 +307,22 @@ export const MultiSelect = forwardRef(({ left, error, right, options, container,
|
|
|
307
307
|
"aria-busy": option.disabled,
|
|
308
308
|
onClick: () => onSelect(option, i),
|
|
309
309
|
})} className={`flex w-full max-w-full cursor-pointer items-center justify-start p-2 text-left hover:bg-floating-hover focus:bg-floating-hover ${active || selected ? "bg-floating-hover text-floating-foreground" : ""}`}>
|
|
310
|
-
|
|
310
|
+
<Checkbox onChange={noop} checked={active} aria-checked={active} onClick={(e) => {
|
|
311
311
|
e.stopPropagation();
|
|
312
312
|
onSelect(option, i);
|
|
313
313
|
}}/>
|
|
314
|
-
|
|
315
|
-
|
|
314
|
+
<Label {...props} label={option.label} value={option.value} children={children}/>
|
|
315
|
+
</button>);
|
|
316
316
|
}}/>
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
317
|
+
</motion.div>)}
|
|
318
|
+
<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">
|
|
319
|
+
{value.size === 0 ? (<Tag theme="muted" size="small">
|
|
320
|
+
{translation.autocompleteEmpty}
|
|
321
|
+
</Tag>) : (tags)}
|
|
322
|
+
</div>
|
|
323
|
+
</div>
|
|
324
|
+
</FloatingFocusManager>
|
|
325
|
+
</FloatingOverlay>) : null}
|
|
326
|
+
</FloatingPortal>
|
|
327
|
+
</InputField>);
|
|
328
328
|
});
|
|
@@ -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,oGA2GlB,CAAC"}
|
|
@@ -4,7 +4,7 @@ import React, { forwardRef, useEffect, useImperativeHandle, useRef } from "react
|
|
|
4
4
|
import { useTranslations } from "../../hooks/use-translations";
|
|
5
5
|
import { css, initializeInputDataset, mergeRefs } from "../../lib/dom";
|
|
6
6
|
import { InputField } from "./input-field";
|
|
7
|
-
export const Select = forwardRef(({ required = true, options, info, selectContainer = "", feedback = null, labelClassName, interactive, rightLabel, loading, optionalText, container, hideLeft = false, right, left, error, ...props }, ref) => {
|
|
7
|
+
export const Select = forwardRef(({ required = true, options, info, selectContainer = "", feedback = null, labelClassName, interactive, rightLabel, hiddenLabel, loading, optionalText, container, hideLeft = false, right, left, error, ...props }, ref) => {
|
|
8
8
|
const translation = useTranslations();
|
|
9
9
|
const inputRef = useRef(null);
|
|
10
10
|
const id = props.id ?? props.name;
|
|
@@ -25,14 +25,14 @@ export const Select = forwardRef(({ required = true, options, info, selectContai
|
|
|
25
25
|
};
|
|
26
26
|
}, []);
|
|
27
27
|
const onClickLabel = () => inputRef.current?.focus();
|
|
28
|
-
return (<InputField info={info} left={left} error={error} form={props.form} loading={loading} 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={<label htmlFor={id}>
|
|
28
|
+
return (<InputField info={info} left={left} error={error} form={props.form} loading={loading} name={props.name} feedback={feedback} hideLeft={hideLeft} required={required} title={props.title} container={container} componentName="select" rightLabel={rightLabel} hiddenLabel={hiddenLabel} interactive={interactive} id={props.name || props.id} optionalText={optionalText} labelClassName={labelClassName} placeholder={props.placeholder} right={<label htmlFor={id}>
|
|
29
29
|
{right}
|
|
30
30
|
<button onClick={onClickLabel} type="button" className="mt-2 transition-colors hover:text-primary">
|
|
31
31
|
<ChevronDownIcon size={20}/>
|
|
32
32
|
<span className="sr-only">{translation.inputCaretDown}</span>
|
|
33
33
|
</button>
|
|
34
34
|
</label>}>
|
|
35
|
-
<select {...props} id={id} name={id} required={required} ref={mergeRefs(ref, inputRef)} data-selected={!!props.value || false} title={typeof props.title === "string" ? props.title : undefined} className={css("input select group
|
|
35
|
+
<select {...props} id={id} name={id} required={required} ref={mergeRefs(ref, inputRef)} data-selected={!!props.value || false} title={typeof props.title === "string" ? props.title : undefined} className={css("input select group h-10 w-full flex-1 appearance-none rounded-md text-base", "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)}>
|
|
36
36
|
<option value="" disabled hidden>
|
|
37
37
|
{props.placeholder}
|
|
38
38
|
</option>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slider.d.ts","sourceRoot":"","sources":["../../../src/components/form/slider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAQvD,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG;
|
|
1
|
+
{"version":3,"file":"slider.d.ts","sourceRoot":"","sources":["../../../src/components/form/slider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAQvD,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG;IACjD,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAmCF,eAAO,MAAM,MAAM,GAAI,OAAO,WAAW,gCAgBxC,CAAC"}
|
|
@@ -25,9 +25,9 @@ const Thumb = (props) => {
|
|
|
25
25
|
observer.observe(html, { attributeFilter: ["aria-valuenow"] });
|
|
26
26
|
return () => observer.disconnect();
|
|
27
27
|
}, []);
|
|
28
|
-
return (<Tooltip title="" ref={ref} as={Base.Thumb} enabled={props.tooltip} className="
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
return (<Tooltip title="" ref={ref} as={Base.Thumb} enabled={props.tooltip} className="focus-within::scale-105 block size-5 cursor-grab rounded-full border-2 border-input-border bg-input-switch shadow-shadow-floating focus-within:border-primary focus-within:outline active:cursor-grabbing">
|
|
29
|
+
{float}
|
|
30
|
+
</Tooltip>);
|
|
31
31
|
};
|
|
32
32
|
export const Slider = (props) => {
|
|
33
33
|
const { tooltip, className, defaultValue, value, ...restProps } = props;
|
|
@@ -35,11 +35,11 @@ export const Slider = (props) => {
|
|
|
35
35
|
const array = defaultValue || value || [];
|
|
36
36
|
const locale = useLocale();
|
|
37
37
|
return (<Base.Root {...restProps} value={value} locale={locale} defaultValue={defaultValue}>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
<Base.Control className={css("relative flex h-5 w-full touch-none select-none items-center", className)}>
|
|
39
|
+
<Base.Track className="relative h-2 grow rounded-full bg-background">
|
|
40
|
+
<Base.Indicator className="absolute h-full rounded-full bg-primary"/>
|
|
41
|
+
</Base.Track>
|
|
42
|
+
{Array.isArray(array) ? array.map((_, i) => <Thumb tooltip={tooltip ?? false} key={`${id.current}-${i}`}/>) : null}
|
|
43
|
+
</Base.Control>
|
|
44
|
+
</Base.Root>);
|
|
45
45
|
};
|
|
@@ -34,8 +34,8 @@ export const Switch = forwardRef(({ children, loading, container, error, ...prop
|
|
|
34
34
|
return (<fieldset className={css("flex flex-col flex-wrap justify-center", container)} data-component="switch" disabled={props.disabled || loading}>
|
|
35
35
|
<span className="flex flex-row flex-wrap items-center">
|
|
36
36
|
<input {...props} hidden ref={innerRef} type="checkbox" checked={checked} id={props.id || id} data-trigger="change" data-checked={checked} disabled={props.disabled || loading} onChange={(e) => setInnerChecked(e.target.checked)}/>
|
|
37
|
-
<button type="button" role="switch" onClick={onCheck} aria-checked={checked} data-checked={checked} aria-labelledby={`${id}-label`} disabled={props.disabled || loading} className="relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-300 ease-in-out focus:outline-
|
|
38
|
-
<span aria-hidden="true" data-checked={checked} className="inline-block aspect-square size-5 transform rounded-full shadow
|
|
37
|
+
<button type="button" role="switch" onClick={onCheck} aria-checked={checked} data-checked={checked} aria-labelledby={`${id}-label`} disabled={props.disabled || loading} className="relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-300 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 data-[checked=false]:bg-input-switch-bg data-[checked=true]:bg-primary">
|
|
38
|
+
<span aria-hidden="true" data-checked={checked} className="inline-block aspect-square size-5 transform rounded-full shadow ring-0 transition duration-300 ease-in-out data-[checked=false]:translate-x-0 data-[checked=true]:translate-x-5 data-[checked=false]:bg-disabled data-[checked=true]:bg-input-switch"/>
|
|
39
39
|
</button>
|
|
40
40
|
<label htmlFor={props.id || id} className="ml-3 inline-block text-sm" id={`${id}-label`}>
|
|
41
41
|
<span className="font-medium text-foreground">{children}</span>
|
|
@@ -8,7 +8,7 @@ import { Checkbox } from "../form/checkbox";
|
|
|
8
8
|
import { Input } from "./input";
|
|
9
9
|
const components = {
|
|
10
10
|
Item: forwardRef(function InnerList(props, ref) {
|
|
11
|
-
return <li {...props} ref={ref} className="flex items-center gap-1
|
|
11
|
+
return <li {...props} ref={ref} className="flex items-center justify-between gap-1"/>;
|
|
12
12
|
}),
|
|
13
13
|
List: forwardRef(function InnerList(props, ref) {
|
|
14
14
|
return <ul {...props} ref={ref} className="space-y-3"/>;
|
|
@@ -18,9 +18,9 @@ export const TransferList = (props) => {
|
|
|
18
18
|
const ref = useRef(null);
|
|
19
19
|
const h = useParentHeight(ref);
|
|
20
20
|
return (<div className="flex flex-row gap-4" ref={ref}>
|
|
21
|
-
<div className="
|
|
21
|
+
<div className="flex w-fit min-w-64 flex-col space-y-4 whitespace-nowrap rounded-lg border border-card-border py-8">
|
|
22
22
|
<header className="border-b border-card-border pb-2"></header>
|
|
23
|
-
<div className="
|
|
23
|
+
<div className="space-y-2 px-8">
|
|
24
24
|
<Input rightLabel="" title="Search" placeholder="Looking for..."/>
|
|
25
25
|
<Virtuoso height={h} useWindowScroll data={props.source} components={components} itemContent={(_, row) => (<Fragment>
|
|
26
26
|
<Checkbox>
|
|
@@ -39,6 +39,8 @@ export * from "./form/transfer-list";
|
|
|
39
39
|
export * from "./core/render-on-view";
|
|
40
40
|
export * from "./display/notifications";
|
|
41
41
|
export * from "./floating/command-palette";
|
|
42
|
+
export { CommandPalette as Commander } from "./floating/command-palette";
|
|
43
|
+
export * from "./page-calendar";
|
|
42
44
|
export { formReset } from "./form/formReset";
|
|
43
45
|
export { createColumns, createOptionCols, type ColType, useTablePreferences, type TablePagination } from "./table/table-lib";
|
|
44
46
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,KAAK,OAAO,EAAE,mBAAmB,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EAAE,cAAc,IAAI,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACzE,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,KAAK,OAAO,EAAE,mBAAmB,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|