@iroco/ui 1.10.3 → 1.11.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.
@@ -7,6 +7,7 @@
7
7
  title: 'Iroco-UI/Components/Steps',
8
8
  component: Steps,
9
9
  args: {
10
+ aria_label: 'Steps example',
10
11
  steps: [{ text: 'Foo' }, { text: 'Bar' }, { text: 'Baz' }]
11
12
  }
12
13
  });
@@ -1,4 +1,14 @@
1
1
  <!--
2
+
3
+ - 2025-08-14 : Migrate to Svelte 5 syntax
4
+ - 2025-08-14 : Rename from Alter to StepIconAlert
5
+
6
+ Copyright (c) 2025, Iroco. All rights reserved.
7
+ Use of this source code is governed by a BSD-style license that can be found
8
+ in the LICENSE file.
9
+
10
+ ---
11
+
2
12
  Copyright (c) 2021, Jingshao Chen. All rights reserved.
3
13
  Use of this source code is governed by a BSD-style license that can be found
4
14
  in the LICENSE file.
@@ -0,0 +1,6 @@
1
+ interface Props {
2
+ stroke?: string;
3
+ }
4
+ declare const StepIconAlert: import("svelte").Component<Props, {}, "">;
5
+ type StepIconAlert = ReturnType<typeof StepIconAlert>;
6
+ export default StepIconAlert;
@@ -1,4 +1,14 @@
1
1
  <!--
2
+
3
+ - 2025-08-14 : Migrate to Svelte 5 syntax
4
+ - 2025-08-14 : Rename from Check to StepIconCheck
5
+
6
+ Copyright (c) 2025, Iroco. All rights reserved.
7
+ Use of this source code is governed by a BSD-style license that can be found
8
+ in the LICENSE file.
9
+
10
+ ---
11
+
2
12
  Copyright (c) 2021, Jingshao Chen. All rights reserved.
3
13
  Use of this source code is governed by a BSD-style license that can be found
4
14
  in the LICENSE file.
@@ -0,0 +1,6 @@
1
+ interface Props {
2
+ stroke?: string;
3
+ }
4
+ declare const StepIconCheck: import("svelte").Component<Props, {}, "">;
5
+ type StepIconCheck = ReturnType<typeof StepIconCheck>;
6
+ export default StepIconCheck;
@@ -1,43 +1,8 @@
1
1
  <!--
2
2
 
3
- @component
4
-
5
- # svelte-steps
6
-
7
- ## props
8
-
9
- - `steps`:
10
- - Array of object. Length has to be more than 1
11
- - Required
12
- - Each item is a step object that can have:
13
- - `text`: The text displayed below each steps.
14
- - `icon`: A svelte component displayed inside each steps.
15
- - `iconProps`: An object that will be passed as props to the `icon` component.
16
- - `current`: current step index. Number. Default `0`
17
- - `size`: size of the step buttons. String. Default `"3rem"`
18
- - `line`: thickness of the connecting lines between the step buttons. String. Default `"0.3rem"`
19
- - `primary`: Primary color of passed and current steps. String. Default `'var(--bs-primary, #3a86ff)'`
20
- - `secondary`: Secondary color of future steps. String. Default `'var(--bs-secondary, #bbbbc0)'`
21
- - `light`: Primary color of text color in passed anc current steps. String. Default `'var(--bs-light, white)'`
22
- - `dark`: Secondary color of text color in future steps. String. Default `'var(--bs-dark, black)'`
23
- - `borderRadius`: Border radius of the step buttons. String. Default `'50%'` (circle)
24
- - `fontFamily`: Font family of the component. String. Default `"'Helvetica Neue', Helvetica, Arial, sans-serif"`
25
- - `vertical`: Vertical steps
26
- - `reverse`: For horizontal steps, reverse the step from right to the left; for vertical steps, reverse puts text labels to the left. Default `false`
27
- - `clickable`: When set to `false`, Clicking icons and labels will not change step. You have to change `current` to change step. Default `true`
28
- - `checkIcon`: User defined check icon for passed steps. If not specified, use the default check mark. Set to `null` if you don't want a check icon.
29
- - `alertIcon`: User defined alert icon for passed steps that has truthful `alert` property. If not specified, use the default alert icon. Set to `null` if you don't want an alert icon.
30
- - `alertColor`: User defined bg color for passed steps that has truthful `alert` property. Default 'var(--bs-danger, #dc3545)'
31
-
32
- ## events
33
-
34
- - `on:click(e)`: click event. Event detail object has two keys:
35
- - `e.detail.current`: the index of current step
36
- - `e.detail.last`: the index of last step
37
-
38
- ## Copyright
39
-
40
3
  - 2025-08-07 : Use Iroco CSS var for steps label
