@carissa-io/theme-default 0.3.11 → 0.3.13

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/DESIGN.md CHANGED
@@ -126,10 +126,11 @@ From [components-checkbox](components/components-checkbox): the whole row (box a
126
126
  least 44px tall. The label is body text (1rem, `#171717`), not the uppercase field-label style.
127
127
  - **Box:** 20px square, square corners, 1px `#666666` border; the border turns black on hover.
128
128
  - **Checked:** black background with a white Lucide `check` mark.
129
+ - **Indeterminate (mixed):** the checked box (`--c-primary` fill and border) with a 10px by 2px square dash in `--c-on-primary` instead of the check, drawn with CSS, so it follows the mode: 21.00:1 in both modes for the dash on the box (above the 4.5:1 text figure), and the box border on the background is 21.00:1 light, 19.80:1 dark (3:1 minimum). It sits after "checked" and before invalid, disabled and focus, so an invalid box keeps its red border, a disabled one turns `--c-disabled-text` on `--c-surface` (the dash follows, exempt from contrast) and the keyboard focus is the filled-box ring below (1px `--c-focus`, offset 2px). Hover only changes the border, which is already `--c-primary`. A test asserts the dash contrast in both modes.
129
130
  - **Disabled:** `#a3a3a3` label and mark on a `#f5f5f5` box with a `#d4d4d4` border; no hover.
130
131
  - **Error:** `#dc3545`, 13px, under the row; the box border turns red too. The built-in error shows after the first
131
132
  interaction, an error passed by the parent shows at once.
132
- - **Focus:** keyboard focus (`:focus-visible`): an empty box thickens its border to 2px; a checked (black) box draws a 1px
133
+ - **Focus:** keyboard focus (`:focus-visible`): an empty box thickens its border to 2px; a checked or indeterminate (black) box draws a 1px
133
134
  black ring offset by 2px.
134
135
 
135
136
  ## Switch
@@ -427,11 +428,23 @@ From [components-faq](components/components-faq): `Faq`. It is the Accordion (th
427
428
  ## Carousel
428
429
  From [components-carousel](components/components-carousel): `Carousel`. The arrows and the pause / play button are the secondary button's: square, 2.75rem, a 1px `--c-muted` border (5.74:1 / 7.85:1 on the background), a `--c-surface-active` hover and a `--c-text` glyph (17.93:1 / 18.16:1; 14.23:1 / 13.88:1 on the hover). The glyphs (corner, bars, triangle) are drawn with borders in `currentColor`, so they follow the mode and need no new colour. Disabled arrows are at half opacity (exempt). The dots are 0.625rem circles in `--c-muted` (5.74:1 / 7.85:1 on the background, 5.27:1 / 7.11:1 on `--c-surface`, above the 3:1 minimum for graphics) and the current one is `--c-primary` (21:1 / 19.8:1) and 1.5rem long. Colour is not the only cue: the current dot is a bar against circles, and it also carries `aria-current`; the lightness gap between the two colours is 3.66:1 in light and 2.52:1 in dark (below 3:1 there, which the shape makes up for). The keyboard ring is the theme's 1px `--c-focus` outline offset by 2px (21:1 / 19.8:1). Transitions run at 0.2s and stop under `prefers-reduced-motion`.
429
430
 
431
+ ## Visually hidden
432
+ From [components-visually-hidden](components/components-visually-hidden): `VisuallyHidden`. The hidden state is the clip pattern and has no look. The revealed state (`focusable`, a skip link) is `--c-text` on `--c-background` (17.93:1 / 18.16:1) with a 0.75rem 1rem padding at the top-left corner; it is only shown while it has keyboard focus, so the browser's focus indicator still marks it and the pair stays well above 4.5:1 in both modes. No new colour.
433
+
434
+ ## Live region
435
+ From [components-live-region](components/components-live-region): `LiveRegion`. Hidden regions have no look (they are announced, not seen). The visible variant is a square box: `--c-text` on `--c-surface` (16.44:1 / 16.44:1) with a 1px `--c-muted` border (5.27:1 / 7.11:1 on the surface, above the 3:1 non-text minimum), 0.75rem 1rem padding; an empty region takes no space.
436
+
437
+ ## Theme switch
438
+ From [components-theme-switch](components/components-theme-switch): `ThemeSwitch`. A segmented control built like the stepper and tabs: square, a 1px `--c-muted` border (5.74:1 / 7.85:1 on the background) and 2.75rem options with 1.25rem icons (`currentColor`, so `--c-text` at 17.93:1 / 18.16:1 on the background). The current option is filled `--c-primary` with an `--c-on-primary` icon (21:1 / 21:1) and a 2px `--c-on-primary` underline, so it is told apart by shape as well as by colour; it also carries `aria-checked`. Hover is a `--c-surface-active` fill (`--c-text` 14.23:1 / 13.88:1). The keyboard ring is the theme's 1px `--c-focus` outline offset by 2px (21:1 / 19.8:1 on the background). The text labels stay visually hidden (the icons are the visible cue). The `cycle` variant is one bordered button of the same height showing the current mode icon (`--c-text` on `--c-background`, same hover and ring).
439
+
440
+ ## Icon
441
+ From [components-icon](components/components-icon): `Icon`. No colour of its own: the stroke is `currentColor`, so an icon has the contrast of the text it sits in (17.93:1 / 18.16:1 for `--c-text`, 5.74:1 / 7.85:1 for `--c-muted`, both above the 3:1 non-text minimum). Sizes are pinned in rem (1, 1.25, 1.5 and 2rem) so they do not drift with the font size around them. A decorative icon is `aria-hidden`; a lone one needs a `label`.
442
+
430
443
  ## Keyboard focus (all controls)
431
444
  One rule keeps the controls coherent: **an outlined control thickens its own border from 1px to 2px, black** (text fields,
432
445
  select, combobox, date picker, textarea, upload, empty checkbox, off switch, radio, secondary and ghost buttons); **a filled
433
446
  (black) control draws a separate 1px black ring offset by 2px**, because a thicker border would be invisible on a black fill
434
- (primary button, checked checkbox, on switch, slider thumb). Calendar days and the upload remove button use an inset 1px ring.
447
+ (primary button, checked or indeterminate checkbox, on switch, slider thumb). Calendar days and the upload remove button use an inset 1px ring.
435
448
 
436
449
  ## Guidelines
437
450
  - **Accessibility:** 4.5:1 contrast for body text; interactive elements are at least 44px tall.
package/README.md CHANGED
@@ -142,9 +142,11 @@ it: check the names against the theme's `scss/_tokens.scss` before you switch.
142
142
 
143
143
  ## What it configures
144
144
  `components-input`, `-button`, `-checkbox`, `-switch`, `-radio-group`, `-slider`, `-popover`, `-listbox`, `-select`,
145
- `-combobox`, `-upload`, `-calendar`, `-date-picker`, `-search`, `-typography`, `-card`, `-alert`, `-spinner`, `-modal`, `-toast`, `-divider`, `-badge`, `-tag`, `-link`, `-avatar`, `-skeleton`, `-progress`, `-tooltip`, `-prose`, `-tabs`, `-accordion`, `-breadcrumb`, `-pagination`, `-stepper`, `-sidebar`, `-navbar`, `-drawer`, `-menu`, `-table`, `-list`, `-description-list`, `-stat`, `-empty-state`, `-timeline`, `-tree`, `-code`, `-field`, `-number-input`, `-otp-input`, `-phone`, `-tag-input`, `-time-picker`, `-date-range`, `-rating`, `-color-picker`, `-async-autocomplete`, `-section`, `-faq` and `-carousel`. `components-email`, `-password`, `-url` and `-textarea`
145
+ `-combobox`, `-upload`, `-calendar`, `-date-picker`, `-search`, `-typography`, `-card`, `-alert`, `-spinner`, `-modal`, `-toast`, `-divider`, `-badge`, `-tag`, `-link`, `-avatar`, `-skeleton`, `-progress`, `-tooltip`, `-prose`, `-tabs`, `-accordion`, `-breadcrumb`, `-pagination`, `-stepper`, `-sidebar`, `-navbar`, `-drawer`, `-menu`, `-table`, `-list`, `-description-list`, `-stat`, `-empty-state`, `-timeline`, `-tree`, `-code`, `-field`, `-number-input`, `-otp-input`, `-phone`, `-tag-input`, `-time-picker`, `-date-range`, `-rating`, `-color-picker`, `-async-autocomplete`, `-section`, `-faq`, `-carousel`, `-visually-hidden`, `-live-region`, `-theme-switch` and `-icon`. `components-email`, `-password`, `-url` and `-textarea`
146
146
  are styled through the input.
147
147
 
148
+ The checkbox's mixed state (`indeterminate`, from the next `components-checkbox` release, class `c-checkbox--indeterminate`) is the checked box with a 10px dash in `--c-on-primary`; on an older checkbox the rule is simply unused.
149
+
148
150
  ## Change a value
149
151
  The palette and the values shared by every component (fonts, radius, minimum height, focus ring, transition, label style, dropdown
150
152
  arrow) are the Sass variables of `scss/_tokens.scss` (the [tokens](#tokens)); each component has one `@use ... with (...)` block of overrides
package/dist/index.css CHANGED
@@ -364,6 +364,8 @@
364
364
  }
365
365
  .c-checkbox__mark {
366
366
  display: inline-flex;
367
+ align-items: center;
368
+ justify-content: center;
367
369
  width: 1rem;
368
370
  height: 1rem;
369
371
  opacity: 0;
@@ -373,6 +375,13 @@
373
375
  width: 100%;
374
376
  height: 100%;
375
377
  }
378
+ .c-checkbox__dash {
379
+ display: block;
380
+ width: 0.625rem;
381
+ height: 2px;
382
+ background: currentcolor;
383
+ border-radius: 0;
384
+ }
376
385
  .c-checkbox__label {
377
386
  min-width: 0;
378
387
  }
@@ -391,6 +400,14 @@
391
400
  .c-checkbox__control:checked + .c-checkbox__box .c-checkbox__mark {
392
401
  opacity: 1;
393
402
  }
403
+ .c-checkbox--indeterminate .c-checkbox__control + .c-checkbox__box {
404
+ color: var(--c-on-primary);
405
+ background: var(--c-primary);
406
+ border-color: var(--c-primary);
407
+ }
408
+ .c-checkbox--indeterminate .c-checkbox__control + .c-checkbox__box .c-checkbox__mark {
409
+ opacity: 1;
410
+ }
394
411
  .c-checkbox--invalid .c-checkbox__control + .c-checkbox__box {
395
412
  border-color: var(--c-error);
396
413
  }
@@ -409,7 +426,7 @@
409
426
  border-color: var(--c-focus);
410
427
  box-shadow: inset 0 0 0 1px var(--c-focus);
411
428
  }
412
- .c-checkbox__control:checked:focus-visible + .c-checkbox__box {
429
+ .c-checkbox__control:checked:focus-visible + .c-checkbox__box, .c-checkbox--indeterminate .c-checkbox__control:focus-visible + .c-checkbox__box {
413
430
  outline: 1px solid var(--c-focus);
414
431
  outline-offset: 2px;
415
432
  box-shadow: none;
@@ -5265,3 +5282,157 @@ ol.c-list {
5265
5282
  transition: none;
5266
5283
  }
5267
5284
  }
5285
+ .c-visually-hidden {
5286
+ position: absolute;
5287
+ width: 1px;
5288
+ height: 1px;
5289
+ padding: 0;
5290
+ margin: -1px;
5291
+ overflow: hidden;
5292
+ white-space: nowrap;
5293
+ border: 0;
5294
+ clip-path: inset(50%);
5295
+ }
5296
+
5297
+ .c-visually-hidden--focusable:focus,
5298
+ .c-visually-hidden--focusable:focus-within {
5299
+ position: fixed;
5300
+ top: 0.5rem;
5301
+ left: 0.5rem;
5302
+ z-index: 1000;
5303
+ width: auto;
5304
+ height: auto;
5305
+ padding: 0.75rem 1rem;
5306
+ margin: 0;
5307
+ overflow: visible;
5308
+ color: var(--c-text);
5309
+ white-space: normal;
5310
+ background: var(--c-background);
5311
+ clip-path: none;
5312
+ }
5313
+
5314
+ .c-live-region--hidden {
5315
+ position: absolute;
5316
+ width: 1px;
5317
+ height: 1px;
5318
+ padding: 0;
5319
+ margin: -1px;
5320
+ overflow: hidden;
5321
+ white-space: nowrap;
5322
+ border: 0;
5323
+ clip-path: inset(50%);
5324
+ }
5325
+
5326
+ .c-live-region:not(.c-live-region--hidden) {
5327
+ padding: 0.75rem 1rem;
5328
+ color: var(--c-text);
5329
+ background: var(--c-surface);
5330
+ border: 1px solid var(--c-muted);
5331
+ border-radius: 0;
5332
+ }
5333
+ .c-live-region:not(.c-live-region--hidden):empty {
5334
+ display: none;
5335
+ }
5336
+
5337
+ .c-theme-switch {
5338
+ box-sizing: border-box;
5339
+ display: inline-flex;
5340
+ align-items: center;
5341
+ gap: 0;
5342
+ padding: 0;
5343
+ color: var(--c-text);
5344
+ vertical-align: middle;
5345
+ background: var(--c-background);
5346
+ border: 1px solid var(--c-muted);
5347
+ border-radius: 0;
5348
+ }
5349
+
5350
+ .c-theme-switch__option,
5351
+ button.c-theme-switch {
5352
+ font: inherit;
5353
+ color: inherit;
5354
+ cursor: pointer;
5355
+ background: transparent;
5356
+ border: 0;
5357
+ transition: background-color 0.2s;
5358
+ }
5359
+ @media (prefers-reduced-motion: reduce) {
5360
+ .c-theme-switch__option,
5361
+ button.c-theme-switch {
5362
+ transition: none;
5363
+ }
5364
+ }
5365
+ .c-theme-switch__option:hover,
5366
+ button.c-theme-switch:hover {
5367
+ background: var(--c-surface-active);
5368
+ }
5369
+ .c-theme-switch__option:focus-visible,
5370
+ button.c-theme-switch:focus-visible {
5371
+ outline: 1px solid var(--c-focus);
5372
+ outline-offset: 2px;
5373
+ }
5374
+
5375
+ .c-theme-switch__option {
5376
+ display: inline-flex;
5377
+ align-items: center;
5378
+ gap: 0.5rem;
5379
+ padding: 0.75rem 0.875rem;
5380
+ border-radius: 0;
5381
+ }
5382
+
5383
+ .c-theme-switch__option--current,
5384
+ .c-theme-switch__option--current:hover {
5385
+ color: var(--c-on-primary);
5386
+ background: var(--c-primary);
5387
+ box-shadow: inset 0 -2px 0 var(--c-on-primary);
5388
+ }
5389
+
5390
+ .c-theme-switch--cycle {
5391
+ padding: 0.75rem 0.875rem;
5392
+ }
5393
+
5394
+ .c-theme-switch__icon {
5395
+ display: inline-flex;
5396
+ flex: none;
5397
+ width: 1.25rem;
5398
+ height: 1.25rem;
5399
+ }
5400
+
5401
+ .c-theme-switch__label {
5402
+ position: absolute;
5403
+ width: 1px;
5404
+ height: 1px;
5405
+ padding: 0;
5406
+ margin: -1px;
5407
+ overflow: hidden;
5408
+ white-space: nowrap;
5409
+ border: 0;
5410
+ clip-path: inset(50%);
5411
+ }
5412
+
5413
+ .c-icon {
5414
+ flex-shrink: 0;
5415
+ width: 1.25rem;
5416
+ height: 1.25rem;
5417
+ vertical-align: -0.2em;
5418
+ }
5419
+
5420
+ .c-icon--sm {
5421
+ width: 1rem;
5422
+ height: 1rem;
5423
+ }
5424
+
5425
+ .c-icon--md {
5426
+ width: 1.25rem;
5427
+ height: 1.25rem;
5428
+ }
5429
+
5430
+ .c-icon--lg {
5431
+ width: 1.5rem;
5432
+ height: 1.5rem;
5433
+ }
5434
+
5435
+ .c-icon--xl {
5436
+ width: 2rem;
5437
+ height: 2rem;
5438
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carissa-io/theme-default",
3
- "version": "0.3.11",
3
+ "version": "0.3.13",
4
4
  "description": "Carissa UI: the default theme (Swiss minimalism) as SCSS variable overrides of the Carissa components, with a compiled CSS build",
5
5
  "type": "module",
6
6
  "style": "dist/index.css",
@@ -96,7 +96,11 @@
96
96
  "@carissa-io/components-async-autocomplete": "^0.1.0",
97
97
  "@carissa-io/components-section": "^0.1.0",
98
98
  "@carissa-io/components-faq": "^0.1.0",
99
- "@carissa-io/components-carousel": "^0.1.0"
99
+ "@carissa-io/components-carousel": "^0.1.0",
100
+ "@carissa-io/components-visually-hidden": "^0.1.0",
101
+ "@carissa-io/components-live-region": "^0.1.0",
102
+ "@carissa-io/components-theme-switch": "^0.1.0",
103
+ "@carissa-io/components-icon": "^0.1.0"
100
104
  },
101
105
  "peerDependenciesMeta": {
102
106
  "@carissa-io/components-input": {
@@ -287,6 +291,18 @@
287
291
  },
288
292
  "@carissa-io/components-carousel": {
289
293
  "optional": true
294
+ },
295
+ "@carissa-io/components-visually-hidden": {
296
+ "optional": true
297
+ },
298
+ "@carissa-io/components-live-region": {
299
+ "optional": true
300
+ },
301
+ "@carissa-io/components-theme-switch": {
302
+ "optional": true
303
+ },
304
+ "@carissa-io/components-icon": {
305
+ "optional": true
290
306
  }
291
307
  },
292
308
  "devDependencies": {
@@ -312,10 +328,12 @@
312
328
  "@carissa-io/components-empty-state": "^0.1.0",
313
329
  "@carissa-io/components-faq": "^0.1.0",
314
330
  "@carissa-io/components-field": "^0.1.0",
331
+ "@carissa-io/components-icon": "^0.1.0",
315
332
  "@carissa-io/components-input": "^0.2.1",
316
333
  "@carissa-io/components-link": "^0.1.0",
317
334
  "@carissa-io/components-list": "^0.1.0",
318
335
  "@carissa-io/components-listbox": "^0.1.1",
336
+ "@carissa-io/components-live-region": "^0.1.0",
319
337
  "@carissa-io/components-menu": "^0.1.0",
320
338
  "@carissa-io/components-modal": "^0.1.0",
321
339
  "@carissa-io/components-navbar": "^0.1.0",
@@ -342,6 +360,7 @@
342
360
  "@carissa-io/components-tabs": "^0.1.0",
343
361
  "@carissa-io/components-tag": "^0.1.0",
344
362
  "@carissa-io/components-tag-input": "^0.1.0",
363
+ "@carissa-io/components-theme-switch": "^0.1.0",
345
364
  "@carissa-io/components-time-picker": "^0.1.0",
346
365
  "@carissa-io/components-timeline": "^0.1.0",
347
366
  "@carissa-io/components-toast": "^0.1.0",
@@ -349,6 +368,7 @@
349
368
  "@carissa-io/components-tree": "^0.1.0",
350
369
  "@carissa-io/components-typography": "^0.1.0",
351
370
  "@carissa-io/components-upload": "^0.1.1",
371
+ "@carissa-io/components-visually-hidden": "^0.1.0",
352
372
  "sass-embedded": "^1.105.1",
353
373
  "vitest": "^4.1.11"
354
374
  },
package/scss/index.scss CHANGED
@@ -138,6 +138,14 @@
138
138
  $c-checkbox-mark-color: $var-on-primary,
139
139
  $c-checkbox-mark-size: 1rem,
140
140
 
141
+ // Indeterminate: the checked box, with a 10px by 2px dash in the mark colour
142
+ $c-checkbox-indeterminate-background: $var-primary,
143
+ $c-checkbox-indeterminate-border-color: $var-primary,
144
+ $c-checkbox-indeterminate-mark-color: $var-on-primary,
145
+ $c-checkbox-indeterminate-mark-width: 0.625rem,
146
+ $c-checkbox-indeterminate-mark-thickness: 2px,
147
+ $c-checkbox-indeterminate-mark-radius: 0,
148
+
141
149
  // Disabled: #a3a3a3 on #f5f5f5
142
150
  $c-checkbox-disabled-color: $var-disabled-text,
143
151
  $c-checkbox-disabled-background: $var-surface,
@@ -1652,3 +1660,59 @@
1652
1660
  $c-carousel-focus-outline: $focus-width solid $var-focus,
1653
1661
  $c-carousel-focus-outline-offset: 2px
1654
1662
  );
1663
+
1664
+ // Visually hidden: the hidden state is the clip pattern and has no look. The revealed (focusable) state, a skip link, is
1665
+ // --c-text on --c-background (17.93:1 / 18.16:1) with comfortable padding; the browser's focus ring still marks it. No
1666
+ // component stylesheet is forwarded here, so the order does not matter.
1667
+ @use '@carissa-io/components-visually-hidden/scss' as visually-hidden with (
1668
+ $c-visually-hidden-focus-top: 0.5rem,
1669
+ $c-visually-hidden-focus-left: 0.5rem,
1670
+ $c-visually-hidden-focus-padding: 0.75rem 1rem,
1671
+ $c-visually-hidden-focus-background: $var-background,
1672
+ $c-visually-hidden-focus-color: $var-text
1673
+ );
1674
+
1675
+ // Live region: only the visible variant has a look, a square box like the theme's alerts and cards: --c-text on
1676
+ // --c-surface (16.44:1 / 16.44:1) with a 1px --c-muted border (5.27:1 / 7.11:1 on the surface, above the 3:1 minimum). An empty
1677
+ // region takes no space (the component hides it).
1678
+ @use '@carissa-io/components-live-region/scss' as live-region with (
1679
+ $c-live-region-visible-padding: 0.75rem 1rem,
1680
+ $c-live-region-visible-radius: $radius,
1681
+ $c-live-region-visible-color: $var-text,
1682
+ $c-live-region-visible-background: $var-surface,
1683
+ $c-live-region-visible-border: 1px solid $var-muted
1684
+ );
1685
+
1686
+ // Theme switch: a segmented control like the stepper and tabs: a square box with a 1px --c-muted border (5.74:1 / 7.85:1 on the
1687
+ // background) and 2.75rem options. The current option is filled --c-primary with --c-on-primary (21:1 / 21:1) and a 2px
1688
+ // --c-on-primary underline, so it is told apart by shape as well as by colour. Hover is --c-surface-active (--c-text 14.23:1 /
1689
+ // 13.88:1) and the keyboard ring is the theme's 1px --c-focus outline offset by 2px (21:1 / 19.8:1). The labels stay visually hidden.
1690
+ @use '@carissa-io/components-theme-switch/scss' as theme-switch with (
1691
+ $c-theme-switch-gap: 0,
1692
+ $c-theme-switch-padding: 0,
1693
+ $c-theme-switch-radius: $radius,
1694
+ $c-theme-switch-option-radius: $radius,
1695
+ $c-theme-switch-icon-size: 1.25rem,
1696
+ $c-theme-switch-option-padding: 0.75rem 0.875rem,
1697
+ $c-theme-switch-option-gap: 0.5rem,
1698
+ $c-theme-switch-show-label: false,
1699
+ $c-theme-switch-color: $var-text,
1700
+ $c-theme-switch-background: $var-background,
1701
+ $c-theme-switch-border: 1px solid $var-muted,
1702
+ $c-theme-switch-hover-background: $var-surface-active,
1703
+ $c-theme-switch-current-color: $var-on-primary,
1704
+ $c-theme-switch-current-background: $var-primary,
1705
+ $c-theme-switch-current-marker: inset 0 -2px 0 $var-on-primary,
1706
+ $c-theme-switch-focus-outline: $focus-width solid $var-focus,
1707
+ $c-theme-switch-focus-offset: 2px,
1708
+ $c-theme-switch-transition: $transition-duration
1709
+ );
1710
+
1711
+ // Icon: pinned sizes (1, 1.25, 1.5 and 2rem) so a glyph does not change with the font size around it; the colour is the
1712
+ // text colour of the parent (currentColor), so it follows both modes with no colour of its own.
1713
+ @use '@carissa-io/components-icon/scss' as icon with (
1714
+ $c-icon-size-sm: 1rem,
1715
+ $c-icon-size-md: 1.25rem,
1716
+ $c-icon-size-lg: 1.5rem,
1717
+ $c-icon-size-xl: 2rem
1718
+ );