@ids-group-ltd/ids-design-system 1.1.1 → 1.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/CHANGELOG.md +869 -0
- package/agent/INDEX.md +8 -7
- package/agent/charts/ds-scatter-chart.md +1 -1
- package/agent/feedback/ds-badge.md +2 -2
- package/agent/feedback/ds-chat-message.md +1 -1
- package/agent/feedback/ds-chat-step.md +2 -2
- package/agent/feedback/ds-chat-thread.md +1 -1
- package/agent/feedback/ds-empty-state.md +2 -1
- package/agent/feedback/ds-stat.md +1 -1
- package/agent/feedback/ds-toast.md +2 -2
- package/agent/feedback/ds-tree.md +4 -2
- package/agent/forms/ds-button.md +3 -3
- package/agent/forms/ds-chat-input.md +3 -3
- package/agent/forms/ds-dropzone.md +1 -1
- package/agent/forms/ds-icon-button.md +3 -3
- package/agent/forms/ds-number-stepper.md +3 -3
- package/agent/forms/ds-search.md +1 -1
- package/agent/forms/ds-split-button.md +1 -1
- package/agent/foundations/tokens.md +4 -3
- package/agent/navigation/ds-app-layout.md +1 -1
- package/agent/navigation/ds-nav-divider.md +6 -0
- package/agent/navigation/{ds-sidenav-footer.md → ds-nav-footer.md} +3 -3
- package/agent/navigation/{ds-sidenav-group.md → ds-nav-group.md} +2 -2
- package/agent/navigation/{ds-sidenav-item.md → ds-nav-item.md} +6 -6
- package/agent/navigation/ds-nav.md +15 -0
- package/agent/navigation/ds-splitter.md +1 -1
- package/agent/overlays/ds-drawer.md +1 -1
- package/agent/platform/toast-service.md +1 -1
- package/components/README.md +24 -24
- package/components.md +60 -51
- package/design-system.md +8 -7
- package/eslint/deprecated-api.json +108 -7
- package/fesm2022/ids-group-ltd-ids-design-system-components-accordion.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-accordion.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-alert.mjs +2 -2
- 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 +4 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-app-layout.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-auth-layout.mjs +4 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-auth-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-avatar.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-avatar.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-badge-badge-count-roll.component-BDNXADJZ.mjs +182 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-badge-badge-count-roll.component-BDNXADJZ.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-badge.mjs +37 -8
- package/fesm2022/ids-group-ltd-ids-design-system-components-badge.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-breadcrumbs.mjs +5 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-breadcrumbs.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-button-group.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-button-group.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs +76 -5
- package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-calendar-day.mjs +2 -2
- 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-chart-tooltip.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-tooltip.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-chat.mjs +122 -21
- 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-definition-term.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-definition-term.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-description-list.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-description-list.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-drawer.mjs +65 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-drawer.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-dropzone.mjs +76 -9
- package/fesm2022/ids-group-ltd-ids-design-system-components-dropzone.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-funnel-chart.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-heatmap-chart.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-heatmap-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-icon-button.mjs +6 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-icon-button.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-info-hint.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-info-hint.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-inline-edit.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-inline-edit.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-list.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-menu.mjs +4 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-menu.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-modal.mjs +2 -2
- 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-nav-footer.mjs +113 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-nav-footer.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-nav.mjs +228 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-nav.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-number-stepper.mjs +61 -10
- 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-pagination.mjs +36 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-pagination.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-pie-chart.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-popover.mjs +9 -2
- 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-reveal.mjs +56 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-reveal.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-scatter-chart.mjs +10 -39
- package/fesm2022/ids-group-ltd-ids-design-system-components-scatter-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-search.mjs +7 -4
- 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 +33 -6
- 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-sidenav-footer.mjs +4 -98
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav-footer.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav.mjs +11 -179
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-skeleton.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-skeleton.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-slider.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-slider.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-split-button.mjs +3 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-split-button.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-stat.mjs +68 -5
- package/fesm2022/ids-group-ltd-ids-design-system-components-stat.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-tabs.mjs +41 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-tabs.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-tag.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-tag.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-textarea.mjs +6 -4
- 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 +4 -4
- 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 +27 -7
- package/fesm2022/ids-group-ltd-ids-design-system-components-timeline.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-toast.mjs +54 -19
- package/fesm2022/ids-group-ltd-ids-design-system-components-toast.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 +8 -7
- 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 +58 -9
- package/fesm2022/ids-group-ltd-ids-design-system-components-tree.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-w3w.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-w3w.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components.mjs +153 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs +25 -1
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system.mjs +4 -1
- package/fesm2022/ids-group-ltd-ids-design-system.mjs.map +1 -1
- package/migrations/1.1.1.json +14 -4
- package/migrations/1.1.2.json +143 -0
- package/migrations/1.2.0.json +1433 -0
- package/migrations/README.md +11 -2
- package/package.json +28 -1
- package/schematics/check-overrides/index.cjs +28 -3
- package/schematics/check-overrides/scan.cjs +151 -2
- package/schematics/check-overrides/schema.json +4 -0
- package/schematics/check-overrides/surface.json +397 -73
- package/schematics/collection.json +1 -1
- package/stylelint/deprecated-tokens.json +7 -0
- 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 +6 -5
- package/styles/_dropdown-overlay.scss +6 -8
- package/styles/_ds-color.scss +7 -2
- package/styles/_field-state.scss +4 -2
- package/styles/_focus.scss +12 -5
- package/styles/_link.scss +4 -4
- package/styles/_optical-center.scss +29 -0
- package/styles/_reveal.scss +8 -0
- package/styles/_status.scss +17 -7
- package/styles/_step-marker.scss +192 -6
- package/styles/_surface-level.scss +16 -0
- package/styles/_text-shimmer.scss +21 -0
- package/styles/_theme-activation.scss +17 -4
- package/styles/_tokens.scss +34 -7
- package/styles/ds.scss +1 -0
- package/themes/README.md +16 -21
- package/themes/_semantic.scss +134 -61
- package/themes/dark/_theme.scss +20 -24
- package/types/ids-group-ltd-ids-design-system-components-app-layout.d.ts +3 -3
- package/types/ids-group-ltd-ids-design-system-components-auth-layout.d.ts +2 -2
- package/types/ids-group-ltd-ids-design-system-components-badge.d.ts +20 -1
- package/types/ids-group-ltd-ids-design-system-components-button.d.ts +14 -3
- package/types/ids-group-ltd-ids-design-system-components-chat.d.ts +67 -6
- package/types/ids-group-ltd-ids-design-system-components-drawer.d.ts +9 -1
- package/types/ids-group-ltd-ids-design-system-components-dropzone.d.ts +28 -2
- package/types/ids-group-ltd-ids-design-system-components-empty-state.d.ts +7 -2
- package/types/ids-group-ltd-ids-design-system-components-icon-button.d.ts +8 -5
- package/types/ids-group-ltd-ids-design-system-components-nav-footer.d.ts +88 -0
- package/types/ids-group-ltd-ids-design-system-components-nav.d.ts +152 -0
- package/types/ids-group-ltd-ids-design-system-components-number-stepper.d.ts +21 -3
- package/types/ids-group-ltd-ids-design-system-components-pagination.d.ts +1 -0
- package/types/ids-group-ltd-ids-design-system-components-reveal.d.ts +31 -0
- package/types/ids-group-ltd-ids-design-system-components-scatter-chart.d.ts +2 -8
- package/types/ids-group-ltd-ids-design-system-components-search.d.ts +4 -1
- package/types/ids-group-ltd-ids-design-system-components-segmented.d.ts +3 -0
- package/types/ids-group-ltd-ids-design-system-components-sidenav-footer.d.ts +12 -83
- package/types/ids-group-ltd-ids-design-system-components-sidenav.d.ts +21 -131
- package/types/ids-group-ltd-ids-design-system-components-split-button.d.ts +1 -1
- package/types/ids-group-ltd-ids-design-system-components-stat.d.ts +10 -1
- package/types/ids-group-ltd-ids-design-system-components-tabs.d.ts +1 -0
- package/types/ids-group-ltd-ids-design-system-components-textarea.d.ts +1 -1
- package/types/ids-group-ltd-ids-design-system-components-timeline.d.ts +3 -1
- package/types/ids-group-ltd-ids-design-system-components-toast.d.ts +27 -6
- package/types/ids-group-ltd-ids-design-system-components-tree.d.ts +26 -4
- package/types/ids-group-ltd-ids-design-system-components.d.ts +26 -1
- package/types/ids-group-ltd-ids-design-system-core.d.ts +38 -2
- package/types/ids-group-ltd-ids-design-system.d.ts +10 -7
- package/agent/navigation/ds-sidenav.md +0 -13
|
@@ -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,8 +5,8 @@
|
|
|
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-
|
|
9
|
-
--_checkbox-hover-border-color: var(--ds-checkbox-hover-border-color, var(--
|
|
8
|
+
--_checkbox-border-color: var(--ds-checkbox-border-color, var(--border-field));
|
|
9
|
+
--_checkbox-hover-border-color: var(--ds-checkbox-hover-border-color, var(--border-field-hover));
|
|
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));
|
|
12
12
|
--_checkbox-radius: var(--ds-checkbox-radius, var(--ds-radius-inner));
|
|
@@ -20,8 +20,9 @@
|
|
|
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
|
+
background-clip: padding-box;
|
|
25
26
|
cursor: pointer;
|
|
26
27
|
display: inline-grid;
|
|
27
28
|
place-items: center;
|
|
@@ -34,8 +35,8 @@
|
|
|
34
35
|
transition: background-color var(--duration-fast) var(--ease-standard),
|
|
35
36
|
border-color var(--duration-fast) var(--ease-standard);
|
|
36
37
|
|
|
37
|
-
&:hover:not(:disabled) {
|
|
38
|
-
border-color: var(--_checkbox-hover-border-color, var(--ds-checkbox-hover-border-color, var(--
|
|
38
|
+
&:hover:not(:disabled, :checked, :indeterminate) {
|
|
39
|
+
border-color: var(--_checkbox-hover-border-color, var(--ds-checkbox-hover-border-color, var(--border-field-hover)));
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
@include press.feedback;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
@use 'check-mark' as check-mark;
|
|
7
7
|
@use 'text-clip' as text-clip;
|
|
8
8
|
@use 'visually-hidden' as visually-hidden;
|
|
9
|
+
@use 'surface-level' as surface-level;
|
|
9
10
|
|
|
10
11
|
.ds-dropdown-panel {
|
|
11
12
|
--_option-selected-bg-color: var(--ds-option-selected-bg-color, var(--surface-overlay-raised-tint));
|
|
@@ -19,7 +20,7 @@
|
|
|
19
20
|
--_option-padding: var(--ds-option-padding, var(--space-2) var(--space-2-5));
|
|
20
21
|
--_option-radius: var(--ds-option-radius, var(--ds-radius-inner));
|
|
21
22
|
--_option-row-gap: var(--ds-option-row-gap, 2px);
|
|
22
|
-
--_option-bg-color-active: var(--ds-option-bg-color-active, var(--
|
|
23
|
+
--_option-bg-color-active: var(--ds-option-bg-color-active, var(--state-layer-hover));
|
|
23
24
|
--_option-font-weight: var(--ds-option-font-weight, var(--font-weight-medium));
|
|
24
25
|
--_option-font-size: var(--ds-option-font-size, var(--font-size-s));
|
|
25
26
|
--_option-line-height: var(--ds-option-line-height, var(--line-height-flat));
|
|
@@ -30,11 +31,8 @@
|
|
|
30
31
|
|
|
31
32
|
--_dropdown-panel-bg-color: var(--ds-dropdown-panel-bg-color, var(--surface-overlay-raised));
|
|
32
33
|
--_dropdown-panel-border-color: var(--ds-dropdown-panel-border-color, var(--border-overlay));
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
--surface-tint: var(--surface-overlay-raised-tint);
|
|
36
|
-
--accent-surface-tint: var(--surface-overlay-raised-tint);
|
|
37
|
-
--accent-strong: var(--accent-strong-overlay);
|
|
34
|
+
|
|
35
|
+
@include surface-level.overlay('overlay-raised');
|
|
38
36
|
--_dropdown-panel-shadow: var(--ds-dropdown-panel-shadow, var(--shadow-popover));
|
|
39
37
|
--_dropdown-panel-max-height: var(--ds-dropdown-panel-max-height, 320px);
|
|
40
38
|
|
|
@@ -66,7 +64,7 @@
|
|
|
66
64
|
}
|
|
67
65
|
|
|
68
66
|
.dropdown-list {
|
|
69
|
-
max-height: var(--picker-maxh);
|
|
67
|
+
max-height: var(--ds-dropdown-panel-max-height, var(--picker-maxh));
|
|
70
68
|
list-style: none;
|
|
71
69
|
margin: 0;
|
|
72
70
|
padding: 0;
|
|
@@ -187,7 +185,7 @@
|
|
|
187
185
|
}
|
|
188
186
|
|
|
189
187
|
&:active:not(.is-disabled, :disabled) {
|
|
190
|
-
background: var(--
|
|
188
|
+
background: var(--state-layer-pressed);
|
|
191
189
|
}
|
|
192
190
|
|
|
193
191
|
&:focus-visible {
|
package/styles/_ds-color.scss
CHANGED
|
@@ -7,7 +7,7 @@ $families: secondary, tertiary, error, success, warning;
|
|
|
7
7
|
//
|
|
8
8
|
// Each pointer ends in a fallback: a role a family does not define is guaranteed-invalid and would reset
|
|
9
9
|
// every declaration reading it to `unset` with no console message. -hover, -pressed and -strong fall
|
|
10
|
-
// back to the family base, tints to its -muted, -on and the focus pointers to the theme-wide role.
|
|
10
|
+
// back to the family base, tints and the tonal press to its -muted, -on and the focus pointers to the theme-wide role.
|
|
11
11
|
@mixin family-vars($family) {
|
|
12
12
|
--accent: var(--#{$family});
|
|
13
13
|
--accent-hover: var(--#{$family}-hover, var(--#{$family}));
|
|
@@ -16,9 +16,10 @@ $families: secondary, tertiary, error, success, warning;
|
|
|
16
16
|
--accent-subtitle: var(--#{$family}-subtitle, var(--#{$family}-muted));
|
|
17
17
|
--accent-muted: var(--#{$family}-muted, var(--surface-muted));
|
|
18
18
|
--accent-muted-strong: var(--#{$family}-muted-strong, var(--#{$family}-muted));
|
|
19
|
+
--accent-muted-pressed: var(--#{$family}-muted-pressed, var(--#{$family}-muted));
|
|
19
20
|
--accent-on: var(--#{$family}-on, var(--text-on-primary));
|
|
20
21
|
--accent-focus-ring: var(--focus-ring-#{$family}, var(--focus-ring));
|
|
21
|
-
--accent-focus-field: var(--
|
|
22
|
+
--accent-focus-field: 0 0 0 var(--border-width-default) var(--#{$family});
|
|
22
23
|
--accent-surface-tint: var(--#{$family}-subtitle, var(--#{$family}-muted));
|
|
23
24
|
|
|
24
25
|
// Re-declared: `--focus-ring-color: var(--accent)` on :root is resolved there, so the subtree would ring brand-blue.
|
|
@@ -39,4 +40,8 @@ $families: secondary, tertiary, error, success, warning;
|
|
|
39
40
|
[ds-color='#{$family}'] {
|
|
40
41
|
@include family-vars($family);
|
|
41
42
|
}
|
|
43
|
+
|
|
44
|
+
:root[data-focus='halo'] [ds-color='#{$family}'] {
|
|
45
|
+
--accent-focus-field: var(--focus-field-#{$family}, var(--focus-field));
|
|
46
|
+
}
|
|
42
47
|
}
|
package/styles/_field-state.scss
CHANGED
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
$error-border: var(--error),
|
|
7
7
|
$error-bg: var(--error-subtitle),
|
|
8
8
|
$error-focus-shadow: var(--ds-field-focus-shadow-error),
|
|
9
|
-
$warning-border: var(--warning
|
|
9
|
+
$warning-border: var(--ds-field-border-warning),
|
|
10
10
|
$success-border: var(--success),
|
|
11
11
|
$warning-focus-shadow: var(--ds-field-focus-shadow-warning),
|
|
12
|
+
$warning-focus-border: var(--ds-field-focus-border-warning),
|
|
12
13
|
$success-focus-shadow: var(--ds-field-focus-shadow-success)
|
|
13
14
|
) {
|
|
14
15
|
// `:not(.in-group)`: a segment ties `.in-group` at (0,3,0) and this mixin is included last, so the fill
|
|
@@ -24,12 +25,13 @@
|
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
//
|
|
28
|
+
// The warning border is 1.57:1 against a white field, under the 3:1 WCAG 1.4.11 asks; `--ds-field-border-warning: var(--warning-text)` gives 4.59:1.
|
|
28
29
|
:host([data-field-state='warning']:not(.in-group)) #{$box}:not(.disabled):not(:disabled) {
|
|
29
30
|
border-color: #{$warning-border};
|
|
30
31
|
|
|
31
32
|
&:focus-within,
|
|
32
33
|
&:focus-visible {
|
|
34
|
+
border-color: #{$warning-focus-border};
|
|
33
35
|
box-shadow: #{$warning-focus-shadow};
|
|
34
36
|
}
|
|
35
37
|
}
|
package/styles/_focus.scss
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Focus-indicator style, switched in one place: `<html data-focus="...">`.
|
|
2
|
-
// Controls take an `outline` (a negative offset draws inside an `overflow` ancestor); fields a
|
|
2
|
+
// Controls take an `outline` (a negative offset draws inside an `overflow` ancestor); fields a crisp ring through `--ds-field-focus-shadow`.
|
|
3
3
|
|
|
4
4
|
// The control indicator. Does not touch box-shadow, so a focused card keeps its elevation; a state
|
|
5
5
|
// painting its own shadow must yield, see `state-shadow`.
|
|
@@ -72,15 +72,21 @@
|
|
|
72
72
|
|
|
73
73
|
// `--warning-text`, not `--focus-ring-warning`: the bright warning hue is 1.47:1 on white, too faint for a ring.
|
|
74
74
|
--ds-field-focus-shadow-warning: 0 0 0 2px var(--focus-ring-inner), 0 0 0 4px var(--warning-text);
|
|
75
|
+
--ds-field-focus-border-warning: var(--warning-text);
|
|
75
76
|
--ds-field-focus-shadow-success: var(--focus-ring-success);
|
|
76
77
|
}
|
|
77
78
|
|
|
78
79
|
:root[data-focus='edge'] {
|
|
79
80
|
--focus-ring-offset: 0px;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
--ds-field-focus-shadow
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
:root[data-focus='halo'] {
|
|
84
|
+
--ds-field-focus-shadow: var(--focus-field);
|
|
85
|
+
--ds-field-focus-shadow-error: var(--focus-field-error);
|
|
86
|
+
--ds-field-focus-shadow-warning: var(--focus-field-warning);
|
|
87
|
+
--ds-field-focus-border-warning: var(--warning-text);
|
|
88
|
+
--ds-field-focus-shadow-success: var(--focus-field-success);
|
|
89
|
+
--accent-focus-field: var(--focus-field);
|
|
84
90
|
}
|
|
85
91
|
|
|
86
92
|
// Not pinned to :root: set it on a clipping element and everything inside keeps an indicator.
|
|
@@ -89,6 +95,7 @@
|
|
|
89
95
|
--ds-field-focus-shadow: var(--focus-ring-inset);
|
|
90
96
|
--ds-field-focus-shadow-error: var(--focus-ring-inset-error);
|
|
91
97
|
--ds-field-focus-shadow-warning: inset 0 0 0 2px var(--focus-ring-inner), inset 0 0 0 4px var(--warning-text);
|
|
98
|
+
--ds-field-focus-border-warning: var(--warning-text);
|
|
92
99
|
--ds-field-focus-shadow-success: inset 0 0 0 2px var(--focus-ring-inner), inset 0 0 0 4px var(--success);
|
|
93
100
|
}
|
|
94
101
|
|
package/styles/_link.scss
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
.link {
|
|
6
6
|
--_link-color: var(--ds-link-color, var(--text-link));
|
|
7
|
-
--_link-color-hover: var(--ds-link-color-hover, color-mix(in srgb, var(--_link-color) 80%,
|
|
8
|
-
--_link-color-active: var(--ds-link-color-active, color-mix(in srgb, var(--_link-color) 65%,
|
|
7
|
+
--_link-color-hover: var(--ds-link-color-hover, color-mix(in srgb, var(--_link-color) 80%, var(--text-link-state-ink)));
|
|
8
|
+
--_link-color-active: var(--ds-link-color-active, color-mix(in srgb, var(--_link-color) 65%, var(--text-link-state-ink)));
|
|
9
9
|
--_link-color-visited: var(--ds-link-color-visited, var(--text-link-visited));
|
|
10
|
-
--_link-color-visited-hover: var(--ds-link-color-visited-hover, color-mix(in srgb, var(--_link-color-visited) 80%,
|
|
11
|
-
--_link-color-visited-active: var(--ds-link-color-visited-active, color-mix(in srgb, var(--_link-color-visited) 65%,
|
|
10
|
+
--_link-color-visited-hover: var(--ds-link-color-visited-hover, color-mix(in srgb, var(--_link-color-visited) 80%, var(--text-link-state-ink)));
|
|
11
|
+
--_link-color-visited-active: var(--ds-link-color-visited-active, color-mix(in srgb, var(--_link-color-visited) 65%, var(--text-link-state-ink)));
|
|
12
12
|
--_link-color-disabled: var(--ds-link-color-disabled, var(--text-disabled));
|
|
13
13
|
--_link-underline-color: var(--ds-link-underline-color, currentcolor);
|
|
14
14
|
--_link-underline-thickness: var(--ds-link-underline-thickness, 1px);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* A short label in a small box: a count, initials, a page, step or day number. Centring the line box
|
|
2
|
+
leaves the glyphs high, since figures and capitals have no descender, so the label's box is
|
|
3
|
+
trimmed to cap height and baseline. The baseline still lands on a whole CSS pixel, so up to half
|
|
4
|
+
a pixel stays. Without `text-box` support the label keeps line-box centring. */
|
|
5
|
+
|
|
6
|
+
/* The label is the only child of a box that centres it (`place-items: center`). It must be an
|
|
7
|
+
element: `text-box` does not reach the anonymous box of bare text. The trailing letter-spacing is
|
|
8
|
+
handed back so it does not pull the glyphs left of centre. */
|
|
9
|
+
@mixin label($letter-spacing: null) {
|
|
10
|
+
text-box: trim-both cap alphabetic;
|
|
11
|
+
|
|
12
|
+
@if $letter-spacing {
|
|
13
|
+
margin-inline-end: calc(-1 * #{$letter-spacing});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* The box sizes itself around its text (a pill with no fixed height): the trimmed leading comes back
|
|
18
|
+
as equal padding, so the pill keeps its height and the capitals sit in its middle. */
|
|
19
|
+
@mixin pill($padding-block: null) {
|
|
20
|
+
@supports (text-box: trim-both cap alphabetic) {
|
|
21
|
+
text-box: trim-both cap alphabetic;
|
|
22
|
+
|
|
23
|
+
@if $padding-block {
|
|
24
|
+
padding-block: calc(#{$padding-block} + (1lh - 1cap) / 2);
|
|
25
|
+
} @else {
|
|
26
|
+
padding-block: calc((1lh - 1cap) / 2);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// The class `dsReveal` puts on an item while it fades in. The item waits `--ds-reveal-index` steps of
|
|
2
|
+
// `--stagger-step`, never more than `--stagger-max` steps.
|
|
3
|
+
.ds-reveal {
|
|
4
|
+
--_ds-reveal-steps: min(var(--ds-reveal-index, 0), var(--stagger-max));
|
|
5
|
+
|
|
6
|
+
animation: ds-fade-in var(--duration-base) var(--ease-standard) both;
|
|
7
|
+
animation-delay: calc(var(--_ds-reveal-steps) * var(--stagger-step));
|
|
8
|
+
}
|