@prunellejs/ui 0.1.1 → 0.7.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 (79) hide show
  1. package/LICENSE +21 -0
  2. package/llms.txt +19 -11
  3. package/package.json +2 -2
  4. package/src/CommandPalette.tsx +130 -75
  5. package/src/DataTable.tsx +131 -58
  6. package/src/Dialog.tsx +30 -14
  7. package/src/Menu.tsx +10 -8
  8. package/src/Select.tsx +19 -8
  9. package/src/Tabs.tsx +2 -1
  10. package/src/Toaster.tsx +79 -5
  11. package/src/behaviors.ts +104 -6
  12. package/src/fold.ts +7 -0
  13. package/src/index.ts +1 -1
  14. package/src/labels/dialog.ts +3 -0
  15. package/src/labels/fr/dialog.ts +3 -0
  16. package/src/labels/fr/palette.ts +8 -0
  17. package/src/labels/fr/select.ts +1 -0
  18. package/src/labels/fr/table.ts +13 -0
  19. package/src/labels/fr/toaster.ts +1 -0
  20. package/src/labels/palette.ts +8 -0
  21. package/src/labels/select.ts +1 -0
  22. package/src/labels/table.ts +13 -0
  23. package/src/labels/toaster.ts +1 -0
  24. package/src/plugin.ts +114 -31
  25. package/src/primitives.tsx +3 -2
  26. package/src/static.tsx +11 -6
  27. package/src/styles/bare.css +22 -312
  28. package/src/styles/base.css +61 -0
  29. package/src/styles/components/accordion.css +10 -0
  30. package/src/styles/components/badge.css +6 -0
  31. package/src/styles/components/button.css +11 -0
  32. package/src/styles/components/card.css +5 -0
  33. package/src/styles/components/checkbox.css +11 -0
  34. package/src/styles/components/command.css +25 -0
  35. package/src/styles/components/consent.css +38 -0
  36. package/src/styles/components/datatable.css +9 -0
  37. package/src/styles/components/dialog.css +16 -0
  38. package/src/styles/components/drawer.css +29 -0
  39. package/src/styles/components/field.css +8 -0
  40. package/src/styles/components/layout.css +69 -0
  41. package/src/styles/components/menu.css +21 -0
  42. package/src/styles/components/notice.css +5 -0
  43. package/src/styles/components/popover.css +8 -0
  44. package/src/styles/components/progress.css +14 -0
  45. package/src/styles/components/radio-group.css +11 -0
  46. package/src/styles/components/select.css +25 -0
  47. package/src/styles/components/switch.css +42 -0
  48. package/src/styles/components/tabs.css +4 -0
  49. package/src/styles/components/toast.css +28 -0
  50. package/src/styles/grammars/console.css +114 -256
  51. package/src/styles/grammars/editorial.css +101 -271
  52. package/src/styles/grammars/orbit.css +121 -390
  53. package/src/styles/grammars/prunelle.css +157 -360
  54. package/src/styles/grammars/soft.css +106 -240
  55. package/src/styles/grammars/workshop.css +110 -251
  56. package/src/styles/scan.ts +144 -0
  57. package/src/styles/split.ts +429 -0
  58. package/src/styles/theme.css +22 -0
  59. package/src/styles/themed/accordion.css +20 -0
  60. package/src/styles/themed/badge.css +20 -0
  61. package/src/styles/themed/button.css +24 -0
  62. package/src/styles/themed/card.css +23 -0
  63. package/src/styles/themed/checkbox.css +4 -0
  64. package/src/styles/themed/command.css +33 -0
  65. package/src/styles/themed/consent.css +33 -0
  66. package/src/styles/themed/datatable.css +28 -0
  67. package/src/styles/themed/dialog.css +13 -0
  68. package/src/styles/themed/drawer.css +13 -0
  69. package/src/styles/themed/field.css +22 -0
  70. package/src/styles/themed/menu.css +21 -0
  71. package/src/styles/themed/notice.css +17 -0
  72. package/src/styles/themed/popover.css +11 -0
  73. package/src/styles/themed/radio-group.css +12 -0
  74. package/src/styles/themed/select.css +32 -0
  75. package/src/styles/themed/switch.css +23 -0
  76. package/src/styles/themed/tabs.css +20 -0
  77. package/src/styles/themed/toast.css +18 -0
  78. package/src/table-state.ts +53 -16
  79. package/src/toast.ts +50 -8
