@schukai/monster 4.149.0 → 4.150.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.
Files changed (79) hide show
  1. package/package.json +1 -1
  2. package/source/components/accessibility/stylesheet/locale-picker.mjs +4 -4
  3. package/source/components/content/stylesheet/viewer.mjs +4 -4
  4. package/source/components/data/stylesheet/kpi-tile.mjs +4 -4
  5. package/source/components/data/stylesheet/metric-graph.mjs +4 -4
  6. package/source/components/data/stylesheet/metric.mjs +4 -4
  7. package/source/components/datatable/pagination.mjs +120 -21
  8. package/source/components/datatable/style/column-bar.pcss +4 -1
  9. package/source/components/datatable/style/datatable.pcss +12 -3
  10. package/source/components/datatable/style/embedded-pagination.pcss +47 -26
  11. package/source/components/datatable/style/filter-controls-defaults.pcss +4 -1
  12. package/source/components/datatable/stylesheet/change-button.mjs +4 -4
  13. package/source/components/datatable/stylesheet/column-bar.mjs +7 -5
  14. package/source/components/datatable/stylesheet/dataset.mjs +4 -4
  15. package/source/components/datatable/stylesheet/datatable.mjs +15 -7
  16. package/source/components/datatable/stylesheet/embedded-pagination.mjs +15 -1
  17. package/source/components/datatable/stylesheet/filter-controls-defaults.mjs +5 -1
  18. package/source/components/datatable/stylesheet/filter-select.mjs +4 -4
  19. package/source/components/datatable/stylesheet/filter.mjs +4 -4
  20. package/source/components/datatable/stylesheet/pagination.mjs +5 -5
  21. package/source/components/datatable/stylesheet/save-button.mjs +4 -4
  22. package/source/components/datatable/stylesheet/status.mjs +4 -4
  23. package/source/components/form/style/checklist.pcss +4 -1
  24. package/source/components/form/style/choice-cards.pcss +16 -4
  25. package/source/components/form/style/digits.pcss +4 -1
  26. package/source/components/form/style/field-layout.pcss +4 -1
  27. package/source/components/form/style/mixin/field-set-layout.pcss +8 -2
  28. package/source/components/form/style/select.pcss +12 -3
  29. package/source/components/form/style/toggle-switch.pcss +8 -0
  30. package/source/components/form/style/variant-select.pcss +8 -2
  31. package/source/components/form/stylesheet/button-bar.mjs +4 -4
  32. package/source/components/form/stylesheet/button.mjs +27 -21
  33. package/source/components/form/stylesheet/checklist.mjs +3 -1
  34. package/source/components/form/stylesheet/choice-cards.mjs +9 -1
  35. package/source/components/form/stylesheet/control-bar.mjs +4 -4
  36. package/source/components/form/stylesheet/digits.mjs +5 -1
  37. package/source/components/form/stylesheet/field-layout.mjs +5 -1
  38. package/source/components/form/stylesheet/field-set.mjs +5 -1
  39. package/source/components/form/stylesheet/form.mjs +3 -1
  40. package/source/components/form/stylesheet/input-group.mjs +3 -1
  41. package/source/components/form/stylesheet/login.mjs +3 -1
  42. package/source/components/form/stylesheet/popper-button.mjs +7 -5
  43. package/source/components/form/stylesheet/register-wizard.mjs +3 -1
  44. package/source/components/form/stylesheet/repeat-field-set-items.mjs +3 -1
  45. package/source/components/form/stylesheet/select.mjs +7 -1
  46. package/source/components/form/stylesheet/toggle-switch.mjs +5 -1
  47. package/source/components/form/stylesheet/variant-select.mjs +5 -1
  48. package/source/components/host/stylesheet/call-button.mjs +4 -4
  49. package/source/components/host/stylesheet/host.mjs +3 -1
  50. package/source/components/host/stylesheet/toggle-button.mjs +4 -4
  51. package/source/components/layout/style/tabs.pcss +16 -4
  52. package/source/components/layout/style/vertical-tabs.pcss +4 -1
  53. package/source/components/layout/stylesheet/collapse.mjs +4 -4
  54. package/source/components/layout/stylesheet/details.mjs +4 -4
  55. package/source/components/layout/stylesheet/overlay.mjs +3 -1
  56. package/source/components/layout/stylesheet/tabs.mjs +12 -4
  57. package/source/components/layout/stylesheet/vertical-tabs.mjs +3 -1
  58. package/source/components/state/stylesheet/state.mjs +1 -1
  59. package/source/components/style/button.css +4 -4
  60. package/source/components/style/form.css +3 -1
  61. package/source/components/style/form.pcss +18 -5
  62. package/source/components/style/mixin/button.pcss +2 -1
  63. package/source/components/style/theme-modern.css +2 -2
  64. package/source/components/style/theme-modern.pcss +4 -4
  65. package/source/components/stylesheet/button.mjs +4 -4
  66. package/source/components/stylesheet/form.mjs +3 -1
  67. package/source/components/stylesheet/theme-modern.mjs +2 -2
  68. package/source/components/time/stylesheet/day.mjs +4 -4
  69. package/source/components/time/stylesheet/month-calendar.mjs +4 -4
  70. package/source/components/time/timeline/stylesheet/appointment.mjs +4 -4
  71. package/source/components/time/timeline/stylesheet/segment.mjs +4 -4
  72. package/source/components/tree-menu/style/tree-menu.pcss +12 -1
  73. package/source/components/tree-menu/stylesheet/tree-menu.mjs +7 -1
  74. package/test/cases/components/datatable/mobile-layout.mjs +58 -7
  75. package/test/cases/components/datatable/pagination.mjs +79 -0
  76. package/test/cases/components/style/button-sizing.mjs +31 -0
  77. package/test/cases/components/style/form-controls.mjs +13 -0
  78. package/test/cases/components/style/theme-accent.mjs +137 -0
  79. package/test/cases/components/style/theme-modern.mjs +10 -1
