@flightlesslabs/dodo-ui 0.14.0 → 0.15.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 (41) hide show
  1. package/dist/index.d.ts +6 -0
  2. package/dist/index.js +4 -0
  3. package/dist/stories/components/Form/Checkbox/Checkbox.stories.svelte +39 -0
  4. package/dist/stories/components/Form/Checkbox/Checkbox.stories.svelte.d.ts +21 -0
  5. package/dist/stories/components/Form/Checkbox/Checkbox.svelte +452 -0
  6. package/dist/stories/components/Form/Checkbox/Checkbox.svelte.d.ts +42 -0
  7. package/dist/stories/components/Form/Checkbox/Color/Color.stories.svelte +19 -0
  8. package/dist/stories/components/Form/Checkbox/Color/Color.stories.svelte.d.ts +26 -0
  9. package/dist/stories/components/Form/Checkbox/Customize/Customize.stories.svelte +27 -0
  10. package/dist/stories/components/Form/Checkbox/Customize/Customize.stories.svelte.d.ts +18 -0
  11. package/dist/stories/components/Form/Checkbox/Events/Events.stories.svelte +35 -0
  12. package/dist/stories/components/Form/Checkbox/Events/Events.stories.svelte.d.ts +18 -0
  13. package/dist/stories/components/Form/Checkbox/Roundness/Roundness.stories.svelte +22 -0
  14. package/dist/stories/components/Form/Checkbox/Roundness/Roundness.stories.svelte.d.ts +26 -0
  15. package/dist/stories/components/Form/Checkbox/Size/Size.stories.svelte +16 -0
  16. package/dist/stories/components/Form/Checkbox/Size/Size.stories.svelte.d.ts +26 -0
  17. package/dist/stories/components/Form/Checkbox/utils/scss/mixins.scss +80 -0
  18. package/dist/stories/components/Form/Radio/Color/Color.stories.svelte +19 -0
  19. package/dist/stories/components/Form/Radio/Color/Color.stories.svelte.d.ts +26 -0
  20. package/dist/stories/components/Form/Radio/Events/Events.stories.svelte +32 -0
  21. package/dist/stories/components/Form/Radio/Events/Events.stories.svelte.d.ts +18 -0
  22. package/dist/stories/components/Form/Radio/Radio.stories.svelte +39 -0
  23. package/dist/stories/components/Form/Radio/Radio.stories.svelte.d.ts +21 -0
  24. package/dist/stories/components/Form/Radio/Radio.svelte +413 -0
  25. package/dist/stories/components/Form/Radio/Radio.svelte.d.ts +36 -0
  26. package/dist/stories/components/Form/Radio/Roundness/Roundness.stories.svelte +22 -0
  27. package/dist/stories/components/Form/Radio/Roundness/Roundness.stories.svelte.d.ts +26 -0
  28. package/dist/stories/components/Form/Radio/Size/Size.stories.svelte +16 -0
  29. package/dist/stories/components/Form/Radio/Size/Size.stories.svelte.d.ts +26 -0
  30. package/dist/stories/components/Form/Radio/utils/scss/mixins.scss +85 -0
  31. package/dist/stories/components/Form/Toggle/Toggle.svelte +30 -40
  32. package/dist/stories/components/Form/Toggle/Toggle.svelte.d.ts +2 -0
  33. package/dist/stories/components/Form/Toggle/utils/scss/mixins.scss +1 -14
  34. package/package.json +2 -2
  35. package/src/lib/index.ts +8 -0
  36. package/src/lib/stories/components/Form/Checkbox/Checkbox.svelte +323 -0
  37. package/src/lib/stories/components/Form/Checkbox/utils/scss/mixins.scss +80 -0
  38. package/src/lib/stories/components/Form/Radio/Radio.svelte +278 -0
  39. package/src/lib/stories/components/Form/Radio/utils/scss/mixins.scss +85 -0
  40. package/src/lib/stories/components/Form/Toggle/Toggle.svelte +31 -3
  41. package/src/lib/stories/components/Form/Toggle/utils/scss/mixins.scss +1 -14
