@volverjs/style 0.1.28 → 0.1.30-beta.1

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 (158) hide show
  1. package/design-tokens.json +503 -7
  2. package/dist/base.css +1 -1
  3. package/dist/components/vv-alert.css +1 -1
  4. package/dist/components/vv-attachment-group.css +1 -0
  5. package/dist/components/vv-attachment.css +1 -0
  6. package/dist/components/vv-avatar.css +1 -1
  7. package/dist/components/vv-badge.css +1 -1
  8. package/dist/components/vv-breadcrumb.css +1 -1
  9. package/dist/components/vv-bubble-group.css +1 -0
  10. package/dist/components/vv-bubble.css +1 -0
  11. package/dist/components/vv-button.css +1 -1
  12. package/dist/components/vv-calendar.css +1 -0
  13. package/dist/components/vv-checkbox-group.css +1 -1
  14. package/dist/components/vv-checkbox.css +1 -1
  15. package/dist/components/vv-command.css +1 -0
  16. package/dist/components/vv-dialog.css +1 -1
  17. package/dist/components/vv-dropdown-action.css +1 -1
  18. package/dist/components/vv-dropdown-option.css +1 -1
  19. package/dist/components/vv-empty.css +1 -0
  20. package/dist/components/vv-field.css +1 -0
  21. package/dist/components/vv-input-file.css +1 -1
  22. package/dist/components/vv-input-otp.css +1 -0
  23. package/dist/components/vv-input-range.css +1 -1
  24. package/dist/components/vv-input-text.css +1 -1
  25. package/dist/components/vv-item-group.css +1 -0
  26. package/dist/components/vv-item.css +1 -0
  27. package/dist/components/vv-kbd-group.css +1 -0
  28. package/dist/components/vv-kbd.css +1 -0
  29. package/dist/components/vv-marker.css +1 -0
  30. package/dist/components/vv-message-scroller.css +1 -0
  31. package/dist/components/vv-message.css +1 -0
  32. package/dist/components/vv-nav.css +1 -1
  33. package/dist/components/vv-pagination.css +1 -0
  34. package/dist/components/vv-popover.css +1 -0
  35. package/dist/components/vv-progress.css +1 -1
  36. package/dist/components/vv-prose.css +1 -0
  37. package/dist/components/vv-questionnaire.css +1 -0
  38. package/dist/components/vv-radio-group.css +1 -1
  39. package/dist/components/vv-radio.css +1 -1
  40. package/dist/components/vv-select.css +1 -1
  41. package/dist/components/vv-separator.css +1 -0
  42. package/dist/components/vv-sidebar.css +1 -0
  43. package/dist/components/vv-spinner.css +1 -0
  44. package/dist/components/vv-table.css +1 -1
  45. package/dist/components/vv-text.css +1 -1
  46. package/dist/components/vv-textarea.css +1 -1
  47. package/dist/components.css +1 -1
  48. package/dist/export.css +1 -1
  49. package/dist/props/colors.css +1 -1
  50. package/dist/props/input.css +1 -1
  51. package/dist/props.css +1 -1
  52. package/dist/themes/dark/components.css +1 -1
  53. package/dist/themes/dark/props.css +1 -1
  54. package/dist/themes/dark/volver.css +1 -1
  55. package/dist/utilities/colors.css +1 -1
  56. package/dist/utilities/layout.css +1 -1
  57. package/dist/utilities.css +1 -1
  58. package/dist/volver.css +1 -1
  59. package/package.json +49 -1
  60. package/src/_config.scss +23 -0
  61. package/src/_preflight.scss +14 -2
  62. package/src/components/index.scss +28 -0
  63. package/src/components/vv-attachment-group.scss +17 -0
  64. package/src/components/vv-attachment.scss +17 -0
  65. package/src/components/vv-bubble-group.scss +17 -0
  66. package/src/components/vv-bubble.scss +17 -0
  67. package/src/components/vv-calendar.scss +25 -0
  68. package/src/components/vv-command.scss +17 -0
  69. package/src/components/vv-empty.scss +17 -0
  70. package/src/components/vv-field.scss +25 -0
  71. package/src/components/vv-input-otp.scss +17 -0
  72. package/src/components/vv-item-group.scss +17 -0
  73. package/src/components/vv-item.scss +39 -0
  74. package/src/components/vv-kbd-group.scss +17 -0
  75. package/src/components/vv-kbd.scss +17 -0
  76. package/src/components/vv-marker.scss +17 -0
  77. package/src/components/vv-message-scroller.scss +24 -0
  78. package/src/components/vv-message.scss +25 -0
  79. package/src/components/vv-pagination.scss +17 -0
  80. package/src/components/vv-popover.scss +17 -0
  81. package/src/components/vv-prose.scss +17 -0
  82. package/src/components/vv-questionnaire.scss +28 -0
  83. package/src/components/vv-separator.scss +17 -0
  84. package/src/components/vv-sidebar.scss +17 -0
  85. package/src/components/vv-spinner.scss +27 -0
  86. package/src/presets/_outlined-fields.scss +346 -0
  87. package/src/props/colors.scss +6 -0
  88. package/src/props/index.scss +4 -1
  89. package/src/props/media.scss +21 -6
  90. package/src/settings/_colors.scss +161 -61
  91. package/src/settings/_index.scss +26 -0
  92. package/src/settings/_input.scss +9 -0
  93. package/src/settings/components/_choice.scss +104 -0
  94. package/src/settings/components/_vv-alert.scss +37 -12
  95. package/src/settings/components/_vv-attachment-group.scss +10 -0
  96. package/src/settings/components/_vv-attachment.scss +135 -0
  97. package/src/settings/components/_vv-avatar.scss +17 -7
  98. package/src/settings/components/_vv-badge.scss +21 -13
  99. package/src/settings/components/_vv-breadcrumb.scss +1 -1
  100. package/src/settings/components/_vv-bubble-group.scss +31 -0
  101. package/src/settings/components/_vv-bubble.scss +69 -0
  102. package/src/settings/components/_vv-button.scss +48 -5
  103. package/src/settings/components/_vv-calendar.scss +102 -0
  104. package/src/settings/components/_vv-checkbox-group.scss +33 -2
  105. package/src/settings/components/_vv-checkbox.scss +7 -2
  106. package/src/settings/components/_vv-command.scss +99 -0
  107. package/src/settings/components/_vv-dialog.scss +129 -26
  108. package/src/settings/components/_vv-dropdown-action.scss +2 -1
  109. package/src/settings/components/_vv-dropdown-option.scss +3 -3
  110. package/src/settings/components/_vv-empty.scss +71 -0
  111. package/src/settings/components/_vv-field.scss +111 -0
  112. package/src/settings/components/_vv-input-file.scss +6 -6
  113. package/src/settings/components/_vv-input-otp.scss +55 -0
  114. package/src/settings/components/_vv-input-range.scss +2 -2
  115. package/src/settings/components/_vv-input-text.scss +6 -6
  116. package/src/settings/components/_vv-item-group.scss +68 -0
  117. package/src/settings/components/_vv-item.scss +201 -0
  118. package/src/settings/components/_vv-kbd-group.scss +9 -0
  119. package/src/settings/components/_vv-kbd.scss +20 -0
  120. package/src/settings/components/_vv-marker.scss +32 -0
  121. package/src/settings/components/_vv-message-scroller.scss +65 -0
  122. package/src/settings/components/_vv-message.scss +95 -0
  123. package/src/settings/components/_vv-nav.scss +7 -3
  124. package/src/settings/components/_vv-pagination.scss +78 -0
  125. package/src/settings/components/_vv-popover.scss +53 -0
  126. package/src/settings/components/_vv-progress.scss +4 -4
  127. package/src/settings/components/_vv-prose.scss +274 -0
  128. package/src/settings/components/_vv-questionnaire.scss +77 -0
  129. package/src/settings/components/_vv-radio.scss +6 -2
  130. package/src/settings/components/_vv-select.scss +5 -5
  131. package/src/settings/components/_vv-separator.scss +79 -0
  132. package/src/settings/components/_vv-sidebar.scss +91 -0
  133. package/src/settings/components/_vv-spinner.scss +26 -0
  134. package/src/settings/components/_vv-table.scss +63 -0
  135. package/src/settings/components/_vv-text.scss +2 -2
  136. package/src/settings/components/_vv-textarea.scss +6 -6
  137. package/src/themes/dark/components/_vv-checkbox.scss +27 -0
  138. package/src/themes/dark/components/_vv-radio.scss +27 -0
  139. package/src/themes/dark/components/index.scss +2 -0
  140. package/src/themes/dark/props/_colors.scss +6 -0
  141. package/src/themes/dark/settings/_colors.scss +97 -32
  142. package/src/themes/dark/settings/_index.scss +2 -0
  143. package/src/themes/dark/settings/components/_choice.scss +15 -0
  144. package/src/themes/dark/settings/components/_vv-alert.scss +6 -48
  145. package/src/themes/dark/settings/components/_vv-avatar.scss +1 -16
  146. package/src/themes/dark/settings/components/_vv-badge.scss +1 -32
  147. package/src/themes/dark/settings/components/_vv-button.scss +0 -8
  148. package/src/themes/dark/settings/components/_vv-checkbox.scss +7 -0
  149. package/src/themes/dark/settings/components/_vv-dropdown-action.scss +2 -3
  150. package/src/themes/dark/settings/components/_vv-dropdown-option.scss +2 -19
  151. package/src/themes/dark/settings/components/_vv-nav.scss +2 -15
  152. package/src/themes/dark/settings/components/_vv-radio.scss +7 -0
  153. package/src/tools/_functions.scss +430 -2
  154. package/src/tools/mixin-modules/_bem.scss +5 -39
  155. package/src/tools/mixin-modules/_states.scss +77 -0
  156. package/src/tools/mixin-modules/_theme.scss +135 -121
  157. package/src/utilities/colors.scss +49 -4
  158. package/src/utilities/layout.scss +25 -0
