@synergy-design-system/metadata 3.16.1 → 3.18.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 (99) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/data/core/component/component:syn-button-group.json +0 -5
  3. package/data/core/component/component:syn-button.json +3 -3
  4. package/data/core/component/component:syn-chart.json +147 -2
  5. package/data/core/component/component:syn-radio-button.json +123 -14
  6. package/data/core/component/component:syn-radio-group.json +11 -0
  7. package/data/core/setup/setup:angular-components-module.json +1 -1
  8. package/data/core/setup/setup:angular-forms-module.json +1 -1
  9. package/data/core/setup/setup:angular-package.json +2 -2
  10. package/data/core/setup/setup:angular-validators-module.json +1 -1
  11. package/data/core/setup/setup:components-package.json +2 -2
  12. package/data/core/setup/setup:react-package.json +2 -2
  13. package/data/core/setup/setup:tokens-package.json +2 -2
  14. package/data/core/setup/setup:vue-package.json +2 -2
  15. package/data/core/token/token:tokens-charts-js-index-d-ts.json +1 -1
  16. package/data/core/token/token:tokens-charts-js-index-js.json +1 -1
  17. package/data/core/token/token:tokens-charts-scss-tokens-scss.json +1 -1
  18. package/data/core/token/token:tokens-charts-themes-sick2025-dark-css.json +1 -1
  19. package/data/core/token/token:tokens-charts-themes-sick2025-light-css.json +1 -1
  20. package/data/core/token/token:tokens-figma-variables-sick2018-dark-json.json +1 -1
  21. package/data/core/token/token:tokens-figma-variables-sick2018-light-json.json +1 -1
  22. package/data/core/token/token:tokens-figma-variables-sick2025-dark-json.json +1 -1
  23. package/data/core/token/token:tokens-figma-variables-sick2025-light-json.json +1 -1
  24. package/data/core/token/token:tokens-js-index-d-ts.json +1 -1
  25. package/data/core/token/token:tokens-js-index-js.json +1 -1
  26. package/data/core/token/token:tokens-scss-tokens-scss.json +1 -1
  27. package/data/core/token/token:tokens-themes-sick2018-dark-css.json +1 -1
  28. package/data/core/token/token:tokens-themes-sick2018-light-css.json +1 -1
  29. package/data/core/token/token:tokens-themes-sick2025-dark-css.json +1 -1
  30. package/data/core/token/token:tokens-themes-sick2025-light-css.json +1 -1
  31. package/data/index.json +3 -2
  32. package/data/layers/examples/component/component:syn-chart.md +115 -106
  33. package/data/layers/examples/component/component:syn-checkbox.md +16 -2
  34. package/data/layers/examples/component/component:syn-combobox.md +10 -21
  35. package/data/layers/examples/component/component:syn-file.md +16 -10
  36. package/data/layers/examples/component/component:syn-input.md +10 -3
  37. package/data/layers/examples/component/component:syn-radio-button.md +200 -0
  38. package/data/layers/examples/component/component:syn-radio-group.md +27 -2
  39. package/data/layers/examples/component/component:syn-radio.md +12 -5
  40. package/data/layers/examples/component/component:syn-range.md +16 -14
  41. package/data/layers/examples/component/component:syn-select.md +10 -3
  42. package/data/layers/examples/component/component:syn-switch.md +10 -3
  43. package/data/layers/examples/component/component:syn-textarea.md +10 -3
  44. package/data/layers/full/component/component:syn-button/components/button-group.styles.ts +66 -0
  45. package/data/layers/full/component/component:syn-button/components/button.component.ts +40 -52
  46. package/data/layers/full/component/component:syn-button/components/button.styles.ts +162 -173
  47. package/data/layers/full/component/component:syn-button-group/components/button-group.component.ts +22 -18
  48. package/data/layers/full/component/component:syn-button-group/components/button-group.styles.ts +0 -2
  49. package/data/layers/full/component/component:syn-chart/angular/chart.component.ts +11 -5
  50. package/data/layers/full/component/component:syn-chart/components/chart.component.ts +67 -20
  51. package/data/layers/full/component/component:syn-chart/components/chart.palettes.ts +59 -59
  52. package/data/layers/full/component/component:syn-chart/components/types.ts +47 -4
  53. package/data/layers/full/component/component:syn-chart/react/chart.ts +1 -1
  54. package/data/layers/full/component/component:syn-chart/vue/SynVueChart.vue +11 -5
  55. package/data/layers/full/component/component:syn-radio-button/angular/radio-button.component.ts +14 -14
  56. package/data/layers/full/component/component:syn-radio-button/components/radio-button.component.ts +45 -25
  57. package/data/layers/full/component/component:syn-radio-button/components/radio-button.styles.ts +87 -25
  58. package/data/layers/full/component/component:syn-radio-button/react/radio-button.ts +1 -1
  59. package/data/layers/full/component/component:syn-radio-button/vue/SynVueRadioButton.vue +6 -6
  60. package/data/layers/full/component/component:syn-radio-group/components/radio-group.component.ts +23 -11
  61. package/data/layers/full/component/component:syn-radio-group/components/radio-group.styles.ts +51 -6
  62. package/data/layers/full/setup/setup:angular-package/angular/CHANGELOG.md +38 -0
  63. package/data/layers/full/setup/setup:angular-package/angular/package.json +1 -1
  64. package/data/layers/full/setup/setup:components-package/components/CHANGELOG.md +36 -0
  65. package/data/layers/full/setup/setup:components-package/components/package.json +1 -1
  66. package/data/layers/full/setup/setup:react-package/react/CHANGELOG.md +28 -0
  67. package/data/layers/full/setup/setup:react-package/react/package.json +1 -1
  68. package/data/layers/full/setup/setup:react-package/react/syn-jsx-elements.ts +4 -4
  69. package/data/layers/full/setup/setup:tokens-package/tokens/CHANGELOG.md +31 -0
  70. package/data/layers/full/setup/setup:tokens-package/tokens/package.json +1 -1
  71. package/data/layers/full/setup/setup:vue-package/vue/CHANGELOG.md +38 -0
  72. package/data/layers/full/setup/setup:vue-package/vue/package.json +1 -1
  73. package/data/layers/full/tokens/charts/js/index.d.ts +275 -265
  74. package/data/layers/full/tokens/charts/js/index.js +143 -133
  75. package/data/layers/full/tokens/charts/scss/_tokens.scss +135 -133
  76. package/data/layers/full/tokens/charts/themes/sick2025_dark.css +135 -133
  77. package/data/layers/full/tokens/charts/themes/sick2025_light.css +135 -133
  78. package/data/layers/full/tokens/figma-variables/sick2018-dark.json +20 -0
  79. package/data/layers/full/tokens/figma-variables/sick2018-light.json +20 -0
  80. package/data/layers/full/tokens/figma-variables/sick2025-dark.json +20 -0
  81. package/data/layers/full/tokens/figma-variables/sick2025-light.json +20 -0
  82. package/data/layers/full/tokens/js/index.d.ts +31 -1
  83. package/data/layers/full/tokens/js/index.js +31 -1
  84. package/data/layers/full/tokens/scss/_tokens.scss +7 -1
  85. package/data/layers/full/tokens/themes/sick2018_dark.css +7 -1
  86. package/data/layers/full/tokens/themes/sick2018_light.css +7 -1
  87. package/data/layers/full/tokens/themes/sick2025_dark.css +7 -1
  88. package/data/layers/full/tokens/themes/sick2025_light.css +7 -1
  89. package/data/layers/interface/component/component:syn-chart.json +5 -5
  90. package/data/layers/interface/component/component:syn-chart.md +4 -4
  91. package/data/layers/interface/component/component:syn-radio-button.json +14 -12
  92. package/data/layers/interface/component/component:syn-radio-button.md +6 -4
  93. package/data/layers/rules/component/component:syn-radio-button.md +16 -11
  94. package/data/manifest.json +1 -1
  95. package/dist/intentPolicy/domains/input/capabilities.js +4 -0
  96. package/dist/intentPolicy/domains/input/patterns.js +9 -0
  97. package/package.json +5 -5
  98. package/data/layers/full/component/component:syn-button/components/button.custom.styles.ts +0 -245
  99. package/data/layers/full/component/component:syn-button-group/components/button-group.custom.styles.ts +0 -5
