@nordcode/ui 1.0.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 (66) hide show
  1. package/CHANGELOG.md +157 -0
  2. package/LICENSE.md +661 -0
  3. package/README.md +90 -0
  4. package/index.html +1169 -0
  5. package/out/bundle.css +1400 -0
  6. package/out/bundle_configless.css +1135 -0
  7. package/out/colors.css +87 -0
  8. package/out/complete.css +2647 -0
  9. package/out/complete_configless.css +2382 -0
  10. package/package.json +73 -0
  11. package/src/assets/fonts/DMMono-Regular.woff +0 -0
  12. package/src/assets/fonts/DMMono-Regular.woff2 +0 -0
  13. package/src/assets/fonts/fonts.css +7 -0
  14. package/src/assets/icons/ArrowRightSolid.svelte +1 -0
  15. package/src/assets/icons/arrow-right-solid.svg +1 -0
  16. package/src/assets/icons/favicon.png +0 -0
  17. package/src/assets/icons/favicon.svg +8 -0
  18. package/src/assets/logos/nordcode-logo-icon.svg +3 -0
  19. package/src/assets/logos/nordcode-logo.svg +17 -0
  20. package/src/modules/copyButtons/ts/copyButtons.ts +9 -0
  21. package/src/modules/dialogs/svelte/dialog.svelte +27 -0
  22. package/src/modules/dialogs/ts/LICENCE +171 -0
  23. package/src/modules/dialogs/ts/dialogs.ts +111 -0
  24. package/src/modules/notifications/js/notifications.js +294 -0
  25. package/src/modules/notifications/svelte/NotificationCenter.svelte +18 -0
  26. package/src/modules/notifications/svelte/NotificationTemplate.svelte +16 -0
  27. package/src/modules/sectionObserver/ts/sectionOberserver.ts +34 -0
  28. package/src/styles/bundle.css +7 -0
  29. package/src/styles/bundle_configless.css +5 -0
  30. package/src/styles/complete.css +5 -0
  31. package/src/styles/complete_configless.css +5 -0
  32. package/src/styles/components/badges.css +14 -0
  33. package/src/styles/components/breadcrumbs.css +37 -0
  34. package/src/styles/components/bundle.css +12 -0
  35. package/src/styles/components/buttons.css +256 -0
  36. package/src/styles/components/card.css +55 -0
  37. package/src/styles/components/dialogs.css +116 -0
  38. package/src/styles/components/forms.css +47 -0
  39. package/src/styles/components/gallery.css +66 -0
  40. package/src/styles/components/icons.css +60 -0
  41. package/src/styles/components/inputs/base.css +258 -0
  42. package/src/styles/components/inputs/bundle.css +5 -0
  43. package/src/styles/components/inputs/fields.css +79 -0
  44. package/src/styles/components/inputs/segmented.css +123 -0
  45. package/src/styles/components/inputs/switch.css +42 -0
  46. package/src/styles/components/inputs/tag-select.css +44 -0
  47. package/src/styles/components/lists.css +40 -0
  48. package/src/styles/components/notifications.css +137 -0
  49. package/src/styles/components/tables.css +7 -0
  50. package/src/styles/config/bundle.css +2 -0
  51. package/src/styles/config/config.css +828 -0
  52. package/src/styles/config/extras.css +18 -0
  53. package/src/styles/exceptions/bundle.css +3 -0
  54. package/src/styles/exceptions/misc.css +21 -0
  55. package/src/styles/exceptions/spacings.css +15 -0
  56. package/src/styles/exceptions/typography.css +57 -0
  57. package/src/styles/theme/colors.css +178 -0
  58. package/src/styles/theme/colors_processed.css +87 -0
  59. package/src/styles/utils/base.css +406 -0
  60. package/src/styles/utils/bundle.css +6 -0
  61. package/src/styles/utils/easings.css +364 -0
  62. package/src/styles/utils/layouts.css +298 -0
  63. package/src/styles/utils/media.css +55 -0
  64. package/src/styles/utils/reset.css +128 -0
  65. package/src/styles/utils/theme.css +120 -0
  66. package/transform.js +71 -0
