@pgcorp/ui-kit 0.1.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 (251) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +157 -0
  3. package/docs/accessibility.md +27 -0
  4. package/docs/getting-started.md +80 -0
  5. package/docs/licensing.md +30 -0
  6. package/docs/public-api.md +39 -0
  7. package/docs/security.md +21 -0
  8. package/docs/theming.md +35 -0
  9. package/docs/versioning.md +23 -0
  10. package/index.ts +3 -0
  11. package/package.json +592 -0
  12. package/src/components/icons/_internal/generatedSputnigUiIconMarkup.ts +971 -0
  13. package/src/components/icons/sputnigUiIcons.ts +530 -0
  14. package/src/components/layout/SAppShell.vue +232 -0
  15. package/src/components/layout/SDockRegion.vue +200 -0
  16. package/src/components/layout/SResizeHandle.vue +251 -0
  17. package/src/components/layout/SSideMenuButton.vue +104 -0
  18. package/src/components/layout/SSideMenuRail.vue +47 -0
  19. package/src/components/layout/SStack.css +25 -0
  20. package/src/components/layout/SStack.vue +57 -0
  21. package/src/components/layout/SStatusBarShell.css +15 -0
  22. package/src/components/layout/SStatusBarShell.vue +26 -0
  23. package/src/components/layout/SWorkbenchLayout.vue +53 -0
  24. package/src/components/layout/SWorkbenchPanelShell.css +161 -0
  25. package/src/components/layout/SWorkbenchPanelShell.vue +286 -0
  26. package/src/components/layout/_internal/SAppBrand.css +45 -0
  27. package/src/components/layout/_internal/SAppBrand.vue +37 -0
  28. package/src/components/layout/_internal/SAppBrandContent.vue +30 -0
  29. package/src/components/layout/types.ts +28 -0
  30. package/src/components/shared/_internal/SDialogSurface.css +127 -0
  31. package/src/components/shared/_internal/SDialogSurface.vue +117 -0
  32. package/src/components/shared/_internal/SDisclosureSummary.css +92 -0
  33. package/src/components/shared/_internal/SDisclosureSummary.vue +121 -0
  34. package/src/components/shared/_internal/SListboxGroup.css +18 -0
  35. package/src/components/shared/_internal/SListboxGroup.vue +24 -0
  36. package/src/components/shared/_internal/SMenuItem.css +112 -0
  37. package/src/components/shared/_internal/SMenuItem.vue +213 -0
  38. package/src/components/shared/_internal/SMenuLayer.css +21 -0
  39. package/src/components/shared/_internal/SMenuLayer.vue +48 -0
  40. package/src/components/shared/_internal/SMenuSeparator.css +5 -0
  41. package/src/components/shared/_internal/SMenuSeparator.vue +13 -0
  42. package/src/components/shared/_internal/SToastItem.css +65 -0
  43. package/src/components/shared/_internal/SToastItem.vue +58 -0
  44. package/src/components/shared/_internal/STreeNode.vue +761 -0
  45. package/src/components/shared/_internal/dialogSurface.ts +105 -0
  46. package/src/components/shared/_internal/focusTrap.ts +40 -0
  47. package/src/components/shared/_internal/listboxContext.ts +16 -0
  48. package/src/components/shared/_internal/markerContract.ts +10 -0
  49. package/src/components/shared/_internal/menuContext.ts +23 -0
  50. package/src/components/shared/_internal/selectionContract.ts +239 -0
  51. package/src/components/shared/_internal/sidebarGroupContext.ts +31 -0
  52. package/src/components/shared/_internal/tabsContext.ts +57 -0
  53. package/src/components/shared/_internal/treeRuntime.ts +203 -0
  54. package/src/components/shared/_internal/useSelectionRoving.ts +162 -0
  55. package/src/components/shared/codeLanguages.ts +168 -0
  56. package/src/components/shared/complex/SKanbanCard.css +8 -0
  57. package/src/components/shared/complex/SKanbanCard.vue +76 -0
  58. package/src/components/shared/complex/SKanbanLane.vue +82 -0
  59. package/src/components/shared/complex/STree.css +24 -0
  60. package/src/components/shared/complex/STree.vue +288 -0
  61. package/src/components/shared/complex/treeAdapter.ts +210 -0
  62. package/src/components/shared/complex/types.ts +102 -0
  63. package/src/components/shared/containers/SCloudChrome.css +103 -0
  64. package/src/components/shared/containers/SCloudChrome.vue +87 -0
  65. package/src/components/shared/containers/SCloudChromeEmpty.css +10 -0
  66. package/src/components/shared/containers/SCloudChromeEmpty.vue +18 -0
  67. package/src/components/shared/containers/SCloudChromeRow.css +78 -0
  68. package/src/components/shared/containers/SCloudChromeRow.vue +108 -0
  69. package/src/components/shared/containers/SCollapsiblePanel.css +57 -0
  70. package/src/components/shared/containers/SCollapsiblePanel.vue +360 -0
  71. package/src/components/shared/containers/SDrawer.css +60 -0
  72. package/src/components/shared/containers/SDrawer.vue +86 -0
  73. package/src/components/shared/containers/SFormGrid.css +26 -0
  74. package/src/components/shared/containers/SFormGrid.vue +46 -0
  75. package/src/components/shared/containers/SFormGridItem.css +18 -0
  76. package/src/components/shared/containers/SFormGridItem.vue +29 -0
  77. package/src/components/shared/containers/SLeftSidebar.vue +74 -0
  78. package/src/components/shared/containers/SModal.css +27 -0
  79. package/src/components/shared/containers/SModal.vue +105 -0
  80. package/src/components/shared/containers/SPageHeader.css +66 -0
  81. package/src/components/shared/containers/SPageHeader.vue +45 -0
  82. package/src/components/shared/containers/SPanel.css +134 -0
  83. package/src/components/shared/containers/SPanel.vue +169 -0
  84. package/src/components/shared/containers/SPopover.css +35 -0
  85. package/src/components/shared/containers/SPopover.vue +551 -0
  86. package/src/components/shared/containers/SSidebarGroup.css +12 -0
  87. package/src/components/shared/containers/SSidebarGroup.vue +443 -0
  88. package/src/components/shared/containers/SSidebarSection.css +41 -0
  89. package/src/components/shared/containers/SSidebarSection.vue +268 -0
  90. package/src/components/shared/containers/disclosureSummary.ts +48 -0
  91. package/src/components/shared/containers/popover.ts +72 -0
  92. package/src/components/shared/containers/sidebar.ts +206 -0
  93. package/src/components/shared/controls/SButton.css +274 -0
  94. package/src/components/shared/controls/SButton.vue +211 -0
  95. package/src/components/shared/controls/SCheckbox.css +65 -0
  96. package/src/components/shared/controls/SCheckbox.vue +130 -0
  97. package/src/components/shared/controls/SCheckboxGroup.vue +134 -0
  98. package/src/components/shared/controls/SChoiceCards.css +29 -0
  99. package/src/components/shared/controls/SChoiceCards.vue +145 -0
  100. package/src/components/shared/controls/SColorSelect.vue +146 -0
  101. package/src/components/shared/controls/SComboboxTrigger.css +35 -0
  102. package/src/components/shared/controls/SComboboxTrigger.vue +122 -0
  103. package/src/components/shared/controls/SContextMenu.css +11 -0
  104. package/src/components/shared/controls/SContextMenu.vue +186 -0
  105. package/src/components/shared/controls/SContextToggleButton.vue +64 -0
  106. package/src/components/shared/controls/SDragHandle.vue +100 -0
  107. package/src/components/shared/controls/SDropdownMenu.css +5 -0
  108. package/src/components/shared/controls/SDropdownMenu.vue +188 -0
  109. package/src/components/shared/controls/SField.css +79 -0
  110. package/src/components/shared/controls/SField.vue +89 -0
  111. package/src/components/shared/controls/SFieldGroup.css +58 -0
  112. package/src/components/shared/controls/SFieldGroup.vue +117 -0
  113. package/src/components/shared/controls/SFieldLabel.css +12 -0
  114. package/src/components/shared/controls/SFieldLabel.vue +51 -0
  115. package/src/components/shared/controls/SInlineTokenEditor.css +61 -0
  116. package/src/components/shared/controls/SInlineTokenEditor.vue +1081 -0
  117. package/src/components/shared/controls/SInputText.css +66 -0
  118. package/src/components/shared/controls/SInputText.vue +321 -0
  119. package/src/components/shared/controls/SInteractiveSurface.css +72 -0
  120. package/src/components/shared/controls/SInteractiveSurface.vue +326 -0
  121. package/src/components/shared/controls/SLink.css +114 -0
  122. package/src/components/shared/controls/SLink.ts +85 -0
  123. package/src/components/shared/controls/SLink.vue +114 -0
  124. package/src/components/shared/controls/SListbox.css +31 -0
  125. package/src/components/shared/controls/SListbox.vue +388 -0
  126. package/src/components/shared/controls/SListboxOption.css +63 -0
  127. package/src/components/shared/controls/SListboxOption.vue +85 -0
  128. package/src/components/shared/controls/SMarker.css +19 -0
  129. package/src/components/shared/controls/SMarker.vue +33 -0
  130. package/src/components/shared/controls/SMenuSurface.css +20 -0
  131. package/src/components/shared/controls/SMenuSurface.vue +333 -0
  132. package/src/components/shared/controls/SSegmentedControl.css +38 -0
  133. package/src/components/shared/controls/SSegmentedControl.vue +134 -0
  134. package/src/components/shared/controls/SSelect.css +12 -0
  135. package/src/components/shared/controls/SSelect.vue +338 -0
  136. package/src/components/shared/controls/STextarea.css +31 -0
  137. package/src/components/shared/controls/STextarea.vue +316 -0
  138. package/src/components/shared/controls/_internal/SInlineTokenSurface.vue +224 -0
  139. package/src/components/shared/controls/menu.ts +178 -0
  140. package/src/components/shared/data-display/SActionCard.css +6 -0
  141. package/src/components/shared/data-display/SActionCard.vue +49 -0
  142. package/src/components/shared/data-display/SActionList.css +15 -0
  143. package/src/components/shared/data-display/SActionList.vue +34 -0
  144. package/src/components/shared/data-display/SActionListItem.css +114 -0
  145. package/src/components/shared/data-display/SActionListItem.vue +230 -0
  146. package/src/components/shared/data-display/SBadge.css +73 -0
  147. package/src/components/shared/data-display/SBadge.vue +52 -0
  148. package/src/components/shared/data-display/SCodeBlock.css +56 -0
  149. package/src/components/shared/data-display/SCodeBlock.vue +188 -0
  150. package/src/components/shared/data-display/SCodeEditor.css +178 -0
  151. package/src/components/shared/data-display/SCodeEditor.vue +274 -0
  152. package/src/components/shared/data-display/SCodeSearchPanel.vue +327 -0
  153. package/src/components/shared/data-display/SCopyField.vue +77 -0
  154. package/src/components/shared/data-display/SDocBlock.css +136 -0
  155. package/src/components/shared/data-display/SDocBlock.vue +358 -0
  156. package/src/components/shared/data-display/SEmptyState.css +42 -0
  157. package/src/components/shared/data-display/SEmptyState.vue +79 -0
  158. package/src/components/shared/data-display/SExpandableText.vue +314 -0
  159. package/src/components/shared/data-display/SJsonTree.css +6 -0
  160. package/src/components/shared/data-display/SJsonTree.vue +111 -0
  161. package/src/components/shared/data-display/SKeyValueGrid.css +37 -0
  162. package/src/components/shared/data-display/SKeyValueGrid.vue +277 -0
  163. package/src/components/shared/data-display/SLinkedSystemsList.vue +270 -0
  164. package/src/components/shared/data-display/SMessage.css +88 -0
  165. package/src/components/shared/data-display/SMessage.vue +152 -0
  166. package/src/components/shared/data-display/SMetricCard.css +32 -0
  167. package/src/components/shared/data-display/SMetricCard.vue +117 -0
  168. package/src/components/shared/data-display/SProgressBar.css +84 -0
  169. package/src/components/shared/data-display/SProgressBar.vue +114 -0
  170. package/src/components/shared/data-display/SProgressIndicator.css +59 -0
  171. package/src/components/shared/data-display/SProgressIndicator.vue +104 -0
  172. package/src/components/shared/data-display/SSectionHeader.css +84 -0
  173. package/src/components/shared/data-display/SSectionHeader.vue +58 -0
  174. package/src/components/shared/data-display/SStatus.css +90 -0
  175. package/src/components/shared/data-display/SStatus.vue +79 -0
  176. package/src/components/shared/data-display/STable.css +83 -0
  177. package/src/components/shared/data-display/STable.vue +339 -0
  178. package/src/components/shared/data-display/SToastContainer.css +53 -0
  179. package/src/components/shared/data-display/SToastContainer.vue +31 -0
  180. package/src/components/shared/data-display/STooltip.css +114 -0
  181. package/src/components/shared/data-display/STooltip.vue +550 -0
  182. package/src/components/shared/data-display/STooltipAnchor.css +21 -0
  183. package/src/components/shared/data-display/STooltipAnchor.vue +119 -0
  184. package/src/components/shared/data-display/SVirtualList.css +24 -0
  185. package/src/components/shared/data-display/SVirtualList.ts +19 -0
  186. package/src/components/shared/data-display/SVirtualList.vue +361 -0
  187. package/src/components/shared/data-display/json.ts +136 -0
  188. package/src/components/shared/data-display/table.ts +76 -0
  189. package/src/components/shared/database/SDataGrid.css +3 -0
  190. package/src/components/shared/database/SDataGrid.vue +464 -0
  191. package/src/components/shared/database/SSqlEditor.vue +363 -0
  192. package/src/components/shared/database/dataGrid.ts +61 -0
  193. package/src/components/shared/feedback/SAsyncState.css +26 -0
  194. package/src/components/shared/feedback/SAsyncState.vue +190 -0
  195. package/src/components/shared/graph/SGraphViewport.ts +1 -0
  196. package/src/components/shared/graph/SGraphViewport.vue +858 -0
  197. package/src/components/shared/graph/_internal/graphViewportContract.ts +362 -0
  198. package/src/components/shared/markdown.ts +169 -0
  199. package/src/components/shared/navigation/SBottomNav.vue +692 -0
  200. package/src/components/shared/navigation/SBreadcrumbs.css +26 -0
  201. package/src/components/shared/navigation/SBreadcrumbs.vue +155 -0
  202. package/src/components/shared/navigation/SCatalogNavigator.css +100 -0
  203. package/src/components/shared/navigation/SCatalogNavigator.vue +308 -0
  204. package/src/components/shared/navigation/STab.vue +363 -0
  205. package/src/components/shared/navigation/STabList.vue +442 -0
  206. package/src/components/shared/navigation/STabPanel.vue +165 -0
  207. package/src/components/shared/navigation/STabPanels.vue +33 -0
  208. package/src/components/shared/navigation/STabs.vue +617 -0
  209. package/src/components/shared/navigation/SWizardSteps.css +69 -0
  210. package/src/components/shared/navigation/SWizardSteps.vue +171 -0
  211. package/src/components/shared/navigation/_internal/SCatalogNavigatorGroup.vue +63 -0
  212. package/src/components/shared/persona/SPersonaProjectPicker.css +36 -0
  213. package/src/components/shared/persona/SPersonaProjectPicker.vue +361 -0
  214. package/src/components/shared/persona/SPersonaRunWorkbench.css +109 -0
  215. package/src/components/shared/persona/SPersonaRunWorkbench.vue +549 -0
  216. package/src/components/shared/persona/_internal/SPersonaRunConsole.css +40 -0
  217. package/src/components/shared/persona/_internal/SPersonaRunConsole.vue +298 -0
  218. package/src/components/shared/persona/_internal/inventory.ts +110 -0
  219. package/src/components/shared/persona/_internal/labels.ts +79 -0
  220. package/src/components/shared/persona/presentation.ts +371 -0
  221. package/src/components/shared/persona/types.ts +256 -0
  222. package/src/composables/uiPreferencesReset.ts +52 -0
  223. package/src/composables/useClipboard.ts +37 -0
  224. package/src/composables/useDialogOverlay.ts +85 -0
  225. package/src/composables/useDisclosure.ts +40 -0
  226. package/src/composables/useFloatingPosition.ts +245 -0
  227. package/src/composables/useNotifier.ts +26 -0
  228. package/src/composables/useSidebarPanelState.ts +610 -0
  229. package/src/internal/codeEditorContract.ts +110 -0
  230. package/src/internal/codeEditorExtensions.ts +27 -0
  231. package/src/internal/feedbackPresentation.ts +136 -0
  232. package/src/internal/fieldSurface.ts +59 -0
  233. package/src/internal/focusNavigation.ts +69 -0
  234. package/src/internal/inlineTokenEditorContract.ts +136 -0
  235. package/src/internal/interactiveElement.ts +33 -0
  236. package/src/internal/layerStack.ts +202 -0
  237. package/src/internal/linkTarget.ts +256 -0
  238. package/src/internal/ownedAttrs.ts +464 -0
  239. package/src/internal/passiveContentContract.ts +129 -0
  240. package/src/internal/pointerInteractionLease.ts +81 -0
  241. package/src/internal/runtimeContract.ts +194 -0
  242. package/src/internal/runtimeTheme.ts +159 -0
  243. package/src/internal/semanticSizing.ts +60 -0
  244. package/src/internal/useMenuLayer.ts +129 -0
  245. package/src/stores/useNotifierStore.ts +69 -0
  246. package/src/styles/reference.css +4 -0
  247. package/src/styles/style.css +151 -0
  248. package/src/styles/tokens.css +836 -0
  249. package/src/theme.ts +449 -0
  250. package/src/types/highlight-js-lib.d.ts +76 -0
  251. package/src/variants.ts +15 -0