4
+ - 2025-08-14 : Migrate to Svelte 5 syntax
5
+ - 2025-08-14 : Migrate to Typescript
41
6
 
42
7
  Copyright (c) 2025, Iroco. All rights reserved.
43
8
  Use of this source code is governed by a BSD-style license that can be found
@@ -52,7 +17,7 @@
52
17
  https://github.com/shaozi/svelte-steps
53
18
 
54
19
  -->
55
- <script>
20
+ <script lang="ts">
56
21
  import { run } from 'svelte/legacy';
57
22
 
58
23
  // A bootstrap step component
@@ -60,30 +25,57 @@
60
25
  import { cubicOut } from 'svelte/easing';
61
26
 
62
27
  import { createEventDispatcher } from 'svelte';
63
- import Check from './Check.svelte';
64
- import Alert from './Alert.svelte';
65
-
66
- /**
67
- * @typedef {Object} Props
68
- * @property {any} steps
69
- * @property {number} [current]
70
- * @property {boolean} [vertical]
71
- * @property {any} [size]
72
- * @property {any} [line]
73
- * @property {any} [lineHeight]
74
- * @property {string} [primary]
75
- * @property {string} [secondary]
76
- * @property {string} [light]
77
- * @property {string} [dark]
78
- * @property {string} [borderRadius]
79
- * @property {string} [fontFamily]
80
- * @property {boolean} [reverse]
81
- * @property {boolean} [clickable]
82
- * @property {any} [checkIcon]
83
- * @property {any} [alertIcon]
84
- * @property {string} [alertColor]
85
- * @property {boolean} [htmlMode]
86
- */
28
+ import StepIconCheck from './StepIconCheck.svelte';
29
+ import StepIconAlert from './StepIconAlert.svelte';
30
+
31
+ interface Props {
32
+ /** Accessible name for this component (it has role="progressbar") */
33
+ aria_label: string;
34
+ /**
35
+ *
36
+ * - Array of object. Length has to be more than 1
37
+ * - Required
38
+ * - Each item is a step object that can have:
39
+ * - `text`: The text displayed below each steps.
40
+ * - `icon`: A svelte component displayed inside each steps.
41
+ * - `iconProps`: An object that will be passed as props to the `icon` component.
42
+ */
43
+ steps: { text: string; alert?: boolean; icon?: boolean; iconProps?: any }[];
44
+ /** Current step index. Default `0` */
45
+ current: number;
46
+ /** When set to `false`, Clicking icons and labels will not change step. You have to change `current` to change step. Default `true` */
47
+ clickable: boolean;
48
+
49
+ /** Vertical steps */
50
+ vertical: boolean;
51
+ /** For horizontal steps, reverse the step from right to the left; for vertical steps, reverse puts text labels to the left. Default `false` */
52
+ reverse: boolean;
53
+
54
+ /** size of the step buttons. String. Default `"3rem"` */
55
+ size: string;
56
+ /** thickness of the connecting lines between the step buttons. String. Default `"0.3rem"` */
57
+ line: string;
58
+ /** Primary color of passed and current steps. String. Default `'var(--bs-primary, #3a86ff)'` */
59
+ primary: string;
60
+ /** Secondary color of future steps. String. Default `'var(--bs-secondary, #bbbbc0)'` */
61
+ secondary: string;
62
+ /** Primary color of text color in passed anc current steps. String. Default `'var(--bs-light, white)'` */
63
+ light: string;
64
+ /** Secondary color of text color in future steps. String. Default `'var(--bs-dark, black)'` */
65
+ dark: string;
66
+ /** Border radius of the step buttons. String. Default `'50%'` (circle) */
67
+ borderRadius: string;
68
+ /** Font family of the component. String. Default `"'Helvetica Neue', Helvetica, Arial, sans-serif"` */
69
+ fontFamily: string;
70
+ /** User defined check icon for passed steps. If not specified, use the default check mark. Set to `null` if you don't want a check icon. */
71
+ checkIcon: any;
72
+ /** User defined alert icon for passed steps that has truthful `alert` property. If not specified, use the default alert icon. Set to `null` if you don't want an alert icon. */
73
+ alertIcon: any;
74
+ /** User defined bg color for passed steps that has truthful `alert` property. Default 'var(--bs-danger, #dc3545)' */
75
+ alertColor: string;
76
+ /** Evaluates step test as HTML */
77
+ htmlMode: boolean;
78
+ }
87
79
 