@@ -0,0 +1,11 @@
1
+ @layer kui {
2
+ [data-ui="button"] {
3
+ display: inline-flex;
4
+ align-items: center;
5
+ justify-content: center;
6
+ min-block-size: var(--ui-touch-min, auto);
7
+ text-decoration: none;
8
+ cursor: pointer;
9
+ &:disabled, &[aria-disabled="true"] { cursor: not-allowed; }
10
+ }
11
+ }
@@ -0,0 +1,5 @@
1
+ @layer kui {
2
+ [data-ui="card"] {
3
+ display: block;
4
+ }
5
+ }
@@ -0,0 +1,11 @@
1
+ @layer kui {
2
+ [data-ui="checkbox"] {
3
+ display: inline-flex;
4
+ align-items: center;
5
+ gap: var(--ui-check-gap, 0.55rem);
6
+ min-block-size: var(--ui-touch-min, auto);
7
+ cursor: pointer;
8
+ user-select: none;
9
+ &[data-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
10
+ }
11
+ }
@@ -0,0 +1,25 @@
1
+ @layer kui {
2
+ html:has(dialog[data-ui]:modal) { overflow: hidden; }
3
+ dialog[data-ui="command"] {
4
+ padding: 0;
5
+ margin: auto;
6
+ max-inline-size: min(32rem, calc(100vw - 2rem));
7
+ max-block-size: calc(100dvh - 2rem);
8
+ overflow: auto;
9
+ inline-size: min(34rem, calc(100vw - 2rem));
10
+ margin-block-start: min(14vh, 6rem);
11
+ }
12
+ dialog[data-ui="command"]::backdrop { background: rgb(0 0 0 / 0.45); }
13
+ dialog[data-ui="command"] [data-part="input"] {
14
+ width: 100%;
15
+ font-size: var(--ui-input-floor, inherit);
16
+ &:focus-visible { outline-offset: -2px; }
17
+ }
18
+ dialog[data-ui="command"] [data-part="item"] {
19
+ display: flex;
20
+ justify-content: space-between;
21
+ align-items: center;
22
+ width: 100%;
23
+ cursor: pointer;
24
+ }
25
+ }
@@ -0,0 +1,38 @@
1
+ @layer kui {
2
+ section[data-ui="consent"] {
3
+ position: fixed;
4
+ inset-inline: 1rem;
5
+ inset-block-end: 1rem;
6
+ z-index: 50;
7
+ max-inline-size: 40rem;
8
+ max-block-size: calc(100dvh - 2rem);
9
+ margin-inline: auto;
10
+ overflow: auto;
11
+ }
12
+ /* Refuse and Accept share the banner row at one width; on a page the preferences buttons keep their own. */
13
+ section[data-ui="consent"] [data-part="actions"] > button {
14
+ flex: 1 1 10rem;
15
+ }
16
+ [data-ui="consent"] {
17
+ & [data-part="actions"] {
18
+ display: flex;
19
+ flex-wrap: wrap;
20
+ gap: 0.5rem;
21
+ }
22
+ & [data-part="choices"] {
23
+ display: grid;
24
+ margin: 0;
25
+ padding: 0;
26
+ border: 0;
27
+ }
28
+ & [data-part="choice"] {
29
+ display: flex;
30
+ align-items: center;
31
+ gap: 0.5rem;
32
+ min-block-size: 2.75rem;
33
+ }
34
+ & [data-part="details"] > summary {
35
+ padding-block: 0.75rem;
36
+ }
37
+ }
38
+ }
@@ -0,0 +1,9 @@
1
+ @layer kui {
2
+ [data-ui="datatable"] { display: flex; flex-direction: column; gap: var(--ui-table-gap, 0.75rem); }
3
+ [data-ui="datatable"] [data-part="scroll"] { overflow-x: auto; }
4
+ [data-ui="datatable"] [data-part="search"] { min-block-size: var(--ui-touch-min, auto); font-size: var(--ui-input-floor, inherit); }
5
+ [data-ui="datatable"] [data-part="pagination"] [data-layout="cluster"] { --ui-gap: 0.4rem; }
6
+ table[data-ui="table"] { width: 100%; border-collapse: collapse; text-align: left; }
7
+ table[data-ui="table"] > caption { text-align: start; font-weight: 600; margin-block-end: 0.5rem; }
8
+ [data-ui="datatable"] [data-part="sort"] { background: transparent; border: 0; padding: 0; font: inherit; text-transform: inherit; letter-spacing: inherit; color: inherit; cursor: pointer; }
9
+ }
@@ -0,0 +1,16 @@
1
+ @layer kui {
2
+ /* The page behind a modal does not scroll */
3
+ html:has(dialog[data-ui]:modal) {
4
+ overflow: hidden;
5
+ }
6
+ dialog[data-ui="dialog"] {
7
+ padding: 0;
8
+ margin: auto;
9
+ max-inline-size: min(32rem, calc(100vw - 2rem));
10
+ max-block-size: calc(100dvh - 2rem);
11
+ overflow: auto;
12
+ }
13
+ dialog[data-ui="dialog"]::backdrop {
14
+ background: rgb(0 0 0 / 0.45);
15
+ }
16
+ }
@@ -0,0 +1,29 @@
1
+ @layer kui {
2
+ html:has(dialog[data-ui]:modal) {
3
+ overflow: hidden;
4
+ }
5
+ dialog[data-ui="drawer"] {
6
+ padding: 0;
7
+ margin: 0;
8
+ max-block-size: 100dvh;
9
+ block-size: 100dvh;
10
+ inline-size: min(26rem, 90vw);
11
+ max-inline-size: 90vw;
12
+ overflow: auto;
13
+ &[data-side="right"] { margin-inline-start: auto; }
14
+ &[data-side="left"] { margin-inline-end: auto; }
15
+ &[data-side="bottom"] {
16
+ margin-block-start: auto;
17
+ inline-size: 100vw;
18
+ max-inline-size: 100vw;
19
+ block-size: auto;
20
+ max-block-size: 80dvh;
21
+ }
22
+ }
23
+ dialog[data-ui="drawer"] > [data-part="panel"] {
24
+ min-block-size: 100%;
25
+ }
26
+ dialog[data-ui="drawer"]::backdrop {
27
+ background: rgb(0 0 0 / 0.45);
28
+ }
29
+ }
@@ -0,0 +1,8 @@
1
+ @layer kui {
2
+ [data-ui="field"] {
3
+ display: flex;
4
+ flex-direction: column;
5
+ & :is(input:not([type="checkbox"], [type="radio"]), select) { min-block-size: var(--ui-touch-min, auto); }
6
+ & :is(input:not([type="checkbox"], [type="radio"]), select, textarea) { font-size: var(--ui-input-floor, inherit); }
7
+ }
8
+ }
@@ -0,0 +1,69 @@
1
+ @layer kui {
2
+ /* Every Layout primitives (0 KB JS) */
3
+ [data-layout="stack"] {
4
+ display: flex;
5
+ flex-direction: column;
6
+ gap: var(--ui-gap, 1rem);
7
+ }
8
+ [data-layout="cluster"] {
9
+ display: flex;
10
+ flex-wrap: wrap;
11
+ align-items: center;
12
+ gap: var(--ui-gap, 0.75rem);
13
+ }
14
+ [data-layout="grid"] {
15
+ display: grid;
16
+ grid-template-columns: repeat(auto-fit, minmax(min(var(--ui-min, 16rem), 100%), 1fr));
17
+ gap: var(--ui-gap, 1rem);
18
+ }
19
+ [data-layout="sidebar"] {
20
+ display: flex;
21
+ flex-wrap: wrap;
22
+ gap: var(--ui-gap, 1.5rem);
23
+ }
24
+ [data-layout="sidebar"] > :first-child {
25
+ flex-basis: var(--ui-side, 16rem);
26
+ flex-grow: 1;
27
+ }
28
+ [data-layout="sidebar"] > :last-child {
29
+ flex-basis: 0;
30
+ flex-grow: 999;
31
+ min-inline-size: var(--ui-content-min, 60%);
32
+ }
33
+ [data-layout="split"] {
34
+ display: flex;
35
+ flex-wrap: wrap;
36
+ align-items: center;
37
+ justify-content: space-between;
38
+ gap: var(--ui-gap, 1rem);
39
+ }
40
+
41
+ /* Layout scale tokens (0 KB JS, strict-CSP safe across all browsers) */
42
+ [data-layout][data-gap="none"] { --ui-gap: 0; }
43
+ [data-layout][data-gap="2xs"] { --ui-gap: var(--ui-space-2xs, 0.25rem); }
44
+ [data-layout][data-gap="xs"] { --ui-gap: var(--ui-space-xs, 0.5rem); }
45
+ [data-layout][data-gap="sm"] { --ui-gap: var(--ui-space-sm, 0.75rem); }
46
+ [data-layout][data-gap="md"] { --ui-gap: var(--ui-space-md, 1rem); }
47
+ [data-layout][data-gap="lg"] { --ui-gap: var(--ui-space-lg, 1.5rem); }
48
+ [data-layout][data-gap="xl"] { --ui-gap: var(--ui-space-xl, 2rem); }
49
+ [data-layout][data-gap="2xl"] { --ui-gap: var(--ui-space-2xl, 3rem); }
50
+
51
+ [data-layout="grid"][data-min="xs"] { --ui-min: 10rem; }
52
+ [data-layout="grid"][data-min="sm"] { --ui-min: 14rem; }
53
+ [data-layout="grid"][data-min="md"] { --ui-min: 16rem; }
54
+ [data-layout="grid"][data-min="lg"] { --ui-min: 20rem; }
55
+ [data-layout="grid"][data-min="xl"] { --ui-min: 24rem; }
56
+
57
+ [data-layout="sidebar"][data-side="xs"] { --ui-side: 10rem; }
58
+ [data-layout="sidebar"][data-side="sm"] { --ui-side: 12rem; }
59
+ [data-layout="sidebar"][data-side="md"] { --ui-side: 16rem; }
60
+ [data-layout="sidebar"][data-side="lg"] { --ui-side: 20rem; }
61
+ [data-layout="sidebar"][data-side="xl"] { --ui-side: 24rem; }
62
+
63
+ /* Progressive CSS Values 5 attr() support for custom CSS lengths without inline style attributes */
64
+ @supports (gap: attr(data-gap-value type(<length-percentage>))) {
65
+ [data-layout][data-gap-value] { --ui-gap: attr(data-gap-value type(<length-percentage>)); }
66
+ [data-layout="grid"][data-min-value] { --ui-min: attr(data-min-value type(<length-percentage>)); }
67
+ [data-layout="sidebar"][data-side-value] { --ui-side: attr(data-side-value type(<length-percentage>)); }
68
+ }
69
+ }
@@ -0,0 +1,21 @@
1
+ @layer kui {
2
+ [data-ui="menu"] {
3
+ display: inline-block;
4
+ }
5
+ [data-ui="menu"] [data-part="content"] {
6
+ inset: auto;
7
+ margin: 4px 0;
8
+ position-area: block-end span-inline-end;
9
+ position-try-fallbacks: flip-block, flip-inline;
10
+ min-inline-size: anchor-size(inline);
11
+ }
12
+ [data-ui="menu"] [data-part="item"] {
13
+ display: flex;
14
+ align-items: center;
15
+ justify-content: space-between;
16
+ width: 100%;
17
+ text-align: start;
18
+ cursor: pointer;
19
+ text-decoration: none;
20
+ }
21
+ }
@@ -0,0 +1,5 @@
1
+ @layer kui {
2
+ [data-ui="notice"] {
3
+ display: block;
4
+ }
5
+ }
@@ -0,0 +1,8 @@
1
+ @layer kui {
2
+ [data-ui="popover"][popover] {
3
+ inset: auto;
4
+ margin: 0;
5
+ position-area: block-end span-inline-end;
6
+ position-try-fallbacks: flip-block, flip-inline;
7
+ }
8
+ }
@@ -0,0 +1,14 @@
1
+ @layer kui {
2
+ /* Progress: the native bar; a grammar may draw the eye instead */
3
+ [data-ui="progress"] {
4
+ display: inline-flex;
5
+ align-items: center;
6
+ gap: 0.6rem;
7
+ }
8
+ [data-ui="progress"] [data-part="eye"] {
9
+ display: none;
10
+ }
11
+ [data-ui="progress"] progress {
12
+ accent-color: var(--ui-accent-fill, var(--ui-accent, currentColor));
13
+ }
14
+ }
@@ -0,0 +1,11 @@
1
+ @layer kui {
2
+ [data-ui="radio-group"] { border: 0; padding: 0; margin: 0; }
3
+ [data-ui="radio-group"] [data-part="options"] { display: flex; flex-direction: column; gap: 0.45rem; }
4
+ [data-ui="radio-group"] [data-part="option"] {
5
+ display: inline-flex;
6
+ align-items: center;
7
+ gap: var(--ui-radio-gap, 0.5rem);
8
+ min-block-size: var(--ui-touch-min, auto);
9
+ cursor: pointer;
10
+ }
11
+ }
@@ -0,0 +1,25 @@
1
+ @layer kui {
2
+ [data-ui="select"] { display: inline-block; }
3
+ [data-ui="select"] [data-part="trigger"] {
4
+ display: inline-flex;
5
+ align-items: center;
6
+ justify-content: space-between;
7
+ min-block-size: var(--ui-touch-min, auto);
8
+ cursor: pointer;
9
+ }
10
+ [data-ui="select"] [data-part="listbox"] {
11
+ inset: auto;
12
+ margin: 4px 0;
13
+ position-area: block-end span-inline-end;
14
+ position-try-fallbacks: flip-block, flip-inline;
15
+ min-inline-size: anchor-size(inline);
16
+ }
17
+ [data-ui="select"] [data-part="option"] {
18
+ display: flex;
19
+ align-items: center;
20
+ justify-content: space-between;
21
+ width: 100%;
22
+ text-align: start;
23
+ cursor: pointer;
24
+ }
25
+ }
@@ -0,0 +1,42 @@
1
+ @layer kui {
2
+ [data-ui="switch"] {
3
+ display: inline-flex;
4
+ align-items: center;
5
+ gap: var(--ui-switch-gap, 0.55rem);
6
+ min-block-size: var(--ui-touch-min, auto);
7
+ cursor: pointer;
8
+ user-select: none;
9
+ &[data-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
10
+ }
11
+ [data-ui="switch"] input[type="checkbox"] {
12
+ position: absolute;
13
+ opacity: 0;
14
+ inline-size: 1px;
15
+ block-size: 1px;
16
+ pointer-events: none;
17
+ }
18
+ [data-ui="switch"] [data-part="track"] {
19
+ position: relative;
20
+ display: inline-block;
21
+ inline-size: 2.25rem;
22
+ block-size: 1.25rem;
23
+ flex-shrink: 0;
24
+ &::after {
25
+ content: '';
26
+ position: absolute;
27
+ inset-block: 2px;
28
+ inset-inline-start: 2px;
29
+ aspect-ratio: 1;
30
+ transition: inset-inline-start 140ms ease, transform 140ms ease;
31
+ }
32
+ }
33
+ [data-ui="switch"] input:checked + [data-part="track"]::after {
34
+ inset-inline-start: calc(100% - 2px);
35
+ transform: translateX(-100%);
36
+ }
37
+ [data-ui="switch"]:has(input:focus-visible) [data-part="track"],
38
+ [data-ui="switch"] input:focus-visible + [data-part="track"] {
39
+ outline: var(--ui-switch-track-focus-w, 2px) solid var(--ui-focus-color, var(--ui-accent, currentColor));
40
+ outline-offset: 2px;
41
+ }
42
+ }
@@ -0,0 +1,4 @@
1
+ @layer kui {
2
+ [data-ui="tabs"] [data-part="list"] { display: var(--ui-tab-disp, flex); }
3
+ [data-ui="tabs"] [data-part="trigger"] { cursor: pointer; min-block-size: var(--ui-touch-min, auto); }
4
+ }
@@ -0,0 +1,28 @@
1
+ @layer kui {
2
+ [data-ui="toaster"] {
3
+ position: fixed;
4
+ inset-block-end: 1rem;
5
+ inset-inline-end: 1rem;
6
+ z-index: 60;
7
+ display: flex;
8
+ flex-direction: column;
9
+ gap: 0.5rem;
10
+ max-inline-size: min(24rem, calc(100vw - 2rem));
11
+ }
12
+ [data-ui="toast"] {
13
+ display: flex;
14
+ align-items: start;
15
+ justify-content: space-between;
16
+ gap: var(--ui-toast-gap, 0.75rem);
17
+ }
18
+ [data-ui="toast"] [data-part="description"] {
19
+ margin: 0.2rem 0 0;
20
+ }
21
+ [data-ui="toast"] [data-part="close"] {
22
+ background: transparent;
23
+ border: 0;
24
+ color: inherit;
25
+ cursor: pointer;
26
+ padding: 0 0.25rem;
27
+ }
28
+ }