@adecore/ui 0.31.11 → 0.32.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.
Files changed (163) hide show
  1. package/dist/AccentSwatches.js +290 -13
  2. package/dist/Banner.js +90 -9
  3. package/dist/Button.js +114 -22
  4. package/dist/ButtonGroup.js +62 -8
  5. package/dist/Checkbox.js +73 -4
  6. package/dist/ChoiceCards.js +205 -11
  7. package/dist/CloseButton.js +87 -7
  8. package/dist/ColorSwatch.js +132 -15
  9. package/dist/ColorWheelPicker.js +305 -71
  10. package/dist/ColumnResizeHandle.js +43 -8
  11. package/dist/DisabledReason.js +27 -8
  12. package/dist/DockShell.js +144 -37
  13. package/dist/EmptyState.js +95 -6
  14. package/dist/ErrorBoundary.js +254 -31
  15. package/dist/Field.js +349 -31
  16. package/dist/FileIcon.js +67 -6
  17. package/dist/Icon.js +38 -6
  18. package/dist/IconButton.js +176 -20
  19. package/dist/IconPicker.js +344 -73
  20. package/dist/Input.js +233 -14
  21. package/dist/Kbd.js +150 -10
  22. package/dist/LazyBoundary.js +14 -5
  23. package/dist/ListRow.js +75 -15
  24. package/dist/Meter.js +108 -5
  25. package/dist/MiddleTruncate.js +126 -45
  26. package/dist/PanelEmpty.js +64 -5
  27. package/dist/PanelHeader.js +95 -13
  28. package/dist/Pill.js +114 -19
  29. package/dist/ProjectSwitcher.js +225 -12
  30. package/dist/PromptDialog.js +352 -37
  31. package/dist/SectionLabel.js +62 -8
  32. package/dist/SegmentBar.js +197 -36
  33. package/dist/Segmented.js +130 -23
  34. package/dist/Select.js +310 -19
  35. package/dist/SelectSearch.js +344 -29
  36. package/dist/Separator.js +35 -4
  37. package/dist/ShortcutHints.js +146 -76
  38. package/dist/Skeleton.js +31 -4
  39. package/dist/Slider.js +172 -10
  40. package/dist/SlidingColumn.js +194 -34
  41. package/dist/Spinner.js +100 -3
  42. package/dist/Stepper.js +232 -11
  43. package/dist/Surface.js +62 -8
  44. package/dist/Switch.js +60 -6
  45. package/dist/TextMenu.js +212 -17
  46. package/dist/Tile.js +149 -5
  47. package/dist/Toasts.js +391 -33
  48. package/dist/Tooltip.js +153 -16
  49. package/dist/UIProvider.js +62 -15
  50. package/dist/Waveform.js +362 -93
  51. package/dist/Wipe.js +259 -34
  52. package/dist/ZoomControls.js +356 -14
  53. package/dist/class-name.js +1 -1
  54. package/dist/clipboard.js +15 -17
  55. package/dist/context-menu/index.parts.js +1 -1
  56. package/dist/dialog/index.parts.js +1 -1
  57. package/dist/dialog/parts.js +378 -29
  58. package/dist/dialog-layer.js +51 -18
  59. package/dist/error-boundary.js +19 -19
  60. package/dist/error-message.js +1 -1
  61. package/dist/field-context.js +7 -5
  62. package/dist/file-icon.js +23 -21
  63. package/dist/file-tree/helpers.js +133 -119
  64. package/dist/file-tree/index.parts.js +3 -3
  65. package/dist/file-tree/parts.js +418 -127
  66. package/dist/file-tree/style.js +1 -1
  67. package/dist/file-tree/use-file-tree-shift.js +43 -30
  68. package/dist/file-tree/use-file-tree.js +60 -18
  69. package/dist/file-tree/use-slots.js +220 -192
  70. package/dist/floating.js +2 -2
  71. package/dist/format/datetime.js +88 -38
  72. package/dist/format/duration.js +59 -53
  73. package/dist/format/index.js +1 -1
  74. package/dist/format/locale.js +76 -56
  75. package/dist/format/number.js +77 -61
  76. package/dist/format/regions.js +4 -2
  77. package/dist/format/time-zone.js +1 -1
  78. package/dist/icon-button-size.js +12 -2
  79. package/dist/icon-picker.js +70 -61
  80. package/dist/index.js +57 -57
  81. package/dist/key-value-list/index.parts.js +1 -1
  82. package/dist/key-value-list/parts.js +256 -22
  83. package/dist/lazy-landings.js +10 -10
  84. package/dist/lazy.js +84 -71
  85. package/dist/locales/en.js +80 -80
  86. package/dist/locales/nl.js +80 -80
  87. package/dist/locales.js +10 -7
  88. package/dist/menu/index.parts.js +1 -1
  89. package/dist/menu/parts.js +882 -44
  90. package/dist/merge-refs.js +8 -9
  91. package/dist/middle-truncate.js +24 -25
  92. package/dist/modality.js +27 -19
  93. package/dist/placement.js +11 -20
  94. package/dist/platform.js +6 -6
  95. package/dist/popover/index.parts.js +1 -1
  96. package/dist/popover/parts.js +173 -11
  97. package/dist/popup-layer.js +38 -17
  98. package/dist/prefetch.js +78 -79
  99. package/dist/preview-card/index.parts.js +1 -1
  100. package/dist/project-switcher-row.js +153 -12
  101. package/dist/select-row.js +69 -5
  102. package/dist/select-shared.js +6 -6
  103. package/dist/selection.js +16 -16
  104. package/dist/seti-icons.js +413 -413
  105. package/dist/settings/ConfirmDialog.js +55 -8
  106. package/dist/settings/DetailHeader.js +72 -4
  107. package/dist/settings/MasterDetail.js +119 -7
  108. package/dist/settings/SettingsDialog.js +820 -80
  109. package/dist/settings/SettingsRow.js +205 -18
  110. package/dist/settings/SettingsSection.js +96 -6
  111. package/dist/settings/index.js +7 -7
  112. package/dist/settings/target.js +7 -2
  113. package/dist/shortcut-hints.js +73 -55
  114. package/dist/shortcut.js +140 -104
  115. package/dist/step-places.js +1 -1
  116. package/dist/tabs/index.parts.js +1 -1
  117. package/dist/tabs/overflow.js +18 -18
  118. package/dist/tabs/parts.js +780 -166
  119. package/dist/testing/dedupe.js +82 -75
  120. package/dist/testing/fake-source.js +12 -12
  121. package/dist/testing/index.js +1 -1
  122. package/dist/toast-store.js +65 -46
  123. package/dist/tree/index.parts.js +1 -1
  124. package/dist/tree/parts.js +721 -94
  125. package/dist/tree/shift.js +28 -22
  126. package/dist/tree/style.js +2 -2
  127. package/dist/tree/use-tree-shift.js +178 -117
  128. package/dist/useAsyncAction.js +23 -19
  129. package/dist/useColumnResize.js +36 -34
  130. package/dist/useContentSize.js +62 -18
  131. package/dist/useMeasuredWidth.js +14 -3
  132. package/dist/useNow.js +73 -30
  133. package/dist/wipe-split.js +14 -14
  134. package/dist/workspace/DropPreview.js +60 -7
  135. package/dist/workspace/SplitView.js +1025 -441
  136. package/dist/workspace/TabStrip.js +810 -191
  137. package/dist/workspace/Workspace.js +276 -26
  138. package/dist/workspace/context.js +8 -3
  139. package/dist/workspace/geometry.js +173 -150
  140. package/dist/workspace/model.js +313 -250
  141. package/dist/workspace/preview.js +61 -61
  142. package/dist/zoom.js +2 -2
  143. package/package.json +1 -1
  144. package/src/ErrorBoundary.tsx +1 -1
  145. package/src/Field.tsx +4 -3
  146. package/src/IconPicker.tsx +3 -3
  147. package/src/LazyBoundary.tsx +2 -0
  148. package/src/MiddleTruncate.tsx +2 -2
  149. package/src/SegmentBar.tsx +2 -2
  150. package/src/Toasts.tsx +3 -1
  151. package/src/Tooltip.tsx +7 -10
  152. package/src/Waveform.tsx +3 -3
  153. package/src/file-tree/parts.tsx +6 -9
  154. package/src/file-tree/use-file-tree-shift.tsx +6 -9
  155. package/src/lazy.tsx +4 -0
  156. package/src/locales/en.ts +4 -4
  157. package/src/locales/nl.ts +5 -5
  158. package/src/settings/SettingsDialog.tsx +1 -1
  159. package/src/tree/parts.tsx +5 -8
  160. package/src/useContentSize.ts +3 -3
  161. package/src/workspace/SplitView.tsx +2 -2
  162. package/src/workspace/TabStrip.tsx +2 -3
  163. package/src/workspace/Workspace.tsx +2 -5
