@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
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import UtilityIcon from './UtilityIcon.svelte';
|
|
2
|
+
import type { StoryBookArgTypes } from '../../../../storybook-types.js';
|
|
3
|
+
export declare const storyUtilityIconArgTypes: 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 UtilityIcon: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
}, {}, {}, string>;
|
|
20
|
+
type UtilityIcon = InstanceType<typeof UtilityIcon>;
|
|
21
|
+
export default UtilityIcon;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<script lang="ts" module>export {};
|
|
2
|
+
</script>
|
|
3
|
+
|
|
4
|
+
<script lang="ts">"use strict";
|
|
5
|
+
let { children, size = 'normal', id, class: className = '', disabled = false, ref = $bindable(), } = $props();
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<span
|
|
9
|
+
class={['dodo-ui-UtilityIcon', `size--${size}`, className].join(' ')}
|
|
10
|
+
class:disabled
|
|
11
|
+
{id}
|
|
12
|
+
bind:this={ref}
|
|
13
|
+
>
|
|
14
|
+
{#if children}
|
|
15
|
+
{@render children()}
|
|
16
|
+
{/if}
|
|
17
|
+
</span>
|
|
18
|
+
|
|
19
|
+
<style>:global(:root) {
|
|
20
|
+
--dodo-ui-UtilityIcon-disabled-color: var(--dodo-color-neutral-400);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
:global(.dodo-theme--dark) {
|
|
24
|
+
--dodo-ui-UtilityIcon-disabled-color: var(--dodo-color-neutral-500);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.dodo-ui-UtilityIcon {
|
|
28
|
+
outline: none;
|
|
29
|
+
transition: all 150ms;
|
|
30
|
+
text-decoration: none;
|
|
31
|
+
margin: 0;
|
|
32
|
+
display: inline-flex;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
align-items: center;
|
|
35
|
+
font-family: inherit;
|
|
36
|
+
background-color: transparent;
|
|
37
|
+
color: var(--dodo-color-neutral-600);
|
|
38
|
+
font-family: inherit;
|
|
39
|
+
}
|
|
40
|
+
.dodo-ui-UtilityIcon.size--normal {
|
|
41
|
+
height: var(--dodo-ui-element-height-normal);
|
|
42
|
+
width: var(--dodo-ui-element-height-normal);
|
|
43
|
+
font-size: 1rem;
|
|
44
|
+
}
|
|
45
|
+
.dodo-ui-UtilityIcon.size--small {
|
|
46
|
+
height: var(--dodo-ui-element-height-small);
|
|
47
|
+
width: var(--dodo-ui-element-height-small);
|
|
48
|
+
font-size: 0.9rem;
|
|
49
|
+
}
|
|
50
|
+
.dodo-ui-UtilityIcon.size--large {
|
|
51
|
+
height: var(--dodo-ui-element-height-large);
|
|
52
|
+
width: var(--dodo-ui-element-height-large);
|
|
53
|
+
font-size: 1.1rem;
|
|
54
|
+
}
|
|
55
|
+
.dodo-ui-UtilityIcon.disabled {
|
|
56
|
+
cursor: initial;
|
|
57
|
+
color: var(--dodo-ui-UtilityIcon-disabled-color);
|
|
58
|
+
}</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ComponentSize } from '../../../../types/size.js';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
export interface UtilityIconProps {
|
|
4
|
+
/** Button contents goes here*/
|
|
5
|
+
children?: Snippet;
|
|
6
|
+
/** Button ref */
|
|
7
|
+
ref?: HTMLSpanElement;
|
|
8
|
+
/** How large should the button be? */
|
|
9
|
+
size?: ComponentSize;
|
|
10
|
+
/** Button disabled state */
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/** Id */
|
|
13
|
+
id?: string;
|
|
14
|
+
/** Custom css class*/
|
|
15
|
+
class?: string;
|
|
16
|
+
}
|
|
17
|
+
declare const UtilityIcon: import("svelte").Component<UtilityIconProps, {}, "ref">;
|
|
18
|
+
type UtilityIcon = ReturnType<typeof UtilityIcon>;
|
|
19
|
+
export default UtilityIcon;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type IconPosition = false | 'before' | 'after';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flightlesslabs/dodo-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"copy-css": "cpy src/lib/styles/global.css dist/styles --parents",
|
|
6
6
|
"build": "vite build && pnpm copy-css && pnpm run prepack",
|
|
@@ -53,22 +53,22 @@
|
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@chromatic-com/storybook": "4.1.0",
|
|
56
|
-
"@eslint/compat": "^1.3.
|
|
57
|
-
"@eslint/js": "^9.
|
|
56
|
+
"@eslint/compat": "^1.3.2",
|
|
57
|
+
"@eslint/js": "^9.33.0",
|
|
58
58
|
"@storybook/addon-docs": "^9.1.1",
|
|
59
59
|
"@storybook/addon-svelte-csf": "5.0.7",
|
|
60
60
|
"@storybook/addon-vitest": "^9.1.1",
|
|
61
61
|
"@storybook/sveltekit": "^9.1.1",
|
|
62
|
-
"@sveltejs/adapter-static": "^3.0.
|
|
63
|
-
"@sveltejs/kit": "^2.27.
|
|
64
|
-
"@sveltejs/package": "^2.4.
|
|
65
|
-
"@sveltejs/vite-plugin-svelte": "^6.1.
|
|
62
|
+
"@sveltejs/adapter-static": "^3.0.9",
|
|
63
|
+
"@sveltejs/kit": "^2.27.3",
|
|
64
|
+
"@sveltejs/package": "^2.4.1",
|
|
65
|
+
"@sveltejs/vite-plugin-svelte": "^6.1.1",
|
|
66
66
|
"@types/file-saver": "^2.0.7",
|
|
67
67
|
"@vitest/browser": "^3.2.4",
|
|
68
68
|
"@vitest/coverage-v8": "^3.2.4",
|
|
69
69
|
"@vueless/storybook-dark-mode": "^9.0.6",
|
|
70
70
|
"cpy-cli": "^5.0.0",
|
|
71
|
-
"eslint": "^9.
|
|
71
|
+
"eslint": "^9.33.0",
|
|
72
72
|
"eslint-config-prettier": "^10.1.8",
|
|
73
73
|
"eslint-plugin-storybook": "9.1.1",
|
|
74
74
|
"eslint-plugin-svelte": "^3.11.0",
|
|
@@ -77,14 +77,14 @@
|
|
|
77
77
|
"prettier": "^3.6.2",
|
|
78
78
|
"prettier-plugin-svelte": "^3.4.0",
|
|
79
79
|
"publint": "^0.3.12",
|
|
80
|
-
"sass": "^1.
|
|
80
|
+
"sass": "^1.90.0",
|
|
81
81
|
"storybook": "^9.1.1",
|
|
82
|
-
"svelte": "^5.
|
|
82
|
+
"svelte": "^5.38.0",
|
|
83
83
|
"svelte-check": "^4.3.1",
|
|
84
84
|
"svelte-preprocess": "^6.0.3",
|
|
85
85
|
"typescript": "^5.9.2",
|
|
86
86
|
"typescript-eslint": "^8.39.0",
|
|
87
|
-
"vite": "^7.
|
|
87
|
+
"vite": "^7.1.1",
|
|
88
88
|
"vitest": "^3.2.4"
|
|
89
89
|
},
|
|
90
90
|
"keywords": [
|
package/src/lib/index.ts
CHANGED
|
@@ -12,6 +12,8 @@ export type { ComponentWeight } from './types/weight.js';
|
|
|
12
12
|
|
|
13
13
|
export type { PositionY, PositionX } from './types/position.js';
|
|
14
14
|
|
|
15
|
+
export type { IconPosition } from './types/special.js';
|
|
16
|
+
|
|
15
17
|
/** developer tools: helpers: logger */
|
|
16
18
|
export { default as createLogger } from '$lib/stories/developer tools/helpers/logger/logger.js';
|
|
17
19
|
export type {
|
|
@@ -103,11 +105,7 @@ export type { MessageProps } from '$lib/stories/components/Form/Message/Message.
|
|
|
103
105
|
|
|
104
106
|
/** Form: Select */
|
|
105
107
|
export { default as Select } from '$lib/stories/components/Form/Select/Select.svelte';
|
|
106
|
-
export type {
|
|
107
|
-
SelectOption,
|
|
108
|
-
SelectDropdownArrowPosition,
|
|
109
|
-
SelectProps,
|
|
110
|
-
} from '$lib/stories/components/Form/Select/Select.svelte';
|
|
108
|
+
export type { SelectOption, SelectProps } from '$lib/stories/components/Form/Select/Select.svelte';
|
|
111
109
|
|
|
112
110
|
/** Form: NumericInput */
|
|
113
111
|
export { default as NumericInput } from '$lib/stories/components/Form/NumericInput/NumericInput.svelte';
|
|
@@ -136,6 +134,10 @@ export type { CheckboxProps } from '$lib/stories/components/Form/Checkbox/Checkb
|
|
|
136
134
|
export { default as Radio } from '$lib/stories/components/Form/Radio/Radio.svelte';
|
|
137
135
|
export type { RadioProps } from '$lib/stories/components/Form/Radio/Radio.svelte';
|
|
138
136
|
|
|
137
|
+
/** Form: Search */
|
|
138
|
+
export { default as Search } from '$lib/stories/components/Form/Search/Search.svelte';
|
|
139
|
+
export type { SearchProps } from '$lib/stories/components/Form/Search/Search.svelte';
|
|
140
|
+
|
|
139
141
|
/** Layout: Paper */
|
|
140
142
|
export { default as Paper } from '$lib/stories/components/Layout/Paper/Paper.svelte';
|
|
141
143
|
export type { PaperColor, PaperProps } from '$lib/stories/components/Layout/Paper/Paper.svelte';
|
|
@@ -172,6 +174,13 @@ export type {
|
|
|
172
174
|
GridColumnProps,
|
|
173
175
|
} from '$lib/stories/components/Layout/Grid/Column/Column.svelte';
|
|
174
176
|
|
|
177
|
+
/** Layout: Accordian */
|
|
178
|
+
export { default as Accordian } from '$lib/stories/components/Layout/Accordian/Accordian.svelte';
|
|
179
|
+
export type {
|
|
180
|
+
AccordianProps,
|
|
181
|
+
AccordianToggleEvent,
|
|
182
|
+
} from '$lib/stories/components/Layout/Accordian/Accordian.svelte';
|
|
183
|
+
|
|
175
184
|
/** Info: Calendar */
|
|
176
185
|
export { default as Calendar } from '$lib/stories/components/Info/Calendar/Calendar.svelte';
|
|
177
186
|
export type {
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { ComponentRoundness } from '$lib/types/roundness.js';
|
|
3
|
+
import type { ComponentSize } from '$lib/types/size.js';
|
|
4
|
+
|
|
5
|
+
import type { Snippet } from 'svelte';
|
|
6
|
+
import type {
|
|
7
|
+
ChangeEventHandler,
|
|
8
|
+
ClipboardEventHandler,
|
|
9
|
+
FocusEventHandler,
|
|
10
|
+
FormEventHandler,
|
|
11
|
+
KeyboardEventHandler,
|
|
12
|
+
} from 'svelte/elements';
|
|
13
|
+
|
|
14
|
+
export interface SearchProps {
|
|
15
|
+
/** Input ref */
|
|
16
|
+
ref?: HTMLInputElement;
|
|
17
|
+
/** How large should the button be? */
|
|
18
|
+
size?: ComponentSize;
|
|
19
|
+
/** How round should the border radius be? */
|
|
20
|
+
roundness?: ComponentRoundness;
|
|
21
|
+
/** Add a border around the button. Default True */
|
|
22
|
+
outline?: boolean;
|
|
23
|
+
/** Input value */
|
|
24
|
+
value?: string;
|
|
25
|
+
/** How round should the border radius be? */
|
|
26
|
+
placeholder?: string;
|
|
27
|
+
/** disabled state */
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
/** Read only ? */
|
|
30
|
+
readonly?: boolean;
|
|
31
|
+
/** is there any associated Error ? */
|
|
32
|
+
error?: boolean;
|
|
33
|
+
/** Name */
|
|
34
|
+
name?: string;
|
|
35
|
+
/** Id */
|
|
36
|
+
id?: string;
|
|
37
|
+
/** Icon before button content */
|
|
38
|
+
before?: Snippet;
|
|
39
|
+
/** Icon after button content */
|
|
40
|
+
after?: Snippet;
|
|
41
|
+
/** Custom css class*/
|
|
42
|
+
class?: string;
|
|
43
|
+
/** onsearch event handler */
|
|
44
|
+
onsearch?: () => void;
|
|
45
|
+
/** onclear event handler */
|
|
46
|
+
onclear?: () => void;
|
|
47
|
+
/** oninput event handler */
|
|
48
|
+
oninput?: FormEventHandler<HTMLInputElement>;
|
|
49
|
+
/** onchange event handler */
|
|
50
|
+
onchange?: ChangeEventHandler<HTMLInputElement>;
|
|
51
|
+
/** onblur event handler */
|
|
52
|
+
onblur?: FocusEventHandler<HTMLInputElement>;
|
|
53
|
+
/** onfocus event handler */
|
|
54
|
+
onfocus?: FocusEventHandler<HTMLInputElement>;
|
|
55
|
+
/** onpaste event handler */
|
|
56
|
+
onpaste?: ClipboardEventHandler<HTMLInputElement>;
|
|
57
|
+
/** oncopy event handler */
|
|
58
|
+
oncopy?: ClipboardEventHandler<HTMLInputElement>;
|
|
59
|
+
/** oncut event handler */
|
|
60
|
+
oncut?: ClipboardEventHandler<HTMLInputElement>;
|
|
61
|
+
/** onkeydown event handler */
|
|
62
|
+
onkeydown?: KeyboardEventHandler<HTMLInputElement>;
|
|
63
|
+
/** onkeypress event handler */
|
|
64
|
+
onkeypress?: KeyboardEventHandler<HTMLInputElement>;
|
|
65
|
+
/** onkeyup event handler */
|
|
66
|
+
onkeyup?: KeyboardEventHandler<HTMLInputElement>;
|
|
67
|
+
/** custom Search Icon */
|
|
68
|
+
customSearchIcon?: () => Snippet;
|
|
69
|
+
/** search Icon Position */
|
|
70
|
+
searchIconPosition?: IconPosition;
|
|
71
|
+
}
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<script lang="ts">
|
|
75
|
+
import InputEnclosure from '$lib/stories/developer tools/components/InputEnclosure/InputEnclosure.svelte';
|
|
76
|
+
import { type DynamicInputFocusEvent } from '$lib/stories/developer tools/components/DynamicInput/DynamicInput.svelte';
|
|
77
|
+
import type { TextInputFocusEvent, TextInputKeyboardEvent } from '../TextInput/TextInput.svelte';
|
|
78
|
+
import UtilityButton from '$lib/stories/developer tools/components/UtilityButton/UtilityButton.svelte';
|
|
79
|
+
import Icon from '@iconify/svelte';
|
|
80
|
+
import UtilityIcon from '$lib/stories/developer tools/components/UtilityIcon/UtilityIcon.svelte';
|
|
81
|
+
import type { IconPosition } from '$lib/types/special.js';
|
|
82
|
+
|
|
83
|
+
let {
|
|
84
|
+
size = 'normal',
|
|
85
|
+
roundness = 1,
|
|
86
|
+
outline = true,
|
|
87
|
+
name,
|
|
88
|
+
id,
|
|
89
|
+
class: className = '',
|
|
90
|
+
disabled = false,
|
|
91
|
+
onsearch,
|
|
92
|
+
onclear,
|
|
93
|
+
oninput,
|
|
94
|
+
onchange,
|
|
95
|
+
onblur,
|
|
96
|
+
onfocus,
|
|
97
|
+
onpaste,
|
|
98
|
+
oncopy,
|
|
99
|
+
oncut,
|
|
100
|
+
onkeydown,
|
|
101
|
+
onkeypress,
|
|
102
|
+
onkeyup,
|
|
103
|
+
before,
|
|
104
|
+
after,
|
|
105
|
+
error = false,
|
|
106
|
+
value = $bindable<string>(),
|
|
107
|
+
placeholder,
|
|
108
|
+
ref = $bindable<HTMLInputElement>(),
|
|
109
|
+
readonly = false,
|
|
110
|
+
customSearchIcon,
|
|
111
|
+
searchIconPosition = 'before',
|
|
112
|
+
}: SearchProps = $props();
|
|
113
|
+
|
|
114
|
+
let focused: boolean = $state(false);
|
|
115
|
+
|
|
116
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
117
|
+
let customSearchIconTyped = customSearchIcon as any;
|
|
118
|
+
|
|
119
|
+
function onfocusMod(e: DynamicInputFocusEvent) {
|
|
120
|
+
const eTyped = e as TextInputFocusEvent;
|
|
121
|
+
if (onfocus) {
|
|
122
|
+
onfocus(eTyped);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function onblurMod(e: DynamicInputFocusEvent) {
|
|
127
|
+
const eTyped = e as TextInputFocusEvent;
|
|
128
|
+
|
|
129
|
+
if (onblur) {
|
|
130
|
+
onblur(eTyped);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function onkeydownMod(e: TextInputKeyboardEvent) {
|
|
135
|
+
const eTyped = e as TextInputKeyboardEvent;
|
|
136
|
+
|
|
137
|
+
if (onkeydown) {
|
|
138
|
+
onkeydown(eTyped);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (e.key === 'Enter' && onsearch) {
|
|
142
|
+
e.preventDefault();
|
|
143
|
+
|
|
144
|
+
onsearch();
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (e.key === 'Escape' && onclear) {
|
|
149
|
+
e.preventDefault();
|
|
150
|
+
|
|
151
|
+
onclear();
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
</script>
|
|
156
|
+
|
|
157
|
+
{#snippet searchIcon()}
|
|
158
|
+
<UtilityIcon {size} {disabled}>
|
|
159
|
+
{#if customSearchIconTyped}
|
|
160
|
+
{@render customSearchIconTyped()}
|
|
161
|
+
{:else}
|
|
162
|
+
<Icon icon="material-symbols:search-rounded" width="24" height="24" />
|
|
163
|
+
{/if}
|
|
164
|
+
</UtilityIcon>
|
|
165
|
+
{/snippet}
|
|
166
|
+
|
|
167
|
+
<div
|
|
168
|
+
class:outline
|
|
169
|
+
class:disabled
|
|
170
|
+
class:error
|
|
171
|
+
class:focused
|
|
172
|
+
class={['dodo-ui-Search', `size--${size}`, `roundness--${roundness}`, className].join(' ')}
|
|
173
|
+
>
|
|
174
|
+
<InputEnclosure {outline} {disabled} {error} {focused} {size} {roundness} {before} {after}>
|
|
175
|
+
{#if searchIconPosition === 'before'}
|
|
176
|
+
<div class="SearchIcon before">
|
|
177
|
+
{@render searchIcon()}
|
|
178
|
+
</div>
|
|
179
|
+
{/if}
|
|
180
|
+
|
|
181
|
+
<input
|
|
182
|
+
type="search"
|
|
183
|
+
{name}
|
|
184
|
+
{id}
|
|
185
|
+
{disabled}
|
|
186
|
+
bind:this={ref}
|
|
187
|
+
bind:focused
|
|
188
|
+
{oninput}
|
|
189
|
+
{onchange}
|
|
190
|
+
onfocus={onfocusMod}
|
|
191
|
+
onblur={onblurMod}
|
|
192
|
+
{onpaste}
|
|
193
|
+
{oncopy}
|
|
194
|
+
{oncut}
|
|
195
|
+
onkeydown={onkeydownMod}
|
|
196
|
+
onkeypress={onkeypress ? (e) => onkeypress(e as TextInputKeyboardEvent) : undefined}
|
|
197
|
+
onkeyup={onkeyup ? (e) => onkeyup(e as TextInputKeyboardEvent) : undefined}
|
|
198
|
+
{placeholder}
|
|
199
|
+
bind:value
|
|
200
|
+
{readonly}
|
|
201
|
+
/>
|
|
202
|
+
|
|
203
|
+
{#if value && onclear && !disabled}
|
|
204
|
+
<div class="SearchClear">
|
|
205
|
+
<UtilityButton {size} title="Clear" onclick={onclear}>
|
|
206
|
+
<Icon icon="material-symbols:close-small" width="24" height="24" />
|
|
207
|
+
</UtilityButton>
|
|
208
|
+
</div>
|
|
209
|
+
{/if}
|
|
210
|
+
|
|
211
|
+
{#if searchIconPosition === 'after'}
|
|
212
|
+
<div class="SearchIcon after">
|
|
213
|
+
{@render searchIcon()}
|
|
214
|
+
</div>
|
|
215
|
+
{/if}
|
|
216
|
+
</InputEnclosure>
|
|
217
|
+
</div>
|
|
218
|
+
|
|
219
|
+
<style lang="scss">
|
|
220
|
+
.dodo-ui-Search {
|
|
221
|
+
input {
|
|
222
|
+
flex: 1;
|
|
223
|
+
border: 0;
|
|
224
|
+
outline: 0;
|
|
225
|
+
height: 100%;
|
|
226
|
+
background-color: transparent;
|
|
227
|
+
font-family: inherit;
|
|
228
|
+
color: inherit;
|
|
229
|
+
letter-spacing: 0.3px;
|
|
230
|
+
margin: 0;
|
|
231
|
+
|
|
232
|
+
&::-webkit-search-decoration,
|
|
233
|
+
&::-webkit-search-cancel-button,
|
|
234
|
+
&::-webkit-search-results-button,
|
|
235
|
+
&::-webkit-search-results-decoration {
|
|
236
|
+
display: none;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.SearchIcon {
|
|
241
|
+
display: flex;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
&.size {
|
|
245
|
+
&--normal {
|
|
246
|
+
.SearchIcon {
|
|
247
|
+
&.before {
|
|
248
|
+
margin-right: calc(calc(var(--dodo-ui-space-small) * 2) * -1);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
input {
|
|
253
|
+
font-size: 1rem;
|
|
254
|
+
padding: 0 calc(var(--dodo-ui-space-small) * 2);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
&--small {
|
|
259
|
+
.SearchIcon {
|
|
260
|
+
&.before {
|
|
261
|
+
margin-right: calc(var(--dodo-ui-space) * -1);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
input {
|
|
266
|
+
padding: 0 var(--dodo-ui-space);
|
|
267
|
+
font-size: 0.9rem;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
&--large {
|
|
272
|
+
.SearchIcon {
|
|
273
|
+
&.before {
|
|
274
|
+
margin-right: calc(calc(var(--dodo-ui-space) * 2) * -1);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
input {
|
|
279
|
+
font-size: 1.1rem;
|
|
280
|
+
padding: 0 calc(var(--dodo-ui-space) * 2);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
</style>
|
|
@@ -17,8 +17,6 @@
|
|
|
17
17
|
disabled?: boolean;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
export type SelectDropdownArrowPosition = false | 'before' | 'after';
|
|
21
|
-
|
|
22
20
|
export interface SelectProps {
|
|
23
21
|
/** How large should the button be? */
|
|
24
22
|
size?: ComponentSize;
|
|
@@ -82,7 +80,7 @@
|
|
|
82
80
|
onkeyup?: KeyboardEventHandler<HTMLInputElement | HTMLButtonElement>;
|
|
83
81
|
/** custom Content Formatting for variant button */
|
|
84
82
|
customInputContent?: (val: SelectOption) => Snippet;
|
|
85
|
-
/** custom
|
|
83
|
+
/** custom Menu Item Content */
|
|
86
84
|
customMenuItemContent?: (val: SelectOption, selected: boolean) => Snippet;
|
|
87
85
|
/** Custom Popup Content */
|
|
88
86
|
customPopupContent?: (
|
|
@@ -90,7 +88,7 @@
|
|
|
90
88
|
selectedOption: SelectOption,
|
|
91
89
|
onselect: (val: SelectOption) => void,
|
|
92
90
|
) => Snippet;
|
|
93
|
-
/** custom
|
|
91
|
+
/** custom Placeholder MenuItem Content */
|
|
94
92
|
customPlaceholderMenuItemContent?: () => Snippet;
|
|
95
93
|
/** PopperPopup Max height. Use css compatible value */
|
|
96
94
|
popupMaxHeight?: string;
|
|
@@ -105,7 +103,7 @@
|
|
|
105
103
|
/** Dropdown Arrow Icon */
|
|
106
104
|
customDropdownArrowIcon?: (open: boolean) => Snippet;
|
|
107
105
|
/** Select Dropdown Arrow Position */
|
|
108
|
-
dropdownArrowPosition?:
|
|
106
|
+
dropdownArrowPosition?: IconPosition;
|
|
109
107
|
/** Popup stick horizontally */
|
|
110
108
|
popupPositionX?: PositionX;
|
|
111
109
|
/** Popup stick vertically */
|
|
@@ -138,6 +136,7 @@
|
|
|
138
136
|
} from '$lib/index.js';
|
|
139
137
|
import type { TextInputInputEvent } from '../TextInput/TextInput.svelte';
|
|
140
138
|
import type { ButtonClickEvent } from '../Button/Button.svelte';
|
|
139
|
+
import type { IconPosition } from '$lib/types/special.js';
|
|
141
140
|
|
|
142
141
|
let {
|
|
143
142
|
size = 'normal',
|
|
@@ -394,6 +393,7 @@
|
|
|
394
393
|
value={searchable ? searchTerm : selectedOption?.label}
|
|
395
394
|
{readonly}
|
|
396
395
|
variant={searchable ? 'input' : 'button'}
|
|
396
|
+
{size}
|
|
397
397
|
>
|
|
398
398
|
{#snippet customInputContent()}
|
|
399
399
|
{#if customInputContentTyped}
|