88
80
  /** @type {Props} */
89
81
  let {
@@ -92,7 +84,6 @@
92
84
  vertical = false,
93
85
  size = vertical ? '2rem' : '3rem',
94
86
  line = $bindable(vertical ? '0.15rem' : '0.3rem'),
95
- lineHeight = undefined,
96
87
  primary = 'var(--bs-primary, #3a86ff)',
97
88
  secondary = 'var(--bs-secondary, #bbbbc0)',
98
89
  light = 'var(--bs-light, white)',
@@ -101,20 +92,16 @@
101
92
  fontFamily = '',
102
93
  reverse = false,
103
94
  clickable = true,
104
- checkIcon = Check,
105
- alertIcon = Alert,
95
+ checkIcon = StepIconCheck,
96
+ alertIcon = StepIconAlert,
106
97
  alertColor = 'var(--bs-danger, #dc3545)',
107
- htmlMode = false
108
- } = $props();
98
+ htmlMode = false,
99
+ aria_label
100
+ }: Props = $props();
109
101
 
110
102
  const minStepSize = '5rem';
111
103
  const stepLabelSpace = '1rem';
112
104
 
113
- // for backward compatible when using lineHeight instead of line
114
- if (lineHeight) {
115
- line = lineHeight;
116
- }
117
-
118
105
  // each segment is half of the step size
119
106
 
120
107
  // @type { height: number; width: number }[]
@@ -177,6 +164,33 @@
177
164
  };
178
165
  </script>
179
166
 
167
+ <!--
168
+
169
+ @component
170
+
171
+ A customizable and accessible step component.
172
+
173
+ ## Usage
174
+
175
+ ```svelte
176
+ <Steps
177
+ aria_label="My steps"
178
+ current={0}
179
+ steps={[
180
+ {test:"Foo"},
181
+ {test:"Bar"},
182
+ {test:"Baz"},
183
+ ]}
184
+ />
185
+ ```
186
+
187
+ ## Events
188
+
189
+ - `onclick(e)`: click event. Event detail object has two keys:
190
+ - `e.detail.current`: the index of current step
191
+ - `e.detail.last`: the index of last step
192
+
193
+ -->
180
194
  <div
181
195
  class="steps-container"
182
196
  role="progressbar"
@@ -184,6 +198,7 @@
184
198
  aria-valuemax={`${(steps?.length ?? 0) + 1}`}
185
199
  aria-valuenow={`${(current ?? 0) + 1}`}
186
200
  aria-valuetext={`${steps[current]?.text}`}