@@ -0,0 +1,35 @@
1
+ <script module lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
2
+ import Checkbox from '../Checkbox.svelte';
3
+ import { storyCheckboxArgTypes } from '../Checkbox.stories.svelte';
4
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
5
+ const { Story } = defineMeta({
6
+ component: Checkbox,
7
+ tags: ['autodocs'],
8
+ argTypes: storyCheckboxArgTypes,
9
+ });
10
+ let checked = $state(false);
11
+ </script>
12
+
13
+ <Story
14
+ name="Change"
15
+ args={{
16
+ onchange: (e: Event) => {
17
+ const target = e.target as HTMLInputElement;
18
+
19
+ alert('onchange Clicked');
20
+ console.log('Checkbox Clicked', target);
21
+ },
22
+ checked,
23
+ }}
24
+ asChild
25
+ >
26
+ <Checkbox
27
+ onchange={(e: Event) => {
28
+ const target = e.target as HTMLInputElement;
29
+
30
+ alert('onchange Clicked');
31
+ console.log('onchange Clicked', target);
32
+ }}
33
+ {checked}
34
+ />
35
+ </Story>
@@ -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,22 @@
1
+ <script module>
2
+ import { defineMeta } from '@storybook/addon-svelte-csf';
3
+ import Checkbox from '../Checkbox.svelte';
4
+ import { storyCheckboxArgTypes } from '../Checkbox.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: Checkbox,
9
+ tags: ['autodocs'],
10
+ argTypes: storyCheckboxArgTypes,
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 }} />
21
+
22
+ <Story name="Roundness full" args={{ roundness: 'full' }} />
@@ -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 Checkbox from '../Checkbox.svelte';
4
+ import { storyCheckboxArgTypes } from '../Checkbox.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: Checkbox,
9
+ tags: ['autodocs'],
10
+ argTypes: storyCheckboxArgTypes,
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,80 @@
1
+ /// Mixin: generate-dodo-ui-checkbox-colors
2
+ /// Generates CSS custom properties for Dodo UI checkbox styles (text & solid)
3
+ /// across different interaction states (default, hover, active).
4
+ /// @param {String} $color-name - The theme color name (e.g., "primary", "safe", etc.)
5
+ @mixin generate-dodo-ui-checkbox-colors($color-name) {
6
+ --dodo-ui-Checkbox-#{$color-name}-bg: var(--dodo-color-#{$color-name}-200);
7
+ --dodo-ui-Checkbox-#{$color-name}-hover-bg: var(--dodo-color-#{$color-name}-300);
8
+ --dodo-ui-Checkbox-#{$color-name}-active-bg: var(--dodo-color-#{$color-name}-400);
9
+
10
+ --dodo-ui-Checkbox-#{$color-name}-checked-bg: var(--dodo-color-#{$color-name}-500);
11
+ --dodo-ui-Checkbox-#{$color-name}-checked-hover-bg: var(--dodo-color-#{$color-name}-600);
12
+ --dodo-ui-Checkbox-#{$color-name}-checked-active-bg: var(--dodo-color-#{$color-name}-700);
13
+ }
14
+
15
+ /// Mixin: generate-dodo-ui-checkbox-colors
16
+ /// Generates CSS custom properties for Dodo UI checkbox styles (text & solid)
17
+ /// across different interaction states (default, hover, active).
18
+ /// @param {String} $color-name - The theme color name (e.g., "primary", "safe", etc.)
19
+ @mixin generate-dodo-ui-checkbox-colors-dark($color-name) {
20
+ --dodo-ui-Checkbox-#{$color-name}-bg: color-mix(
21
+ in oklab,
22
+ var(--dodo-color-#{$color-name}-50) 90%,
23
+ #fff
24
+ );
25
+ --dodo-ui-Checkbox-#{$color-name}-hover-bg: color-mix(
26
+ in oklab,
27
+ var(--dodo-color-#{$color-name}-100) 90%,
28
+ #fff
29
+ );
30
+ --dodo-ui-Checkbox-#{$color-name}-active-bg: color-mix(
31
+ in oklab,
32
+ var(--dodo-color-#{$color-name}-200) 90%,
33
+ #fff
34
+ );
35
+
36
+ --dodo-ui-Checkbox-#{$color-name}-checked-bg: var(--dodo-color-#{$color-name}-400);
37
+ --dodo-ui-Checkbox-#{$color-name}-checked-hover-bg: var(--dodo-color-#{$color-name}-300);
38
+ --dodo-ui-Checkbox-#{$color-name}-checked-active-bg: var(--dodo-color-#{$color-name}-200);
39
+ }
40
+
41
+ /// Mixin: generate-dodo-ui-checkbox-color
42
+ /// @param {String} $theme - e.g., default, safe, danger, etc.
43
+ @mixin generate-dodo-ui-checkbox-color($theme) {
44
+ &--#{$theme} {
45
+ .Checkbox {
46
+ background-color: var(--dodo-ui-Checkbox-#{$theme}-bg);
47
+ }
48
+
49
+ input:checked:not([disabled]) {
50
+ & + .Checkbox {
51
+ background-color: var(--dodo-ui-Checkbox-#{$theme}-checked-bg);
52
+ border-color: transparent;
53
+ }
54
+ }
55
+
56
+ &:hover {
57
+ .Checkbox {
58
+ background-color: var(--dodo-ui-Checkbox-#{$theme}-hover-bg);
59
+ }
60
+
61
+ input:checked:not([disabled]) {
62
+ & + .Checkbox {
63
+ background-color: var(--dodo-ui-Checkbox-#{$theme}-checked-hover-bg);
64
+ }
65
+ }
66
+ }
67
+
68
+ &:active {
69
+ .Checkbox {
70
+ background-color: var(--dodo-ui-Checkbox-#{$theme}-active-bg);
71
+ }
72
+
73
+ input:checked:not([disabled]) {
74
+ & + .Checkbox {
75
+ background-color: var(--dodo-ui-Checkbox-#{$theme}-checked-active-bg);
76
+ }
77
+ }
78
+ }
79
+ }
80
+ }
@@ -0,0 +1,19 @@
1
+ <script module>
2
+ import { defineMeta } from '@storybook/addon-svelte-csf';
3
+ import Radio from '../Radio.svelte';
4
+ import { storyRadioArgTypes } from '../Radio.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: Radio,
9
+ tags: ['autodocs'],
10
+ argTypes: storyRadioArgTypes,
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,32 @@
1
+ <script module lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
2
+ import Radio from '../Radio.svelte';
3
+ import { storyRadioArgTypes } from '../Radio.stories.svelte';
4
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
5
+ const { Story } = defineMeta({
6
+ component: Radio,
7
+ tags: ['autodocs'],
8
+ argTypes: storyRadioArgTypes,
9
+ });
10
+ </script>
11
+
12
+ <Story
13
+ name="Change"
14
+ args={{
15
+ onchange: (e: Event) => {
16
+ const target = e.target as HTMLInputElement;
17
+
18
+ alert('onchange Clicked');
19
+ console.log('Radio Clicked', target);
20
+ },
21
+ }}
22
+ asChild
23
+ >
24
+ <Radio
25
+ onchange={(e: Event) => {
26
+ const target = e.target as HTMLInputElement;
27
+
28
+ alert('onchange Clicked');
29
+ console.log('onchange Clicked', target);
30
+ }}
31
+ />
32
+ </Story>
@@ -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,39 @@
1
+ <script module lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
2
+ import Radio from './Radio.svelte';
3
+ import { componentRoundnessArray } from '../../../../types/roundness.js';
4
+ import { componentColorArray } from '../../../../types/colors.js';
5
+ import { componentSizeArray } from '../../../../types/size.js';
6
+ export const storyRadioArgTypes = {
7
+ color: {
8
+ control: { type: 'select' },
9
+ options: componentColorArray,
10
+ },
11
+ roundness: {
12
+ control: { type: 'select' },
13
+ options: componentRoundnessArray,
14
+ },
15
+ size: {
16
+ control: { type: 'select' },
17
+ options: componentSizeArray,
18
+ },
19
+ };
20
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
21
+ const { Story } = defineMeta({
22
+ component: Radio,
23
+ tags: ['autodocs'],
24
+ argTypes: storyRadioArgTypes,
25
+ args: {
26
+ value: 'Car1',
27
+ name: 'radios',
28
+ },
29
+ });
30
+ </script>
31
+
32
+ <!-- Radio with default style -->
33
+ <Story name="Primary" />
34
+
35
+ <Story name="WithText">This is Radio</Story>
36
+
37
+ <Story name="Selected" args={{ selectedValue: 'Car1' }} />
38
+
39
+ <Story name="Disabled" args={{ disabled: true }} />
@@ -0,0 +1,21 @@
1
+ import Radio from './Radio.svelte';
2
+ import type { StoryBookArgTypes } from '../../../../storybook-types.js';
3
+ export declare const storyRadioArgTypes: 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 Radio: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
18
+ [evt: string]: CustomEvent<any>;
19
+ }, {}, {}, string>;
20
+ type Radio = InstanceType<typeof Radio>;
21
+ export default Radio;