@adecore/ui 0.33.3 → 0.34.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/Banner.d.ts +2 -1
- package/dist/Banner.js +92 -51
- package/dist/CopyButton.d.ts +24 -0
- package/dist/CopyButton.js +144 -0
- package/dist/ErrorBoundary.js +16 -18
- package/dist/ProjectSwitcher.js +66 -73
- package/dist/RelativeTime.d.ts +9 -0
- package/dist/RelativeTime.js +38 -0
- package/dist/Segmented.d.ts +4 -1
- package/dist/Segmented.js +111 -86
- package/dist/Toasts.js +1 -1
- package/dist/combobox/index.parts.d.ts +1 -0
- package/dist/combobox/index.parts.js +1 -0
- package/dist/combobox/parts.d.ts +32 -0
- package/dist/combobox/parts.js +556 -0
- package/dist/command-palette/index.parts.d.ts +2 -0
- package/dist/command-palette/index.parts.js +3 -0
- package/dist/command-palette/parts.d.ts +32 -0
- package/dist/command-palette/parts.js +422 -0
- package/dist/format/datetime.d.ts +1 -0
- package/dist/format/datetime.js +8 -0
- package/dist/format/duration.d.ts +1 -0
- package/dist/format/duration.js +24 -1
- package/dist/format/index.d.ts +2 -2
- package/dist/format/index.js +2 -2
- package/dist/index.d.ts +7 -0
- package/dist/index.js +5 -0
- package/dist/locales/en.d.ts +8 -0
- package/dist/locales/en.js +8 -0
- package/dist/locales/nl.d.ts +8 -0
- package/dist/locales/nl.js +8 -0
- package/dist/match.d.ts +1 -0
- package/dist/match.js +47 -0
- package/dist/segmented-keys.d.ts +3 -0
- package/dist/segmented-keys.js +33 -0
- package/dist/theme.css +15 -0
- package/dist/toast-store.d.ts +1 -0
- package/dist/toast-store.js +16 -6
- package/dist/workspace/TabStrip.d.ts +2 -1
- package/dist/workspace/TabStrip.js +432 -372
- package/package.json +1 -1
- package/src/Banner.tsx +33 -9
- package/src/CopyButton.tsx +86 -0
- package/src/ErrorBoundary.tsx +3 -4
- package/src/ProjectSwitcher.tsx +4 -2
- package/src/RelativeTime.tsx +44 -0
- package/src/Segmented.tsx +60 -33
- package/src/Toasts.tsx +1 -1
- package/src/combobox/index.parts.ts +12 -0
- package/src/combobox/parts.tsx +147 -0
- package/src/command-palette/index.parts.ts +16 -0
- package/src/command-palette/parts.tsx +145 -0
- package/src/format/datetime.ts +5 -0
- package/src/format/duration.ts +25 -1
- package/src/format/index.ts +2 -1
- package/src/index.ts +7 -0
- package/src/locales/en.ts +8 -0
- package/src/locales/nl.ts +8 -0
- package/src/match.ts +50 -0
- package/src/segmented-keys.ts +33 -0
- package/src/theme.css +15 -0
- package/src/toast-store.ts +16 -6
- package/src/workspace/TabStrip.tsx +31 -2
package/dist/Segmented.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export interface SegmentedOption<T extends string> {
|
|
|
4
4
|
id: T;
|
|
5
5
|
label: string;
|
|
6
6
|
icon?: LucideIcon;
|
|
7
|
+
disabled?: boolean;
|
|
7
8
|
}
|
|
8
9
|
export interface SegmentedProps<T extends string> {
|
|
9
10
|
value: T;
|
|
@@ -12,7 +13,9 @@ export interface SegmentedProps<T extends string> {
|
|
|
12
13
|
label: string;
|
|
13
14
|
disabled?: boolean;
|
|
14
15
|
orientation?: 'horizontal' | 'vertical';
|
|
16
|
+
size?: 'md' | 'sm';
|
|
17
|
+
iconOnly?: boolean;
|
|
15
18
|
className?: string;
|
|
16
19
|
ref?: Ref<HTMLDivElement>;
|
|
17
20
|
}
|
|
18
|
-
export declare function Segmented<T extends string>({ value, onValueChange, options, label, disabled, orientation, className, ref }: SegmentedProps<T>): import("react").JSX.Element;
|
|
21
|
+
export declare function Segmented<T extends string>({ value, onValueChange, options, label, disabled, orientation, size, iconOnly, className, ref }: SegmentedProps<T>): import("react").JSX.Element;
|
package/dist/Segmented.js
CHANGED
|
@@ -1,19 +1,31 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { Icon } from "./Icon.js";
|
|
4
|
+
import { segmentedStop, segmentedTarget } from './segmented-keys.js';
|
|
5
|
+
import { Tooltip } from "./Tooltip.js";
|
|
4
6
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const SIZE = {
|
|
8
|
+
md: {
|
|
9
|
+
track: 'rounded-lg',
|
|
10
|
+
row: 'min-h-8',
|
|
11
|
+
option: 'min-h-7 rounded-md px-3 py-1',
|
|
12
|
+
square: 'size-7 rounded-md',
|
|
13
|
+
icon: 14
|
|
14
|
+
},
|
|
15
|
+
sm: {
|
|
16
|
+
track: 'rounded-md',
|
|
17
|
+
row: 'min-h-7',
|
|
18
|
+
option: 'min-h-6 rounded-sm px-2.5 py-0.5',
|
|
19
|
+
square: 'size-6 rounded-sm',
|
|
20
|
+
icon: 12
|
|
21
|
+
}
|
|
10
22
|
};
|
|
11
23
|
/*
|
|
12
24
|
* One of a few options side by side in one sunken track, the picked one lifted out of it. A radio
|
|
13
25
|
* group: one tab stop, and the arrows pick and focus the next option, around the ends.
|
|
14
26
|
*/
|
|
15
27
|
export function Segmented(t0) {
|
|
16
|
-
const $ = _c(
|
|
28
|
+
const $ = _c(38);
|
|
17
29
|
const {
|
|
18
30
|
value,
|
|
19
31
|
onValueChange,
|
|
@@ -21,34 +33,30 @@ export function Segmented(t0) {
|
|
|
21
33
|
label,
|
|
22
34
|
disabled,
|
|
23
35
|
orientation: t1,
|
|
36
|
+
size: t2,
|
|
37
|
+
iconOnly: t3,
|
|
24
38
|
className,
|
|
25
39
|
ref
|
|
26
40
|
} = t0;
|
|
27
41
|
const orientation = t1 === undefined ? "horizontal" : t1;
|
|
42
|
+
const size = t2 === undefined ? "md" : t2;
|
|
43
|
+
const iconOnly = t3 === undefined ? false : t3;
|
|
28
44
|
const vertical = orientation === "vertical";
|
|
29
|
-
|
|
45
|
+
const sizing = SIZE[size];
|
|
46
|
+
let t4;
|
|
30
47
|
if ($[0] !== options || $[1] !== value) {
|
|
31
|
-
|
|
32
|
-
if ($[3] !== value) {
|
|
33
|
-
t3 = option => option.id === value;
|
|
34
|
-
$[3] = value;
|
|
35
|
-
$[4] = t3;
|
|
36
|
-
} else {
|
|
37
|
-
t3 = $[4];
|
|
38
|
-
}
|
|
39
|
-
t2 = options.findIndex(t3);
|
|
48
|
+
t4 = segmentedStop(options, value);
|
|
40
49
|
$[0] = options;
|
|
41
50
|
$[1] = value;
|
|
42
|
-
$[2] =
|
|
51
|
+
$[2] = t4;
|
|
43
52
|
} else {
|
|
44
|
-
|
|
53
|
+
t4 = $[2];
|
|
45
54
|
}
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const next = event.key in STEPS ? (index + STEPS[event.key] + options.length) % options.length : event.key === "Home" ? 0 : event.key === "End" ? options.length - 1 : null;
|
|
55
|
+
const stop = t4;
|
|
56
|
+
let t5;
|
|
57
|
+
if ($[3] !== onValueChange || $[4] !== options) {
|
|
58
|
+
t5 = function move(event, index) {
|
|
59
|
+
const next = segmentedTarget(options, index, event.key);
|
|
52
60
|
if (next === null) {
|
|
53
61
|
return;
|
|
54
62
|
}
|
|
@@ -56,81 +64,98 @@ export function Segmented(t0) {
|
|
|
56
64
|
onValueChange(options[next].id);
|
|
57
65
|
event.currentTarget.parentElement?.querySelectorAll("[role=\"radio\"]")[next]?.focus();
|
|
58
66
|
};
|
|
59
|
-
$[
|
|
60
|
-
$[
|
|
61
|
-
$[
|
|
67
|
+
$[3] = onValueChange;
|
|
68
|
+
$[4] = options;
|
|
69
|
+
$[5] = t5;
|
|
62
70
|
} else {
|
|
63
|
-
|
|
71
|
+
t5 = $[5];
|
|
64
72
|
}
|
|
65
|
-
const move =
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
$[
|
|
71
|
-
$[
|
|
72
|
-
$[
|
|
73
|
+
const move = t5;
|
|
74
|
+
let t6;
|
|
75
|
+
if ($[6] !== className || $[7] !== sizing.row || $[8] !== sizing.track || $[9] !== vertical) {
|
|
76
|
+
t6 = clsx("flex bg-surface-sunken p-0.5 text-xs font-medium", sizing.track, vertical ? "w-full flex-col items-stretch gap-0.5" : clsx(sizing.row, "w-fit items-center"), className);
|
|
77
|
+
$[6] = className;
|
|
78
|
+
$[7] = sizing.row;
|
|
79
|
+
$[8] = sizing.track;
|
|
80
|
+
$[9] = vertical;
|
|
81
|
+
$[10] = t6;
|
|
73
82
|
} else {
|
|
74
|
-
|
|
83
|
+
t6 = $[10];
|
|
75
84
|
}
|
|
76
|
-
const
|
|
77
|
-
let
|
|
78
|
-
if ($[11] !== disabled || $[12] !==
|
|
79
|
-
let
|
|
80
|
-
if ($[
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
85
|
+
const t7 = vertical ? "vertical" : undefined;
|
|
86
|
+
let t8;
|
|
87
|
+
if ($[11] !== disabled || $[12] !== iconOnly || $[13] !== move || $[14] !== onValueChange || $[15] !== options || $[16] !== sizing.icon || $[17] !== sizing.option || $[18] !== sizing.square || $[19] !== stop || $[20] !== value) {
|
|
88
|
+
let t9;
|
|
89
|
+
if ($[22] !== disabled || $[23] !== iconOnly || $[24] !== move || $[25] !== onValueChange || $[26] !== sizing.icon || $[27] !== sizing.option || $[28] !== sizing.square || $[29] !== stop || $[30] !== value) {
|
|
90
|
+
t9 = (option, index_0) => {
|
|
91
|
+
const square = iconOnly && option.icon !== undefined;
|
|
92
|
+
const button = /*#__PURE__*/_jsxs("button", {
|
|
93
|
+
type: "button",
|
|
94
|
+
role: "radio",
|
|
95
|
+
"aria-checked": value === option.id,
|
|
96
|
+
tabIndex: index_0 === stop ? 0 : -1,
|
|
97
|
+
disabled: disabled || option.disabled,
|
|
98
|
+
className: clsx("flex items-center transition-colors disabled:opacity-50", square ? clsx(sizing.square, "justify-center") : clsx(sizing.option, "gap-1.5 text-left"), value === option.id ? "bg-surface-raised text-text shadow-raised" : "text-text-muted enabled:hover:text-text"),
|
|
99
|
+
onClick: () => onValueChange(option.id),
|
|
100
|
+
onKeyDown: event_0 => move(event_0, index_0),
|
|
101
|
+
children: [option.icon && /*#__PURE__*/_jsx(Icon, {
|
|
102
|
+
icon: option.icon,
|
|
103
|
+
size: sizing.icon,
|
|
104
|
+
className: "shrink-0"
|
|
105
|
+
}), !square && option.label]
|
|
106
|
+
}, option.id);
|
|
107
|
+
return square ? /*#__PURE__*/_jsx(Tooltip, {
|
|
108
|
+
label: option.label,
|
|
109
|
+
name: true,
|
|
110
|
+
children: button
|
|
111
|
+
}, option.id) : button;
|
|
112
|
+
};
|
|
113
|
+
$[22] = disabled;
|
|
114
|
+
$[23] = iconOnly;
|
|
115
|
+
$[24] = move;
|
|
116
|
+
$[25] = onValueChange;
|
|
117
|
+
$[26] = sizing.icon;
|
|
118
|
+
$[27] = sizing.option;
|
|
119
|
+
$[28] = sizing.square;
|
|
120
|
+
$[29] = stop;
|
|
121
|
+
$[30] = value;
|
|
122
|
+
$[31] = t9;
|
|
102
123
|
} else {
|
|
103
|
-
|
|
124
|
+
t9 = $[31];
|
|
104
125
|
}
|
|
105
|
-
|
|
126
|
+
t8 = options.map(t9);
|
|
106
127
|
$[11] = disabled;
|
|
107
|
-
$[12] =
|
|
108
|
-
$[13] =
|
|
109
|
-
$[14] =
|
|
110
|
-
$[15] =
|
|
111
|
-
$[16] =
|
|
112
|
-
$[17] =
|
|
128
|
+
$[12] = iconOnly;
|
|
129
|
+
$[13] = move;
|
|
130
|
+
$[14] = onValueChange;
|
|
131
|
+
$[15] = options;
|
|
132
|
+
$[16] = sizing.icon;
|
|
133
|
+
$[17] = sizing.option;
|
|
134
|
+
$[18] = sizing.square;
|
|
135
|
+
$[19] = stop;
|
|
136
|
+
$[20] = value;
|
|
137
|
+
$[21] = t8;
|
|
113
138
|
} else {
|
|
114
|
-
|
|
139
|
+
t8 = $[21];
|
|
115
140
|
}
|
|
116
|
-
let
|
|
117
|
-
if ($[
|
|
118
|
-
|
|
141
|
+
let t9;
|
|
142
|
+
if ($[32] !== label || $[33] !== ref || $[34] !== t6 || $[35] !== t7 || $[36] !== t8) {
|
|
143
|
+
t9 = /*#__PURE__*/_jsx("div", {
|
|
119
144
|
ref: ref,
|
|
120
|
-
className:
|
|
145
|
+
className: t6,
|
|
121
146
|
role: "radiogroup",
|
|
122
147
|
"aria-label": label,
|
|
123
|
-
"aria-orientation":
|
|
124
|
-
children:
|
|
148
|
+
"aria-orientation": t7,
|
|
149
|
+
children: t8
|
|
125
150
|
});
|
|
126
|
-
$[
|
|
127
|
-
$[
|
|
128
|
-
$[
|
|
129
|
-
$[
|
|
130
|
-
$[
|
|
131
|
-
$[
|
|
151
|
+
$[32] = label;
|
|
152
|
+
$[33] = ref;
|
|
153
|
+
$[34] = t6;
|
|
154
|
+
$[35] = t7;
|
|
155
|
+
$[36] = t8;
|
|
156
|
+
$[37] = t9;
|
|
132
157
|
} else {
|
|
133
|
-
|
|
158
|
+
t9 = $[37];
|
|
134
159
|
}
|
|
135
|
-
return
|
|
160
|
+
return t9;
|
|
136
161
|
}
|
package/dist/Toasts.js
CHANGED
|
@@ -183,7 +183,7 @@ function ToastCard(t0) {
|
|
|
183
183
|
const {
|
|
184
184
|
t
|
|
185
185
|
} = useTranslation("ui");
|
|
186
|
-
const leaves = toast.
|
|
186
|
+
const leaves = toast.deadline !== undefined;
|
|
187
187
|
let t1;
|
|
188
188
|
if ($[0] !== toast.action) {
|
|
189
189
|
t1 = toast.action === undefined ? [] : [toast.action];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ComboboxCollection as Collection, ComboboxEmpty as Empty, ComboboxGroup as Group, ComboboxGroupLabel as GroupLabel, ComboboxInput as Input, ComboboxItem as Item, ComboboxList as List, ComboboxPopup as Popup, ComboboxRoot as Root, ComboboxStatus as Status } from './parts.tsx';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ComboboxCollection as Collection, ComboboxEmpty as Empty, ComboboxGroup as Group, ComboboxGroupLabel as GroupLabel, ComboboxInput as Input, ComboboxItem as Item, ComboboxList as List, ComboboxPopup as Popup, ComboboxRoot as Root, ComboboxStatus as Status } from "./parts.js";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import type { LucideIcon } from 'lucide-react';
|
|
3
|
+
import { Autocomplete } from '@base-ui/react/autocomplete';
|
|
4
|
+
import { type PlacementKey } from '../placement.ts';
|
|
5
|
+
import type { Shortcut } from '../shortcut.ts';
|
|
6
|
+
export declare const ComboboxRoot: typeof Autocomplete.Root;
|
|
7
|
+
export type ComboboxInputProps = Omit<ComponentProps<typeof Autocomplete.Input>, 'size' | 'className'> & {
|
|
8
|
+
className?: string;
|
|
9
|
+
size?: 'md' | 'sm';
|
|
10
|
+
mono?: boolean;
|
|
11
|
+
icon?: LucideIcon;
|
|
12
|
+
};
|
|
13
|
+
export declare function ComboboxInput({ size, mono, icon, className, id, ...props }: ComboboxInputProps): import("react").JSX.Element;
|
|
14
|
+
type Placement = Pick<ComponentProps<typeof Autocomplete.Positioner>, PlacementKey>;
|
|
15
|
+
export type ComboboxPopupProps = ComponentProps<typeof Autocomplete.Popup> & Placement;
|
|
16
|
+
export declare function ComboboxPopup({ side, align, sideOffset, className, ...props }: ComboboxPopupProps): import("react").JSX.Element;
|
|
17
|
+
export declare function ComboboxList(props: ComponentProps<typeof Autocomplete.List>): import("react").JSX.Element;
|
|
18
|
+
export type ComboboxItemProps = ComponentProps<typeof Autocomplete.Item> & {
|
|
19
|
+
icon?: ReactNode;
|
|
20
|
+
hint?: ReactNode;
|
|
21
|
+
description?: ReactNode;
|
|
22
|
+
trailing?: ReactNode;
|
|
23
|
+
shortcut?: Shortcut;
|
|
24
|
+
unstyled?: boolean;
|
|
25
|
+
};
|
|
26
|
+
export declare function ComboboxItem({ icon, hint, description, trailing, shortcut, unstyled, className, children, ...props }: ComboboxItemProps): import("react").JSX.Element;
|
|
27
|
+
export declare const ComboboxGroup: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").ComboboxGroupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
28
|
+
export declare function ComboboxGroupLabel({ className, ...props }: ComponentProps<typeof Autocomplete.GroupLabel>): import("react").JSX.Element;
|
|
29
|
+
export declare const ComboboxCollection: typeof Autocomplete.Collection;
|
|
30
|
+
export declare function ComboboxEmpty({ className, ...props }: ComponentProps<typeof Autocomplete.Empty>): import("react").JSX.Element;
|
|
31
|
+
export declare function ComboboxStatus({ className, ...props }: ComponentProps<typeof Autocomplete.Status>): import("react").JSX.Element;
|
|
32
|
+
export {};
|