201
+ aria-label={aria_label}
187
202
  style={`--size: ${size};
188
203
  --line-thickness: ${line};
189
204
  --primary: ${primary};
@@ -1,107 +1,56 @@
1
- export default Steps;
2
- type Steps = SvelteComponent<Props, {
3
- click: CustomEvent<any>;
4
- } & {
5
- [evt: string]: CustomEvent<any>;
6
- }, {}> & {
7
- $$bindings?: "line" | "current" | undefined;
8
- };
9
- /**
10
- * # svelte-steps
11
- *
12
- * ## props
13
- *
14
- * - `steps`:
15
- * - Array of object. Length has to be more than 1
16
- * - Required
17
- * - Each item is a step object that can have:
18
- * - `text`: The text displayed below each steps.
19
- * - `icon`: A svelte component displayed inside each steps.
20
- * - `iconProps`: An object that will be passed as props to the `icon` component.
21
- * - `current`: current step index. Number. Default `0`
22
- * - `size`: size of the step buttons. String. Default `"3rem"`
23
- * - `line`: thickness of the connecting lines between the step buttons. String. Default `"0.3rem"`
24
- * - `primary`: Primary color of passed and current steps. String. Default `'var(--bs-primary, #3a86ff)'`
25
- * - `secondary`: Secondary color of future steps. String. Default `'var(--bs-secondary, #bbbbc0)'`
26
- * - `light`: Primary color of text color in passed anc current steps. String. Default `'var(--bs-light, white)'`
27
- * - `dark`: Secondary color of text color in future steps. String. Default `'var(--bs-dark, black)'`
28
- * - `borderRadius`: Border radius of the step buttons. String. Default `'50%'` (circle)
29
- * - `fontFamily`: Font family of the component. String. Default `"'Helvetica Neue', Helvetica, Arial, sans-serif"`
30
- * - `vertical`: Vertical steps
31
- * - `reverse`: For horizontal steps, reverse the step from right to the left; for vertical steps, reverse puts text labels to the left. Default `false`
32
- * - `clickable`: When set to `false`, Clicking icons and labels will not change step. You have to change `current` to change step. Default `true`
33
- * - `checkIcon`: User defined check icon for passed steps. If not specified, use the default check mark. Set to `null` if you don't want a check icon.
34
- * - `alertIcon`: User defined alert icon for passed steps that has truthful `alert` property. If not specified, use the default alert icon. Set to `null` if you don't want an alert icon.
35
- * - `alertColor`: User defined bg color for passed steps that has truthful `alert` property. Default 'var(--bs-danger, #dc3545)'
36
- *
37
- * ## events
38
- *
39
- * - `on:click(e)`: click event. Event detail object has two keys:
40
- * - `e.detail.current`: the index of current step
41
- * - `e.detail.last`: the index of last step
42
- *
43
- * ## Copyright
44
- *
45
- * - 2025-08-07 : Use Iroco CSS var for steps label
46
- *
47
- * Copyright (c) 2025, Iroco. All rights reserved.
48
- * Use of this source code is governed by a BSD-style license that can be found
49
- * in the LICENSE file.
50
- *
51
- * ---
52
- *
53
- * Copyright (c) 2021, Jingshao Chen. All rights reserved.
54
- * Use of this source code is governed by a BSD-style license that can be found
55
- * in the LICENSE file.
56
- *
57
- * https://github.com/shaozi/svelte-steps
58
- */
59
- declare const Steps: $$__sveltets_2_IsomorphicComponent<{
60
- steps: any;
61
- current?: number | undefined;
62
- vertical?: boolean | undefined;
63
- size?: any;
64
- line?: any;
65
- lineHeight?: any;
66
- primary?: string | undefined;
67
- secondary?: string | undefined;
68
- light?: string | undefined;
69
- dark?: string | undefined;
70
- borderRadius?: string | undefined;
71
- fontFamily?: string | undefined;
72
- reverse?: boolean | undefined;
73
- clickable?: boolean | undefined;
74
- checkIcon?: any;
75
- alertIcon?: any;
76
- alertColor?: string | undefined;
77
- htmlMode?: boolean | undefined;
78
- }, {
79
- click: CustomEvent<any>;
80
- } & {
81
- [evt: string]: CustomEvent<any>;
82
- }, {}, {}, "line" | "current">;
83
- type Props = {
84
- steps: any;
85
- current?: number | undefined;
86
- vertical?: boolean | undefined;
87
- size?: any;
88
- line?: any;
89
- lineHeight?: any;
90
- primary?: string | undefined;
91
- secondary?: string | undefined;
92
- light?: string | undefined;
93
- dark?: string | undefined;
94
- borderRadius?: string | undefined;
95
- fontFamily?: string | undefined;
96
- reverse?: boolean | undefined;
97
- clickable?: boolean | undefined;
98
- checkIcon?: any;
99
- alertIcon?: any;
100
- alertColor?: string | undefined;
101
- htmlMode?: boolean | undefined;
102
- };
1
+ interface Props {
2
+ /** Accessible name for this component (it has role="progressbar") */
3
+ aria_label: string;
4
+ /**
5
+ *
6
+ * - Array of object. Length has to be more than 1
7
+ * - Required
8
+ * - Each item is a step object that can have:
9
+ * - `text`: The text displayed below each steps.
10
+ * - `icon`: A svelte component displayed inside each steps.
11
+ * - `iconProps`: An object that will be passed as props to the `icon` component.
12
+ */
13
+ steps: {
14
+ text: string;
15
+ alert?: boolean;
16
+ icon?: boolean;
17
+ iconProps?: any;
18
+ }[];
19
+ /** Current step index. Default `0` */
20
+ current: number;
21
+ /** When set to `false`, Clicking icons and labels will not change step. You have to change `current` to change step. Default `true` */
22
+ clickable: boolean;
23
+ /** Vertical steps */
24
+ vertical: boolean;
25
+ /** For horizontal steps, reverse the step from right to the left; for vertical steps, reverse puts text labels to the left. Default `false` */
26
+ reverse: boolean;
27
+ /** size of the step buttons. String. Default `"3rem"` */
28
+ size: string;
29
+ /** thickness of the connecting lines between the step buttons. String. Default `"0.3rem"` */
30
+ line: string;
31
+ /** Primary color of passed and current steps. String. Default `'var(--bs-primary, #3a86ff)'` */
32
+ primary: string;
33
+ /** Secondary color of future steps. String. Default `'var(--bs-secondary, #bbbbc0)'` */
34
+ secondary: string;
35
+ /** Primary color of text color in passed anc current steps. String. Default `'var(--bs-light, white)'` */
36
+ light: string;
37
+ /** Secondary color of text color in future steps. String. Default `'var(--bs-dark, black)'` */
38
+ dark: string;
39
+ /** Border radius of the step buttons. String. Default `'50%'` (circle) */
40
+ borderRadius: string;
41
+ /** Font family of the component. String. Default `"'Helvetica Neue', Helvetica, Arial, sans-serif"` */
42
+ fontFamily: string;
43
+ /** User defined check icon for passed steps. If not specified, use the default check mark. Set to `null` if you don't want a check icon. */
44
+ checkIcon: any;
45
+ /** User defined alert icon for passed steps that has truthful `alert` property. If not specified, use the default alert icon. Set to `null` if you don't want an alert icon. */
46
+ alertIcon: any;
47
+ /** User defined bg color for passed steps that has truthful `alert` property. Default 'var(--bs-danger, #dc3545)' */
48
+ alertColor: string;
49
+ /** Evaluates step test as HTML */
50
+ htmlMode: boolean;
51
+ }
103
52
  interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
104
- new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
53
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
105
54
  $$bindings?: Bindings;
106
55
  } & Exports;
107
56
  (internal: unknown, props: Props & {
@@ -113,3 +62,33 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
113
62
  };
114
63
  z_$$bindings?: Bindings;
115
64
  }
65
+ /**
66
+ * A customizable and accessible step component.
67
+ *
68
+ * ## Usage
69
+ *
70
+ * ```svelte
71
+ * <Steps
72
+ * aria_label="My steps"
73
+ * current={0}
74
+ * steps={[
75
+ * {test:"Foo"},
76
+ * {test:"Bar"},
77
+ * {test:"Baz"},
78
+ * ]}
79
+ * />
80
+ * ```
81
+ *
82
+ * ## Events
83
+ *
84
+ * - `onclick(e)`: click event. Event detail object has two keys:
85
+ * - `e.detail.current`: the index of current step
86
+ * - `e.detail.last`: the index of last step
87
+ */
88
+ declare const Steps: $$__sveltets_2_IsomorphicComponent<Props, {
89
+ click: CustomEvent<any>;
90
+ } & {
91
+ [evt: string]: CustomEvent<any>;
92
+ }, {}, {}, "line" | "current">;
93
+ type Steps = InstanceType<typeof Steps>;
94
+ export default Steps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iroco/ui",
3
- "version": "1.10.3",
3
+ "version": "1.11.0",
4
4
  "description": "Iroco design system based on Svelte",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -9,7 +9,7 @@
9
9
  "test:watch": "vitest watch --passWithNoTests",
10
10
  "svelte:check": "svelte-check --tsconfig ./tsconfig.json",
11
11
  "dev": "storybook dev -p 5175",
12
- "build": "svelte-package",
12
+ "build": "svelte-package --types",
13
13
  "check": "svelte-check --tsconfig ./tsconfig.json",
14
14
  "check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
15
15
  "lint": "prettier . --check . && eslint .",
@@ -276,6 +276,5 @@
276
276
  "./dist/index.d.ts"
277
277
  ]
278
278
  }
279
- },
280
- "packageManager": "yarn@1.22.21+sha1.1959a18351b811cdeedbd484a8f86c3cc3bbaf72"
279
+ }
281
280
  }
@@ -1,6 +0,0 @@
1
- interface Props {
2
- stroke?: string;
3
- }
4
- declare const Alert: import("svelte").Component<Props, {}, "">;
5
- type Alert = ReturnType<typeof Alert>;
6
- export default Alert;
@@ -1,6 +0,0 @@
1
- interface Props {
2
- stroke?: string;
3
- }
4
- declare const Check: import("svelte").Component<Props, {}, "">;
5
- type Check = ReturnType<typeof Check>;
6
- export default Check;