tide-design-system 2.0.34 → 2.0.35
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/.storybook/main.ts +1 -1
- package/.storybook/preview.ts +2 -0
- package/dist/css/grid-layout.css +12 -10
- package/dist/css/reset.css +2 -2
- package/dist/css/utilities.css +100 -0
- package/dist/css/variables.css +9 -14
- package/dist/style.css +1 -1
- package/dist/tide-design-system.cjs +2 -2
- package/dist/tide-design-system.esm.d.ts +24 -11
- package/dist/tide-design-system.esm.js +196 -177
- package/dist/utilities/storybook.ts +11 -1
- package/package.json +3 -1
- package/src/assets/css/grid-layout.css +12 -10
- package/src/assets/css/reset.css +2 -2
- package/src/assets/css/utilities.css +100 -0
- package/src/assets/css/variables.css +9 -14
- package/src/components/TideImage.vue +2 -6
- package/src/stories/FoundationsGrid.stories.ts +309 -0
- package/src/stories/FoundationsTypography.stories.ts +39 -23
- package/src/stories/TideImage.stories.ts +38 -0
- package/src/types/Storybook.ts +55 -20
- package/src/types/Styles.ts +24 -3
- package/src/utilities/storybook.ts +11 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ArgTypes } from '@storybook/vue3';
|
|
2
2
|
|
|
3
|
-
import { BOOLEAN_UNREQUIRED } from '@/types/Storybook';
|
|
3
|
+
import { BOOLEAN, BOOLEAN_UNREQUIRED } from '@/types/Storybook';
|
|
4
4
|
import { CSS } from '@/types/Styles';
|
|
5
5
|
import { ELEMENT, ELEMENT_TEXT_AS_ICON } from '@/types/Element';
|
|
6
6
|
|
|
@@ -20,6 +20,16 @@ import { NoneAsEmpty, NoneAsUndefined } from '@/types/Storybook';
|
|
|
20
20
|
export const lineBreak = '\r';
|
|
21
21
|
export const tab = ' ';
|
|
22
22
|
|
|
23
|
+
export const argTypeBoolean = {
|
|
24
|
+
control: 'select',
|
|
25
|
+
description: 'Determines whether CSS utility is present',
|
|
26
|
+
options: BOOLEAN,
|
|
27
|
+
table: {
|
|
28
|
+
defaultValue: { summary: 'False' },
|
|
29
|
+
type: { summary: 'boolean' },
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
23
33
|
export const argTypeBooleanUnrequired = {
|
|
24
34
|
control: 'select',
|
|
25
35
|
description: 'True, False, or undefined<br />(for demonstration purposes)',
|
package/package.json
CHANGED
|
@@ -41,8 +41,10 @@
|
|
|
41
41
|
"build-only": "vite build && cp -r src/assets/css/ dist/css/ && cp -r src/utilities/ dist/utilities/",
|
|
42
42
|
"build-storybook": "storybook build && cp -r src/assets/css/realm/ storybook-static/public/",
|
|
43
43
|
"coverage": "vitest run --coverage",
|
|
44
|
+
"dev": "vite",
|
|
44
45
|
"lint": "eslint . --ext .js,.ts,.vue --ignore-path .gitignore",
|
|
45
46
|
"lint:fix": "eslint . --ext .js,.ts,.vue --ignore-path .gitignore --fix",
|
|
47
|
+
"precommit": "npm run lint:fix && npm run type-check",
|
|
46
48
|
"preview": "npm run build-storybook && npx http-server -a localhost storybook-static/",
|
|
47
49
|
"storybook": "storybook dev -p 6006",
|
|
48
50
|
"test": "vitest run",
|
|
@@ -52,5 +54,5 @@
|
|
|
52
54
|
"main": "dist/tide-design-system.cjs",
|
|
53
55
|
"module": "dist/tide-design-system.esm.js",
|
|
54
56
|
"types": "dist/tide-design-system.esm.d.ts",
|
|
55
|
-
"version": "2.0.
|
|
57
|
+
"version": "2.0.35"
|
|
56
58
|
}
|
|
@@ -11,6 +11,14 @@
|
|
|
11
11
|
--tide-gap-width: var(--tide-spacing-1);
|
|
12
12
|
--tide-gutter-width: var(--tide-spacing-1);
|
|
13
13
|
--tide-gutter-width-offset: calc(var(--tide-gutter-width) - var(--tide-gap-width));
|
|
14
|
+
|
|
15
|
+
display: grid;
|
|
16
|
+
grid-auto-rows: min-content;
|
|
17
|
+
grid-template-columns:
|
|
18
|
+
minmax(var(--tide-gutter-width-offset), 1fr)
|
|
19
|
+
repeat(var(--tide-column-count), var(--tide-column-width))
|
|
20
|
+
minmax(var(--tide-gutter-width-offset), 1fr);
|
|
21
|
+
gap: var(--tide-spacing-1) var(--tide-gap-width);
|
|
14
22
|
}
|
|
15
23
|
|
|
16
24
|
@media (min-width: 768px) {
|
|
@@ -29,18 +37,12 @@
|
|
|
29
37
|
--tide-max-content-width: var(--tide-1920px);
|
|
30
38
|
}
|
|
31
39
|
|
|
32
|
-
.tide-grid-layout
|
|
33
|
-
|
|
34
|
-
grid-
|
|
35
|
-
grid-template-columns:
|
|
36
|
-
minmax(var(--tide-gutter-width-offset), 1fr)
|
|
37
|
-
repeat(12, var(--tide-column-width))
|
|
38
|
-
minmax(var(--tide-gutter-width-offset), 1fr);
|
|
39
|
-
gap: var(--tide-spacing-1) var(--tide-gap-width);
|
|
40
|
+
.tide-grid-layout > *,
|
|
41
|
+
.tide-grid-item {
|
|
42
|
+
grid-column: 2 / -2;
|
|
40
43
|
}
|
|
41
44
|
|
|
42
|
-
.tide-
|
|
43
|
-
.tide-fluid {grid-column: 1 / -1;}
|
|
45
|
+
.tide-fluid {grid-column: 1 / -1;}
|
|
44
46
|
|
|
45
47
|
.tide-start-0 {grid-column-start: 1;}
|
|
46
48
|
.tide-start-1 {grid-column-start: 2;}
|
package/src/assets/css/reset.css
CHANGED
|
@@ -12,7 +12,7 @@ body {
|
|
|
12
12
|
padding: 0;
|
|
13
13
|
color: inherit;
|
|
14
14
|
font-family: Montserrat;
|
|
15
|
-
font-weight:
|
|
15
|
+
font-weight: 400;
|
|
16
16
|
-webkit-font-smoothing: antialiased;
|
|
17
17
|
-moz-osx-font-smoothing: grayscale;
|
|
18
18
|
}
|
|
@@ -28,7 +28,7 @@ h2,
|
|
|
28
28
|
h3,
|
|
29
29
|
h4,
|
|
30
30
|
h5 {
|
|
31
|
-
font-weight:
|
|
31
|
+
font-weight: 700;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
img,
|
|
@@ -229,6 +229,26 @@
|
|
|
229
229
|
.tide-transparent-300 {background-color: var(--tide-transparent-300);}
|
|
230
230
|
.tide-transparent-400 {background-color: var(--tide-transparent-400);}
|
|
231
231
|
|
|
232
|
+
/* Typographic roles */
|
|
233
|
+
.tide-typography-display-1 {font-size: var(--tide-font-32); font-weight: 700;}
|
|
234
|
+
.tide-typography-headline-1 {font-size: var(--tide-font-24); font-weight: 700;}
|
|
235
|
+
.tide-typography-headline-2 {font-size: var(--tide-font-20); font-weight: 700;}
|
|
236
|
+
.tide-typography-headline-3 {font-size: var(--tide-font-16); font-weight: 700;}
|
|
237
|
+
.tide-typography-title-1 {font-size: var(--tide-font-20); font-weight: 600;}
|
|
238
|
+
.tide-typography-title-2 {font-size: var(--tide-font-18); font-weight: 600;}
|
|
239
|
+
.tide-typography-body-1 {font-size: var(--tide-font-16); font-weight: 400;}
|
|
240
|
+
.tide-typography-body-2 {font-size: var(--tide-font-14); font-weight: 400;}
|
|
241
|
+
.tide-typography-label-1 {font-size: var(--tide-font-16); font-weight: 500;}
|
|
242
|
+
.tide-typography-label-1-semibold {font-size: var(--tide-font-16); font-weight: 600;}
|
|
243
|
+
.tide-typography-label-2 {font-size: var(--tide-font-14); font-weight: 500;}
|
|
244
|
+
.tide-typography-label-2-semibold {font-size: var(--tide-font-14); font-weight: 600;}
|
|
245
|
+
.tide-typography-label-3 {font-size: var(--tide-font-12); font-weight: 500;}
|
|
246
|
+
.tide-typography-link-1 {font-size: var(--tide-font-16); font-weight: 500;}
|
|
247
|
+
.tide-typography-link-2 {font-size: var(--tide-font-14); font-weight: 500;}
|
|
248
|
+
.tide-typography-link-3 {font-size: var(--tide-font-12); font-weight: 500;}
|
|
249
|
+
.tide-typography-button-1 {font-size: var(--tide-font-16); font-weight: 600;}
|
|
250
|
+
.tide-typography-button-2 {font-size: var(--tide-font-14); font-weight: 600;}
|
|
251
|
+
|
|
232
252
|
/* Font Size */
|
|
233
253
|
.tide-font-10 {font-size: var(--tide-font-10);}
|
|
234
254
|
.tide-font-12 {font-size: var(--tide-font-12);}
|
|
@@ -572,6 +592,26 @@
|
|
|
572
592
|
.sm-tide-transparent-300 {background-color: var(--tide-transparent-300);}
|
|
573
593
|
.sm-tide-transparent-400 {background-color: var(--tide-transparent-400);}
|
|
574
594
|
|
|
595
|
+
/* Typographic roles */
|
|
596
|
+
.sm-tide-typography-display-1 {font-size: var(--tide-font-32); font-weight: 700;}
|
|
597
|
+
.sm-tide-typography-headline-1 {font-size: var(--tide-font-24); font-weight: 700;}
|
|
598
|
+
.sm-tide-typography-headline-2 {font-size: var(--tide-font-20); font-weight: 700;}
|
|
599
|
+
.sm-tide-typography-headline-3 {font-size: var(--tide-font-16); font-weight: 700;}
|
|
600
|
+
.sm-tide-typography-title-1 {font-size: var(--tide-font-20); font-weight: 600;}
|
|
601
|
+
.sm-tide-typography-title-2 {font-size: var(--tide-font-18); font-weight: 600;}
|
|
602
|
+
.sm-tide-typography-body-1 {font-size: var(--tide-font-16); font-weight: 400;}
|
|
603
|
+
.sm-tide-typography-body-2 {font-size: var(--tide-font-14); font-weight: 400;}
|
|
604
|
+
.sm-tide-typography-label-1 {font-size: var(--tide-font-16); font-weight: 500;}
|
|
605
|
+
.sm-tide-typography-label-1-semibold {font-size: var(--tide-font-16); font-weight: 600;}
|
|
606
|
+
.sm-tide-typography-label-2 {font-size: var(--tide-font-14); font-weight: 500;}
|
|
607
|
+
.sm-tide-typography-label-2-semibold {font-size: var(--tide-font-14); font-weight: 600;}
|
|
608
|
+
.sm-tide-typography-label-3 {font-size: var(--tide-font-12); font-weight: 500;}
|
|
609
|
+
.sm-tide-typography-link-1 {font-size: var(--tide-font-16); font-weight: 500;}
|
|
610
|
+
.sm-tide-typography-link-2 {font-size: var(--tide-font-14); font-weight: 500;}
|
|
611
|
+
.sm-tide-typography-link-3 {font-size: var(--tide-font-12); font-weight: 500;}
|
|
612
|
+
.sm-tide-typography-button-1 {font-size: var(--tide-font-16); font-weight: 600;}
|
|
613
|
+
.sm-tide-typography-button-2 {font-size: var(--tide-font-14); font-weight: 600;}
|
|
614
|
+
|
|
575
615
|
/* Font Size */
|
|
576
616
|
.sm-tide-font-10 {font-size: var(--tide-font-10);}
|
|
577
617
|
.sm-tide-font-12 {font-size: var(--tide-font-12);}
|
|
@@ -916,6 +956,26 @@
|
|
|
916
956
|
.md-tide-transparent-300 {background-color: var(--tide-transparent-300);}
|
|
917
957
|
.md-tide-transparent-400 {background-color: var(--tide-transparent-400);}
|
|
918
958
|
|
|
959
|
+
/* Typographic roles */
|
|
960
|
+
.md-tide-typography-display-1 {font-size: var(--tide-font-32); font-weight: 700;}
|
|
961
|
+
.md-tide-typography-headline-1 {font-size: var(--tide-font-24); font-weight: 700;}
|
|
962
|
+
.md-tide-typography-headline-2 {font-size: var(--tide-font-20); font-weight: 700;}
|
|
963
|
+
.md-tide-typography-headline-3 {font-size: var(--tide-font-16); font-weight: 700;}
|
|
964
|
+
.md-tide-typography-title-1 {font-size: var(--tide-font-20); font-weight: 600;}
|
|
965
|
+
.md-tide-typography-title-2 {font-size: var(--tide-font-18); font-weight: 600;}
|
|
966
|
+
.md-tide-typography-body-1 {font-size: var(--tide-font-16); font-weight: 400;}
|
|
967
|
+
.md-tide-typography-body-2 {font-size: var(--tide-font-14); font-weight: 400;}
|
|
968
|
+
.md-tide-typography-label-1 {font-size: var(--tide-font-16); font-weight: 500;}
|
|
969
|
+
.md-tide-typography-label-1-semibold {font-size: var(--tide-font-16); font-weight: 600;}
|
|
970
|
+
.md-tide-typography-label-2 {font-size: var(--tide-font-14); font-weight: 500;}
|
|
971
|
+
.md-tide-typography-label-2-semibold {font-size: var(--tide-font-14); font-weight: 600;}
|
|
972
|
+
.md-tide-typography-label-3 {font-size: var(--tide-font-12); font-weight: 500;}
|
|
973
|
+
.md-tide-typography-link-1 {font-size: var(--tide-font-16); font-weight: 500;}
|
|
974
|
+
.md-tide-typography-link-2 {font-size: var(--tide-font-14); font-weight: 500;}
|
|
975
|
+
.md-tide-typography-link-3 {font-size: var(--tide-font-12); font-weight: 500;}
|
|
976
|
+
.md-tide-typography-button-1 {font-size: var(--tide-font-16); font-weight: 600;}
|
|
977
|
+
.md-tide-typography-button-2 {font-size: var(--tide-font-14); font-weight: 600;}
|
|
978
|
+
|
|
919
979
|
/* Font Size */
|
|
920
980
|
.md-tide-font-10 {font-size: var(--tide-font-10);}
|
|
921
981
|
.md-tide-font-12 {font-size: var(--tide-font-12);}
|
|
@@ -1260,6 +1320,26 @@
|
|
|
1260
1320
|
.lg-tide-transparent-300 {background-color: var(--tide-transparent-300);}
|
|
1261
1321
|
.lg-tide-transparent-400 {background-color: var(--tide-transparent-400);}
|
|
1262
1322
|
|
|
1323
|
+
/* Typographic roles */
|
|
1324
|
+
.lg-tide-typography-display-1 {font-size: var(--tide-font-32); font-weight: 700;}
|
|
1325
|
+
.lg-tide-typography-headline-1 {font-size: var(--tide-font-24); font-weight: 700;}
|
|
1326
|
+
.lg-tide-typography-headline-2 {font-size: var(--tide-font-20); font-weight: 700;}
|
|
1327
|
+
.lg-tide-typography-headline-3 {font-size: var(--tide-font-16); font-weight: 700;}
|
|
1328
|
+
.lg-tide-typography-title-1 {font-size: var(--tide-font-20); font-weight: 600;}
|
|
1329
|
+
.lg-tide-typography-title-2 {font-size: var(--tide-font-18); font-weight: 600;}
|
|
1330
|
+
.lg-tide-typography-body-1 {font-size: var(--tide-font-16); font-weight: 400;}
|
|
1331
|
+
.lg-tide-typography-body-2 {font-size: var(--tide-font-14); font-weight: 400;}
|
|
1332
|
+
.lg-tide-typography-label-1 {font-size: var(--tide-font-16); font-weight: 500;}
|
|
1333
|
+
.lg-tide-typography-label-1-semibold {font-size: var(--tide-font-16); font-weight: 600;}
|
|
1334
|
+
.lg-tide-typography-label-2 {font-size: var(--tide-font-14); font-weight: 500;}
|
|
1335
|
+
.lg-tide-typography-label-2-semibold {font-size: var(--tide-font-14); font-weight: 600;}
|
|
1336
|
+
.lg-tide-typography-label-3 {font-size: var(--tide-font-12); font-weight: 500;}
|
|
1337
|
+
.lg-tide-typography-link-1 {font-size: var(--tide-font-16); font-weight: 500;}
|
|
1338
|
+
.lg-tide-typography-link-2 {font-size: var(--tide-font-14); font-weight: 500;}
|
|
1339
|
+
.lg-tide-typography-link-3 {font-size: var(--tide-font-12); font-weight: 500;}
|
|
1340
|
+
.lg-tide-typography-button-1 {font-size: var(--tide-font-16); font-weight: 600;}
|
|
1341
|
+
.lg-tide-typography-button-2 {font-size: var(--tide-font-14); font-weight: 600;}
|
|
1342
|
+
|
|
1263
1343
|
/* Font Size */
|
|
1264
1344
|
.lg-tide-font-10 {font-size: var(--tide-font-10);}
|
|
1265
1345
|
.lg-tide-font-12 {font-size: var(--tide-font-12);}
|
|
@@ -1604,6 +1684,26 @@
|
|
|
1604
1684
|
.xl-tide-transparent-300 {background-color: var(--tide-transparent-300);}
|
|
1605
1685
|
.xl-tide-transparent-400 {background-color: var(--tide-transparent-400);}
|
|
1606
1686
|
|
|
1687
|
+
/* Typographic roles */
|
|
1688
|
+
.xl-tide-typography-display-1 {font-size: var(--tide-font-32); font-weight: 700;}
|
|
1689
|
+
.xl-tide-typography-headline-1 {font-size: var(--tide-font-24); font-weight: 700;}
|
|
1690
|
+
.xl-tide-typography-headline-2 {font-size: var(--tide-font-20); font-weight: 700;}
|
|
1691
|
+
.xl-tide-typography-headline-3 {font-size: var(--tide-font-16); font-weight: 700;}
|
|
1692
|
+
.xl-tide-typography-title-1 {font-size: var(--tide-font-20); font-weight: 600;}
|
|
1693
|
+
.xl-tide-typography-title-2 {font-size: var(--tide-font-18); font-weight: 600;}
|
|
1694
|
+
.xl-tide-typography-body-1 {font-size: var(--tide-font-16); font-weight: 400;}
|
|
1695
|
+
.xl-tide-typography-body-2 {font-size: var(--tide-font-14); font-weight: 400;}
|
|
1696
|
+
.xl-tide-typography-label-1 {font-size: var(--tide-font-16); font-weight: 500;}
|
|
1697
|
+
.xl-tide-typography-label-1-semibold {font-size: var(--tide-font-16); font-weight: 600;}
|
|
1698
|
+
.xl-tide-typography-label-2 {font-size: var(--tide-font-14); font-weight: 500;}
|
|
1699
|
+
.xl-tide-typography-label-2-semibold {font-size: var(--tide-font-14); font-weight: 600;}
|
|
1700
|
+
.xl-tide-typography-label-3 {font-size: var(--tide-font-12); font-weight: 500;}
|
|
1701
|
+
.xl-tide-typography-link-1 {font-size: var(--tide-font-16); font-weight: 500;}
|
|
1702
|
+
.xl-tide-typography-link-2 {font-size: var(--tide-font-14); font-weight: 500;}
|
|
1703
|
+
.xl-tide-typography-link-3 {font-size: var(--tide-font-12); font-weight: 500;}
|
|
1704
|
+
.xl-tide-typography-button-1 {font-size: var(--tide-font-16); font-weight: 600;}
|
|
1705
|
+
.xl-tide-typography-button-2 {font-size: var(--tide-font-14); font-weight: 600;}
|
|
1706
|
+
|
|
1607
1707
|
/* Font Size */
|
|
1608
1708
|
.xl-tide-font-10 {font-size: var(--tide-font-10);}
|
|
1609
1709
|
.xl-tide-font-12 {font-size: var(--tide-font-12);}
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
/*.CSS Variables */
|
|
2
2
|
:root {
|
|
3
3
|
/* Font Size */
|
|
4
|
-
--tide-font-10: 0.625rem;
|
|
5
|
-
--tide-font-12: 0.75rem;
|
|
6
|
-
--tide-font-14: 0.875rem;
|
|
7
|
-
--tide-font-16: 1rem;
|
|
8
|
-
--tide-font-
|
|
9
|
-
--tide-font-
|
|
10
|
-
--tide-font-
|
|
11
|
-
--tide-font-
|
|
12
|
-
|
|
13
|
-
/* Font Weight */
|
|
14
|
-
--tide-font-400: 400;
|
|
15
|
-
--tide-font-500: 500;
|
|
16
|
-
--tide-font-600: 600;
|
|
17
|
-
--tide-font-700: 700;
|
|
4
|
+
--tide-font-10: 0.625rem;
|
|
5
|
+
--tide-font-12: 0.75rem;
|
|
6
|
+
--tide-font-14: 0.875rem;
|
|
7
|
+
--tide-font-16: 1rem;
|
|
8
|
+
--tide-font-18: 1.125rem;
|
|
9
|
+
--tide-font-20: 1.25rem;
|
|
10
|
+
--tide-font-24: 1.5rem;
|
|
11
|
+
--tide-font-28: 1.75rem;
|
|
12
|
+
--tide-font-32: 2rem;
|
|
18
13
|
|
|
19
14
|
/* Animation */
|
|
20
15
|
--tide-animate: 300ms ease-in-out;
|
|
@@ -5,23 +5,19 @@
|
|
|
5
5
|
|
|
6
6
|
type Props = {
|
|
7
7
|
alt?: string;
|
|
8
|
-
cdn?: string;
|
|
9
8
|
isLazy?: boolean;
|
|
10
|
-
offset?: number;
|
|
11
9
|
src?: string;
|
|
12
10
|
};
|
|
13
11
|
|
|
14
12
|
const props = withDefaults(defineProps<Props>(), {
|
|
15
13
|
alt: '',
|
|
16
|
-
cdn: undefined,
|
|
17
14
|
isLazy: true,
|
|
18
|
-
offset: 0,
|
|
19
15
|
src: undefined,
|
|
20
16
|
});
|
|
21
17
|
|
|
22
18
|
const tideImage = ref();
|
|
23
19
|
|
|
24
|
-
const imageDefault =
|
|
20
|
+
const imageDefault = 'https://cdn-static-rec.tilabs.io/image-coming-soon-512.png';
|
|
25
21
|
|
|
26
22
|
const setImageFromDefault = () => {
|
|
27
23
|
tideImage.value.src = imageDefault;
|
|
@@ -34,7 +30,7 @@
|
|
|
34
30
|
<img
|
|
35
31
|
:alt="alt"
|
|
36
32
|
:class="['tide-image', CSS.OBJECT.CENTER, CSS.OBJECT.COVER]"
|
|
37
|
-
:loading="isLazy ? 'lazy' : 'eager'"
|
|
33
|
+
:loading="props.isLazy ? 'lazy' : 'eager'"
|
|
38
34
|
ref="tideImage"
|
|
39
35
|
:src="src ?? imageDefault"
|
|
40
36
|
@error="setImageFromDefault"
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import type { StoryContext } from '@storybook/vue3';
|
|
2
|
+
|
|
3
|
+
import * as STYLES from '@/types/Storybook';
|
|
4
|
+
import { CSS } from '@/types/Styles';
|
|
5
|
+
import {
|
|
6
|
+
argTypeBoolean,
|
|
7
|
+
formatArgType,
|
|
8
|
+
getConstantsByValues,
|
|
9
|
+
lineBreak,
|
|
10
|
+
prependNoneAsEmpty,
|
|
11
|
+
tab,
|
|
12
|
+
} from '@/utilities/storybook';
|
|
13
|
+
|
|
14
|
+
const GRID_END = prependNoneAsEmpty(STYLES.GRID_END);
|
|
15
|
+
const GRID_START = prependNoneAsEmpty(STYLES.GRID_START);
|
|
16
|
+
|
|
17
|
+
const formatArgs = (args: any) => {
|
|
18
|
+
args.class = formatClassNames(args).join(' ');
|
|
19
|
+
|
|
20
|
+
return { args };
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const formatClassNames = (args: any) => {
|
|
24
|
+
const classNames: string[] = [];
|
|
25
|
+
|
|
26
|
+
if (args.fluid) classNames.push(CSS.GRID.FLUID);
|
|
27
|
+
if (args.item) classNames.push(CSS.GRID.ITEM);
|
|
28
|
+
if (args.start) classNames.push(args.start);
|
|
29
|
+
if (args.end) classNames.push(args.end);
|
|
30
|
+
|
|
31
|
+
return classNames;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const formatClassNamesSnippet = (args: any) => {
|
|
35
|
+
const classNames = formatClassNames(args);
|
|
36
|
+
|
|
37
|
+
return getConstantsByValues(classNames);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const formatClassNamesParentSnippet = (args: any) => {
|
|
41
|
+
const classNamesParent: string[] = [CSS.GRID.LAYOUT];
|
|
42
|
+
|
|
43
|
+
if (args.xl) classNamesParent.push(CSS.GRID.XL);
|
|
44
|
+
|
|
45
|
+
return getConstantsByValues(classNamesParent);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const formatSnippet = (code: string, context: StoryContext) => {
|
|
49
|
+
const { args } = context;
|
|
50
|
+
const classNames = formatClassNamesSnippet(args);
|
|
51
|
+
const attribute = classNames.length ? ` :class="[${classNames.join(', ')}]"` : '';
|
|
52
|
+
|
|
53
|
+
if (args.item) {
|
|
54
|
+
return (
|
|
55
|
+
`<div :class="[${formatClassNamesParentSnippet(args).join(', ')}]">${lineBreak}` +
|
|
56
|
+
`${tab}<span :class="[CSS.DISPLAY.CONTENTS]">${lineBreak}` +
|
|
57
|
+
`${tab}${tab}<span${attribute}>Demo</span>${lineBreak}` +
|
|
58
|
+
`${tab}</span>${lineBreak}` +
|
|
59
|
+
`</div>`
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
`<div :class="[${formatClassNamesParentSnippet(args).join(', ')}]">${lineBreak}` +
|
|
65
|
+
`${tab}<span${attribute}>Demo</span>${lineBreak}` +
|
|
66
|
+
`</div>`
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const parameters = {
|
|
71
|
+
docs: {
|
|
72
|
+
source: {
|
|
73
|
+
format: false,
|
|
74
|
+
language: 'html',
|
|
75
|
+
transform: formatSnippet,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const render = (args: any) => ({
|
|
81
|
+
setup() {
|
|
82
|
+
return formatArgs(args);
|
|
83
|
+
},
|
|
84
|
+
template: `<div class="tide-grid-layout tide-padding-top-2"><div class="tide-border-1 tide-padding-1 sb-bg-white tide-xy-hidden" v-bind="args">Demo</div></div>`,
|
|
85
|
+
updated() {
|
|
86
|
+
return formatArgs(args);
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
export default {
|
|
91
|
+
argTypes: {
|
|
92
|
+
end: {
|
|
93
|
+
...formatArgType({ GRID_END }),
|
|
94
|
+
description: `Ending column of grid item`,
|
|
95
|
+
if: { arg: 'fluid', neq: true },
|
|
96
|
+
name: 'End',
|
|
97
|
+
},
|
|
98
|
+
fluid: {
|
|
99
|
+
...argTypeBoolean,
|
|
100
|
+
description: `Determines whether grid item should extend to parent bounds`,
|
|
101
|
+
if: { arg: 'item', neq: true },
|
|
102
|
+
name: 'Fluid',
|
|
103
|
+
},
|
|
104
|
+
item: {
|
|
105
|
+
...argTypeBoolean,
|
|
106
|
+
description: `Forces a non-direct descendant to adhere to the grid`,
|
|
107
|
+
if: { arg: 'fluid', neq: true },
|
|
108
|
+
name: 'Item',
|
|
109
|
+
},
|
|
110
|
+
start: {
|
|
111
|
+
...formatArgType({ GRID_START }),
|
|
112
|
+
description: `Starting column of grid item`,
|
|
113
|
+
if: { arg: 'fluid', neq: true },
|
|
114
|
+
name: 'Start',
|
|
115
|
+
},
|
|
116
|
+
xl: {
|
|
117
|
+
...argTypeBoolean,
|
|
118
|
+
description: `Increases the maximum content width`,
|
|
119
|
+
name: 'XL',
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
args: {
|
|
123
|
+
end: GRID_END.None,
|
|
124
|
+
fluid: false,
|
|
125
|
+
item: false,
|
|
126
|
+
start: GRID_START.None,
|
|
127
|
+
xl: false,
|
|
128
|
+
},
|
|
129
|
+
parameters,
|
|
130
|
+
render,
|
|
131
|
+
tags: ['autodocs'],
|
|
132
|
+
title: 'Foundations/Grid',
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export const Default = {};
|
|
136
|
+
|
|
137
|
+
export const Fluid = {
|
|
138
|
+
args: {
|
|
139
|
+
fluid: true,
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export const Item = {
|
|
144
|
+
args: {
|
|
145
|
+
item: true,
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export const XL = {
|
|
150
|
+
args: {
|
|
151
|
+
xl: true,
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export const Start0 = {
|
|
156
|
+
args: {
|
|
157
|
+
start: GRID_START['Column 0'],
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export const Start1 = {
|
|
162
|
+
args: {
|
|
163
|
+
start: GRID_START['Column 1'],
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export const Start2 = {
|
|
168
|
+
args: {
|
|
169
|
+
start: GRID_START['Column 2'],
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
export const Start3 = {
|
|
174
|
+
args: {
|
|
175
|
+
start: GRID_START['Column 3'],
|
|
176
|
+
},
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
export const Start4 = {
|
|
180
|
+
args: {
|
|
181
|
+
start: GRID_START['Column 4'],
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export const Start5 = {
|
|
186
|
+
args: {
|
|
187
|
+
start: GRID_START['Column 5'],
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
export const Start6 = {
|
|
192
|
+
args: {
|
|
193
|
+
start: GRID_START['Column 6'],
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
export const Start7 = {
|
|
198
|
+
args: {
|
|
199
|
+
start: GRID_START['Column 7'],
|
|
200
|
+
},
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
export const Start8 = {
|
|
204
|
+
args: {
|
|
205
|
+
start: GRID_START['Column 8'],
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
export const Start9 = {
|
|
210
|
+
args: {
|
|
211
|
+
start: GRID_START['Column 9'],
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
export const Start10 = {
|
|
216
|
+
args: {
|
|
217
|
+
start: GRID_START['Column 10'],
|
|
218
|
+
},
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
export const Start11 = {
|
|
222
|
+
args: {
|
|
223
|
+
start: GRID_START['Column 11'],
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
export const Start12 = {
|
|
228
|
+
args: {
|
|
229
|
+
start: GRID_START['Column 12'],
|
|
230
|
+
},
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
export const End1 = {
|
|
234
|
+
args: {
|
|
235
|
+
end: GRID_END['Column 1'],
|
|
236
|
+
},
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
export const End2 = {
|
|
240
|
+
args: {
|
|
241
|
+
end: GRID_END['Column 2'],
|
|
242
|
+
},
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
export const End3 = {
|
|
246
|
+
args: {
|
|
247
|
+
end: GRID_END['Column 3'],
|
|
248
|
+
},
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
export const End4 = {
|
|
252
|
+
args: {
|
|
253
|
+
end: GRID_END['Column 4'],
|
|
254
|
+
},
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
export const End5 = {
|
|
258
|
+
args: {
|
|
259
|
+
end: GRID_END['Column 5'],
|
|
260
|
+
},
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
export const End6 = {
|
|
264
|
+
args: {
|
|
265
|
+
end: GRID_END['Column 6'],
|
|
266
|
+
},
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
export const End7 = {
|
|
270
|
+
args: {
|
|
271
|
+
end: GRID_END['Column 7'],
|
|
272
|
+
},
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
export const End8 = {
|
|
276
|
+
args: {
|
|
277
|
+
end: GRID_END['Column 8'],
|
|
278
|
+
},
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
export const End9 = {
|
|
282
|
+
args: {
|
|
283
|
+
end: GRID_END['Column 9'],
|
|
284
|
+
},
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
export const End10 = {
|
|
288
|
+
args: {
|
|
289
|
+
end: GRID_END['Column 10'],
|
|
290
|
+
},
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
export const End11 = {
|
|
294
|
+
args: {
|
|
295
|
+
end: GRID_END['Column 11'],
|
|
296
|
+
},
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
export const End12 = {
|
|
300
|
+
args: {
|
|
301
|
+
end: GRID_END['Column 12'],
|
|
302
|
+
},
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
export const End13 = {
|
|
306
|
+
args: {
|
|
307
|
+
end: GRID_END['Column 13'],
|
|
308
|
+
},
|
|
309
|
+
};
|