@@ -0,0 +1,89 @@
1
+ <template>
2
+ <div
3
+ v-bind="ownedAttrs.bindings()"
4
+ class="s-field"
5
+ :class="`s-field--${layout}`"
6
+ :data-disabled="disabled || undefined"
7
+ :data-readonly="readonly || undefined"
8
+ :data-invalid="isInvalid || undefined"
9
+ :data-fill="fill"
10
+ >
11
+ <label v-if="hasLabel" :id="labelId" class="s-field__label" :for="controlId">
12
+ <slot name="label">{{ label }}</slot>
13
+ <span v-if="required" class="s-field__required" aria-hidden="true">*</span>
14
+ </label>
15
+
16
+ <div class="s-field__control">
17
+ <slot
18
+ :control-id="controlId"
19
+ :labelled-by="hasLabel ? labelId : undefined"
20
+ :described-by="describedBy"
21
+ :invalid="isInvalid"
22
+ :disabled="disabled"
23
+ :readonly="readonly"
24
+ :required="required"
25
+ />
26
+ </div>
27
+
28
+ <p v-if="helpText || $slots.help" :id="helpId" class="s-field__help">
29
+ <slot name="help">{{ helpText }}</slot>
30
+ </p>
31
+ <p v-if="isInvalid && (errorMessage || $slots.error)" :id="errorId" class="s-field__error">
32
+ <slot name="error">{{ errorMessage }}</slot>
33
+ </p>
34
+ </div>
35
+ </template>
36
+
37
+ <script setup lang="ts">
38
+ import { computed, useSlots } from 'vue'
39
+ import { useOwnedAttrs } from '../../../internal/ownedAttrs'
40
+
41
+ defineOptions({ inheritAttrs: false })
42
+
43
+ /** Расположение подписи относительно control-region. / Label placement relative to the control region. */
44
+ export type SFieldLayout = 'stacked' | 'inline'
45
+
46
+ /** Высота field-root и его control-region. / Height contract for the field root and control region. */
47
+ export type SFieldFill = 'content' | 'container'
48
+
49
+ export interface Props {
50
+ controlId: string
51
+ label?: string
52
+ required?: boolean
53
+ helpText?: string
54
+ errorMessage?: string
55
+ invalid?: boolean
56
+ disabled?: boolean
57
+ readonly?: boolean
58
+ layout?: SFieldLayout
59
+ fill?: SFieldFill
60
+ }
61
+
62
+ const props = withDefaults(defineProps<Props>(), {
63
+ label: undefined,
64
+ required: false,
65
+ helpText: undefined,
66
+ errorMessage: undefined,
67
+ invalid: false,
68
+ disabled: false,
69
+ readonly: false,
70
+ layout: 'stacked',
71
+ fill: 'content',
72
+ })
73
+ const slots = useSlots()
74
+ const ownedAttrs = useOwnedAttrs({ component: 'SField', owner: 'field root' })
75
+
76
+ const isInvalid = computed(() => props.invalid)
77
+ const hasLabel = computed(() => Boolean(props.label || slots.label))
78
+ const labelId = computed(() => `${props.controlId}-label`)
79
+ const helpId = computed(() => `${props.controlId}-help`)
80
+ const errorId = computed(() => `${props.controlId}-error`)
81
+ const describedBy = computed(() => {
82
+ const ids: string[] = []
83
+ if (props.helpText || slots.help) ids.push(helpId.value)
84
+ if (isInvalid.value && (props.errorMessage || slots.error)) ids.push(errorId.value)
85
+ return ids.length > 0 ? ids.join(' ') : undefined
86
+ })
87
+ </script>
88
+
89
+ <style lang="postcss" src="./SField.css" scoped></style>
@@ -0,0 +1,58 @@
1
+ @reference "../../../styles/reference.css";
2
+
3
+ .s-field-group {
4
+ @apply m-0 min-w-0 border-0 p-0;
5
+ }
6
+
7
+ .s-field-group__legend {
8
+ @apply mb-2 min-w-0 text-sm font-medium text-surface-700 dark:text-surface-300;
9
+ }
10
+
11
+ .s-field-group__required {
12
+ @apply ml-0.5 text-danger-600 dark:text-danger-400;
13
+ }
14
+
15
+ .s-field-group__controls {
16
+ @apply grid min-w-0 gap-2;
17
+ }
18
+
19
+ .s-field-group[data-layout='inline'] .s-field-group__controls {
20
+ @apply flex flex-wrap items-start;
21
+ }
22
+
23
+ .s-field-group[data-layout='grid'][data-columns='2'] .s-field-group__controls {
24
+ @apply grid-cols-2;
25
+ }
26
+
27
+ .s-field-group[data-layout='grid'][data-columns='3'] .s-field-group__controls {
28
+ @apply grid-cols-3;
29
+ }
30
+
31
+ .s-field-group[data-layout='grid'][data-columns='4'] .s-field-group__controls {
32
+ @apply grid-cols-4;
33
+ }
34
+
35
+ .s-field-group__help,
36
+ .s-field-group__error {
37
+ @apply mt-1 min-w-0 whitespace-normal text-xs;
38
+ overflow-wrap: anywhere;
39
+ }
40
+
41
+ .s-field-group__help {
42
+ @apply text-surface-500 dark:text-surface-400;
43
+ }
44
+
45
+ .s-field-group__error {
46
+ @apply text-danger-600 dark:text-danger-400;
47
+ }
48
+
49
+ .s-field-group[data-disabled='true'] .s-field-group__legend,
50
+ .s-field-group[data-readonly='true'] .s-field-group__legend {
51
+ @apply text-surface-400 dark:text-surface-500;
52
+ }
53
+
54
+ @media (max-width: 40rem) {
55
+ .s-field-group[data-layout='grid'][data-columns] .s-field-group__controls {
56
+ @apply grid-cols-1;
57
+ }
58
+ }
@@ -0,0 +1,117 @@
1
+ <template>
2
+ <fieldset
3
+ v-bind="ownedAttrs.bindings()"
4
+ :id="groupId"
5
+ class="s-field-group"
6
+ :disabled="disabled"
7
+ :aria-describedby="mergeIdReferences(ownedAttrs.string('aria-describedby'), describedBy)"
8
+ :aria-invalid="invalid || undefined"
9
+ :data-disabled="disabled || undefined"
10
+ :data-readonly="readonly || undefined"
11
+ :data-invalid="invalid || undefined"
12
+ :data-layout="validatedLayout"
13
+ :data-columns="validatedLayout === 'grid' ? validatedColumns : undefined"
14
+ >
15
+ <legend :id="labelId" class="s-field-group__legend">
16
+ <slot name="label">{{ validatedLabel }}</slot>
17
+ <span v-if="required" class="s-field-group__required" aria-hidden="true">*</span>
18
+ </legend>
19
+
20
+ <div class="s-field-group__controls">
21
+ <slot
22
+ :group-id="groupId"
23
+ :label-id="labelId"
24
+ :described-by="describedBy"
25
+ :invalid="invalid"
26
+ :disabled="disabled"
27
+ :readonly="readonly"
28
+ :required="required"
29
+ />
30
+ </div>
31
+
32
+ <p v-if="helpText || $slots.help" :id="helpId" class="s-field-group__help">
33
+ <slot name="help">{{ helpText }}</slot>
34
+ </p>
35
+ <p v-if="invalid && (errorMessage || $slots.error)" :id="errorId" class="s-field-group__error">
36
+ <slot name="error">{{ errorMessage }}</slot>
37
+ </p>
38
+ </fieldset>
39
+ </template>
40
+
41
+ <script setup lang="ts">
42
+ import { computed, useId, useSlots } from 'vue'
43
+ import { mergeIdReferences, useOwnedAttrs } from '../../../internal/ownedAttrs'
44
+ import {
45
+ validateBoundedInteger,
46
+ validateDomId,
47
+ validateExactString,
48
+ validateNonEmptyString,
49
+ } from '../../../internal/runtimeContract'
50
+
51
+ defineOptions({ inheritAttrs: false })
52
+
53
+ /** Раскладка controls внутри семантической группы. / Controls layout inside a semantic group. */
54
+ export type SFieldGroupLayout = 'stacked' | 'inline' | 'grid'
55
+ /** Число semantic grid columns без raw CSS length. / Semantic grid column count without a raw CSS length. */
56
+ export type SFieldGroupColumns = 1 | 2 | 3 | 4
57
+
58
+ const FIELD_GROUP_LAYOUTS = ['stacked', 'inline', 'grid'] as const
59
+ const FIELD_GROUP_COLUMNS_DOMAIN = { minimum: 1, maximum: 4 } as const
60
+
61
+ export interface Props {
62
+ label: string
63
+ id?: string
64
+ helpText?: string
65
+ errorMessage?: string
66
+ required?: boolean
67
+ invalid?: boolean
68
+ disabled?: boolean
69
+ readonly?: boolean
70
+ layout?: SFieldGroupLayout
71
+ columns?: SFieldGroupColumns
72
+ }
73
+
74
+ const props = withDefaults(defineProps<Props>(), {
75
+ id: undefined,
76
+ helpText: undefined,
77
+ errorMessage: undefined,
78
+ required: false,
79
+ invalid: false,
80
+ disabled: false,
81
+ readonly: false,
82
+ layout: 'stacked',
83
+ columns: 1,
84
+ })
85
+ const slots = useSlots()
86
+ const ownedAttrs = useOwnedAttrs({ component: 'SFieldGroup', owner: 'native fieldset' })
87
+ const generatedId = useId()
88
+ const groupId = computed(() => validateDomId(
89
+ 'SFieldGroup',
90
+ 'id',
91
+ props.id ?? `s-field-group-${generatedId}`,
92
+ ))
93
+ const labelId = computed(() => `${groupId.value}-legend`)
94
+ const validatedLabel = computed(() => validateNonEmptyString('SFieldGroup', 'label', props.label))
95
+ const helpId = computed(() => `${groupId.value}-help`)
96
+ const errorId = computed(() => `${groupId.value}-error`)
97
+ const describedBy = computed(() => {
98
+ const ids: string[] = []
99
+ if (props.helpText || slots.help) ids.push(helpId.value)
100
+ if (props.invalid && (props.errorMessage || slots.error)) ids.push(errorId.value)
101
+ return ids.length > 0 ? ids.join(' ') : undefined
102
+ })
103
+ const validatedLayout = computed<SFieldGroupLayout>(() => validateExactString(
104
+ 'SFieldGroup',
105
+ 'layout',
106
+ props.layout,
107
+ FIELD_GROUP_LAYOUTS,
108
+ ))
109
+ const validatedColumns = computed<SFieldGroupColumns>(() => validateBoundedInteger(
110
+ 'SFieldGroup',
111
+ 'columns',
112
+ props.columns,
113
+ FIELD_GROUP_COLUMNS_DOMAIN,
114
+ ) as SFieldGroupColumns)
115
+ </script>
116
+
117
+ <style lang="postcss" src="./SFieldGroup.css" scoped></style>
@@ -0,0 +1,12 @@
1
+ @reference "../../../styles/reference.css";
2
+
3
+ .s-field-label {
4
+ @apply min-w-0 whitespace-normal font-medium text-surface-600 dark:text-surface-300;
5
+ overflow-wrap: anywhere;
6
+ }
7
+
8
+ .s-field-label[data-size='sm'] { @apply text-xs; }
9
+ .s-field-label[data-size='md'] { @apply text-sm; }
10
+ .s-field-label[data-align='end'] { @apply text-right; }
11
+ .s-field-label[data-disabled='true'] { @apply text-surface-400 dark:text-surface-500; }
12
+ .s-field-label__required { @apply ml-0.5 text-danger-600 dark:text-danger-400; }
@@ -0,0 +1,51 @@
1
+ <template>
2
+ <label
3
+ v-bind="ownedAttrs.bindings()"
4
+ class="s-field-label"
5
+ :for="forId"
6
+ :data-align="align"
7
+ :data-size="size"
8
+ :data-disabled="disabled || undefined"
9
+ >
10
+ <slot />
11
+ <span v-if="required" class="s-field-label__required" aria-hidden="true">*</span>
12
+ </label>
13
+ </template>
14
+
15
+ <script setup lang="ts">
16
+ import type { VNodeChild } from 'vue'
17
+ import { useOwnedAttrs } from '../../../internal/ownedAttrs'
18
+
19
+ defineOptions({ inheritAttrs: false })
20
+
21
+ /**
22
+ * Standalone label-owner для композиций с раздельными grid-регионами подписи и control.
23
+ * Standalone label owner for compositions with separate label and control grid regions.
24
+ */
25
+ export interface Props {
26
+ /** ID связанного control. / ID of the associated control. */
27
+ forId?: string
28
+ /** Выравнивание текста внутри label-region. / Text alignment within the label region. */
29
+ align?: 'start' | 'end'
30
+ /** Семантический размер типографики. / Semantic typography size. */
31
+ size?: 'sm' | 'md'
32
+ /** Показывает обязательность без замены native required control contract. / Shows required presentation without replacing the native control contract. */
33
+ required?: boolean
34
+ /** Приглушает подпись связанного disabled control. / Mutes the label of an associated disabled control. */
35
+ disabled?: boolean
36
+ }
37
+
38
+ withDefaults(defineProps<Props>(), {
39
+ forId: undefined,
40
+ align: 'start',
41
+ size: 'md',
42
+ required: false,
43
+ disabled: false,
44
+ })
45
+
46
+ const ownedAttrs = useOwnedAttrs({ component: 'SFieldLabel', owner: 'native label' })
47
+
48
+ defineSlots<{ default?: () => VNodeChild }>()
49
+ </script>
50
+
51
+ <style lang="postcss" src="./SFieldLabel.css" scoped></style>
@@ -0,0 +1,61 @@
1
+ @reference "../../../styles/reference.css";
2
+
3
+ .s-inline-token-editor {
4
+ white-space: pre-wrap;
5
+ overflow-wrap: anywhere;
6
+ padding-top: var(--s-inline-token-editor-padding-top);
7
+ padding-right: var(--s-inline-token-editor-padding-right);
8
+ padding-bottom: var(--s-inline-token-editor-padding-bottom);
9
+ padding-left: var(--s-inline-token-editor-padding-left);
10
+ line-height: var(--s-inline-token-editor-line-height);
11
+ @apply relative block w-full break-words text-sm text-surface-800 caret-surface-800 dark:text-surface-100 dark:caret-surface-100;
12
+ }
13
+
14
+ .s-inline-token-editor[data-placeholder-visible='true']::before {
15
+ content: attr(data-placeholder);
16
+ pointer-events: none;
17
+ @apply text-surface-400 dark:text-surface-500;
18
+ }
19
+
20
+ .s-inline-token-editor[data-appearance='default'] {
21
+ --s-inline-token-editor-padding-top: 0.5rem;
22
+ --s-inline-token-editor-padding-right: 0.75rem;
23
+ --s-inline-token-editor-padding-bottom: 0.5rem;
24
+ --s-inline-token-editor-padding-left: 0.75rem;
25
+ --s-inline-token-editor-line-height: 1.5;
26
+ }
27
+
28
+ .s-inline-token-editor[data-appearance='ghost'] {
29
+ --s-inline-token-editor-padding-top: 0;
30
+ --s-inline-token-editor-padding-right: 0;
31
+ --s-inline-token-editor-padding-bottom: 0;
32
+ --s-inline-token-editor-padding-left: 0;
33
+ --s-inline-token-editor-line-height: 1.45;
34
+ appearance: none;
35
+ @apply border-0 bg-transparent shadow-none ring-0;
36
+ }
37
+
38
+ .s-inline-token-editor[data-appearance='ghost']:focus {
39
+ @apply border-0 shadow-none ring-0;
40
+ }
41
+
42
+ .s-inline-token-editor[data-disabled='true'] {
43
+ @apply cursor-not-allowed opacity-70;
44
+ }
45
+
46
+ .s-inline-token-editor[data-readonly='true'] {
47
+ @apply cursor-text;
48
+ }
49
+
50
+ .s-inline-token-editor[data-appearance='ghost'][data-disabled='true'] {
51
+ @apply text-surface-400 dark:text-surface-500;
52
+ }
53
+
54
+ .s-inline-token-editor[data-appearance='ghost'][data-invalid='true'] {
55
+ @apply text-danger-700 dark:text-danger-300;
56
+ }
57
+
58
+ .s-inline-token-editor__token {
59
+ vertical-align: baseline;
60
+ @apply mx-0.5 inline-flex max-w-52 items-center rounded-xl border border-primary-300/90 bg-primary-100/90 px-1 text-xs font-semibold leading-tight text-primary-800 shadow-sm backdrop-blur-md dark:border-primary-700/80 dark:bg-primary-900/40 dark:text-primary-100;
61
+ }