@mrcaktuz/sds-tokens 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,397 +1,429 @@
1
1
  // src/colors.ts
2
- var colors = {
3
- gray: {
4
- white: "#ffffff",
5
- lightest: "#f5f4f4",
6
- lighter: "#e3e3e3",
7
- light: "#cacaca",
8
- default: "#9a9a9a",
9
- dark: "#696969",
10
- darker: "#202020",
11
- darkest: "#141414"
12
- },
13
- brand: {
14
- lightest: "#e4f0ff",
15
- lighter: "#99c5ff",
16
- light: "#004baf",
17
- default: "#003781",
18
- dark: "#00316f",
19
- darker: "#002a5c",
20
- darkest: "#001633"
21
- },
22
- success: {
23
- lightest: "#ebfaf1",
24
- lighter: "#b2ddc8",
25
- light: "#4eb184",
26
- default: "#3a8362",
27
- dark: "#327155",
28
- darker: "#295b44",
29
- darkest: "#1c3b2e"
30
- },
31
- warning: {
32
- lightest: "#fff2e8",
33
- lighter: "#fdd2a0",
34
- light: "#fdb35e",
35
- default: "#ff832b",
36
- dark: "#bd5b00",
37
- darker: "#7a3e03",
38
- darkest: "#361b00"
39
- },
40
- danger: {
41
- lightest: "#fff1f1",
42
- lighter: "#f09e9e",
43
- light: "#e35656",
44
- default: "#d32222",
45
- dark: "#a10505",
46
- darker: "#730202",
47
- darkest: "#440101"
48
- },
49
- visited: {
50
- lightest: "#f8e9fc",
51
- lighter: "#ecc2f7",
52
- light: "#d575eb",
53
- default: "#c029df",
54
- dark: "#8a17a1",
55
- darker: "#6d127e",
56
- darkest: "#310839"
57
- }
2
+ const colors = {
3
+ gray: {
4
+ white: "#ffffff",
5
+ lightest: "#f5f4f4",
6
+ lighter: "#e3e3e3",
7
+ light: "#cacaca",
8
+ default: "#9a9a9a",
9
+ dark: "#696969",
10
+ darker: "#202020",
11
+ darkest: "#141414"
12
+ },
13
+ brand: {
14
+ lightest: "#e4f0ff",
15
+ lighter: "#99c5ff",
16
+ light: "#004baf",
17
+ default: "#003781",
18
+ dark: "#00316f",
19
+ darker: "#002a5c",
20
+ darkest: "#001633"
21
+ },
22
+ success: {
23
+ lightest: "#ebfaf1",
24
+ lighter: "#b2ddc8",
25
+ light: "#4eb184",
26
+ default: "#3a8362",
27
+ dark: "#327155",
28
+ darker: "#295b44",
29
+ darkest: "#1c3b2e"
30
+ },
31
+ warning: {
32
+ lightest: "#fff2e8",
33
+ lighter: "#fdd2a0",
34
+ light: "#fdb35e",
35
+ default: "#ff832b",
36
+ dark: "#bd5b00",
37
+ darker: "#7a3e03",
38
+ darkest: "#361b00"
39
+ },
40
+ danger: {
41
+ lightest: "#fff1f1",
42
+ lighter: "#f09e9e",
43
+ light: "#e35656",
44
+ default: "#d32222",
45
+ dark: "#a10505",
46
+ darker: "#730202",
47
+ darkest: "#440101"
48
+ },
49
+ visited: {
50
+ lightest: "#f8e9fc",
51
+ lighter: "#ecc2f7",
52
+ light: "#d575eb",
53
+ default: "#c029df",
54
+ dark: "#8a17a1",
55
+ darker: "#6d127e",
56
+ darkest: "#310839"
57
+ }
58
58
  };
59
-
60
59
  // src/theme/background.ts
61
- var backgroundTheme = {
62
- content: {
63
- light: colors.gray.white,
64
- dark: colors.gray.darkest
65
- },
66
- graySoft: {
67
- light: colors.gray.lightest,
68
- dark: colors.gray.darker
69
- },
70
- gray: {
71
- light: colors.gray.light,
72
- dark: colors.gray.darker
73
- },
74
- grayHover: {
75
- light: colors.gray.light,
76
- dark: colors.gray.darkest
77
- },
78
- grayStrong: {
79
- light: colors.gray.darker,
80
- dark: colors.gray.default
81
- },
82
- overlay: {
83
- light: "rgba(20, 20, 20, 0.2)",
84
- dark: "rgba(20, 20, 20, 0.2)"
85
- },
86
- brand: {
87
- light: colors.brand.default,
88
- dark: colors.brand.light
89
- },
90
- brandHover: {
91
- light: colors.brand.light,
92
- dark: colors.brand.default
93
- },
94
- brandSoft: {
95
- light: colors.brand.lightest,
96
- dark: colors.brand.darker
97
- },
98
- success: {
99
- light: colors.success.default,
100
- dark: colors.success.default
101
- },
102
- successHover: {
103
- light: colors.success.light,
104
- dark: colors.success.light
105
- },
106
- successSoft: {
107
- light: colors.success.lightest,
108
- dark: colors.success.darkest
109
- },
110
- warning: {
111
- light: colors.warning.default,
112
- dark: colors.warning.default
113
- },
114
- warningHover: {
115
- light: colors.warning.light,
116
- dark: colors.warning.light
117
- },
118
- warningSoft: {
119
- light: colors.warning.lightest,
120
- dark: colors.warning.darkest
121
- },
122
- danger: {
123
- light: colors.danger.default,
124
- dark: colors.danger.default
125
- },
126
- dangerHover: {
127
- light: colors.danger.light,
128
- dark: colors.danger.light
129
- },
130
- dangerSoft: {
131
- light: colors.danger.lightest,
132
- dark: colors.danger.darkest
133
- },
134
- visited: {
135
- light: colors.visited.default,
136
- dark: colors.visited.dark
137
- },
138
- visitedSoft: {
139
- light: colors.visited.lightest,
140
- dark: colors.visited.darker
141
- }
60
+ const backgroundTheme = {
61
+ content: {
62
+ light: colors.gray.white,
63
+ dark: colors.gray.darkest
64
+ },
65
+ graySoft: {
66
+ light: colors.gray.lightest,
67
+ dark: colors.gray.darker
68
+ },
69
+ gray: {
70
+ light: colors.gray.light,
71
+ dark: colors.gray.darker
72
+ },
73
+ grayHover: {
74
+ light: colors.gray.light,
75
+ dark: colors.gray.darkest
76
+ },
77
+ grayStrong: {
78
+ light: colors.gray.darker,
79
+ dark: colors.gray.default
80
+ },
81
+ overlay: {
82
+ light: "rgba(20, 20, 20, 0.2)",
83
+ dark: "rgba(20, 20, 20, 0.2)"
84
+ },
85
+ brand: {
86
+ light: colors.brand.default,
87
+ dark: colors.brand.light
88
+ },
89
+ brandHover: {
90
+ light: colors.brand.light,
91
+ dark: colors.brand.default
92
+ },
93
+ brandSoft: {
94
+ light: colors.brand.lightest,
95
+ dark: colors.brand.darker
96
+ },
97
+ success: {
98
+ light: colors.success.default,
99
+ dark: colors.success.default
100
+ },
101
+ successHover: {
102
+ light: colors.success.light,
103
+ dark: colors.success.light
104
+ },
105
+ successSoft: {
106
+ light: colors.success.lightest,
107
+ dark: colors.success.darkest
108
+ },
109
+ warning: {
110
+ light: colors.warning.default,
111
+ dark: colors.warning.default
112
+ },
113
+ warningHover: {
114
+ light: colors.warning.light,
115
+ dark: colors.warning.light
116
+ },
117
+ warningSoft: {
118
+ light: colors.warning.lightest,
119
+ dark: colors.warning.darkest
120
+ },
121
+ danger: {
122
+ light: colors.danger.default,
123
+ dark: colors.danger.default
124
+ },
125
+ dangerHover: {
126
+ light: colors.danger.light,
127
+ dark: colors.danger.light
128
+ },
129
+ dangerSoft: {
130
+ light: colors.danger.lightest,
131
+ dark: colors.danger.darkest
132
+ },
133
+ visited: {
134
+ light: colors.visited.default,
135
+ dark: colors.visited.dark
136
+ },
137
+ visitedSoft: {
138
+ light: colors.visited.lightest,
139
+ dark: colors.visited.darker
140
+ }
142
141
  };
143
-
144
142
  // src/theme/border.ts
145
- var borderTheme = {
146
- focus: {
147
- light: colors.brand.lighter,
148
- dark: colors.brand.lighter
149
- },
150
- gray: {
151
- light: colors.gray.light,
152
- dark: colors.gray.dark
153
- },
154
- graySoft: {
155
- light: colors.gray.lighter,
156
- dark: colors.gray.dark
157
- },
158
- grayStrong: {
159
- light: colors.gray.dark,
160
- dark: colors.gray.light
161
- },
162
- brand: {
163
- light: colors.brand.default,
164
- dark: colors.brand.light
165
- },
166
- brandSoft: {
167
- light: colors.brand.lighter,
168
- dark: colors.brand.dark
169
- },
170
- success: {
171
- light: colors.success.default,
172
- dark: colors.success.dark
173
- },
174
- successSoft: {
175
- light: colors.success.lighter,
176
- dark: colors.success.darker
177
- },
178
- warning: {
179
- light: colors.warning.default,
180
- dark: colors.warning.dark
181
- },
182
- warningSoft: {
183
- light: colors.warning.lighter,
184
- dark: colors.warning.darker
185
- },
186
- danger: {
187
- light: colors.danger.default,
188
- dark: colors.danger.dark
189
- },
190
- dangerSoft: {
191
- light: colors.danger.lighter,
192
- dark: colors.danger.darker
193
- },
194
- visited: {
195
- light: colors.visited.default,
196
- dark: colors.visited.dark
197
- },
198
- visitedSoft: {
199
- light: colors.visited.lighter,
200
- dark: colors.visited.darker
201
- }
143
+ const borderTheme = {
144
+ focus: {
145
+ light: colors.brand.lighter,
146
+ dark: colors.brand.lighter
147
+ },
148
+ gray: {
149
+ light: colors.gray.light,
150
+ dark: colors.gray.dark
151
+ },
152
+ graySoft: {
153
+ light: colors.gray.lighter,
154
+ dark: colors.gray.dark
155
+ },
156
+ grayStrong: {
157
+ light: colors.gray.dark,
158
+ dark: colors.gray.light
159
+ },
160
+ brand: {
161
+ light: colors.brand.default,
162
+ dark: colors.brand.light
163
+ },
164
+ brandSoft: {
165
+ light: colors.brand.lighter,
166
+ dark: colors.brand.dark
167
+ },
168
+ success: {
169
+ light: colors.success.default,
170
+ dark: colors.success.dark
171
+ },
172
+ successSoft: {
173
+ light: colors.success.lighter,
174
+ dark: colors.success.darker
175
+ },
176
+ warning: {
177
+ light: colors.warning.default,
178
+ dark: colors.warning.dark
179
+ },
180
+ warningSoft: {
181
+ light: colors.warning.lighter,
182
+ dark: colors.warning.darker
183
+ },
184
+ danger: {
185
+ light: colors.danger.default,
186
+ dark: colors.danger.dark
187
+ },
188
+ dangerSoft: {
189
+ light: colors.danger.lighter,
190
+ dark: colors.danger.darker
191
+ },
192
+ visited: {
193
+ light: colors.visited.default,
194
+ dark: colors.visited.dark
195
+ },
196
+ visitedSoft: {
197
+ light: colors.visited.lighter,
198
+ dark: colors.visited.darker
199
+ }
202
200
  };
203
-
204
201
  // src/theme/content.ts
205
- var contentTheme = {
206
- default: {
207
- light: colors.gray.darkest,
208
- dark: colors.gray.lightest
209
- },
210
- inverse: {
211
- light: colors.gray.white,
212
- dark: colors.gray.white
213
- },
214
- gray: {
215
- light: colors.gray.dark,
216
- dark: colors.gray.light
217
- },
218
- graySoft: {
219
- light: colors.gray.default,
220
- dark: colors.gray.default
221
- },
222
- grayStrong: {
223
- light: colors.gray.darker,
224
- dark: colors.gray.lighter
225
- },
226
- brand: {
227
- light: colors.brand.default,
228
- dark: colors.brand.lighter
229
- },
230
- brandHover: {
231
- light: colors.brand.light,
232
- dark: colors.brand.light
233
- },
234
- success: {
235
- light: colors.success.default,
236
- dark: colors.success.light
237
- },
238
- warning: {
239
- light: colors.warning.dark,
240
- dark: colors.warning.default
241
- },
242
- danger: {
243
- light: colors.danger.default,
244
- dark: colors.danger.light
245
- },
246
- visited: {
247
- light: colors.visited.default,
248
- dark: colors.visited.default
249
- }
202
+ const contentTheme = {
203
+ default: {
204
+ light: colors.gray.darkest,
205
+ dark: colors.gray.lightest
206
+ },
207
+ inverse: {
208
+ light: colors.gray.white,
209
+ dark: colors.gray.white
210
+ },
211
+ gray: {
212
+ light: colors.gray.dark,
213
+ dark: colors.gray.light
214
+ },
215
+ graySoft: {
216
+ light: colors.gray.default,
217
+ dark: colors.gray.default
218
+ },
219
+ grayStrong: {
220
+ light: colors.gray.darker,
221
+ dark: colors.gray.lighter
222
+ },
223
+ brand: {
224
+ light: colors.brand.default,
225
+ dark: colors.brand.lighter
226
+ },
227
+ brandHover: {
228
+ light: colors.brand.light,
229
+ dark: colors.brand.light
230
+ },
231
+ success: {
232
+ light: colors.success.default,
233
+ dark: colors.success.light
234
+ },
235
+ warning: {
236
+ light: colors.warning.dark,
237
+ dark: colors.warning.default
238
+ },
239
+ danger: {
240
+ light: colors.danger.default,
241
+ dark: colors.danger.light
242
+ },
243
+ visited: {
244
+ light: colors.visited.default,
245
+ dark: colors.visited.default
246
+ }
250
247
  };
251
-
252
248
  // src/theme/index.ts
253
- var themeModes = ["light", "dark"];
254
-
249
+ const themeModes = ["light", "dark"];
255
250
  // src/spacing.ts
256
- var generateSpacers = (count, step) => {
257
- const spacers2 = { 0: 0, 2: 2 };
258
- for (let i = 1; i <= count; i++) {
259
- spacers2[i * step] = i * step;
260
- }
261
- return spacers2;
251
+ const generateSpacers = (count, step) => {
252
+ const spacers = {
253
+ 0: 0,
254
+ 2: 2
255
+ };
256
+ for (let i = 1; i <= count; i++) spacers[i * step] = i * step;
257
+ return spacers;
262
258
  };
263
- var spacers = generateSpacers(40, 4);
264
-
259
+ const spacers = generateSpacers(50, 4);
265
260
  // src/typography.ts
266
- var fontFamilies = {
267
- sans: { name: "Open Sans", fallback: "sans-serif" }
261
+ const fontFamilies = { sans: {
262
+ name: "Open Sans",
263
+ fallback: "sans-serif"
264
+ } };
265
+ const fontWeights = {
266
+ light: 300,
267
+ regular: 400,
268
+ semibold: 600,
269
+ bold: 800
268
270
  };
269
- var fontWeights = {
270
- light: 300,
271
- regular: 400,
272
- semibold: 600,
273
- bold: 800
271
+ const fontSizes = {
272
+ 0: 0,
273
+ sm: 12,
274
+ md: 14,
275
+ lg: 16,
276
+ big: 18,
277
+ hero: 24
274
278
  };
275
- var fontSizes = {
276
- 0: 0,
277
- sm: 12,
278
- md: 14,
279
- lg: 16,
280
- big: 18,
281
- hero: 24
282
- };
283
-
284
279
  // src/border.ts
285
- var radius = {
286
- 0: 0,
287
- btn: 4,
288
- input: 4,
289
- card: 8,
290
- pill: 100,
291
- round: "50%"
280
+ const radius = {
281
+ 0: 0,
282
+ btn: 4,
283
+ input: 4,
284
+ card: 8,
285
+ pill: 100,
286
+ round: "50%"
292
287
  };
293
- var borderWidths = {
294
- 0: 0,
295
- 1: 1,
296
- 2: 2,
297
- 3: 3
288
+ const borderWidths = {
289
+ 0: 0,
290
+ 1: 1,
291
+ 2: 2,
292
+ 3: 3
298
293
  };
299
-
300
294
  // src/breakpoints.ts
301
- var breakpoints = {
302
- xs: 0,
303
- sm: 480,
304
- md: 680,
305
- lg: 1024,
306
- xl: 1200,
307
- xxl: 1400
295
+ const breakpoints = {
296
+ xs: 0,
297
+ sm: 480,
298
+ md: 680,
299
+ lg: 1024,
300
+ xl: 1200,
301
+ xxl: 1400
308
302
  };
309
-
310
303
  // src/transitions.ts
311
- var transitions = {
312
- default: { property: "all", duration: 300, timing: "ease-in-out", delay: 0 },
313
- chevronRotate: { property: "transform", duration: 300, timing: "ease-in-out", delay: 75 }
304
+ const transitions = {
305
+ default: {
306
+ property: "all",
307
+ duration: 300,
308
+ timing: "ease-in-out",
309
+ delay: 0
310
+ },
311
+ chevronRotate: {
312
+ property: "transform",
313
+ duration: 300,
314
+ timing: "ease-in-out",
315
+ delay: 75
316
+ }
314
317
  };
315
-
316
318
  // src/components/button.ts
317
- var primary = (content, background, backgroundHover) => ({ content, background, backgroundHover, border: null, borderHover: null });
318
- var outline = (content, backgroundHover) => ({ content, background: null, backgroundHover, border: "currentColor", borderHover: null });
319
- var ghost = (content, backgroundHover) => ({ content, background: null, backgroundHover, border: null, borderHover: null });
320
- var button = {
321
- base: {
322
- padding: { x: 16, y: 12 },
323
- // From the `md` breakpoint (web only, native follows the mobile values)
324
- paddingFromMd: { x: 16, y: 8 },
325
- gap: 8,
326
- iconSize: 16,
327
- radius: "btn",
328
- fontSize: "md",
329
- fontWeight: "semibold",
330
- lineHeight: 1.15,
331
- borderWidth: 1
332
- },
333
- small: {
334
- paddingFromMd: { x: 8, y: 4 }
335
- },
336
- iconOnly: {
337
- padding: 8
338
- },
339
- variants: {
340
- primary: {
341
- brand: primary("inverse", "brand", "brandHover"),
342
- gray: primary("inverse", "brand", "brandHover"),
343
- success: primary("inverse", "success", "successHover"),
344
- warning: primary("default", "warning", "warningHover"),
345
- danger: primary("inverse", "danger", "dangerHover")
346
- },
347
- outline: {
348
- brand: outline("brand", "brandSoft"),
349
- success: outline("brand", "brandSoft"),
350
- warning: outline("brand", "brandSoft"),
351
- gray: outline("default", "grayHover"),
352
- danger: outline("danger", "dangerSoft")
353
- },
354
- ghost: {
355
- brand: ghost("brand", "brandSoft"),
356
- warning: ghost("warning", "warningSoft"),
357
- // Uses the primary styles in legacy: strong hover and primary disabled state
358
- success: { ...ghost("success", "successHover"), disabledAs: "primary" },
359
- gray: ghost("default", "graySoft"),
360
- danger: ghost("danger", "dangerSoft")
361
- }
362
- },
363
- disabled: {
364
- primary: { content: "graySoft", background: "graySoft", border: "currentColor" },
365
- outline: { content: "graySoft", background: null, border: "gray" },
366
- ghost: { content: "graySoft", background: null, border: null }
367
- }
319
+ const primary = (content, background, backgroundHover) => ({
320
+ content,
321
+ background,
322
+ backgroundHover,
323
+ border: null,
324
+ borderHover: null
325
+ });
326
+ const outline = (content, backgroundHover) => ({
327
+ content,
328
+ background: null,
329
+ backgroundHover,
330
+ border: "currentColor",
331
+ borderHover: null
332
+ });
333
+ const ghost = (content, backgroundHover) => ({
334
+ content,
335
+ background: null,
336
+ backgroundHover,
337
+ border: null,
338
+ borderHover: null
339
+ });
340
+ const button = {
341
+ base: {
342
+ padding: {
343
+ x: 16,
344
+ y: 12
345
+ },
346
+ paddingFromMd: {
347
+ x: 16,
348
+ y: 8
349
+ },
350
+ gap: 8,
351
+ iconSize: 16,
352
+ radius: "btn",
353
+ fontSize: "md",
354
+ fontWeight: "semibold",
355
+ lineHeight: 1.15,
356
+ borderWidth: 1
357
+ },
358
+ small: { paddingFromMd: {
359
+ x: 8,
360
+ y: 4
361
+ } },
362
+ iconOnly: { padding: 8 },
363
+ variants: {
364
+ primary: {
365
+ brand: primary("inverse", "brand", "brandHover"),
366
+ gray: primary("inverse", "brand", "brandHover"),
367
+ success: primary("inverse", "success", "successHover"),
368
+ warning: primary("default", "warning", "warningHover"),
369
+ danger: primary("inverse", "danger", "dangerHover")
370
+ },
371
+ outline: {
372
+ brand: outline("brand", "brandSoft"),
373
+ success: outline("brand", "brandSoft"),
374
+ warning: outline("brand", "brandSoft"),
375
+ gray: outline("default", "grayHover"),
376
+ danger: outline("danger", "dangerSoft")
377
+ },
378
+ ghost: {
379
+ brand: ghost("brand", "brandSoft"),
380
+ warning: ghost("warning", "warningSoft"),
381
+ success: {
382
+ ...ghost("success", "successHover"),
383
+ disabledAs: "primary"
384
+ },
385
+ gray: ghost("default", "graySoft"),
386
+ danger: ghost("danger", "dangerSoft")
387
+ }
388
+ },
389
+ disabled: {
390
+ primary: {
391
+ content: "graySoft",
392
+ background: "graySoft",
393
+ border: "currentColor"
394
+ },
395
+ outline: {
396
+ content: "graySoft",
397
+ background: null,
398
+ border: "gray"
399
+ },
400
+ ghost: {
401
+ content: "graySoft",
402
+ background: null,
403
+ border: null
404
+ }
405
+ }
368
406
  };
369
- var buttonTokens = button;
370
- var defaultButtonVariant = "primary";
371
- var defaultButtonColor = "brand";
372
- var getButtonColors = (variant, color) => button.variants[variant][color];
373
- var getButtonDisabledColors = (variant, color) => button.disabled[getButtonColors(variant, color).disabledAs ?? variant];
374
-
375
- // src/index.ts
376
- var cssPrefix = "sds";
377
- export {
378
- backgroundTheme,
379
- borderTheme,
380
- borderWidths,
381
- breakpoints,
382
- buttonTokens,
383
- colors,
384
- contentTheme,
385
- cssPrefix,
386
- defaultButtonColor,
387
- defaultButtonVariant,
388
- fontFamilies,
389
- fontSizes,
390
- fontWeights,
391
- getButtonColors,
392
- getButtonDisabledColors,
393
- radius,
394
- spacers,
395
- themeModes,
396
- transitions
407
+ const buttonTokens = button;
408
+ const defaultButtonVariant = "primary";
409
+ const defaultButtonColor = "brand";
410
+ const getButtonColors = (variant, color) => button.variants[variant][color];
411
+ const getButtonDisabledColors = (variant, color) => button.disabled[getButtonColors(variant, color).disabledAs ?? variant];
412
+ const mainGridTokens = {
413
+ columns: 12,
414
+ gap: 12,
415
+ padding: 20
397
416
  };
417
+ const mainNavTokens = {
418
+ widthCollapsed: 48,
419
+ widthExpanded: 200,
420
+ padding: 8,
421
+ gap: 4,
422
+ iconBox: 32,
423
+ iconSize: 20,
424
+ chevronSize: 16,
425
+ submenuMinWidth: 200
426
+ };
427
+ // src/index.ts
428
+ const cssPrefix = "sds";
429
+ export { backgroundTheme, borderTheme, borderWidths, breakpoints, buttonTokens, colors, contentTheme, cssPrefix, defaultButtonColor, defaultButtonVariant, fontFamilies, fontSizes, fontWeights, getButtonColors, getButtonDisabledColors, mainGridTokens, mainNavTokens, radius, spacers, themeModes, transitions };