@flightlesslabs/dodo-ui 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/dist/stories/components/Form/Button/Button.svelte +18 -18
- package/dist/stories/components/Form/Button/utils/scss/mixins.scss +3 -3
- package/dist/stories/components/Form/DatePicker/DatePicker.svelte +1 -11
- package/dist/stories/components/Form/NumericInput/Roundness/Roundness.stories.svelte +20 -0
- package/dist/stories/components/Form/NumericInput/Roundness/Roundness.stories.svelte.d.ts +26 -0
- package/dist/stories/components/Form/NumericInput/Size/Size.stories.svelte +16 -0
- package/dist/stories/components/Form/NumericInput/Size/Size.stories.svelte.d.ts +26 -0
- package/dist/stories/components/Form/NumericInput/WithIcon/WithIcon.stories.svelte +31 -0
- package/dist/stories/components/Form/NumericInput/WithIcon/WithIcon.stories.svelte.d.ts +26 -0
- package/dist/stories/components/Form/RangeSlider/Color/Color.stories.svelte +19 -0
- package/dist/stories/components/Form/RangeSlider/Color/Color.stories.svelte.d.ts +26 -0
- package/dist/stories/components/Form/RangeSlider/Events/Events.stories.svelte +59 -0
- package/dist/stories/components/Form/RangeSlider/Events/Events.stories.svelte.d.ts +18 -0
- package/dist/stories/components/Form/RangeSlider/RangeSlider.stories.svelte +64 -0
- package/dist/stories/components/Form/RangeSlider/RangeSlider.stories.svelte.d.ts +21 -0
- package/dist/stories/components/Form/RangeSlider/RangeSlider.svelte +525 -0
- package/dist/stories/components/Form/RangeSlider/RangeSlider.svelte.d.ts +48 -0
- package/dist/stories/components/Form/RangeSlider/Roundness/Roundness.stories.svelte +30 -0
- package/dist/stories/components/Form/RangeSlider/Roundness/Roundness.stories.svelte.d.ts +26 -0
- package/dist/stories/components/Form/RangeSlider/Size/Size.stories.svelte +16 -0
- package/dist/stories/components/Form/RangeSlider/Size/Size.stories.svelte.d.ts +26 -0
- package/dist/stories/components/Form/RangeSlider/WithIcon/WithIcon.stories.svelte +30 -0
- package/dist/stories/components/Form/RangeSlider/WithIcon/WithIcon.stories.svelte.d.ts +18 -0
- package/dist/stories/components/Form/RangeSlider/utils/scss/mixins.scss +91 -0
- package/dist/stories/developer tools/components/Popper/Popper.stories.svelte +16 -0
- package/dist/stories/developer tools/components/Popper/Popper.svelte +10 -14
- package/dist/stories/developer tools/components/Popper/Popper.svelte.d.ts +2 -0
- package/dist/stories/developer tools/components/Popper/PopperPopup/PopperPopup.svelte +25 -11
- package/dist/stories/developer tools/components/Popper/PopperPopup/PopperPopup.svelte.d.ts +2 -0
- package/dist/stories/developer tools/components/Popper/PopperPopup/utils/getPopupPosition.d.ts +10 -8
- package/dist/stories/developer tools/components/Popper/PopperPopup/utils/getPopupPosition.js +40 -23
- package/dist/stories/developer tools/directives/drag/drag.d.ts +3 -0
- package/dist/stories/developer tools/directives/drag/drag.js +40 -0
- package/dist/styles/_components.css +5 -0
- package/package.json +10 -10
- package/src/lib/index.ts +4 -0
- package/src/lib/stories/components/Form/Button/utils/scss/mixins.scss +3 -3
- package/src/lib/stories/components/Form/DatePicker/DatePicker.svelte +1 -13
- package/src/lib/stories/components/Form/RangeSlider/RangeSlider.svelte +476 -0
- package/src/lib/stories/components/Form/RangeSlider/utils/scss/mixins.scss +91 -0
- package/src/lib/stories/developer tools/components/Popper/Popper.svelte +13 -14
- package/src/lib/stories/developer tools/components/Popper/PopperPopup/PopperPopup.svelte +36 -10
- package/src/lib/stories/developer tools/components/Popper/PopperPopup/utils/getPopupPosition.ts +45 -31
- package/src/lib/stories/developer tools/directives/drag/drag.ts +47 -0
- package/src/lib/styles/_components.css +5 -0
package/dist/index.d.ts
CHANGED
|
@@ -58,6 +58,9 @@ export type { NumericInputProps } from './stories/components/Form/NumericInput/N
|
|
|
58
58
|
/** Form: DatePicker */
|
|
59
59
|
export { default as DatePicker } from './stories/components/Form/DatePicker/DatePicker.svelte';
|
|
60
60
|
export type { DatePickerProps, DatePickerCalendarIconPosition, } from './stories/components/Form/DatePicker/DatePicker.svelte';
|
|
61
|
+
/** Form: RangeSlider */
|
|
62
|
+
export { default as RangeSlider } from './stories/components/Form/RangeSlider/RangeSlider.svelte';
|
|
63
|
+
export type { RangeSliderProps } from './stories/components/Form/RangeSlider/RangeSlider.svelte';
|
|
61
64
|
/** Layout: Paper */
|
|
62
65
|
export { default as Paper } from './stories/components/Layout/Paper/Paper.svelte';
|
|
63
66
|
export type { PaperColor, PaperProps } from './stories/components/Layout/Paper/Paper.svelte';
|
package/dist/index.js
CHANGED
|
@@ -36,6 +36,8 @@ export { default as Select } from './stories/components/Form/Select/Select.svelt
|
|
|
36
36
|
export { default as NumericInput } from './stories/components/Form/NumericInput/NumericInput.svelte';
|
|
37
37
|
/** Form: DatePicker */
|
|
38
38
|
export { default as DatePicker } from './stories/components/Form/DatePicker/DatePicker.svelte';
|
|
39
|
+
/** Form: RangeSlider */
|
|
40
|
+
export { default as RangeSlider } from './stories/components/Form/RangeSlider/RangeSlider.svelte';
|
|
39
41
|
/** Layout: Paper */
|
|
40
42
|
export { default as Paper } from './stories/components/Layout/Paper/Paper.svelte';
|
|
41
43
|
/** Layout: Separator */
|
|
@@ -147,9 +147,9 @@ let { children, type = 'button', size = 'normal', color = 'primary', roundness =
|
|
|
147
147
|
var(--dodo-color-neutral-200) 90%,
|
|
148
148
|
#fff
|
|
149
149
|
);
|
|
150
|
-
--dodo-ui-Button-solid-neutral-bg: var(--dodo-color-neutral-
|
|
151
|
-
--dodo-ui-Button-solid-neutral-hover-bg: var(--dodo-color-neutral-
|
|
152
|
-
--dodo-ui-Button-solid-neutral-active-bg: var(--dodo-color-neutral-
|
|
150
|
+
--dodo-ui-Button-solid-neutral-bg: var(--dodo-color-neutral-400);
|
|
151
|
+
--dodo-ui-Button-solid-neutral-hover-bg: var(--dodo-color-neutral-300);
|
|
152
|
+
--dodo-ui-Button-solid-neutral-active-bg: var(--dodo-color-neutral-200);
|
|
153
153
|
--dodo-ui-Button-outline-primary: color-mix(
|
|
154
154
|
in oklab,
|
|
155
155
|
var(--dodo-color-primary-300) 90%,
|
|
@@ -170,9 +170,9 @@ let { children, type = 'button', size = 'normal', color = 'primary', roundness =
|
|
|
170
170
|
var(--dodo-color-primary-200) 90%,
|
|
171
171
|
#fff
|
|
172
172
|
);
|
|
173
|
-
--dodo-ui-Button-solid-primary-bg: var(--dodo-color-primary-
|
|
174
|
-
--dodo-ui-Button-solid-primary-hover-bg: var(--dodo-color-primary-
|
|
175
|
-
--dodo-ui-Button-solid-primary-active-bg: var(--dodo-color-primary-
|
|
173
|
+
--dodo-ui-Button-solid-primary-bg: var(--dodo-color-primary-400);
|
|
174
|
+
--dodo-ui-Button-solid-primary-hover-bg: var(--dodo-color-primary-300);
|
|
175
|
+
--dodo-ui-Button-solid-primary-active-bg: var(--dodo-color-primary-200);
|
|
176
176
|
--dodo-ui-Button-outline-secondary: color-mix(
|
|
177
177
|
in oklab,
|
|
178
178
|
var(--dodo-color-secondary-300) 90%,
|
|
@@ -193,9 +193,9 @@ let { children, type = 'button', size = 'normal', color = 'primary', roundness =
|
|
|
193
193
|
var(--dodo-color-secondary-200) 90%,
|
|
194
194
|
#fff
|
|
195
195
|
);
|
|
196
|
-
--dodo-ui-Button-solid-secondary-bg: var(--dodo-color-secondary-
|
|
197
|
-
--dodo-ui-Button-solid-secondary-hover-bg: var(--dodo-color-secondary-
|
|
198
|
-
--dodo-ui-Button-solid-secondary-active-bg: var(--dodo-color-secondary-
|
|
196
|
+
--dodo-ui-Button-solid-secondary-bg: var(--dodo-color-secondary-400);
|
|
197
|
+
--dodo-ui-Button-solid-secondary-hover-bg: var(--dodo-color-secondary-300);
|
|
198
|
+
--dodo-ui-Button-solid-secondary-active-bg: var(--dodo-color-secondary-200);
|
|
199
199
|
--dodo-ui-Button-outline-safe: color-mix(
|
|
200
200
|
in oklab,
|
|
201
201
|
var(--dodo-color-safe-300) 90%,
|
|
@@ -216,9 +216,9 @@ let { children, type = 'button', size = 'normal', color = 'primary', roundness =
|
|
|
216
216
|
var(--dodo-color-safe-200) 90%,
|
|
217
217
|
#fff
|
|
218
218
|
);
|
|
219
|
-
--dodo-ui-Button-solid-safe-bg: var(--dodo-color-safe-
|
|
220
|
-
--dodo-ui-Button-solid-safe-hover-bg: var(--dodo-color-safe-
|
|
221
|
-
--dodo-ui-Button-solid-safe-active-bg: var(--dodo-color-safe-
|
|
219
|
+
--dodo-ui-Button-solid-safe-bg: var(--dodo-color-safe-400);
|
|
220
|
+
--dodo-ui-Button-solid-safe-hover-bg: var(--dodo-color-safe-300);
|
|
221
|
+
--dodo-ui-Button-solid-safe-active-bg: var(--dodo-color-safe-200);
|
|
222
222
|
--dodo-ui-Button-outline-warning: color-mix(
|
|
223
223
|
in oklab,
|
|
224
224
|
var(--dodo-color-warning-300) 90%,
|
|
@@ -239,9 +239,9 @@ let { children, type = 'button', size = 'normal', color = 'primary', roundness =
|
|
|
239
239
|
var(--dodo-color-warning-200) 90%,
|
|
240
240
|
#fff
|
|
241
241
|
);
|
|
242
|
-
--dodo-ui-Button-solid-warning-bg: var(--dodo-color-warning-
|
|
243
|
-
--dodo-ui-Button-solid-warning-hover-bg: var(--dodo-color-warning-
|
|
244
|
-
--dodo-ui-Button-solid-warning-active-bg: var(--dodo-color-warning-
|
|
242
|
+
--dodo-ui-Button-solid-warning-bg: var(--dodo-color-warning-400);
|
|
243
|
+
--dodo-ui-Button-solid-warning-hover-bg: var(--dodo-color-warning-300);
|
|
244
|
+
--dodo-ui-Button-solid-warning-active-bg: var(--dodo-color-warning-200);
|
|
245
245
|
--dodo-ui-Button-outline-danger: color-mix(
|
|
246
246
|
in oklab,
|
|
247
247
|
var(--dodo-color-danger-300) 90%,
|
|
@@ -262,9 +262,9 @@ let { children, type = 'button', size = 'normal', color = 'primary', roundness =
|
|
|
262
262
|
var(--dodo-color-danger-200) 90%,
|
|
263
263
|
#fff
|
|
264
264
|
);
|
|
265
|
-
--dodo-ui-Button-solid-danger-bg: var(--dodo-color-danger-
|
|
266
|
-
--dodo-ui-Button-solid-danger-hover-bg: var(--dodo-color-danger-
|
|
267
|
-
--dodo-ui-Button-solid-danger-active-bg: var(--dodo-color-danger-
|
|
265
|
+
--dodo-ui-Button-solid-danger-bg: var(--dodo-color-danger-400);
|
|
266
|
+
--dodo-ui-Button-solid-danger-hover-bg: var(--dodo-color-danger-300);
|
|
267
|
+
--dodo-ui-Button-solid-danger-active-bg: var(--dodo-color-danger-200);
|
|
268
268
|
}
|
|
269
269
|
|
|
270
270
|
.dodo-ui-Button {
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
#fff
|
|
42
42
|
);
|
|
43
43
|
|
|
44
|
-
--dodo-ui-Button-solid-#{$color-name}-bg: var(--dodo-color-#{$color-name}-
|
|
45
|
-
--dodo-ui-Button-solid-#{$color-name}-hover-bg: var(--dodo-color-#{$color-name}-
|
|
46
|
-
--dodo-ui-Button-solid-#{$color-name}-active-bg: var(--dodo-color-#{$color-name}-
|
|
44
|
+
--dodo-ui-Button-solid-#{$color-name}-bg: var(--dodo-color-#{$color-name}-400);
|
|
45
|
+
--dodo-ui-Button-solid-#{$color-name}-hover-bg: var(--dodo-color-#{$color-name}-300);
|
|
46
|
+
--dodo-ui-Button-solid-#{$color-name}-active-bg: var(--dodo-color-#{$color-name}-200);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
/// Mixin: generate-dodo-ui-button-color
|
|
@@ -16,16 +16,6 @@ let customPopupContentTyped = customPopupContentInternal;
|
|
|
16
16
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
17
|
let customCalendarIconTyped = customCalendarIconInternal;
|
|
18
18
|
const calenderSize = calendarProps?.size || size;
|
|
19
|
-
let popupWidth = $state(`calc(var(--dodo-ui-element-height-normal) * 7 + var(--dodo-ui-space) * 2)`);
|
|
20
|
-
if (calenderSize === 'normal') {
|
|
21
|
-
popupWidth = `calc(var(--dodo-ui-element-height-normal) * 7 + var(--dodo-ui-space) * 2)`;
|
|
22
|
-
}
|
|
23
|
-
else if (calenderSize === 'small') {
|
|
24
|
-
popupWidth = `calc(var(--dodo-ui-element-height-small) * 7 + var(--dodo-ui-space) * 2)`;
|
|
25
|
-
}
|
|
26
|
-
else if (calenderSize === 'large') {
|
|
27
|
-
popupWidth = `calc(var(--dodo-ui-element-height-large) * 7 + var(--dodo-ui-space) * 2)`;
|
|
28
|
-
}
|
|
29
19
|
function closePopup() {
|
|
30
20
|
open = false;
|
|
31
21
|
ref?.blur();
|
|
@@ -110,7 +100,7 @@ function onclearMod(e) {
|
|
|
110
100
|
<Popper
|
|
111
101
|
{open}
|
|
112
102
|
fullWidth
|
|
113
|
-
{
|
|
103
|
+
popupFullWidth={false}
|
|
114
104
|
{onClickOutside}
|
|
115
105
|
{...popperProps}
|
|
116
106
|
{popupPositionX}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import NumericInput from '../NumericInput.svelte';
|
|
4
|
+
import { storyNumericInputArgTypes } from '../NumericInput.stories.svelte';
|
|
5
|
+
|
|
6
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
7
|
+
const { Story } = defineMeta({
|
|
8
|
+
component: NumericInput,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: storyNumericInputArgTypes,
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<Story name="Roundness 1" />
|
|
15
|
+
|
|
16
|
+
<Story name="Roundness 2" args={{ roundness: 2 }} />
|
|
17
|
+
|
|
18
|
+
<Story name="Roundness 3" args={{ roundness: 3 }} />
|
|
19
|
+
|
|
20
|
+
<Story name="Roundness 0" args={{ roundness: 0 }} />
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default Roundness;
|
|
2
|
+
type Roundness = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Roundness: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
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: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import NumericInput from '../NumericInput.svelte';
|
|
4
|
+
import { storyNumericInputArgTypes } from '../NumericInput.stories.svelte';
|
|
5
|
+
|
|
6
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
7
|
+
const { Story } = defineMeta({
|
|
8
|
+
component: NumericInput,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: storyNumericInputArgTypes,
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<Story name="Normal" />
|
|
15
|
+
<Story name="Small" args={{ size: 'small' }} />
|
|
16
|
+
<Story name="Large" args={{ size: 'large' }} />
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default Size;
|
|
2
|
+
type Size = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Size: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
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: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import NumericInput from '../NumericInput.svelte';
|
|
4
|
+
import { storyNumericInputArgTypes } from '../NumericInput.stories.svelte';
|
|
5
|
+
import Icon from '@iconify/svelte';
|
|
6
|
+
|
|
7
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
8
|
+
const { Story } = defineMeta({
|
|
9
|
+
component: NumericInput,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
argTypes: storyNumericInputArgTypes,
|
|
12
|
+
});
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<!-- NumericInput icon in front. -->
|
|
16
|
+
<Story name="Icon Before" asChild>
|
|
17
|
+
<NumericInput>
|
|
18
|
+
{#snippet before()}
|
|
19
|
+
<Icon icon="material-symbols:content-copy" />
|
|
20
|
+
{/snippet}
|
|
21
|
+
</NumericInput>
|
|
22
|
+
</Story>
|
|
23
|
+
|
|
24
|
+
<!-- NumericInput icon in front. -->
|
|
25
|
+
<Story name="Icon After" asChild>
|
|
26
|
+
<NumericInput>
|
|
27
|
+
{#snippet after()}
|
|
28
|
+
<Icon icon="material-symbols:download-2" />
|
|
29
|
+
{/snippet}
|
|
30
|
+
</NumericInput>
|
|
31
|
+
</Story>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default WithIcon;
|
|
2
|
+
type WithIcon = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const WithIcon: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
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: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import RangeSlider from '../RangeSlider.svelte';
|
|
4
|
+
import { storyRangeSliderArgTypes } from '../RangeSlider.stories.svelte';
|
|
5
|
+
|
|
6
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
7
|
+
const { Story } = defineMeta({
|
|
8
|
+
component: RangeSlider,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: storyRangeSliderArgTypes,
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<Story name="Primary" />
|
|
15
|
+
<Story name="Secondary" args={{ color: 'secondary' }} />
|
|
16
|
+
<Story name="Neutral" args={{ color: 'neutral' }} />
|
|
17
|
+
<Story name="Safe" args={{ color: 'safe' }} />
|
|
18
|
+
<Story name="Warning" args={{ color: 'warning' }} />
|
|
19
|
+
<Story name="Danger" args={{ color: 'danger' }} />
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default Color;
|
|
2
|
+
type Color = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Color: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
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: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<script module lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
2
|
+
import { storyRangeSliderArgTypes } from '../RangeSlider.stories.svelte';
|
|
3
|
+
import RangeSlider from '../RangeSlider.svelte';
|
|
4
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
5
|
+
const { Story } = defineMeta({
|
|
6
|
+
component: RangeSlider,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
argTypes: storyRangeSliderArgTypes,
|
|
9
|
+
});
|
|
10
|
+
let value = $state(0);
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<Story
|
|
14
|
+
name="Input"
|
|
15
|
+
args={{
|
|
16
|
+
value,
|
|
17
|
+
oninput: (e: Event) => {
|
|
18
|
+
const target = e.target as HTMLInputElement;
|
|
19
|
+
|
|
20
|
+
console.log('Input Event', target.value);
|
|
21
|
+
},
|
|
22
|
+
}}
|
|
23
|
+
/>
|
|
24
|
+
|
|
25
|
+
<Story
|
|
26
|
+
name="Change"
|
|
27
|
+
args={{
|
|
28
|
+
value,
|
|
29
|
+
onchange: (e: Event) => {
|
|
30
|
+
const target = e.target as HTMLInputElement;
|
|
31
|
+
|
|
32
|
+
console.log('onChange Event', target.value);
|
|
33
|
+
},
|
|
34
|
+
}}
|
|
35
|
+
/>
|
|
36
|
+
|
|
37
|
+
<Story
|
|
38
|
+
name="Focus"
|
|
39
|
+
args={{
|
|
40
|
+
value,
|
|
41
|
+
onfocus: (e: TextInputFocusEvent) => {
|
|
42
|
+
const target = e.target as HTMLInputElement;
|
|
43
|
+
|
|
44
|
+
console.log('onfocus Event', target);
|
|
45
|
+
},
|
|
46
|
+
}}
|
|
47
|
+
/>
|
|
48
|
+
|
|
49
|
+
<Story
|
|
50
|
+
name="Blur"
|
|
51
|
+
args={{
|
|
52
|
+
value,
|
|
53
|
+
onblur: (e: TextInputFocusEvent) => {
|
|
54
|
+
const target = e.target as HTMLInputElement;
|
|
55
|
+
|
|
56
|
+
console.log('onblur Event', target);
|
|
57
|
+
},
|
|
58
|
+
}}
|
|
59
|
+
/>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
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> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const Events: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type Events = InstanceType<typeof Events>;
|
|
18
|
+
export default Events;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<script module lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
2
|
+
import RangeSlider from './RangeSlider.svelte';
|
|
3
|
+
import { componentRoundnessArray } from '../../../../types/roundness.js';
|
|
4
|
+
import { componentSizeArray } from '../../../../types/size.js';
|
|
5
|
+
import { componentColorArray } from '../../../../types/colors.js';
|
|
6
|
+
export const storyRangeSliderArgTypes = {
|
|
7
|
+
color: {
|
|
8
|
+
control: { type: 'select' },
|
|
9
|
+
options: componentColorArray,
|
|
10
|
+
},
|
|
11
|
+
roundness: {
|
|
12
|
+
control: { type: 'select' },
|
|
13
|
+
options: componentRoundnessArray,
|
|
14
|
+
},
|
|
15
|
+
thumbRoundness: {
|
|
16
|
+
control: { type: 'select' },
|
|
17
|
+
options: componentRoundnessArray,
|
|
18
|
+
},
|
|
19
|
+
size: {
|
|
20
|
+
control: { type: 'select' },
|
|
21
|
+
options: componentSizeArray,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
25
|
+
const { Story } = defineMeta({
|
|
26
|
+
component: RangeSlider,
|
|
27
|
+
tags: ['autodocs'],
|
|
28
|
+
argTypes: storyRangeSliderArgTypes,
|
|
29
|
+
});
|
|
30
|
+
let value = $state(30);
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<!-- RangeSlider with default style -->
|
|
34
|
+
<Story
|
|
35
|
+
name="Default"
|
|
36
|
+
args={{
|
|
37
|
+
value,
|
|
38
|
+
}}
|
|
39
|
+
/>
|
|
40
|
+
|
|
41
|
+
<Story
|
|
42
|
+
name="Step"
|
|
43
|
+
args={{
|
|
44
|
+
value,
|
|
45
|
+
step: 10,
|
|
46
|
+
}}
|
|
47
|
+
/>
|
|
48
|
+
|
|
49
|
+
<Story
|
|
50
|
+
name="MinMax"
|
|
51
|
+
args={{
|
|
52
|
+
value,
|
|
53
|
+
min: 0,
|
|
54
|
+
max: 1500,
|
|
55
|
+
}}
|
|
56
|
+
/>
|
|
57
|
+
|
|
58
|
+
<Story
|
|
59
|
+
name="Disabled"
|
|
60
|
+
args={{
|
|
61
|
+
value: 30,
|
|
62
|
+
disabled: true,
|
|
63
|
+
}}
|
|
64
|
+
/>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import RangeSlider from './RangeSlider.svelte';
|
|
2
|
+
import type { StoryBookArgTypes } from '../../../../storybook-types.js';
|
|
3
|
+
export declare const storyRangeSliderArgTypes: StoryBookArgTypes;
|
|
4
|
+
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> {
|
|
5
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
6
|
+
$$bindings?: Bindings;
|
|
7
|
+
} & Exports;
|
|
8
|
+
(internal: unknown, props: {
|
|
9
|
+
$$events?: Events;
|
|
10
|
+
$$slots?: Slots;
|
|
11
|
+
}): Exports & {
|
|
12
|
+
$set?: any;
|
|
13
|
+
$on?: any;
|
|
14
|
+
};
|
|
15
|
+
z_$$bindings?: Bindings;
|
|
16
|
+
}
|
|
17
|
+
declare const RangeSlider: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
}, {}, {}, string>;
|
|
20
|
+
type RangeSlider = InstanceType<typeof RangeSlider>;
|
|
21
|
+
export default RangeSlider;
|