@graupl/navigation-shelf 1.0.0-beta.16

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 (49) hide show
  1. package/dist/css/component/navigation-shelf.css +36 -0
  2. package/dist/css/component/navigation-shelf.css.map +1 -0
  3. package/dist/css/component.css +36 -0
  4. package/dist/css/component.css.map +1 -0
  5. package/dist/css/navigation-shelf.css +36 -0
  6. package/dist/css/navigation-shelf.css.map +1 -0
  7. package/dist/css/utilities/shelf-aware.css +2 -0
  8. package/dist/css/utilities/shelf-aware.css.map +1 -0
  9. package/dist/css/utilities/width.css +2 -0
  10. package/dist/css/utilities/width.css.map +1 -0
  11. package/dist/css/utilities.css +2 -0
  12. package/dist/css/utilities.css.map +1 -0
  13. package/dist/js/component/navigation-shelf.cjs.js +5 -0
  14. package/dist/js/component/navigation-shelf.cjs.js.map +1 -0
  15. package/dist/js/component/navigation-shelf.es.js +5 -0
  16. package/dist/js/component/navigation-shelf.es.js.map +1 -0
  17. package/dist/js/component/navigation-shelf.iife.js +5 -0
  18. package/dist/js/component/navigation-shelf.iife.js.map +1 -0
  19. package/dist/js/generator/navigation-shelf.cjs.js +5 -0
  20. package/dist/js/generator/navigation-shelf.cjs.js.map +1 -0
  21. package/dist/js/generator/navigation-shelf.es.js +5 -0
  22. package/dist/js/generator/navigation-shelf.es.js.map +1 -0
  23. package/dist/js/generator/navigation-shelf.iife.js +5 -0
  24. package/dist/js/generator/navigation-shelf.iife.js.map +1 -0
  25. package/dist/js/navigation-shelf.js +5 -0
  26. package/dist/js/navigation-shelf.js.map +1 -0
  27. package/package.json +71 -0
  28. package/scss/component/navigation-shelf.scss +3 -0
  29. package/scss/component.scss +3 -0
  30. package/scss/navigation-shelf.scss +3 -0
  31. package/scss/utilities/shelf-aware.scss +3 -0
  32. package/scss/utilities/width.scss +3 -0
  33. package/scss/utilities.scss +3 -0
  34. package/src/js/navigation-shelf/NavigationShelf.js +1912 -0
  35. package/src/js/navigation-shelf/generator.js +38 -0
  36. package/src/js/navigation-shelf/index.js +5 -0
  37. package/src/js/validate.js +46 -0
  38. package/src/scss/_index.scss +2 -0
  39. package/src/scss/component/_index.scss +1 -0
  40. package/src/scss/component/navigation-shelf/_defaults.scss +85 -0
  41. package/src/scss/component/navigation-shelf/_index.scss +228 -0
  42. package/src/scss/component/navigation-shelf/_variables.scss +196 -0
  43. package/src/scss/utilities/_index.scss +2 -0
  44. package/src/scss/utilities/shelf-aware/_defaults.scss +31 -0
  45. package/src/scss/utilities/shelf-aware/_index.scss +383 -0
  46. package/src/scss/utilities/shelf-aware/_variables.scss +6 -0
  47. package/src/scss/utilities/width/_defaults.scss +58 -0
  48. package/src/scss/utilities/width/_index.scss +290 -0
  49. package/src/scss/utilities/width/_variables.scss +6 -0
