@vokality/design-system 1.3.0 → 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.
- package/CHANGELOG.md +26 -0
- package/README.md +2 -2
- package/dist/components/Field/Field.js +2 -2
- package/dist/components/Fieldset/Fieldset.js +3 -3
- package/dist/components/Grid/Grid.d.ts +866 -4
- package/dist/components/Grid/Grid.js +2 -3
- package/dist/components/Inline/Inline.d.ts +866 -4
- package/dist/components/Inline/Inline.js +2 -3
- package/dist/components/Stack/Stack.d.ts +866 -4
- package/dist/components/Stack/Stack.js +2 -3
- package/dist/components/Text/Text.d.ts +9 -5
- package/dist/components/Text/Text.js +3 -4
- package/dist/components.css +102 -52
- package/dist/internal/describedBy.d.ts +3 -0
- package/dist/internal/describedBy.js +4 -0
- package/dist/tokens.css +2 -0
- package/dist/tokens.dtcg.json +10 -0
- package/dist/tokens.json +10 -0
- package/dist/types.d.ts +6 -1
- package/dist/vokality.css +104 -52
- package/dist/vokality.iife.js +331 -349
- package/docs/brand.md +2 -2
- package/docs/components/Badge/README.md +1 -1
- package/docs/components/Button/README.md +4 -2
- package/docs/components/Inline/README.md +1 -1
- package/docs/components/Text/README.md +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
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
5
|
export function Stack({ as, gap, align, children, className, style, ...rest }) {
|
|
6
|
-
|
|
7
|
-
return _jsx(Tag, { className: cx("vk-layout-stack", className), style: { gap: space(gap, "md"), alignItems: align, ...style }, ...rest, children: children });
|
|
6
|
+
return createElement(as || "div", { className: cx("vk-layout-stack", className), style: { gap: space(gap, "md"), alignItems: align, ...style }, ...rest }, children);
|
|
8
7
|
}
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
3
|
-
export interface
|
|
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
|
+
className?: string;
|
|
7
8
|
/** Space Grotesk with tabular figures for numbers, codes and identifiers. */
|
|
8
9
|
numeric?: boolean;
|
|
9
10
|
/** Allow long identifiers to wrap without widening their container. */
|
|
10
|
-
|
|
11
|
+
overflowWrap?: "normal" | "anywhere";
|
|
11
12
|
/** Keep one line and show an ellipsis when the available width is exhausted. */
|
|
12
13
|
truncate?: boolean;
|
|
13
14
|
/** Emphasis independent of the selected type size. */
|
|
14
15
|
weight?: "regular" | "medium" | "semibold" | "bold";
|
|
15
16
|
}
|
|
17
|
+
export type TextProps<T extends ElementTag = "p"> = PolymorphicProps<T, TextOwnProps>;
|
|
16
18
|
/** Running text in one of the system's text styles and tones. */
|
|
17
|
-
export declare function Text({ as, size, tone, numeric,
|
|
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 {
|
|
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, numeric,
|
|
5
|
-
|
|
6
|
-
return _jsx(Tag, { className: cx("vk-text", "vk-text-" + (size || "body"), tone && "vk-tone-" + tone, numeric && "vk-text-numeric", wrap === "anywhere" && "vk-text-wrap-anywhere", truncate && "vk-text-truncate", weight && "vk-weight-" + weight, className), ...rest, 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
|
}
|
package/dist/components.css
CHANGED
|
@@ -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; }
|
|
@@ -117,7 +117,6 @@ body {
|
|
|
117
117
|
.vk-btn-text .vk-btn-label, .vk-btn-text .vk-btn-label:only-child { padding: var(--space-xs) 0; }
|
|
118
118
|
.vk-btn-text:hover { color: var(--primary); text-decoration: underline; text-underline-offset: var(--space-xs); }
|
|
119
119
|
.vk-btn-text:disabled { cursor: not-allowed; opacity: 0.5; }
|
|
120
|
-
@media (any-pointer: coarse) { .vk-btn-text { min-height: var(--control-height); } }
|
|
121
120
|
|
|
122
121
|
/* Square glyph */
|
|
123
122
|
@keyframes vk-glyph-blink {
|
|
@@ -364,9 +363,8 @@ body {
|
|
|
364
363
|
}
|
|
365
364
|
|
|
366
365
|
.vk-badge-icon { gap: var(--space-xs); }
|
|
367
|
-
.vk-badge[tabindex] { box-sizing: border-box; min-height: var(--button-height-sm); }
|
|
366
|
+
.vk-badge[tabindex]:not([tabindex="-1"]) { box-sizing: border-box; min-height: var(--button-height-sm); }
|
|
368
367
|
.vk-badge:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
|
|
369
|
-
@media (any-pointer: coarse) { .vk-badge[tabindex] { min-height: var(--control-height); } }
|
|
370
368
|
|
|
371
369
|
/* Quote */
|
|
372
370
|
.vk-quote {
|
|
@@ -492,8 +490,8 @@ body {
|
|
|
492
490
|
align-items: center;
|
|
493
491
|
justify-content: center;
|
|
494
492
|
box-sizing: border-box;
|
|
495
|
-
width: 40px;
|
|
496
|
-
height: 40px;
|
|
493
|
+
width: var(--button-height, 40px);
|
|
494
|
+
height: var(--button-height, 40px);
|
|
497
495
|
padding: 0;
|
|
498
496
|
color: var(--foreground);
|
|
499
497
|
background: transparent;
|
|
@@ -544,9 +542,11 @@ input.vk-input:read-only, textarea.vk-input:read-only { background: transparent;
|
|
|
544
542
|
box-sizing: border-box;
|
|
545
543
|
width: 100%;
|
|
546
544
|
min-height: var(--control-height, 44px);
|
|
547
|
-
padding: 0.6rem 0.75rem;
|
|
545
|
+
padding: var(--control-padding-block, 0.6rem) 0.75rem;
|
|
548
546
|
font: inherit;
|
|
549
|
-
font-size: var(--
|
|
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;
|
|
550
550
|
color: var(--foreground);
|
|
551
551
|
background: var(--card);
|
|
552
552
|
border: 1px solid var(--input-border);
|
|
@@ -555,7 +555,7 @@ input.vk-input:read-only, textarea.vk-input:read-only { background: transparent;
|
|
|
555
555
|
.vk-input::placeholder { color: var(--muted-subtle); }
|
|
556
556
|
.vk-input:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; border-color: var(--primary); }
|
|
557
557
|
.vk-input[aria-invalid="true"] { border-color: var(--primary); }
|
|
558
|
-
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; }
|
|
559
559
|
.vk-select { position: relative; display: grid; min-width: 0; }
|
|
560
560
|
.vk-select-trigger {
|
|
561
561
|
display: flex;
|
|
@@ -571,7 +571,7 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
|
|
|
571
571
|
.vk-select-placeholder { color: var(--muted-subtle); }
|
|
572
572
|
.vk-select-icon {
|
|
573
573
|
position: absolute;
|
|
574
|
-
top:
|
|
574
|
+
top: calc(var(--control-height, 44px) / 2);
|
|
575
575
|
right: 0.75rem;
|
|
576
576
|
translate: 0 -50%;
|
|
577
577
|
color: var(--muted-foreground);
|
|
@@ -603,7 +603,7 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
|
|
|
603
603
|
justify-content: space-between;
|
|
604
604
|
gap: 0.75rem;
|
|
605
605
|
padding: 0.6rem 0.75rem;
|
|
606
|
-
font-size: var(--
|
|
606
|
+
font-size: var(--control-font-size, 1rem);
|
|
607
607
|
line-height: 1.4;
|
|
608
608
|
color: var(--foreground);
|
|
609
609
|
cursor: pointer;
|
|
@@ -620,9 +620,9 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
|
|
|
620
620
|
.vk-fieldset { min-width: 0; margin: 0; padding: var(--space-md); border: 1px solid var(--border-subtle); }
|
|
621
621
|
.vk-fieldset-legend { padding-inline: var(--space-xs); font-size: var(--text-xs); font-weight: 600; color: var(--foreground); }
|
|
622
622
|
.vk-fieldset-controls { display: grid; gap: var(--space-sm); }
|
|
623
|
-
|
|
624
|
-
.vk-fieldset-hint { margin
|
|
625
|
-
.vk-fieldset-error { margin
|
|
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; }
|
|
626
626
|
/* Select (Radix Select, popper position). The shared .vk-select-* rules live in styles/fields.css;
|
|
627
627
|
these cover the Radix parts: state comes from data-state, data-highlighted and data-disabled,
|
|
628
628
|
and the list is portalled and placed by Radix's popper wrapper. */
|
|
@@ -772,13 +772,13 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
|
|
|
772
772
|
|
|
773
773
|
/* Search and clear */
|
|
774
774
|
.vk-search, .vk-combobox-field { position: relative; display: grid; min-width: 0; }
|
|
775
|
-
.vk-search-icon { position: absolute; top:
|
|
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; }
|
|
776
776
|
.vk-search-input, .vk-has-lead { padding-left: 2.25rem; }
|
|
777
777
|
.vk-search-input { padding-right: 2.5rem; }
|
|
778
778
|
.vk-search-input::-webkit-search-cancel-button, .vk-search-input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
|
|
779
779
|
.vk-field-clear {
|
|
780
780
|
position: absolute;
|
|
781
|
-
top:
|
|
781
|
+
top: calc(var(--control-height, 44px) / 2);
|
|
782
782
|
right: 0.35rem;
|
|
783
783
|
translate: 0 -50%;
|
|
784
784
|
display: inline-flex;
|
|
@@ -806,7 +806,7 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
|
|
|
806
806
|
flex-wrap: wrap;
|
|
807
807
|
align-items: center;
|
|
808
808
|
gap: 0.35rem;
|
|
809
|
-
padding:
|
|
809
|
+
padding: calc((var(--control-height, 44px) - 28px) / 2) 2.5rem calc((var(--control-height, 44px) - 28px) / 2) 0.5rem;
|
|
810
810
|
cursor: text;
|
|
811
811
|
}
|
|
812
812
|
.vk-multiselect-field:focus-within { outline: 2px solid var(--ring); outline-offset: 1px; border-color: var(--primary); }
|
|
@@ -818,7 +818,7 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
|
|
|
818
818
|
height: 26px;
|
|
819
819
|
padding: 0 0.25rem;
|
|
820
820
|
font: inherit;
|
|
821
|
-
font-size: var(--
|
|
821
|
+
font-size: var(--control-font-size, 1rem);
|
|
822
822
|
color: var(--foreground);
|
|
823
823
|
background: transparent;
|
|
824
824
|
border: 0;
|
|
@@ -835,7 +835,7 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
|
|
|
835
835
|
.vk-multi-option[aria-disabled="true"] .vk-choice-box { border-style: dashed; background: transparent; }
|
|
836
836
|
|
|
837
837
|
/* Date picker and popover */
|
|
838
|
-
.vk-date-trigger { gap: 0.6rem; padding-right: 0.75rem;
|
|
838
|
+
.vk-date-trigger { gap: 0.6rem; padding-right: 0.75rem; }
|
|
839
839
|
.vk-date-trigger:disabled { cursor: not-allowed; }
|
|
840
840
|
.vk-date-trigger[data-state="open"] { border-color: var(--primary); }
|
|
841
841
|
.vk-date-icon { flex-shrink: 0; color: var(--muted-foreground); }
|
|
@@ -852,6 +852,7 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
|
|
|
852
852
|
border: 1px solid var(--border);
|
|
853
853
|
border-radius: var(--radius, 0);
|
|
854
854
|
}
|
|
855
|
+
.vk-popover-footer .vk-btn { width: auto; }
|
|
855
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); }
|
|
856
857
|
|
|
857
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 */
|
|
@@ -914,6 +915,7 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
|
|
|
914
915
|
.vk-day-range-end { background: linear-gradient(90deg, var(--primary-tint) 50%, transparent 50%); }
|
|
915
916
|
.vk-day[aria-disabled="true"] { color: var(--muted-subtle); text-decoration: line-through; cursor: not-allowed; border-color: transparent; }
|
|
916
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); }
|
|
917
919
|
|
|
918
920
|
/* Badge tones */
|
|
919
921
|
.vk-badge-neutral { color: var(--muted-foreground); border-color: var(--border); }
|
|
@@ -921,7 +923,7 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
|
|
|
921
923
|
.vk-badge-success { color: var(--success); border-color: var(--success-line); }
|
|
922
924
|
.vk-badge-warning { color: var(--warning); border-color: var(--warning-line); }
|
|
923
925
|
.vk-badge-danger { color: var(--danger); border-color: var(--danger-line); }
|
|
924
|
-
.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); }
|
|
925
927
|
.vk-table td:has(.vk-menu-root) { padding-top: 0.25rem; padding-bottom: 0.25rem; }
|
|
926
928
|
|
|
927
929
|
/* Utilities */
|
|
@@ -1097,6 +1099,21 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
|
|
|
1097
1099
|
|
|
1098
1100
|
/* Tabs (Radix Tabs: data-state=active|inactive and data-disabled set by Radix) */
|
|
1099
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
|
+
}
|
|
1100
1117
|
.vk-tab {
|
|
1101
1118
|
position: relative;
|
|
1102
1119
|
display: inline-flex;
|
|
@@ -1423,6 +1440,10 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
|
|
|
1423
1440
|
.vk-layout-stack { display: flex; flex-direction: column; min-width: 0; }
|
|
1424
1441
|
.vk-layout-inline { display: flex; min-width: 0; }
|
|
1425
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); }
|
|
1426
1447
|
@media (max-width: 40rem) { .vk-layout-grid-fixed { grid-template-columns: 1fr !important; } }
|
|
1427
1448
|
.vk-container { box-sizing: border-box; width: 100%; max-width: var(--content-max); margin-inline: auto; }
|
|
1428
1449
|
.vk-container-prose { max-width: calc(var(--prose-max) + 2 * var(--section-gutter)); }
|
|
@@ -1488,6 +1509,8 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
|
|
|
1488
1509
|
/* Charts */
|
|
1489
1510
|
.vk-chart { display: grid; gap: 0.75rem; margin: 0; min-width: 0; }
|
|
1490
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; }
|
|
1491
1514
|
.vk-chart-title { margin: 0; font-family: var(--font-display); font-size: var(--text-base); font-weight: 600; color: var(--foreground); }
|
|
1492
1515
|
.vk-chart-description { margin: 0.2rem 0 0; font-size: var(--text-sm); color: var(--muted-foreground); }
|
|
1493
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); }
|
|
@@ -1578,7 +1601,7 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
|
|
|
1578
1601
|
|
|
1579
1602
|
/* Slider (Radix Slider: the track is its root, the fill its range; Radix positions the thumb's wrapper) */
|
|
1580
1603
|
.vk-slider { display: grid; grid-template-columns: 1fr auto; gap: 0.35rem 1rem; align-items: center; min-width: 0; }
|
|
1581
|
-
.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; }
|
|
1582
1605
|
/* A flex box, so the absolutely positioned thumb wrapper is centred vertically. */
|
|
1583
1606
|
.vk-slider-track { grid-column: 1; grid-row: 1; position: relative; display: flex; align-items: center; height: 28px; cursor: pointer; touch-action: none; }
|
|
1584
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; }
|
|
@@ -1666,12 +1689,13 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
|
|
|
1666
1689
|
.vk-list-divided > .vk-list-item + .vk-list-item { border-top: 1px solid var(--border-subtle); }
|
|
1667
1690
|
.vk-list-bordered { border: 1px solid var(--border-subtle); }
|
|
1668
1691
|
.vk-list-bordered .vk-list-main { padding-inline: 1rem; }
|
|
1692
|
+
.vk-list-bordered .vk-list-trailing { padding-right: 1rem; }
|
|
1669
1693
|
.vk-list-item { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
|
|
1670
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; }
|
|
1671
1695
|
.vk-list-interactive { cursor: pointer; }
|
|
1672
1696
|
.vk-list-interactive:hover { background: var(--card-fill); }
|
|
1673
1697
|
.vk-list-interactive:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
|
|
1674
|
-
.vk-list-item-selected
|
|
1698
|
+
.vk-list-item-selected { background: var(--primary-tint); }
|
|
1675
1699
|
.vk-list-leading { display: inline-flex; flex-shrink: 0; color: var(--muted-foreground); }
|
|
1676
1700
|
.vk-list-text { display: grid; gap: 0.1rem; flex: 1; min-width: 0; }
|
|
1677
1701
|
.vk-list-title { font-size: var(--text-sm); font-weight: 500; color: var(--foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
@@ -1684,7 +1708,7 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
|
|
|
1684
1708
|
.vk-avatar-group-item { display: inline-flex; margin-left: -6px; }
|
|
1685
1709
|
.vk-avatar-group-item:first-child { margin-left: 0; }
|
|
1686
1710
|
.vk-avatar-group-item .vk-avatar { outline: 2px solid var(--background); }
|
|
1687
|
-
.vk-avatar-more { background: var(--card); color: var(--muted-foreground); font-
|
|
1711
|
+
.vk-avatar-more { background: var(--card); color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
|
|
1688
1712
|
|
|
1689
1713
|
/* Timeline */
|
|
1690
1714
|
.vk-timeline { margin: 0; padding: 0; list-style: none; }
|
|
@@ -1772,6 +1796,7 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
|
|
|
1772
1796
|
.vk-codeblock-copy:hover { color: var(--foreground); background: var(--primary-tint); }
|
|
1773
1797
|
.vk-codeblock-copy:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
|
|
1774
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; }
|
|
1775
1800
|
.vk-codeblock-pre:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
|
|
1776
1801
|
.vk-codeblock-numbered code { counter-reset: vk-line; }
|
|
1777
1802
|
.vk-code-line { display: block; }
|
|
@@ -1796,30 +1821,35 @@ textarea.vk-input, .vk-textarea { resize: vertical; min-height: 8rem; line-heigh
|
|
|
1796
1821
|
.vk-cmd-item-active { background: var(--primary-tint); }
|
|
1797
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); }
|
|
1798
1823
|
|
|
1799
|
-
/* Opt in on html so portalled controls use the same density as their triggers.
|
|
1800
|
-
|
|
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); }
|
|
1801
1828
|
html[data-density="compact"] body { font-size: var(--text-sm); }
|
|
1802
|
-
[data-density="compact"] .vk-page-header { container-type: inline-size; gap: var(--space-sm); padding-block: 0; }
|
|
1829
|
+
[data-density="compact"] .vk-page-header { container-type: inline-size; box-sizing: border-box; width: 100%; gap: var(--space-sm); padding-block: 0; }
|
|
1803
1830
|
[data-density="compact"] .vk-page-header-divider { padding-bottom: var(--space-md); margin-bottom: 0; }
|
|
1804
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); }
|
|
1805
1832
|
[data-density="compact"] .vk-page-header-text { display: contents; }
|
|
1806
1833
|
[data-density="compact"] .vk-page-header-title { grid-column: 1; grid-row: 1; }
|
|
1807
1834
|
[data-density="compact"] .vk-page-header-description { grid-column: 1; grid-row: 2; max-width: var(--prose-max); }
|
|
1808
|
-
[data-density="compact"] .vk-page-header-actions { grid-column: 2; grid-row: 1; min-width: 0; }
|
|
1835
|
+
[data-density="compact"] .vk-page-header-actions { grid-column: 2; grid-row: 1; justify-self: start; min-width: 0; }
|
|
1809
1836
|
[data-density="compact"] .vk-page-header-eyebrow { grid-column: 1; grid-row: 1; }
|
|
1810
1837
|
[data-density="compact"] .vk-page-header-row:has(.vk-page-header-eyebrow) .vk-page-header-title,
|
|
1811
1838
|
[data-density="compact"] .vk-page-header-row:has(.vk-page-header-eyebrow) .vk-page-header-actions { grid-row: 2; }
|
|
1812
1839
|
[data-density="compact"] .vk-page-header-row:has(.vk-page-header-eyebrow) .vk-page-header-description { grid-row: 3; }
|
|
1813
1840
|
[data-density="compact"] .vk-page-header-title, [data-density="compact"] .vk-text-heading-1 { font-size: var(--text-xl); line-height: 1.3; }
|
|
1814
|
-
[data-density="compact"] .vk-page-header-description, [data-density="compact"] .vk-text-body
|
|
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); }
|
|
1815
1845
|
[data-density="compact"] .vk-section-header { margin-bottom: 0; }
|
|
1816
|
-
[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
|
|
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; }
|
|
1817
1848
|
[data-density="compact"] .vk-section-heading { font-weight: 600; text-transform: none; letter-spacing: normal; }
|
|
1818
|
-
[data-density="compact"] .vk-text-meta { font-size: var(--text-xs); }
|
|
1819
1849
|
[data-density="compact"] .vk-stat-value { font-size: var(--text-2xl); }
|
|
1820
1850
|
[data-density="compact"] .vk-shell-main { padding: var(--space-lg); }
|
|
1821
1851
|
[data-density="compact"] .vk-shell-topbar > .vk-icon-btn { flex-shrink: 0; }
|
|
1822
|
-
[data-density="compact"] .vk-shell-brand { flex:
|
|
1852
|
+
[data-density="compact"] .vk-shell-brand { flex: 0 1 auto; min-width: 0; }
|
|
1823
1853
|
[data-density="compact"] .vk-shell-brand > * { min-width: 0; max-width: 100%; }
|
|
1824
1854
|
[data-density="compact"] .vk-shell-actions { flex: 0 1 auto; min-width: 0; }
|
|
1825
1855
|
[data-density="compact"] .vk-shell-actions > * { min-width: 0; max-width: 100%; }
|
|
@@ -1827,35 +1857,55 @@ html[data-density="compact"] body { font-size: var(--text-sm); }
|
|
|
1827
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; }
|
|
1828
1858
|
[data-density="compact"] .vk-dialog-title { font-size: var(--text-base); }
|
|
1829
1859
|
[data-density="compact"] .vk-accordion-trigger { font-size: var(--text-sm); padding-block: var(--space-sm); }
|
|
1830
|
-
[data-density="compact"] .vk-input { min-height: var(--density-control-height); padding-block: var(--space-xs); line-height: 1.4; }
|
|
1831
|
-
[data-density="compact"] .vk-affix-row { min-height: var(--density-control-height); }
|
|
1832
|
-
[data-density="compact"] .vk-affix-row > .vk-input { min-height: 0; }
|
|
1833
|
-
[data-density="compact"] .vk-btn { min-height: var(--density-control-height); font-size: var(--text-xs); }
|
|
1834
1860
|
[data-density="compact"] .vk-btn-text { font-size: var(--text-sm); }
|
|
1835
|
-
[data-density="compact"] .vk-btn .vk-btn-label { padding: var(--space-xs) var(--space-sm); }
|
|
1836
|
-
[data-density="compact"] .vk-btn-text .vk-btn-label { padding-inline: 0; }
|
|
1837
|
-
[data-density="compact"] .vk-icon-btn { width: var(--density-control-height); height: var(--density-control-height); }
|
|
1838
|
-
[data-density="compact"] .vk-search-icon, [data-density="compact"] .vk-select-icon, [data-density="compact"] .vk-field-clear { top: calc(var(--density-control-height) / 2); }
|
|
1839
|
-
[data-density="compact"] .vk-field-clear { width: var(--density-control-height); height: var(--density-control-height); right: 0; }
|
|
1840
|
-
[data-density="compact"] .vk-badge[tabindex] { min-height: var(--density-control-height); }
|
|
1861
|
+
[data-density="compact"] .vk-btn:not(.vk-btn-sm, .vk-btn-text) .vk-btn-label { padding: var(--space-xs) var(--space-sm); }
|
|
1841
1862
|
[data-density="compact"] .vk-segmented { min-width: 0; max-width: 100%; align-self: flex-start; }
|
|
1842
|
-
[data-density="compact"] .vk-segment { min-width: 0; min-height: var(--
|
|
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; }
|
|
1843
1864
|
@container (max-width: 40rem) {
|
|
1844
1865
|
[data-density="compact"] .vk-page-header-row { grid-template-columns: minmax(0, 1fr); }
|
|
1845
|
-
[data-density="compact"] .vk-page-header-row .vk-page-header-actions
|
|
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); }
|
|
1846
1868
|
}
|
|
1847
1869
|
@media (max-width: 48rem) {
|
|
1848
1870
|
[data-density="compact"] .vk-shell-actions { max-width: 45%; }
|
|
1849
1871
|
}
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
}
|
|
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. */
|
|
1853
1885
|
@media (any-pointer: coarse) {
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
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; }
|
|
1858
1907
|
}
|
|
1908
|
+
|
|
1859
1909
|
/* Windows high-contrast (forced colors): restore state that relied on fills */
|
|
1860
1910
|
@media (forced-colors: active) {
|
|
1861
1911
|
.vk-choice .vk-choice-box:is([data-state="checked"], [data-state="indeterminate"]),
|
|
@@ -1868,7 +1918,7 @@ html[data-density="compact"] body { font-size: var(--text-sm); }
|
|
|
1868
1918
|
.vk-tab[aria-selected="true"]::after, .vk-slider-fill, .vk-progress-fill, .vk-slider-thumb { forced-color-adjust: none; background: Highlight; }
|
|
1869
1919
|
.vk-progress-track[data-state="indeterminate"] { forced-color-adjust: none; background: repeating-linear-gradient(-45deg, Canvas, Canvas 4px, Highlight 4px, Highlight 6px); }
|
|
1870
1920
|
.vk-select-option-active, .vk-menu-item:focus, .vk-cmd-item-active, .vk-tree-row-selected, .vk-navlist-item-active,
|
|
1871
|
-
.vk-list-item-selected
|
|
1921
|
+
.vk-list-item-selected, .vk-table .vk-tr-selected, .vk-day-selected, .vk-segment[aria-checked="true"], .vk-page[aria-current="page"],
|
|
1872
1922
|
.vk-tile-active { forced-color-adjust: none; background: Highlight; color: HighlightText; }
|
|
1873
1923
|
.vk-day-in-range { forced-color-adjust: none; background: transparent; outline: 1px dashed Highlight; outline-offset: -3px; }
|
|
1874
1924
|
.vk-spinner { border-color: CanvasText; border-top-color: Highlight; }
|
|
@@ -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;
|
package/dist/tokens.dtcg.json
CHANGED
|
@@ -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?:
|
|
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;
|