@adecore/ui 0.35.5 → 0.37.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/Button.d.ts +2 -3
- package/dist/Button.js +21 -46
- package/dist/Checkbox.js +1 -1
- package/dist/ChoiceCards.js +2 -2
- package/dist/IconPicker.d.ts +2 -1
- package/dist/IconPicker.js +504 -217
- package/dist/Input.d.ts +5 -3
- package/dist/Input.js +127 -112
- package/dist/Segmented.js +1 -1
- package/dist/SplitButton.d.ts +17 -0
- package/dist/SplitButton.js +237 -0
- package/dist/Stepper.js +1 -1
- package/dist/Switch.js +1 -1
- package/dist/Tile.js +2 -2
- package/dist/button-class.d.ts +6 -0
- package/dist/button-class.js +92 -0
- package/dist/command-palette/context.d.ts +10 -0
- package/dist/command-palette/context.js +5 -0
- package/dist/command-palette/index.parts.d.ts +1 -0
- package/dist/command-palette/index.parts.js +2 -1
- package/dist/command-palette/parts.d.ts +1 -1
- package/dist/command-palette/parts.js +12 -3
- package/dist/command-palette/virtual.d.ts +20 -0
- package/dist/command-palette/virtual.js +155 -0
- package/dist/file-tree/empty-lines.d.ts +11 -0
- package/dist/file-tree/empty-lines.js +89 -0
- package/dist/file-tree/highlight.d.ts +4 -0
- package/dist/file-tree/highlight.js +75 -0
- package/dist/file-tree/parts.d.ts +9 -1
- package/dist/file-tree/parts.js +297 -205
- package/dist/file-tree/style.js +13 -0
- package/dist/file-tree/use-empty-lines.d.ts +3 -0
- package/dist/file-tree/use-empty-lines.js +176 -0
- package/dist/file-tree/use-file-tree.js +5 -1
- package/dist/file-tree/use-slots.d.ts +16 -2
- package/dist/file-tree/use-slots.js +186 -43
- package/dist/format/index.d.ts +1 -1
- package/dist/format/index.js +1 -1
- package/dist/format/locale.d.ts +1 -0
- package/dist/format/locale.js +4 -5
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/locales/en.d.ts +1 -0
- package/dist/locales/en.js +1 -0
- package/dist/locales/nl.d.ts +1 -0
- package/dist/locales/nl.js +1 -0
- package/dist/select-shared.d.ts +1 -1
- package/dist/select-shared.js +1 -1
- package/dist/settings/SettingsDialog.js +1 -1
- package/dist/theme.css +33 -3
- package/package.json +2 -1
- package/src/Button.tsx +3 -36
- package/src/Checkbox.tsx +1 -1
- package/src/ChoiceCards.tsx +2 -2
- package/src/IconPicker.tsx +220 -136
- package/src/Input.tsx +19 -10
- package/src/Segmented.tsx +1 -1
- package/src/SplitButton.tsx +72 -0
- package/src/Stepper.tsx +6 -1
- package/src/Switch.tsx +1 -1
- package/src/Tile.tsx +2 -2
- package/src/button-class.ts +111 -0
- package/src/command-palette/context.ts +16 -0
- package/src/command-palette/index.parts.ts +2 -0
- package/src/command-palette/parts.tsx +11 -12
- package/src/command-palette/virtual.tsx +147 -0
- package/src/file-tree/empty-lines.ts +105 -0
- package/src/file-tree/highlight.ts +80 -0
- package/src/file-tree/parts.tsx +42 -11
- package/src/file-tree/style.ts +13 -0
- package/src/file-tree/use-empty-lines.ts +115 -0
- package/src/file-tree/use-file-tree.ts +2 -1
- package/src/file-tree/use-slots.ts +176 -17
- package/src/format/index.ts +1 -1
- package/src/format/locale.ts +13 -7
- package/src/index.ts +3 -0
- package/src/locales/en.ts +1 -0
- package/src/locales/nl.ts +1 -0
- package/src/select-shared.ts +2 -1
- package/src/settings/SettingsDialog.tsx +1 -1
- package/src/theme.css +33 -3
package/dist/index.d.ts
CHANGED
|
@@ -57,6 +57,7 @@ export { Skeleton, type SkeletonProps } from './Skeleton.tsx';
|
|
|
57
57
|
export { Slider, type SliderProps } from './Slider.tsx';
|
|
58
58
|
export { SlidingColumn, type SlidingColumnProps } from './SlidingColumn.tsx';
|
|
59
59
|
export { Spinner, type SpinnerProps } from './Spinner.tsx';
|
|
60
|
+
export { SplitButton, type SplitButtonProps } from './SplitButton.tsx';
|
|
60
61
|
export { Stepper, type StepperProps } from './Stepper.tsx';
|
|
61
62
|
export { Surface, type SurfaceProps } from './Surface.tsx';
|
|
62
63
|
export { Switch, type SwitchProps } from './Switch.tsx';
|
|
@@ -102,3 +103,4 @@ export { DropPreview, type DropPreviewProps } from './workspace/DropPreview.tsx'
|
|
|
102
103
|
export { rectDropPreview, sameDropPreview, tabDropPreview, type DropPreviewShape, type TabDrop } from './workspace/preview.ts';
|
|
103
104
|
export { createSplitLayout, updateSplitLayout, splitPanes, type SplitAxis, type SplitSide, type SplitPane, type SplitBranch, type SplitNode, type SplitLayout, type SplitCommand } from './workspace/model.ts';
|
|
104
105
|
export { tabGapAt, type SplitRect, type SplitEdges, type SplitMinimum } from './workspace/geometry.ts';
|
|
106
|
+
export type { CommandPaletteVirtualListProps, CommandPaletteVirtualItemProps } from './command-palette/virtual.tsx';
|
package/dist/index.js
CHANGED
|
@@ -54,6 +54,7 @@ export { Skeleton } from "./Skeleton.js";
|
|
|
54
54
|
export { Slider } from "./Slider.js";
|
|
55
55
|
export { SlidingColumn } from "./SlidingColumn.js";
|
|
56
56
|
export { Spinner } from "./Spinner.js";
|
|
57
|
+
export { SplitButton } from "./SplitButton.js";
|
|
57
58
|
export { Stepper } from "./Stepper.js";
|
|
58
59
|
export { Surface } from "./Surface.js";
|
|
59
60
|
export { Switch } from "./Switch.js";
|
package/dist/locales/en.d.ts
CHANGED
package/dist/locales/en.js
CHANGED
package/dist/locales/nl.d.ts
CHANGED
package/dist/locales/nl.js
CHANGED
package/dist/select-shared.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare const TRIGGER_SIZE: {
|
|
|
16
16
|
readonly md: 'h-8 gap-1.5 px-2';
|
|
17
17
|
};
|
|
18
18
|
export declare const TRIGGER_VARIANT: {
|
|
19
|
-
readonly outlined: 'max-w-56 rounded-lg border border-border bg-surface-
|
|
19
|
+
readonly outlined: 'max-w-56 rounded-lg border border-field-border bg-field text-text hover:bg-surface-hover data-[popup-open]:bg-surface-hover data-disabled:hover:bg-field';
|
|
20
20
|
readonly ghost: 'rounded-md text-text-muted hover:bg-surface-hover hover:text-text data-[popup-open]:bg-surface-active data-[popup-open]:text-text data-disabled:hover:bg-transparent data-disabled:hover:text-text-muted';
|
|
21
21
|
};
|
|
22
22
|
export declare const TRIGGER_DISABLED = "data-disabled:cursor-default data-disabled:opacity-50";
|
package/dist/select-shared.js
CHANGED
|
@@ -5,7 +5,7 @@ export const TRIGGER_SIZE = {
|
|
|
5
5
|
md: 'h-8 gap-1.5 px-2'
|
|
6
6
|
};
|
|
7
7
|
export const TRIGGER_VARIANT = {
|
|
8
|
-
outlined: 'max-w-56 rounded-lg border border-border bg-surface-
|
|
8
|
+
outlined: 'max-w-56 rounded-lg border border-field-border bg-field text-text hover:bg-surface-hover data-[popup-open]:bg-surface-hover data-disabled:hover:bg-field',
|
|
9
9
|
ghost: 'rounded-md text-text-muted hover:bg-surface-hover hover:text-text data-[popup-open]:bg-surface-active data-[popup-open]:text-text data-disabled:hover:bg-transparent data-disabled:hover:text-text-muted'
|
|
10
10
|
};
|
|
11
11
|
/* The dimmed look `Switch` and `Button` wear when disabled, so a select that cannot open reads as such. */
|
|
@@ -241,7 +241,7 @@ function SearchField(t0) {
|
|
|
241
241
|
if ($[15] !== query || $[16] !== t4 || $[17] !== t5 || $[18] !== t6 || $[19] !== t7) {
|
|
242
242
|
t8 = /*#__PURE__*/_jsx(Input, {
|
|
243
243
|
ref: input,
|
|
244
|
-
className: "
|
|
244
|
+
className: "pr-12 pl-8 text-xs",
|
|
245
245
|
placeholder: t4,
|
|
246
246
|
"aria-label": t5,
|
|
247
247
|
value: query,
|
package/dist/theme.css
CHANGED
|
@@ -17,9 +17,16 @@
|
|
|
17
17
|
than the pressed step, so hover reads as a lift and pressed as the heavier state. A white
|
|
18
18
|
popup cannot go lighter, so in this theme the step is the softest gray there is. */
|
|
19
19
|
--surface-hover: #f3f3f5;
|
|
20
|
+
/* The hover of something that draws its own border: a smaller step, so the ground never passes
|
|
21
|
+
its edge and the outline stays visible under the pointer. */
|
|
22
|
+
--surface-hover-edged: color-mix(in srgb, var(--surface-raised) 60%, var(--surface-hover));
|
|
20
23
|
/* The pressed step of a toggle. It cannot be `--surface-raised`, which equals `--surface` in the
|
|
21
24
|
light theme, and it has to sit a shade past `--surface-hover` so pressed outranks hover. */
|
|
22
25
|
--surface-active: #dcdce2;
|
|
26
|
+
/* What a person types or picks in: a step lighter than the ground it stands on in the dark theme, the raised white here. */
|
|
27
|
+
--field: var(--surface-raised);
|
|
28
|
+
/* An edge of its own, since an app may set `--border` to a solid separator that vanishes against a field. */
|
|
29
|
+
--field-border: rgb(0 0 0 / 0.11);
|
|
23
30
|
/* Borders carry an alpha rather than a gray of their own, so a line takes the color of whatever
|
|
24
31
|
it is drawn over instead of fighting it. A gray hairline over a tinted surface reads as a
|
|
25
32
|
smudge; the same line in black at a low alpha stays a line. Everything with a surface of its
|
|
@@ -41,6 +48,9 @@
|
|
|
41
48
|
--accent-soft: color-mix(in srgb, var(--accent) 16%, var(--surface));
|
|
42
49
|
--accent-text: #ffffff;
|
|
43
50
|
--selection: rgb(var(--accent-rgb) / 0.55);
|
|
51
|
+
/* The part of a name that answers a filter or a search. A tint of its own rather than the
|
|
52
|
+
selection's, so a selected row that matches still shows both. */
|
|
53
|
+
--match: color-mix(in srgb, var(--status-needs-you) 30%, transparent);
|
|
44
54
|
--float-shadow:
|
|
45
55
|
0 1px 2px -1px rgb(0 0 0 / 0.08),
|
|
46
56
|
0 3px 6px -2px rgb(0 0 0 / 0.07),
|
|
@@ -106,9 +116,12 @@
|
|
|
106
116
|
--bg: #0d0d10;
|
|
107
117
|
--surface: #131316;
|
|
108
118
|
--surface-raised: #18181c;
|
|
109
|
-
--surface-sunken: #
|
|
119
|
+
--surface-sunken: #0b0b0e;
|
|
110
120
|
--surface-hover: #202024;
|
|
111
121
|
--surface-active: #28282e;
|
|
122
|
+
/* Derived, so an app that tints its surfaces tints its fields along. */
|
|
123
|
+
--field: color-mix(in srgb, var(--surface) 40%, var(--surface-hover));
|
|
124
|
+
--field-border: rgb(255 255 255 / 0.1);
|
|
112
125
|
/* White at a low alpha, which is what gives a dark surface its lifted edge. */
|
|
113
126
|
--border: rgb(255 255 255 / 0.07);
|
|
114
127
|
--separator: oklch(0.236 0.006 285.956);
|
|
@@ -118,6 +131,7 @@
|
|
|
118
131
|
--text-muted: #9a9aa6;
|
|
119
132
|
--text-faint: #5f5f6b;
|
|
120
133
|
--selection: rgb(var(--accent-rgb) / 0.6);
|
|
134
|
+
--match: color-mix(in srgb, var(--status-needs-you) 28%, transparent);
|
|
121
135
|
--float-shadow:
|
|
122
136
|
0 1px 2px -1px rgb(0 0 0 / 0.3),
|
|
123
137
|
0 2px 4px rgb(0 0 0 / 0.24),
|
|
@@ -233,7 +247,10 @@
|
|
|
233
247
|
--color-surface-sunken: var(--surface-sunken);
|
|
234
248
|
--color-surface-idle: var(--surface-idle);
|
|
235
249
|
--color-surface-hover: var(--surface-hover);
|
|
250
|
+
--color-surface-hover-edged: var(--surface-hover-edged);
|
|
236
251
|
--color-surface-active: var(--surface-active);
|
|
252
|
+
--color-field: var(--field);
|
|
253
|
+
--color-field-border: var(--field-border);
|
|
237
254
|
--color-border: var(--border);
|
|
238
255
|
--color-separator: var(--separator);
|
|
239
256
|
--color-border-strong: var(--border-strong);
|
|
@@ -261,6 +278,10 @@
|
|
|
261
278
|
}
|
|
262
279
|
|
|
263
280
|
@layer base {
|
|
281
|
+
/* Whatever a click acts on shows the hand; a disabled one shows that nothing will. Menu rows keep the arrow (`.menu-item`). */
|
|
282
|
+
:where(button, a[href], summary, label[for], [role="button"], [role="checkbox"], [role="switch"], [role="radio"], [role="tab"], [role="option"]):not(:disabled, [aria-disabled="true"], [data-disabled]) {
|
|
283
|
+
cursor: pointer;
|
|
284
|
+
}
|
|
264
285
|
/*
|
|
265
286
|
* A border with an alpha has to mix with what is behind the element, not with the element's own
|
|
266
287
|
* background: by default a background runs on under the border and a node's white surface would
|
|
@@ -326,8 +347,8 @@
|
|
|
326
347
|
width: 100%;
|
|
327
348
|
padding: 0 10px;
|
|
328
349
|
border-radius: 8px;
|
|
329
|
-
border: 1px solid var(--border);
|
|
330
|
-
background: var(--
|
|
350
|
+
border: 1px solid var(--field-border);
|
|
351
|
+
background-color: var(--field);
|
|
331
352
|
color: var(--text);
|
|
332
353
|
font-size: var(--text-sm);
|
|
333
354
|
outline: none;
|
|
@@ -345,6 +366,10 @@
|
|
|
345
366
|
border-radius: 6px;
|
|
346
367
|
font-size: var(--text-xs);
|
|
347
368
|
}
|
|
369
|
+
/* A field inside a card that draws the edge and the focus for it. The border stays as a transparent
|
|
370
|
+
line, so the text sits where it would in a field of its own. */
|
|
371
|
+
.field-bare { border-color: transparent; background: transparent; }
|
|
372
|
+
.field-bare:focus-visible { outline: none; }
|
|
348
373
|
/* Keyboard focus is visible on every control; pointer focus stays quiet. `.focus-ring` is the
|
|
349
374
|
same outline for something that takes focus without being a button, such as a row in a list. */
|
|
350
375
|
.icon-btn:focus-visible, .menu-item:focus-visible, button:focus-visible, .focus-ring:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
|
|
@@ -683,6 +708,11 @@
|
|
|
683
708
|
.adecore-tree-decoration {
|
|
684
709
|
font-variant-numeric: tabular-nums;
|
|
685
710
|
}
|
|
711
|
+
/* A row's own icon in place of the tree's glyph, in the glyph's color. */
|
|
712
|
+
.adecore-tree-icon {
|
|
713
|
+
display: inline-flex;
|
|
714
|
+
color: var(--text-muted);
|
|
715
|
+
}
|
|
686
716
|
/* A tree whose rows slide sideways: every part of a row keeps its width and moves with the shift. */
|
|
687
717
|
.adecore-tree[data-overflow="scroll"] .adecore-tree-row {
|
|
688
718
|
overflow: clip;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adecore/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"description": "React components, a theme, formatters and a settings dialog for desktop-grade apps on React 19, Base UI and Tailwind 4.",
|
|
5
5
|
"license": "FSL-1.1-MIT",
|
|
6
6
|
"author": "Bas Milius",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@base-ui/react": "^1.9.0",
|
|
69
69
|
"@pierre/trees": "1.0.0-beta.6",
|
|
70
|
+
"@tanstack/react-virtual": "^3.14.13",
|
|
70
71
|
"clsx": "^2.1.1",
|
|
71
72
|
"lucide-react": "^1.47.0",
|
|
72
73
|
"zustand": "^5.0.15"
|
package/src/Button.tsx
CHANGED
|
@@ -1,35 +1,8 @@
|
|
|
1
1
|
import type { AnchorHTMLAttributes, ComponentProps, Ref } from 'react';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
+
import { buttonClass, type ButtonShape, type ButtonSize, type ButtonVariant } from './button-class.ts';
|
|
3
4
|
|
|
4
|
-
export type
|
|
5
|
-
export type ButtonSize = 'xs' | 'sm' | 'md';
|
|
6
|
-
export type ButtonShape = 'default' | 'pill';
|
|
7
|
-
|
|
8
|
-
const VARIANT: Record<ButtonVariant, string> = {
|
|
9
|
-
// A filled button darkens under the pointer. Its color is the meaning, so no token of its own for hover.
|
|
10
|
-
primary: 'bg-accent text-accent-text hover:brightness-90 disabled:hover:brightness-100',
|
|
11
|
-
secondary: 'border border-border bg-surface-raised text-text hover:bg-surface-hover disabled:hover:bg-surface-raised',
|
|
12
|
-
ghost: 'text-text-muted hover:bg-surface-hover hover:text-text',
|
|
13
|
-
danger: 'bg-status-error text-accent-text hover:brightness-90 disabled:hover:brightness-100',
|
|
14
|
-
// A step that forgets something rather than destroys it: softer than the filled button of a deletion that cannot come back.
|
|
15
|
-
'danger-outline': 'border border-status-error/35 text-status-error hover:bg-status-error/10 disabled:hover:bg-transparent',
|
|
16
|
-
positive: 'bg-positive text-positive-text hover:brightness-90 disabled:hover:brightness-100',
|
|
17
|
-
// Dark on a light theme, light on a dark one, matching what Apple's and GitHub's sign-in buttons ask for.
|
|
18
|
-
inverse: 'bg-text text-bg hover:opacity-90 disabled:hover:opacity-100'
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
/* 28 and 32 pixels are the compact and the normal control; 24 fits a header of 32. */
|
|
22
|
-
const SIZE: Record<ButtonSize, string> = {
|
|
23
|
-
xs: 'h-6 px-2',
|
|
24
|
-
sm: 'h-7 px-2.5',
|
|
25
|
-
md: 'h-8 px-3'
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/* A pill is one size of its own, for a control that sits in a round row, so it takes the place of `size`. */
|
|
29
|
-
const SHAPE: Record<ButtonShape, string> = {
|
|
30
|
-
default: 'rounded-md text-xs',
|
|
31
|
-
pill: 'h-9 rounded-full px-3.5 text-sm'
|
|
32
|
-
};
|
|
5
|
+
export type { ButtonShape, ButtonSize, ButtonVariant } from './button-class.ts';
|
|
33
6
|
|
|
34
7
|
export interface ButtonProps extends ComponentProps<'button'> {
|
|
35
8
|
variant?: ButtonVariant;
|
|
@@ -42,13 +15,7 @@ export interface ButtonProps extends ComponentProps<'button'> {
|
|
|
42
15
|
|
|
43
16
|
/* Every button with a word in it. A button that is only an icon is an `IconButton`, which is a square, not a label. */
|
|
44
17
|
export function Button({ variant = 'ghost', size = 'md', shape = 'default', className, href, type = 'button', ref, ...rest }: ButtonProps) {
|
|
45
|
-
const classes = clsx(
|
|
46
|
-
'inline-flex shrink-0 items-center justify-center gap-1.5 font-medium disabled:opacity-50',
|
|
47
|
-
SHAPE[shape],
|
|
48
|
-
VARIANT[variant],
|
|
49
|
-
shape === 'default' && SIZE[size],
|
|
50
|
-
className
|
|
51
|
-
);
|
|
18
|
+
const classes = clsx(buttonClass(variant, size, shape), className);
|
|
52
19
|
if (href) {
|
|
53
20
|
return (
|
|
54
21
|
<a
|
package/src/Checkbox.tsx
CHANGED
|
@@ -27,7 +27,7 @@ export function Checkbox({ checked, onCheckedChange, label, indeterminate = fals
|
|
|
27
27
|
aria-label={label}
|
|
28
28
|
disabled={disabled}
|
|
29
29
|
className={clsx(
|
|
30
|
-
'flex size-4 shrink-0 items-center justify-center rounded-sm border border-border
|
|
30
|
+
'flex size-4 shrink-0 items-center justify-center rounded-sm border border-field-border bg-field text-accent-text transition-colors',
|
|
31
31
|
'data-checked:border-accent data-checked:bg-accent data-indeterminate:border-accent data-indeterminate:bg-accent data-disabled:opacity-50',
|
|
32
32
|
className
|
|
33
33
|
)}
|
package/src/ChoiceCards.tsx
CHANGED
|
@@ -47,11 +47,11 @@ function ChoiceCard<Value extends string | number>({ choice, radio }: { choice:
|
|
|
47
47
|
disabled={choice.disabled}
|
|
48
48
|
aria-labelledby={`${id}-title`}
|
|
49
49
|
aria-describedby={`${id}-description`}
|
|
50
|
-
className="group focus-ring flex min-w-0 items-start gap-3 rounded-xl border border-border bg-surface p-3 text-left hover:bg-surface-hover data-checked:border-accent data-disabled:opacity-50 data-disabled:hover:bg-surface"
|
|
50
|
+
className="group focus-ring flex min-w-0 items-start gap-3 rounded-xl border border-border bg-surface p-3 text-left hover:bg-surface-hover-edged data-checked:border-accent data-disabled:opacity-50 data-disabled:hover:bg-surface"
|
|
51
51
|
>
|
|
52
52
|
{radio === 'start' && dot}
|
|
53
53
|
{choice.icon && (
|
|
54
|
-
<span className="grid size-8 shrink-0 place-items-center rounded-lg bg-surface-sunken text-text-muted group-data-checked:text-accent">
|
|
54
|
+
<span className="grid size-8 shrink-0 place-items-center rounded-lg bg-surface-sunken text-text-muted group-data-checked:text-accent dark:bg-field dark:inset-ring dark:inset-ring-field-border">
|
|
55
55
|
<Icon icon={choice.icon} size={16} />
|
|
56
56
|
</span>
|
|
57
57
|
)}
|