@@ -0,0 +1,290 @@
1
+ // @graupl/navigation-shelf width utilities styles.
2
+ //
3
+ // This file generates the width utility classes provided by Graupl.
4
+ //
5
+ // The following classes are generated by default:
6
+ // - `.w-shelf-min`: Sets the width property to `--graupl-navigation-shelf-min-width`.
7
+ // - `.w-shelf-max`: Sets the width property to `--graupl-navigation-shelf-max-width`.
8
+ // - `.w-shelf-current`: Sets the width property to `--graupl-navigation-shelf-current-width`.
9
+ // - `.w-shelf-closed`: Sets the width property to `--graupl-navigation-shelf-closed-width`.
10
+ // - `.w-shelf-open`: Sets the width property to `--graupl-navigation-shelf-open-width`.
11
+ // - `.max-w-shelf-min`: Sets the max-width property to `--graupl-navigation-shelf-min-width`.
12
+ // - `.max-w-shelf-max`: Sets the max-width property to `--graupl-navigation-shelf-max-width`.
13
+ // - `.max-w-shelf-current`: Sets the max-width property to `--graupl-navigation-shelf-current-width`.
14
+ // - `.max-w-shelf-closed`: Sets the max-width property to `--graupl-navigation-shelf-closed-width`.
15
+ // - `.max-w-shelf-open`: Sets the max-width property to `--graupl-navigation-shelf-open-width`.
16
+ // - `.min-w-shelf-min`: Sets the min-width property to `--graupl-navigation-shelf-min-width`.
17
+ // - `.min-w-shelf-max`: Sets the min-width property to `--graupl-navigation-shelf-max-width`.
18
+ // - `.min-w-shelf-current`: Sets the min-width property to `--graupl-navigation-shelf-current-width`.
19
+ // - `.min-w-shelf-closed`: Sets the min-width property to `--graupl-navigation-shelf-closed-width`.
20
+ // - `.min-w-shelf-open`: Sets the min-width property to `--graupl-navigation-shelf-open-width`.
21
+ //
22
+ // The following custom properties control the generated classes:
23
+ // - N/A.
24
+ //
25
+ // The following variables control the generated classes:
26
+ // - `$selector-base`: The base selector for the utility classes.
27
+ // - `$use-important`: A flag to determine if the `!important` flag should be added to the utility classes.
28
+ // - `$generate-base-utilities`: A flag to determine if the base utility classes should be generated.
29
+ // - `$screen-aware`: A flag to generate screen-aware utility classes.
30
+ // - `$theme-aware`: A flag to generate theme-aware utility classes.
31
+ // - `$state-aware`: A flag to generate state-aware utility classes.
32
+ // - `$container-aware`: A flag to generate container-aware utility classes.
33
+ // - `$screen-aware-separator`: The separator for screen-aware utility classes.
34
+ // - `$theme-aware-separator`: The separator for theme-aware utility classes.
35
+ // - `$state-aware-separator`: The separator for state-aware utility classes.
36
+ // - `$container-aware-separator`: The separator for container-aware utility classes.
37
+ // - `$screen-aware-selector-prefix`: The prefix for screen-aware utility classes.
38
+ // - `$theme-aware-selector-prefix`: The prefix for theme-aware utility classes.
39
+ // - `$state-aware-selector-prefix`: The prefix for state-aware utility classes.
40
+ // - `$container-aware-selector-prefix`: The prefix for container-aware utility classes.
41
+ // - `$width-selector-prefix`: The prefix for the width utility classes.
42
+ // - `$max-width-selector-prefix`: The prefix for the max-width utility classes.
43
+ // - `$min-width-selector-prefix`: The prefix for the min-width utility classes.
44
+ // - `$custom-width-values`: [DEPRECATED] The custom properties and values for the width utility classes.
45
+ // - `$width-values`: The combined properties and values for the width utility classes.
46
+ //
47
+ // Generating responsive utility classes can be done by setting `$screen-aware`, `$theme-aware`, or `$state-aware` to `true`.
48
+ // By default, no responsive utility classes are generated.
49
+ //
50
+ // When set to true, screen-aware utility classes will be generated for each screen size in the following pattern:
51
+ // - `.{screen-prefix}{screen-name}:{prefix}{value}`
52
+ //
53
+ // e.g. `.sm:w-shelf-min` will set the `width` property to `--graupl-navigation-shelf-min-width` on screens equal to or larger than the `sm` breakpoint.
54
+ //
55
+ // When set to true, theme-aware utility classes will be generated for each theme in the following pattern:
56
+ // - `.{theme-prefix}{theme-name}:{prefix}{value}`
57
+ //
58
+ // e.g. `.dark:w-shelf-min` will set the `width` property to `--graupl-navigation-shelf-min-width` when the `dark` theme is active.
59
+ //
60
+ // When set to true, state-aware utility classes will be generated for each state in the following pattern:
61
+ // - `.{state-prefix}{state-name}:{prefix}{value}`
62
+ //
63
+ // e.g. `.hover:w-shelf-min` will set the `width` property to `--graupl-navigation-shelf-min-width` when the element is hovered.
64
+ //
65
+ // When set to true, container-aware utility classes will be generated for each container in the following pattern:
66
+ // - `.{container-prefix}{container-name}:{prefix}{value}`
67
+ //
68
+ // e.g. `.cq:md:w-shelf-min` will set the `width` property to `--graupl-navigation-shelf-min-width` when the parent container is larger than the `md` breakpoint.
69
+ //
70
+ // @example
71
+ // <div class="w-5">This element has a width equal to Graupl's spacer 5 value.</div>
72
+
73
+ @use "defaults";
74
+ @use "pkg:@graupl/core/src/defaults" as root-defaults;
75
+ @use "pkg:@graupl/core/src/mixins/layer" as *;
76
+ @use "pkg:@graupl/core/src/mixins/utility";
77
+ @use "pkg:@graupl/core/src/theme/color/variables" as color;
78
+ @use "pkg:@graupl/core/src/variables" as root-variables;
79
+ @use "sass:map";
80
+ @use "variables" as *;
81
+
82
+ @include layer(utilities) {
83
+ // `.`
84
+ $selector-prefix: defaults.$selector-base;
85
+
86
+ // For each width property, create a utility class.
87
+ @each $width, $value in defaults.$width-values {
88
+ // e.g. `.w-shelf-min` or `.w-shelf-open`
89
+ $selector: #{$selector-prefix}#{defaults.$width-selector-prefix}#{$width};
90
+
91
+ @include utility.create(
92
+ $selector,
93
+ width,
94
+ $value,
95
+ $important: defaults.$use-important
96
+ );
97
+
98
+ // e.g. `.max-w-shelf-min` or `.max-w-shelf-open`
99
+ $selector: #{$selector-prefix}#{defaults.$max-width-selector-prefix}#{$width};
100
+
101
+ @include utility.create(
102
+ $selector,
103
+ max-width,
104
+ $value,
105
+ $important: defaults.$use-important
106
+ );
107
+
108
+ // e.g. `.min-w-shelf-min` or `.min-w-shelf-open`
109
+ $selector: #{$selector-prefix}#{defaults.$min-width-selector-prefix}#{$width};
110
+
111
+ @include utility.create(
112
+ $selector,
113
+ min-width,
114
+ $value,
115
+ $important: defaults.$use-important
116
+ );
117
+ }
118
+
119
+ // Generate screen-aware utilities.
120
+ @if defaults.$screen-aware {
121
+ @each $screen-name in map.keys(root-defaults.$screen-sizes) {
122
+ // e.g. `.md:` or `.lg:`
123
+ $selector-prefix: #{defaults.$selector-base}#{defaults.$screen-aware-selector-prefix}#{$screen-name}#{defaults.$screen-aware-separator};
124
+
125
+ // For each width property, create a utility class.
126
+ @each $width, $value in defaults.$width-values {
127
+ // e.g. `.md:w-shelf-min` or `.lg:w-shelf-open`
128
+ $selector: #{$selector-prefix}#{defaults.$width-selector-prefix}#{$width};
129
+
130
+ @include utility.create(
131
+ $selector,
132
+ width,
133
+ $value,
134
+ $important: defaults.$use-important,
135
+ $screen: $screen-name
136
+ );
137
+
138
+ // e.g. `.md:max-w-shelf-min` or `.lg:max-w-shelf-open`
139
+ $selector: #{$selector-prefix}#{defaults.$max-width-selector-prefix}#{$width};
140
+
141
+ @include utility.create(
142
+ $selector,
143
+ max-width,
144
+ $value,
145
+ $important: defaults.$use-important,
146
+ $screen: $screen-name
147
+ );
148
+
149
+ // e.g. `.md:min-w-shelf-min` or `.lg:min-w-shelf-open`
150
+ $selector: #{$selector-prefix}#{defaults.$min-width-selector-prefix}#{$width};
151
+
152
+ @include utility.create(
153
+ $selector,
154
+ min-width,
155
+ $value,
156
+ $important: defaults.$use-important,
157
+ $screen: $screen-name
158
+ );
159
+ }
160
+ }
161
+ }
162
+
163
+ // Generate theme-aware utilities.
164
+ @if defaults.$theme-aware and root-defaults.$theme-aware-utilities {
165
+ @each $theme-name, $colors in color.$themes {
166
+ @if $theme-name != active {
167
+ // e.g. `.dark:` or `.light:`
168
+ $selector-prefix: #{defaults.$selector-base}#{defaults.$theme-aware-selector-prefix}#{$theme-name}#{defaults.$theme-aware-separator};
169
+
170
+ // For each width property, create a utility class.
171
+ @each $width, $value in defaults.$width-values {
172
+ // e.g. `.dark:w-shelf-min` or `.light:w-shelf-open`
173
+ $selector: #{$selector-prefix}#{defaults.$width-selector-prefix}#{$width};
174
+
175
+ @include utility.create(
176
+ $selector,
177
+ width,
178
+ $value,
179
+ $important: defaults.$use-important,
180
+ $theme: $theme-name
181
+ );
182
+
183
+ // e.g. `.dark:max-w-shelf-min` or `.light:max-w-shelf-open`
184
+ $selector: #{$selector-prefix}#{defaults.$max-width-selector-prefix}#{$width};
185
+
186
+ @include utility.create(
187
+ $selector,
188
+ max-width,
189
+ $value,
190
+ $important: defaults.$use-important,
191
+ $theme: $theme-name
192
+ );
193
+
194
+ // e.g. `.dark:min-w-shelf-min` or `.light:min-w-shelf-open`
195
+ $selector: #{$selector-prefix}#{defaults.$min-width-selector-prefix}#{$width};
196
+
197
+ @include utility.create(
198
+ $selector,
199
+ min-width,
200
+ $value,
201
+ $important: defaults.$use-important,
202
+ $theme: $theme-name
203
+ );
204
+ }
205
+ }
206
+ }
207
+ }
208
+
209
+ // Generate state-aware utilities.
210
+ @if defaults.$state-aware and root-defaults.$state-aware-utilities {
211
+ @each $state-name, $value in root-defaults.$state-selectors {
212
+ // e.g. `.hover:` or `.focus:`
213
+ $selector-prefix: #{defaults.$selector-base}#{defaults.$state-aware-selector-prefix}#{$state-name}#{defaults.$state-aware-separator};
214
+
215
+ // For each width property, create a utility class.
216
+ @each $width, $value in defaults.$width-values {
217
+ // e.g. `.hover:w-shelf-min` or `.focus:w-shelf-open`
218
+ $selector: #{$selector-prefix}#{defaults.$width-selector-prefix}#{$width};
219
+
220
+ @include utility.create($selector, width, $value, $state: $state-name);
221
+
222
+ // e.g. `.hover:max-w-shelf-min` or `.focus:max-w-shelf-open`
223
+ $selector: #{$selector-prefix}#{defaults.$max-width-selector-prefix}#{$width};
224
+
225
+ @include utility.create(
226
+ $selector,
227
+ max-width,
228
+ $value,
229
+ $important: defaults.$use-important,
230
+ $state: $state-name
231
+ );
232
+
233
+ // e.g. `.hover:min-w-shelf-min` or `.focus:min-w-shelf-open`
234
+ $selector: #{$selector-prefix}#{defaults.$min-width-selector-prefix}#{$width};
235
+
236
+ @include utility.create(
237
+ $selector,
238
+ min-width,
239
+ $value,
240
+ $important: defaults.$use-important,
241
+ $state: $state-name
242
+ );
243
+ }
244
+ }
245
+ }
246
+
247
+ // Generate container-aware utilities.
248
+ @if defaults.$container-aware {
249
+ @each $container-name in map.keys(root-defaults.$container-sizes) {
250
+ // e.g. `.md:` or `.lg:`
251
+ $selector-prefix: #{defaults.$selector-base}#{defaults.$container-aware-selector-prefix}#{$container-name}#{defaults.$container-aware-separator};
252
+
253
+ // For each width property, create a utility class.
254
+ @each $width, $value in defaults.$width-values {
255
+ // e.g. `.md:w-shelf-min` or `.lg:w-shelf-open`
256
+ $selector: #{$selector-prefix}#{defaults.$width-selector-prefix}#{$width};
257
+
258
+ @include utility.create(
259
+ $selector,
260
+ width,
261
+ $value,
262
+ $important: defaults.$use-important,
263
+ $container: $container-name
264
+ );
265
+
266
+ // e.g. `.md:max-w-shelf-min` or `.lg:max-w-shelf-open`
267
+ $selector: #{$selector-prefix}#{defaults.$max-width-selector-prefix}#{$width};
268
+
269
+ @include utility.create(
270
+ $selector,
271
+ max-width,
272
+ $value,
273
+ $important: defaults.$use-important,
274
+ $container: $container-name
275
+ );
276
+
277
+ // e.g. `.md:min-w-shelf-min` or `.lg:min-w-shelf-open`
278
+ $selector: #{$selector-prefix}#{defaults.$min-width-selector-prefix}#{$width};
279
+
280
+ @include utility.create(
281
+ $selector,
282
+ min-width,
283
+ $value,
284
+ $important: defaults.$use-important,
285
+ $container: $container-name
286
+ );
287
+ }
288
+ }
289
+ }
290
+ }
@@ -0,0 +1,6 @@
1
+ // @graupl/navigation-shelf width utilities variables.
2
+ //
3
+ // These values are to be used to directly style components and provide a
4
+ // cleaner way to reference custom properties.
5
+
6
+ @use "defaults";