@@ -0,0 +1,274 @@
1
+ // A container for rich text that arrives as plain tags: rendered markdown,
2
+ // the output of an editor or a CMS. Every element is an alias on a bare tag
3
+ // inside the block, and a group of tags is one selector through `:is()`,
4
+ // since an `_alias` has to be a single selector. The BEM classes the
5
+ // generator emits next to the aliases are there if a tag needs one.
6
+
7
+ // The reset of the library unsets every property of every tag but its
8
+ // `display`, so the meaning of the inline tags (italic, struck, underlined,
9
+ // raised) is given back here, not only their look.
10
+
11
+ // Sizes are in `em`, not in the static steps of `vv-text`: rich text is set
12
+ // at 14px in a chat bubble and at 16px on a page, and the headings follow the
13
+ // text around them. The rhythm is a margin on every child after the first,
14
+ // so the block has no margin of its own at either end.
15
+ $vv-prose: (
16
+ line-height: var(--leading-normal),
17
+ overflow-wrap: break-word,
18
+ element: (
19
+ // Declared first: the rules below add space back where it belongs
20
+ child: (
21
+ _alias: '> *',
22
+ margin-block: 0,
23
+ ),
24
+ flow: (
25
+ _alias: '> * + *',
26
+ margin-block-start: 0.75em,
27
+ ),
28
+ // Markdown wraps content in these too: two paragraphs in a quote, a
29
+ // loose list item, a disclosure
30
+ nested-flow: (
31
+ _alias: ':is(blockquote, details, td, th) > * + *',
32
+ margin-block-start: 0.75em,
33
+ ),
34
+ item-nested-flow: (
35
+ _alias: 'li > * + *',
36
+ margin-block-start: 0.25em,
37
+ ),
38
+ heading: (
39
+ _alias: ':is(h1, h2, h3, h4, h5, h6)',
40
+ color: var(--color-word),
41
+ font-weight: var(--font-semibold),
42
+ line-height: var(--leading-tight),
43
+ text-wrap: balance,
44
+ ),
45
+ // A heading opens a section: more room above it than between two
46
+ // paragraphs
47
+ heading-flow: (
48
+ _alias: '> * + :is(h1, h2, h3, h4, h5, h6)',
49
+ margin-block-start: 1.5em,
50
+ ),
51
+ h1: (
52
+ _alias: 'h1',
53
+ font-size: 1.5em,
54
+ ),
55
+ h2: (
56
+ _alias: 'h2',
57
+ font-size: 1.25em,
58
+ ),
59
+ h3: (
60
+ _alias: 'h3',
61
+ font-size: 1.125em,
62
+ ),
63
+ h4: (
64
+ _alias: ':is(h4, h5, h6)',
65
+ font-size: 1em,
66
+ ),
67
+ link: (
68
+ _alias: 'a',
69
+ color: var(--color-brand-readable),
70
+ text-decoration: underline,
71
+ text-underline-offset: 0.2em,
72
+ state: (
73
+ hover: (
74
+ text-decoration-thickness: 2px,
75
+ ),
76
+ focus-visible: (
77
+ outline: var(--spacing-px) solid var(--color-brand),
78
+ outline-offset: var(--spacing-2),
79
+ ),
80
+ ),
81
+ ),
82
+ strong: (
83
+ _alias: ':is(b, strong)',
84
+ font-weight: var(--font-semibold),
85
+ ),
86
+ emphasis: (
87
+ _alias: ':is(em, i, cite, dfn, var)',
88
+ font-style: italic,
89
+ ),
90
+ strike: (
91
+ _alias: ':is(del, s)',
92
+ text-decoration: line-through,
93
+ ),
94
+ underline: (
95
+ _alias: ':is(ins, u)',
96
+ text-decoration: underline,
97
+ ),
98
+ abbr: (
99
+ _alias: 'abbr[title]',
100
+ text-decoration: underline dotted,
101
+ cursor: help,
102
+ ),
103
+ small: (
104
+ _alias: 'small',
105
+ font-size: 0.875em,
106
+ ),
107
+ mark: (
108
+ _alias: 'mark',
109
+ padding-inline: 0.1em,
110
+ background-color: var(--color-surface-warning),
111
+ ),
112
+ script: (
113
+ _alias: ':is(sub, sup)',
114
+ position: relative,
115
+ font-size: 0.75em,
116
+ line-height: 0,
117
+ ),
118
+ sub: (
119
+ _alias: 'sub',
120
+ bottom: -0.25em,
121
+ ),
122
+ sup: (
123
+ _alias: 'sup',
124
+ top: -0.5em,
125
+ ),
126
+ kbd: (
127
+ _alias: 'kbd',
128
+ padding: 0.1em 0.35em,
129
+ border: var(--border) solid var(--color-surface-4),
130
+ border-bottom-width: var(--spacing-2),
131
+ border-radius: var(--rounded),
132
+ font-family: var(--font-mono),
133
+ font-size: 0.875em,
134
+ ),
135
+ list: (
136
+ _alias: ':is(ul, ol)',
137
+ padding-inline-start: 1.5em,
138
+ ),
139
+ ul: (
140
+ _alias: 'ul',
141
+ list-style-type: disc,
142
+ ),
143
+ ol: (
144
+ _alias: 'ol',
145
+ list-style-type: decimal,
146
+ ),
147
+ item-flow: (
148
+ _alias: 'li + li',
149
+ margin-block-start: 0.25em,
150
+ ),
151
+ nested-list: (
152
+ _alias: 'li > :is(ul, ol)',
153
+ margin-block-start: 0.25em,
154
+ ),
155
+ // The checkbox of a task list item, which the reset leaves with no
156
+ // appearance and no size
157
+ task: (
158
+ _alias: "li > input[type='checkbox']",
159
+ appearance: auto,
160
+ margin-inline-end: 0.5em,
161
+ vertical-align: middle,
162
+ ),
163
+ dt: (
164
+ _alias: 'dt',
165
+ font-weight: var(--font-semibold),
166
+ ),
167
+ dd: (
168
+ _alias: 'dd',
169
+ margin-inline-start: 1.5em,
170
+ ),
171
+ blockquote: (
172
+ _alias: 'blockquote',
173
+ margin-inline: 0,
174
+ padding-inline-start: 1em,
175
+ border-inline-start: var(--spacing-4) solid var(--color-surface-3),
176
+ color: var(--color-word-3),
177
+ ),
178
+ code: (
179
+ _alias: ':not(pre) > code',
180
+ padding: 0.1em 0.3em,
181
+ border-radius: var(--rounded),
182
+ background-color: var(--color-surface-1),
183
+ font-family: var(--font-mono),
184
+ font-size: 0.875em,
185
+ ),
186
+ pre: (
187
+ _alias: 'pre',
188
+ overflow: auto,
189
+ padding: 0.75em 1em,
190
+ border: var(--border) solid var(--color-surface-3),
191
+ border-radius: var(--rounded-md),
192
+ background-color: var(--color-surface-1),
193
+ font-family: var(--font-mono),
194
+ font-size: 0.875em,
195
+ line-height: var(--leading-snug),
196
+ white-space: pre,
197
+ ),
198
+ table: (
199
+ _alias: 'table',
200
+ width: 100%,
201
+ border-collapse: collapse,
202
+ font-size: 0.875em,
203
+ ),
204
+ cell: (
205
+ _alias: ':is(th, td)',
206
+ padding: 0.375em 0.625em,
207
+ border: var(--border) solid var(--color-surface-3),
208
+ text-align: start,
209
+ vertical-align: top,
210
+ ),
211
+ th: (
212
+ _alias: 'th',
213
+ background-color: var(--color-surface-1),
214
+ font-weight: var(--font-semibold),
215
+ ),
216
+ hr: (
217
+ _alias: 'hr',
218
+ margin-block: 1.5em,
219
+ border: 0,
220
+ border-block-start: var(--border) solid var(--color-surface-3),
221
+ ),
222
+ img: (
223
+ _alias: 'img',
224
+ max-width: 100%,
225
+ height: auto,
226
+ border-radius: var(--rounded-md),
227
+ ),
228
+ details: (
229
+ _alias: 'details',
230
+ padding: 0.5em 0.75em,
231
+ border: var(--border) solid var(--color-surface-3),
232
+ border-radius: var(--rounded-md),
233
+ background-color: var(--color-surface-1),
234
+ ),
235
+ summary: (
236
+ _alias: 'summary',
237
+ font-weight: var(--font-semibold),
238
+ cursor: pointer,
239
+ ),
240
+ summary-open: (
241
+ _alias: 'details[open] > summary',
242
+ margin-block-end: 0.5em,
243
+ ),
244
+ ),
245
+ modifier: (
246
+ // Rich text at the density of a field or a list: headings at the size
247
+ // of the text, the gaps halved
248
+ compact: (
249
+ element: (
250
+ flow: (
251
+ margin-block-start: 0.375em,
252
+ ),
253
+ heading-flow: (
254
+ margin-block-start: 0.75em,
255
+ ),
256
+ h1: (
257
+ font-size: 1em,
258
+ ),
259
+ h2: (
260
+ font-size: 1em,
261
+ ),
262
+ h3: (
263
+ font-size: 1em,
264
+ ),
265
+ item-flow: (
266
+ margin-block-start: 0,
267
+ ),
268
+ hr: (
269
+ margin-block: 0.75em,
270
+ ),
271
+ ),
272
+ ),
273
+ ),
274
+ ) !default;
@@ -0,0 +1,77 @@
1
+ // Questions asked one step at a time, in a conversation or a panel: a
2
+ // `header` with the title of the set, a `progress` bar, the `item` being
3
+ // asked (a `title`, a `description`, the choices, an `error`) and the
4
+ // `actions` that move between steps. The choices are fields of the library:
5
+ // `vv-radio--card` or `vv-checkbox--card` for a single or a multiple choice,
6
+ // a text field for a free answer.
7
+ // The share of the steps done is `--questionnaire-progress`, set on the block
8
+ // (`style="--questionnaire-progress: 40%"`) and read by a plain declaration.
9
+ // The title and the description space themselves with a margin, not the item
10
+ // with a gap: a choice keeps them inside its fieldset, as the `legend` and a
11
+ // paragraph, where a gap of the item would not reach. The description sits
12
+ // close under the title (see `src/components/vv-questionnaire.scss`).
13
+ $vv-questionnaire: (
14
+ display: flex,
15
+ flex-direction: column,
16
+ overflow: hidden,
17
+ border: var(--border) solid var(--color-surface-3),
18
+ border-radius: var(--rounded-xl),
19
+ background-color: var(--color-surface),
20
+ element: (
21
+ // A heading, in the markup
22
+ header: (
23
+ display: flex,
24
+ align-items: center,
25
+ gap: var(--spacing-8),
26
+ margin: 0,
27
+ padding: var(--spacing-10) var(--spacing-sm),
28
+ font-size: var(--text-16),
29
+ color: var(--color-word-1),
30
+ font-weight: var(--font-semibold),
31
+ ),
32
+ progress: (
33
+ position: relative,
34
+ block-size: var(--spacing-4),
35
+ overflow: hidden,
36
+ background-color: var(--color-surface-3),
37
+ pseudo: (
38
+ after: (
39
+ position: absolute,
40
+ inset-block: 0,
41
+ inset-inline-start: 0,
42
+ background-color: var(--color-word-4),
43
+ transition: inline-size var(--duration-300) var(--ease-out),
44
+ [inline-size]: var(--questionnaire-progress, 0%),
45
+ ),
46
+ ),
47
+ ),
48
+ item: (
49
+ display: flex,
50
+ flex-direction: column,
51
+ padding: var(--spacing-16) var(--spacing-sm),
52
+ ),
53
+ title: (
54
+ margin: 0 0 var(--spacing-12),
55
+ color: var(--color-word-1),
56
+ font-weight: var(--font-semibold),
57
+ ),
58
+ description: (
59
+ margin: 0 0 var(--spacing-12),
60
+ color: var(--color-word-3),
61
+ font-size: var(--text-14),
62
+ ),
63
+ error: (
64
+ color: var(--color-danger-readable),
65
+ font-size: var(--text-12),
66
+ ),
67
+ actions: (
68
+ display: flex,
69
+ flex-wrap: wrap,
70
+ align-items: center,
71
+ justify-content: flex-end,
72
+ gap: var(--spacing-8),
73
+ padding: var(--spacing-10) var(--spacing-sm),
74
+ border-top: var(--border) solid var(--color-surface-3),
75
+ ),
76
+ ),
77
+ ) !default;
@@ -1,3 +1,5 @@
1
+ @use 'choice' as *;
2
+
1
3
  $vv-radio: (
2
4
  display: inline-flex,
3
5
  flex-wrap: wrap,
@@ -21,6 +23,8 @@ $vv-radio: (
21
23
  ),
22
24
  ),
