@vokality/design-system 1.2.3 → 2.0.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 (37) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +6 -0
  3. package/dist/components/Badge/Badge.d.ts +6 -4
  4. package/dist/components/Badge/Badge.js +6 -4
  5. package/dist/components/Button/Button.d.ts +2 -1
  6. package/dist/components/Field/Field.js +2 -2
  7. package/dist/components/Fieldset/Fieldset.d.ts +11 -0
  8. package/dist/components/Fieldset/Fieldset.js +12 -0
  9. package/dist/components/Grid/Grid.d.ts +866 -4
  10. package/dist/components/Grid/Grid.js +3 -4
  11. package/dist/components/Inline/Inline.d.ts +866 -4
  12. package/dist/components/Inline/Inline.js +3 -4
  13. package/dist/components/Stack/Stack.d.ts +866 -4
  14. package/dist/components/Stack/Stack.js +3 -4
  15. package/dist/components/Text/Text.d.ts +15 -4
  16. package/dist/components/Text/Text.js +3 -4
  17. package/dist/components.css +166 -19
  18. package/dist/index.d.ts +2 -0
  19. package/dist/index.js +1 -0
  20. package/dist/internal/describedBy.d.ts +3 -0
  21. package/dist/internal/describedBy.js +4 -0
  22. package/dist/tokens.css +2 -0
  23. package/dist/tokens.dtcg.json +10 -0
  24. package/dist/tokens.json +10 -0
  25. package/dist/types.d.ts +6 -1
  26. package/dist/vokality.css +168 -19
  27. package/dist/vokality.iife.js +945 -912
  28. package/docs/brand.md +3 -1
  29. package/docs/components/Badge/README.md +2 -0
  30. package/docs/components/Button/README.md +7 -3
  31. package/docs/components/Fieldset/README.md +25 -0
  32. package/docs/components/Grid/README.md +2 -0
  33. package/docs/components/Inline/README.md +2 -0
  34. package/docs/components/PageHeader/README.md +2 -0
  35. package/docs/components/Stack/README.md +2 -0
  36. package/docs/components/Text/README.md +4 -0
  37. package/package.json +1 -1
@@ -1,8 +1,7 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { createElement } from "react";
2
2
  import { cx } from "../../lib/cx.js";
3
3
  import { space } from "../../lib/space.js";
4
4
  /** Lays children out vertically with one gap from the spacing scale. */