@@ -0,0 +1,258 @@
1
+ @layer components.inputs {
2
+ :where(label:not([class]), .nc-input-label) {
3
+ font-family: var(--font-family-default);
4
+ letter-spacing: var(--tracking-tight);
5
+ font-weight: var(--font-weight-active);
6
+ color: var(--color-text-base);
7
+ display: inline-flex;
8
+ font-size: inherit;
9
+ cursor: pointer;
10
+ gap: 0.15lh;
11
+ align-items: center;
12
+ }
13
+
14
+ :where(
15
+ input[type="text"],
16
+ input[type="email"],
17
+ input[type="password"],
18
+ input[type="number"],
19
+ input[type="url"],
20
+ input[type="search"],
21
+ input[type="date"],
22
+ input[type="month"],
23
+ input[type="week"],
24
+ input[type="text"],
25
+ input[type="datetime"],
26
+ input[type="datetime-local"],
27
+ input[type="time"],
28
+ input[type="tel"],
29
+ input[type="color"],
30
+ input[type="file"],
31
+ input[type="checkbox"],
32
+ input[type="radio"],
33
+ textarea,
34
+ select,
35
+ .nc-input,
36
+ .nc-select,
37
+ .nc-textarea,
38
+ .nc-input-checkbox,
39
+ .nc-input-radio,
40
+ .nc-input-label,
41
+ .nc-input-color,
42
+ .nc-input-field,
43
+ .nc-input-error,
44
+ .nc-checkbox-wrapper,
45
+ .nc-input-switch,
46
+ .nc-radio-field,
47
+ .nc-checkbox-field
48
+ ) {
49
+ --_input-background: var(--input-background, var(--color-surface-subtle));
50
+ --_input-background-active: var(--input-background-active, var(--color-surface-base));
51
+ --_input-color: var(--input-color, var(--color-text-base));
52
+ --_input-border: var(
53
+ --input-border,
54
+ var(--border-width-thin) solid var(--color-border-base)
55
+ );
56
+ --_input-border-radius: var(--input-border-radius, var(--border-radius-medium));
57
+
58
+ --_input-box-shadow: var(--input-box-shadow, var(--shadow-inset));
59
+ --_input-outline: var(
60
+ --input-outline,
61
+ var(--border-width-thick) solid var(--color-brand-primary-base)
62
+ );
63
+ --_input-disabled-filter: var(--input-disabled-filter, contrast(0.72) opacity(0.72));
64
+
65
+ --_input-padding-block: var(--input-padding-block, 0.125lh);
66
+ --_input-padding-inline: var(--input-padding-inline, 1ch);
67
+ --_input-hover-background: var(--input-hover-background, var(--color-brand-primary-hover));
68
+ }
69
+
70
+ :where(
71
+ input[type="text"],
72
+ input[type="email"],
73
+ input[type="password"],
74
+ input[type="number"],
75
+ input[type="url"],
76
+ input[type="search"],
77
+ input[type="date"],
78
+ input[type="month"],
79
+ input[type="week"],
80
+ input[type="text"],
81
+ input[type="datetime"],
82
+ input[type="datetime-local"],
83
+ input[type="time"],
84
+ input[type="tel"],
85
+ input[type="color"],
86
+ input[type="file"],
87
+ textarea,
88
+ select,
89
+ .nc-input
90
+ ) {
91
+ font: inherit;
92
+ letter-spacing: inherit;
93
+ word-spacing: inherit;
94
+ appearance: none;
95
+
96
+ color: var(--_input-color);
97
+ background-color: var(--_input-background);
98
+ border: var(--_input-border);
99
+ border-radius: var(--_input-border-radius);
100
+ block-size: var(--button-height-base);
101
+ padding-inline: var(--_input-padding-inline);
102
+ box-shadow: var(--_input-box-shadow);
103
+ inline-size: var(--input-inline-size, auto);
104
+ line-height: var(--line-height-base);
105
+
106
+ &:focus,
107
+ &:hover:focus {
108
+ --current-background: var(--_input-background-active);
109
+ outline: var(--_input-outline);
110
+ outline-offset: 0;
111
+ background-color: var(--_input-background-active);
112
+ }
113
+
114
+ &:disabled {
115
+ filter: var(--_input-disabled-filter);
116
+ cursor: not-allowed;
117
+ }
118
+
119
+ &:hover {
120
+ --current-background: var(--_input-hover-background);
121
+ background-color: var(--_input-hover-background);
122
+ }
123
+
124
+ &[required] {
125
+ border-inline-start-width: var(--border-width-thick);
126
+ }
127
+
128
+ &::placeholder {
129
+ color: var(--color-text-subtle);
130
+ }
131
+ }
132
+
133
+ :where(select:not([class]), .nc-select) {
134
+ padding-inline-end: 3.5ch;
135
+ background-image: var(--triangle-down-url);
136
+ background-position: right 1ch top 50%;
137
+ background-size: 1.5ch 1.25ch;
138
+ }
139
+
140
+ :where(textarea:not([class]), .nc-textarea) {
141
+ min-block-size: calc(5lh + 2 * var(--_input-padding-block));
142
+ min-inline-size: var(--input-inline-size, 100%);
143
+ max-inline-size: 100%;
144
+ padding-block: var(--_input-padding-block);
145
+ }
146
+
147
+ :where(
148
+ input[type="checkbox"]:not([class]),
149
+ input[type="radio"]:not([class]),
150
+ .nc-input-checkbox,
151
+ .nc-input-radio,
152
+ .nc-input-switch
153
+ ) {
154
+ inline-size: 1lh;
155
+ block-size: 1lh;
156
+ margin: 0;
157
+ padding: 0;
158
+ appearance: none;
159
+ display: inline-flex;
160
+ align-items: center;
161
+ justify-content: center;
162
+ border: var(--_input-border);
163
+ --current-background: var(--_input-background);
164
+ background: var(--current-background);
165
+ cursor: pointer;
166
+ transition: var(--transition-duration-short) background var(--ease-2);
167
+ box-shadow: var(--_input-box-shadow);
168
+ }
169
+
170
+ :where(input[type="checkbox"]:not([class]), .nc-input-checkbox) {
171
+ --_transition-duration: 0ms;
172
+ overflow: hidden;
173
+ border-radius: var(--_input-border-radius);
174
+
175
+ &:before {
176
+ content: "";
177
+ display: inline-flex;
178
+ align-items: center;
179
+ justify-content: center;
180
+ inline-size: 0.75lh;
181
+ block-size: 0.75lh;
182
+ background-color: var(--color-brand-primary-contrast);
183
+ transform: scale(0.8) translateY(2em);
184
+ transition: transform var(--ease-out-2) var(--transition-duration-short);
185
+ font-family: var(--font-family-sans);
186
+ --font-weight: var(--font-weight-active);
187
+ line-height: 1;
188
+ color: var(--_input-background);
189
+ clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
190
+ }
191
+
192
+ &:checked {
193
+ --current-background: var(--color-brand-primary-base);
194
+
195
+ &:before {
196
+ transform: scale(1) translateY(0%);
197
+ }
198
+ }
199
+ }
200
+
201
+ :where(input[type="radio"], .nc-input-radio) {
202
+ border-radius: var(--border-radius-round);
203
+ overflow: hidden;
204
+
205
+ &:before {
206
+ content: "";
207
+ display: inline-flex;
208
+ block-size: 50%;
209
+ inline-size: 50%;
210
+ border-radius: var(--border-radius-round);
211
+ transform: scale(0.8) translateY(2em);
212
+ background-color: var(--color-brand-primary-contrast);
213
+ transition: transform var(--ease-out-2) var(--transition-duration-short);
214
+ }
215
+
216
+ &:checked {
217
+ --current-background: var(--color-brand-primary-base);
218
+
219
+ &:before {
220
+ transform: scale(1) translateY(0%);
221
+ }
222
+ }
223
+ }
224
+
225
+ :where(input[type="color"], .nc-input-color) {
226
+ aspect-ratio: 1;
227
+ inline-size: auto;
228
+ padding: calc(var(--button-height-base) / 12);
229
+ }
230
+
231
+ :where(input[type="date"], .nc-input-date) {
232
+ flex-flow: row nowrap;
233
+ }
234
+
235
+ :where(input[type="range"], .nc-input-range) {
236
+ & > .nc-hint {
237
+ margin-inline-start: auto;
238
+ }
239
+
240
+ &::-webkit-slider-thumb,
241
+ &::-moz-range-thumb {
242
+ appearance: none;
243
+ inline-size: 1lh;
244
+ block-size: 1lh;
245
+ border-radius: var(--_input-border-radius);
246
+ border: var(--_input-border);
247
+ border-color: var(--color-text-base);
248
+ background-color: var(--color-text-base);
249
+ box-shadow: var(--shadow-near);
250
+ cursor: pointer;
251
+
252
+ &:hover {
253
+ background-color: var(--color-brand-primary-base);
254
+ border-color: var(--color-brand-primary-base);
255
+ }
256
+ }
257
+ }
258
+ }
@@ -0,0 +1,5 @@
1
+ @import "./base.css";
2
+ @import "./fields.css";
3
+ @import "./segmented.css";
4
+ @import "./switch.css";
5
+ @import "./tag-select.css";
@@ -0,0 +1,79 @@
1
+ @layer components.input-fields {
2
+ :where(.nc-input-field) {
3
+ display: grid;
4
+ gap: 0.25lh;
5
+ grid-template-columns: minmax(0, 1fr);
6
+ inline-size: 100%;
7
+ min-inline-size: var(--input-field-min-inline-size);
8
+ max-inline-size: var(--input-field-max-inline-size);
9
+ place-items: start;
10
+
11
+ & > label,
12
+ & > .nc-stack {
13
+ gap: 0.125lh;
14
+ line-height: var(--line-height-small);
15
+ }
16
+
17
+ & > .nc-cluster {
18
+ gap: 1ch;
19
+ }
20
+ }
21
+
22
+ :where(.nc-input-error) {
23
+ --color-base: var(--color-status-danger-emphasis);
24
+ color: var(--color-base);
25
+ font-size: var(--font-size-small);
26
+
27
+ &:before {
28
+ content: "!";
29
+ font-family: var(--font-family-default);
30
+ letter-spacing: var(--tracking-tight);
31
+ font-weight: var(--font-weight-default);
32
+ display: inline-flex;
33
+ align-items: center;
34
+ justify-content: center;
35
+ background-color: var(--color-base);
36
+ color: var(--color-surface-subtle);
37
+ margin-inline-end: 1ch;
38
+ inline-size: 1em;
39
+ block-size: 1em;
40
+ flex-shrink: 0;
41
+ }
42
+ }
43
+
44
+ :where(.nc-checkbox-wrapper) {
45
+ display: grid;
46
+ grid-template:
47
+ "checkbox label" 1fr
48
+ / auto 1fr;
49
+ place-items: start;
50
+ gap: 0;
51
+
52
+ & > [data-label] {
53
+ grid-area: label;
54
+ padding-inline-start: 1ch;
55
+ }
56
+
57
+ & .nc-input-label {
58
+ min-block-size: var(--line-height-base);
59
+ }
60
+
61
+ & > [data-input] {
62
+ grid-area: checkbox;
63
+ }
64
+
65
+ &:hover:not(:has(input:checked)) input {
66
+ background: var(--_input-hover-background);
67
+ }
68
+ }
69
+
70
+ :where(.nc-radio-field, .nc-checkbox-field) {
71
+ & fieldset {
72
+ margin-block-start: 0.6lh;
73
+ }
74
+
75
+ & fieldset > *:not(:first-child) {
76
+ margin-block-start: 0.6lh;
77
+ }
78
+ }
79
+ }
@@ -0,0 +1,123 @@
1
+ @layer components.inputs-segmented {
2
+ :where(.nc-segmented-control-group) {
3
+ container: segmented-control / inline-size;
4
+ }
5
+
6
+ :where(.nc-segmented-control) {
7
+ --_segmented-control-border-radius: var(
8
+ --segmented-control-border-radius,
9
+ var(--_input-border-radius)
10
+ );
11
+ --_segmented-control-checked-text-color: var(
12
+ --segmented-control-checked-text-color,
13
+ var(--color-brand-primary-contrast)
14
+ );
15
+ --_segmented-control-checked-surface-color: var(
16
+ --segmented-control-checked-surface-color,
17
+ var(--color-brand-primary-base)
18
+ );
19
+ display: grid;
20
+ grid-auto-rows: 1fr;
21
+ grid-auto-flow: row;
22
+ padding: 0;
23
+ margin: 0;
24
+ border: none;
25
+ box-shadow: var(--_input-box-shadow);
26
+ border-radius: var(--_segmented-control-border-radius);
27
+ background: var(--_input-background);
28
+ block-size: auto;
29
+ inline-size: 100%;
30
+
31
+ & input {
32
+ opacity: 0;
33
+ position: absolute;
34
+ }
35
+
36
+ &:focus-within {
37
+ outline: var(--_input-outline);
38
+ outline-offset: 0;
39
+ }
40
+
41
+ & label {
42
+ display: flex;
43
+ padding-inline: var(--_input-padding-inline);
44
+ padding-block: var(--_input-padding-block);
45
+ min-block-size: var(--segmented-control-min-height, var(--button-height-base));
46
+ color: var(--_input-color);
47
+ border: var(--_input-border);
48
+ align-items: center;
49
+ justify-content: center;
50
+
51
+ > .nc-input-label {
52
+ color: inherit;
53
+ }
54
+
55
+ &:hover {
56
+ --current-background: var(--_input-hover-background);
57
+ background-color: var(--_input-hover-background);
58
+ }
59
+
60
+ &:first-child {
61
+ border-radius: var(--_segmented-control-border-radius)
62
+ var(--_segmented-control-border-radius) 0 0;
63
+ }
64
+
65
+ &:last-child {
66
+ border-radius: 0 0 var(--_segmented-control-border-radius)
67
+ var(--_segmented-control-border-radius);
68
+ }
69
+
70
+ &:not(:last-child) {
71
+ border-block-end: var(--border-width-thin) solid var(--color-border-muted);
72
+ }
73
+
74
+ &:not(:first-child) {
75
+ border-block-start: none;
76
+ }
77
+
78
+ &:has(input:checked) {
79
+ background: var(--_segmented-control-checked-surface-color);
80
+ color: var(--_segmented-control-checked-text-color);
81
+ box-shadow: var(--shadow-near);
82
+ }
83
+
84
+ &:focus-within {
85
+ outline: none;
86
+ }
87
+
88
+ &:has(input:disabled) {
89
+ filter: var(--_input-disabled-filter);
90
+ cursor: not-allowed;
91
+ }
92
+ }
93
+ }
94
+
95
+ @container segmented-control (min-width: 32rem) {
96
+ :where(.nc-segmented-control) {
97
+ grid-auto-columns: 1fr;
98
+ grid-auto-flow: column;
99
+
100
+ > label {
101
+ &:first-child {
102
+ border-radius: var(--_segmented-control-border-radius) 0 0
103
+ var(--_segmented-control-border-radius);
104
+ }
105
+
106
+ &:last-child {
107
+ border-radius: 0 var(--_segmented-control-border-radius)
108
+ var(--_segmented-control-border-radius) 0;
109
+ }
110
+
111
+ &:not(:last-child) {
112
+ border-block-end: var(--_input-border);
113
+ border-inline-end: var(--border-width-thin) solid var(--color-border-muted);
114
+ }
115
+
116
+ &:not(:first-child) {
117
+ border-block-start: var(--_input-border);
118
+ border-inline-start: none;
119
+ }
120
+ }
121
+ }
122
+ }
123
+ }
@@ -0,0 +1,42 @@
1
+ @layer components.input-switch {
2
+ :where(.nc-input-switch) {
3
+ --_switch-width: var(--switch-width, calc(var(--line-height-base) * 2));
4
+ --_switch-height: var(--switch-height, calc(var(--_switch-width) / 2));
5
+ --_switch-color: var(--switch-color, var(--_input-background));
6
+ --_switch-color-checked: var(--switch-color-checked, var(--color-brand-primary-base));
7
+ --_thumb-margin: var(--thumb-margin, calc(var(--_switch-width) / 12));
8
+ --_thumb-color: var(--thumb-color, var(--_input-color));
9
+
10
+ vertical-align: var(--_thumb-margin);
11
+ inline-size: var(--_switch-width);
12
+ block-size: var(--_switch-height);
13
+ border-radius: var(--_input-border-radius);
14
+ --current-background: var(--_switch-color);
15
+ justify-content: flex-start;
16
+
17
+ &:before {
18
+ content: "";
19
+ display: block;
20
+ aspect-ratio: 1;
21
+ margin-block: var(--_thumb-margin);
22
+ transform: translateX(var(--_thumb-margin));
23
+ block-size: calc(100% - 2 * var(--_thumb-margin));
24
+ background-color: var(--_thumb-color);
25
+ border-radius: var(--_input-border-radius);
26
+ box-shadow: var(--shadow-near);
27
+ transition: transform, background-color;
28
+ transition-duration: var(--transition-duration-base);
29
+ transition-timing-function: var(--ease-2);
30
+ }
31
+
32
+ &:checked {
33
+ --current-background: var(--_switch-color-checked);
34
+ }
35
+
36
+ &:checked:before {
37
+ transform: translateX(
38
+ calc(var(--_switch-width) - var(--_switch-height) + var(--_thumb-margin))
39
+ );
40
+ }
41
+ }
42
+ }
@@ -0,0 +1,44 @@
1
+ @layer components.inputs {
2
+ :where(.nc-tag-select-field) {
3
+ --_tag-select-checked-text-color: var(
4
+ --tag-select-checked-text-color,
5
+ var(--color-brand-primary-contrast)
6
+ );
7
+ --_tag-select-checked-surface-color: var(
8
+ --tag-select-checked-surface-color,
9
+ var(--color-brand-primary-base)
10
+ );
11
+ --_tag-select-border-radius: var(--tag-select-border-radius, var(--_input-border-radius));
12
+
13
+ &:focus-within:has(:focus-visible) {
14
+ outline-offset: 1ch;
15
+ outline: var(--_input-outline);
16
+ border-radius: var(--_tag-select-border-radius);
17
+ }
18
+
19
+ & input {
20
+ opacity: 0;
21
+ position: absolute;
22
+ }
23
+
24
+ & label {
25
+ display: grid;
26
+
27
+ &:hover,
28
+ &:focus-within {
29
+ background-color: var(--_input-hover-background);
30
+ }
31
+
32
+ &:has(input:checked) {
33
+ background: var(--_tag-select-checked-surface-color);
34
+ color: var(--_tag-select-checked-text-color);
35
+ box-shadow: var(--shadow-near);
36
+ }
37
+
38
+ &:has(input:disabled) {
39
+ filter: var(--_input-disabled-filter);
40
+ cursor: not-allowed;
41
+ }
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,40 @@
1
+ @layer components.lists {
2
+ :where(.nc-meta-list) {
3
+ inline-size: 100%;
4
+ container: metalist / inline-size;
5
+ }
6
+
7
+ :where(.nc-meta-list-item) {
8
+ overflow-wrap: break-word;
9
+ max-inline-size: 100%;
10
+ hyphens: auto;
11
+ inline-size: 100%;
12
+
13
+ &:not(:last-child) {
14
+ margin-block-end: 1ch;
15
+ }
16
+ }
17
+
18
+ @container metalist (min-width: 20rem) {
19
+ :where(.nc-meta-list-item) {
20
+ inline-size: auto;
21
+
22
+ &:not(:last-child):after {
23
+ content: '';
24
+ border-right: var(--border-width-medium) solid var(--color-border-muted);
25
+ margin: 0 1ch;
26
+ transform: calc(var(--border-width-medium) / 2);
27
+ }
28
+ }
29
+ }
30
+
31
+ :where(.nc-list-reset) {
32
+ list-style: none;
33
+ padding: 0;
34
+ margin: 0;
35
+
36
+ & li {
37
+ margin: 0;
38
+ }
39
+ }
40
+ }