@@ -1,59 +1,140 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useLayoutEffect, useMemo, useState } from 'react';
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 './Tooltip.js';
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
- const view = element.ownerDocument.defaultView;
11
- canvas ??= element.ownerDocument.createElement('canvas');
12
- const context = canvas.getContext('2d');
13
- if (context === null || view === null) {
14
- return null;
15
- }
16
- const style = view.getComputedStyle(element);
17
- context.font = style.font || `${style.fontStyle} ${style.fontWeight} ${style.fontSize} ${style.fontFamily}`;
18
- if ('letterSpacing' in context) {
19
- context.letterSpacing = style.letterSpacing === 'normal' ? '0px' : style.letterSpacing;
20
- }
21
- return (text) => context.measureText(text).width;
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
- return first?.head === second?.head && first?.tail === second?.tail;
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({ text, tooltip = true, className, ref }) {
32
- const [element, setElement] = useState(null);
33
- const [cut, setCut] = useState(null);
34
- const rootRef = useMemo(() => mergeRefs(setElement, ref), [ref]);
35
- useLayoutEffect(() => {
36
- if (element === null) {
37
- return;
38
- }
39
- const update = () => {
40
- const measure = textMeasure(element);
41
- // Layout rounds what a canvas measures, so a text a fraction wider than its box still fits.
42
- const next = measure === null ? null : fitMiddle(text, element.getBoundingClientRect().width + 0.5, measure);
43
- setCut((current) => (sameCut(current, next) ? current : next));
44
- };
45
- update();
46
- if (typeof ResizeObserver === 'undefined') {
47
- return;
48
- }
49
- const observer = new ResizeObserver(update);
50
- observer.observe(element);
51
- return () => observer.disconnect();
52
- }, [element, text]);
53
- const content = (_jsx("span", { ref: rootRef, className: clsx('middle-truncate', className), "data-text": text, children: cut === null ? (text) : (_jsxs(_Fragment, { children: [_jsx("span", { className: "middle-truncate-head", children: cut.head }), _jsx("span", { className: "middle-truncate-middle", children: cut.middle }), cut.tail] })) }));
54
- // Only a cut text has more to say, and a long list of whole ones keeps no hover handlers.
55
- if (cut === null || !tooltip) {
56
- return content;
57
- }
58
- return _jsx(Tooltip, { label: text, children: content });
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
+ }
@@ -1,7 +1,66 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import clsx from 'clsx';
3
- import { EmptyState } from './EmptyState.js';
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
- export function PanelEmpty({ header, icon, busy = false, action, sunken = false, fill = 'grow', children, className, ref }) {
6
- return (_jsxs("div", { ref: ref, className: clsx('grid min-h-0 place-items-center', fill === 'full' ? 'h-full' : 'grow', sunken && 'bg-surface-sunken', className), children: [header, _jsx(EmptyState, { icon: icon, busy: busy, action: action, children: children })] }));
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
+ }
@@ -1,20 +1,102 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
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 './SectionLabel.js';
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
- export function PanelHeader({ title, render, className, ref, children, ...props }) {
10
- return useRender({
11
- render,
12
- ref,
13
- defaultTagName: 'header',
14
- props: {
15
- ...props,
16
- className: clsx('flex h-12 shrink-0 items-center gap-2 border-b border-border pr-2 pl-3', className),
17
- children: (_jsxs(_Fragment, { children: [title !== undefined && _jsx(SectionLabel, { className: "shrink-0", children: title }), children] }))
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 { jsxs as _jsxs } from "react/jsx-runtime";
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
- muted: 'bg-text/7 text-text-muted',
10
- /* A step further off the ground, for a label that should stand out as a control. */
11
- raised: 'bg-text/12 text-text-muted',
12
- idle: 'bg-status-idle/15 text-status-idle',
13
- needsYou: 'bg-status-needs-you/15 text-status-needs-you',
14
- error: 'bg-status-error/15 text-status-error',
15
- accent: 'bg-accent/16 text-accent'
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
- pill: 'rounded-md',
20
- tag: 'rounded-md font-medium'
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
- pill: { md: 'px-2 py-0.5', sm: 'px-1.5' },
25
- tag: { md: 'px-1.5 py-0.5', sm: 'px-1' }
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({ icon, children, tone = 'muted', shape = 'pill', size = 'md', mono = false, onClick, pressed, disabled, className, ref }) {
29
- // Never broken inside itself: in a row that wraps, a pill that does not fit moves to the next line whole.
30
- 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);
31
- if (!onClick) {
32
- return (_jsxs("span", { ref: ref, className: shared, children: [icon, children] }));
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
- return (_jsxs("button", { ref: ref, type: "button", "aria-pressed": pressed, disabled: disabled, className: clsx(shared, 'enabled:hover:text-text disabled:opacity-50 aria-pressed:bg-text/14 aria-pressed:text-text'), onClick: onClick, children: [icon, children] }));
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
+ }