5
- export function Stack({ as, gap, align, children, className, style }) {
6
- const Tag = as || "div";
7
- return _jsx(Tag, { className: cx("vk-layout-stack", className), style: { gap: space(gap, "md"), alignItems: align, ...style }, children: children });
5
+ export function Stack({ as, gap, align, children, className, style, ...rest }) {
6
+ return createElement(as || "div", { className: cx("vk-layout-stack", className), style: { gap: space(gap, "md"), alignItems: align, ...style }, ...rest }, children);
8
7
  }
@@ -1,10 +1,21 @@
1
- import type { ReactNode } from "react";
2
- import type { AsProp } from "../../types.js";
3
- export interface TextProps extends AsProp {
1
+ import { type ReactNode } from "react";
2
+ import type { ElementTag, PolymorphicProps } from "../../types.js";
3
+ export interface TextOwnProps {
4
4
  size?: string;
5
5
  tone?: "muted" | "subtle" | "primary" | "danger" | "success";
6
6
  children?: ReactNode;
7
7
  className?: string;
8
+ /** Space Grotesk with tabular figures for numbers, codes and identifiers. */
9
+ numeric?: boolean;
10
+ /** Allow long identifiers to wrap without widening their container. */
11
+ overflowWrap?: "normal" | "anywhere";
12
+ /** Keep one line and show an ellipsis when the available width is exhausted. */
13
+ truncate?: boolean;
14
+ /** Emphasis independent of the selected type size. */
15
+ weight?: "regular" | "medium" | "semibold" | "bold";
8
16
  }
17
+ export type TextProps<T extends ElementTag = "p"> = PolymorphicProps<T, TextOwnProps>;
9
18
  /** Running text in one of the system's text styles and tones. */
10
- export declare function Text({ as, size, tone, children, className }: TextProps): import("react/jsx-runtime").JSX.Element;
19
+ export declare function Text<T extends ElementTag = "p">({ as, size, tone, numeric, overflowWrap, truncate, weight, children, className, ...rest }: TextProps<T>): import("react").ReactElement<{
20
+ className: string;
21
+ } & Omit<TextProps<T>, "as" | "children" | "className" | "numeric" | "overflowWrap" | "size" | "tone" | "truncate" | "weight">, string | import("react").JSXElementConstructor<any>>;
@@ -1,7 +1,6 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { createElement } from "react";
2
2
  import { cx } from "../../lib/cx.js";
3
3
  /** Running text in one of the system's text styles and tones. */
4
- export function Text({ as, size, tone, children, className }) {
5
- const Tag = as || "p";
6
- return _jsx(Tag, { className: cx("vk-text", "vk-text-" + (size || "body"), tone && "vk-tone-" + tone, className), children: children });
4
+ export function Text({ as, size, tone, numeric, overflowWrap, truncate, weight, children, className, ...rest }) {
5
+ return createElement(as || "p", { className: cx("vk-text", "vk-text-" + (size || "body"), tone && "vk-tone-" + tone, numeric && "vk-text-numeric", overflowWrap === "anywhere" && "vk-text-wrap-anywhere", truncate && "vk-text-truncate", weight && "vk-weight-" + weight, className), ...rest }, children);
7
6
  }
@@ -41,7 +41,7 @@ body {
41
41
  gap: 0;
42
42
  box-sizing: border-box;
43
43
  max-width: 100%;
44
- min-height: 40px;
44
+ min-height: var(--button-height, 40px);
45
45
  padding: 0;
46
46
  font: inherit;
47
47
  font-family: var(--font-sans);
@@ -80,7 +80,7 @@ body {
80
80
  }
81
81
  .vk-btn-ghost:hover { background: var(--primary-tint); }
82
82
  .vk-btn-outline:disabled, .vk-btn-ghost:disabled { cursor: not-allowed; opacity: 0.5; }
83
- .vk-btn-sm { min-height: 32px; font-size: 0.6875rem; }
83
+ .vk-btn-sm { min-height: var(--button-height-sm, 32px); font-size: 0.6875rem; }
84
84
  .vk-btn-sm .vk-btn-label { padding: 0.4rem 0.75rem 0.4rem 0.85rem; }
85
85
  .vk-btn-sm .vk-btn-label:only-child { padding-right: 0.85rem; }
86
86
  .vk-btn-sm .vk-btn-glyph { width: 1.85rem; }
@@ -100,6 +100,24 @@ body {
100
100
  .vk-btn { width: 100%; justify-content: space-between; }
101
101
  }
102
102
 
103
+ /* A named record can be an action without adopting an uppercase action label. */
104
+ .vk-btn-text {
105
+ width: auto;
106
+ min-height: var(--button-height-sm);
107
+ justify-content: flex-start;
108
+ font-size: var(--text-sm);
109
+ font-weight: 500;
110
+ letter-spacing: normal;
111
+ text-transform: none;
112
+ text-align: left;
113
+ color: var(--foreground);
114
+ background: transparent;
115
+ border: 1px solid transparent;
116
+ }
117
+ .vk-btn-text .vk-btn-label, .vk-btn-text .vk-btn-label:only-child { padding: var(--space-xs) 0; }
118
+ .vk-btn-text:hover { color: var(--primary); text-decoration: underline; text-underline-offset: var(--space-xs); }
119
+ .vk-btn-text:disabled { cursor: not-allowed; opacity: 0.5; }
120
+
103
121
  /* Square glyph */
104
122
  @keyframes vk-glyph-blink {
105
123
  0%, 72%, 100% { opacity: 1; filter: brightness(1); }
@@ -344,6 +362,10 @@ body {
344
362
  color: var(--primary);
345
363
  }
346
364
 
365
+ .vk-badge-icon { gap: var(--space-xs); }
366
+ .vk-badge[tabindex]:not([tabindex="-1"]) { box-sizing: border-box; min-height: var(--button-height-sm); }
367
+ .vk-badge:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
368
+
347
369
  /* Quote */
348
370
  .vk-quote {
349
371
  position: relative;
@@ -468,8 +490,8 @@ body {
468
490
  align-items: center;
469
491
  justify-content: center;
470
492
  box-sizing: border-box;
471
- width: 40px;
472
- height: 40px;
493
+ width: var(--button-height, 40px);
494
+ height: var(--button-height, 40px);
473
495
  padding: 0;
474
496
  color: var(--foreground);
475
497
  background: transparent;
@@ -520,9 +542,11 @@ input.vk-input:read-only, textarea.vk-input:read-only { background: transparent;
520
542
  box-sizing: border-box;
521
543
  width: 100%;
522
544
  min-height: var(--control-height, 44px);
523
- padding: 0.6rem 0.75rem;
545
+ padding: var(--control-padding-block, 0.6rem) 0.75rem;
524
546
  font: inherit;
525
- font-size: var(--text-base);
547
+ font-size: var(--control-font-size, 1rem);
548
+ /* One line fits inside --control-height; the inherited body line-height would make fields taller than the token. */
549
+ line-height: 1.25;
526
550
  color: var(--foreground);
527
551
  background: var(--card);
528
552
  border: 1px solid var(--input-border);
@@ -531,7 +555,7 @@ input.vk-input:read-only, textarea.vk-input:read-only { background: transparent;
531
555
  .vk-input::placeholder { color: var(--muted-subtle); }
532
556
  .vk-input:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; border-color: var(--primary); }
533
557
  .vk-input[aria-invalid="true"] { border-color: var(--primary); }
534
- textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-height: 1.6; }
558
+ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; padding-block: 0.6rem; line-height: 1.6; }
535
559
  .vk-select { position: relative; display: grid; min-width: 0; }
536
560
  .vk-select-trigger {
537
561
  display: flex;
@@ -547,7 +571,7 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
547
571
  .vk-select-placeholder { color: var(--muted-subtle); }
548
572
  .vk-select-icon {
549
573
  position: absolute;
550
- top: 22px;
574
+ top: calc(var(--control-height, 44px) / 2);
551
575
  right: 0.75rem;
552
576
  translate: 0 -50%;
553
577
  color: var(--muted-foreground);
@@ -579,7 +603,7 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
579
603
  justify-content: space-between;
580
604
  gap: 0.75rem;
581
605
  padding: 0.6rem 0.75rem;
582
- font-size: var(--text-base);
606
+ font-size: var(--control-font-size, 1rem);
583
607
  line-height: 1.4;
584
608
  color: var(--foreground);
585
609
  cursor: pointer;
@@ -593,6 +617,12 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
593
617
  .vk-select-option[aria-disabled="true"] .vk-select-option-description { color: var(--muted-subtle); }
594
618
  .vk-field-error { margin: 0; font-size: var(--text-sm); color: var(--primary-hover); }
595
619
 
620
+ .vk-fieldset { min-width: 0; margin: 0; padding: var(--space-md); border: 1px solid var(--border-subtle); }
621
+ .vk-fieldset-legend { padding-inline: var(--space-xs); font-size: var(--text-xs); font-weight: 600; color: var(--foreground); }
622
+ .vk-fieldset-controls { display: grid; gap: var(--space-sm); }
623
+ /* Hint and error take the shared field styles; only their spacing within the group is set here. */
624
+ .vk-fieldset-hint { margin: 0 0 var(--space-sm); }
625
+ .vk-fieldset-error { margin: var(--space-sm) 0 0; }
596
626
  /* Select (Radix Select, popper position). The shared .vk-select-* rules live in styles/fields.css;
597
627
  these cover the Radix parts: state comes from data-state, data-highlighted and data-disabled,
598
628
  and the list is portalled and placed by Radix's popper wrapper. */
@@ -742,13 +772,13 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
742
772
 
743
773
  /* Search and clear */
744
774
  .vk-search, .vk-combobox-field { position: relative; display: grid; min-width: 0; }
745
- .vk-search-icon { position: absolute; top: 22px; left: 0.75rem; translate: 0 -50%; color: var(--muted-foreground); pointer-events: none; }
775
+ .vk-search-icon { position: absolute; top: calc(var(--control-height, 44px) / 2); left: 0.75rem; translate: 0 -50%; color: var(--muted-foreground); pointer-events: none; }
746
776
  .vk-search-input, .vk-has-lead { padding-left: 2.25rem; }
747
777
  .vk-search-input { padding-right: 2.5rem; }
748
778
  .vk-search-input::-webkit-search-cancel-button, .vk-search-input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
749
779
  .vk-field-clear {
750
780
  position: absolute;
751
- top: 22px;
781
+ top: calc(var(--control-height, 44px) / 2);
752
782
  right: 0.35rem;
753
783
  translate: 0 -50%;
754
784
  display: inline-flex;
@@ -776,7 +806,7 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
776
806
  flex-wrap: wrap;
777
807
  align-items: center;
778
808
  gap: 0.35rem;
779
- padding: 0.5rem 2.5rem 0.5rem 0.5rem;
809
+ padding: calc((var(--control-height, 44px) - 28px) / 2) 2.5rem calc((var(--control-height, 44px) - 28px) / 2) 0.5rem;
780
810
  cursor: text;
781
811
  }
782
812
  .vk-multiselect-field:focus-within { outline: 2px solid var(--ring); outline-offset: 1px; border-color: var(--primary); }
@@ -788,7 +818,7 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
788
818
  height: 26px;
789
819
  padding: 0 0.25rem;
790
820
  font: inherit;
791
- font-size: var(--text-base);
821
+ font-size: var(--control-font-size, 1rem);
792
822
  color: var(--foreground);
793
823
  background: transparent;
794
824
  border: 0;
@@ -805,7 +835,7 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
805
835
  .vk-multi-option[aria-disabled="true"] .vk-choice-box { border-style: dashed; background: transparent; }
806
836
 
807
837
  /* Date picker and popover */
808
- .vk-date-trigger { gap: 0.6rem; padding-right: 0.75rem; font: inherit; font-size: var(--text-base); color: var(--foreground); }
838
+ .vk-date-trigger { gap: 0.6rem; padding-right: 0.75rem; }
809
839
  .vk-date-trigger:disabled { cursor: not-allowed; }
810
840
  .vk-date-trigger[data-state="open"] { border-color: var(--primary); }
811
841
  .vk-date-icon { flex-shrink: 0; color: var(--muted-foreground); }
@@ -822,6 +852,7 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
822
852
  border: 1px solid var(--border);
823
853
  border-radius: var(--radius, 0);
824
854
  }
855
+ .vk-popover-footer .vk-btn { width: auto; }
825
856
  .vk-popover-footer { display: flex; justify-content: space-between; gap: 0.5rem; margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--border-subtle); }
826
857
 
827
858
  /* The calendar panel (Radix Popover): placed by its popper wrapper, which takes the z-index from here; data-state and data-side set by Radix */
@@ -884,6 +915,7 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
884
915
  .vk-day-range-end { background: linear-gradient(90deg, var(--primary-tint) 50%, transparent 50%); }
885
916
  .vk-day[aria-disabled="true"] { color: var(--muted-subtle); text-decoration: line-through; cursor: not-allowed; border-color: transparent; }
886
917
  .vk-day[aria-disabled="true"]:hover { border-color: transparent; }
918
+ .vk-day-selected[aria-disabled="true"] { color: var(--primary-foreground); border-color: var(--primary); }
887
919
 
888
920
  /* Badge tones */
889
921
  .vk-badge-neutral { color: var(--muted-foreground); border-color: var(--border); }
@@ -891,7 +923,7 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
891
923
  .vk-badge-success { color: var(--success); border-color: var(--success-line); }
892
924
  .vk-badge-warning { color: var(--warning); border-color: var(--warning-line); }
893
925
  .vk-badge-danger { color: var(--danger); border-color: var(--danger-line); }
894
- .vk-table .vk-icon-btn { width: 32px; height: 32px; }
926
+ .vk-table .vk-icon-btn { width: var(--button-height-sm, 32px); height: var(--button-height-sm, 32px); }
895
927
  .vk-table td:has(.vk-menu-root) { padding-top: 0.25rem; padding-bottom: 0.25rem; }
896
928
 
897
929
  /* Utilities */
@@ -1067,6 +1099,21 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
1067
1099
 
1068
1100
  /* Tabs (Radix Tabs: data-state=active|inactive and data-disabled set by Radix) */
1069
1101
  .vk-tablist { display: flex; gap: 1.75rem; overflow-x: auto; border-bottom: 1px solid var(--border-subtle); scrollbar-width: none; }
1102
+ /* A tab list that scrolls fades the edge with more tabs behind it, since its scrollbar is hidden. */
1103
+ @property --vk-tab-fade-start { syntax: "<length>"; inherits: false; initial-value: 0px; }
1104
+ @property --vk-tab-fade-end { syntax: "<length>"; inherits: false; initial-value: 0px; }
1105
+ @keyframes vk-tablist-fade {
1106
+ 0% { --vk-tab-fade-start: 0px; --vk-tab-fade-end: 2.5rem; }
1107
+ 8%, 92% { --vk-tab-fade-start: 2.5rem; --vk-tab-fade-end: 2.5rem; }
1108
+ 100% { --vk-tab-fade-start: 2.5rem; --vk-tab-fade-end: 0px; }
1109
+ }
1110
+ @supports (animation-timeline: scroll()) {
1111
+ .vk-tablist {
1112
+ mask-image: linear-gradient(to right, transparent, #000 var(--vk-tab-fade-start), #000 calc(100% - var(--vk-tab-fade-end)), transparent);
1113
+ animation: vk-tablist-fade linear both;
1114
+ animation-timeline: scroll(self inline);
1115
+ }
1116
+ }
1070
1117
  .vk-tab {
1071
1118
  position: relative;
1072
1119
  display: inline-flex;
@@ -1393,6 +1440,10 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
1393
1440
  .vk-layout-stack { display: flex; flex-direction: column; min-width: 0; }
1394
1441
  .vk-layout-inline { display: flex; min-width: 0; }
1395
1442
  .vk-layout-grid { display: grid; min-width: 0; }
1443
+ /* A row that holds a field sizes its buttons to the field, so toolbars and inline forms sit flush at --control-height. */
1444
+ .vk-layout-inline:has(.vk-input) > .vk-btn { min-height: var(--control-height, 44px); }
1445
+ .vk-layout-inline:has(.vk-input) > .vk-icon-btn { width: var(--control-height, 44px); height: var(--control-height, 44px); }
1446
+ .vk-layout-inline:has(.vk-input) > .vk-segmented .vk-segment { min-height: calc(var(--control-height, 44px) - 2px); }
1396
1447
  @media (max-width: 40rem) { .vk-layout-grid-fixed { grid-template-columns: 1fr !important; } }
1397
1448
  .vk-container { box-sizing: border-box; width: 100%; max-width: var(--content-max); margin-inline: auto; }
1398
1449
  .vk-container-prose { max-width: calc(var(--prose-max) + 2 * var(--section-gutter)); }
@@ -1458,6 +1509,8 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
1458
1509
  /* Charts */
1459
1510
  .vk-chart { display: grid; gap: 0.75rem; margin: 0; min-width: 0; }
1460
1511
  .vk-chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
1512
+ /* The table toggle keeps its width beside the title on narrow screens, where buttons otherwise fill the column. */
1513
+ .vk-chart-head .vk-btn { width: auto; flex-shrink: 0; }
1461
1514
  .vk-chart-title { margin: 0; font-family: var(--font-display); font-size: var(--text-base); font-weight: 600; color: var(--foreground); }
1462
1515
  .vk-chart-description { margin: 0.2rem 0 0; font-size: var(--text-sm); color: var(--muted-foreground); }
1463
1516
  .vk-chart-legend { display: flex; flex-wrap: wrap; gap: 0.35rem 1.25rem; margin: 0; padding: 0; list-style: none; font-size: var(--text-sm); color: var(--muted-foreground); }
@@ -1548,7 +1601,7 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
1548
1601
 
1549
1602
  /* Slider (Radix Slider: the track is its root, the fill its range; Radix positions the thumb's wrapper) */
1550
1603
  .vk-slider { display: grid; grid-template-columns: 1fr auto; gap: 0.35rem 1rem; align-items: center; min-width: 0; }
1551
- .vk-slider-value { grid-column: 2; grid-row: 1; font-family: var(--font-numeric); font-variant-numeric: tabular-nums; font-size: var(--text-sm); color: var(--foreground); }
1604
+ .vk-slider-value { grid-column: 2; grid-row: 1; font-family: var(--font-numeric); font-variant-numeric: tabular-nums; font-size: var(--text-sm); color: var(--foreground); min-width: 6ch; text-align: right; }
1552
1605
  /* A flex box, so the absolutely positioned thumb wrapper is centred vertically. */
1553
1606
  .vk-slider-track { grid-column: 1; grid-row: 1; position: relative; display: flex; align-items: center; height: 28px; cursor: pointer; touch-action: none; }
1554
1607
  .vk-slider-track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 4px; translate: 0 -50%; background: var(--card); border: 1px solid var(--input-border); box-sizing: border-box; }
@@ -1636,12 +1689,13 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
1636
1689
  .vk-list-divided > .vk-list-item + .vk-list-item { border-top: 1px solid var(--border-subtle); }
1637
1690
  .vk-list-bordered { border: 1px solid var(--border-subtle); }
1638
1691
  .vk-list-bordered .vk-list-main { padding-inline: 1rem; }
1692
+ .vk-list-bordered .vk-list-trailing { padding-right: 1rem; }
1639
1693
  .vk-list-item { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
1640
1694
  .vk-list-main { flex: 1; display: flex; align-items: center; gap: 0.85rem; min-width: 0; padding: 0.75rem 0.25rem; font: inherit; text-align: left; color: inherit; text-decoration: none; background: none; border: 0; }
1641
1695
  .vk-list-interactive { cursor: pointer; }
1642
1696
  .vk-list-interactive:hover { background: var(--card-fill); }
1643
1697
  .vk-list-interactive:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
1644
- .vk-list-item-selected .vk-list-main { background: var(--primary-tint); }
1698
+ .vk-list-item-selected { background: var(--primary-tint); }
1645
1699
  .vk-list-leading { display: inline-flex; flex-shrink: 0; color: var(--muted-foreground); }
1646
1700
  .vk-list-text { display: grid; gap: 0.1rem; flex: 1; min-width: 0; }
1647
1701
  .vk-list-title { font-size: var(--text-sm); font-weight: 500; color: var(--foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@@ -1654,7 +1708,7 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
1654
1708
  .vk-avatar-group-item { display: inline-flex; margin-left: -6px; }
1655
1709
  .vk-avatar-group-item:first-child { margin-left: 0; }
1656
1710
  .vk-avatar-group-item .vk-avatar { outline: 2px solid var(--background); }
1657
- .vk-avatar-more { background: var(--card); color: var(--muted-foreground); font-family: var(--font-numeric); }
1711
+ .vk-avatar-more { background: var(--card); color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
1658
1712
 
1659
1713
  /* Timeline */
1660
1714
  .vk-timeline { margin: 0; padding: 0; list-style: none; }
@@ -1697,6 +1751,13 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
1697
1751
  /* Typography */
1698
1752
  .vk-heading { margin: 0; color: var(--foreground); text-wrap: balance; }
1699
1753
  .vk-text { margin: 0; color: var(--foreground); }
1754
+ .vk-text-numeric { font-family: var(--font-numeric); font-variant-numeric: tabular-nums; }
1755
+ .vk-text-wrap-anywhere { overflow-wrap: anywhere; min-width: 0; }
1756
+ .vk-text-truncate { display: block; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1757
+ .vk-weight-regular { font-weight: 400; }
1758
+ .vk-weight-medium { font-weight: 500; }
1759
+ .vk-weight-semibold { font-weight: 600; }
1760
+ .vk-weight-bold { font-weight: 700; }
1700
1761
  .vk-tone-muted { color: var(--muted-foreground); }
1701
1762
  .vk-tone-subtle { color: var(--muted-subtle); }
1702
1763
  .vk-tone-primary { color: var(--primary); }
@@ -1735,6 +1796,7 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
1735
1796
  .vk-codeblock-copy:hover { color: var(--foreground); background: var(--primary-tint); }
1736
1797
  .vk-codeblock-copy:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
1737
1798
  .vk-codeblock-pre { margin: 0; overflow-x: auto; padding: 0.9rem 1rem; font-family: var(--font-mono); font-size: 13px; line-height: 1.65; color: var(--foreground); tab-size: 2; }
1799
+ .vk-codeblock-pre code { font: inherit; }
1738
1800
  .vk-codeblock-pre:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
1739
1801
  .vk-codeblock-numbered code { counter-reset: vk-line; }
1740
1802
  .vk-code-line { display: block; }
@@ -1759,6 +1821,91 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
1759
1821
  .vk-cmd-item-active { background: var(--primary-tint); }
1760
1822
  .vk-cmd-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; padding: 0.55rem 0.85rem; font-size: 0.75rem; color: var(--muted-subtle); border-top: 1px solid var(--border-subtle); }
1761
1823
 
1824
+ /* Opt in on html so portalled controls use the same density as their triggers.
1825
+ Components size controls from the control and button tokens, so density redefines those; component-specific sizes still win.
1826
+ On fine pointers the control height is 32px; with any coarse pointer it stays 44px, and buttons follow it either way. */
1827
+ [data-density="compact"] { --button-height: var(--control-height); --button-height-sm: var(--control-height); }
1828
+ html[data-density="compact"] body { font-size: var(--text-sm); }
1829
+ [data-density="compact"] .vk-page-header { container-type: inline-size; box-sizing: border-box; width: 100%; gap: var(--space-sm); padding-block: 0; }
1830
+ [data-density="compact"] .vk-page-header-divider { padding-bottom: var(--space-md); margin-bottom: 0; }
1831
+ [data-density="compact"] .vk-page-header-row { display: grid; grid-template-columns: minmax(min-content, 1fr) minmax(0, auto); align-items: center; gap: var(--space-xs) var(--space-md); }
1832
+ [data-density="compact"] .vk-page-header-text { display: contents; }
1833
+ [data-density="compact"] .vk-page-header-title { grid-column: 1; grid-row: 1; }
1834
+ [data-density="compact"] .vk-page-header-description { grid-column: 1; grid-row: 2; max-width: var(--prose-max); }
1835
+ [data-density="compact"] .vk-page-header-actions { grid-column: 2; grid-row: 1; justify-self: start; min-width: 0; }
1836
+ [data-density="compact"] .vk-page-header-eyebrow { grid-column: 1; grid-row: 1; }
1837
+ [data-density="compact"] .vk-page-header-row:has(.vk-page-header-eyebrow) .vk-page-header-title,
1838
+ [data-density="compact"] .vk-page-header-row:has(.vk-page-header-eyebrow) .vk-page-header-actions { grid-row: 2; }
1839
+ [data-density="compact"] .vk-page-header-row:has(.vk-page-header-eyebrow) .vk-page-header-description { grid-row: 3; }
1840
+ [data-density="compact"] .vk-page-header-title, [data-density="compact"] .vk-text-heading-1 { font-size: var(--text-xl); line-height: 1.3; }
1841
+ [data-density="compact"] .vk-page-header-description, [data-density="compact"] .vk-text-body { font-size: var(--text-sm); }
1842
+ [data-density="compact"] .vk-text-body-sm { font-size: 0.8125rem; }
1843
+ [data-density="compact"] .vk-text-small { font-size: var(--text-xs); }
1844
+ [data-density="compact"] .vk-text-lead, [data-density="compact"] .vk-section-lead { font-size: var(--text-base); }
1845
+ [data-density="compact"] .vk-section-header { margin-bottom: 0; }
1846
+ [data-density="compact"] .vk-section-heading, [data-density="compact"] .vk-text-heading-2, [data-density="compact"] .vk-text-title, [data-density="compact"] .vk-text-title-sm,
1847
+ [data-density="compact"] .vk-card-title, [data-density="compact"] .vk-empty-title, [data-density="compact"] .vk-media-card-title { font-size: var(--text-base); line-height: 1.4; }
1848
+ [data-density="compact"] .vk-section-heading { font-weight: 600; text-transform: none; letter-spacing: normal; }
1849
+ [data-density="compact"] .vk-stat-value { font-size: var(--text-2xl); }
1850
+ [data-density="compact"] .vk-shell-main { padding: var(--space-lg); }
1851
+ [data-density="compact"] .vk-shell-topbar > .vk-icon-btn { flex-shrink: 0; }
1852
+ [data-density="compact"] .vk-shell-brand { flex: 0 1 auto; min-width: 0; }
1853
+ [data-density="compact"] .vk-shell-brand > * { min-width: 0; max-width: 100%; }
1854
+ [data-density="compact"] .vk-shell-actions { flex: 0 1 auto; min-width: 0; }
1855
+ [data-density="compact"] .vk-shell-actions > * { min-width: 0; max-width: 100%; }
1856
+ [data-density="compact"] .vk-shell-actions .vk-btn { width: auto; min-width: 0; }
1857
+ [data-density="compact"] .vk-shell-actions .vk-btn-label { display: block; min-width: 0; align-self: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
1858
+ [data-density="compact"] .vk-dialog-title { font-size: var(--text-base); }
1859
+ [data-density="compact"] .vk-accordion-trigger { font-size: var(--text-sm); padding-block: var(--space-sm); }
1860
+ [data-density="compact"] .vk-btn-text { font-size: var(--text-sm); }
1861
+ [data-density="compact"] .vk-btn:not(.vk-btn-sm, .vk-btn-text) .vk-btn-label { padding: var(--space-xs) var(--space-sm); }
1862
+ [data-density="compact"] .vk-segmented { min-width: 0; max-width: 100%; align-self: flex-start; }
1863
+ [data-density="compact"] .vk-segment { min-width: 0; min-height: calc(var(--control-height) - 2px); padding: var(--space-xs) var(--space-sm); font-size: var(--text-sm); overflow-wrap: anywhere; }
1864
+ @container (max-width: 40rem) {
1865
+ [data-density="compact"] .vk-page-header-row { grid-template-columns: minmax(0, 1fr); }
1866
+ [data-density="compact"] .vk-page-header-row .vk-page-header-actions,
1867
+ [data-density="compact"] .vk-page-header-row:has(.vk-page-header-eyebrow) .vk-page-header-actions { grid-column: 1; grid-row: auto; margin-top: var(--space-xs); }
1868
+ }
1869
+ @media (max-width: 48rem) {
1870
+ [data-density="compact"] .vk-shell-actions { max-width: 45%; }
1871
+ }
1872
+ /* Data-dense components: tighter rows, cells and cards. Touch keeps 44px rows through accessibility.css. */
1873
+ [data-density="compact"] .vk-table td, [data-density="compact"] .vk-table tbody th { padding: var(--space-sm) var(--space-md); }
1874
+ [data-density="compact"] .vk-table thead th { padding: var(--space-xs) var(--space-md); }
1875
+ [data-density="compact"] .vk-list-main { padding-block: var(--space-sm); }
1876
+ [data-density="compact"] .vk-navlist-item, [data-density="compact"] .vk-menu-item { min-height: var(--control-height); padding-block: var(--space-xs); }
1877
+ [data-density="compact"] .vk-card { gap: var(--space-sm); padding: var(--space-md); }
1878
+ [data-density="compact"] .vk-card-body { font-size: var(--text-sm); }
1879
+ [data-density="compact"] .vk-page { min-width: var(--control-height); height: var(--control-height); }
1880
+ /* Fine pointers only: with any coarse pointer, controls keep 44px targets and 16px text (iOS zooms smaller inputs on focus). */
1881
+ @media (pointer: fine) and (not (any-pointer: coarse)) {
1882
+ [data-density="compact"] { --control-height: 32px; --control-font-size: var(--text-sm); --control-padding-block: var(--space-xs); }
1883
+ }
1884
+ /* Touch: buttons and rows meet a 44px target in every density (WCAG 2.5.5, Apple HIG); density only tightens fine-pointer layouts. */
1885
+ @media (any-pointer: coarse) {
1886
+ :root { --button-height: var(--control-height); --button-height-sm: var(--control-height); }
1887
+ .vk-navlist-item, .vk-menu-item, .vk-tree-row, .vk-accordion-trigger, .vk-choice { min-height: var(--control-height); }
1888
+ .vk-page { min-width: var(--control-height); height: var(--control-height); }
1889
+ .vk-day { height: var(--control-height); }
1890
+ .vk-segmented .vk-segment { min-height: calc(var(--control-height) - 2px); }
1891
+ .vk-calendar-header .vk-icon-btn { width: var(--control-height); height: var(--control-height); }
1892
+ .vk-stepper-btn, .vk-tab { min-width: var(--control-height); justify-content: center; }
1893
+ .vk-codeblock-copy { min-height: var(--control-height); }
1894
+ .vk-field-clear { width: var(--control-height); height: var(--control-height); right: 0; }
1895
+ .vk-search-input, .vk-date-input { padding-right: calc(var(--control-height) + var(--space-xs)); }
1896
+ /* Single-line choices centre the box in their 44px row; with a description the box stays on the first line. */
1897
+ .vk-choice:not(:has(.vk-choice-description)) { align-items: center; }
1898
+ .vk-choice:not(:has(.vk-choice-description)) :is(.vk-choice-box, .vk-switch-track) { margin-top: 0; }
1899
+ }
1900
+
1901
+ /* Small controls keep their look and extend their hit area: at least 24px (WCAG 2.5.8), 44px on touch where neighbours allow. */
1902
+ .vk-tag-remove, .vk-th-sort, .vk-alert-close, .vk-slider-thumb { position: relative; }
1903
+ .vk-tag-remove::after, .vk-th-sort::after, .vk-alert-close::after, .vk-slider-thumb::after { content: ""; position: absolute; top: 50%; left: 50%; width: max(100%, 24px); height: max(100%, 24px); translate: -50% -50%; }
1904
+ @media (any-pointer: coarse) {
1905
+ .vk-th-sort::after { height: 44px; }
1906
+ .vk-alert-close::after, .vk-slider-thumb::after { width: 44px; height: 44px; }
1907
+ }
1908
+
1762
1909
  /* Windows high-contrast (forced colors): restore state that relied on fills */
1763
1910
  @media (forced-colors: active) {
1764
1911
  .vk-choice .vk-choice-box:is([data-state="checked"], [data-state="indeterminate"]),
@@ -1771,7 +1918,7 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
1771
1918
  .vk-tab[aria-selected="true"]::after, .vk-slider-fill, .vk-progress-fill, .vk-slider-thumb { forced-color-adjust: none; background: Highlight; }
1772
1919
  .vk-progress-track[data-state="indeterminate"] { forced-color-adjust: none; background: repeating-linear-gradient(-45deg, Canvas, Canvas 4px, Highlight 4px, Highlight 6px); }
1773
1920
  .vk-select-option-active, .vk-menu-item:focus, .vk-cmd-item-active, .vk-tree-row-selected, .vk-navlist-item-active,
1774
- .vk-list-item-selected .vk-list-main, .vk-table .vk-tr-selected, .vk-day-selected, .vk-segment[aria-checked="true"], .vk-page[aria-current="page"],
1921
+ .vk-list-item-selected, .vk-table .vk-tr-selected, .vk-day-selected, .vk-segment[aria-checked="true"], .vk-page[aria-current="page"],
1775
1922
  .vk-tile-active { forced-color-adjust: none; background: Highlight; color: HighlightText; }
1776
1923
  .vk-day-in-range { forced-color-adjust: none; background: transparent; outline: 1px dashed Highlight; outline-offset: -3px; }
1777
1924
  .vk-spinner { border-color: CanvasText; border-top-color: Highlight; }
package/dist/index.d.ts CHANGED
@@ -35,6 +35,8 @@ export { Avatar } from "./components/Avatar/Avatar.js";
35
35
  export type * from "./components/Avatar/Avatar.js";
36
36
  export { Field } from "./components/Field/Field.js";
37
37
  export type * from "./components/Field/Field.js";
38
+ export { Fieldset } from "./components/Fieldset/Fieldset.js";
39
+ export type * from "./components/Fieldset/Fieldset.js";
38
40
  export { Input } from "./components/Input/Input.js";
39
41
  export type * from "./components/Input/Input.js";
40
42
  export { Textarea } from "./components/Textarea/Textarea.js";
package/dist/index.js CHANGED
@@ -19,6 +19,7 @@ export { IconButton } from "./components/IconButton/IconButton.js";
19
19
  export { Link } from "./components/Link/Link.js";
20
20
  export { Avatar } from "./components/Avatar/Avatar.js";
21
21
  export { Field } from "./components/Field/Field.js";
22
+ export { Fieldset } from "./components/Fieldset/Fieldset.js";
22
23
  export { Input } from "./components/Input/Input.js";
23
24
  export { Textarea } from "./components/Textarea/Textarea.js";
24
25
  export { Select } from "./components/Select/Select.js";
@@ -0,0 +1,3 @@
1
+ import type { ReactNode } from "react";
2
+ /** The aria-describedby list for a control or group with an optional hint and error rendered as `id-hint` and `id-error`. */
3
+ export declare function describedBy(id: string, hint: ReactNode, error: ReactNode, existing?: string): string | undefined;
@@ -0,0 +1,4 @@
1
+ /** The aria-describedby list for a control or group with an optional hint and error rendered as `id-hint` and `id-error`. */
2
+ export function describedBy(id, hint, error, existing) {
3
+ return [existing, hint ? id + "-hint" : null, error ? id + "-error" : null].filter(Boolean).join(" ") || undefined;
4
+ }
package/dist/tokens.css CHANGED
@@ -245,6 +245,8 @@
245
245
  --sidebar-width: 15rem;
246
246
  --topbar-height: 56px;
247
247
  --control-height: 44px;
248
+ --control-font-size: 1rem;
249
+ --control-padding-block: 0.6rem;
248
250
  --button-height: 40px;
249
251
  --button-height-sm: 32px;
250
252
  --font-sans: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
@@ -1186,6 +1186,16 @@
1186
1186
  "$value": "44px",
1187
1187
  "$description": "Inputs, selects, date fields."
1188
1188
  },
1189
+ "control-font-size": {
1190
+ "$type": "dimension",
1191
+ "$value": "1rem",
1192
+ "$description": "Text inside inputs, selects and date fields; 16px or more avoids iOS focus zoom."
1193
+ },
1194
+ "control-padding-block": {
1195
+ "$type": "dimension",
1196
+ "$value": "0.6rem",
1197
+ "$description": "Vertical padding inside single-line inputs, selects and date fields."
1198
+ },
1189
1199
  "button-height": {
1190
1200
  "$type": "dimension",
1191
1201
  "$value": "40px",
package/dist/tokens.json CHANGED
@@ -1202,6 +1202,16 @@
1202
1202
  "value": "44px",
1203
1203
  "usage": "Inputs, selects, date fields."
1204
1204
  },
1205
+ {
1206
+ "name": "control-font-size",
1207
+ "value": "1rem",
1208
+ "usage": "Text inside inputs, selects and date fields; 16px or more avoids iOS focus zoom."
1209
+ },
1210
+ {
1211
+ "name": "control-padding-block",
1212
+ "value": "0.6rem",
1213
+ "usage": "Vertical padding inside single-line inputs, selects and date fields."
1214
+ },
1205
1215
  {
1206
1216
  "name": "button-height",
1207
1217
  "value": "40px",
package/dist/types.d.ts CHANGED
@@ -42,9 +42,14 @@ export type MenuEntry = {
42
42
  label: string;
43
43
  };
44
44
  export type SpaceStep = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';
45
+ export type ElementTag = keyof React.JSX.IntrinsicElements;
45
46
  export type AsProp = {
46
- as?: keyof React.JSX.IntrinsicElements;
47
+ as?: ElementTag;
47
48
  };
49
+ /** A component's own props plus the attributes and events of the element it renders `as`, typed for that element. */
50
+ export type PolymorphicProps<T extends ElementTag, Own> = Own & {
51
+ as?: T;
52
+ } & Omit<React.ComponentPropsWithoutRef<T>, keyof Own | "as">;
48
53
  export interface ChartSeries {
49
54
  key: string;
50
55
  label: string;