@flightlesslabs/dodo-ui 0.6.6 → 0.7.1
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 +28 -7
- package/dist/index.js +12 -2
- package/dist/stories/Home.mdx +1 -1
- package/dist/stories/components/Form/Button/Button.svelte +2 -2
- package/dist/stories/components/Form/Button/Button.svelte.d.ts +8 -5
- package/dist/stories/components/Form/FormControl/FormControl.svelte +3 -0
- package/dist/stories/components/Form/FormControl/FormControl.svelte.d.ts +1 -1
- package/dist/stories/components/Form/Label/Label.svelte +5 -2
- package/dist/stories/components/Form/Label/Label.svelte.d.ts +1 -1
- package/dist/stories/components/Form/Message/Message.svelte +5 -2
- package/dist/stories/components/Form/Message/Message.svelte.d.ts +1 -1
- package/dist/stories/components/Form/PasswordInput/PasswordInput.svelte +25 -32
- package/dist/stories/components/Form/PasswordInput/PasswordInput.svelte.d.ts +5 -5
- package/dist/stories/components/Form/Select/Customize/Customize.stories.svelte +120 -0
- package/dist/stories/components/Form/Select/Customize/Customize.stories.svelte.d.ts +18 -0
- package/dist/stories/components/Form/Select/Events/Events.stories.svelte +138 -0
- package/dist/stories/components/Form/Select/Options/OptionFormat.mdx +40 -0
- package/dist/stories/components/Form/Select/Roundness/Roundness.stories.svelte +28 -0
- package/dist/stories/components/Form/Select/Roundness/Roundness.stories.svelte.d.ts +18 -0
- package/dist/stories/components/Form/Select/Select.stories.svelte +114 -0
- package/dist/stories/components/Form/Select/Select.stories.svelte.d.ts +22 -0
- package/dist/stories/components/Form/Select/Select.svelte +285 -0
- package/dist/stories/components/Form/Select/Select.svelte.d.ts +87 -0
- package/dist/stories/components/Form/Select/Size/Size.stories.svelte +24 -0
- package/dist/stories/components/Form/Select/Size/Size.stories.svelte.d.ts +18 -0
- package/dist/stories/components/Form/Select/WithIcon/WithIcon.stories.svelte +39 -0
- package/dist/stories/components/Form/Select/WithIcon/WithIcon.stories.svelte.d.ts +18 -0
- package/dist/stories/components/Form/TextInput/TextInput.svelte +9 -28
- package/dist/stories/components/Form/TextInput/TextInput.svelte.d.ts +8 -5
- package/dist/stories/components/Layout/Menu/Menu.stories.svelte +65 -0
- package/dist/stories/components/Layout/Menu/Menu.stories.svelte.d.ts +21 -0
- package/dist/stories/components/Layout/Menu/Menu.svelte +30 -0
- package/dist/stories/components/Layout/Menu/Menu.svelte.d.ts +23 -0
- package/dist/stories/components/Layout/Menu/MenuItem/MenuItem.stories.svelte +30 -0
- package/dist/stories/components/Layout/Menu/MenuItem/MenuItem.stories.svelte.d.ts +21 -0
- package/dist/stories/components/Layout/Menu/MenuItem/MenuItem.svelte +164 -0
- package/dist/stories/components/Layout/Menu/MenuItem/MenuItem.svelte.d.ts +49 -0
- package/dist/stories/components/Layout/Menu/MenuItem/Size/Size.stories.svelte +16 -0
- package/dist/stories/components/Layout/Menu/MenuItem/Type/Type.stories.svelte +21 -0
- package/dist/stories/components/{Form/SimpleSelect/WithIcon/WithIcon.stories.svelte.d.ts → Layout/Menu/MenuItem/Type/Type.stories.svelte.d.ts} +3 -3
- package/dist/stories/components/Layout/Menu/Size/Size.stories.svelte +37 -0
- package/dist/stories/components/{Form/SimpleSelect/Roundness/Roundness.stories.svelte.d.ts → Layout/Menu/Size/Size.stories.svelte.d.ts} +3 -3
- package/dist/stories/components/Layout/Paper/Color/Color.stories.svelte +1 -1
- package/dist/stories/components/Layout/Paper/Paper.stories.svelte +1 -1
- package/dist/stories/components/Layout/Paper/Paper.svelte.d.ts +5 -5
- package/dist/stories/components/Layout/Separator/Color/Color.stories.svelte +19 -0
- package/dist/stories/components/Layout/Separator/Color/Color.stories.svelte.d.ts +26 -0
- package/dist/stories/components/Layout/Separator/Separator.stories.svelte +26 -0
- package/dist/stories/components/Layout/Separator/Separator.stories.svelte.d.ts +21 -0
- package/dist/stories/components/Layout/Separator/Separator.svelte +66 -0
- package/dist/stories/components/Layout/Separator/Separator.svelte.d.ts +22 -0
- package/dist/stories/components/Layout/Separator/utils/scss/mixins.scss +24 -0
- package/dist/stories/developer tools/components/DynamicInput/DynamicInput.stories.svelte +49 -0
- package/dist/stories/{components/Form/SimpleSelect/SimpleSelect.stories.svelte.d.ts → developer tools/components/DynamicInput/DynamicInput.stories.svelte.d.ts } +5 -7
- package/dist/stories/developer tools/components/DynamicInput/DynamicInput.svelte +92 -0
- package/dist/stories/developer tools/components/DynamicInput/DynamicInput.svelte.d.ts +60 -0
- package/dist/stories/{components/Form/SimpleSelect/Size/Size.stories.svelte → developer tools/components/DynamicInput/Size/Size.stories.svelte } +5 -8
- package/dist/stories/developer tools/components/DynamicInput/Size/Size.stories.svelte.d.ts +26 -0
- package/dist/stories/developer tools/components/InputEnclosure/InputEnclosure.svelte +6 -2
- package/dist/stories/developer tools/components/InputEnclosure/InputEnclosure.svelte.d.ts +1 -1
- package/dist/stories/developer tools/components/Popper/Popper.stories.svelte +119 -0
- package/dist/stories/developer tools/components/Popper/Popper.stories.svelte.d.ts +21 -0
- package/dist/stories/developer tools/components/Popper/Popper.svelte +77 -0
- package/dist/stories/developer tools/components/Popper/Popper.svelte.d.ts +50 -0
- package/dist/stories/developer tools/components/Popper/PopperPopup/PopperPopup.stories.svelte +60 -0
- package/dist/stories/developer tools/components/Popper/PopperPopup/PopperPopup.stories.svelte.d.ts +21 -0
- package/dist/stories/developer tools/components/Popper/PopperPopup/PopperPopup.svelte +66 -0
- package/dist/stories/developer tools/components/Popper/PopperPopup/PopperPopup.svelte.d.ts +34 -0
- package/dist/stories/developer tools/components/Popper/PopperPopup/utils/getPopupPosition.d.ts +21 -0
- package/dist/stories/developer tools/components/Popper/PopperPopup/utils/getPopupPosition.js +62 -0
- package/dist/stories/developer tools/components/Popper/Positions/AutoPosition/AutoPosition.stories.svelte +89 -0
- package/dist/stories/developer tools/components/Popper/Positions/AutoPosition/AutoPosition.stories.svelte.d.ts +18 -0
- package/dist/stories/developer tools/components/Popper/Positions/Positions.stories.svelte +111 -0
- package/dist/stories/developer tools/components/Popper/Positions/Positions.stories.svelte.d.ts +18 -0
- package/dist/stories/developer tools/components/UtilityButton/Size/Size.stories.svelte +3 -5
- package/dist/stories/developer tools/components/UtilityButton/UtilityButton.stories.svelte +0 -4
- package/dist/stories/developer tools/components/UtilityButton/UtilityButton.svelte +5 -2
- package/dist/stories/developer tools/components/UtilityButton/UtilityButton.svelte.d.ts +1 -1
- package/dist/stories/developer tools/directives/clickOutside/clickOutside.d.ts +3 -0
- package/dist/stories/developer tools/directives/clickOutside/clickOutside.js +14 -0
- package/dist/stories/developer tools/directives/clickOutside/index.mdx +25 -0
- package/dist/styles/_z-index.css +9 -0
- package/dist/styles/global.css +1 -0
- package/dist/types/position.d.ts +4 -0
- package/dist/types/position.js +2 -0
- package/package.json +3 -3
- package/src/lib/index.ts +50 -9
- package/src/lib/stories/components/Form/Button/Button.svelte +14 -10
- package/src/lib/stories/components/Form/FormControl/FormControl.svelte +7 -4
- package/src/lib/stories/components/Form/Label/Label.svelte +4 -2
- package/src/lib/stories/components/Form/Message/Message.svelte +4 -2
- package/src/lib/stories/components/Form/PasswordInput/PasswordInput.svelte +48 -49
- package/src/lib/stories/components/Form/Select/Select.svelte +501 -0
- package/src/lib/stories/components/Form/TextInput/TextInput.svelte +32 -59
- package/src/lib/stories/components/Layout/Menu/Menu.svelte +65 -0
- package/src/lib/stories/components/Layout/Menu/MenuItem/MenuItem.svelte +268 -0
- package/src/lib/stories/components/Layout/Paper/Paper.svelte +8 -9
- package/src/lib/stories/components/Layout/Separator/Separator.svelte +96 -0
- package/src/lib/stories/components/Layout/Separator/utils/scss/mixins.scss +24 -0
- package/src/lib/stories/developer tools/components/DynamicInput/DynamicInput.svelte +195 -0
- package/src/lib/stories/developer tools/components/InputEnclosure/InputEnclosure.svelte +5 -2
- package/src/lib/stories/developer tools/components/Popper/Popper.svelte +159 -0
- package/src/lib/stories/developer tools/components/Popper/PopperPopup/PopperPopup.svelte +120 -0
- package/src/lib/stories/developer tools/components/Popper/PopperPopup/utils/getPopupPosition.ts +87 -0
- package/src/lib/stories/developer tools/components/UtilityButton/UtilityButton.svelte +4 -2
- package/src/lib/stories/developer tools/directives/clickOutside/clickOutside.ts +17 -0
- package/src/lib/styles/_z-index.css +9 -0
- package/src/lib/styles/global.css +1 -0
- package/src/lib/types/position.ts +5 -0
- package/dist/stories/components/Form/SimpleSelect/Events/Events.stories.svelte +0 -47
- package/dist/stories/components/Form/SimpleSelect/Roundness/Roundness.stories.svelte +0 -24
- package/dist/stories/components/Form/SimpleSelect/SimpleSelect.stories.svelte +0 -57
- package/dist/stories/components/Form/SimpleSelect/SimpleSelect.svelte +0 -69
- package/dist/stories/components/Form/SimpleSelect/SimpleSelect.svelte.d.ts +0 -51
- package/dist/stories/components/Form/SimpleSelect/WithIcon/WithIcon.stories.svelte +0 -36
- package/src/lib/stories/components/Form/SimpleSelect/SimpleSelect.svelte +0 -160
- /package/dist/stories/components/Form/{SimpleSelect → Select}/Events/Events.stories.svelte.d.ts +0 -0
- /package/dist/stories/components/{Form/SimpleSelect → Layout/Menu/MenuItem}/Size/Size.stories.svelte.d.ts +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -3,28 +3,49 @@ export type { ComponentColorPriority, ComponentColorSeverity, ComponentColor, }
|
|
|
3
3
|
export type { ComponentRoundness } from './types/roundness.js';
|
|
4
4
|
export type { ComponentSize } from './types/size.js';
|
|
5
5
|
export type { ComponentWeight } from './types/weight.js';
|
|
6
|
+
export type { PositionY, PositionX } from './types/position.js';
|
|
7
|
+
/** developer tools: directives: clickOutside */
|
|
8
|
+
export { clickOutside } from './stories/developer tools/directives/clickOutside/clickOutside.js';
|
|
6
9
|
/** developer tools: components: UtilityButton */
|
|
7
10
|
export { default as UtilityButton } from './stories/developer tools/components/UtilityButton/UtilityButton.svelte';
|
|
11
|
+
export type { UtilityButtonProps } from './stories/developer tools/components/UtilityButton/UtilityButton.svelte';
|
|
8
12
|
/** developer tools: components: InputEnclosure */
|
|
9
13
|
export { default as InputEnclosure } from './stories/developer tools/components/InputEnclosure/InputEnclosure.svelte';
|
|
14
|
+
export type { InputEnclosureProps } from './stories/developer tools/components/InputEnclosure/InputEnclosure.svelte';
|
|
15
|
+
/** developer tools: components: DynamicInput */
|
|
16
|
+
export { default as DynamicInput } from './stories/developer tools/components/DynamicInput/DynamicInput.svelte';
|
|
17
|
+
export type { DynamicInputVariant, DynamicInputProps, DynamicInputClickEvent, DynamicInputFocusEvent, } from './stories/developer tools/components/DynamicInput/DynamicInput.svelte';
|
|
18
|
+
/** developer tools: components: Popper */
|
|
19
|
+
export { default as Popper } from './stories/developer tools/components/Popper/Popper.svelte';
|
|
20
|
+
export type { PopperProps } from './stories/developer tools/components/Popper/Popper.svelte';
|
|
21
|
+
export { default as PopperPopup } from './stories/developer tools/components/Popper/PopperPopup/PopperPopup.svelte';
|
|
22
|
+
export type { PopperPopupProps } from './stories/developer tools/components/Popper/PopperPopup/PopperPopup.svelte';
|
|
10
23
|
/** Form: Button */
|
|
11
24
|
export { default as Button } from './stories/components/Form/Button/Button.svelte';
|
|
12
|
-
export type { ButtonLinkTarget, ButtonLinkReferrerpolicy, ButtonType, } from './stories/components/Form/Button/Button.svelte';
|
|
25
|
+
export type { ButtonLinkTarget, ButtonLinkReferrerpolicy, ButtonType, ButtonProps, ButtonClickEvent, } from './stories/components/Form/Button/Button.svelte';
|
|
13
26
|
/** Form: TextInput */
|
|
14
27
|
export { default as TextInput } from './stories/components/Form/TextInput/TextInput.svelte';
|
|
15
|
-
export type { TextInputType, TextInputFocusEvent, TextInputClipboardEvent, } from './stories/components/Form/TextInput/TextInput.svelte';
|
|
28
|
+
export type { TextInputType, TextInputFocusEvent, TextInputClipboardEvent, TextInputInputEvent, TextInputProps, } from './stories/components/Form/TextInput/TextInput.svelte';
|
|
16
29
|
/** Form: PasswordInput */
|
|
17
30
|
export { default as PasswordInput } from './stories/components/Form/PasswordInput/PasswordInput.svelte';
|
|
18
|
-
export type { PasswordInputToggleEvent } from './stories/components/Form/PasswordInput/PasswordInput.svelte';
|
|
31
|
+
export type { PasswordInputToggleEvent, PasswordInputProps, } from './stories/components/Form/PasswordInput/PasswordInput.svelte';
|
|
19
32
|
/** Form: Label */
|
|
20
33
|
export { default as Label } from './stories/components/Form/Label/Label.svelte';
|
|
34
|
+
export type { LabelProps } from './stories/components/Form/Label/Label.svelte';
|
|
21
35
|
/** Form: FormControl */
|
|
22
36
|
export { default as FormControl } from './stories/components/Form/FormControl/FormControl.svelte';
|
|
37
|
+
export type { FormControlProps } from './stories/components/Form/FormControl/FormControl.svelte';
|
|
23
38
|
/** Form: Message */
|
|
24
39
|
export { default as Message } from './stories/components/Form/Message/Message.svelte';
|
|
25
|
-
|
|
26
|
-
export { default as SimpleSelect } from './stories/components/Form/SimpleSelect/SimpleSelect.svelte';
|
|
27
|
-
export type { SimpleSelectFocusEvent, SimpleSelectOption, } from './stories/components/Form/SimpleSelect/SimpleSelect.svelte';
|
|
40
|
+
export type { MessageProps } from './stories/components/Form/Message/Message.svelte';
|
|
28
41
|
/** Layout: Paper */
|
|
29
42
|
export { default as Paper } from './stories/components/Layout/Paper/Paper.svelte';
|
|
30
|
-
export type { PaperColor } from './stories/components/Layout/Paper/Paper.svelte';
|
|
43
|
+
export type { PaperColor, PaperProps } from './stories/components/Layout/Paper/Paper.svelte';
|
|
44
|
+
/** Layout: Separator */
|
|
45
|
+
export { default as Separator } from './stories/components/Layout/Separator/Separator.svelte';
|
|
46
|
+
export type { SeparatorProps, SeparatorOrientation, } from './stories/components/Layout/Separator/Separator.svelte';
|
|
47
|
+
/** Layout: Menu */
|
|
48
|
+
export { default as Menu } from './stories/components/Layout/Menu/Menu.svelte';
|
|
49
|
+
export type { MenuProps } from './stories/components/Layout/Menu/Menu.svelte';
|
|
50
|
+
export { default as MenuItem } from './stories/components/Layout/Menu/MenuItem/MenuItem.svelte';
|
|
51
|
+
export type { MenuItemType, MenuItemProps, } from './stories/components/Layout/Menu/MenuItem/MenuItem.svelte';
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import './styles/global.css';
|
|
2
|
+
/** developer tools: directives: clickOutside */
|
|
3
|
+
export { clickOutside } from './stories/developer tools/directives/clickOutside/clickOutside.js';
|
|
2
4
|
/** developer tools: components: UtilityButton */
|
|
3
5
|
export { default as UtilityButton } from './stories/developer tools/components/UtilityButton/UtilityButton.svelte';
|
|
4
6
|
/** developer tools: components: InputEnclosure */
|
|
5
7
|
export { default as InputEnclosure } from './stories/developer tools/components/InputEnclosure/InputEnclosure.svelte';
|
|
8
|
+
/** developer tools: components: DynamicInput */
|
|
9
|
+
export { default as DynamicInput } from './stories/developer tools/components/DynamicInput/DynamicInput.svelte';
|
|
10
|
+
/** developer tools: components: Popper */
|
|
11
|
+
export { default as Popper } from './stories/developer tools/components/Popper/Popper.svelte';
|
|
12
|
+
export { default as PopperPopup } from './stories/developer tools/components/Popper/PopperPopup/PopperPopup.svelte';
|
|
6
13
|
/** Form: Button */
|
|
7
14
|
export { default as Button } from './stories/components/Form/Button/Button.svelte';
|
|
8
15
|
/** Form: TextInput */
|
|
@@ -15,7 +22,10 @@ export { default as Label } from './stories/components/Form/Label/Label.svelte';
|
|
|
15
22
|
export { default as FormControl } from './stories/components/Form/FormControl/FormControl.svelte';
|
|
16
23
|
/** Form: Message */
|
|
17
24
|
export { default as Message } from './stories/components/Form/Message/Message.svelte';
|
|
18
|
-
/** Form: SimpleSelect */
|
|
19
|
-
export { default as SimpleSelect } from './stories/components/Form/SimpleSelect/SimpleSelect.svelte';
|
|
20
25
|
/** Layout: Paper */
|
|
21
26
|
export { default as Paper } from './stories/components/Layout/Paper/Paper.svelte';
|
|
27
|
+
/** Layout: Separator */
|
|
28
|
+
export { default as Separator } from './stories/components/Layout/Separator/Separator.svelte';
|
|
29
|
+
/** Layout: Menu */
|
|
30
|
+
export { default as Menu } from './stories/components/Layout/Menu/Menu.svelte';
|
|
31
|
+
export { default as MenuItem } from './stories/components/Layout/Menu/MenuItem/MenuItem.svelte';
|
package/dist/stories/Home.mdx
CHANGED
|
@@ -54,6 +54,6 @@ import { Button } '@flightlesslabs/dodo-ui';
|
|
|
54
54
|
|
|
55
55
|
## Explore more
|
|
56
56
|
|
|
57
|
-
- [Dark Theme
|
|
57
|
+
- [Dark Theme](?path=/docs/developer-tools-philosophy-themes--docs#dark-theme)
|
|
58
58
|
- [Colors](?path=/docs/developer-tools-philosophy-colors--docs)
|
|
59
59
|
- [Adjust Color Opacity](?path=/docs/developer-tools-philosophy-colors--docs#adjusting-opacity)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts" module>export const buttonTypeArray = ['button', 'submit'];
|
|
2
2
|
</script>
|
|
3
3
|
|
|
4
|
-
<script lang="ts">
|
|
5
|
-
|
|
4
|
+
<script lang="ts">"use strict";
|
|
5
|
+
let { children, type = 'button', size = 'normal', color = 'primary', roundness = 1, variant = 'solid', outline = false, compact = false, fullWidth = false, name, id, title, class: className = '', disabled = false, onclick, before, after, href, download, hreflang, media, ping, rel, target, anchorMediaType, referrerpolicy, ref = $bindable(), } = $props();
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
{#snippet buttonContent()}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
export type ButtonLinkTarget = '_self' | '_blank' | '_parent' | '_top' | (string & {}) | undefined | null;
|
|
2
|
-
export type ButtonLinkReferrerpolicy = ReferrerPolicy | undefined | null;
|
|
3
|
-
export type ButtonType = 'button' | 'submit';
|
|
4
|
-
export declare const buttonTypeArray: ButtonType[];
|
|
5
1
|
import type { ComponentColor } from '../../../../types/colors.js';
|
|
6
2
|
import type { ComponentRoundness } from '../../../../types/roundness.js';
|
|
7
3
|
import type { ComponentSize } from '../../../../types/size.js';
|
|
8
4
|
import type { ComponentWeight } from '../../../../types/weight.js';
|
|
9
5
|
import type { Snippet } from 'svelte';
|
|
10
6
|
import type { MouseEventHandler } from 'svelte/elements';
|
|
11
|
-
|
|
7
|
+
export type ButtonLinkTarget = '_self' | '_blank' | '_parent' | '_top' | (string & {}) | undefined | null;
|
|
8
|
+
export type ButtonLinkReferrerpolicy = ReferrerPolicy | undefined | null;
|
|
9
|
+
export type ButtonType = 'button' | 'submit';
|
|
10
|
+
export declare const buttonTypeArray: ButtonType[];
|
|
11
|
+
export type ButtonClickEvent = MouseEvent & {
|
|
12
|
+
currentTarget: EventTarget & HTMLButtonElement;
|
|
13
|
+
};
|
|
14
|
+
export interface ButtonProps {
|
|
12
15
|
/** Button contents goes here */
|
|
13
16
|
children?: Snippet;
|
|
14
17
|
/** Button ref */
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
<script lang="ts" module>export {};
|
|
2
|
+
</script>
|
|
3
|
+
|
|
1
4
|
<script lang="ts">import Label from '../Label/Label.svelte';
|
|
2
5
|
import Message from '../Message/Message.svelte';
|
|
3
6
|
let { children, label, class: className = '', for: htmlFor, form, ref = $bindable(), errorMessage, } = $props();
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
1
|
+
<script lang="ts" module>export {};
|
|
2
|
+
</script>
|
|
3
|
+
|
|
4
|
+
<script lang="ts">"use strict";
|
|
5
|
+
let { children, class: className = '', for: htmlFor, form, ref = $bindable(), } = $props();
|
|
3
6
|
</script>
|
|
4
7
|
|
|
5
8
|
<label class={['dodo-ui-Label', className].join(' ')} for={htmlFor} {form} bind:this={ref}>
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
1
|
+
<script lang="ts" module>export {};
|
|
2
|
+
</script>
|
|
3
|
+
|
|
4
|
+
<script lang="ts">"use strict";
|
|
5
|
+
let { children, class: className = '', color = 'primary', ref = $bindable(), size = 'normal', } = $props();
|
|
3
6
|
</script>
|
|
4
7
|
|
|
5
8
|
<div
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ComponentColor } from '../../../../types/colors.js';
|
|
2
2
|
import type { ComponentSize } from '../../../../types/size.js';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
|
-
interface MessageProps {
|
|
4
|
+
export interface MessageProps {
|
|
5
5
|
/** Message contents goes here */
|
|
6
6
|
children?: Snippet;
|
|
7
7
|
/** Message ref */
|
|
@@ -4,21 +4,24 @@
|
|
|
4
4
|
<script lang="ts">import Icon from '@iconify/svelte';
|
|
5
5
|
import UtilityButton from '../../../developer tools/components/UtilityButton/UtilityButton.svelte';
|
|
6
6
|
import InputEnclosure from '../../../developer tools/components/InputEnclosure/InputEnclosure.svelte';
|
|
7
|
+
import { DynamicInput } from '../../../../index.js';
|
|
7
8
|
let { size = 'normal', roundness = 1, outline = true, name, id, class: className = '', disabled = false, oninput, onchange, onblur, onfocus, onpaste, oncopy, oncut, before, after, customPasswordToggleIcon, error = false, passwordToggle = true, passwordToggleState = $bindable(), value = $bindable(), placeholder, ontoggle, ref = $bindable(), readonly = false, } = $props();
|
|
8
9
|
let focused = $state(false);
|
|
9
10
|
let toggle = $state(passwordToggleState);
|
|
10
11
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
12
|
let customPasswordToggleIconTyped = customPasswordToggleIcon;
|
|
12
13
|
function onfocusMod(e) {
|
|
14
|
+
const eTyped = e;
|
|
13
15
|
focused = true;
|
|
14
16
|
if (onfocus) {
|
|
15
|
-
onfocus(
|
|
17
|
+
onfocus(eTyped);
|
|
16
18
|
}
|
|
17
19
|
}
|
|
18
20
|
function onblurMod(e) {
|
|
21
|
+
const eTyped = e;
|
|
19
22
|
focused = false;
|
|
20
23
|
if (onblur) {
|
|
21
|
-
onblur(
|
|
24
|
+
onblur(eTyped);
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
27
|
function ontoggleMod(e) {
|
|
@@ -42,11 +45,12 @@ function ontoggleMod(e) {
|
|
|
42
45
|
class={['dodo-ui-PasswordInput', `size--${size}`, `roundness--${roundness}`, className].join(' ')}
|
|
43
46
|
>
|
|
44
47
|
<InputEnclosure {outline} {disabled} {error} {focused} {size} {roundness} {before} {after}>
|
|
45
|
-
<
|
|
48
|
+
<DynamicInput
|
|
46
49
|
type={passwordToggle && toggle ? 'text' : 'password'}
|
|
47
50
|
{name}
|
|
48
51
|
{id}
|
|
49
52
|
{disabled}
|
|
53
|
+
bind:ref
|
|
50
54
|
{oninput}
|
|
51
55
|
{onchange}
|
|
52
56
|
onfocus={onfocusMod}
|
|
@@ -56,43 +60,32 @@ function ontoggleMod(e) {
|
|
|
56
60
|
{oncut}
|
|
57
61
|
{placeholder}
|
|
58
62
|
bind:value
|
|
59
|
-
bind:this={ref}
|
|
60
63
|
{readonly}
|
|
64
|
+
variant="input"
|
|
61
65
|
/>
|
|
62
66
|
|
|
63
67
|
{#if passwordToggle && !disabled}
|
|
64
|
-
<
|
|
65
|
-
{
|
|
66
|
-
{
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
<div class:after class="passwordToggle">
|
|
69
|
+
<UtilityButton {size} title="Toggle password" onclick={ontoggleMod}>
|
|
70
|
+
{#if customPasswordToggleIcon}
|
|
71
|
+
{@render customPasswordToggleIconTyped(toggle)}
|
|
72
|
+
{:else if toggle}
|
|
73
|
+
<Icon icon="mdi:eye-off" width="24" height="24" />
|
|
74
|
+
{:else}
|
|
75
|
+
<Icon icon="mdi:eye" width="24" height="24" />
|
|
76
|
+
{/if}
|
|
77
|
+
</UtilityButton>
|
|
78
|
+
</div>
|
|
73
79
|
{/if}
|
|
74
80
|
</InputEnclosure>
|
|
75
81
|
</div>
|
|
76
82
|
|
|
77
|
-
<style>.dodo-ui-PasswordInput
|
|
78
|
-
|
|
79
|
-
border: 0;
|
|
80
|
-
outline: 0;
|
|
81
|
-
height: 100%;
|
|
82
|
-
background-color: transparent;
|
|
83
|
-
font-family: inherit;
|
|
84
|
-
color: inherit;
|
|
85
|
-
letter-spacing: 0.3px;
|
|
83
|
+
<style>.dodo-ui-PasswordInput.size--normal .passwordToggle.after {
|
|
84
|
+
margin-right: calc(var(--dodo-ui-space-small) * 2);
|
|
86
85
|
}
|
|
87
|
-
.dodo-ui-PasswordInput.size--
|
|
88
|
-
|
|
89
|
-
padding: 0 calc(var(--dodo-ui-space-small) * 2);
|
|
86
|
+
.dodo-ui-PasswordInput.size--small .passwordToggle.after {
|
|
87
|
+
margin-right: var(--dodo-ui-space);
|
|
90
88
|
}
|
|
91
|
-
.dodo-ui-PasswordInput.size--
|
|
92
|
-
|
|
93
|
-
font-size: 0.9rem;
|
|
94
|
-
}
|
|
95
|
-
.dodo-ui-PasswordInput.size--large input {
|
|
96
|
-
font-size: 1.1rem;
|
|
97
|
-
padding: 0 calc(var(--dodo-ui-space) * 2);
|
|
89
|
+
.dodo-ui-PasswordInput.size--large .passwordToggle.after {
|
|
90
|
+
margin-right: calc(var(--dodo-ui-space) * 2);
|
|
98
91
|
}</style>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import type { ComponentSize } from '../../../../types/size.js';
|
|
2
|
+
import type { ComponentRoundness } from '../../../../types/roundness.js';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
import type { ChangeEventHandler, ClipboardEventHandler, FocusEventHandler, FormEventHandler } from 'svelte/elements';
|
|
1
5
|
export type PasswordInputToggleEvent = {
|
|
2
6
|
event: Event;
|
|
3
7
|
toggle: boolean;
|
|
4
8
|
};
|
|
5
|
-
|
|
6
|
-
import type { ChangeEventHandler, ClipboardEventHandler, FocusEventHandler, FormEventHandler } from 'svelte/elements';
|
|
7
|
-
import type { ComponentSize } from '../../../../types/size.js';
|
|
8
|
-
import type { ComponentRoundness } from '../../../../types/roundness.js';
|
|
9
|
-
interface PasswordInputProps {
|
|
9
|
+
export interface PasswordInputProps {
|
|
10
10
|
/** How large should the button be? */
|
|
11
11
|
size?: ComponentSize;
|
|
12
12
|
/** Input ref */
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
<script module lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
2
|
+
import Select, {} from '../Select.svelte';
|
|
3
|
+
import { selectOptions, storySelectArgTypes } from '../Select.stories.svelte';
|
|
4
|
+
import { Menu } from '../../../../../index.js';
|
|
5
|
+
import MenuItem from '../../../Layout/Menu/MenuItem/MenuItem.svelte';
|
|
6
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
7
|
+
const { Story } = defineMeta({
|
|
8
|
+
component: Select,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: storySelectArgTypes,
|
|
11
|
+
parameters: {
|
|
12
|
+
docs: {
|
|
13
|
+
story: {
|
|
14
|
+
height: '400px',
|
|
15
|
+
inline: false,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
const options = selectOptions;
|
|
21
|
+
let value = $state(options[0]);
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<!-- Format look and feel of input content. -->
|
|
25
|
+
<Story name="CustomInput" asChild>
|
|
26
|
+
<Select {options} {value} onselect={(val: SelectOption) => (value = val)}>
|
|
27
|
+
{#snippet customInputContent(selectedOption)}
|
|
28
|
+
{selectedOption.label} 💯💯💯
|
|
29
|
+
{/snippet}
|
|
30
|
+
</Select>
|
|
31
|
+
</Story>
|
|
32
|
+
|
|
33
|
+
<!-- Format look and feel of Popper menu item. -->
|
|
34
|
+
<Story name="CustomMenuItem" asChild>
|
|
35
|
+
<Select {options} {value} onselect={(val: SelectOption) => (value = val)}>
|
|
36
|
+
{#snippet customMenuItemContent(selectedOption, selected)}
|
|
37
|
+
{selected ? '✅' : ''} {selectedOption.label} 💯
|
|
38
|
+
{/snippet}
|
|
39
|
+
</Select>
|
|
40
|
+
</Story>
|
|
41
|
+
|
|
42
|
+
<!-- Format look and feel of Popper menu item Placeholder. -->
|
|
43
|
+
<Story name="CustomMenuItemPlaceholder" asChild>
|
|
44
|
+
<Select {options} {value} searchable onselect={(val: SelectOption) => (value = val)}>
|
|
45
|
+
{#snippet customPlaceholderMenuItemContent()}
|
|
46
|
+
🤚🤚🤚🤚 Nothing found....
|
|
47
|
+
{/snippet}
|
|
48
|
+
</Select>
|
|
49
|
+
</Story>
|
|
50
|
+
|
|
51
|
+
<!-- Format look and feel of Popup. -->
|
|
52
|
+
<Story name="CustomPopup" asChild>
|
|
53
|
+
<Select {options} {value}>
|
|
54
|
+
{#snippet customPopupContent(options, selectedOption)}
|
|
55
|
+
<Menu size="small" separator>
|
|
56
|
+
{#each options as option (option.value)}
|
|
57
|
+
<MenuItem
|
|
58
|
+
type="button"
|
|
59
|
+
disabled={option.disabled}
|
|
60
|
+
selected={selectedOption.value === option.value}
|
|
61
|
+
>
|
|
62
|
+
<b>{option.label}</b>
|
|
63
|
+
</MenuItem>
|
|
64
|
+
{/each}
|
|
65
|
+
</Menu>
|
|
66
|
+
{/snippet}
|
|
67
|
+
</Select>
|
|
68
|
+
</Story>
|
|
69
|
+
|
|
70
|
+
<!-- Format look and feel of Popup [Paper](?path=/docs/components-layout-paper--docs) -->
|
|
71
|
+
<Story
|
|
72
|
+
name="PaperProps"
|
|
73
|
+
args={{
|
|
74
|
+
options,
|
|
75
|
+
value,
|
|
76
|
+
paperProps: {
|
|
77
|
+
color: 'danger',
|
|
78
|
+
},
|
|
79
|
+
}}
|
|
80
|
+
/>
|
|
81
|
+
|
|
82
|
+
<!-- Format look and feel of [Popper](?path=/docs/developer-tools-components-popper--docs). We have incrased popupOffsetY in this example. -->
|
|
83
|
+
<Story
|
|
84
|
+
name="PopperProps"
|
|
85
|
+
args={{
|
|
86
|
+
options,
|
|
87
|
+
value,
|
|
88
|
+
popperProps: {
|
|
89
|
+
popupOffsetY: 40,
|
|
90
|
+
},
|
|
91
|
+
}}
|
|
92
|
+
/>
|
|
93
|
+
|
|
94
|
+
<!-- Format look and feel of Popup [Menu](?path=/docs/components-layout-menu--docs) -->
|
|
95
|
+
<Story
|
|
96
|
+
name="MenuProps"
|
|
97
|
+
args={{
|
|
98
|
+
options,
|
|
99
|
+
value,
|
|
100
|
+
menuProps: {
|
|
101
|
+
separator: true,
|
|
102
|
+
size: 'large',
|
|
103
|
+
},
|
|
104
|
+
}}
|
|
105
|
+
/>
|
|
106
|
+
|
|
107
|
+
<!-- Format look and feel of Popup [MenuItem](?path=/docs/components-layout-menu-menuitem--docs) -->
|
|
108
|
+
<Story
|
|
109
|
+
name="MenuItemProps"
|
|
110
|
+
args={{
|
|
111
|
+
options,
|
|
112
|
+
value,
|
|
113
|
+
menuItemProps: {
|
|
114
|
+
size: 'small',
|
|
115
|
+
type: 'link',
|
|
116
|
+
href: 'https://developer.mozilla.org/en-US/',
|
|
117
|
+
target: '_blank',
|
|
118
|
+
},
|
|
119
|
+
}}
|
|
120
|
+
/>
|
|
@@ -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 Customize: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type Customize = InstanceType<typeof Customize>;
|
|
18
|
+
export default Customize;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
<script module lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
2
|
+
import { selectOptions, storySelectArgTypes } from '../Select.stories.svelte';
|
|
3
|
+
import Select, {} from '../Select.svelte';
|
|
4
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
5
|
+
const { Story } = defineMeta({
|
|
6
|
+
component: Select,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
argTypes: storySelectArgTypes,
|
|
9
|
+
parameters: {
|
|
10
|
+
docs: {
|
|
11
|
+
story: {
|
|
12
|
+
height: '400px',
|
|
13
|
+
inline: false,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
const options = selectOptions;
|
|
19
|
+
let value = $state(options[0]);
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<Story
|
|
23
|
+
name="SelectEvent"
|
|
24
|
+
args={{
|
|
25
|
+
options,
|
|
26
|
+
value,
|
|
27
|
+
onselect: (val: SelectOption) => {
|
|
28
|
+
console.log('Select Event', val);
|
|
29
|
+
},
|
|
30
|
+
}}
|
|
31
|
+
/>
|
|
32
|
+
|
|
33
|
+
<Story
|
|
34
|
+
name="Clear"
|
|
35
|
+
args={{
|
|
36
|
+
options,
|
|
37
|
+
value,
|
|
38
|
+
onclear: () => {
|
|
39
|
+
console.log('Clear Event');
|
|
40
|
+
},
|
|
41
|
+
}}
|
|
42
|
+
/>
|
|
43
|
+
|
|
44
|
+
<Story
|
|
45
|
+
name="Input"
|
|
46
|
+
args={{
|
|
47
|
+
options,
|
|
48
|
+
value,
|
|
49
|
+
searchable: true,
|
|
50
|
+
oninput: (e: Event) => {
|
|
51
|
+
const target = e.target as HTMLInputElement;
|
|
52
|
+
|
|
53
|
+
console.log('Input Event', target.value);
|
|
54
|
+
},
|
|
55
|
+
}}
|
|
56
|
+
/>
|
|
57
|
+
|
|
58
|
+
<Story
|
|
59
|
+
name="Change"
|
|
60
|
+
args={{
|
|
61
|
+
options,
|
|
62
|
+
value,
|
|
63
|
+
searchable: true,
|
|
64
|
+
onchange: (e: Event) => {
|
|
65
|
+
const target = e.target as HTMLInputElement;
|
|
66
|
+
|
|
67
|
+
console.log('onChange Event', target.value);
|
|
68
|
+
},
|
|
69
|
+
}}
|
|
70
|
+
/>
|
|
71
|
+
|
|
72
|
+
<Story
|
|
73
|
+
name="Focus"
|
|
74
|
+
args={{
|
|
75
|
+
options,
|
|
76
|
+
value,
|
|
77
|
+
onfocus: (e: DynamicInputFocusEvent) => {
|
|
78
|
+
const target = e.target as HTMLInputElement | HTMLButtonElement;
|
|
79
|
+
|
|
80
|
+
console.log('onfocus Event', target);
|
|
81
|
+
},
|
|
82
|
+
}}
|
|
83
|
+
/>
|
|
84
|
+
|
|
85
|
+
<Story
|
|
86
|
+
name="Blur"
|
|
87
|
+
args={{
|
|
88
|
+
options,
|
|
89
|
+
value,
|
|
90
|
+
onblur: (e: DynamicInputFocusEvent) => {
|
|
91
|
+
const target = e.target as HTMLInputElement | HTMLButtonElement;
|
|
92
|
+
|
|
93
|
+
console.log('onblur Event', target);
|
|
94
|
+
},
|
|
95
|
+
}}
|
|
96
|
+
/>
|
|
97
|
+
|
|
98
|
+
<Story
|
|
99
|
+
name="Copy"
|
|
100
|
+
args={{
|
|
101
|
+
options,
|
|
102
|
+
value,
|
|
103
|
+
searchable: true,
|
|
104
|
+
oncopy: (e: TextInputClipboardEvent) => {
|
|
105
|
+
const target = e.target as HTMLInputElement;
|
|
106
|
+
|
|
107
|
+
console.log('oncopy Event', target);
|
|
108
|
+
},
|
|
109
|
+
}}
|
|
110
|
+
/>
|
|
111
|
+
|
|
112
|
+
<Story
|
|
113
|
+
name="Cut"
|
|
114
|
+
args={{
|
|
115
|
+
options,
|
|
116
|
+
value,
|
|
117
|
+
searchable: true,
|
|
118
|
+
oncut: (e: TextInputClipboardEvent) => {
|
|
119
|
+
const target = e.target as HTMLInputElement;
|
|
120
|
+
|
|
121
|
+
console.log('oncut Event', target);
|
|
122
|
+
},
|
|
123
|
+
}}
|
|
124
|
+
/>
|
|
125
|
+
|
|
126
|
+
<Story
|
|
127
|
+
name="Paste"
|
|
128
|
+
args={{
|
|
129
|
+
options,
|
|
130
|
+
value,
|
|
131
|
+
searchable: true,
|
|
132
|
+
onpaste: (e: TextInputClipboardEvent) => {
|
|
133
|
+
const target = e.target as HTMLInputElement;
|
|
134
|
+
|
|
135
|
+
console.log('onpaste Event', target);
|
|
136
|
+
},
|
|
137
|
+
}}
|
|
138
|
+
/>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Source } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
# Option Format
|
|
4
|
+
|
|
5
|
+
## SelectOption
|
|
6
|
+
|
|
7
|
+
<Source
|
|
8
|
+
dark
|
|
9
|
+
language="ts"
|
|
10
|
+
code={`
|
|
11
|
+
type SelectOption = {
|
|
12
|
+
value: string | number | boolean | null | undefined;
|
|
13
|
+
label: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
};
|
|
16
|
+
`}
|
|
17
|
+
/>
|
|
18
|
+
|
|
19
|
+
## Example values
|
|
20
|
+
|
|
21
|
+
<Source
|
|
22
|
+
dark
|
|
23
|
+
language="ts"
|
|
24
|
+
code={`
|
|
25
|
+
const options: SelectOption[] = [
|
|
26
|
+
{
|
|
27
|
+
value: 1,
|
|
28
|
+
label: 'One',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
value: 2,
|
|
32
|
+
label: 'Two',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
value: 3,
|
|
36
|
+
label: 'Three',
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
`}
|
|
40
|
+
/>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script module lang="ts">import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
2
|
+
import Select, {} from '../Select.svelte';
|
|
3
|
+
import { selectOptions, storySelectArgTypes } from '../Select.stories.svelte';
|
|
4
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
5
|
+
const { Story } = defineMeta({
|
|
6
|
+
component: Select,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
argTypes: storySelectArgTypes,
|
|
9
|
+
parameters: {
|
|
10
|
+
docs: {
|
|
11
|
+
story: {
|
|
12
|
+
height: '400px',
|
|
13
|
+
inline: false,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
const options = selectOptions;
|
|
19
|
+
let value = $state(options[0]);
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<Story name="Roundness 1" args={{ options, value }} />
|
|
23
|
+
|
|
24
|
+
<Story name="Roundness 2" args={{ options, value, roundness: 2 }} />
|
|
25
|
+
|
|
26
|
+
<Story name="Roundness 3" args={{ options, value, roundness: 3 }} />
|
|
27
|
+
|
|
28
|
+
<Story name="Roundness 0" args={{ options, value, roundness: 0 }} />
|