@flightlesslabs/dodo-ui 0.17.2 → 0.19.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 +8 -1
- package/dist/index.js +4 -0
- package/dist/stories/components/Form/DatePicker/DatePicker.svelte +1 -0
- package/dist/stories/components/Form/NumericInput/NumericInput.svelte +1 -0
- package/dist/stories/components/Form/PasswordInput/PasswordInput.svelte +1 -0
- package/dist/stories/components/Form/Search/Events/Events.stories.svelte +137 -0
- package/dist/stories/components/Form/Search/Events/Events.stories.svelte.d.ts +18 -0
- package/dist/stories/components/Form/Search/Roundness/Roundness.stories.svelte +21 -0
- package/dist/stories/components/Form/Search/Roundness/Roundness.stories.svelte.d.ts +26 -0
- package/dist/stories/components/Form/Search/Search.stories.svelte +40 -0
- package/dist/stories/components/Form/Search/Search.stories.svelte.d.ts +21 -0
- package/dist/stories/components/Form/Search/Search.svelte +142 -0
- package/dist/stories/components/Form/Search/Search.svelte.d.ts +66 -0
- package/dist/stories/components/Form/Search/SearchIcon/SearchIcon.stories.svelte +27 -0
- package/dist/stories/components/Form/Search/SearchIcon/SearchIcon.stories.svelte.d.ts +26 -0
- package/dist/stories/components/Form/Search/Size/Size.stories.svelte +17 -0
- package/dist/stories/components/Form/Search/Size/Size.stories.svelte.d.ts +26 -0
- package/dist/stories/components/Form/Search/WithIcon/WithIcon.stories.svelte +47 -0
- package/dist/stories/components/Form/Search/WithIcon/WithIcon.stories.svelte.d.ts +26 -0
- package/dist/stories/components/Form/Select/Select.svelte +1 -0
- package/dist/stories/components/Form/Select/Select.svelte.d.ts +4 -4
- package/dist/stories/components/Form/TextInput/TextInput.svelte +1 -0
- package/dist/stories/components/Layout/Accordian/Accordian.stories.svelte +52 -0
- package/dist/stories/components/Layout/Accordian/Accordian.stories.svelte.d.ts +21 -0
- package/dist/stories/components/Layout/Accordian/Accordian.svelte +121 -0
- package/dist/stories/components/Layout/Accordian/Accordian.svelte.d.ts +34 -0
- package/dist/stories/components/Layout/Accordian/Customize/Customize.stories.svelte +69 -0
- package/dist/stories/components/Layout/Accordian/Customize/Customize.stories.svelte.d.ts +18 -0
- package/dist/stories/components/Layout/Accordian/Events/Events.stories.svelte +30 -0
- package/dist/stories/components/Layout/Accordian/Events/Events.stories.svelte.d.ts +18 -0
- package/dist/stories/components/Layout/Accordian/Size/Size.stories.svelte +48 -0
- package/dist/stories/components/Layout/Accordian/Size/Size.stories.svelte.d.ts +26 -0
- package/dist/stories/developer tools/components/UtilityIcon/Size/Size.stories.svelte +25 -0
- package/dist/stories/developer tools/components/UtilityIcon/Size/Size.stories.svelte.d.ts +26 -0
- package/dist/stories/developer tools/components/UtilityIcon/UtilityIcon.stories.svelte +26 -0
- package/dist/stories/developer tools/components/UtilityIcon/UtilityIcon.stories.svelte.d.ts +21 -0
- package/dist/stories/developer tools/components/UtilityIcon/UtilityIcon.svelte +58 -0
- package/dist/stories/developer tools/components/UtilityIcon/UtilityIcon.svelte.d.ts +19 -0
- package/dist/types/special.d.ts +1 -0
- package/dist/types/special.js +1 -0
- package/package.json +11 -11
- package/src/lib/index.ts +14 -5
- package/src/lib/stories/components/Form/DatePicker/DatePicker.svelte +1 -0
- package/src/lib/stories/components/Form/NumericInput/NumericInput.svelte +1 -0
- package/src/lib/stories/components/Form/PasswordInput/PasswordInput.svelte +1 -0
- package/src/lib/stories/components/Form/Search/Search.svelte +285 -0
- package/src/lib/stories/components/Form/Select/Select.svelte +5 -5
- package/src/lib/stories/components/Form/TextInput/TextInput.svelte +1 -0
- package/src/lib/stories/components/Layout/Accordian/Accordian.svelte +195 -0
- package/src/lib/stories/developer tools/components/UtilityIcon/UtilityIcon.svelte +90 -0
- package/src/lib/types/special.ts +1 -0
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export type { ComponentRoundness } from './types/roundness.js';
|
|
|
3
3
|
export type { ComponentSize } from './types/size.js';
|
|
4
4
|
export type { ComponentWeight } from './types/weight.js';
|
|
5
5
|
export type { PositionY, PositionX } from './types/position.js';
|
|
6
|
+
export type { IconPosition } from './types/special.js';
|
|
6
7
|
/** developer tools: helpers: logger */
|
|
7
8
|
export { default as createLogger } from './stories/developer tools/helpers/logger/logger.js';
|
|
8
9
|
export type { LogLevel, LoggerOptions, } from './stories/developer tools/helpers/logger/logger.js';
|
|
@@ -50,7 +51,7 @@ export { default as Message } from './stories/components/Form/Message/Message.sv
|
|
|
50
51
|
export type { MessageProps } from './stories/components/Form/Message/Message.svelte';
|
|
51
52
|
/** Form: Select */
|
|
52
53
|
export { default as Select } from './stories/components/Form/Select/Select.svelte';
|
|
53
|
-
export type { SelectOption,
|
|
54
|
+
export type { SelectOption, SelectProps } from './stories/components/Form/Select/Select.svelte';
|
|
54
55
|
/** Form: NumericInput */
|
|
55
56
|
export { default as NumericInput } from './stories/components/Form/NumericInput/NumericInput.svelte';
|
|
56
57
|
export type { NumericInputProps } from './stories/components/Form/NumericInput/NumericInput.svelte';
|
|
@@ -69,6 +70,9 @@ export type { CheckboxProps } from './stories/components/Form/Checkbox/Checkbox.
|
|
|
69
70
|
/** Form: Radio */
|
|
70
71
|
export { default as Radio } from './stories/components/Form/Radio/Radio.svelte';
|
|
71
72
|
export type { RadioProps } from './stories/components/Form/Radio/Radio.svelte';
|
|
73
|
+
/** Form: Search */
|
|
74
|
+
export { default as Search } from './stories/components/Form/Search/Search.svelte';
|
|
75
|
+
export type { SearchProps } from './stories/components/Form/Search/Search.svelte';
|
|
72
76
|
/** Layout: Paper */
|
|
73
77
|
export { default as Paper } from './stories/components/Layout/Paper/Paper.svelte';
|
|
74
78
|
export type { PaperColor, PaperProps } from './stories/components/Layout/Paper/Paper.svelte';
|
|
@@ -89,6 +93,9 @@ export { default as Row } from './stories/components/Layout/Grid/Row/Row.svelte'
|
|
|
89
93
|
export type { GridRowProps } from './stories/components/Layout/Grid/Row/Row.svelte';
|
|
90
94
|
export { default as Column } from './stories/components/Layout/Grid/Column/Column.svelte';
|
|
91
95
|
export type { GridColumnSize, GridColumnProps, } from './stories/components/Layout/Grid/Column/Column.svelte';
|
|
96
|
+
/** Layout: Accordian */
|
|
97
|
+
export { default as Accordian } from './stories/components/Layout/Accordian/Accordian.svelte';
|
|
98
|
+
export type { AccordianProps, AccordianToggleEvent, } from './stories/components/Layout/Accordian/Accordian.svelte';
|
|
92
99
|
/** Info: Calendar */
|
|
93
100
|
export { default as Calendar } from './stories/components/Info/Calendar/Calendar.svelte';
|
|
94
101
|
export type { CalendarProps, CalendarActiveSection, } from './stories/components/Info/Calendar/Calendar.svelte';
|
package/dist/index.js
CHANGED
|
@@ -43,6 +43,8 @@ export { default as Toggle } from './stories/components/Form/Toggle/Toggle.svelt
|
|
|
43
43
|
export { default as Checkbox } from './stories/components/Form/Checkbox/Checkbox.svelte';
|
|
44
44
|
/** Form: Radio */
|
|
45
45
|
export { default as Radio } from './stories/components/Form/Radio/Radio.svelte';
|
|
46
|
+
/** Form: Search */
|
|
47
|
+
export { default as Search } from './stories/components/Form/Search/Search.svelte';
|
|
46
48
|
/** Layout: Paper */
|
|
47
49
|
export { default as Paper } from './stories/components/Layout/Paper/Paper.svelte';
|
|
48
50
|
/** Layout: Separator */
|
|
@@ -55,6 +57,8 @@ export { default as DynamicMenu } from './stories/components/Layout/Menu/Dynamic
|
|
|
55
57
|
export { default as Grid } from './stories/components/Layout/Grid/Grid.svelte';
|
|
56
58
|
export { default as Row } from './stories/components/Layout/Grid/Row/Row.svelte';
|
|
57
59
|
export { default as Column } from './stories/components/Layout/Grid/Column/Column.svelte';
|
|
60
|
+
/** Layout: Accordian */
|
|
61
|
+
export { default as Accordian } from './stories/components/Layout/Accordian/Accordian.svelte';
|
|
58
62
|
/** Info: Calendar */
|
|
59
63
|
export { default as Calendar } from './stories/components/Info/Calendar/Calendar.svelte';
|
|
60
64
|
export { default as CalendarDatesChart } from './stories/components/Info/Calendar/SubComponents/CalendarDatesChart/CalendarDatesChart.svelte';
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
<script module lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
2
|
+
import { storySearchArgTypes } from '../Search.stories.svelte';
|
|
3
|
+
import Search from '../Search.svelte';
|
|
4
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
5
|
+
const { Story } = defineMeta({
|
|
6
|
+
component: Search,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
argTypes: storySearchArgTypes,
|
|
9
|
+
});
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<Story
|
|
13
|
+
name="Search"
|
|
14
|
+
args={{
|
|
15
|
+
onsearch: () => {
|
|
16
|
+
console.log('Search Event');
|
|
17
|
+
},
|
|
18
|
+
}}
|
|
19
|
+
/>
|
|
20
|
+
|
|
21
|
+
<Story
|
|
22
|
+
name="Clear"
|
|
23
|
+
args={{
|
|
24
|
+
onclear: () => {
|
|
25
|
+
console.log('Clear Event');
|
|
26
|
+
},
|
|
27
|
+
}}
|
|
28
|
+
/>
|
|
29
|
+
|
|
30
|
+
<Story
|
|
31
|
+
name="Input"
|
|
32
|
+
args={{
|
|
33
|
+
oninput: (e: Event) => {
|
|
34
|
+
const target = e.target as HTMLInputElement;
|
|
35
|
+
|
|
36
|
+
console.log('Input Event', target.value);
|
|
37
|
+
},
|
|
38
|
+
}}
|
|
39
|
+
/>
|
|
40
|
+
|
|
41
|
+
<Story
|
|
42
|
+
name="Change"
|
|
43
|
+
args={{
|
|
44
|
+
onchange: (e: Event) => {
|
|
45
|
+
const target = e.target as HTMLInputElement;
|
|
46
|
+
|
|
47
|
+
console.log('onChange Event', target.value);
|
|
48
|
+
},
|
|
49
|
+
}}
|
|
50
|
+
/>
|
|
51
|
+
|
|
52
|
+
<!-- `e: TextInputFocusEvent` -->
|
|
53
|
+
<Story
|
|
54
|
+
name="Focus"
|
|
55
|
+
args={{
|
|
56
|
+
onfocus: (e: TextInputFocusEvent) => {
|
|
57
|
+
const target = e.target as HTMLInputElement;
|
|
58
|
+
|
|
59
|
+
console.log('onfocus Event', target);
|
|
60
|
+
},
|
|
61
|
+
}}
|
|
62
|
+
/>
|
|
63
|
+
|
|
64
|
+
<!-- `e: TextInputFocusEvent` -->
|
|
65
|
+
<Story
|
|
66
|
+
name="Blur"
|
|
67
|
+
args={{
|
|
68
|
+
onblur: (e: TextInputFocusEvent) => {
|
|
69
|
+
const target = e.target as HTMLInputElement;
|
|
70
|
+
|
|
71
|
+
console.log('onblur Event', target);
|
|
72
|
+
},
|
|
73
|
+
}}
|
|
74
|
+
/>
|
|
75
|
+
|
|
76
|
+
<!-- `e: TextInputClipboardEvent` -->
|
|
77
|
+
<Story
|
|
78
|
+
name="Copy"
|
|
79
|
+
args={{
|
|
80
|
+
oncopy: (e: TextInputClipboardEvent) => {
|
|
81
|
+
const target = e.target as HTMLInputElement;
|
|
82
|
+
|
|
83
|
+
console.log('oncopy Event', target);
|
|
84
|
+
},
|
|
85
|
+
}}
|
|
86
|
+
/>
|
|
87
|
+
|
|
88
|
+
<!-- `e: TextInputClipboardEvent` -->
|
|
89
|
+
<Story
|
|
90
|
+
name="Cut"
|
|
91
|
+
args={{
|
|
92
|
+
oncut: (e: TextInputClipboardEvent) => {
|
|
93
|
+
const target = e.target as HTMLInputElement;
|
|
94
|
+
|
|
95
|
+
console.log('oncut Event', target);
|
|
96
|
+
},
|
|
97
|
+
}}
|
|
98
|
+
/>
|
|
99
|
+
|
|
100
|
+
<!-- `e: TextInputClipboardEvent` -->
|
|
101
|
+
<Story
|
|
102
|
+
name="Paste"
|
|
103
|
+
args={{
|
|
104
|
+
onpaste: (e: TextInputClipboardEvent) => {
|
|
105
|
+
const target = e.target as HTMLInputElement;
|
|
106
|
+
|
|
107
|
+
console.log('onpaste Event', target);
|
|
108
|
+
},
|
|
109
|
+
}}
|
|
110
|
+
/>
|
|
111
|
+
|
|
112
|
+
<Story
|
|
113
|
+
name="KeyDown"
|
|
114
|
+
args={{
|
|
115
|
+
onkeydown: (e: TextInputKeyboardEvent) => {
|
|
116
|
+
console.log('onkeydown Event', e.key);
|
|
117
|
+
},
|
|
118
|
+
}}
|
|
119
|
+
/>
|
|
120
|
+
|
|
121
|
+
<Story
|
|
122
|
+
name="KeyPress"
|
|
123
|
+
args={{
|
|
124
|
+
onkeypress: (e: TextInputKeyboardEvent) => {
|
|
125
|
+
console.log('onkeypress Event', e.key);
|
|
126
|
+
},
|
|
127
|
+
}}
|
|
128
|
+
/>
|
|
129
|
+
|
|
130
|
+
<Story
|
|
131
|
+
name="KeyUp"
|
|
132
|
+
args={{
|
|
133
|
+
onkeyup: (e: TextInputKeyboardEvent) => {
|
|
134
|
+
console.log('onkeyup Event', e.key);
|
|
135
|
+
},
|
|
136
|
+
}}
|
|
137
|
+
/>
|
|
@@ -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,21 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Search from '../Search.svelte';
|
|
4
|
+
import { storySearchArgTypes } from '../Search.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: Search,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: storySearchArgTypes,
|
|
11
|
+
args: { value: 'Hello world!' },
|
|
12
|
+
});
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<Story name="Roundness 1" />
|
|
16
|
+
|
|
17
|
+
<Story name="Roundness 2" args={{ roundness: 2 }} />
|
|
18
|
+
|
|
19
|
+
<Story name="Roundness 3" args={{ roundness: 3 }} />
|
|
20
|
+
|
|
21
|
+
<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,40 @@
|
|
|
1
|
+
<script module lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
2
|
+
import Search from './Search.svelte';
|
|
3
|
+
import { componentRoundnessArray } from '../../../../types/roundness.js';
|
|
4
|
+
import { componentSizeArray } from '../../../../types/size.js';
|
|
5
|
+
export const storySearchArgTypes = {
|
|
6
|
+
roundness: {
|
|
7
|
+
control: { type: 'select' },
|
|
8
|
+
options: componentRoundnessArray,
|
|
9
|
+
},
|
|
10
|
+
size: {
|
|
11
|
+
control: { type: 'select' },
|
|
12
|
+
options: componentSizeArray,
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
16
|
+
const { Story } = defineMeta({
|
|
17
|
+
component: Search,
|
|
18
|
+
tags: ['autodocs'],
|
|
19
|
+
argTypes: storySearchArgTypes,
|
|
20
|
+
args: { value: 'Hello world!' },
|
|
21
|
+
});
|
|
22
|
+
let value = $state('Something');
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<!-- Search with default style -->
|
|
26
|
+
<Story name="Default" />
|
|
27
|
+
|
|
28
|
+
<Story name="Clearable" asChild>
|
|
29
|
+
<Search bind:value onclear={() => (value = '')} />
|
|
30
|
+
</Story>
|
|
31
|
+
|
|
32
|
+
<Story name="Placeholder" args={{ value: '', placeholder: 'Type something...' }} />
|
|
33
|
+
|
|
34
|
+
<Story name="No Outline" args={{ outline: false }} />
|
|
35
|
+
|
|
36
|
+
<Story name="Error" args={{ error: true }} />
|
|
37
|
+
|
|
38
|
+
<Story name="Disabled" args={{ disabled: true }} />
|
|
39
|
+
|
|
40
|
+
<Story name="Read only" args={{ readonly: true }} />
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import Search from './Search.svelte';
|
|
2
|
+
import type { StoryBookArgTypes } from '../../../../storybook-types.js';
|
|
3
|
+
export declare const storySearchArgTypes: 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 Search: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
}, {}, {}, string>;
|
|
20
|
+
type Search = InstanceType<typeof Search>;
|
|
21
|
+
export default Search;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
<script lang="ts" module>export {};
|
|
2
|
+
</script>
|
|
3
|
+
|
|
4
|
+
<script lang="ts">import InputEnclosure from '../../../developer tools/components/InputEnclosure/InputEnclosure.svelte';
|
|
5
|
+
import {} from '../../../developer tools/components/DynamicInput/DynamicInput.svelte';
|
|
6
|
+
import UtilityButton from '../../../developer tools/components/UtilityButton/UtilityButton.svelte';
|
|
7
|
+
import Icon from '@iconify/svelte';
|
|
8
|
+
import UtilityIcon from '../../../developer tools/components/UtilityIcon/UtilityIcon.svelte';
|
|
9
|
+
let { size = 'normal', roundness = 1, outline = true, name, id, class: className = '', disabled = false, onsearch, onclear, oninput, onchange, onblur, onfocus, onpaste, oncopy, oncut, onkeydown, onkeypress, onkeyup, before, after, error = false, value = $bindable(), placeholder, ref = $bindable(), readonly = false, customSearchIcon, searchIconPosition = 'before', } = $props();
|
|
10
|
+
let focused = $state(false);
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
|
+
let customSearchIconTyped = customSearchIcon;
|
|
13
|
+
function onfocusMod(e) {
|
|
14
|
+
const eTyped = e;
|
|
15
|
+
if (onfocus) {
|
|
16
|
+
onfocus(eTyped);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function onblurMod(e) {
|
|
20
|
+
const eTyped = e;
|
|
21
|
+
if (onblur) {
|
|
22
|
+
onblur(eTyped);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function onkeydownMod(e) {
|
|
26
|
+
const eTyped = e;
|
|
27
|
+
if (onkeydown) {
|
|
28
|
+
onkeydown(eTyped);
|
|
29
|
+
}
|
|
30
|
+
if (e.key === 'Enter' && onsearch) {
|
|
31
|
+
e.preventDefault();
|
|
32
|
+
onsearch();
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (e.key === 'Escape' && onclear) {
|
|
36
|
+
e.preventDefault();
|
|
37
|
+
onclear();
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
{#snippet searchIcon()}
|
|
44
|
+
<UtilityIcon {size} {disabled}>
|
|
45
|
+
{#if customSearchIconTyped}
|
|
46
|
+
{@render customSearchIconTyped()}
|
|
47
|
+
{:else}
|
|
48
|
+
<Icon icon="material-symbols:search-rounded" width="24" height="24" />
|
|
49
|
+
{/if}
|
|
50
|
+
</UtilityIcon>
|
|
51
|
+
{/snippet}
|
|
52
|
+
|
|
53
|
+
<div
|
|
54
|
+
class:outline
|
|
55
|
+
class:disabled
|
|
56
|
+
class:error
|
|
57
|
+
class:focused
|
|
58
|
+
class={['dodo-ui-Search', `size--${size}`, `roundness--${roundness}`, className].join(' ')}
|
|
59
|
+
>
|
|
60
|
+
<InputEnclosure {outline} {disabled} {error} {focused} {size} {roundness} {before} {after}>
|
|
61
|
+
{#if searchIconPosition === 'before'}
|
|
62
|
+
<div class="SearchIcon before">
|
|
63
|
+
{@render searchIcon()}
|
|
64
|
+
</div>
|
|
65
|
+
{/if}
|
|
66
|
+
|
|
67
|
+
<input
|
|
68
|
+
type="search"
|
|
69
|
+
{name}
|
|
70
|
+
{id}
|
|
71
|
+
{disabled}
|
|
72
|
+
bind:this={ref}
|
|
73
|
+
bind:focused
|
|
74
|
+
{oninput}
|
|
75
|
+
{onchange}
|
|
76
|
+
onfocus={onfocusMod}
|
|
77
|
+
onblur={onblurMod}
|
|
78
|
+
{onpaste}
|
|
79
|
+
{oncopy}
|
|
80
|
+
{oncut}
|
|
81
|
+
onkeydown={onkeydownMod}
|
|
82
|
+
onkeypress={onkeypress ? (e) => onkeypress(e as TextInputKeyboardEvent) : undefined}
|
|
83
|
+
onkeyup={onkeyup ? (e) => onkeyup(e as TextInputKeyboardEvent) : undefined}
|
|
84
|
+
{placeholder}
|
|
85
|
+
bind:value
|
|
86
|
+
{readonly}
|
|
87
|
+
/>
|
|
88
|
+
|
|
89
|
+
{#if value && onclear && !disabled}
|
|
90
|
+
<div class="SearchClear">
|
|
91
|
+
<UtilityButton {size} title="Clear" onclick={onclear}>
|
|
92
|
+
<Icon icon="material-symbols:close-small" width="24" height="24" />
|
|
93
|
+
</UtilityButton>
|
|
94
|
+
</div>
|
|
95
|
+
{/if}
|
|
96
|
+
|
|
97
|
+
{#if searchIconPosition === 'after'}
|
|
98
|
+
<div class="SearchIcon after">
|
|
99
|
+
{@render searchIcon()}
|
|
100
|
+
</div>
|
|
101
|
+
{/if}
|
|
102
|
+
</InputEnclosure>
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
<style>.dodo-ui-Search input {
|
|
106
|
+
flex: 1;
|
|
107
|
+
border: 0;
|
|
108
|
+
outline: 0;
|
|
109
|
+
height: 100%;
|
|
110
|
+
background-color: transparent;
|
|
111
|
+
font-family: inherit;
|
|
112
|
+
color: inherit;
|
|
113
|
+
letter-spacing: 0.3px;
|
|
114
|
+
margin: 0;
|
|
115
|
+
}
|
|
116
|
+
.dodo-ui-Search input::-webkit-search-decoration, .dodo-ui-Search input::-webkit-search-cancel-button, .dodo-ui-Search input::-webkit-search-results-button, .dodo-ui-Search input::-webkit-search-results-decoration {
|
|
117
|
+
display: none;
|
|
118
|
+
}
|
|
119
|
+
.dodo-ui-Search .SearchIcon {
|
|
120
|
+
display: flex;
|
|
121
|
+
}
|
|
122
|
+
.dodo-ui-Search.size--normal .SearchIcon.before {
|
|
123
|
+
margin-right: calc(var(--dodo-ui-space-small) * 2 * -1);
|
|
124
|
+
}
|
|
125
|
+
.dodo-ui-Search.size--normal input {
|
|
126
|
+
font-size: 1rem;
|
|
127
|
+
padding: 0 calc(var(--dodo-ui-space-small) * 2);
|
|
128
|
+
}
|
|
129
|
+
.dodo-ui-Search.size--small .SearchIcon.before {
|
|
130
|
+
margin-right: calc(var(--dodo-ui-space) * -1);
|
|
131
|
+
}
|
|
132
|
+
.dodo-ui-Search.size--small input {
|
|
133
|
+
padding: 0 var(--dodo-ui-space);
|
|
134
|
+
font-size: 0.9rem;
|
|
135
|
+
}
|
|
136
|
+
.dodo-ui-Search.size--large .SearchIcon.before {
|
|
137
|
+
margin-right: calc(var(--dodo-ui-space) * 2 * -1);
|
|
138
|
+
}
|
|
139
|
+
.dodo-ui-Search.size--large input {
|
|
140
|
+
font-size: 1.1rem;
|
|
141
|
+
padding: 0 calc(var(--dodo-ui-space) * 2);
|
|
142
|
+
}</style>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { ComponentRoundness } from '../../../../types/roundness.js';
|
|
2
|
+
import type { ComponentSize } from '../../../../types/size.js';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
import type { ChangeEventHandler, ClipboardEventHandler, FocusEventHandler, FormEventHandler, KeyboardEventHandler } from 'svelte/elements';
|
|
5
|
+
export interface SearchProps {
|
|
6
|
+
/** Input ref */
|
|
7
|
+
ref?: HTMLInputElement;
|
|
8
|
+
/** How large should the button be? */
|
|
9
|
+
size?: ComponentSize;
|
|
10
|
+
/** How round should the border radius be? */
|
|
11
|
+
roundness?: ComponentRoundness;
|
|
12
|
+
/** Add a border around the button. Default True */
|
|
13
|
+
outline?: boolean;
|
|
14
|
+
/** Input value */
|
|
15
|
+
value?: string;
|
|
16
|
+
/** How round should the border radius be? */
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
/** disabled state */
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/** Read only ? */
|
|
21
|
+
readonly?: boolean;
|
|
22
|
+
/** is there any associated Error ? */
|
|
23
|
+
error?: boolean;
|
|
24
|
+
/** Name */
|
|
25
|
+
name?: string;
|
|
26
|
+
/** Id */
|
|
27
|
+
id?: string;
|
|
28
|
+
/** Icon before button content */
|
|
29
|
+
before?: Snippet;
|
|
30
|
+
/** Icon after button content */
|
|
31
|
+
after?: Snippet;
|
|
32
|
+
/** Custom css class*/
|
|
33
|
+
class?: string;
|
|
34
|
+
/** onsearch event handler */
|
|
35
|
+
onsearch?: () => void;
|
|
36
|
+
/** onclear event handler */
|
|
37
|
+
onclear?: () => void;
|
|
38
|
+
/** oninput event handler */
|
|
39
|
+
oninput?: FormEventHandler<HTMLInputElement>;
|
|
40
|
+
/** onchange event handler */
|
|
41
|
+
onchange?: ChangeEventHandler<HTMLInputElement>;
|
|
42
|
+
/** onblur event handler */
|
|
43
|
+
onblur?: FocusEventHandler<HTMLInputElement>;
|
|
44
|
+
/** onfocus event handler */
|
|
45
|
+
onfocus?: FocusEventHandler<HTMLInputElement>;
|
|
46
|
+
/** onpaste event handler */
|
|
47
|
+
onpaste?: ClipboardEventHandler<HTMLInputElement>;
|
|
48
|
+
/** oncopy event handler */
|
|
49
|
+
oncopy?: ClipboardEventHandler<HTMLInputElement>;
|
|
50
|
+
/** oncut event handler */
|
|
51
|
+
oncut?: ClipboardEventHandler<HTMLInputElement>;
|
|
52
|
+
/** onkeydown event handler */
|
|
53
|
+
onkeydown?: KeyboardEventHandler<HTMLInputElement>;
|
|
54
|
+
/** onkeypress event handler */
|
|
55
|
+
onkeypress?: KeyboardEventHandler<HTMLInputElement>;
|
|
56
|
+
/** onkeyup event handler */
|
|
57
|
+
onkeyup?: KeyboardEventHandler<HTMLInputElement>;
|
|
58
|
+
/** custom Search Icon */
|
|
59
|
+
customSearchIcon?: () => Snippet;
|
|
60
|
+
/** search Icon Position */
|
|
61
|
+
searchIconPosition?: IconPosition;
|
|
62
|
+
}
|
|
63
|
+
import type { IconPosition } from '../../../../types/special.js';
|
|
64
|
+
declare const Search: import("svelte").Component<SearchProps, {}, "ref" | "value">;
|
|
65
|
+
type Search = ReturnType<typeof Search>;
|
|
66
|
+
export default Search;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Search from '../Search.svelte';
|
|
4
|
+
import { storySearchArgTypes } from '../Search.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: Search,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
argTypes: storySearchArgTypes,
|
|
12
|
+
});
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<Story name="Deafult" />
|
|
16
|
+
|
|
17
|
+
<Story name="Icon After" args={{ searchIconPosition: 'after' }} />
|
|
18
|
+
|
|
19
|
+
<Story name="No Search Icon" args={{ searchIconPosition: false }} />
|
|
20
|
+
|
|
21
|
+
<Story name="CustomSearchIcon" asChild>
|
|
22
|
+
<Search>
|
|
23
|
+
{#snippet customSearchIcon()}
|
|
24
|
+
<Icon icon="line-md:search-twotone" width="24" height="24" />
|
|
25
|
+
{/snippet}
|
|
26
|
+
</Search>
|
|
27
|
+
</Story>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default SearchIcon;
|
|
2
|
+
type SearchIcon = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const SearchIcon: $$__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,17 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Search from '../Search.svelte';
|
|
4
|
+
import { storySearchArgTypes } from '../Search.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: Search,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: storySearchArgTypes,
|
|
11
|
+
args: { value: 'Hello world!' },
|
|
12
|
+
});
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<Story name="Normal" />
|
|
16
|
+
<Story name="Small" args={{ size: 'small' }} />
|
|
17
|
+
<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
|
+
}
|