@clarusjs/ui 0.2.0 → 0.3.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 (3) hide show
  1. package/README.md +3 -0
  2. package/package.json +3 -3
  3. package/src/ui.css +74 -21
package/README.md CHANGED
@@ -3,6 +3,9 @@
3
3
  Thin, accessible styles for the parts in [`@clarusjs/ui-primitives`](https://clarusjs.com/guide/ui-primitives#parts):
4
4
  one stylesheet over their `data-part` names and state attributes, light and dark.
5
5
 
6
+ For components you copy and own (cards, tables, charts, date pickers, blocks…), in plain CSS or Tailwind, see
7
+ [ui.clarusjs.com](https://ui.clarusjs.com).
8
+
6
9
  ```sh
7
10
  pnpm add @clarusjs/ui @clarusjs/ui-primitives
8
11
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clarusjs/ui",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "A styled set for @clarusjs/ui-primitives: design tokens and thin, accessible styles over the parts' data-part and state attributes, light and dark.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -17,7 +17,7 @@
17
17
  "access": "public"
18
18
  },
19
19
  "peerDependencies": {
20
- "@clarusjs/ui-primitives": "^0.2.0"
20
+ "@clarusjs/ui-primitives": "^0.3.0"
21
21
  },
22
22
  "repository": {
23
23
  "type": "git",
@@ -35,7 +35,7 @@
35
35
  "url": "https://github.com/forinda/clarusjs/issues"
36
36
  },
37
37
  "devDependencies": {
38
- "@clarusjs/ui-primitives": "^0.2.0",
38
+ "@clarusjs/ui-primitives": "^0.3.0",
39
39
  "vitest": "^5.1.1"
40
40
  },
41
41
  "scripts": {
package/src/ui.css CHANGED
@@ -7,6 +7,7 @@
7
7
  @layer theme, base, components, utilities; /* Tailwind's order, declared first: components always rank above base. */
8
8
 
9
9
  :root {
10
+ color-scheme: light; /* native controls (select popups, date pickers, scrollbars) match */
10
11
  --ui-font: system-ui, sans-serif;
11
12
  --ui-font-heading: var(--ui-font);
12
13
  --ui-font-mono: ui-monospace, monospace;
@@ -65,6 +66,7 @@
65
66
  }
66
67
  @media (prefers-color-scheme: dark) {
67
68
  :root:not([data-theme='light']) {
69
+ color-scheme: dark;
68
70
  --ui-bg: #121a1b;
69
71
  --ui-fg: #e6eded;
70
72
  --ui-muted: #9aa8a9;
@@ -102,6 +104,7 @@
102
104
  }
103
105
  }
104
106
  :root[data-theme='dark'] {
107
+ color-scheme: dark;
105
108
  --ui-bg: #121a1b;
106
109
  --ui-fg: #e6eded;
107
110
  --ui-muted: #9aa8a9;
@@ -146,6 +149,10 @@
146
149
  outline: 2px solid var(--ui-ring);
147
150
  outline-offset: 2px;
148
151
  }
152
+ /* A combobox's or chip input's box shows its focus: the input inside doesn't draw a second ring (~=: another part's name, not this one's). */
153
+ :where([data-part~='combobox'] [data-part~='input'], [data-part~='chip-input'] [data-part~='input']):focus-visible {
154
+ outline: none;
155
+ }
149
156
  /* end part */
150
157
 
151
158
  /* part: buttons */
@@ -176,8 +183,23 @@
176
183
  box-shadow: var(--ui-shadow);
177
184
  font: calc(var(--ui-font-size) + 1px)/1.5 var(--ui-font);
178
185
  }
186
+ /* The backdrop: a black scrim, dimmed by --ui-backdrop-opacity and blurred by --ui-backdrop-blur (it reads them from
187
+ its dialog). data-backdrop on the dialog picks a variant; set the knobs on :root for a site-wide default. */
179
188
  :where([data-part='dialog'])::backdrop {
180
- background: rgb(0 0 0 / 0.45);
189
+ background: rgb(0 0 0 / var(--ui-backdrop-opacity, 0.45));
190
+ backdrop-filter: blur(var(--ui-backdrop-blur, 0px));
191
+ }
192
+ :where([data-part='dialog'][data-backdrop='light']) {
193
+ --ui-backdrop-opacity: 0.2;
194
+ }
195
+ :where([data-part='dialog'][data-backdrop='dark']) {
196
+ --ui-backdrop-opacity: 0.7;
197
+ }
198
+ :where([data-part='dialog'][data-backdrop='blur']) {
199
+ --ui-backdrop-blur: 6px;
200
+ }
201
+ :where([data-part='dialog'][data-backdrop='none']) {
202
+ --ui-backdrop-opacity: 0;
181
203
  }
182
204
  :where([data-part='title']) {
183
205
  margin: 0 0 var(--ui-space-2);
@@ -563,26 +585,8 @@
563
585
  }
564
586
  /* end part */
565
587
 
566
- /* part: combobox */
567
- /* Combobox: chips in the control, a list below. */
568
- :where([data-part='combobox']) {
569
- display: grid;
570
- gap: var(--ui-space-1);
571
- max-width: 360px;
572
- font: var(--ui-font-size) var(--ui-font);
573
- color: var(--ui-fg);
574
- }
575
- :where([data-part='combobox']) > :where([data-part='control']) {
576
- display: flex;
577
- flex-wrap: wrap;
578
- align-items: center;
579
- gap: var(--ui-space-1);
580
- padding: calc(var(--ui-space) * 0.5) calc(var(--ui-space) * 1.5);
581
- }
582
- :where([data-part='combobox']) > :where([data-part='control']):focus-within {
583
- border-color: var(--ui-ring);
584
- box-shadow: 0 0 0 3px var(--ui-accent-soft);
585
- }
588
+ /* part: chips */
589
+ /* Chips in a control, beside the field you type in (combobox, chip input). */
586
590
  :where([data-part='input']) {
587
591
  flex: 1;
588
592
  min-width: 6ch;
@@ -612,6 +616,28 @@
612
616
  color: var(--ui-muted);
613
617
  cursor: pointer;
614
618
  }
619
+ /* end part */
620
+
621
+ /* part: combobox */
622
+ /* Combobox: chips in the control, a list below. */
623
+ :where([data-part='combobox']) {
624
+ display: grid;
625
+ gap: var(--ui-space-1);
626
+ max-width: 360px;
627
+ font: var(--ui-font-size) var(--ui-font);
628
+ color: var(--ui-fg);
629
+ }
630
+ :where([data-part='combobox']) > :where([data-part='control']) {
631
+ display: flex;
632
+ flex-wrap: wrap;
633
+ align-items: center;
634
+ gap: var(--ui-space-1);
635
+ padding: calc(var(--ui-space) * 0.5) calc(var(--ui-space) * 1.5);
636
+ }
637
+ :where([data-part='combobox']) > :where([data-part='control']):focus-within {
638
+ border-color: var(--ui-ring);
639
+ box-shadow: 0 0 0 3px var(--ui-accent-soft);
640
+ }
615
641
  :where([data-part='listbox']) {
616
642
  margin-top: var(--ui-space-1);
617
643
  padding: var(--ui-space-1);
@@ -654,6 +680,33 @@
654
680
  }
655
681
  /* end part */
656
682
 
683
+ /* part: chip-input */
684
+ /* Chip input: what's typed becomes a chip in the control; a hint below. */
685
+ :where([data-part='chip-input']) {
686
+ display: grid;
687
+ gap: var(--ui-space-1);
688
+ max-width: 360px;
689
+ font: var(--ui-font-size) var(--ui-font);
690
+ color: var(--ui-fg);
691
+ }
692
+ :where([data-part='chip-input']) > :where([data-part='control']) {
693
+ display: flex;
694
+ flex-wrap: wrap;
695
+ align-items: center;
696
+ gap: var(--ui-space-1);
697
+ padding: calc(var(--ui-space) * 0.5) calc(var(--ui-space) * 1.5);
698
+ }
699
+ :where([data-part='chip-input']) > :where([data-part='control']):focus-within {
700
+ border-color: var(--ui-ring);
701
+ box-shadow: 0 0 0 3px var(--ui-accent-soft);
702
+ }
703
+ :where([data-part='hint']) {
704
+ margin: 0;
705
+ color: var(--ui-muted);
706
+ font-size: calc(var(--ui-font-size) - 1px);
707
+ }
708
+ /* end part */
709
+
657
710
  /* part: sidebar */
658
711
  /* Sidebar: inline beside the page on wide screens (hidden when collapsed: its data-state, or data-sidebar on <html>
659
712
  from the remembered choice); on phones a popover panel from the left. */