tide-design-system 2.4.2 → 2.4.3
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/README.md +10 -9
- package/dist/css/fonts.css +36 -0
- package/dist/css/grid-layout.css +34 -0
- package/dist/css/main.css +5 -0
- package/dist/css/realm/aero.css +25 -0
- package/dist/css/realm/atv.css +25 -0
- package/dist/css/realm/boatmart.css +25 -0
- package/dist/css/realm/cycle.css +24 -0
- package/dist/css/realm/equipment.css +25 -0
- package/dist/css/realm/pwc.css +25 -0
- package/dist/css/realm/rv.css +25 -0
- package/dist/css/realm/snow.css +25 -0
- package/dist/css/realm/truck.css +25 -0
- package/dist/css/reset.css +95 -0
- package/dist/css/storybook.css +17 -0
- package/dist/css/utilities-base.css +545 -0
- package/dist/css/utilities-responsive.css +2737 -0
- package/dist/css/utilities.css +16 -0
- package/dist/css/variables.css +205 -0
- package/dist/style.css +1 -1
- package/dist/tide-design-system.cjs +2 -2
- package/dist/tide-design-system.esm.d.ts +2 -0
- package/dist/tide-design-system.esm.js +5 -5
- package/dist/utilities/event.ts +4 -0
- package/dist/utilities/format.ts +184 -0
- package/dist/utilities/forms.ts +22 -0
- package/dist/utilities/storybook.ts +352 -0
- package/dist/utilities/validation-deprecated.ts +252 -0
- package/dist/utilities/validation.ts +132 -0
- package/dist/utilities/viewport.ts +63 -0
- package/{src/docs → docs}/integration-full.md +1 -1
- package/{src/docs → docs}/integration-partial.md +1 -1
- package/docs/token-cheatsheet.md +63 -0
- package/package.json +2 -2
- package/src/components/TideInputRadioDeprecated.vue +1 -0
- package/src/components/TideInputTextDeprecated.vue +1 -0
- /package/{src/docs → docs}/assets/native-input-validation.png +0 -0
- /package/{src/docs → docs}/development.md +0 -0
- /package/{src/docs → docs}/figma.md +0 -0
- /package/{src/docs → docs}/forms.md +0 -0
- /package/{src/docs → docs}/migration.md +0 -0
- /package/{src/docs → docs}/storybook.md +0 -0
- /package/{src/docs → docs}/style-guide.md +0 -0
- /package/{src/docs → docs}/upgrading.md +0 -0
- /package/{src/docs → docs}/workflows.md +0 -0
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { priceToNumber } from '@/utilities/format';
|
|
2
|
+
|
|
3
|
+
import type { StringInput } from '@/types/FormDeprecated';
|
|
4
|
+
import type { SelectOption } from '@/types/Select';
|
|
5
|
+
import type { ValidationError, ValidationLength, ValidationResult, Validator } from '@/types/ValidationDeprecated';
|
|
6
|
+
import type { Ref } from 'vue';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated
|
|
10
|
+
*/
|
|
11
|
+
type RangeData = {
|
|
12
|
+
min: number | null;
|
|
13
|
+
max: number | null;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated
|
|
18
|
+
*/
|
|
19
|
+
export const errorMessageDefault = 'Please enter a valid value.';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated
|
|
23
|
+
*/
|
|
24
|
+
export const noError = {
|
|
25
|
+
message: '',
|
|
26
|
+
valid: true,
|
|
27
|
+
} as Readonly<ValidationResult>;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated
|
|
31
|
+
*/
|
|
32
|
+
export const checkFormat = (format: RegExp) => {
|
|
33
|
+
return (value: string): ValidationResult => {
|
|
34
|
+
let result = noError;
|
|
35
|
+
|
|
36
|
+
if (!value.trim().match(format)) {
|
|
37
|
+
result = {
|
|
38
|
+
message: errorMessageDefault,
|
|
39
|
+
valid: false,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @deprecated
|
|
49
|
+
*/
|
|
50
|
+
export const getErrorMessage = (errorFromProps: ValidationError, errorFromRef: ValidationError) => {
|
|
51
|
+
// error in props takes precedence over validation error
|
|
52
|
+
if (typeof errorFromProps === 'string' && errorFromProps.length > 0) return errorFromProps;
|
|
53
|
+
|
|
54
|
+
return typeof errorFromRef === 'string' && errorFromRef.length > 0 ? errorFromRef : errorMessageDefault;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @deprecated
|
|
59
|
+
*/
|
|
60
|
+
export const getFieldHasError = (errorFromProps: ValidationError, errorFromRef: ValidationError) =>
|
|
61
|
+
errorFromProps !== false || errorFromRef !== false;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @deprecated
|
|
65
|
+
*/
|
|
66
|
+
export const getFieldLengthIsValid = ({ maxlength, minlength, required, value }: ValidationLength) => {
|
|
67
|
+
const isEmptyAndUnrequired = value.length === 0 && !required;
|
|
68
|
+
const isTooLong = maxlength && value.length > maxlength;
|
|
69
|
+
const isTooShort = !isEmptyAndUnrequired && minlength && value.length < minlength;
|
|
70
|
+
|
|
71
|
+
return !isTooShort && !isTooLong;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @deprecated
|
|
76
|
+
*/
|
|
77
|
+
export const getMaxRangeIsValid = ({ min }: Pick<RangeData, 'min'>, type?: 'price') => {
|
|
78
|
+
return (value: string): ValidationResult => {
|
|
79
|
+
let newMax: number | null = type === 'price' ? priceToNumber(value) : Number(value);
|
|
80
|
+
newMax = !isNaN(newMax) ? newMax : null;
|
|
81
|
+
if (min && newMax) {
|
|
82
|
+
if (newMax >= min) {
|
|
83
|
+
return {
|
|
84
|
+
message: '',
|
|
85
|
+
valid: true,
|
|
86
|
+
};
|
|
87
|
+
} else {
|
|
88
|
+
return {
|
|
89
|
+
message: `Must be greater than min`,
|
|
90
|
+
valid: false,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
} else {
|
|
94
|
+
return noError;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @deprecated
|
|
101
|
+
*/
|
|
102
|
+
export const getMinRangeIsValid = ({ max }: Pick<RangeData, 'max'>, type?: 'price') => {
|
|
103
|
+
return (value: string): ValidationResult => {
|
|
104
|
+
let newMin: number | null = type === 'price' ? priceToNumber(value) : Number(value);
|
|
105
|
+
newMin = !isNaN(newMin) ? newMin : null;
|
|
106
|
+
if (max && newMin) {
|
|
107
|
+
if (newMin <= max) {
|
|
108
|
+
return {
|
|
109
|
+
message: '',
|
|
110
|
+
valid: true,
|
|
111
|
+
};
|
|
112
|
+
} else {
|
|
113
|
+
return {
|
|
114
|
+
message: `Must be less than max`,
|
|
115
|
+
valid: false,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
} else {
|
|
119
|
+
return noError;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @deprecated
|
|
126
|
+
*/
|
|
127
|
+
export const getSelectOptionsFromStrings = (strings: string[]) =>
|
|
128
|
+
strings.map(
|
|
129
|
+
(option) =>
|
|
130
|
+
({
|
|
131
|
+
label: option,
|
|
132
|
+
value: option,
|
|
133
|
+
} as SelectOption)
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @deprecated
|
|
138
|
+
*/
|
|
139
|
+
export const handleFieldValidation = ({
|
|
140
|
+
error,
|
|
141
|
+
errorFromProps,
|
|
142
|
+
maxlength,
|
|
143
|
+
minlength,
|
|
144
|
+
required = false,
|
|
145
|
+
validators,
|
|
146
|
+
value,
|
|
147
|
+
}: {
|
|
148
|
+
error: Ref<ValidationError>;
|
|
149
|
+
errorFromProps: ValidationError;
|
|
150
|
+
maxlength?: number;
|
|
151
|
+
minlength?: number;
|
|
152
|
+
required?: boolean;
|
|
153
|
+
validators?: Validator[];
|
|
154
|
+
value?: Ref<string | undefined>;
|
|
155
|
+
}) => {
|
|
156
|
+
// error in props takes precedence over validation error
|
|
157
|
+
|
|
158
|
+
error.value = errorFromProps ? errorFromProps : false;
|
|
159
|
+
|
|
160
|
+
if (!error.value && validators) {
|
|
161
|
+
const validation = validateProperty(value?.value || '', validators);
|
|
162
|
+
|
|
163
|
+
if (!validation.valid) {
|
|
164
|
+
error.value = validation.message;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (!error.value && (maxlength || minlength)) {
|
|
169
|
+
const lengthValidation = validateLength({
|
|
170
|
+
maxlength,
|
|
171
|
+
minlength,
|
|
172
|
+
required,
|
|
173
|
+
value: value?.value || '',
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
if (!lengthValidation.valid) {
|
|
177
|
+
error.value = lengthValidation.message;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* @deprecated
|
|
184
|
+
*/
|
|
185
|
+
export function validateFieldsFromRefs(fields: { [key: string]: Ref<StringInput | null> }) {
|
|
186
|
+
let valid = true;
|
|
187
|
+
|
|
188
|
+
for (const key in fields) {
|
|
189
|
+
if (fields[key].value?.required) {
|
|
190
|
+
const value = fields[key].value?.value;
|
|
191
|
+
valid = valid && !!value && value.trim() !== '';
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const error = fields[key].value?.error;
|
|
195
|
+
valid = valid && !error;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return valid;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* @deprecated
|
|
203
|
+
*/
|
|
204
|
+
export const validateLength = ({
|
|
205
|
+
maxlength,
|
|
206
|
+
minlength,
|
|
207
|
+
required = false,
|
|
208
|
+
value,
|
|
209
|
+
}: ValidationLength): ValidationResult => {
|
|
210
|
+
const response = {
|
|
211
|
+
message: '',
|
|
212
|
+
valid: true,
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
response.valid = getFieldLengthIsValid({
|
|
216
|
+
maxlength,
|
|
217
|
+
minlength,
|
|
218
|
+
required,
|
|
219
|
+
value,
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
if (response.valid) return response;
|
|
223
|
+
|
|
224
|
+
response.message = errorMessageDefault;
|
|
225
|
+
|
|
226
|
+
if (maxlength && minlength) {
|
|
227
|
+
response.message = `Please enter a value between ${minlength} and ${maxlength} characters in length.`;
|
|
228
|
+
} else if (maxlength) {
|
|
229
|
+
response.message = `Please enter a value no more than ${maxlength} characters in length.`;
|
|
230
|
+
} else if (minlength) {
|
|
231
|
+
response.message = `Please enter a value no less than ${minlength} characters in length.`;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
return response;
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* @deprecated
|
|
239
|
+
*/
|
|
240
|
+
export function validateProperty(value: string, validators: ((value: string) => ValidationResult)[]): ValidationResult {
|
|
241
|
+
for (const validator of validators) {
|
|
242
|
+
const validation = validator(value);
|
|
243
|
+
if (!validation.valid) {
|
|
244
|
+
return validation;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return {
|
|
249
|
+
message: '',
|
|
250
|
+
valid: true,
|
|
251
|
+
};
|
|
252
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { formatNumber } from '@/utilities/format';
|
|
2
|
+
|
|
3
|
+
import type { ValidationLength, ValidationResult, Validator } from '@/types/Validation';
|
|
4
|
+
import type { Ref } from 'vue';
|
|
5
|
+
|
|
6
|
+
export const errorMessageDefault = 'Please enter a valid value';
|
|
7
|
+
|
|
8
|
+
export const VALIDATION_RESULT = {
|
|
9
|
+
NO_ERROR: {
|
|
10
|
+
message: '',
|
|
11
|
+
valid: true,
|
|
12
|
+
},
|
|
13
|
+
REQUIRED: {
|
|
14
|
+
message: 'Please fill out this field',
|
|
15
|
+
valid: false,
|
|
16
|
+
},
|
|
17
|
+
} as const;
|
|
18
|
+
|
|
19
|
+
export const checkFormat = (format: RegExp, message?: string) => {
|
|
20
|
+
return (value: string): ValidationResult => {
|
|
21
|
+
let result: ValidationResult = VALIDATION_RESULT.NO_ERROR;
|
|
22
|
+
|
|
23
|
+
if (!value.trim().match(format)) {
|
|
24
|
+
result = {
|
|
25
|
+
message: message ?? errorMessageDefault,
|
|
26
|
+
valid: false,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const getFieldLengthIsValid = ({ maxlength, minlength, required, value }: ValidationLength) => {
|
|
35
|
+
const isEmptyAndUnrequired = value.length === 0 && !required;
|
|
36
|
+
const isTooLong = maxlength && value.length > maxlength;
|
|
37
|
+
const isTooShort = !isEmptyAndUnrequired && minlength && value.length < minlength;
|
|
38
|
+
return !isTooShort && !isTooLong;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const getFieldValidationResult = ({
|
|
42
|
+
errorFromProps,
|
|
43
|
+
maxlength,
|
|
44
|
+
minlength,
|
|
45
|
+
required,
|
|
46
|
+
validators,
|
|
47
|
+
value,
|
|
48
|
+
}: {
|
|
49
|
+
errorFromProps: string;
|
|
50
|
+
maxlength?: number;
|
|
51
|
+
minlength?: number;
|
|
52
|
+
required: boolean;
|
|
53
|
+
validators?: Validator[];
|
|
54
|
+
value: Ref<string>;
|
|
55
|
+
}): ValidationResult => {
|
|
56
|
+
// error in props takes precedence over validation error
|
|
57
|
+
if (errorFromProps !== '')
|
|
58
|
+
return {
|
|
59
|
+
message: errorFromProps,
|
|
60
|
+
valid: false,
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// custom validator prop errors from have second highest precedence
|
|
64
|
+
if (validators) {
|
|
65
|
+
const validation = validateProperty(value.value, validators);
|
|
66
|
+
|
|
67
|
+
if (!validation.valid) {
|
|
68
|
+
return validation;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// all other prop-based errors come last
|
|
73
|
+
if (required && value.value.trim() === '') {
|
|
74
|
+
return VALIDATION_RESULT.REQUIRED;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (maxlength || minlength) {
|
|
78
|
+
const lengthValidation = validateLength({
|
|
79
|
+
maxlength,
|
|
80
|
+
minlength,
|
|
81
|
+
required,
|
|
82
|
+
value: value.value,
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
if (!lengthValidation.valid) {
|
|
86
|
+
return lengthValidation;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return VALIDATION_RESULT.NO_ERROR;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export const validateLength = ({ maxlength, minlength, required, value }: ValidationLength): ValidationResult => {
|
|
93
|
+
const response = {
|
|
94
|
+
message: '',
|
|
95
|
+
valid: true,
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
response.valid = getFieldLengthIsValid({
|
|
99
|
+
maxlength,
|
|
100
|
+
minlength,
|
|
101
|
+
required,
|
|
102
|
+
value,
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
if (response.valid) return response;
|
|
106
|
+
|
|
107
|
+
response.message = errorMessageDefault;
|
|
108
|
+
|
|
109
|
+
if (maxlength && minlength) {
|
|
110
|
+
response.message = `Enter a value between ${formatNumber(minlength)} and ${formatNumber(maxlength)} characters`;
|
|
111
|
+
} else if (maxlength) {
|
|
112
|
+
response.message = `Use ${formatNumber(maxlength)} characters or fewer`;
|
|
113
|
+
} else if (minlength) {
|
|
114
|
+
response.message = `Enter at least ${formatNumber(minlength)} characters`;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return response;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export function validateProperty(value: string, validators: ((value: string) => ValidationResult)[]): ValidationResult {
|
|
121
|
+
for (const validator of validators) {
|
|
122
|
+
const validation = validator(value);
|
|
123
|
+
if (!validation.valid) {
|
|
124
|
+
return validation;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return {
|
|
129
|
+
message: '',
|
|
130
|
+
valid: true,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { nextTick } from 'vue';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Directly modifies the `<body>` element to apply or remove scroll lock.
|
|
5
|
+
* When `false` is provided, it only unlocks scroll if there are no open
|
|
6
|
+
* HTML dialog elements.
|
|
7
|
+
*/
|
|
8
|
+
export const setScrollLock = async (isLocked: boolean) => {
|
|
9
|
+
// Cannot be applied to body tag in marketplace repo due to data-css-scope
|
|
10
|
+
// const BODY_LOCK_CLASS = 'body-scroll-lock';
|
|
11
|
+
|
|
12
|
+
const body = document.body;
|
|
13
|
+
|
|
14
|
+
if (isLocked) {
|
|
15
|
+
if (!body.dataset.scrollLockY) {
|
|
16
|
+
const scrollY = window.scrollY;
|
|
17
|
+
|
|
18
|
+
body.dataset.scrollLockY = scrollY.toString();
|
|
19
|
+
body.style.setProperty('--saved-scroll-y', `${scrollY}px`);
|
|
20
|
+
body.style.setProperty('inset', '0');
|
|
21
|
+
body.style.setProperty('margin-top', `calc(0px - var(--saved-scroll-y, 0px))`);
|
|
22
|
+
body.style.setProperty('overflow-y', 'scroll');
|
|
23
|
+
body.style.setProperty('position', 'fixed');
|
|
24
|
+
|
|
25
|
+
// Cannot be applied to body tag in marketplace repo due to data-css-scope
|
|
26
|
+
// body.classList.add(BODY_LOCK_CLASS);
|
|
27
|
+
}
|
|
28
|
+
} else {
|
|
29
|
+
await nextTick();
|
|
30
|
+
if (!document.querySelector('dialog[open]')) {
|
|
31
|
+
const savedScrollY = parseInt(body.dataset.scrollLockY || '0');
|
|
32
|
+
|
|
33
|
+
// Cannot be applied to body tag in marketplace repo due to data-css-scope
|
|
34
|
+
// body.classList.remove(BODY_LOCK_CLASS);
|
|
35
|
+
|
|
36
|
+
body.style.removeProperty('inset');
|
|
37
|
+
body.style.removeProperty('marginTop');
|
|
38
|
+
body.style.removeProperty('overflowY');
|
|
39
|
+
body.style.removeProperty('position');
|
|
40
|
+
body.style.removeProperty('--saved-scroll-y');
|
|
41
|
+
|
|
42
|
+
window.scrollTo({
|
|
43
|
+
behavior: 'auto',
|
|
44
|
+
top: savedScrollY,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
delete body.dataset.scrollLockY;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const TOP_LAYER_ID = 'tide-top-layer';
|
|
53
|
+
|
|
54
|
+
export const initFauxTopLayer = () => {
|
|
55
|
+
let topLayer = document.getElementById(TOP_LAYER_ID);
|
|
56
|
+
if (!topLayer) {
|
|
57
|
+
topLayer = document.createElement('div');
|
|
58
|
+
topLayer.id = TOP_LAYER_ID;
|
|
59
|
+
topLayer.setAttribute('data-css-scope', '');
|
|
60
|
+
document.body.appendChild(topLayer);
|
|
61
|
+
}
|
|
62
|
+
topLayer.style.isolation = 'isolate';
|
|
63
|
+
};
|
|
@@ -81,4 +81,4 @@
|
|
|
81
81
|
|
|
82
82
|
6. Storybook
|
|
83
83
|
|
|
84
|
-
Working implementations of TIDE utilities and components can be dynamically-generated from the publicly-served [Storybook](https://tide-design-system.netlify.app) interface layer of the TIDE repository. See [Using Storybook](./
|
|
84
|
+
Working implementations of TIDE utilities and components can be dynamically-generated from the publicly-served [Storybook](https://tide-design-system.netlify.app) interface layer of the TIDE repository. See [Using Storybook](./docs/storybook.md#using-storybook) for details.
|
|
@@ -36,4 +36,4 @@
|
|
|
36
36
|
4. Leverage responsive CSS utilities:
|
|
37
37
|
|
|
38
38
|
`<div class="tide-position-relative md-tide-position-absolute" />`
|
|
39
|
-
3. Working implementations of TIDE utilities can be dynamically-generated from the publicly-served [Storybook](https://tide-design-system.netlify.app) interface layer of the TIDE repository. See [Utilities](./
|
|
39
|
+
3. Working implementations of TIDE utilities can be dynamically-generated from the publicly-served [Storybook](https://tide-design-system.netlify.app) interface layer of the TIDE repository. See [Utilities](./docs/storybook.md#utilities) under [Using Storybook](./docs/storybook.md#using-storybook) for details.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# TIDE Figma Token Cheatsheet
|
|
2
|
+
|
|
3
|
+
## Terminology
|
|
4
|
+
- [**Figma Token**](https://www.figma.com/design/9oYSAyY2X9mPaUMiobZOPg/Design-System---TIDE-2.0?node-id=0-1&p=f&m=dev): the name that appears in the "Layer properties" section of the right sidebar when inspecting an element of a Figma mock
|
|
5
|
+
- [**JS Constant**](../src/types/Styles.ts): the standard JavaScript structure to use when implementing a TIDE Figma token from within a JS file and/or framework (`.vue`, `.ts`, `.js`)
|
|
6
|
+
- [**CSS Utility**](../src/assets/css/utilities-base.css): the CSS class to use when implementing a TIDE Figma token from **legacy** frameworks (`.html`, `.php`, `.phtml`).
|
|
7
|
+
|
|
8
|
+
## Typography
|
|
9
|
+
|[Figma Token](https://www.figma.com/design/9oYSAyY2X9mPaUMiobZOPg/Design-System---TIDE-2.0?node-id=0-1&p=f&m=dev)|[JS Constant](../src/types/Styles.ts)|[CSS Utility](../src/assets/css/utilities-base.css)|
|
|
10
|
+
|-|-|-|
|
|
11
|
+
|Role/Display/Display 1|`CSS.FONT.ROLE.DISPLAY_1`|`tide-typography-display-1`|
|
|
12
|
+
|Role/Headline/Headline 1|`CSS.FONT.ROLE.HEADLINE_1`|`tide-typography-headline-1`|
|
|
13
|
+
|Role/Headline/Headline 2|`CSS.FONT.ROLE.HEADLINE_2`|`tide-typography-headline-2`|
|
|
14
|
+
|Role/Headline/Headline 3|`CSS.FONT.ROLE.HEADLINE_3`|`tide-typography-headline-3`|
|
|
15
|
+
|Role/Title/Title 1|`CSS.FONT.ROLE.TITLE_1`|`tide-typography-title-1`|
|
|
16
|
+
|Role/Title/Title 2|`CSS.FONT.ROLE.TITLE_2`|`tide-typography-title-2`|
|
|
17
|
+
|Role/Body/Body 1*|`CSS.FONT.ROLE.BODY_1`|`tide-typography-body-1`|
|
|
18
|
+
|Role/Body/Body 2|`CSS.FONT.ROLE.BODY_2`|`tide-typography-body-2`|
|
|
19
|
+
|Role/Label/Label 1|`CSS.FONT.ROLE.LABEL_1`|`tide-typography-label-1`|
|
|
20
|
+
|Role/Label/Label 1 Semibold|`CSS.FONT.ROLE.LABEL_1_SEMIBOLD`|`tide-typography-label-1-semibold`|
|
|
21
|
+
|Role/Label/Label 2|`CSS.FONT.ROLE.LABEL_2`|`tide-typography-label-2`|
|
|
22
|
+
|Role/Label/Label 2 Semibold|`CSS.FONT.ROLE.LABEL_2_SEMIBOLD`|`tide-typography-label-2-semibold`|
|
|
23
|
+
|Role/Label/Label 3|`CSS.FONT.ROLE.LABEL_3`|`tide-typography-label-3`|
|
|
24
|
+
|Role/Link/Link 1|`CSS.FONT.ROLE.LINK_1`|`tide-typography-link-1`|
|
|
25
|
+
|Role/Link/Link 2|`CSS.FONT.ROLE.LINK_2`|`tide-typography-link-2`|
|
|
26
|
+
|Role/Button/Button 1|`CSS.FONT.ROLE.BUTTON_1`|`tide-typography-button-1`|
|
|
27
|
+
|Role/Button/Button 2|`CSS.FONT.ROLE.BUTTON_2`|`tide-typography-button-2`|
|
|
28
|
+
|
|
29
|
+
\* **Body/Body 1** is applied to all site text by default in the [CSS Reset](../src/assets/css/reset.css), so it doesn't need to be specified unless overriding an inherited font role.
|
|
30
|
+
|
|
31
|
+
## Color
|
|
32
|
+
|
|
33
|
+
### Background Color
|
|
34
|
+
|[Figma Token](https://www.figma.com/design/9oYSAyY2X9mPaUMiobZOPg/Design-System---TIDE-2.0?node-id=0-1&p=f&m=dev)|[JS Constant](../src/types/Styles.ts)|[CSS Utility](../src/assets/css/utilities-base.css)
|
|
35
|
+
|-|-|-|
|
|
36
|
+
|Colors/Primary/Primary|`CSS.BG.PRIMARY`|`tide-bg-primary`|
|
|
37
|
+
|Colors/Secondary/Secondary|`CSS.BG.SECONDARY`|`tide-bg-secondary`|
|
|
38
|
+
|Colors/Surface/Surface|`CSS.BG.SURFACE.DEFAULT`|`tide-bg-surface`|
|
|
39
|
+
|Colors/Surface/Surface brand|`CSS.BG.SURFACE.BRAND`|`tide-bg-surface-brand`|
|
|
40
|
+
|Colors/Surface/Surface brand|`CSS.BG.SURFACE.BRAND`|`tide-bg-surface-brand`|
|
|
41
|
+
|Colors/Surface/Surface accent|`CSS.BG.SURFACE.ACCENT`|`tide-bg-surface-accent`|
|
|
42
|
+
|Colors/Surface/Surface variant|`CSS.BG.SURFACE.VARIANT`|`tide-bg-surface-variant`|
|
|
43
|
+
|Colors/Surface/Surface gradient|`CSS.BG.SURFACE.GRADIENT`|`tide-bg-surface-gradient`|
|
|
44
|
+
|Colors/Surface/Surface floating|`CSS.BG.SURFACE.FLOATING`|`tide-bg-surface-floating`|
|
|
45
|
+
|
|
46
|
+
### Border Color
|
|
47
|
+
|[Figma Token](https://www.figma.com/design/9oYSAyY2X9mPaUMiobZOPg/Design-System---TIDE-2.0?node-id=0-1&p=f&m=dev)|[JS Constant](../src/types/Styles.ts)|[CSS Utility](../src/assets/css/utilities-base.css)
|
|
48
|
+
|-|-|-|
|
|
49
|
+
|Colors/Border/Border|`CSS.BORDER.COLOR.DEFAULT`|`tide-border`|
|
|
50
|
+
|Colors/Border/Border low|`CSS.BORDER.COLOR.LOW`|`tide-border-low`|
|
|
51
|
+
|Colors/Border/Border high|`CSS.BORDER.COLOR.HGIH`|`tide-border-high`|
|
|
52
|
+
|Colors/Border/Border floating|`CSS.BORDER.COLOR.FLOATING`|`tide-border-floating`|
|
|
53
|
+
|
|
54
|
+
### Font Color
|
|
55
|
+
|[Figma Token](https://www.figma.com/design/9oYSAyY2X9mPaUMiobZOPg/Design-System---TIDE-2.0?node-id=0-1&p=f&m=dev)|[JS Constant](../src/types/Styles.ts)|[CSS Utility](../src/assets/css/utilities-base.css)
|
|
56
|
+
|-|-|-|
|
|
57
|
+
|Colors/Primary/On primary|`CSS.BG.PRIMARY`|`tide-font-on-primary`|
|
|
58
|
+
|Colors/Secondary/Secondary|`CSS.BG.SECONDARY`|`tide-font-on-secondary`|
|
|
59
|
+
|Colors/Surface/On surface|`CSS.BG.SURFACE.DEFAULT`|`tide-font-on-surface`|
|
|
60
|
+
|Colors/Surface/On surface brand|`CSS.BG.SURFACE.BRAND`|`tide-font-on-surface-brand`|
|
|
61
|
+
|Colors/Surface/On surface inverse|`CSS.BG.SURFACE.INVERSE`|`tide-font-on-surface-inverse`|
|
|
62
|
+
|Colors/Surface/On surface variant|`CSS.BG.SURFACE.VARIANT`|`tide-font-on-surface-variant`|
|
|
63
|
+
|Colors/Surface/On surface variant inverse|`CSS.BG.SURFACE.VARIANT_INVERSE`|`tide-font-on-surface-variant-inverse`|
|
package/package.json
CHANGED
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"build": "npm run enforce && npm run build-vite",
|
|
47
47
|
"build-sandbox": "vite build --config vite.config.sandbox.ts",
|
|
48
48
|
"build-storybook": "npm run build-vite && storybook build && cp -r src/assets/ storybook-static/",
|
|
49
|
-
"build-vite": "vite build",
|
|
49
|
+
"build-vite": "vite build && cp -r src/assets/css/ dist/css/ && cp -r src/utilities/ dist/utilities/",
|
|
50
50
|
"coverage": "vitest run --coverage",
|
|
51
51
|
"dev": "vite",
|
|
52
52
|
"enforce": "npm run lint && npm run type-check && npm run test",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"main": "dist/tide-design-system.cjs",
|
|
64
64
|
"module": "dist/tide-design-system.esm.js",
|
|
65
65
|
"types": "dist/tide-design-system.esm.d.ts",
|
|
66
|
-
"version": "2.4.
|
|
66
|
+
"version": "2.4.3",
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@floating-ui/vue": "^1.1.6"
|
|
69
69
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|