23
25
  modifier: (
26
+ segment: $choice-segment,
27
+ card: $choice-card,
24
28
  readonly: (
25
29
  opacity: var(--opacity-100),
26
30
  cursor: default,
@@ -29,14 +33,14 @@ $vv-radio: (
29
33
  valid: (
30
34
  element: (
31
35
  hint: (
32
- color: var(--input-valid-color),
36
+ color: var(--input-valid-text-color),
33
37
  ),
34
38
  ),
35
39
  ),
36
40
  invalid: (
37
41
  element: (
38
42
  hint: (
39
- color: var(--input-invalid-color),
43
+ color: var(--input-invalid-text-color),
40
44
  ),
41
45
  ),
42
46
  ),
@@ -243,7 +243,7 @@ $vv-select: (
243
243
  color: var(--input-color),
244
244
  state: (
245
245
  checked: (
246
- color: var(--color-brand),
246
+ color: var(--color-surface-brand-readable),
247
247
  background-color: var(--color-surface-brand),
248
248
  ),
249
249
  disabled: (
@@ -270,10 +270,10 @@ $vv-select: (
270
270
  ),
271
271
  ),
272
272
  hint: (
273
- color: var(--input-valid-color),
273
+ color: var(--input-valid-text-color),
274
274
  ),
275
275
  icon-after: (
276
- color: var(--input-valid-color),
276
+ color: var(--input-valid-text-color),
277
277
  ),
278
278
  ),
279
279
  ),
@@ -288,10 +288,10 @@ $vv-select: (
288
288
  ),
289
289
  ),
290
290
  hint: (
291
- color: var(--input-invalid-color),
291
+ color: var(--input-invalid-text-color),
292
292
  ),
293
293
  icon-after: (
294
- color: var(--input-invalid-color),
294
+ color: var(--input-invalid-text-color),
295
295
  ),
296
296
  ),
297
297
  ),
