@adecore/ui 0.31.12 → 0.33.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/AccentSwatches.js +290 -13
- package/dist/Banner.js +90 -9
- package/dist/Button.js +114 -22
- package/dist/ButtonGroup.js +62 -8
- package/dist/Checkbox.js +73 -4
- package/dist/ChoiceCards.js +205 -11
- package/dist/CloseButton.js +87 -7
- package/dist/ColorSwatch.js +132 -15
- package/dist/ColorWheelPicker.js +305 -71
- package/dist/ColumnResizeHandle.js +43 -8
- package/dist/DisabledReason.js +27 -8
- package/dist/DockShell.js +144 -37
- package/dist/EmptyState.js +95 -6
- package/dist/ErrorBoundary.js +254 -31
- package/dist/Field.js +349 -31
- package/dist/FileIcon.js +67 -6
- package/dist/Icon.js +38 -6
- package/dist/IconButton.js +176 -20
- package/dist/IconPicker.js +344 -73
- package/dist/Input.js +233 -14
- package/dist/Kbd.js +150 -10
- package/dist/LazyBoundary.js +14 -5
- package/dist/ListRow.js +75 -15
- package/dist/Meter.js +108 -5
- package/dist/MiddleTruncate.js +126 -45
- package/dist/PanelEmpty.js +64 -5
- package/dist/PanelHeader.js +95 -13
- package/dist/Pill.js +114 -19
- package/dist/ProjectSwitcher.js +225 -12
- package/dist/PromptDialog.js +352 -37
- package/dist/SectionLabel.js +62 -8
- package/dist/SegmentBar.js +197 -36
- package/dist/Segmented.js +130 -23
- package/dist/Select.js +310 -19
- package/dist/SelectSearch.js +344 -29
- package/dist/Separator.js +35 -4
- package/dist/ShortcutHints.js +146 -76
- package/dist/Skeleton.js +31 -4
- package/dist/Slider.js +172 -10
- package/dist/SlidingColumn.js +194 -34
- package/dist/Spinner.js +100 -3
- package/dist/Stepper.js +232 -11
- package/dist/Surface.js +62 -8
- package/dist/Switch.js +60 -6
- package/dist/TextMenu.js +212 -17
- package/dist/Tile.js +149 -5
- package/dist/Toasts.js +391 -33
- package/dist/Tooltip.js +153 -16
- package/dist/UIProvider.js +62 -15
- package/dist/Waveform.js +362 -93
- package/dist/Wipe.js +259 -34
- package/dist/ZoomControls.js +356 -14
- package/dist/class-name.js +1 -1
- package/dist/clipboard.js +15 -17
- package/dist/context-menu/index.parts.js +1 -1
- package/dist/dialog/index.parts.js +1 -1
- package/dist/dialog/parts.js +378 -29
- package/dist/dialog-layer.js +51 -18
- package/dist/error-boundary.js +19 -19
- package/dist/error-message.js +1 -1
- package/dist/field-context.js +7 -5
- package/dist/file-icon.js +23 -21
- package/dist/file-tree/helpers.js +133 -119
- package/dist/file-tree/index.parts.js +3 -3
- package/dist/file-tree/parts.js +418 -127
- package/dist/file-tree/style.js +1 -1
- package/dist/file-tree/use-file-tree-shift.js +43 -30
- package/dist/file-tree/use-file-tree.js +60 -18
- package/dist/file-tree/use-slots.js +220 -192
- package/dist/floating.js +2 -2
- package/dist/format/datetime.js +88 -38
- package/dist/format/duration.js +59 -53
- package/dist/format/index.js +1 -1
- package/dist/format/locale.js +76 -56
- package/dist/format/number.js +77 -61
- package/dist/format/regions.js +4 -2
- package/dist/format/time-zone.js +1 -1
- package/dist/icon-button-size.js +12 -2
- package/dist/icon-picker.js +70 -61
- package/dist/index.js +57 -57
- package/dist/key-value-list/index.parts.js +1 -1
- package/dist/key-value-list/parts.js +256 -22
- package/dist/lazy-landings.js +10 -10
- package/dist/lazy.js +84 -71
- package/dist/locales/en.js +80 -80
- package/dist/locales/nl.js +80 -80
- package/dist/locales.js +10 -7
- package/dist/menu/index.parts.js +1 -1
- package/dist/menu/parts.js +882 -44
- package/dist/merge-refs.js +8 -9
- package/dist/middle-truncate.js +24 -25
- package/dist/modality.js +27 -19
- package/dist/placement.js +11 -20
- package/dist/platform.js +6 -6
- package/dist/popover/index.parts.js +1 -1
- package/dist/popover/parts.js +173 -11
- package/dist/popup-layer.js +38 -17
- package/dist/prefetch.js +78 -79
- package/dist/preview-card/index.parts.js +1 -1
- package/dist/project-switcher-row.js +153 -12
- package/dist/select-row.js +69 -5
- package/dist/select-shared.js +6 -6
- package/dist/selection.js +16 -16
- package/dist/seti-icons.js +413 -413
- package/dist/settings/ConfirmDialog.js +55 -8
- package/dist/settings/DetailHeader.js +72 -4
- package/dist/settings/MasterDetail.js +119 -7
- package/dist/settings/SettingsDialog.js +820 -80
- package/dist/settings/SettingsRow.js +205 -18
- package/dist/settings/SettingsSection.js +96 -6
- package/dist/settings/index.js +7 -7
- package/dist/settings/target.js +7 -2
- package/dist/shortcut-hints.js +73 -55
- package/dist/shortcut.js +140 -104
- package/dist/step-places.js +1 -1
- package/dist/tabs/index.parts.js +1 -1
- package/dist/tabs/overflow.js +18 -18
- package/dist/tabs/parts.js +780 -166
- package/dist/testing/dedupe.js +82 -75
- package/dist/testing/fake-source.js +12 -12
- package/dist/testing/index.js +1 -1
- package/dist/toast-store.js +65 -46
- package/dist/tree/index.parts.js +1 -1
- package/dist/tree/parts.js +721 -94
- package/dist/tree/shift.js +28 -22
- package/dist/tree/style.js +2 -2
- package/dist/tree/use-tree-shift.js +178 -117
- package/dist/useAsyncAction.js +23 -19
- package/dist/useColumnResize.js +36 -34
- package/dist/useContentSize.js +62 -18
- package/dist/useMeasuredWidth.js +14 -3
- package/dist/useNow.js +73 -30
- package/dist/wipe-split.js +14 -14
- package/dist/workspace/DropPreview.js +60 -7
- package/dist/workspace/SplitView.js +1025 -441
- package/dist/workspace/TabStrip.js +810 -191
- package/dist/workspace/Workspace.js +276 -26
- package/dist/workspace/context.js +8 -3
- package/dist/workspace/geometry.js +173 -150
- package/dist/workspace/model.js +313 -250
- package/dist/workspace/preview.js +61 -61
- package/dist/zoom.js +2 -2
- package/package.json +1 -1
- package/src/ErrorBoundary.tsx +1 -1
- package/src/Field.tsx +4 -3
- package/src/IconPicker.tsx +3 -3
- package/src/LazyBoundary.tsx +2 -0
- package/src/MiddleTruncate.tsx +2 -2
- package/src/SegmentBar.tsx +2 -2
- package/src/Toasts.tsx +3 -1
- package/src/Tooltip.tsx +7 -10
- package/src/Waveform.tsx +3 -3
- package/src/file-tree/parts.tsx +6 -9
- package/src/file-tree/use-file-tree-shift.tsx +6 -9
- package/src/lazy.tsx +4 -0
- package/src/locales/en.ts +4 -4
- package/src/locales/nl.ts +5 -5
- package/src/settings/SettingsDialog.tsx +1 -1
- package/src/tree/parts.tsx +5 -8
- package/src/useContentSize.ts +3 -3
- package/src/workspace/SplitView.tsx +2 -2
- package/src/workspace/TabStrip.tsx +2 -3
- package/src/workspace/Workspace.tsx +2 -5
package/dist/MiddleTruncate.js
CHANGED
|
@@ -1,59 +1,140 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useLayoutEffect,
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { useLayoutEffect, useState } from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { fitMiddle } from './middle-truncate.js';
|
|
5
5
|
import { mergeRefs } from './merge-refs.js';
|
|
6
|
-
import { Tooltip } from
|
|
6
|
+
import { Tooltip } from "./Tooltip.js";
|
|
7
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
8
|
let canvas = null;
|
|
8
9
|
/* How wide a text is drawn in the face of `element`, or null where the page cannot tell (no canvas). */
|
|
9
10
|
function textMeasure(element) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
const view = element.ownerDocument.defaultView;
|
|
12
|
+
canvas ??= element.ownerDocument.createElement('canvas');
|
|
13
|
+
const context = canvas.getContext('2d');
|
|
14
|
+
if (context === null || view === null) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
const style = view.getComputedStyle(element);
|
|
18
|
+
context.font = style.font || `${style.fontStyle} ${style.fontWeight} ${style.fontSize} ${style.fontFamily}`;
|
|
19
|
+
if ('letterSpacing' in context) {
|
|
20
|
+
context.letterSpacing = style.letterSpacing === 'normal' ? '0px' : style.letterSpacing;
|
|
21
|
+
}
|
|
22
|
+
return text => context.measureText(text).width;
|
|
22
23
|
}
|
|
23
24
|
function sameCut(first, second) {
|
|
24
|
-
|
|
25
|
+
return first?.head === second?.head && first?.tail === second?.tail;
|
|
25
26
|
}
|
|
26
27
|
/*
|
|
27
28
|
* A path or a branch name on one line that keeps its start and its end and cuts the middle. It asks
|
|
28
29
|
* for the width of the whole text and measures what it gets. The part it cuts stays in the element
|
|
29
30
|
* at no width, so selecting, copying and finding read the whole text.
|
|
30
31
|
*/
|
|
31
|
-
export function MiddleTruncate(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
32
|
+
export function MiddleTruncate(t0) {
|
|
33
|
+
const $ = _c(19);
|
|
34
|
+
const {
|
|
35
|
+
text,
|
|
36
|
+
tooltip: t1,
|
|
37
|
+
className,
|
|
38
|
+
ref
|
|
39
|
+
} = t0;
|
|
40
|
+
const tooltip = t1 === undefined ? true : t1;
|
|
41
|
+
const [element, setElement] = useState(null);
|
|
42
|
+
const [cut, setCut] = useState(null);
|
|
43
|
+
let t2;
|
|
44
|
+
if ($[0] !== ref) {
|
|
45
|
+
t2 = mergeRefs(setElement, ref);
|
|
46
|
+
$[0] = ref;
|
|
47
|
+
$[1] = t2;
|
|
48
|
+
} else {
|
|
49
|
+
t2 = $[1];
|
|
50
|
+
}
|
|
51
|
+
const rootRef = t2;
|
|
52
|
+
let t3;
|
|
53
|
+
let t4;
|
|
54
|
+
if ($[2] !== element || $[3] !== text) {
|
|
55
|
+
t3 = () => {
|
|
56
|
+
if (element === null) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const update = () => {
|
|
60
|
+
const measure = textMeasure(element);
|
|
61
|
+
const next = measure === null ? null : fitMiddle(text, element.getBoundingClientRect().width + 0.5, measure);
|
|
62
|
+
setCut(current => sameCut(current, next) ? current : next);
|
|
63
|
+
};
|
|
64
|
+
update();
|
|
65
|
+
if (typeof ResizeObserver === "undefined") {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const observer = new ResizeObserver(update);
|
|
69
|
+
observer.observe(element);
|
|
70
|
+
return () => observer.disconnect();
|
|
71
|
+
};
|
|
72
|
+
t4 = [element, text];
|
|
73
|
+
$[2] = element;
|
|
74
|
+
$[3] = text;
|
|
75
|
+
$[4] = t3;
|
|
76
|
+
$[5] = t4;
|
|
77
|
+
} else {
|
|
78
|
+
t3 = $[4];
|
|
79
|
+
t4 = $[5];
|
|
80
|
+
}
|
|
81
|
+
useLayoutEffect(t3, t4);
|
|
82
|
+
let t5;
|
|
83
|
+
if ($[6] !== className) {
|
|
84
|
+
t5 = clsx("middle-truncate", className);
|
|
85
|
+
$[6] = className;
|
|
86
|
+
$[7] = t5;
|
|
87
|
+
} else {
|
|
88
|
+
t5 = $[7];
|
|
89
|
+
}
|
|
90
|
+
let t6;
|
|
91
|
+
if ($[8] !== cut || $[9] !== text) {
|
|
92
|
+
t6 = cut === null ? text : /*#__PURE__*/_jsxs(_Fragment, {
|
|
93
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
94
|
+
className: "middle-truncate-head",
|
|
95
|
+
children: cut.head
|
|
96
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
97
|
+
className: "middle-truncate-middle",
|
|
98
|
+
children: cut.middle
|
|
99
|
+
}), cut.tail]
|
|
100
|
+
});
|
|
101
|
+
$[8] = cut;
|
|
102
|
+
$[9] = text;
|
|
103
|
+
$[10] = t6;
|
|
104
|
+
} else {
|
|
105
|
+
t6 = $[10];
|
|
106
|
+
}
|
|
107
|
+
let t7;
|
|
108
|
+
if ($[11] !== rootRef || $[12] !== t5 || $[13] !== t6 || $[14] !== text) {
|
|
109
|
+
t7 = /*#__PURE__*/_jsx("span", {
|
|
110
|
+
ref: rootRef,
|
|
111
|
+
className: t5,
|
|
112
|
+
"data-text": text,
|
|
113
|
+
children: t6
|
|
114
|
+
});
|
|
115
|
+
$[11] = rootRef;
|
|
116
|
+
$[12] = t5;
|
|
117
|
+
$[13] = t6;
|
|
118
|
+
$[14] = text;
|
|
119
|
+
$[15] = t7;
|
|
120
|
+
} else {
|
|
121
|
+
t7 = $[15];
|
|
122
|
+
}
|
|
123
|
+
const content = t7;
|
|
124
|
+
if (cut === null || !tooltip) {
|
|
125
|
+
return content;
|
|
126
|
+
}
|
|
127
|
+
let t8;
|
|
128
|
+
if ($[16] !== content || $[17] !== text) {
|
|
129
|
+
t8 = /*#__PURE__*/_jsx(Tooltip, {
|
|
130
|
+
label: text,
|
|
131
|
+
children: content
|
|
132
|
+
});
|
|
133
|
+
$[16] = content;
|
|
134
|
+
$[17] = text;
|
|
135
|
+
$[18] = t8;
|
|
136
|
+
} else {
|
|
137
|
+
t8 = $[18];
|
|
138
|
+
}
|
|
139
|
+
return t8;
|
|
140
|
+
}
|
package/dist/PanelEmpty.js
CHANGED
|
@@ -1,7 +1,66 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
-
import { EmptyState } from
|
|
3
|
+
import { EmptyState } from "./EmptyState.js";
|
|
4
4
|
/* What a panel or a card shows while it holds nothing: a sentence, one icon, at most one button. */
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
export function PanelEmpty(t0) {
|
|
7
|
+
const $ = _c(14);
|
|
8
|
+
const {
|
|
9
|
+
header,
|
|
10
|
+
icon,
|
|
11
|
+
busy: t1,
|
|
12
|
+
action,
|
|
13
|
+
sunken: t2,
|
|
14
|
+
fill: t3,
|
|
15
|
+
children,
|
|
16
|
+
className,
|
|
17
|
+
ref
|
|
18
|
+
} = t0;
|
|
19
|
+
const busy = t1 === undefined ? false : t1;
|
|
20
|
+
const sunken = t2 === undefined ? false : t2;
|
|
21
|
+
const fill = t3 === undefined ? "grow" : t3;
|
|
22
|
+
const t4 = fill === "full" ? "h-full" : "grow";
|
|
23
|
+
const t5 = sunken && "bg-surface-sunken";
|
|
24
|
+
let t6;
|
|
25
|
+
if ($[0] !== className || $[1] !== t4 || $[2] !== t5) {
|
|
26
|
+
t6 = clsx("grid min-h-0 place-items-center", t4, t5, className);
|
|
27
|
+
$[0] = className;
|
|
28
|
+
$[1] = t4;
|
|
29
|
+
$[2] = t5;
|
|
30
|
+
$[3] = t6;
|
|
31
|
+
} else {
|
|
32
|
+
t6 = $[3];
|
|
33
|
+
}
|
|
34
|
+
let t7;
|
|
35
|
+
if ($[4] !== action || $[5] !== busy || $[6] !== children || $[7] !== icon) {
|
|
36
|
+
t7 = /*#__PURE__*/_jsx(EmptyState, {
|
|
37
|
+
icon: icon,
|
|
38
|
+
busy: busy,
|
|
39
|
+
action: action,
|
|
40
|
+
children: children
|
|
41
|
+
});
|
|
42
|
+
$[4] = action;
|
|
43
|
+
$[5] = busy;
|
|
44
|
+
$[6] = children;
|
|
45
|
+
$[7] = icon;
|
|
46
|
+
$[8] = t7;
|
|
47
|
+
} else {
|
|
48
|
+
t7 = $[8];
|
|
49
|
+
}
|
|
50
|
+
let t8;
|
|
51
|
+
if ($[9] !== header || $[10] !== ref || $[11] !== t6 || $[12] !== t7) {
|
|
52
|
+
t8 = /*#__PURE__*/_jsxs("div", {
|
|
53
|
+
ref: ref,
|
|
54
|
+
className: t6,
|
|
55
|
+
children: [header, t7]
|
|
56
|
+
});
|
|
57
|
+
$[9] = header;
|
|
58
|
+
$[10] = ref;
|
|
59
|
+
$[11] = t6;
|
|
60
|
+
$[12] = t7;
|
|
61
|
+
$[13] = t8;
|
|
62
|
+
} else {
|
|
63
|
+
t8 = $[13];
|
|
64
|
+
}
|
|
65
|
+
return t8;
|
|
66
|
+
}
|
package/dist/PanelHeader.js
CHANGED
|
@@ -1,20 +1,102 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { useRender } from '@base-ui/react/use-render';
|
|
4
|
-
import { SectionLabel } from
|
|
4
|
+
import { SectionLabel } from "./SectionLabel.js";
|
|
5
5
|
/*
|
|
6
6
|
* The bar across the top of a side panel, as tall as a 48px toolbar beside it: the panel's name,
|
|
7
7
|
* its own controls, and a close button last.
|
|
8
8
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
export function PanelHeader(t0) {
|
|
11
|
+
const $ = _c(22);
|
|
12
|
+
let children;
|
|
13
|
+
let className;
|
|
14
|
+
let props;
|
|
15
|
+
let ref;
|
|
16
|
+
let render;
|
|
17
|
+
let title;
|
|
18
|
+
if ($[0] !== t0) {
|
|
19
|
+
({
|
|
20
|
+
title,
|
|
21
|
+
render,
|
|
22
|
+
className,
|
|
23
|
+
ref,
|
|
24
|
+
children,
|
|
25
|
+
...props
|
|
26
|
+
} = t0);
|
|
27
|
+
$[0] = t0;
|
|
28
|
+
$[1] = children;
|
|
29
|
+
$[2] = className;
|
|
30
|
+
$[3] = props;
|
|
31
|
+
$[4] = ref;
|
|
32
|
+
$[5] = render;
|
|
33
|
+
$[6] = title;
|
|
34
|
+
} else {
|
|
35
|
+
children = $[1];
|
|
36
|
+
className = $[2];
|
|
37
|
+
props = $[3];
|
|
38
|
+
ref = $[4];
|
|
39
|
+
render = $[5];
|
|
40
|
+
title = $[6];
|
|
41
|
+
}
|
|
42
|
+
let t1;
|
|
43
|
+
if ($[7] !== className) {
|
|
44
|
+
t1 = clsx("flex h-12 shrink-0 items-center gap-2 border-b border-border pr-2 pl-3", className);
|
|
45
|
+
$[7] = className;
|
|
46
|
+
$[8] = t1;
|
|
47
|
+
} else {
|
|
48
|
+
t1 = $[8];
|
|
49
|
+
}
|
|
50
|
+
let t2;
|
|
51
|
+
if ($[9] !== title) {
|
|
52
|
+
t2 = title !== undefined && /*#__PURE__*/_jsx(SectionLabel, {
|
|
53
|
+
className: "shrink-0",
|
|
54
|
+
children: title
|
|
19
55
|
});
|
|
20
|
-
|
|
56
|
+
$[9] = title;
|
|
57
|
+
$[10] = t2;
|
|
58
|
+
} else {
|
|
59
|
+
t2 = $[10];
|
|
60
|
+
}
|
|
61
|
+
let t3;
|
|
62
|
+
if ($[11] !== children || $[12] !== t2) {
|
|
63
|
+
t3 = /*#__PURE__*/_jsxs(_Fragment, {
|
|
64
|
+
children: [t2, children]
|
|
65
|
+
});
|
|
66
|
+
$[11] = children;
|
|
67
|
+
$[12] = t2;
|
|
68
|
+
$[13] = t3;
|
|
69
|
+
} else {
|
|
70
|
+
t3 = $[13];
|
|
71
|
+
}
|
|
72
|
+
let t4;
|
|
73
|
+
if ($[14] !== props || $[15] !== t1 || $[16] !== t3) {
|
|
74
|
+
t4 = {
|
|
75
|
+
...props,
|
|
76
|
+
className: t1,
|
|
77
|
+
children: t3
|
|
78
|
+
};
|
|
79
|
+
$[14] = props;
|
|
80
|
+
$[15] = t1;
|
|
81
|
+
$[16] = t3;
|
|
82
|
+
$[17] = t4;
|
|
83
|
+
} else {
|
|
84
|
+
t4 = $[17];
|
|
85
|
+
}
|
|
86
|
+
let t5;
|
|
87
|
+
if ($[18] !== ref || $[19] !== render || $[20] !== t4) {
|
|
88
|
+
t5 = {
|
|
89
|
+
render,
|
|
90
|
+
ref,
|
|
91
|
+
defaultTagName: "header",
|
|
92
|
+
props: t4
|
|
93
|
+
};
|
|
94
|
+
$[18] = ref;
|
|
95
|
+
$[19] = render;
|
|
96
|
+
$[20] = t4;
|
|
97
|
+
$[21] = t5;
|
|
98
|
+
} else {
|
|
99
|
+
t5 = $[21];
|
|
100
|
+
}
|
|
101
|
+
return useRender(t5);
|
|
102
|
+
}
|
package/dist/Pill.js
CHANGED
|
@@ -1,35 +1,130 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
/*
|
|
4
4
|
* What the label says about the thing it names, drawn as its ground. Every ground is an alpha over
|
|
5
5
|
* whatever the pill stands on, the way a border is: in the dark theme it lifts a shade off the row
|
|
6
6
|
* under it, in the light theme it sinks one. A solid sunken ground read as a hole on a dark row.
|
|
7
7
|
*/
|
|
8
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
9
|
const TONES = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
muted: 'bg-text/7 text-text-muted',
|
|
11
|
+
/* A step further off the ground, for a label that should stand out as a control. */
|
|
12
|
+
raised: 'bg-text/12 text-text-muted',
|
|
13
|
+
idle: 'bg-status-idle/15 text-status-idle',
|
|
14
|
+
needsYou: 'bg-status-needs-you/15 text-status-needs-you',
|
|
15
|
+
error: 'bg-status-error/15 text-status-error',
|
|
16
|
+
accent: 'bg-accent/16 text-accent'
|
|
16
17
|
};
|
|
17
18
|
/* The corners of a button, so a pill reads as a small label of the same family and not as a badge. A tag, at the end of a line of prose, is tighter and heavier. */
|
|
18
19
|
const SHAPES = {
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
pill: 'rounded-md',
|
|
21
|
+
tag: 'rounded-md font-medium'
|
|
21
22
|
};
|
|
22
23
|
/* The text stays at the theme's smallest size, so `sm` gives up padding: 20px tall instead of 24. */
|
|
23
24
|
const PADDING = {
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
pill: {
|
|
26
|
+
md: 'px-2 py-0.5',
|
|
27
|
+
sm: 'px-1.5'
|
|
28
|
+
},
|
|
29
|
+
tag: {
|
|
30
|
+
md: 'px-1.5 py-0.5',
|
|
31
|
+
sm: 'px-1'
|
|
32
|
+
}
|
|
26
33
|
};
|
|
27
34
|
/* The small rounded label in a header, a sidebar row or a settings line: a count, a branch, a status. */
|
|
28
|
-
export function Pill(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
export function Pill(t0) {
|
|
36
|
+
const $ = _c(26);
|
|
37
|
+
const {
|
|
38
|
+
icon,
|
|
39
|
+
children,
|
|
40
|
+
tone: t1,
|
|
41
|
+
shape: t2,
|
|
42
|
+
size: t3,
|
|
43
|
+
mono: t4,
|
|
44
|
+
onClick,
|
|
45
|
+
pressed,
|
|
46
|
+
disabled,
|
|
47
|
+
className,
|
|
48
|
+
ref
|
|
49
|
+
} = t0;
|
|
50
|
+
const tone = t1 === undefined ? "muted" : t1;
|
|
51
|
+
const shape = t2 === undefined ? "pill" : t2;
|
|
52
|
+
const size = t3 === undefined ? "md" : t3;
|
|
53
|
+
const mono = t4 === undefined ? false : t4;
|
|
54
|
+
let t10;
|
|
55
|
+
let t5;
|
|
56
|
+
let t6;
|
|
57
|
+
let t7;
|
|
58
|
+
let t8;
|
|
59
|
+
let t9;
|
|
60
|
+
if ($[0] !== children || $[1] !== className || $[2] !== disabled || $[3] !== icon || $[4] !== mono || $[5] !== onClick || $[6] !== pressed || $[7] !== ref || $[8] !== shape || $[9] !== size || $[10] !== tone) {
|
|
61
|
+
t10 = Symbol.for("react.early_return_sentinel");
|
|
62
|
+
bb0: {
|
|
63
|
+
const shared = clsx("inline-flex shrink-0 items-center gap-1 whitespace-nowrap text-2xs", SHAPES[shape], PADDING[shape][size], TONES[tone], mono && "font-mono", className);
|
|
64
|
+
if (!onClick) {
|
|
65
|
+
t10 = /*#__PURE__*/_jsxs("span", {
|
|
66
|
+
ref: ref,
|
|
67
|
+
className: shared,
|
|
68
|
+
children: [icon, children]
|
|
69
|
+
});
|
|
70
|
+
break bb0;
|
|
71
|
+
}
|
|
72
|
+
t5 = ref;
|
|
73
|
+
t6 = "button";
|
|
74
|
+
t7 = pressed;
|
|
75
|
+
t8 = disabled;
|
|
76
|
+
t9 = clsx(shared, "enabled:hover:text-text disabled:opacity-50 aria-pressed:bg-text/14 aria-pressed:text-text");
|
|
33
77
|
}
|
|
34
|
-
|
|
35
|
-
|
|
78
|
+
$[0] = children;
|
|
79
|
+
$[1] = className;
|
|
80
|
+
$[2] = disabled;
|
|
81
|
+
$[3] = icon;
|
|
82
|
+
$[4] = mono;
|
|
83
|
+
$[5] = onClick;
|
|
84
|
+
$[6] = pressed;
|
|
85
|
+
$[7] = ref;
|
|
86
|
+
$[8] = shape;
|
|
87
|
+
$[9] = size;
|
|
88
|
+
$[10] = tone;
|
|
89
|
+
$[11] = t10;
|
|
90
|
+
$[12] = t5;
|
|
91
|
+
$[13] = t6;
|
|
92
|
+
$[14] = t7;
|
|
93
|
+
$[15] = t8;
|
|
94
|
+
$[16] = t9;
|
|
95
|
+
} else {
|
|
96
|
+
t10 = $[11];
|
|
97
|
+
t5 = $[12];
|
|
98
|
+
t6 = $[13];
|
|
99
|
+
t7 = $[14];
|
|
100
|
+
t8 = $[15];
|
|
101
|
+
t9 = $[16];
|
|
102
|
+
}
|
|
103
|
+
if (t10 !== Symbol.for("react.early_return_sentinel")) {
|
|
104
|
+
return t10;
|
|
105
|
+
}
|
|
106
|
+
let t11;
|
|
107
|
+
if ($[17] !== children || $[18] !== icon || $[19] !== onClick || $[20] !== t5 || $[21] !== t6 || $[22] !== t7 || $[23] !== t8 || $[24] !== t9) {
|
|
108
|
+
t11 = /*#__PURE__*/_jsxs("button", {
|
|
109
|
+
ref: t5,
|
|
110
|
+
type: t6,
|
|
111
|
+
"aria-pressed": t7,
|
|
112
|
+
disabled: t8,
|
|
113
|
+
className: t9,
|
|
114
|
+
onClick: onClick,
|
|
115
|
+
children: [icon, children]
|
|
116
|
+
});
|
|
117
|
+
$[17] = children;
|
|
118
|
+
$[18] = icon;
|
|
119
|
+
$[19] = onClick;
|
|
120
|
+
$[20] = t5;
|
|
121
|
+
$[21] = t6;
|
|
122
|
+
$[22] = t7;
|
|
123
|
+
$[23] = t8;
|
|
124
|
+
$[24] = t9;
|
|
125
|
+
$[25] = t11;
|
|
126
|
+
} else {
|
|
127
|
+
t11 = $[25];
|
|
128
|
+
}
|
|
129
|
+
return t11;
|
|
130
|
+
}
|