@@ -1,5 +1,5 @@
1
1
  import {
2
- type EChartsType, init, use,
2
+ type EChartsType, init, registerPreprocessor, registerTheme, use,
3
3
  } from 'echarts/core.js';
4
4
  import { CanvasRenderer } from 'echarts/renderers.js';
5
5
  import { html } from 'lit';
@@ -10,12 +10,14 @@ import { LineChart } from 'echarts/charts.js';
10
10
  import {
11
11
  GridComponent, LegendComponent, TitleComponent, TooltipComponent,
12
12
  } from 'echarts/components.js';
13
- import { classMap } from 'lit/directives/class-map.js';
14
13
  import SynergyElement from '../../internal/synergy-element.js';
15
14
  import componentStyles from '../../styles/component.styles.js';
16
15
  import styles from './chart.styles.js';
17
- import { PALETTE_TOKENS, type SynChartPalette } from './chart.palettes.js';
18
- import type { ECConfig } from './types.js';
16
+ import { type ChartPalette, PALETTE_TOKENS } from './chart.palettes.js';
17
+ import { resolveConfigInput } from './configs/config.js';
18
+ import type { ChartConfigType, ECConfig } from './types.js';
19
+ import { synergyLightTheme } from './themes/light.js';
20
+ import { applyAxisDefaultsPreprocessor } from './configs/axes/utilities.js';
19
21
 
20
22
  // TODO: Check, should we let the user define the *use* so the bundle size is optimized for their specific use case?