@@ -0,0 +1,79 @@
1
+ // A hairline between two groups of content, with an optional label on it
2
+ // ("or", a date). The two halves of the line are the `::before` and `::after`
3
+ // of the block, either side of the label, so a long label wraps and the
4
+ // separator takes its own height instead of overlapping what is around it.
5
+ // The generator gives both pseudo elements their empty `content`.
6
+
7
+ // Each half keeps at least 16px and never shrinks, so a label too long for
8
+ // the row wraps instead of squeezing the line out of sight.
9
+
10
+ // The space around the label is its own padding, not a `gap` on the block:
11
+ // without a label the halves have to meet, and `:empty` cannot tell, since
12
+ // a single space or line break inside the block is enough to defeat it.
13
+
14
+ // The line takes the colour of the block's `border-color`, which the block
15
+ // never draws itself (it has no border of its own): override that one colour
16
+ // and both halves follow. `inherit` goes through a plain declaration, in
17
+ // brackets: written into a custom property, a CSS-wide keyword applies to the
18
+ // custom property itself, at the root, and the halves would fall back to
19
+ // `currentcolor`.
20
+ $vv-separator: (
21
+ display: flex,
22
+ align-items: center,
23
+ margin: var(--spacing-0),
24
+ border: var(--border-0),
25
+ border-color: var(--color-surface-3),
26
+ color: var(--color-word-3),
27
+ font-size: var(--text-12),
28
+ line-height: var(--leading-snug),
29
+ text-transform: uppercase,
30
+ pseudo: (
31
+ before: (
32
+ flex: 1 0 var(--spacing-16),
33
+ border-block-start: var(--border) solid,
34
+ [border-color]: inherit,
35
+ ),
36
+ after: (
37
+ flex: 1 0 var(--spacing-16),
38
+ border-block-start: var(--border) solid,
39
+ [border-color]: inherit,
40
+ ),
41
+ ),
42
+ element: (
43
+ label: (
44
+ _alias: '> span',
45
+ min-width: 0,
46
+ padding-inline: var(--spacing-8),
47
+ text-align: center,
48
+ ),
49
+ ),
50
+ modifier: (
51
+ // Between two items of a row: the halves stand up and the block
52
+ // stretches to the height of the row. They drop the 16px floor, which
53
+ // would make a row of text taller than its text.
54
+ vertical: (
55
+ flex-direction: column,
56
+ align-self: stretch,
57
+ pseudo: (
58
+ before: (
59
+ flex: 1,
60
+ border-block-start: var(--border-0),
61
+ border-inline-start: var(--border) solid,
62
+ [border-color]: inherit,
63
+ ),
64
+ after: (
65
+ flex: 1,
66
+ border-block-start: var(--border-0),
67
+ border-inline-start: var(--border) solid,
68
+ [border-color]: inherit,
69
+ ),
70
+ ),
71
+ element: (
72
+ label: (
73
+ padding-block: var(--spacing-8),
74
+ padding-inline: var(--spacing-0),
75
+ ),
76
+ ),
77
+ ),
78
+ ),
79
+ ) !default;
@@ -0,0 +1,91 @@
1
+ // The width of the collapsed sidebar, read by the block and by its sections
2
+ $-rail-width: var(--sidebar-collapsed-width, var(--spacing-64));
3
+
4
+ // A section of the rail is one column as wide as the rail, anchored at its
5
+ // start, with what is left in it centred: the icons of the header, of the
6
+ // navigation and of the footer line up on the middle of the rail, whatever
7
+ // padding each of them carries. The column keeps that width while the rail is
8
+ // still narrowing, so the icons stay where they land instead of riding the
9
+ // middle of a column that shrinks. `minmax(0, ...)` gives up the pixel of the
10
+ // border at rest, where the section is that much narrower than the rail.
11
+ $-rail-section: (
12
+ display: grid,
13
+ align-content: start,
14
+ justify-items: center,
15
+ padding-inline: 0,
16
+ [grid-template-columns]: minmax(0, $-rail-width),
17
+ );
18
+
19
+ // The side column of an application: a `header` (the product, a switcher), a
20
+ // `content` that scrolls (a `vv-nav--sidebar`), a `footer` (the account).
21
+ // Its width is `--sidebar-width`, 16rem when nothing sets it; `collapsed`
22
+ // narrows it to `--sidebar-collapsed-width`, a 64px rail, and hides every
23
+ // `label` from sight, so the icons of the navigation remain and still carry
24
+ // their names. Both are read with a
25
+ // fallback and never declared on the block, so a value set on the layout
26
+ // around it reaches it.
27
+ $vv-sidebar: (
28
+ display: flex,
29
+ flex-direction: column,
30
+ // Its width is the one set, even beside a main column that overflows
31
+ flex-shrink: 0,
32
+ block-size: 100%,
33
+ min-block-size: 0,
34
+ border-inline-end: var(--border) solid var(--color-surface-3),
35
+ background-color: var(--color-surface-1),
36
+ color: var(--color-word-2),
37
+ transition: inline-size var(--duration-300) var(--ease-out),
38
+ [inline-size]: var(--sidebar-width, 16rem),
39
+ element: (
40
+ header: (
41
+ display: flex,
42
+ flex-shrink: 0,
43
+ align-items: center,
44
+ gap: var(--spacing-8),
45
+ min-width: 0,
46
+ padding: var(--spacing-sm),
47
+ ),
48
+ content: (
49
+ flex: 1,
50
+ min-height: 0,
51
+ padding: var(--spacing-xs) var(--spacing-sm),
52
+ overflow-y: auto,
53
+ scrollbar-width: thin,
54
+ ),
55
+ footer: (
56
+ display: flex,
57
+ flex-shrink: 0,
58
+ align-items: center,
59
+ gap: var(--spacing-8),
60
+ min-width: 0,
61
+ padding: var(--spacing-sm),
62
+ border-top: var(--border) solid var(--color-surface-3),
63
+ ),
64
+ label: (
65
+ min-width: 0,
66
+ overflow: hidden,
67
+ text-overflow: ellipsis,
68
+ white-space: nowrap,
69
+ ),
70
+ ),
71
+ modifier: (
72
+ // The labels leave the rail but stay in the accessibility tree, so an
73
+ // icon keeps the name of its link
74
+ collapsed: (
75
+ [inline-size]: $-rail-width,
76
+ element: (
77
+ header: $-rail-section,
78
+ content: $-rail-section,
79
+ footer: $-rail-section,
80
+ label: (
81
+ position: absolute,
82
+ inline-size: var(--spacing-1),
83
+ block-size: var(--spacing-1),
84
+ overflow: hidden,
85
+ clip-path: inset(50%),
86
+ white-space: nowrap,
87
+ ),
88
+ ),
89
+ ),
90
+ ),
91
+ ) !default;
@@ -0,0 +1,26 @@
1
+ // A ring that turns while something is loading. It measures `1em` and draws
2
+ // in `currentcolor`, so it takes the size and the colour of the text it sits
3
+ // in: inside a button, next to a label, or alone with a text utility on it.
4
+
5
+ // The animation tokens are `none` under `prefers-reduced-motion`, and a
6
+ // spinner that stands still says nothing, so the block runs `spin` itself
7
+ // and slows it down there instead (see `src/components/vv-spinner.scss`).
8
+ // `--spinner-duration` and `--spinner-thickness` are read by plain
9
+ // declarations, in brackets: a `var()` inside a generated custom property is
10
+ // substituted where that property is declared, at the root, and would never
11
+ // see a value set on the block.
12
+ $vv-spinner: (
13
+ --spinner-duration: 0.75s,
14
+ --spinner-thickness: 0.125em,
15
+ display: inline-block,
16
+ flex-shrink: 0,
17
+ inline-size: 1em,
18
+ block-size: 1em,
19
+ border-style: solid,
20
+ border-color: color-mix(in srgb, currentcolor 20%, transparent),
21
+ border-block-start-color: currentcolor,
22
+ border-radius: var(--rounded-full),
23
+ vertical-align: middle,
24
+ [border-width]: var(--spinner-thickness),
25
+ [animation]: spin var(--spinner-duration) linear infinite,
26
+ ) !default;
@@ -27,12 +27,45 @@ $vv-table: (
27
27
  last-child: (
28
28
  border-width: 0,
29
29
  ),
30
+ // A row picked in a table that selects (`aria-selected`)
31
+ selected: (
32
+ background-color: var(--color-surface-1),
33
+ ),
34
+ // The row being looked at, the table as a master list: a
35
+ // surface that stands apart and a bar along the inline start,
36
+ // as `vv-item--current` draws it. Plain markup puts `current`
37
+ // on the `tr`.
38
+ current: (
39
+ background-color: var(--color-surface-2),
40
+ // On the inline start: `--direction` is -1 in a right to left page
41
+ [box-shadow]: inset calc(var(--spacing-3) * var(--direction, 1)) 0 0 var(--color-word-2),
42
+ ),
30
43
  ),
