@pgcorp/ui-kit 0.7.2 → 0.8.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/README.md +135 -8
- package/docs/accessibility.md +12 -0
- package/docs/getting-started.md +32 -2
- package/docs/public-api.md +19 -2
- package/docs/theming.md +16 -0
- package/package.json +18 -3
- package/src/components/shared/codeLanguages.ts +2 -107
- package/src/components/shared/containers/SPanel.css +32 -1
- package/src/components/shared/containers/SPanel.vue +4 -0
- package/src/components/shared/controls/SCheckbox.vue +2 -2
- package/src/components/shared/controls/SInteractiveSurface.css +4 -0
- package/src/components/shared/controls/SInteractiveSurface.vue +1 -1
- package/src/components/shared/controls/SListbox.vue +4 -4
- package/src/components/shared/controls/SSwitch.vue +2 -2
- package/src/components/shared/data-display/SChart.css +149 -0
- package/src/components/shared/data-display/SChart.vue +493 -0
- package/src/components/shared/data-display/SChip.css +19 -0
- package/src/components/shared/data-display/SChip.vue +30 -6
- package/src/components/shared/data-display/SCodeBlock.css +68 -0
- package/src/components/shared/data-display/SCodeBlock.vue +102 -16
- package/src/components/shared/data-display/SMetricCard.css +1 -0
- package/src/components/shared/data-display/SMetricCard.vue +1 -0
- package/src/components/shared/data-display/STable.vue +120 -145
- package/src/components/shared/data-display/chart.ts +54 -0
- package/src/components/shared/navigation/STabList.vue +0 -3
- package/src/internal/chartGeometry.ts +748 -0
- package/src/internal/codeLanguageIdentity.ts +89 -0
- package/src/internal/lazyCodeEditor.ts +1 -0
- package/src/internal/linkTarget.ts +1 -3
- package/src/internal/ownedAttrs.ts +1 -0
- package/src/internal/useBinaryInput.ts +9 -2
- package/src/styles/tailwind.css +3 -0
- package/src/styles/tokens.css +33 -0
|
@@ -18,6 +18,10 @@
|
|
|
18
18
|
@apply border-transparent bg-transparent dark:border-transparent dark:bg-transparent;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
.s-interactive-surface[data-appearance='bare'] {
|
|
22
|
+
@apply overflow-visible border-0 bg-transparent dark:bg-transparent;
|
|
23
|
+
}
|
|
24
|
+
|
|
21
25
|
.s-interactive-surface__activation {
|
|
22
26
|
@apply absolute inset-0 z-10 block h-full w-full cursor-pointer border-0 bg-transparent p-0;
|
|
23
27
|
border-radius: inherit;
|
|
@@ -20,7 +20,7 @@ export type InteractiveSurfaceDensity = 'compact' | 'comfortable'
|
|
|
20
20
|
export type InteractiveSurfacePadding = 'none' | 'sm' | 'md'
|
|
21
21
|
export type InteractiveSurfaceRadius = 'md' | 'lg' | 'xl'
|
|
22
22
|
export type InteractiveSurfaceFill = 'content' | 'container'
|
|
23
|
-
export type InteractiveSurfaceAppearance = 'card' | 'plain'
|
|
23
|
+
export type InteractiveSurfaceAppearance = 'card' | 'plain' | 'bare'
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Единственный semantic-контракт поверхности: passive, action или ровно одна link-target.
|
|
@@ -338,7 +338,7 @@ provide(listboxContextKey, {
|
|
|
338
338
|
},
|
|
339
339
|
})
|
|
340
340
|
|
|
341
|
-
function focusOption(target: ListboxOptionRegistration
|
|
341
|
+
function focusOption(target: ListboxOptionRegistration): void {
|
|
342
342
|
for (const option of registrations) option.element.tabIndex = -1
|
|
343
343
|
target.element.tabIndex = 0
|
|
344
344
|
target.element.focus()
|
|
@@ -451,7 +451,7 @@ function handleKeydown(event: KeyboardEvent): void {
|
|
|
451
451
|
const match = searchOrder.find((option) => option.label().toLocaleLowerCase().startsWith(query))
|
|
452
452
|
if (match) {
|
|
453
453
|
event.preventDefault()
|
|
454
|
-
focusOption(match
|
|
454
|
+
focusOption(match)
|
|
455
455
|
}
|
|
456
456
|
return
|
|
457
457
|
}
|
|
@@ -467,7 +467,7 @@ function handleKeydown(event: KeyboardEvent): void {
|
|
|
467
467
|
const target = options[nextIndex]
|
|
468
468
|
if (!target) return
|
|
469
469
|
event.preventDefault()
|
|
470
|
-
focusOption(target
|
|
470
|
+
focusOption(target)
|
|
471
471
|
}
|
|
472
472
|
|
|
473
473
|
function focusSelectedOrFirst(): void {
|
|
@@ -476,7 +476,7 @@ function focusSelectedOrFirst(): void {
|
|
|
476
476
|
}
|
|
477
477
|
const options = enabledRegistrations()
|
|
478
478
|
const target = options.find((option) => option.selected()) ?? options[0]
|
|
479
|
-
if (target) focusOption(target
|
|
479
|
+
if (target) focusOption(target)
|
|
480
480
|
}
|
|
481
481
|
|
|
482
482
|
onBeforeUnmount(() => { if (typeaheadTimer) clearTimeout(typeaheadTimer) })
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<template #default="field">
|
|
14
14
|
<span class="s-switch-control">
|
|
15
15
|
<input
|
|
16
|
-
ref="
|
|
16
|
+
:ref="setInputElement"
|
|
17
17
|
v-bind="ownedAttrs.bindings()"
|
|
18
18
|
:id="field.controlId"
|
|
19
19
|
type="checkbox"
|
|
@@ -75,10 +75,10 @@ const ownedAttrs = useOwnedAttrs({ component: 'SSwitch', owner: 'native switch i
|
|
|
75
75
|
useInteractiveLeafRegistration({ owner: 'SSwitch' })
|
|
76
76
|
const {
|
|
77
77
|
checkedValue,
|
|
78
|
-
inputEl,
|
|
79
78
|
inputId,
|
|
80
79
|
onChange,
|
|
81
80
|
onClick,
|
|
81
|
+
setInputElement,
|
|
82
82
|
} = useBinaryInput({
|
|
83
83
|
owner: 'SSwitch',
|
|
84
84
|
inputName: 'switch',
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
@reference "../../../styles/reference.css";
|
|
2
|
+
|
|
3
|
+
.s-chart {
|
|
4
|
+
@apply m-0 grid min-w-0 w-full text-surface-700 dark:text-surface-200;
|
|
5
|
+
gap: var(--s-space-content-gap);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.s-chart__viewport {
|
|
9
|
+
@apply relative min-w-0 w-full overflow-hidden rounded-md;
|
|
10
|
+
background: var(--s-chart-surface);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.s-chart[data-size='compact'] .s-chart__viewport { aspect-ratio: 15 / 4; }
|
|
14
|
+
.s-chart[data-size='sm'] .s-chart__viewport { aspect-ratio: 8 / 3; }
|
|
15
|
+
.s-chart[data-size='md'] .s-chart__viewport { aspect-ratio: 20 / 9; }
|
|
16
|
+
.s-chart[data-size='lg'] .s-chart__viewport { aspect-ratio: 25 / 12; }
|
|
17
|
+
|
|
18
|
+
.s-chart[data-empty='true'] .s-chart__viewport { aspect-ratio: auto; }
|
|
19
|
+
.s-chart[data-size='compact'][data-empty='true'] .s-chart__viewport { min-height: 6rem; }
|
|
20
|
+
.s-chart[data-size='sm'][data-empty='true'] .s-chart__viewport { min-height: 10rem; }
|
|
21
|
+
.s-chart[data-size='md'][data-empty='true'] .s-chart__viewport { min-height: 14rem; }
|
|
22
|
+
.s-chart[data-size='lg'][data-empty='true'] .s-chart__viewport { min-height: 18rem; }
|
|
23
|
+
|
|
24
|
+
.s-chart__svg { @apply block h-full w-full overflow-visible; }
|
|
25
|
+
|
|
26
|
+
.s-chart__grid line {
|
|
27
|
+
stroke: var(--s-chart-grid);
|
|
28
|
+
stroke-width: 1;
|
|
29
|
+
vector-effect: non-scaling-stroke;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.s-chart__axis line {
|
|
33
|
+
stroke: var(--s-chart-axis);
|
|
34
|
+
stroke-width: 1;
|
|
35
|
+
vector-effect: non-scaling-stroke;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.s-chart__axis text,
|
|
39
|
+
.s-chart__data-label {
|
|
40
|
+
fill: var(--s-chart-label);
|
|
41
|
+
font-family: var(--font-sans);
|
|
42
|
+
font-size: 11px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.s-chart[data-size='compact'] .s-chart__axis text,
|
|
46
|
+
.s-chart[data-size='compact'] .s-chart__data-label { font-size: 9px; }
|
|
47
|
+
|
|
48
|
+
.s-chart__axis .s-chart__axis-title {
|
|
49
|
+
fill: var(--s-chart-axis-title);
|
|
50
|
+
font-weight: 600;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.s-chart__line {
|
|
54
|
+
fill: none;
|
|
55
|
+
stroke: var(--s-chart-tone);
|
|
56
|
+
stroke-linecap: round;
|
|
57
|
+
stroke-linejoin: round;
|
|
58
|
+
stroke-width: 2.5;
|
|
59
|
+
vector-effect: non-scaling-stroke;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.s-chart[data-size='compact'] .s-chart__line { stroke-width: 2; }
|
|
63
|
+
|
|
64
|
+
.s-chart__area {
|
|
65
|
+
fill: color-mix(in srgb, var(--s-chart-tone) 20%, transparent);
|
|
66
|
+
stroke: none;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.s-chart__marker {
|
|
70
|
+
fill: var(--s-chart-surface);
|
|
71
|
+
stroke: var(--s-chart-tone);
|
|
72
|
+
stroke-width: 2.5;
|
|
73
|
+
vector-effect: non-scaling-stroke;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.s-chart__bar,
|
|
77
|
+
.s-chart__slice {
|
|
78
|
+
fill: var(--s-chart-tone);
|
|
79
|
+
stroke: var(--s-chart-surface);
|
|
80
|
+
stroke-width: 1;
|
|
81
|
+
vector-effect: non-scaling-stroke;
|
|
82
|
+
transition: opacity var(--s-motion-fast) ease;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.s-chart__bar:hover,
|
|
86
|
+
.s-chart__slice:hover { opacity: 0.82; }
|
|
87
|
+
|
|
88
|
+
.s-chart__radial-label {
|
|
89
|
+
fill: var(--s-chart-label-on-series);
|
|
90
|
+
font-family: var(--font-sans);
|
|
91
|
+
font-size: 11px;
|
|
92
|
+
font-weight: 700;
|
|
93
|
+
paint-order: stroke;
|
|
94
|
+
stroke: color-mix(in srgb, var(--color-surface-950) 28%, transparent);
|
|
95
|
+
stroke-width: 2px;
|
|
96
|
+
stroke-linejoin: round;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.s-chart__center {
|
|
100
|
+
fill: var(--s-chart-center-label);
|
|
101
|
+
font-family: var(--font-sans);
|
|
102
|
+
font-size: 20px;
|
|
103
|
+
font-weight: 700;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.s-chart__center-label {
|
|
107
|
+
fill: var(--s-chart-label);
|
|
108
|
+
font-size: 10px;
|
|
109
|
+
font-weight: 500;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.s-chart__legend {
|
|
113
|
+
@apply flex min-w-0 flex-wrap items-center text-xs text-surface-600 dark:text-surface-300;
|
|
114
|
+
gap: var(--s-space-content-gap);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.s-chart__legend[data-position='top'] { @apply justify-start; }
|
|
118
|
+
.s-chart__legend[data-position='bottom'] { @apply justify-center; }
|
|
119
|
+
.s-chart__legend-item { @apply inline-flex min-w-0 items-center gap-1.5; }
|
|
120
|
+
|
|
121
|
+
.s-chart__legend-swatch {
|
|
122
|
+
@apply block h-2.5 w-2.5 shrink-0 rounded-full;
|
|
123
|
+
background: var(--s-chart-tone);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.s-chart__data-table { @apply w-full border-collapse overflow-hidden rounded-md text-left text-sm; }
|
|
127
|
+
|
|
128
|
+
.s-chart__data-table th,
|
|
129
|
+
.s-chart__data-table td { @apply border-b border-surface-200 px-3 py-2 dark:border-surface-700; }
|
|
130
|
+
|
|
131
|
+
.s-chart__data-table thead th {
|
|
132
|
+
@apply bg-surface-100 font-semibold text-surface-700 dark:bg-surface-800 dark:text-surface-200;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.s-chart__data-table tbody th { @apply font-medium; }
|
|
136
|
+
.s-chart__data-table tbody td { @apply tabular-nums; }
|
|
137
|
+
.s-chart__data-table--assistive { @apply sr-only; }
|
|
138
|
+
|
|
139
|
+
[data-s-chart-tone='series-1'] { --s-chart-tone: var(--s-chart-series-1); }
|
|
140
|
+
[data-s-chart-tone='series-2'] { --s-chart-tone: var(--s-chart-series-2); }
|
|
141
|
+
[data-s-chart-tone='series-3'] { --s-chart-tone: var(--s-chart-series-3); }
|
|
142
|
+
[data-s-chart-tone='series-4'] { --s-chart-tone: var(--s-chart-series-4); }
|
|
143
|
+
[data-s-chart-tone='series-5'] { --s-chart-tone: var(--s-chart-series-5); }
|
|
144
|
+
[data-s-chart-tone='series-6'] { --s-chart-tone: var(--s-chart-series-6); }
|
|
145
|
+
[data-s-chart-tone='series-7'] { --s-chart-tone: var(--s-chart-series-7); }
|
|
146
|
+
[data-s-chart-tone='series-8'] { --s-chart-tone: var(--s-chart-series-8); }
|
|
147
|
+
[data-s-chart-tone='success'] { --s-chart-tone: var(--color-success-500); }
|
|
148
|
+
[data-s-chart-tone='warn'] { --s-chart-tone: var(--color-warn-500); }
|
|
149
|
+
[data-s-chart-tone='danger'] { --s-chart-tone: var(--color-danger-500); }
|