21
23
  use([
@@ -32,7 +34,7 @@ use([
32
34
  *
33
35
  * @documentation https://synergy-design-system.github.io/?path=/docs/charting-syn-chart--docs
34
36
  * @status experimental
35
- * @since 0.0.0
37
+ * @since 3.15.0
36
38
  *
37
39
  * @csspart base - The component's base wrapper.
38
40
  */
@@ -49,31 +51,59 @@ export default class SynChart extends SynergyElement {
49
51
 
50
52
  private resizeObserver: ResizeObserver;
51
53
 
54
+ private resolvedConfig: ECConfig = {};
55
+
52
56
  /**
53
- * The ECharts configuration option object.
57
+ * The ECharts configuration input.
58
+ *
59
+ * This property accepts either:
60
+ * - a plain `ECConfig` object, or
61
+ * - a callback that receives a typed preset handle and applies chart presets.
54
62
  *
55
- * This property maps 1:1 to the ECharts `option` parameter passed to `setOption()`.
63
+ * The resolved result maps 1:1 to the ECharts `option` parameter passed to
64
+ * `setOption()`.
56
65
  * Consult the [ECharts option documentation](https://echarts.apache.org/en/option.html)
57
- * and assign the object directly to this property.
66
+ * and assign either the object directly or build it through the handle.
58
67
  *
59
68
  * > **Note:** Currently only **line charts** (`series[].type: 'line'`) are supported.
60
69
  * > Support for additional chart types (bar, pie, etc.) will be added in future releases or can be requested.
61
70
  *
62
- * Assigning a new object completely replaces the previous chart configuration (`notMerge: true`).
71
+ * Assigning a new config input completely replaces the previous chart
72
+ * configuration (`notMerge: true`).
63
73
  * To update only parts of the chart, access the underlying ECharts instance directly and
64
74
  * call `setOption()` with custom merge options.
65
75
  *
66
76
  * @example
67
77
  * ```js
78
+ * // Using a plain object
68
79
  * chart.config = {
69
80
  * xAxis: { type: 'category', data: ['Mon', 'Tue', 'Wed'] },
70
81
  * yAxis: { type: 'value' },
71
82
  * series: [{ type: 'line', data: [150, 230, 224] }],
72
83
  * };
84
+ *
85
+ * // Using the handle with method chaining
86
+ * chart.config = (handle) => handle
87
+ * .baseConfig({
88
+ * xAxis: { type: 'category', data: ['Mon', 'Tue', 'Wed'] },
89
+ * yAxis: { type: 'value' },
90
+ * series: [{ type: 'line', data: [150, 230, 224] }],
91
+ * })
92
+ * .axesShowSplitLines();
93
+ *
94
+ * // Using the handle with sequential calls
95
+ * chart.config = (handle) => {
96
+ * handle.baseConfig({
97
+ * xAxis: { type: 'category', data: ['Mon', 'Tue', 'Wed'] },
98
+ * yAxis: { type: 'value' },
99
+ * series: [{ type: 'line', data: [150, 230, 224] }],
100
+ * });
101
+ * handle.axesShowSplitLines();
102
+ * };
73
103
  * ```
74
104
  */
75
105
  @property({ attribute: false })
76
- config: ECConfig = {};
106
+ config: ChartConfigType = {};
77
107
 
78
108
  /**
79
109
  * The color palette to apply to chart series.
@@ -88,13 +118,13 @@ export default class SynChart extends SynergyElement {
88
118
  * it takes precedence over the palette.
89
119
  */
90
120
  @property({ reflect: true })
91
- palette: SynChartPalette = 'categorical';
121
+ palette: ChartPalette = 'categorical';
92
122
 
93
123
  /** Resolves palette CSS custom properties to computed color values and applies them to the chart. */
94
124
  private applyPalette(): void {
95
125
  if (!this.chartInstance) return;
96
126
  // If the user explicitly set config.color, respect it — palette is a default only
97
- if (Array.isArray(this.config.color) && this.config.color.length > 0) return;
127
+ if (Array.isArray(this.resolvedConfig.color) && this.resolvedConfig.color.length > 0) return;
98
128
 
99
129
  const tokens = PALETTE_TOKENS[this.palette];
100
130
  const computedStyles = getComputedStyle(this);
@@ -103,23 +133,41 @@ export default class SynChart extends SynergyElement {
103
133
  .filter(Boolean);
104
134
 
105
135
  if (colors.length > 0) {
106
- this.chartInstance.setOption({ color: colors }, { notMerge: false });
136
+ const oldOption = this.chartInstance.getOption();
137
+ if (!oldOption) return;
138
+
139
+ oldOption.color = colors;
140
+ // We can not only replace 'color' via { replaceMerge: ['color'] }. Echarts does not allow to do this.
141
+ // Therefore we need to completely replace it, with the old option but new color.
142
+ this.chartInstance.setOption(oldOption, { notMerge: true });
107
143
  }
108
144
  }
109
145
 
110
146
  protected updated(changedProperties: PropertyValues<this>): void {
111
147
  if (changedProperties.has('config') && this.chartInstance) {
112
- this.chartInstance.setOption(this.config, { notMerge: true });
148
+ this.resolvedConfig = resolveConfigInput(this.config);
149
+ this.chartInstance.setOption(this.resolvedConfig, { notMerge: true });
113
150
  }
114
151
  if ((changedProperties.has('palette') || changedProperties.has('config')) && this.chartInstance) {
115
152
  this.applyPalette();
116
153
  }
117
154
  }
118
155
 
156
+ connectedCallback() {
157
+ super.connectedCallback();
158
+ registerTheme('default', synergyLightTheme);
159
+ /**
160
+ * Depending if x-axis or y-axis, the axis name has different positions and alignments. This preprocessor ensures that the correct styles are applied to the axis names based on the axis type.
161
+ * This is needed because ECharts does not provide a way to set specific styles for x and y axis, only for axis types.
162
+ */
163
+ registerPreprocessor(applyAxisDefaultsPreprocessor);
164
+ }
165
+
119
166
  // Initialize echarts instance and resize observer
120
167
  protected firstUpdated(_changedProperties: PropertyValues): void {
121
168
  if (this.chartContainer !== null && this.chartContainer !== undefined) {
122
- this.chartInstance = init(this.chartContainer);
169
+ this.chartInstance = init(this.chartContainer, 'default');
170
+
123
171
  // Resize observer
124
172
  this.resizeObserver = new ResizeObserver(() => {
125
173
  this.chartInstance?.resize();
@@ -127,8 +175,9 @@ export default class SynChart extends SynergyElement {
127
175
  this.resizeObserver.observe(this.chartContainer);
128
176
 
129
177
  // Apply config if already set before first render
130
- if (Object.keys(this.config).length > 0) {
131
- this.chartInstance.setOption(this.config);
178
+ this.resolvedConfig = resolveConfigInput(this.config);
179
+ if (Object.keys(this.resolvedConfig).length > 0) {
180
+ this.chartInstance.setOption(this.resolvedConfig);
132
181
  }
133
182
  // Apply palette after config so colors blend in without replacing the full config
134
183
  this.applyPalette();
@@ -172,9 +221,7 @@ export default class SynChart extends SynergyElement {
172
221
  return html`
173
222
  <div
174
223
  part="base"
175
- class=${classMap({
176
- chart: true,
177
- })}>
224
+ class="chart">
178
225
  </div>
179
226
  `;
180
227
  }
@@ -7,7 +7,7 @@
7
7
  * (`01`=primary, `02`=accent, `03`=muted, `04`=purple, `05`=teal, `06`=magenta, `07`=neutral)
8
8
  * - `sequential-status-critical/error/info/success/warning` — 10-step status color ramps, ordered from darkest to brightest
9
9
  */
10
- export type SynChartPalette =
10
+ export type ChartPalette =
11
11
  | 'categorical'
12
12
  | 'sequential-01'
13
13
  | 'sequential-02'
@@ -23,88 +23,88 @@ export type SynChartPalette =
23
23
  | 'sequential-status-warning';
24
24
 
25
25
  /** Maps each palette name to the ordered list of CSS custom property names to resolve. */
26
- export const PALETTE_TOKENS: Record<SynChartPalette, string[]> = {
26
+ export const PALETTE_TOKENS: Record<ChartPalette, string[]> = {
27
27
  categorical: [
28
- '--syn-categorical-01', '--syn-categorical-02', '--syn-categorical-03',
29
- '--syn-categorical-04', '--syn-categorical-05', '--syn-categorical-06',
30
- '--syn-categorical-07', '--syn-categorical-08', '--syn-categorical-09',
31
- '--syn-categorical-10', '--syn-categorical-11', '--syn-categorical-12',
28
+ '--syn-chart-categorical-01', '--syn-chart-categorical-02', '--syn-chart-categorical-03',
29
+ '--syn-chart-categorical-04', '--syn-chart-categorical-05', '--syn-chart-categorical-06',
30
+ '--syn-chart-categorical-07', '--syn-chart-categorical-08', '--syn-chart-categorical-09',
31
+ '--syn-chart-categorical-10', '--syn-chart-categorical-11', '--syn-chart-categorical-12',
32
32
  ],
33
33
  'sequential-01': [
34
- '--syn-sequential-01-100', '--syn-sequential-01-90', '--syn-sequential-01-80',
35
- '--syn-sequential-01-70', '--syn-sequential-01-60', '--syn-sequential-01-50',
36
- '--syn-sequential-01-40', '--syn-sequential-01-30', '--syn-sequential-01-20',
37
- '--syn-sequential-01-10',
34
+ '--syn-chart-sequential-01-100', '--syn-chart-sequential-01-90', '--syn-chart-sequential-01-80',
35
+ '--syn-chart-sequential-01-70', '--syn-chart-sequential-01-60', '--syn-chart-sequential-01-50',
36
+ '--syn-chart-sequential-01-40', '--syn-chart-sequential-01-30', '--syn-chart-sequential-01-20',
37
+ '--syn-chart-sequential-01-10',
38
38
  ],
39
39
  'sequential-02': [
40
- '--syn-sequential-02-100', '--syn-sequential-02-90', '--syn-sequential-02-80',
41
- '--syn-sequential-02-70', '--syn-sequential-02-60', '--syn-sequential-02-50',
42
- '--syn-sequential-02-40', '--syn-sequential-02-30', '--syn-sequential-02-20',
43
- '--syn-sequential-02-10',
40
+ '--syn-chart-sequential-02-100', '--syn-chart-sequential-02-90', '--syn-chart-sequential-02-80',
41
+ '--syn-chart-sequential-02-70', '--syn-chart-sequential-02-60', '--syn-chart-sequential-02-50',
42
+ '--syn-chart-sequential-02-40', '--syn-chart-sequential-02-30', '--syn-chart-sequential-02-20',
43
+ '--syn-chart-sequential-02-10',
44
44
  ],
45
45
  'sequential-03': [
46
- '--syn-sequential-03-100', '--syn-sequential-03-90', '--syn-sequential-03-80',
47
- '--syn-sequential-03-70', '--syn-sequential-03-60', '--syn-sequential-03-50',
48
- '--syn-sequential-03-40', '--syn-sequential-03-30', '--syn-sequential-03-20',
49
- '--syn-sequential-03-10',
46
+ '--syn-chart-sequential-03-100', '--syn-chart-sequential-03-90', '--syn-chart-sequential-03-80',
47
+ '--syn-chart-sequential-03-70', '--syn-chart-sequential-03-60', '--syn-chart-sequential-03-50',
48
+ '--syn-chart-sequential-03-40', '--syn-chart-sequential-03-30', '--syn-chart-sequential-03-20',
49
+ '--syn-chart-sequential-03-10',
50
50
  ],
51
51
  'sequential-04': [
52
- '--syn-sequential-04-100', '--syn-sequential-04-90', '--syn-sequential-04-80',
53
- '--syn-sequential-04-70', '--syn-sequential-04-60', '--syn-sequential-04-50',
54
- '--syn-sequential-04-40', '--syn-sequential-04-30', '--syn-sequential-04-20',
55
- '--syn-sequential-04-10',
52
+ '--syn-chart-sequential-04-100', '--syn-chart-sequential-04-90', '--syn-chart-sequential-04-80',
53
+ '--syn-chart-sequential-04-70', '--syn-chart-sequential-04-60', '--syn-chart-sequential-04-50',
54
+ '--syn-chart-sequential-04-40', '--syn-chart-sequential-04-30', '--syn-chart-sequential-04-20',
55
+ '--syn-chart-sequential-04-10',
56
56
  ],
57
57
  'sequential-05': [
58
- '--syn-sequential-05-100', '--syn-sequential-05-90', '--syn-sequential-05-80',
59
- '--syn-sequential-05-70', '--syn-sequential-05-60', '--syn-sequential-05-50',
60
- '--syn-sequential-05-40', '--syn-sequential-05-30', '--syn-sequential-05-20',
61
- '--syn-sequential-05-10',
58
+ '--syn-chart-sequential-05-100', '--syn-chart-sequential-05-90', '--syn-chart-sequential-05-80',
59
+ '--syn-chart-sequential-05-70', '--syn-chart-sequential-05-60', '--syn-chart-sequential-05-50',
60
+ '--syn-chart-sequential-05-40', '--syn-chart-sequential-05-30', '--syn-chart-sequential-05-20',
61
+ '--syn-chart-sequential-05-10',
62
62
  ],
63
63
  'sequential-06': [
64
- '--syn-sequential-06-100', '--syn-sequential-06-90', '--syn-sequential-06-80',
65
- '--syn-sequential-06-70', '--syn-sequential-06-60', '--syn-sequential-06-50',
66
- '--syn-sequential-06-40', '--syn-sequential-06-30', '--syn-sequential-06-20',
67
- '--syn-sequential-06-10',
64
+ '--syn-chart-sequential-06-100', '--syn-chart-sequential-06-90', '--syn-chart-sequential-06-80',
65
+ '--syn-chart-sequential-06-70', '--syn-chart-sequential-06-60', '--syn-chart-sequential-06-50',
66
+ '--syn-chart-sequential-06-40', '--syn-chart-sequential-06-30', '--syn-chart-sequential-06-20',
67
+ '--syn-chart-sequential-06-10',
68
68
  ],
69
69
  'sequential-07': [
70
- '--syn-sequential-07-100', '--syn-sequential-07-90', '--syn-sequential-07-80',
71
- '--syn-sequential-07-70', '--syn-sequential-07-60', '--syn-sequential-07-50',
72
- '--syn-sequential-07-40', '--syn-sequential-07-30', '--syn-sequential-07-20',
73
- '--syn-sequential-07-10',
70
+ '--syn-chart-sequential-07-100', '--syn-chart-sequential-07-90', '--syn-chart-sequential-07-80',
71
+ '--syn-chart-sequential-07-70', '--syn-chart-sequential-07-60', '--syn-chart-sequential-07-50',
72
+ '--syn-chart-sequential-07-40', '--syn-chart-sequential-07-30', '--syn-chart-sequential-07-20',
73
+ '--syn-chart-sequential-07-10',
74
74
  ],
75
75
  'sequential-status-critical': [
76
- '--syn-sequential-status-critical-100', '--syn-sequential-status-critical-90',
77
- '--syn-sequential-status-critical-80', '--syn-sequential-status-critical-70',
78
- '--syn-sequential-status-critical-60', '--syn-sequential-status-critical-50',
79
- '--syn-sequential-status-critical-40', '--syn-sequential-status-critical-30',
80
- '--syn-sequential-status-critical-20', '--syn-sequential-status-critical-10',
76
+ '--syn-chart-sequential-status-critical-100', '--syn-chart-sequential-status-critical-90',
77
+ '--syn-chart-sequential-status-critical-80', '--syn-chart-sequential-status-critical-70',
78
+ '--syn-chart-sequential-status-critical-60', '--syn-chart-sequential-status-critical-50',
79
+ '--syn-chart-sequential-status-critical-40', '--syn-chart-sequential-status-critical-30',
80
+ '--syn-chart-sequential-status-critical-20', '--syn-chart-sequential-status-critical-10',
81
81
  ],
82
82
  'sequential-status-error': [
83
- '--syn-sequential-status-error-100', '--syn-sequential-status-error-90',
84
- '--syn-sequential-status-error-80', '--syn-sequential-status-error-70',
85
- '--syn-sequential-status-error-60', '--syn-sequential-status-error-50',
86
- '--syn-sequential-status-error-40', '--syn-sequential-status-error-30',
87
- '--syn-sequential-status-error-20', '--syn-sequential-status-error-10',
83
+ '--syn-chart-sequential-status-error-100', '--syn-chart-sequential-status-error-90',
84
+ '--syn-chart-sequential-status-error-80', '--syn-chart-sequential-status-error-70',
85
+ '--syn-chart-sequential-status-error-60', '--syn-chart-sequential-status-error-50',
86
+ '--syn-chart-sequential-status-error-40', '--syn-chart-sequential-status-error-30',
87
+ '--syn-chart-sequential-status-error-20', '--syn-chart-sequential-status-error-10',
88
88
  ],
89
89
  'sequential-status-info': [
90
- '--syn-sequential-status-info-100', '--syn-sequential-status-info-90',
91
- '--syn-sequential-status-info-80', '--syn-sequential-status-info-70',
92
- '--syn-sequential-status-info-60', '--syn-sequential-status-info-50',
93
- '--syn-sequential-status-info-40', '--syn-sequential-status-info-30',
94
- '--syn-sequential-status-info-20', '--syn-sequential-status-info-10',
90
+ '--syn-chart-sequential-status-info-100', '--syn-chart-sequential-status-info-90',
91
+ '--syn-chart-sequential-status-info-80', '--syn-chart-sequential-status-info-70',
92
+ '--syn-chart-sequential-status-info-60', '--syn-chart-sequential-status-info-50',
93
+ '--syn-chart-sequential-status-info-40', '--syn-chart-sequential-status-info-30',
94
+ '--syn-chart-sequential-status-info-20', '--syn-chart-sequential-status-info-10',
95
95
  ],
96
96
  'sequential-status-success': [
97
- '--syn-sequential-status-success-100', '--syn-sequential-status-success-90',
98
- '--syn-sequential-status-success-80', '--syn-sequential-status-success-70',
99
- '--syn-sequential-status-success-60', '--syn-sequential-status-success-50',
100
- '--syn-sequential-status-success-40', '--syn-sequential-status-success-30',
101
- '--syn-sequential-status-success-20', '--syn-sequential-status-success-10',
97
+ '--syn-chart-sequential-status-success-100', '--syn-chart-sequential-status-success-90',
98
+ '--syn-chart-sequential-status-success-80', '--syn-chart-sequential-status-success-70',
99
+ '--syn-chart-sequential-status-success-60', '--syn-chart-sequential-status-success-50',
100
+ '--syn-chart-sequential-status-success-40', '--syn-chart-sequential-status-success-30',
101
+ '--syn-chart-sequential-status-success-20', '--syn-chart-sequential-status-success-10',
102
102
  ],
103
103
  'sequential-status-warning': [
104
- '--syn-sequential-status-warning-100', '--syn-sequential-status-warning-90',
105
- '--syn-sequential-status-warning-80', '--syn-sequential-status-warning-70',
106
- '--syn-sequential-status-warning-60', '--syn-sequential-status-warning-50',
107
- '--syn-sequential-status-warning-40', '--syn-sequential-status-warning-30',
108
- '--syn-sequential-status-warning-20', '--syn-sequential-status-warning-10',
104
+ '--syn-chart-sequential-status-warning-100', '--syn-chart-sequential-status-warning-90',
105
+ '--syn-chart-sequential-status-warning-80', '--syn-chart-sequential-status-warning-70',
106
+ '--syn-chart-sequential-status-warning-60', '--syn-chart-sequential-status-warning-50',
107
+ '--syn-chart-sequential-status-warning-40', '--syn-chart-sequential-status-warning-30',
108
+ '--syn-chart-sequential-status-warning-20', '--syn-chart-sequential-status-warning-10',
109
109
  ],
110
110
  };
@@ -1,5 +1,48 @@
1
- import type { LineSeriesOption } from 'echarts/charts.js';
2
- import type { ComposeOption } from 'echarts/core.js';
1
+ import type { EChartsOption } from 'echarts/types/dist/shared.js';
2
+ import {
3
+ type ChartPresets,
4
+ } from './configs/presets/index.js';
5
+ import type { ChartConfigBuilder } from './configs/config.js';
3
6
 
4
- // Scoped option type only includes the components and chart types registered via use()
5
- export type ECConfig = ComposeOption<LineSeriesOption>;
7
+ export type ECConfig = EChartsOption;
8
+
9
+ export type ChartPresetFunctions = {
10
+ [K in keyof typeof ChartPresets]: (...args: Parameters<(typeof ChartPresets)[K]>) => ChartConfigHandle;
11
+ };
12
+
13
+ export type ChartConfigHandle = ChartPresetFunctions & Omit<ChartConfigBuilder, 'build'>;
14
+
15
+ /**
16
+ * Configuration callback for the chart `config` property.
17
+ *
18
+ * This callback is invoked with a configuration handle that provides preset functions
19
+ * for building the chart configuration. Use the handle to call preset functions and
20
+ * set the base configuration. The callback is responsible for configuring all aspects
21
+ * of the chart before rendering.
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * config={(handle) => {
26
+ * handle.baseConfig({ ... });
27
+ * handle.axesShowSplitLines();
28
+ * handle.axesAddXLabelIcons({ ... });
29
+ * }}
30
+ * ```
31
+ */
32
+ export type ChartConfigCallback = (handle: ChartConfigHandle) => void;
33
+
34
+ /**
35
+ * Accepted input type for the `config` property on `<syn-chart>`.
36
+ *
37
+ * Can be either:
38
+ * - A direct ECharts configuration object
39
+ * - A callback function that configures the chart using preset functions
40
+ */
41
+ export type ChartConfigType = ECConfig | ChartConfigCallback;
42
+
43
+ export type {
44
+ AxisIndices,
45
+ AxisUpdateOptions,
46
+ AxesUpdateOptions,
47
+ AxisLabelIconOptions,
48
+ } from './configs/axes/types.js';
@@ -15,7 +15,7 @@ Component.define('syn-chart');
15
15
  *
16
16
  * @documentation https://synergy-design-system.github.io/?path=/docs/charting-syn-chart--docs
17
17
  * @status experimental
18
- * @since 0.0.0
18
+ * @since 3.15.0
19
19
  *
20
20
  * @csspart base - The component's base wrapper.
21
21
  */
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * @documentation https://synergy-design-system.github.io/?path=/docs/charting-syn-chart--docs
12
12
  * @status experimental
13
- * @since 0.0.0
13
+ * @since 3.15.0
14
14
  *
15
15
  * @csspart base - The component's base wrapper.
16
16
  */
@@ -44,16 +44,22 @@ it takes precedence over the palette.
44
44
  palette?: SynChart['palette'];
45
45
 
46
46
  /**
47
- * The ECharts configuration option object.
47
+ * The ECharts configuration input.
48
48
 
49
- This property maps 1:1 to the ECharts `option` parameter passed to `setOption()`.
49
+ This property accepts either:
50
+ - a plain `ECConfig` object, or
51
+ - a callback that receives a typed preset handle and applies chart presets.
52
+
53
+ The resolved result maps 1:1 to the ECharts `option` parameter passed to
54
+ `setOption()`.
50
55
  Consult the [ECharts option documentation](https://echarts.apache.org/en/option.html)
51
- and assign the object directly to this property.
56
+ and assign either the object directly or build it through the handle.
52
57
 
53
58
  > **Note:** Currently only **line charts** (`series[].type: 'line'`) are supported.
54
59
  > Support for additional chart types (bar, pie, etc.) will be added in future releases or can be requested.
55
60
 
56
- Assigning a new object completely replaces the previous chart configuration (`notMerge: true`).
61
+ Assigning a new config input completely replaces the previous chart
62
+ configuration (`notMerge: true`).
57
63
  To update only parts of the chart, access the underlying ECharts instance directly and
58
64
  call `setOption()` with custom merge options.
59
65
  */
@@ -21,7 +21,7 @@ import '@synergy-design-system/components/components/radio-button/radio-button.j
21
21
  * @summary Radios buttons allow the user to select a single option from a group using a button-like control.
22
22
  * @documentation https://synergy-design-system.github.io/?path=/docs/components-syn-radio-button--docs
23
23
  * @status stable
24
- * @since 1.0.0
24
+ * @since 3.17.0
25
25
  *
26
26
  * @slot - The radio button's label.
27
27
  * @slot prefix - A presentational prefix icon or similar element.
@@ -82,6 +82,19 @@ export class SynRadioButtonComponent {
82
82
  return this.nativeElement.disabled;
83
83
  }
84
84
 
85
+ /**
86
+ * Sets the radio button to a readonly state.
87
+ */
88
+ @Input()
89
+ set readonly(v: '' | SynRadioButton['readonly']) {
90
+ this._ngZone.runOutsideAngular(
91
+ () => (this.nativeElement.readonly = v === '' || v),
92
+ );
93
+ }
94
+ get readonly(): SynRadioButton['readonly'] {
95
+ return this.nativeElement.readonly;
96
+ }
97
+
85
98
  /**
86
99
  * The radio button's size.
87
100
  * When used inside a radio group, the size will be determined by the radio group's size so
@@ -95,19 +108,6 @@ this attribute can typically be omitted.
95
108
  return this.nativeElement.size;
96
109
  }
97
110
 
98
- /**
99
- * Draws a pill-style radio button with rounded edges.
100
- */
101
- @Input()
102
- set pill(v: '' | SynRadioButton['pill']) {
103
- this._ngZone.runOutsideAngular(
104
- () => (this.nativeElement.pill = v === '' || v),
105
- );
106
- }
107
- get pill(): SynRadioButton['pill'] {
108
- return this.nativeElement.pill;
109
- }
110
-
111
111
  /**
112
112
  * Emitted when the button loses focus.
113
113
  */
@@ -1,21 +1,20 @@
1
- /* eslint-disable */
2
- import { classMap } from 'lit/directives/class-map.js';
3
- import { HasSlotController } from '../../internal/slot.js';
4
- import { html } from 'lit/static-html.js';
5
- import { ifDefined } from 'lit/directives/if-defined.js';
1
+ import { type CSSResultGroup, html } from 'lit';
6
2
  import { property, query, state } from 'lit/decorators.js';
3
+ import { ifDefined } from 'lit/directives/if-defined.js';
4
+ import { classMap } from 'lit/directives/class-map.js';
5
+ import { HasSlotController, getTextContent } from '../../internal/slot.js';
7
6
  import { watch } from '../../internal/watch.js';
8
7
  import componentStyles from '../../styles/component.styles.js';
9
8
  import SynergyElement from '../../internal/synergy-element.js';
10
9
  import styles from './radio-button.styles.js';
11
- import type { CSSResultGroup } from 'lit';
10
+ import buttonStyles from '../button/button.styles.js';
12
11
  import { enableDefaultSettings } from '../../utilities/defaultSettings/decorator.js';
13
12
 
14
13
  /**
15
14
  * @summary Radios buttons allow the user to select a single option from a group using a button-like control.
16
15
  * @documentation https://synergy-design-system.github.io/?path=/docs/components-syn-radio-button--docs
17
16
  * @status stable
18
- * @since 1.0.0
17
+ * @since 3.17.0
19
18
  *
20
19
  * @slot - The radio button's label.
21
20
  * @slot prefix - A presentational prefix icon or similar element.
@@ -33,26 +32,32 @@ import { enableDefaultSettings } from '../../utilities/defaultSettings/decorator
33
32
  */
34
33
  @enableDefaultSettings('SynRadioButton')
35
34
  export default class SynRadioButton extends SynergyElement {
36
- static styles: CSSResultGroup = [componentStyles, styles];
35
+ static styles: CSSResultGroup = [componentStyles, buttonStyles, styles];
37
36
 
38
37
  private readonly hasSlotController = new HasSlotController(this, '[default]', 'prefix', 'suffix');
39
38
 
40
39
  @query('.button') input: HTMLInputElement;
41
- @query('.hidden-input') hiddenInput: HTMLInputElement;
40
+
41
+ @query('slot:not([name])') defaultSlot: HTMLSlotElement;
42
42
 
43
43
  @state() protected hasFocus = false;
44
44
 
45
+ @state() private iconOnly = false;
46
+
45
47
  /**
46
48
  * @internal The radio button's checked state. This is exposed as an "internal" attribute so we can reflect it, making
47
49
  * it easier to style in button groups.
48
50
  */
49
- @property({ type: Boolean, reflect: true }) checked = false;
51
+ @property({ reflect: true, type: Boolean }) checked = false;
50
52
 
51
53
  /** The radio's value. When selected, the radio group will receive this value. */
52
54
  @property() value: string | number;
53
55
 
54
56
  /** Disables the radio button. */
55
- @property({ type: Boolean, reflect: true }) disabled = false;
57
+ @property({ reflect: true, type: Boolean }) disabled = false;
58
+
59
+ /** Sets the radio button to a readonly state. */
60
+ @property({ reflect: true, type: Boolean }) readonly = false;
56
61
 
57
62
  /**
58
63
  * The radio button's size. When used inside a radio group, the size will be determined by the radio group's size so
@@ -60,21 +65,22 @@ export default class SynRadioButton extends SynergyElement {
60
65
  */
61
66
  @property({ reflect: true }) size: 'small' | 'medium' | 'large' = 'medium';
62
67
 
63
- /** Draws a pill-style radio button with rounded edges. */
64
- @property({ type: Boolean, reflect: true }) pill = false;
65
-
66
68
  connectedCallback() {
67
69
  super.connectedCallback();
68
70
  this.setAttribute('role', 'presentation');
69
71
  }
70
72
 
73
+ private isDisabled() {
74
+ return this.disabled || this.readonly;
75
+ }
76
+
71
77
  private handleBlur() {
72
78
  this.hasFocus = false;
73
79
  this.emit('syn-blur');
74
80
  }
75
81
 
76
82
  private handleClick(e: MouseEvent) {
77
- if (this.disabled) {
83
+ if (this.isDisabled()) {
78
84
  e.preventDefault();
79
85
  e.stopPropagation();
80
86
  return;
@@ -88,9 +94,17 @@ export default class SynRadioButton extends SynergyElement {
88
94
  this.emit('syn-focus');
89
95
  }
90
96
 
91
- @watch('disabled', { waitUntilFirstUpdate: true })
97
+ private handleSlotChange() {
98
+ const textContent = getTextContent(this.defaultSlot).trim();
99
+ const assignedElements = this.defaultSlot.assignedElements({ flatten: true });
100
+ const iconOnlyElement = assignedElements.length === 1 && assignedElements[0].tagName.toLowerCase() === 'syn-icon';
101
+
102
+ this.iconOnly = iconOnlyElement && textContent === '';
103
+ }
104
+
105
+ @watch(['disabled', 'readonly'], { waitUntilFirstUpdate: true })
92
106
  handleDisabledChange() {
93
- this.setAttribute('aria-disabled', this.disabled ? 'true' : 'false');
107
+ this.setAttribute('aria-disabled', this.isDisabled() ? 'true' : 'false');
94
108
  }
95
109
 
96
110
  /** Sets focus on the radio button. */
@@ -104,6 +118,7 @@ export default class SynRadioButton extends SynergyElement {
104
118
  }
105
119
 
106
120
  render() {
121
+ /* eslint-disable @typescript-eslint/unbound-method */
107
122
  return html`
108
123
  <div part="base" role="presentation">
109
124
  <button
@@ -112,31 +127,36 @@ export default class SynRadioButton extends SynergyElement {
112
127
  aria-checked="${this.checked}"
113
128
  class=${classMap({
114
129
  button: true,
115
- 'button--default': true,
116
- 'button--small': this.size === 'small',
117
- 'button--medium': this.size === 'medium',
118
- 'button--large': this.size === 'large',
119
130
  'button--checked': this.checked,
131
+ 'button--default': true,
120
132
  'button--disabled': this.disabled,
133
+ 'button--filled': this.checked,
121
134
  'button--focused': this.hasFocus,
122
- 'button--outline': true,
123
- 'button--pill': this.pill,
124
135
  'button--has-label': this.hasSlotController.test('[default]'),
125
136
  'button--has-prefix': this.hasSlotController.test('prefix'),
126
- 'button--has-suffix': this.hasSlotController.test('suffix')
137
+ 'button--has-suffix': this.hasSlotController.test('suffix'),
138
+ 'button--icon-only': this.iconOnly,
139
+ 'button--large': this.size === 'large',
140
+ 'button--medium': this.size === 'medium',
141
+ 'button--primary': true,
142
+ 'button--readonly': this.readonly,
143
+ 'button--small': this.size === 'small',
144
+ 'button--text': !this.checked,
127
145
  })}
128
146
  aria-disabled=${this.disabled}
129
147
  type="button"
148
+ tabindex=${ifDefined(this.disabled ? '-1': undefined)}
130
149
  value=${ifDefined(this.value)}
131
150
  @blur=${this.handleBlur}
132
151
  @focus=${this.handleFocus}
133
152
  @click=${this.handleClick}
134
153
  >
135
154
  <slot name="prefix" part="prefix" class="button__prefix"></slot>
136
- <slot part="label" class="button__label"></slot>
155
+ <slot part="label" class="button__label" @slotchange=${this.handleSlotChange}></slot>
137
156
  <slot name="suffix" part="suffix" class="button__suffix"></slot>
138
157
  </button>
139
158
  </div>
140
159
  `;
160
+ /* eslint-enable @typescript-eslint/unbound-method */
141
161
  }
142
162
  }