@ids-group-ltd/ids-design-system 1.1.0 → 1.1.2
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/CHANGELOG.md +289 -0
- package/agent/INDEX.md +1 -1
- package/agent/feedback/ds-alert.md +3 -2
- package/agent/feedback/ds-chat-message.md +3 -3
- package/agent/feedback/ds-chat-step.md +1 -1
- package/agent/feedback/ds-chat-steps.md +1 -1
- package/agent/feedback/ds-chat-thread.md +2 -2
- package/agent/feedback/ds-empty-state.md +2 -1
- package/agent/feedback/ds-tree.md +4 -2
- package/agent/forms/ds-chat-input.md +3 -3
- package/agent/foundations/tokens.md +2 -2
- package/agent/navigation/ds-splitter.md +1 -1
- package/components.md +22 -18
- package/fesm2022/ids-group-ltd-ids-design-system-components-alert.mjs +5 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-alert.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-app-layout.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-app-layout.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-banner.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-banner.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-legend.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-legend.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-chat.mjs +184 -72
- package/fesm2022/ids-group-ltd-ids-design-system-components-chat.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-checkbox.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-checkbox.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-color-picker.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-color-picker.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-drawer.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-drawer.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-empty-state.mjs +14 -7
- package/fesm2022/ids-group-ltd-ids-design-system-components-empty-state.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-field-group.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-field-group.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-input.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-input.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-modal.mjs +4 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-modal.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-multi-select.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-multi-select.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-number-stepper.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-number-stepper.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-otp-input.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-otp-input.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-popover.mjs +23 -12
- package/fesm2022/ids-group-ltd-ids-design-system-components-popover.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-radio-group.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-radio-group.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-search.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-search.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-segmented.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-segmented.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-select.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-select.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-splitter.mjs +116 -10
- package/fesm2022/ids-group-ltd-ids-design-system-components-splitter.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-stepper.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-stepper.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-switch.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-switch.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-table-columns.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-table-columns.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-textarea.mjs +4 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-textarea.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-time-picker.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-time-picker.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-timeline.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-timeline.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-toggle-button.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-toggle-button.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs +4 -19
- package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-tree.mjs +84 -9
- package/fesm2022/ids-group-ltd-ids-design-system-components-tree.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components.mjs +31 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs +33 -0
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-icons.mjs +4 -2
- package/fesm2022/ids-group-ltd-ids-design-system-icons.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system.mjs +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system.mjs.map +1 -1
- package/migrations/0.11.2.json +1 -0
- package/migrations/1.0.1.json +4 -0
- package/migrations/1.0.2.json +9 -1
- package/migrations/1.1.0.json +25 -0
- package/migrations/1.1.1.json +190 -0
- package/migrations/1.1.2.json +135 -0
- package/migrations/README.md +9 -7
- package/package.json +4 -1
- package/schematics/check-overrides/surface.json +29 -3
- package/stylelint/index.mjs +17 -3
- package/stylelint/known-tokens.mjs +139 -0
- package/stylelint/report.mjs +185 -0
- package/stylelint/tokens.mjs +160 -0
- package/stylelint/use-tokens.mjs +397 -0
- package/styles/_check-box.scss +2 -2
- package/styles/_dropdown-overlay.scss +5 -2
- package/styles/_field-box.scss +2 -2
- package/styles/_tokens.scss +8 -0
- package/themes/README.md +1 -1
- package/themes/_semantic.scss +13 -0
- package/themes/dark/_theme.scss +15 -3
- package/types/ids-group-ltd-ids-design-system-components-alert.d.ts +3 -1
- package/types/ids-group-ltd-ids-design-system-components-chat.d.ts +58 -5
- package/types/ids-group-ltd-ids-design-system-components-empty-state.d.ts +7 -2
- package/types/ids-group-ltd-ids-design-system-components-splitter.d.ts +15 -1
- package/types/ids-group-ltd-ids-design-system-components-textarea.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-tree.d.ts +57 -3
- package/types/ids-group-ltd-ids-design-system-components.d.ts +8 -4
- package/types/ids-group-ltd-ids-design-system-core.d.ts +40 -0
- package/types/ids-group-ltd-ids-design-system.d.ts +3 -3
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
// `ids-design-system/use-tokens`: reports a raw style value where the design system has a token for
|
|
2
|
+
// it, and names the token: the exact one when the value is on the scale, otherwise the nearest step,
|
|
3
|
+
// said as nearest.
|
|
4
|
+
import { createRequire } from 'node:module';
|
|
5
|
+
import { relative } from 'node:path';
|
|
6
|
+
import stylelint from 'stylelint';
|
|
7
|
+
import { normalizeColor, normalizeEase, tokens } from './tokens.mjs';
|
|
8
|
+
|
|
9
|
+
// Both ship with stylelint, so they resolve from it under any package manager.
|
|
10
|
+
const fromStylelint = createRequire(import.meta.resolve('stylelint'));
|
|
11
|
+
const valueParser = fromStylelint('postcss-value-parser');
|
|
12
|
+
const micromatch = fromStylelint('micromatch');
|
|
13
|
+
|
|
14
|
+
const {
|
|
15
|
+
createPlugin,
|
|
16
|
+
utils: { report, ruleMessages, validateOptions },
|
|
17
|
+
} = stylelint;
|
|
18
|
+
|
|
19
|
+
export const ruleName = 'ids-design-system/use-tokens';
|
|
20
|
+
|
|
21
|
+
const messages = ruleMessages(ruleName, {
|
|
22
|
+
exact: (category, prop, raw, suggestion) =>
|
|
23
|
+
`${category}: raw "${raw}" in ${prop}, use ${suggestion}`,
|
|
24
|
+
nearest: (category, prop, raw, suggestion, tokenValue) =>
|
|
25
|
+
`${category}: raw "${raw}" in ${prop} has no exact token, nearest ${suggestion} (${tokenValue})`,
|
|
26
|
+
none: (category, prop, raw) =>
|
|
27
|
+
`${category}: raw "${raw}" in ${prop} matches no design-system colour`,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export const CATEGORIES = [
|
|
31
|
+
[
|
|
32
|
+
'radius',
|
|
33
|
+
/^border(-(top|bottom|start|end)-(left|right|start|end))?-radius$/,
|
|
34
|
+
],
|
|
35
|
+
[
|
|
36
|
+
'space',
|
|
37
|
+
/^(margin|padding|inset|scroll-margin|scroll-padding)(-.+)?$|^(grid-)?(row-|column-)?gap$/,
|
|
38
|
+
],
|
|
39
|
+
['font-size', /^font-size$/],
|
|
40
|
+
['line-height', /^line-height$/],
|
|
41
|
+
['font-weight', /^font-weight$/],
|
|
42
|
+
['shadow', /^box-shadow$/],
|
|
43
|
+
['z-index', /^z-index$/],
|
|
44
|
+
['motion', /^(transition|animation)(-(duration|delay|timing-function))?$/],
|
|
45
|
+
];
|
|
46
|
+
const CATEGORY_NAMES = ['color', ...CATEGORIES.map(([name]) => name)];
|
|
47
|
+
|
|
48
|
+
const ALWAYS_ALLOWED = new Set([
|
|
49
|
+
'0',
|
|
50
|
+
'auto',
|
|
51
|
+
'inherit',
|
|
52
|
+
'initial',
|
|
53
|
+
'unset',
|
|
54
|
+
'revert',
|
|
55
|
+
'revert-layer',
|
|
56
|
+
'currentcolor',
|
|
57
|
+
'transparent',
|
|
58
|
+
'none',
|
|
59
|
+
'normal',
|
|
60
|
+
'100%',
|
|
61
|
+
]);
|
|
62
|
+
const MATH = new Set(['calc', 'min', 'max', 'clamp']);
|
|
63
|
+
const COLOR_FUNCTIONS = new Set(['rgb', 'rgba', 'hsl', 'hsla']);
|
|
64
|
+
const NAMED_COLORS = new Set([
|
|
65
|
+
'white',
|
|
66
|
+
'black',
|
|
67
|
+
'red',
|
|
68
|
+
'green',
|
|
69
|
+
'blue',
|
|
70
|
+
'gray',
|
|
71
|
+
'grey',
|
|
72
|
+
'silver',
|
|
73
|
+
'orange',
|
|
74
|
+
'yellow',
|
|
75
|
+
'purple',
|
|
76
|
+
'pink',
|
|
77
|
+
]);
|
|
78
|
+
const EASE_KEYWORDS = {
|
|
79
|
+
ease: '--ease-standard',
|
|
80
|
+
'ease-in-out': '--ease-standard',
|
|
81
|
+
'ease-out': '--ease-decelerate',
|
|
82
|
+
'ease-in': '--ease-accelerate',
|
|
83
|
+
};
|
|
84
|
+
const ROLE_PREFIX = [
|
|
85
|
+
[/^(color|caret-color|-webkit-text-fill-color)$/, ['--text-', '--icon-']],
|
|
86
|
+
[/^(fill|stroke)$/, ['--icon-', '--text-']],
|
|
87
|
+
[/^(border|outline|column-rule)/, ['--border-']],
|
|
88
|
+
[/^background/, ['--surface-', '--primary', '--secondary']],
|
|
89
|
+
];
|
|
90
|
+
|
|
91
|
+
const variable = (name) => `var(${name})`;
|
|
92
|
+
|
|
93
|
+
// Exact when a token holds the number, otherwise the nearest non-zero step: a value that is not
|
|
94
|
+
// zero is never pointed at a zero token, and a tie goes to the smaller step.
|
|
95
|
+
const onScale = (list, number, format = (token) => token.value) => {
|
|
96
|
+
const hit = list.find((token) => token.number === number);
|
|
97
|
+
if (hit) return { kind: 'exact', token: hit.name };
|
|
98
|
+
const near = list
|
|
99
|
+
.filter((token) => token.number !== 0)
|
|
100
|
+
.sort((a, b) => a.number - b.number)
|
|
101
|
+
.reduce((best, token) =>
|
|
102
|
+
Math.abs(token.number - number) < Math.abs(best.number - number)
|
|
103
|
+
? token
|
|
104
|
+
: best,
|
|
105
|
+
);
|
|
106
|
+
return { kind: 'nearest', token: near.name, tokenValue: format(near) };
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const lengthInPx = ({ number, unit }) => {
|
|
110
|
+
const value = Math.abs(parseFloat(number));
|
|
111
|
+
if (unit === 'px') return value;
|
|
112
|
+
if (unit === 'rem') return value * 16;
|
|
113
|
+
return null;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const judgeWord = (category, word, inMath) => {
|
|
117
|
+
const lower = word.toLowerCase();
|
|
118
|
+
if (
|
|
119
|
+
ALWAYS_ALLOWED.has(lower) ||
|
|
120
|
+
lower.startsWith('$') ||
|
|
121
|
+
lower.startsWith('-$')
|
|
122
|
+
)
|
|
123
|
+
return null;
|
|
124
|
+
const parsed = valueParser.unit(word);
|
|
125
|
+
|
|
126
|
+
if (category === 'motion') {
|
|
127
|
+
if (EASE_KEYWORDS[lower])
|
|
128
|
+
return {
|
|
129
|
+
kind: 'nearest',
|
|
130
|
+
token: EASE_KEYWORDS[lower],
|
|
131
|
+
tokenValue: 'keyword',
|
|
132
|
+
};
|
|
133
|
+
if (!parsed || !/^m?s$/.test(parsed.unit)) return null;
|
|
134
|
+
const ms = parseFloat(parsed.number) * (parsed.unit === 's' ? 1000 : 1);
|
|
135
|
+
return ms === 0 ? null : onScale(tokens.duration, ms);
|
|
136
|
+
}
|
|
137
|
+
if (category === 'font-weight') {
|
|
138
|
+
const weight =
|
|
139
|
+
lower === 'bold'
|
|
140
|
+
? 700
|
|
141
|
+
: parsed && parsed.unit === ''
|
|
142
|
+
? +parsed.number
|
|
143
|
+
: null;
|
|
144
|
+
return weight === null ? null : onScale(tokens.fontWeight, weight);
|
|
145
|
+
}
|
|
146
|
+
if (!parsed) return null;
|
|
147
|
+
if (category === 'line-height')
|
|
148
|
+
return parsed.unit === ''
|
|
149
|
+
? onScale(tokens.lineHeight, +parsed.number)
|
|
150
|
+
: null;
|
|
151
|
+
if (category === 'z-index') {
|
|
152
|
+
if (parsed.unit !== '' || inMath) return null;
|
|
153
|
+
const layer = +parsed.number;
|
|
154
|
+
const exact = tokens.layer.find((token) => token.number === layer);
|
|
155
|
+
if (exact) return { kind: 'exact', token: exact.name };
|
|
156
|
+
// A small or negative index orders siblings inside one stacking context; the layer scale is
|
|
157
|
+
// for what stacks across the page.
|
|
158
|
+
if (layer < 100) return null;
|
|
159
|
+
return onScale(tokens.layer, layer);
|
|
160
|
+
}
|
|
161
|
+
if (category === 'radius' && parsed.unit === '%')
|
|
162
|
+
return parsed.number === '50' && !inMath
|
|
163
|
+
? { kind: 'exact', token: '--radius-pill' }
|
|
164
|
+
: null;
|
|
165
|
+
if (inMath && (parsed.unit === '' || parsed.unit === '%')) return null;
|
|
166
|
+
const px = lengthInPx(parsed);
|
|
167
|
+
if (px === null || px === 0) return null;
|
|
168
|
+
if (category === 'radius' && px >= 100)
|
|
169
|
+
return { kind: 'exact', token: '--radius-pill' };
|
|
170
|
+
const list = {
|
|
171
|
+
radius: tokens.radius,
|
|
172
|
+
space: tokens.space,
|
|
173
|
+
'font-size': tokens.fontSize,
|
|
174
|
+
}[category];
|
|
175
|
+
const finding = onScale(list, px, (token) => `${token.number}px`);
|
|
176
|
+
return { ...finding, negative: parsed.number.startsWith('-') };
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const judgeColor = (raw, prop) => {
|
|
180
|
+
const hex = normalizeColor(raw);
|
|
181
|
+
const match = hex && tokens.colorsByHex.get(hex);
|
|
182
|
+
if (!match) return { kind: 'none' };
|
|
183
|
+
if (!match.semantic.length)
|
|
184
|
+
return { kind: 'exact', token: match.palette[0], paletteOnly: true };
|
|
185
|
+
const prefixes =
|
|
186
|
+
ROLE_PREFIX.find(([pattern]) => pattern.test(prop))?.[1] ?? [];
|
|
187
|
+
const preferred = prefixes.flatMap((prefix) =>
|
|
188
|
+
match.semantic.filter((name) => name.startsWith(prefix)),
|
|
189
|
+
)[0];
|
|
190
|
+
return { kind: 'exact', token: preferred ?? match.semantic[0] };
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
// A layer drawn inset or with no blur is a ring or a hairline, a border by other means, so only the
|
|
194
|
+
// remaining layers are compared with the elevation scale.
|
|
195
|
+
const judgeShadow = (value) => {
|
|
196
|
+
const layers = [[]];
|
|
197
|
+
for (const node of valueParser(value).nodes) {
|
|
198
|
+
if (node.type === 'div' && node.value === ',') layers.push([]);
|
|
199
|
+
else if (node.type === 'word') layers.at(-1).push(node.value.toLowerCase());
|
|
200
|
+
}
|
|
201
|
+
const elevation = layers
|
|
202
|
+
.map((words) => ({
|
|
203
|
+
inset: words.includes('inset'),
|
|
204
|
+
lengths: words
|
|
205
|
+
.filter((word) => /^-?[\d.]+(px)?$/.test(word))
|
|
206
|
+
.map(parseFloat),
|
|
207
|
+
}))
|
|
208
|
+
.filter(
|
|
209
|
+
({ inset, lengths }) => !inset && lengths.length >= 3 && lengths[2] > 0,
|
|
210
|
+
);
|
|
211
|
+
if (!elevation.length) return null;
|
|
212
|
+
const [, y, blur] = elevation[0].lengths;
|
|
213
|
+
const best = tokens.shadow.reduce((a, b) =>
|
|
214
|
+
Math.abs(b.blur - blur) < Math.abs(a.blur - blur) ? b : a,
|
|
215
|
+
);
|
|
216
|
+
return best.y === y && best.blur === blur
|
|
217
|
+
? { kind: 'exact', token: best.name }
|
|
218
|
+
: { kind: 'nearest', token: best.name, tokenValue: 'nearest elevation' };
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
const suggestionOf = ({ token, negative, paletteOnly }) => {
|
|
222
|
+
if (!token) return undefined;
|
|
223
|
+
if (negative) return `calc(-1 * ${variable(token)})`;
|
|
224
|
+
return paletteOnly
|
|
225
|
+
? `${variable(token)} (a palette step, no role token holds it)`
|
|
226
|
+
: variable(token);
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
const optionList = (value) =>
|
|
230
|
+
value === undefined || Array.isArray(value)
|
|
231
|
+
? true
|
|
232
|
+
: typeof value === 'object' && value !== null;
|
|
233
|
+
|
|
234
|
+
const rule =
|
|
235
|
+
(primary, secondary = {}) =>
|
|
236
|
+
(root, result) => {
|
|
237
|
+
if (
|
|
238
|
+
!validateOptions(
|
|
239
|
+
result,
|
|
240
|
+
ruleName,
|
|
241
|
+
{ actual: primary },
|
|
242
|
+
{
|
|
243
|
+
actual: secondary,
|
|
244
|
+
possible: {
|
|
245
|
+
allow: [(value) => typeof value === 'string' || optionList(value)],
|
|
246
|
+
categories: [
|
|
247
|
+
(value) =>
|
|
248
|
+
typeof value === 'object' &&
|
|
249
|
+
Object.entries(value).every(
|
|
250
|
+
([name, setting]) =>
|
|
251
|
+
CATEGORY_NAMES.includes(name) &&
|
|
252
|
+
[true, false, 'warning', 'error'].includes(setting),
|
|
253
|
+
),
|
|
254
|
+
],
|
|
255
|
+
ignore: [(value) => typeof value === 'string'],
|
|
256
|
+
ignoreProperties: [(value) => typeof value === 'string'],
|
|
257
|
+
},
|
|
258
|
+
optional: true,
|
|
259
|
+
},
|
|
260
|
+
)
|
|
261
|
+
)
|
|
262
|
+
return;
|
|
263
|
+
|
|
264
|
+
const file = root.source?.input?.file;
|
|
265
|
+
if (
|
|
266
|
+
file &&
|
|
267
|
+
secondary.ignore?.length &&
|
|
268
|
+
micromatch.isMatch(
|
|
269
|
+
relative(process.cwd(), file).replaceAll('\\', '/'),
|
|
270
|
+
secondary.ignore,
|
|
271
|
+
)
|
|
272
|
+
)
|
|
273
|
+
return;
|
|
274
|
+
|
|
275
|
+
const allow = Array.isArray(secondary.allow)
|
|
276
|
+
? { '*': secondary.allow }
|
|
277
|
+
: (secondary.allow ?? {});
|
|
278
|
+
const settings = { ...secondary.categories };
|
|
279
|
+
const enabled = (category) => settings[category] !== false;
|
|
280
|
+
const severityOf = (category) =>
|
|
281
|
+
typeof settings[category] === 'string' ? settings[category] : undefined;
|
|
282
|
+
const ignoredProperties = (secondary.ignoreProperties ?? []).map(
|
|
283
|
+
(pattern) => new RegExp(pattern),
|
|
284
|
+
);
|
|
285
|
+
const allowed = (category, prop, raw) =>
|
|
286
|
+
[allow['*'], allow[category], allow[prop]].some((list) =>
|
|
287
|
+
list?.includes(raw),
|
|
288
|
+
);
|
|
289
|
+
|
|
290
|
+
root.walkDecls((declaration) => {
|
|
291
|
+
const prop = declaration.prop.toLowerCase();
|
|
292
|
+
if (
|
|
293
|
+
prop.startsWith('$') ||
|
|
294
|
+
prop.startsWith('--') ||
|
|
295
|
+
declaration.value.includes('#{')
|
|
296
|
+
)
|
|
297
|
+
return;
|
|
298
|
+
if (ignoredProperties.some((pattern) => pattern.test(prop))) return;
|
|
299
|
+
const category = CATEGORIES.find(([, pattern]) =>
|
|
300
|
+
pattern.test(prop),
|
|
301
|
+
)?.[0];
|
|
302
|
+
const valueIndex =
|
|
303
|
+
declaration.prop.length + (declaration.raws.between ?? ':').length;
|
|
304
|
+
|
|
305
|
+
const emit = (finding, ofCategory, raw, index) => {
|
|
306
|
+
if (!finding || !enabled(ofCategory) || allowed(ofCategory, prop, raw))
|
|
307
|
+
return;
|
|
308
|
+
report({
|
|
309
|
+
ruleName,
|
|
310
|
+
result,
|
|
311
|
+
node: declaration,
|
|
312
|
+
index: valueIndex + index,
|
|
313
|
+
endIndex: valueIndex + index + raw.length,
|
|
314
|
+
severity: severityOf(ofCategory),
|
|
315
|
+
message: messages[finding.kind](
|
|
316
|
+
ofCategory,
|
|
317
|
+
prop,
|
|
318
|
+
raw,
|
|
319
|
+
suggestionOf(finding),
|
|
320
|
+
finding.tokenValue,
|
|
321
|
+
),
|
|
322
|
+
});
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
if (category === 'shadow') {
|
|
326
|
+
if (
|
|
327
|
+
/\d+px/.test(declaration.value) &&
|
|
328
|
+
!/^\s*var\(/.test(declaration.value) &&
|
|
329
|
+
!declaration.value.includes('$')
|
|
330
|
+
)
|
|
331
|
+
emit(judgeShadow(declaration.value), 'shadow', declaration.value, 0);
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
const visit = (nodes, inMath) => {
|
|
336
|
+
for (const node of nodes) {
|
|
337
|
+
if (node.type === 'function') {
|
|
338
|
+
const name = node.value.toLowerCase();
|
|
339
|
+
if (name === 'var' || name === 'env' || name === 'url') continue;
|
|
340
|
+
const raw = valueParser.stringify(node);
|
|
341
|
+
if (COLOR_FUNCTIONS.has(name)) {
|
|
342
|
+
if (!raw.includes('$') && !raw.includes('var('))
|
|
343
|
+
emit(judgeColor(raw, prop), 'color', raw, node.sourceIndex);
|
|
344
|
+
continue;
|
|
345
|
+
}
|
|
346
|
+
if (name === 'cubic-bezier') {
|
|
347
|
+
if (category === 'motion') {
|
|
348
|
+
const hit = tokens.ease.find(
|
|
349
|
+
(token) => token.normalized === normalizeEase(raw),
|
|
350
|
+
);
|
|
351
|
+
emit(
|
|
352
|
+
hit
|
|
353
|
+
? { kind: 'exact', token: hit.name }
|
|
354
|
+
: {
|
|
355
|
+
kind: 'nearest',
|
|
356
|
+
token: '--ease-standard',
|
|
357
|
+
tokenValue: 'closest family',
|
|
358
|
+
},
|
|
359
|
+
'motion',
|
|
360
|
+
raw,
|
|
361
|
+
node.sourceIndex,
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
continue;
|
|
365
|
+
}
|
|
366
|
+
visit(node.nodes, inMath || MATH.has(name));
|
|
367
|
+
continue;
|
|
368
|
+
}
|
|
369
|
+
if (node.type !== 'word') continue;
|
|
370
|
+
const word = node.value;
|
|
371
|
+
if (
|
|
372
|
+
/^#[0-9a-f]{3,8}$/i.test(word) ||
|
|
373
|
+
NAMED_COLORS.has(word.toLowerCase())
|
|
374
|
+
) {
|
|
375
|
+
emit(judgeColor(word, prop), 'color', word, node.sourceIndex);
|
|
376
|
+
continue;
|
|
377
|
+
}
|
|
378
|
+
if (category)
|
|
379
|
+
emit(
|
|
380
|
+
judgeWord(category, word, inMath),
|
|
381
|
+
category,
|
|
382
|
+
word,
|
|
383
|
+
node.sourceIndex,
|
|
384
|
+
);
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
visit(valueParser(declaration.value).nodes, false);
|
|
388
|
+
});
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
rule.ruleName = ruleName;
|
|
392
|
+
rule.messages = messages;
|
|
393
|
+
rule.meta = {
|
|
394
|
+
url: 'https://www.npmjs.com/package/@ids-group-ltd/ids-design-system',
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
export default createPlugin(ruleName, rule);
|
package/styles/_check-box.scss
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// override (error, warning) and pin the resting colour.
|
|
6
6
|
@mixin resolvers {
|
|
7
7
|
--_checkbox-bg-color: var(--ds-checkbox-bg-color, var(--surface-default));
|
|
8
|
-
--_checkbox-border-color: var(--ds-checkbox-border-color, var(--border-
|
|
8
|
+
--_checkbox-border-color: var(--ds-checkbox-border-color, var(--border-field));
|
|
9
9
|
--_checkbox-hover-border-color: var(--ds-checkbox-hover-border-color, var(--accent));
|
|
10
10
|
--_checkbox-selected-bg-color: var(--ds-checkbox-selected-bg-color, var(--accent));
|
|
11
11
|
--_checkbox-selected-border-color: var(--ds-checkbox-selected-border-color, var(--accent));
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
width: var(--_checkbox-glyph, var(--check-size));
|
|
21
21
|
height: var(--_checkbox-glyph, var(--check-size));
|
|
22
22
|
border: var(--check-bw) solid
|
|
23
|
-
var(--_checkbox-border-color, var(--ds-checkbox-border-color, var(--border-
|
|
23
|
+
var(--_checkbox-border-color, var(--ds-checkbox-border-color, var(--border-field)));
|
|
24
24
|
background: var(--_checkbox-bg-color, var(--ds-checkbox-bg-color, var(--surface-default)));
|
|
25
25
|
cursor: pointer;
|
|
26
26
|
display: inline-grid;
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
@use 'visually-hidden' as visually-hidden;
|
|
9
9
|
|
|
10
10
|
.ds-dropdown-panel {
|
|
11
|
-
--_option-selected-bg-color: var(--ds-option-selected-bg-color, var(--
|
|
12
|
-
--_option-selected-label-color: var(--ds-option-selected-label-color, var(--
|
|
11
|
+
--_option-selected-bg-color: var(--ds-option-selected-bg-color, var(--surface-overlay-raised-tint));
|
|
12
|
+
--_option-selected-label-color: var(--ds-option-selected-label-color, var(--accent-strong-overlay));
|
|
13
13
|
--_option-selected-bg-color-hover: var(--ds-option-selected-bg-color-hover, var(--primary-muted));
|
|
14
14
|
--_option-check-color: var(--ds-option-check-color, var(--primary));
|
|
15
15
|
|
|
@@ -32,6 +32,9 @@
|
|
|
32
32
|
--_dropdown-panel-border-color: var(--ds-dropdown-panel-border-color, var(--border-overlay));
|
|
33
33
|
--surface-secondary: var(--surface-overlay-raised-secondary);
|
|
34
34
|
--surface-muted: var(--surface-overlay-raised-muted);
|
|
35
|
+
--surface-tint: var(--surface-overlay-raised-tint);
|
|
36
|
+
--accent-surface-tint: var(--surface-overlay-raised-tint);
|
|
37
|
+
--accent-strong: var(--accent-strong-overlay);
|
|
35
38
|
--_dropdown-panel-shadow: var(--ds-dropdown-panel-shadow, var(--shadow-popover));
|
|
36
39
|
--_dropdown-panel-max-height: var(--ds-dropdown-panel-max-height, 320px);
|
|
37
40
|
|
package/styles/_field-box.scss
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
// One `--ds-field-*` set retunes input, textarea, select, multi-select, autocomplete and search.
|
|
10
10
|
// The date, time and colour pickers keep their own `-trigger-*` vocabulary.
|
|
11
11
|
@mixin field-box-tokens {
|
|
12
|
-
--_field-border-color: var(--ds-field-border-color, var(--border-
|
|
13
|
-
--_field-border-color-hover: var(--ds-field-border-color-hover, var(--border-
|
|
12
|
+
--_field-border-color: var(--ds-field-border-color, var(--border-field));
|
|
13
|
+
--_field-border-color-hover: var(--ds-field-border-color-hover, var(--border-field-hover));
|
|
14
14
|
--_field-border-color-focus: var(--ds-field-border-color-focus, var(--accent));
|
|
15
15
|
--_field-text-color: var(--ds-field-text-color, var(--text-primary));
|
|
16
16
|
--_field-placeholder-color: var(--ds-field-placeholder-color, var(--text-tertiary));
|
package/styles/_tokens.scss
CHANGED
|
@@ -398,6 +398,7 @@
|
|
|
398
398
|
--tooltip-border-color: var(--border-overlay);
|
|
399
399
|
|
|
400
400
|
--popover-maxw: 320px;
|
|
401
|
+
--popover-pad: var(--space-3);
|
|
401
402
|
|
|
402
403
|
--toast-minw: 320px;
|
|
403
404
|
--toast-maxw: 480px;
|
|
@@ -529,6 +530,10 @@
|
|
|
529
530
|
--table-cell-pad-x: var(--space-2);
|
|
530
531
|
--table-cell-pad-y: var(--space-1);
|
|
531
532
|
--table-head-pad-y: var(--space-1);
|
|
533
|
+
--tree-row-pad-y: var(--space-1);
|
|
534
|
+
--tree-row-pad-x: var(--space-2);
|
|
535
|
+
--tree-indent: var(--space-4);
|
|
536
|
+
--popover-pad: var(--space-2);
|
|
532
537
|
|
|
533
538
|
/* One rung only: a card's frame reads as lost padding before its cells do (24 to 16, cells 16 to 8). */
|
|
534
539
|
--ds-surface-padding: var(--space-4);
|
|
@@ -545,6 +550,9 @@
|
|
|
545
550
|
--status-dot-size: 6px;
|
|
546
551
|
--sidenav-w: 220px;
|
|
547
552
|
--segmented-btn-h: 24px;
|
|
553
|
+
--tree-row-pad-y: var(--space-1);
|
|
554
|
+
--tree-row-pad-x: var(--space-2);
|
|
555
|
+
--tree-indent: var(--space-4);
|
|
548
556
|
}
|
|
549
557
|
[data-density="cozy"] {
|
|
550
558
|
--hit-cozy: 40px;
|
package/themes/README.md
CHANGED
|
@@ -197,5 +197,5 @@ Green brand, measured in Chrome 2026-10-12:
|
|
|
197
197
|
- Light is the default; dark is opt-in (`data-theme="dark"`); OS-follow is a consumer opt-in. No `prefers-color-scheme` by default.
|
|
198
198
|
- Themes are sibling and self-contained; `_semantic.scss`'s `@mixin roles` holds the light-default values, dark overrides the deltas.
|
|
199
199
|
- Brands are theme-authored overlays, and a brand authored on light pairs with the default theme.
|
|
200
|
-
- Overlays take one of two fixed levels: a container (modal, drawer) is painted with `--surface-overlay`, a popover-class overlay (popover, menu, dropdown panel, picker panel, tooltip, toast) with `--surface-overlay-raised`. Each sets `--surface-secondary` and `--surface-
|
|
200
|
+
- Overlays take one of two fixed levels: a container (modal, drawer) is painted with `--surface-overlay`, a popover-class overlay (popover, menu, dropdown panel, picker panel, tooltip, toast) with `--surface-overlay-raised`. Each sets `--surface-secondary`, `--surface-muted`, `--surface-tint` and `--accent-surface-tint` on itself to its level's `-secondary` / `-muted` / `-tint` token (`--surface-overlay-secondary`, `--surface-overlay-raised-tint`, ...), so the hovers, fills and selected rows inside it stay a step above it. On dark the levels are `--neutral-100` and `--neutral-150`; in light every overlay token equals the role it replaces. Secondary text inside a popover-class overlay reads `--text-tertiary-overlay`: `--text-tertiary` in light, `--neutral-700` on dark.
|
|
201
201
|
- `--primary-hover`/`--primary-pressed` are auto-derived via `color-mix()` (toward black in light, toward white in dark).
|
package/themes/_semantic.scss
CHANGED
|
@@ -27,6 +27,9 @@
|
|
|
27
27
|
--surface-overlay-raised: var(--surface-overlay);
|
|
28
28
|
--surface-overlay-raised-secondary: var(--surface-secondary);
|
|
29
29
|
--surface-overlay-raised-muted: var(--surface-muted);
|
|
30
|
+
--surface-overlay-tint: var(--surface-tint);
|
|
31
|
+
--surface-overlay-raised-tint: var(--surface-tint);
|
|
32
|
+
--accent-strong-overlay: var(--accent-strong);
|
|
30
33
|
|
|
31
34
|
/* Modal/drawer backdrop; the dark theme flips the tint. */
|
|
32
35
|
--surface-scrim: hsl(var(--shadow-tint-h) var(--shadow-tint-s) var(--shadow-tint-l) / 55%);
|
|
@@ -36,6 +39,16 @@
|
|
|
36
39
|
|
|
37
40
|
--border-default: var(--neutral-200);
|
|
38
41
|
--border-strong: var(--neutral-300);
|
|
42
|
+
/* Every field and control boundary: at least 3:1 against the page, a card, an overlay and their
|
|
43
|
+
secondary and muted fills. Lowest pair --surface-muted: 3.62:1 on the default neutrals, 3.02:1
|
|
44
|
+
under data-neutrals="brand" at --primary-h 60 (measured 2026-11-09). */
|
|
45
|
+
--border-field: color-mix(in srgb, var(--neutral-500) 86%, var(--neutral-400));
|
|
46
|
+
--border-field-hover: var(--neutral-600);
|
|
47
|
+
/* Selected segment inside a ds-segmented track, which draws no border: the fill is the boundary, at
|
|
48
|
+
least 3:1 against the track (4.98:1, measured 2026-11-09). Declared with the theme, so a ds-color
|
|
49
|
+
zone does not recolour it. */
|
|
50
|
+
--segmented-selected: var(--accent);
|
|
51
|
+
--segmented-selected-on: var(--accent-on);
|
|
39
52
|
--border-overlay: var(--border-default);
|
|
40
53
|
--border-subtitle: var(--neutral-150);
|
|
41
54
|
--border-divider: var(--neutral-150);
|
package/themes/dark/_theme.scss
CHANGED
|
@@ -33,7 +33,16 @@
|
|
|
33
33
|
--surface-overlay-raised: var(--neutral-150);
|
|
34
34
|
--surface-overlay-raised-secondary: var(--neutral-200);
|
|
35
35
|
--surface-overlay-raised-muted: var(--neutral-300);
|
|
36
|
+
--surface-overlay-tint: color-mix(in srgb, var(--primary) 30%, var(--surface-overlay));
|
|
37
|
+
--surface-overlay-raised-tint: color-mix(in srgb, var(--primary) 30%, var(--surface-overlay-raised));
|
|
38
|
+
--accent-strong-overlay: hsl(from var(--primary) h 90% 80%);
|
|
36
39
|
--border-overlay: var(--border-strong);
|
|
40
|
+
// At least 3:1 on every surface; lowest pair --surface-overlay-raised-muted, 3.03:1 (measured 2026-11-09).
|
|
41
|
+
--border-field: color-mix(in srgb, var(--neutral-500) 80%, var(--neutral-400));
|
|
42
|
+
--border-field-hover: var(--neutral-500);
|
|
43
|
+
// --accent is 2.86:1 against the dark track; this fill is 7.45:1 (measured 2026-11-09).
|
|
44
|
+
--segmented-selected: var(--accent-strong-overlay);
|
|
45
|
+
--segmented-selected-on: var(--surface-default);
|
|
37
46
|
--text-tertiary-overlay: var(--neutral-700);
|
|
38
47
|
|
|
39
48
|
--surface-tint: hsl(from var(--primary) h 45% 16%);
|
|
@@ -81,9 +90,12 @@
|
|
|
81
90
|
|
|
82
91
|
--surface-scrim: hsl(225deg 39% 4% / 70%);
|
|
83
92
|
|
|
84
|
-
// A shadow barely shows on a dark canvas, so the alphas are several times the light ones
|
|
85
|
-
//
|
|
86
|
-
|
|
93
|
+
// A shadow barely shows on a dark canvas, so the alphas are several times the light ones. What the first
|
|
94
|
+
// step raises (a selected segment, an active pill tab, a thumb, a raised card) and the modal and drawer
|
|
95
|
+
// surface have no border of their own and are no lighter than what is under them, so both steps add a
|
|
96
|
+
// 1px light hairline as the edge.
|
|
97
|
+
--shadow-1: 0 0 0 1px hsl(var(--shadow-tint-h) var(--shadow-tint-s) 95% / 8%),
|
|
98
|
+
0 1px 2px hsl(var(--shadow-tint-h) var(--shadow-tint-s) var(--shadow-tint-l) / 30%),
|
|
87
99
|
0 1px 3px hsl(var(--shadow-tint-h) var(--shadow-tint-s) var(--shadow-tint-l) / 40%);
|
|
88
100
|
--shadow-2: 0 4px 8px hsl(var(--shadow-tint-h) var(--shadow-tint-s) var(--shadow-tint-l) / 30%),
|
|
89
101
|
0 4px 16px hsl(var(--shadow-tint-h) var(--shadow-tint-s) var(--shadow-tint-l) / 45%);
|
|
@@ -14,6 +14,8 @@ declare class AlertComponent {
|
|
|
14
14
|
readonly dismissible: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
15
15
|
/** Override the variant's default icon. */
|
|
16
16
|
readonly icon: _angular_core.InputSignal<IconName | null>;
|
|
17
|
+
/** Fills the container instead of hugging its content. */
|
|
18
|
+
readonly fullWidth: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
17
19
|
/** Fires when the user dismisses the alert. */
|
|
18
20
|
readonly closed: _angular_core.OutputEmitterRef<void>;
|
|
19
21
|
/** Announce this alert to a screen reader when it appears. Unset follows
|
|
@@ -29,7 +31,7 @@ declare class AlertComponent {
|
|
|
29
31
|
protected readonly resolvedIcon: _angular_core.Signal<IconName>;
|
|
30
32
|
protected onDismiss(leaving: HTMLElement): void;
|
|
31
33
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AlertComponent, never>;
|
|
32
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AlertComponent, "ds-alert", never, { "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "title": { "alias": "title"; "required": false; "isSignal": true; }; "dismissible": { "alias": "dismissible"; "required": false; "isSignal": true; }; "icon": { "alias": "icon"; "required": false; "isSignal": true; }; "announce": { "alias": "announce"; "required": false; "isSignal": true; }; }, { "closed": "closed"; }, never, ["*", "[actions]"], true, never>;
|
|
34
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AlertComponent, "ds-alert", never, { "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "title": { "alias": "title"; "required": false; "isSignal": true; }; "dismissible": { "alias": "dismissible"; "required": false; "isSignal": true; }; "icon": { "alias": "icon"; "required": false; "isSignal": true; }; "fullWidth": { "alias": "fullWidth"; "required": false; "isSignal": true; }; "announce": { "alias": "announce"; "required": false; "isSignal": true; }; }, { "closed": "closed"; }, never, ["*", "[actions]"], true, never>;
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
export { AlertComponent };
|