31
44
  ),
32
45
  tfoot-tr: (
33
46
  _alias: 'tfoot > tr',
34
47
  border-width: 1px 0 0 0,
35
48
  ),
49
+ // A sortable column carries `aria-sort` on the `th` and a
50
+ // `vv-table__sort` button inside it. The indicator is the chevron of
51
+ // the library, drawn as a mask in the colour of the text after the
52
+ // button, faint while the column is not sorted. Declared before `th`,
53
+ // whose sorted states follow it.
54
+ sortable: (
55
+ _alias: 'th[aria-sort]',
56
+ pseudo: (
57
+ after: (
58
+ display: inline-block,
59
+ width: 0.75em,
60
+ height: 0.75em,
61
+ margin-inline-start: 0.25em,
62
+ vertical-align: middle,
63
+ background-color: currentcolor,
64
+ mask: var(--bg-chevron) center / contain no-repeat,
65
+ opacity: var(--opacity-40),
66
+ ),
67
+ ),
68
+ ),
36
69
  th: (
37
70
  _alias: 'th',
38
71
  font-weight: var(--font-semibold),
@@ -40,6 +73,36 @@ $vv-table: (
40
73
  color: var(--color-word-2),
41
74
  vertical-align: middle,
42
75
  [padding]: var(--table-cell-padding),
76
+ // Sorted: the indicator of `sortable` above, full strength,
77
+ // pointing down for descending and up for ascending
78
+ state: (
79
+ sort-descending: (
80
+ pseudo: (
81
+ after: (
82
+ opacity: var(--opacity-100),
83
+ ),
84
+ ),
85
+ ),
86
+ sort-ascending: (
87
+ pseudo: (
88
+ after: (
89
+ opacity: var(--opacity-100),
90
+ rotate: 180deg,
91
+ ),
92
+ ),
93
+ ),
94
+ ),
95
+ ),
96
+ sort: (
97
+ display: inline-flex,
98
+ align-items: center,
99
+ cursor: pointer,
100
+ state: (
101
+ focus-visible: (
102
+ outline: var(--spacing-px) solid var(--color-brand),
103
+ outline-offset: var(--spacing-2),
104
+ ),
105
+ ),
43
106
  ),
44
107
  td: (
45
108
  _alias: 'td',