@iroco/ui 1.8.1 → 1.10.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.
@@ -21,7 +21,7 @@
21
21
 
22
22
  <style>.iroco-ui-form input,
23
23
  .iroco-ui-form textarea {
24
- outline-color: var(--color-secondary);
24
+ outline-color: var(--color-border);
25
25
  outline-style: ridge;
26
26
  text-decoration: none;
27
27
  font-size: 14px;
@@ -17,7 +17,7 @@
17
17
 
18
18
  <style>.iroco-ui-form input,
19
19
  .iroco-ui-form textarea {
20
- outline-color: var(--color-secondary);
20
+ outline-color: var(--color-border);
21
21
  outline-style: ridge;
22
22
  text-decoration: none;
23
23
  font-size: 14px;
@@ -0,0 +1,23 @@
1
+ <script module lang="ts">
2
+ import { Steps } from './index';
3
+
4
+ import { defineMeta, setTemplate } from '@storybook/addon-svelte-csf';
5
+
6
+ const { Story } = defineMeta({
7
+ title: 'Iroco-UI/Components/Steps',
8
+ component: Steps,
9
+ args: {
10
+ steps: [{ text: 'Foo' }, { text: 'Bar' }, { text: 'Baz' }]
11
+ }
12
+ });
13
+ </script>
14
+
15
+ <script lang="ts">
16
+ setTemplate(template);
17
+ </script>
18
+
19
+ {#snippet template({ ...args })}
20
+ <Steps {...args} />
21
+ {/snippet}
22
+
23
+ <Story name="Default" />
@@ -0,0 +1,19 @@
1
+ import { Steps } from './index';
2
+ 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> {
3
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
+ $$bindings?: Bindings;
5
+ } & Exports;
6
+ (internal: unknown, props: {
7
+ $$events?: Events;
8
+ $$slots?: Slots;
9
+ }): Exports & {
10
+ $set?: any;
11
+ $on?: any;
12
+ };
13
+ z_$$bindings?: Bindings;
14
+ }
15
+ declare const Steps: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
16
+ [evt: string]: CustomEvent<any>;
17
+ }, {}, {}, string>;
18
+ type Steps = InstanceType<typeof Steps>;
19
+ export default Steps;
@@ -79,7 +79,7 @@
79
79
 
80
80
  <style>.iroco-ui-form input,
81
81
  .iroco-ui-form textarea {
82
- outline-color: var(--color-secondary);
82
+ outline-color: var(--color-border);
83
83
  outline-style: ridge;
84
84
  text-decoration: none;
85
85
  font-size: 14px;
package/dist/index.d.ts CHANGED
@@ -19,4 +19,5 @@ export { default as NumberInput } from './NumberInput.svelte';
19
19
  export { default as RadioButton } from './RadioButton.svelte';
20
20
  export { default as SlottedComponentWrapper } from './SlottedComponentWrapper.svelte';
21
21
  export { default as TextInput } from './TextInput.svelte';
22
+ export { Steps } from './svelte-steps';
22
23
  export * from './definition';
package/dist/index.js CHANGED
@@ -19,4 +19,5 @@ export { default as NumberInput } from './NumberInput.svelte';
19
19
  export { default as RadioButton } from './RadioButton.svelte';
20
20
  export { default as SlottedComponentWrapper } from './SlottedComponentWrapper.svelte';
21
21
  export { default as TextInput } from './TextInput.svelte';
22
+ export { Steps } from './svelte-steps';
22
23
  export * from './definition';
@@ -1,7 +1,7 @@
1
1
  .iroco-ui-form {
2
2
  input,
3
3
  textarea {
4
- outline-color: var(--color-secondary);
4
+ outline-color: var(--color-border);
5
5
  outline-style: ridge;
6
6
  text-decoration: none;
7
7
  font-size: 14px;
@@ -0,0 +1,29 @@
1
+ <!--
2
+ Copyright (c) 2021, Jingshao Chen. All rights reserved.
3
+ Use of this source code is governed by a BSD-style license that can be found
4
+ in the LICENSE file.
5
+
6
+ https://github.com/shaozi/svelte-steps
7
+ -->
8
+ <script>
9
+ export let stroke = 'currentColor';
10
+ </script>
11
+
12
+ <svg
13
+ xmlns="http://www.w3.org/2000/svg"
14
+ width="1em"
15
+ height="1em"
16
+ viewBox="0 0 24 24"
17
+ fill="none"
18
+ {stroke}
19
+ stroke-width="2"
20
+ stroke-linecap="round"
21
+ stroke-linejoin="round"
22
+ class="feather feather-alert-triangle"
23
+ >
24
+ <path
25
+ d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"
26
+ />
27
+ <line x1="12" y1="9" x2="12" y2="13" />
28
+ <line x1="12" y1="17" x2="12.01" y2="17" />
29
+ </svg>
@@ -0,0 +1,26 @@
1
+ export default Alert;
2
+ type Alert = SvelteComponent<{
3
+ stroke?: string | undefined;
4
+ }, {
5
+ [evt: string]: CustomEvent<any>;
6
+ }, {}> & {
7
+ $$bindings?: string | undefined;
8
+ };
9
+ declare const Alert: $$__sveltets_2_IsomorphicComponent<{
10
+ stroke?: string | undefined;
11
+ }, {
12
+ [evt: string]: CustomEvent<any>;
13
+ }, {}, {}, string>;
14
+ 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> {
15
+ new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
16
+ $$bindings?: Bindings;
17
+ } & Exports;
18
+ (internal: unknown, props: Props & {
19
+ $$events?: Events;
20
+ $$slots?: Slots;
21
+ }): Exports & {
22
+ $set?: any;
23
+ $on?: any;
24
+ };
25
+ z_$$bindings?: Bindings;
26
+ }
@@ -0,0 +1,26 @@
1
+ export default Check;
2
+ type Check = SvelteComponent<{
3
+ stroke?: string | undefined;
4
+ }, {
5
+ [evt: string]: CustomEvent<any>;
6
+ }, {}> & {
7
+ $$bindings?: string | undefined;
8
+ };
9
+ declare const Check: $$__sveltets_2_IsomorphicComponent<{
10
+ stroke?: string | undefined;
11
+ }, {
12
+ [evt: string]: CustomEvent<any>;
13
+ }, {}, {}, string>;
14
+ 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> {
15
+ new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
16
+ $$bindings?: Bindings;
17
+ } & Exports;
18
+ (internal: unknown, props: Props & {
19
+ $$events?: Events;
20
+ $$slots?: Slots;
21
+ }): Exports & {
22
+ $set?: any;
23
+ $on?: any;
24
+ };
25
+ z_$$bindings?: Bindings;
26
+ }
@@ -0,0 +1,27 @@
1
+ BSD 2-Clause License
2
+
3
+ Copyright (c) 2025, Iroco
4
+ Copyright (c) 2021, Jingshao Chen
5
+
6
+ All rights reserved.
7
+
8
+ Redistribution and use in source and binary forms, with or without
9
+ modification, are permitted provided that the following conditions are met:
10
+
11
+ 1. Redistributions of source code must retain the above copyright notice, this
12
+ list of conditions and the following disclaimer.
13
+
14
+ 2. Redistributions in binary form must reproduce the above copyright notice,
15
+ this list of conditions and the following disclaimer in the documentation
16
+ and/or other materials provided with the distribution.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,190 @@
1
+ # 🐾 Svelte steps component 🐾
2
+
3
+ ## Forked by Iroco
4
+
5
+ Forked from https://github.com/shaozi/svelte-steps at commit `6fef9940e354ced639bba5c5f72e8408b6bd9469`
6
+
7
+ As Iroco Team, we forked this project since it did not evolve since 2022.
8
+
9
+ We plan to improve the following :
10
+
11
+ - [x] Adapt npm package to our organization
12
+ - [x] Keep credits to original author
13
+ - [ ] Release with `release-it`
14
+ - [ ] Add credit ourselves when modifying
15
+ - [ ] Update to Svelte 5 peer dependencies
16
+ - [ ] Update to node lts
17
+ - [ ] Update vulnerable dependencies
18
+ - [ ] Fix Svelte 5 warning : `WARNING: The following packages have a svelte field in their package.json but no exports condition for svelte.`
19
+ - [ ] Web accessibility: Treat as `role="progress"` aria
20
+
21
+ ## Previous task list
22
+
23
+ A customizable step component written in Svelte!
24
+
25
+ - [x] Bootstrap color theme
26
+ - [x] Icons
27
+ - [x] Animate progress
28
+ - [x] Horizontal and vertical
29
+ - [x] Dumpbells and bar
30
+ - [x] Custom size
31
+ - [x] Custom color
32
+ - [x] Custom font
33
+ - [x] Circle, square and between
34
+ - [x] Left and right
35
+
36
+ ![demo](static/demo.png)
37
+
38
+ ## Installation
39
+
40
+ ```sh
41
+ npm install --saveDev svelte-steps
42
+ ```
43
+
44
+ ## Example Usages
45
+
46
+ Clone this project and run it. Itself is an example. Take a look at the homepage [here](https://svelte-steps.web.app).
47
+ The source file of the demo is at [src/routes/index.svelte](src/routes/index.svelte)
48
+
49
+ ### Basic Usage
50
+
51
+ ```javascript
52
+ <script>
53
+ import { Steps } from 'svelte-steps';
54
+ let steps = [
55
+ { text: 'step one' },
56
+ { text: 'step two' },
57
+ { text: 'the last step' }
58
+ ];
59
+ </script>
60
+
61
+ <Steps {steps} />
62
+ ```
63
+
64
+ ### Vertical Steps
65
+
66
+ > NOTE: needs svelte version 3.46.3 or newer
67
+
68
+ Add `vertical` props to `Steps` component.
69
+
70
+ ```javascript
71
+ <Steps vertical {steps} />
72
+ ```
73
+
74
+ You can also use `reverse` to put text label to the left.
75
+
76
+ ```javascript
77
+ <Steps vertical reverse {steps}>
78
+ ```
79
+
80
+ ### With Icons
81
+
82
+ ```javascript
83
+ let steps = [
84
+ { text: 'step one', icon: IconMoney },
85
+ { text: 'step two', icon: IconPaperClip },
86
+ { text: 'the last step', icon: IconPerson }
87
+ ];
88
+ ```
89
+
90
+ ### Square Steps
91
+
92
+ ```javascript
93
+ <Steps {steps} borderRadius="0"/>
94
+ ```
95
+
96
+ ### Custom Color
97
+
98
+ ```javascript
99
+ <Steps {steps} primary="#ff0000" secondary="#ffaaaa"/>
100
+ ```
101
+
102
+ ### Custom Size
103
+
104
+ ```javascript
105
+ <Steps {steps} size="2rem" line="2px"/>
106
+ ```
107
+
108
+ ### No Text
109
+
110
+ ```javascript
111
+ let steps = [{ icon: IconMoney }, { icon: IconPaperClip }, { icon: IconPerson }];
112
+ ```
113
+
114
+ ### Bar
115
+
116
+ ```javascript
117
+ <Steps {steps} size="2rem" line="2rem"/>
118
+ ```
119
+
120
+ ### Use alert and customize icons (**NEW**)
121
+
122
+ ````javascript
123
+ import Escalation from './YourEscalation.svelt'
124
+ <script>
125
+ let steps = [
126
+ { text: 'step one' , alert: true},
127
+ { text: 'step two' },
128
+ { text: 'the last step' }
129
+ ];
130
+ </script>
131
+ <Steps {steps} alertColor={'#ff00ff'} alertIcon={Escalation} checkIcon={null}>
132
+ ```
133
+
134
+ ### Events
135
+
136
+ ```javascript
137
+ <Steps
138
+ {steps}
139
+ {current}
140
+ on:click={(e) => {
141
+ last = e.detail.last;
142
+ current = e.detail.current;
143
+ }}
144
+ />
145
+ ````
146
+
147
+ ## Use with Bootstrap
148
+
149
+ It by default uses `--bs-primary`, `--bs-secondary`, `--bs-danger`, `--bs-light`, and `--bs-dark` css variables if they are defined. These css vars are defined in bootstrap css:
150
+
151
+ ```html
152
+ <!-- Include Bootstrap css in app.html <head></head> -->
153
+ <link
154
+ href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
155
+ rel="stylesheet"
156
+ integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
157
+ crossorigin="anonymous"
158
+ />
159
+ ```
160
+
161
+ ## Props
162
+
163
+ - `steps`:
164
+ - Array of object. Length has to be more than 1
165
+ - Required
166
+ - Each item is a step object that can have:
167
+ - `text`: The text displayed below each steps.
168
+ - `icon`: A svelte component displayed inside each steps.
169
+ - `iconProps`: An object that will be passed as props to the `icon` component.
170
+ - `current`: current step index. Number. Default `0`
171
+ - `size`: size of the step buttons. String. Default `"3rem"` (`"2rem"` for vertical steps)
172
+ - `line`: thickness of the connecting lines between the step buttons. String. Default `"0.3rem"` (`"0.15rem"` for vertical steps)
173
+ - `primary`: Primary color of passed and current steps. String. Default `'var(--bs-primary, #3a86ff)'`
174
+ - `secondary`: Secondary color of future steps. String. Default `'var(--bs-secondary, #bbbbc0)'`
175
+ - `light`: Primary color of text color in passed anc current steps. String. Default `'var(--bs-light, white)'`
176
+ - `dark`: Secondary color of text color in future steps. String. Default `'var(--bs-dark, black)'`
177
+ - `borderRadius`: Border radius of the step buttons. String. Default `'50%'` (circle)
178
+ - `fontFamily`: Font family of the component. String. Default `"'Helvetica Neue', Helvetica, Arial, sans-serif"`
179
+ - `vertical`: Vertical steps. Default `false`
180
+ - `reverse`: For horizontal steps, reverse the step from right to the left; for vertical steps, reverse puts text labels to the left. Default `false`
181
+ - `clickable`: When set to `false`, Clicking icons and labels will not change step. You have to change `current` to change step. Default `true`
182
+ - `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.
183
+ - `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.
184
+ - `alertColor`: User defined bg color for passed steps that has truthful `alert` property. Default 'var(--bs-danger, #dc3545)'
185
+
186
+ ## Events
187
+
188
+ - `on:click(e)`: click event. Event detail object has two keys:
189
+ - `e.detail.current`: the index of current step
190
+ - `e.detail.last`: the index of last step
@@ -0,0 +1,347 @@
1
+ <!--
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
+ Copyright (c) 2021, Jingshao Chen. All rights reserved.
41
+ Use of this source code is governed by a BSD-style license that can be found
42
+ in the LICENSE file.
43
+
44
+ https://github.com/shaozi/svelte-steps
45
+
46
+ -->
47
+ <script>
48
+ // A bootstrap step component
49
+ import { tweened } from 'svelte/motion';
50
+ import { cubicOut } from 'svelte/easing';
51
+
52
+ import { createEventDispatcher } from 'svelte';
53
+ import Check from './Check.svelte';
54
+ import Alert from './Alert.svelte';
55
+ export let steps;
56
+ export let current = 0;
57
+ export let vertical = false;
58
+ export let size = vertical ? '2rem' : '3rem';
59
+ export let line = vertical ? '0.15rem' : '0.3rem';
60
+ export let lineHeight = undefined;
61
+ export let primary = 'var(--bs-primary, #3a86ff)';
62
+ export let secondary = 'var(--bs-secondary, #bbbbc0)';
63
+ export let light = 'var(--bs-light, white)';
64
+ export let dark = 'var(--bs-dark, black)';
65
+ export let borderRadius = '50%';
66
+ export let fontFamily = '';
67
+ export let reverse = false;
68
+ export let clickable = true;
69
+
70
+ export let checkIcon = Check;
71
+ export let alertIcon = Alert;
72
+ export let alertColor = 'var(--bs-danger, #dc3545)';
73
+ export let htmlMode = false;
74
+
75
+ const minStepSize = '5rem';
76
+ const stepLabelSpace = '1rem';
77
+
78
+ // for backward compatible when using lineHeight instead of line
79
+ if (lineHeight) {
80
+ line = lineHeight;
81
+ }
82
+
83
+ // each segment is half of the step size
84
+
85
+ // @type { height: number; width: number }[]
86
+ let segmentSizes = [];
87
+ for (let i = 0; i < steps.length; i++) {
88
+ segmentSizes.push({ height: 0, width: 0 });
89
+ }
90
+
91
+ if (current > steps.length - 1) {
92
+ current = steps.length - 1;
93
+ }
94
+ if (current < 0) {
95
+ current = 0;
96
+ }
97
+
98
+ let progress = tweened(current, { duration: 400, easing: cubicOut });
99
+ let total = 0;
100
+ let key = vertical ? 'height' : 'width';
101
+
102
+ function f(p /*@type number*/) {
103
+ // 0 - 1: $p * (0 + 1)/2
104
+ // 1 - 2: 1 * (0 + 1)/2 + ($p-1) * (1 + 2)/2
105
+ // 2 - 3: (0 + 1)/2 + (1 + 2)/2 + ($p-2) * (2+3)/2
106
+ let ret = 0;
107
+ let i = 0;
108
+ while (p > 1) {
109
+ p--;
110
+ ret += (segmentSizes[i][key] + segmentSizes[i + 1][key]) / 2;
111
+ i++;
112
+ }
113
+ if (i < segmentSizes.length - 1) {
114
+ ret += (p * (segmentSizes[i][key] + segmentSizes[i + 1][key])) / 2;
115
+ }
116
+ return ret;
117
+ }
118
+
119
+ let fill = f(current);
120
+
121
+ $: {
122
+ total = 0;
123
+ if (segmentSizes[0][key] > 0) {
124
+ for (let i = 0; i < steps.length; i++) {
125
+ total += segmentSizes[i][key];
126
+ }
127
+ total -= (segmentSizes[0][key] + segmentSizes[segmentSizes.length - 1][key]) / 2;
128
+ }
129
+ fill = f($progress);
130
+ }
131
+ $: {
132
+ $progress = current;
133
+ }
134
+ const dispatch = createEventDispatcher();
135
+ let onClick = (i /*: number*/) => {
136
+ if (clickable) {
137
+ let last = current;
138
+ current = i;
139
+ // $progress = i
140
+ dispatch('click', { current, last });
141
+ }
142
+ };
143
+ </script>
144
+
145
+ <div
146
+ class="steps-container"
147
+ style={`--size: ${size};
148
+ --line-thickness: ${line};
149
+ --primary: ${primary};
150
+ --secondary: ${secondary};
151
+ --light: ${light};
152
+ --dark: ${dark};
153
+ --danger: ${alertColor};
154
+ --border-radius: ${borderRadius};
155
+ --font-family: ${fontFamily || "'Helvetica Neue', Helvetica, Arial, sans-serif"};
156
+ display: flex;
157
+ `}
158
+ style:flex-direction={vertical ? (reverse ? 'row-reverse' : 'row') : 'column'}
159
+ >
160
+ <!-- progress line container -->
161
+ <div
162
+ style="display: flex; align-items: center;"
163
+ style:flex-direction={vertical ? 'column' : 'row'}
164
+ style:width={vertical ? size : '100%'}
165
+ style:min-width={vertical ? size : null}
166
+ style:height={vertical ? '100%' : size}
167
+ style:min-height={vertical ? null : size}
168
+ >
169
+ <div
170
+ style:width={vertical ? line : `${segmentSizes[0].width / 2}px`}
171
+ style:height={vertical ? `${segmentSizes[0].height / 2}px` : line}
172
+ />
173
+ <div
174
+ style:width={vertical ? line : `${total}px`}
175
+ style:height={vertical ? `${total}px` : line}
176
+ class="bg-secondary"
177
+ style="display: flex; align-items:center;"
178
+ style:flex-direction={vertical ? 'column' : reverse ? 'row-reverse' : 'row'}
179
+ >
180
+ <div
181
+ class="bg-primary"
182
+ style:width={vertical ? line : `${fill}px`}
183
+ style:height={vertical ? `${fill}px` : line}
184
+ />
185
+ {#if line != size}
186
+ <!-- the progress indicator -->
187
+ <div class="bg-primary" style="width:8px; height:8px; border-radius: 50%;" />
188
+ {/if}
189
+ </div>
190
+ <div
191
+ style:width={vertical ? line : `${segmentSizes[0].width / 2}px`}
192
+ style:height={vertical ? `${segmentSizes[0].height / 2}px` : line}
193
+ />
194
+ </div>
195
+ <!-- progress line end -->
196
+ <div
197
+ style="display: flex; justify-content: space-between;"
198
+ style:flex-direction={vertical ? 'column' : reverse ? 'row-reverse' : 'row'}
199
+ style:margin-left={vertical ? (reverse ? null : '-' + size) : null}
200
+ style:margin-right={vertical ? (reverse ? '-' + size : null) : null}
201
+ style:margin-top={vertical ? null : '-' + size}
202
+ >
203
+ {#each steps as step, i}
204
+ <!-- step container -->
205
+ <div
206
+ style="display: flex; align-items:center; flex-grow: 10; width: 100%"
207
+ style:flex-direction={vertical ? (reverse ? 'row-reverse' : 'row') : 'column'}
208
+ bind:clientWidth={segmentSizes[i].width}
209
+ bind:clientHeight={segmentSizes[i].height}
210
+ >
211
+ <!-- circle and text label -->
212
+ <div
213
+ style="display: flex; align-items: center; "
214
+ style:flex-direction={vertical ? (reverse ? 'row-reverse' : 'row') : 'column'}
215
+ style:min-width={vertical ? 'var(--size)' : minStepSize}
216
+ style:min-height={vertical ? minStepSize : 'var(--size)'}
217
+ >
218
+ <!-- circle -->
219
+ <button
220
+ class="step
221
+ {i <= $progress ? (step.alert ? 'bg-danger' : 'bg-primary') : 'bg-secondary'}
222
+ text-light
223
+ "
224
+ class:hover-highlight={clickable}
225
+ class:shadow={i == current}
226
+ on:click={() => {
227
+ onClick(i);
228
+ }}
229
+ >
230
+ {#if step.icon}
231
+ {#if i < $progress}
232
+ {#if step.alert}
233
+ {#if alertIcon}
234
+ <svelte:component this={alertIcon} />
235
+ {:else if step.iconProps}
236
+ <svelte:component this={step.icon} {...step.iconProps} />
237
+ {:else}
238
+ <svelte:component this={step.icon} />
239
+ {/if}
240
+ {:else if checkIcon}
241
+ <svelte:component this={checkIcon} />
242
+ {:else if step.iconProps}
243
+ <svelte:component this={step.icon} {...step.iconProps} />
244
+ {:else}
245
+ <svelte:component this={step.icon} />
246
+ {/if}
247
+ {:else if step.iconProps}
248
+ <svelte:component this={step.icon} {...step.iconProps} />
249
+ {:else}
250
+ <svelte:component this={step.icon} />
251
+ {/if}
252
+ {:else if i < $progress}
253
+ {#if step.alert}
254
+ {#if alertIcon}
255
+ <svelte:component this={alertIcon} />
256
+ {:else}
257
+ <span class="steps__number">{i + 1}</span>
258
+ {/if}
259
+ {:else if checkIcon}
260
+ <svelte:component this={checkIcon} />
261
+ {:else}
262
+ <span class="steps__number">{i + 1}</span>
263
+ {/if}
264
+ {:else}
265
+ <span class="steps__number">{i + 1}</span>
266
+ {/if}
267
+ </button>
268
+ <!-- text label -->
269
+ {#if typeof step.text != 'undefined'}
270
+ <button
271
+ class="steps__label"
272
+ class:hover-highlight={clickable}
273
+ style:margin-left={vertical ? (reverse ? null : stepLabelSpace) : null}
274
+ style:margin-right={vertical ? (reverse ? stepLabelSpace : null) : null}
275
+ style:margin-top={vertical ? null : stepLabelSpace}
276
+ style:text-align={vertical ? (reverse ? 'right' : 'left') : 'center'}
277
+ on:click={() => {
278
+ onClick(i);
279
+ }}
280
+ >
281
+ <div class:text-primary={i <= $progress}>
282
+ {#if htmlMode}
283
+ {@html step.text}
284
+ {:else}
285
+ {step.text}
286
+ {/if}
287
+ </div>
288
+ </button>
289
+ {:else}
290
+ {''}
291
+ {/if}
292
+ </div>
293
+ </div>
294
+ {/each}
295
+ </div>
296
+ </div>
297
+
298
+ <style>
299
+ .steps-container {
300
+ font-family: var(--font-family);
301
+ box-sizing: border-box;
302
+ }
303
+
304
+ .step {
305
+ border-width: 0;
306
+ border-radius: var(--border-radius);
307
+ box-sizing: border-box;
308
+ display: flex;
309
+ align-items: center;
310
+ justify-content: center;
311
+ width: var(--size);
312
+ min-width: var(--size);
313
+ height: var(--size);
314
+ min-height: var(--size);
315
+ font-size: calc(var(--size) * 0.5);
316
+ }
317
+ .hover-highlight:hover {
318
+ cursor: pointer;
319
+ filter: brightness(85%);
320
+ box-sizing: border-box;
321
+ }
322
+ .steps__label {
323
+ border-width: 0;
324
+ background-color: transparent;
325
+ font-size: larger;
326
+ box-sizing: border-box;
327
+ }
328
+
329
+ .text-primary {
330
+ color: var(--primary) !important;
331
+ }
332
+ .text-light {
333
+ color: var(--light) !important;
334
+ }
335
+ .bg-secondary {
336
+ background-color: var(--secondary) !important;
337
+ }
338
+ .bg-primary {
339
+ background-color: var(--primary) !important;
340
+ }
341
+ .bg-danger {
342
+ background-color: var(--danger) !important;
343
+ }
344
+ .shadow {
345
+ box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
346
+ }
347
+ </style>
@@ -0,0 +1,25 @@
1
+ <!--
2
+ Copyright (c) 2021, Jingshao Chen. All rights reserved.
3
+ Use of this source code is governed by a BSD-style license that can be found
4
+ in the LICENSE file.
5
+
6
+ https://github.com/shaozi/svelte-steps
7
+ -->
8
+ <script>
9
+ export let stroke = 'currentColor';
10
+ </script>
11
+
12
+ <svg
13
+ xmlns="http://www.w3.org/2000/svg"
14
+ width="1em"
15
+ height="1em"
16
+ viewBox="0 0 24 24"
17
+ fill="none"
18
+ {stroke}
19
+ stroke-width="2"
20
+ stroke-linecap="round"
21
+ stroke-linejoin="round"
22
+ class="feather feather-check"
23
+ >
24
+ <polyline points="20 6 9 17 4 12" />
25
+ </svg>
@@ -0,0 +1 @@
1
+ export { default as Steps } from './Steps.svelte';
@@ -0,0 +1,15 @@
1
+ /*
2
+ * Copyright (c) 2025, Iroco. All rights reserved.
3
+ * Use of this source code is governed by a BSD-style license that can be found
4
+ * in the LICENSE file.
5
+ *
6
+ * 2025-08-07 : migrate to Typescript
7
+ * ---
8
+ *
9
+ * Copyright (c) 2021, Jingshao Chen. All rights reserved.
10
+ * Use of this source code is governed by a BSD-style license that can be found
11
+ * in the LICENSE file.
12
+ *
13
+ * https://github.com/shaozi/svelte-steps
14
+ */
15
+ export { default as Steps } from './Steps.svelte';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iroco/ui",
3
- "version": "1.8.1",
3
+ "version": "1.10.0",
4
4
  "description": "Iroco design system based on Svelte",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {