@pgcorp/ui-kit 0.1.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/package.json +19 -3
- package/src/components/layout/SSideMenuButton.vue +5 -4
- package/src/components/layout/SSideMenuRail.vue +3 -6
- package/src/components/layout/SStack.css +9 -3
- package/src/components/layout/SStack.vue +10 -2
- package/src/components/shared/_internal/STreeNode.vue +10 -4
- package/src/components/shared/_internal/sidebarGroupContext.ts +3 -1
- package/src/components/shared/_internal/tabsContext.ts +1 -0
- package/src/components/shared/containers/SLeftSidebar.vue +2 -2
- package/src/components/shared/containers/SPageHeader.css +11 -0
- package/src/components/shared/containers/SPageHeader.vue +7 -1
- package/src/components/shared/containers/SPanel.css +7 -1
- package/src/components/shared/containers/SPanel.vue +5 -1
- package/src/components/shared/containers/SSidebarGroup.css +1 -1
- package/src/components/shared/containers/SSidebarGroup.vue +113 -94
- package/src/components/shared/containers/SSidebarSection.css +16 -4
- package/src/components/shared/containers/SSidebarSection.vue +15 -16
- package/src/components/shared/controls/SButton.css +39 -0
- package/src/components/shared/controls/SButton.vue +146 -29
- package/src/components/shared/controls/SCombobox.css +9 -0
- package/src/components/shared/controls/SCombobox.vue +322 -0
- package/src/components/shared/controls/SContextToggleButton.vue +1 -1
- package/src/components/shared/controls/SInputText.vue +15 -0
- package/src/components/shared/controls/SInteractiveSurface.css +4 -0
- package/src/components/shared/controls/SInteractiveSurface.vue +4 -0
- package/src/components/shared/controls/SListbox.vue +99 -1
- package/src/components/shared/controls/SListboxOption.vue +15 -2
- package/src/components/shared/controls/SRange.css +35 -0
- package/src/components/shared/controls/SRange.vue +129 -0
- package/src/components/shared/controls/SSwitch.css +48 -0
- package/src/components/shared/controls/SSwitch.vue +109 -0
- package/src/components/shared/controls/_internal/SInlineTokenSurface.vue +6 -3
- package/src/components/shared/data-display/SChip.css +59 -0
- package/src/components/shared/data-display/SChip.vue +92 -0
- package/src/components/shared/data-display/SCodeBlock.vue +1 -1
- package/src/components/shared/data-display/SCodeEditor.css +15 -0
- package/src/components/shared/data-display/SCodeEditor.vue +14 -0
- package/src/components/shared/data-display/STable.vue +107 -3
- package/src/components/shared/data-display/table.ts +9 -0
- package/src/components/shared/navigation/SBottomNav.vue +3 -0
- package/src/components/shared/navigation/STab.vue +31 -6
- package/src/components/shared/navigation/STabs.vue +8 -2
- package/src/internal/codeEditorContract.ts +1 -1
- package/src/internal/ownedAttrs.ts +31 -2
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
:data-list-width="tabListWidth"
|
|
12
12
|
:data-tone="tone"
|
|
13
13
|
:data-close-mode="closeButtonMode"
|
|
14
|
+
:data-close-visibility="closeButtonVisibility"
|
|
14
15
|
:data-radius="surfaceRadius"
|
|
15
16
|
:data-surface="surface"
|
|
16
17
|
:data-has-panels="composition === 'custom' ? 'custom' : ($slots.panels ? 'true' : 'false')"
|
|
@@ -121,6 +122,8 @@ export interface Props {
|
|
|
121
122
|
tabDensity?: 'compact' | 'default' | 'comfortable'
|
|
122
123
|
/** Резервирует или перекрывает место sibling close action. / Reserves or overlays sibling close-action space. */
|
|
123
124
|
closeButtonMode?: 'reserve' | 'overlay'
|
|
125
|
+
/** Видимость sibling close/action region. / Visibility policy for the sibling close/action region. */
|
|
126
|
+
closeButtonVisibility?: 'always' | 'active-hover' | 'hover'
|
|
124
127
|
/** Скругление owner surface. / Radius of the owner surface. */
|
|
125
128
|
surfaceRadius?: 'default' | 'none'
|
|
126
129
|
/** Фон owner surface. / Background of the owner surface. */
|
|
@@ -156,6 +159,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
156
159
|
tabListWidth: 'auto',
|
|
157
160
|
tabDensity: 'default',
|
|
158
161
|
closeButtonMode: 'reserve',
|
|
162
|
+
closeButtonVisibility: 'always',
|
|
159
163
|
surfaceRadius: 'default',
|
|
160
164
|
surface: 'default',
|
|
161
165
|
})
|
|
@@ -236,6 +240,7 @@ const activeKey = computed<string | null>(() => (
|
|
|
236
240
|
))
|
|
237
241
|
const activationMode = computed(() => props.activationMode)
|
|
238
242
|
const closeMode = computed(() => props.closeButtonMode)
|
|
243
|
+
const closeVisibility = computed(() => props.closeButtonVisibility)
|
|
239
244
|
const density = computed(() => props.tabDensity)
|
|
240
245
|
|
|
241
246
|
function identityIds(tabKey: string): { tabId: string; panelId: string } {
|
|
@@ -456,6 +461,7 @@ const context: STabsContext = {
|
|
|
456
461
|
activeKey,
|
|
457
462
|
activationMode,
|
|
458
463
|
closeButtonMode: closeMode,
|
|
464
|
+
closeButtonVisibility: closeVisibility,
|
|
459
465
|
tabDensity: density,
|
|
460
466
|
registerTab,
|
|
461
467
|
unregisterTab,
|
|
@@ -522,7 +528,7 @@ defineExpose({
|
|
|
522
528
|
--s-tab-base-padding-inline: 1rem;
|
|
523
529
|
--s-tab-padding-inline: var(--s-tab-base-padding-inline);
|
|
524
530
|
--s-tab-padding-block: 0;
|
|
525
|
-
--s-tab-content-offset-y:
|
|
531
|
+
--s-tab-content-offset-y: 0;
|
|
526
532
|
--s-tab-trigger-min-height: var(--s-control-hitbox-sm);
|
|
527
533
|
--s-tab-indicator-width: 2px;
|
|
528
534
|
--s-tab-radius: 0.375rem 0.375rem 0 0;
|
|
@@ -575,7 +581,7 @@ defineExpose({
|
|
|
575
581
|
|
|
576
582
|
.s-tabs[data-density='compact'] { --s-tab-row-height: 2rem; --s-tab-base-padding-inline: 0.5rem; }
|
|
577
583
|
.s-tabs[data-density='comfortable'] { --s-tab-row-height: 3rem; --s-tab-base-padding-inline: 1.125rem; }
|
|
578
|
-
.s-tabs[data-sizing='content'] { --s-tab-min-width:
|
|
584
|
+
.s-tabs[data-sizing='content'] { --s-tab-min-width: 0; --s-tab-max-width: 15rem; }
|
|
579
585
|
.s-tabs[data-sizing='compact'] { --s-tab-max-width: 10.5rem; }
|
|
580
586
|
.s-tabs[data-sizing='wide'] { --s-tab-max-width: 20rem; }
|
|
581
587
|
.s-tabs[data-sizing='equal'] {
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
validateNonEmptyString,
|
|
6
6
|
} from './runtimeContract'
|
|
7
7
|
|
|
8
|
-
export const CODE_EDITOR_VIEWPORTS = ['content', 'compact', 'standard', 'expanded', 'fill'] as const
|
|
8
|
+
export const CODE_EDITOR_VIEWPORTS = ['content', 'document', 'compact', 'standard', 'expanded', 'fill'] as const
|
|
9
9
|
export const CODE_EDITOR_VARIANTS = ['code', 'sql'] as const
|
|
10
10
|
export const CODE_EDITOR_KEY_BEHAVIORS = ['indent', 'focus-next'] as const
|
|
11
11
|
export const CODE_EDITOR_CURSOR_ACTIVITY_MODES = ['editable', 'always'] as const
|
|
@@ -126,6 +126,13 @@ export const ownedAttributeSchemas = Object.freeze({
|
|
|
126
126
|
onPointerdown: 'listener',
|
|
127
127
|
tabindex: 'string-or-number',
|
|
128
128
|
}),
|
|
129
|
+
SSwitch: defineOwnedAttributeSchema({
|
|
130
|
+
'aria-label': 'string',
|
|
131
|
+
'aria-describedby': 'string',
|
|
132
|
+
onClick: 'listener',
|
|
133
|
+
onPointerdown: 'listener',
|
|
134
|
+
tabindex: 'string-or-number',
|
|
135
|
+
}),
|
|
129
136
|
SCheckboxGroup: defineOwnedAttributeSchema({
|
|
130
137
|
'aria-describedby': 'string',
|
|
131
138
|
'data-testid': 'data',
|
|
@@ -137,6 +144,10 @@ export const ownedAttributeSchemas = Object.freeze({
|
|
|
137
144
|
SColorSelect: defineOwnedAttributeSchema({
|
|
138
145
|
'aria-label': 'string',
|
|
139
146
|
}),
|
|
147
|
+
SCombobox: defineOwnedAttributeSchema({
|
|
148
|
+
'aria-describedby': 'string',
|
|
149
|
+
'aria-label': 'string',
|
|
150
|
+
}),
|
|
140
151
|
SDragHandle: defineOwnedAttributeSchema({
|
|
141
152
|
'data-testid': 'data',
|
|
142
153
|
}),
|
|
@@ -158,7 +169,12 @@ export const ownedAttributeSchemas = Object.freeze({
|
|
|
158
169
|
title: 'string',
|
|
159
170
|
}),
|
|
160
171
|
SInputText: defineOwnedAttributeSchema({
|
|
172
|
+
'aria-activedescendant': 'string',
|
|
173
|
+
'aria-autocomplete': 'string',
|
|
174
|
+
'aria-controls': 'string',
|
|
161
175
|
'aria-describedby': 'string',
|
|
176
|
+
'aria-expanded': 'aria-boolean',
|
|
177
|
+
'aria-haspopup': 'aria-haspopup',
|
|
162
178
|
'aria-invalid': 'aria-boolean',
|
|
163
179
|
'aria-label': 'string',
|
|
164
180
|
'data-testid': 'data',
|
|
@@ -168,13 +184,22 @@ export const ownedAttributeSchemas = Object.freeze({
|
|
|
168
184
|
max: 'string-or-number',
|
|
169
185
|
min: 'string-or-number',
|
|
170
186
|
onBlur: 'listener',
|
|
187
|
+
onClick: 'listener',
|
|
171
188
|
onFocus: 'listener',
|
|
172
189
|
onKeydown: 'listener',
|
|
173
190
|
onKeyup: 'listener',
|
|
174
191
|
pattern: 'string',
|
|
192
|
+
role: 'string',
|
|
175
193
|
step: 'string-or-number',
|
|
176
194
|
title: 'string',
|
|
177
195
|
}),
|
|
196
|
+
SRange: defineOwnedAttributeSchema({
|
|
197
|
+
'aria-describedby': 'string',
|
|
198
|
+
'aria-label': 'string',
|
|
199
|
+
'data-testid': 'data',
|
|
200
|
+
onBlur: 'listener',
|
|
201
|
+
onFocus: 'listener',
|
|
202
|
+
}),
|
|
178
203
|
SInlineTokenEditor: defineOwnedAttributeSchema({
|
|
179
204
|
'aria-describedby': 'string',
|
|
180
205
|
'aria-label': 'string',
|
|
@@ -230,6 +255,10 @@ export const ownedAttributeSchemas = Object.freeze({
|
|
|
230
255
|
'data-testid': 'data',
|
|
231
256
|
title: 'string',
|
|
232
257
|
}),
|
|
258
|
+
SChip: defineOwnedAttributeSchema({
|
|
259
|
+
'aria-label': 'string',
|
|
260
|
+
title: 'string',
|
|
261
|
+
}),
|
|
233
262
|
SCodeBlock: defineOwnedAttributeSchema({
|
|
234
263
|
'aria-label': 'string',
|
|
235
264
|
'data-testid': 'data',
|
|
@@ -331,7 +360,7 @@ type OwnedAttributeValue<Name extends string, Kind extends OwnedAttributeValueKi
|
|
|
331
360
|
|
|
332
361
|
export type OwnedAttributeBindings<Component extends OwnedAttributeComponent> = Readonly<Partial<{
|
|
333
362
|
[Name in OwnedAttributeName<Component>]: OwnedAttributeValue<Name, OwnedAttributeKind<Component, Name>>
|
|
334
|
-
}
|
|
363
|
+
}> & Partial<Record<`data-${string}`, string | number | boolean>>>
|
|
335
364
|
|
|
336
365
|
export interface OwnedAttrsOptions<Component extends OwnedAttributeComponent> {
|
|
337
366
|
/** Имя public-компонента для диагностики контракта. / Public component name used in contract diagnostics. */
|
|
@@ -413,7 +442,7 @@ export function useOwnedAttrs<Component extends OwnedAttributeComponent>(
|
|
|
413
442
|
`raw "${name}" запрещён; атрибут "${name}" не объявлен в exact owned-attrs schema; используйте типизированные props/tokens UI-kit или consumer layout wrapper. Raw "${name}" is forbidden and is not declared by the exact owned-attrs schema; use typed UI-kit props/tokens or a consumer layout wrapper`,
|
|
414
443
|
)
|
|
415
444
|
}
|
|
416
|
-
const kind = schema[name]
|
|
445
|
+
const kind = schema[name] ?? (name.startsWith('data-') && name.length > 5 ? 'data' : undefined)
|
|
417
446
|
if (!kind) {
|
|
418
447
|
throw attributeBoundaryError(
|
|
419
448
|
options.component,
|