@@ -11,6 +11,19 @@ const generatedStyleSheet = readFileSync(
11
11
  );
12
12
 
13
13
  describe("Global form controls", () => {
14
+ it("preserves native readonly styling across shadow tree scopes", () => {
15
+ expect(formSource).to.match(
16
+ /input\[readonly\]:not\(\[type="checkbox"\]\):not\(\[type="radio"\]\),\s*textarea\[readonly\] \{[^}]*background-color: var\(--monster-bg-color-primary-2\);[^}]*color: var\(--monster-color-primary-2\);[^}]*cursor: default;/s,
17
+ );
18
+ expect(formSource).to.include(":not([readonly]):not([disabled])");
19
+ expect(generatedStyleSheet).to.include(
20
+ "input[readonly]:not([type=checkbox]):not([type=radio]),textarea[readonly]",
21
+ );
22
+ expect(generatedStyleSheet).to.include(
23
+ "background-color:var(--monster-bg-color-primary-2);color:var(--monster-color-primary-2);cursor:default",
24
+ );
25
+ });
26
+
14
27
  it("keeps native choice controls separate from text-control sizing", () => {
15
28
  expect(formSource).to.include(
16
29
  'input:not([type="checkbox"]):not([type="radio"]),',
@@ -0,0 +1,137 @@
1
+ import { readdirSync, readFileSync } from "node:fs";
2
+ import { join, relative, resolve } from "node:path";
3
+ import { expect } from "chai";
4
+
5
+ const projectRoot = resolve(import.meta.dirname, "../../../..");
6
+ const componentRoot = join(projectRoot, "source/components");
7
+
8
+ const sourceFiles = {
9
+ tabs: "layout/style/tabs.pcss",
10
+ verticalTabs: "layout/style/vertical-tabs.pcss",
11
+ choiceCards: "form/style/choice-cards.pcss",
12
+ select: "form/style/select.pcss",
13
+ variantSelect: "form/style/variant-select.pcss",
14
+ datatable: "datatable/style/datatable.pcss",
15
+ treeMenu: "tree-menu/style/tree-menu.pcss",
16
+ themeModern: "style/theme-modern.pcss",
17
+ };
18
+
19
+ const generatedFiles = {
20
+ tabs: "layout/stylesheet/tabs.mjs",
21
+ verticalTabs: "layout/stylesheet/vertical-tabs.mjs",
22
+ choiceCards: "form/stylesheet/choice-cards.mjs",
23
+ select: "form/stylesheet/select.mjs",
24
+ variantSelect: "form/stylesheet/variant-select.mjs",
25
+ datatable: "datatable/stylesheet/datatable.mjs",
26
+ treeMenu: "tree-menu/stylesheet/tree-menu.mjs",
27
+ toggleSwitch: "form/stylesheet/toggle-switch.mjs",
28
+ themeModern: "stylesheet/theme-modern.mjs",
29
+ };
30
+
31
+ describe("Theme accent contract", () => {
32
+ it("gives every native accent-color declaration a legacy fallback", () => {
33
+ const declarations = [];
34
+
35
+ for (const file of walkPcssFiles(componentRoot)) {
36
+ const source = readFileSync(file, "utf8");
37
+ for (const match of source.matchAll(/accent-color:\s*([^;]+);/gu)) {
38
+ declarations.push({
39
+ file: relative(componentRoot, file),
40
+ value: match[1],
41
+ });
42
+ }
43
+ }
44
+
45
+ expect(declarations).to.have.length.greaterThan(0);
46
+ for (const { file, value } of declarations) {
47
+ expect(value, file).to.include("--monster-theme-accent");
48
+ expect(value, file).to.match(
49
+ /var\(\s*--monster-theme-accent,\s*var\(\s*--monster-/u,
50
+ );
51
+ }
52
+ });
53
+
54
+ it("uses the accent pair for active and selected controls", () => {
55
+ const sources = Object.fromEntries(
56
+ Object.entries(sourceFiles).map(([name, file]) => [
57
+ name,
58
+ readFileSync(join(componentRoot, file), "utf8"),
59
+ ]),
60
+ );
61
+
62
+ for (const name of [
63
+ "tabs",
64
+ "verticalTabs",
65
+ "choiceCards",
66
+ "select",
67
+ "variantSelect",
68
+ "datatable",
69
+ "treeMenu",
70
+ ]) {
71
+ expect(sources[name], name).to.include("--monster-theme-accent");
72
+ }
73
+
74
+ for (const name of ["select", "variantSelect", "datatable", "treeMenu"]) {
75
+ expect(sources[name], name).to.include("--monster-theme-accent-subtle");
76
+ }
77
+
78
+ expect(sources.choiceCards).to.include("--monster-theme-on-accent");
79
+ const toggleSwitch = readFileSync(
80
+ join(componentRoot, "form/style/toggle-switch.pcss"),
81
+ "utf8",
82
+ );
83
+ expect(toggleSwitch).to.match(
84
+ /\.switch\[data-monster-state="on"\] \.switch-slider[\s\S]*?--monster-theme-accent[\s\S]*?--monster-theme-on-accent/u,
85
+ );
86
+ expect(sources.themeModern).to.include(
87
+ "--monster-tabs-button-active-color: var(--monster-theme-accent)",
88
+ );
89
+ expect(sources.themeModern).to.include(
90
+ "--monster-tabs-button-active-border-color: var(--monster-theme-accent)",
91
+ );
92
+ expect(sources.themeModern).to.include(
93
+ "--monster-theme-on-bg-color: var(--monster-theme-accent)",
94
+ );
95
+ });
96
+
97
+ it("ships the accent contract in generated component styles", () => {
98
+ for (const [name, file] of Object.entries(generatedFiles)) {
99
+ const generated = readFileSync(join(componentRoot, file), "utf8");
100
+ expect(generated, name).to.include("--monster-theme-accent");
101
+ }
102
+
103
+ const generatedTheme = readFileSync(
104
+ join(componentRoot, generatedFiles.themeModern),
105
+ "utf8",
106
+ );
107
+ expect(generatedTheme).to.include(
108
+ "--monster-tabs-button-active-color:var(--monster-theme-accent)",
109
+ );
110
+ expect(generatedTheme).to.include(
111
+ "--monster-theme-on-bg-color:var(--monster-theme-accent)",
112
+ );
113
+ });
114
+
115
+ it("keeps generated stylesheet imports independent of the checkout path", () => {
116
+ for (const file of walkFiles(componentRoot, ".mjs")) {
117
+ const source = readFileSync(file, "utf8");
118
+ expect(source, relative(componentRoot, file)).not.to.match(
119
+ /from\s+"[^"]*monster\/source\//u,
120
+ );
121
+ }
122
+ });
123
+ });
124
+
125
+ function walkPcssFiles(directory) {
126
+ return walkFiles(directory, ".pcss");
127
+ }
128
+
129
+ function walkFiles(directory, extension) {
130
+ return readdirSync(directory, { withFileTypes: true }).flatMap((entry) => {
131
+ const path = join(directory, entry.name);
132
+ if (entry.isDirectory()) {
133
+ return walkFiles(path, extension);
134
+ }
135
+ return entry.isFile() && entry.name.endsWith(extension) ? [path] : [];
136
+ });
137
+ }
@@ -85,6 +85,9 @@ const requiredCompatibilityTokens = [
85
85
  ];
86
86
 
87
87
  const contrastPairs = [
88
+ ["theme-accent", "theme-surface-canvas", 4.5],
89
+ ["theme-accent", "theme-surface", 4.5],
90
+ ["theme-accent", "theme-accent-subtle", 4.5],
88
91
  ["theme-text", "theme-surface-canvas", 4.5],
89
92
  ["theme-text", "theme-surface", 4.5],
90
93
  ["theme-text-secondary", "theme-surface", 4.5],
@@ -227,7 +230,13 @@ describe("Modern theme stylesheet", () => {
227
230
  "--monster-split-panel-handle-border-radius:999px",
228
231
  );
229
232
  expect(generatedCss).to.include(
230
- "--monster-tabs-button-active-border-color:var(--monster-theme-tertiary)",
233
+ "--monster-tabs-button-active-border-color:var(--monster-theme-accent)",
234
+ );
235
+ expect(generatedCss).to.include(
236
+ "--monster-tabs-button-active-color:var(--monster-theme-accent)",
237
+ );
238
+ expect(generatedCss).to.include(
239
+ "--monster-theme-on-bg-color:var(--monster-theme-accent)",
231
240
  );
232
241
  expect(generatedCss).to.include(
233
242
  "--monster-tabs-indicator-active-opacity:0",