@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.
Files changed (118) hide show
  1. package/dist/index.d.ts +28 -7
  2. package/dist/index.js +12 -2
  3. package/dist/stories/Home.mdx +1 -1
  4. package/dist/stories/components/Form/Button/Button.svelte +2 -2
  5. package/dist/stories/components/Form/Button/Button.svelte.d.ts +8 -5
  6. package/dist/stories/components/Form/FormControl/FormControl.svelte +3 -0
  7. package/dist/stories/components/Form/FormControl/FormControl.svelte.d.ts +1 -1
  8. package/dist/stories/components/Form/Label/Label.svelte +5 -2
  9. package/dist/stories/components/Form/Label/Label.svelte.d.ts +1 -1
  10. package/dist/stories/components/Form/Message/Message.svelte +5 -2
  11. package/dist/stories/components/Form/Message/Message.svelte.d.ts +1 -1
  12. package/dist/stories/components/Form/PasswordInput/PasswordInput.svelte +25 -32
  13. package/dist/stories/components/Form/PasswordInput/PasswordInput.svelte.d.ts +5 -5
  14. package/dist/stories/components/Form/Select/Customize/Customize.stories.svelte +120 -0
  15. package/dist/stories/components/Form/Select/Customize/Customize.stories.svelte.d.ts +18 -0
  16. package/dist/stories/components/Form/Select/Events/Events.stories.svelte +138 -0
  17. package/dist/stories/components/Form/Select/Options/OptionFormat.mdx +40 -0
  18. package/dist/stories/components/Form/Select/Roundness/Roundness.stories.svelte +28 -0
  19. package/dist/stories/components/Form/Select/Roundness/Roundness.stories.svelte.d.ts +18 -0
  20. package/dist/stories/components/Form/Select/Select.stories.svelte +114 -0
  21. package/dist/stories/components/Form/Select/Select.stories.svelte.d.ts +22 -0
  22. package/dist/stories/components/Form/Select/Select.svelte +285 -0
  23. package/dist/stories/components/Form/Select/Select.svelte.d.ts +87 -0
  24. package/dist/stories/components/Form/Select/Size/Size.stories.svelte +24 -0
  25. package/dist/stories/components/Form/Select/Size/Size.stories.svelte.d.ts +18 -0
  26. package/dist/stories/components/Form/Select/WithIcon/WithIcon.stories.svelte +39 -0
  27. package/dist/stories/components/Form/Select/WithIcon/WithIcon.stories.svelte.d.ts +18 -0
  28. package/dist/stories/components/Form/TextInput/TextInput.svelte +9 -28
  29. package/dist/stories/components/Form/TextInput/TextInput.svelte.d.ts +8 -5
  30. package/dist/stories/components/Layout/Menu/Menu.stories.svelte +65 -0
  31. package/dist/stories/components/Layout/Menu/Menu.stories.svelte.d.ts +21 -0
  32. package/dist/stories/components/Layout/Menu/Menu.svelte +30 -0
  33. package/dist/stories/components/Layout/Menu/Menu.svelte.d.ts +23 -0
  34. package/dist/stories/components/Layout/Menu/MenuItem/MenuItem.stories.svelte +30 -0
  35. package/dist/stories/components/Layout/Menu/MenuItem/MenuItem.stories.svelte.d.ts +21 -0
  36. package/dist/stories/components/Layout/Menu/MenuItem/MenuItem.svelte +164 -0
  37. package/dist/stories/components/Layout/Menu/MenuItem/MenuItem.svelte.d.ts +49 -0
  38. package/dist/stories/components/Layout/Menu/MenuItem/Size/Size.stories.svelte +16 -0
  39. package/dist/stories/components/Layout/Menu/MenuItem/Type/Type.stories.svelte +21 -0
  40. package/dist/stories/components/{Form/SimpleSelect/WithIcon/WithIcon.stories.svelte.d.ts → Layout/Menu/MenuItem/Type/Type.stories.svelte.d.ts} +3 -3
  41. package/dist/stories/components/Layout/Menu/Size/Size.stories.svelte +37 -0
  42. package/dist/stories/components/{Form/SimpleSelect/Roundness/Roundness.stories.svelte.d.ts → Layout/Menu/Size/Size.stories.svelte.d.ts} +3 -3
  43. package/dist/stories/components/Layout/Paper/Color/Color.stories.svelte +1 -1
  44. package/dist/stories/components/Layout/Paper/Paper.stories.svelte +1 -1
  45. package/dist/stories/components/Layout/Paper/Paper.svelte.d.ts +5 -5
  46. package/dist/stories/components/Layout/Separator/Color/Color.stories.svelte +19 -0
  47. package/dist/stories/components/Layout/Separator/Color/Color.stories.svelte.d.ts +26 -0
  48. package/dist/stories/components/Layout/Separator/Separator.stories.svelte +26 -0
  49. package/dist/stories/components/Layout/Separator/Separator.stories.svelte.d.ts +21 -0
  50. package/dist/stories/components/Layout/Separator/Separator.svelte +66 -0
  51. package/dist/stories/components/Layout/Separator/Separator.svelte.d.ts +22 -0
  52. package/dist/stories/components/Layout/Separator/utils/scss/mixins.scss +24 -0
  53. package/dist/stories/developer tools/components/DynamicInput/DynamicInput.stories.svelte +49 -0
  54. package/dist/stories/{components/Form/SimpleSelect/SimpleSelect.stories.svelte.d.ts → developer tools/components/DynamicInput/DynamicInput.stories.svelte.d.ts } +5 -7
  55. package/dist/stories/developer tools/components/DynamicInput/DynamicInput.svelte +92 -0
  56. package/dist/stories/developer tools/components/DynamicInput/DynamicInput.svelte.d.ts +60 -0
  57. package/dist/stories/{components/Form/SimpleSelect/Size/Size.stories.svelte → developer tools/components/DynamicInput/Size/Size.stories.svelte } +5 -8
  58. package/dist/stories/developer tools/components/DynamicInput/Size/Size.stories.svelte.d.ts +26 -0
  59. package/dist/stories/developer tools/components/InputEnclosure/InputEnclosure.svelte +6 -2
  60. package/dist/stories/developer tools/components/InputEnclosure/InputEnclosure.svelte.d.ts +1 -1
  61. package/dist/stories/developer tools/components/Popper/Popper.stories.svelte +119 -0
  62. package/dist/stories/developer tools/components/Popper/Popper.stories.svelte.d.ts +21 -0
  63. package/dist/stories/developer tools/components/Popper/Popper.svelte +77 -0
  64. package/dist/stories/developer tools/components/Popper/Popper.svelte.d.ts +50 -0
  65. package/dist/stories/developer tools/components/Popper/PopperPopup/PopperPopup.stories.svelte +60 -0
  66. package/dist/stories/developer tools/components/Popper/PopperPopup/PopperPopup.stories.svelte.d.ts +21 -0
  67. package/dist/stories/developer tools/components/Popper/PopperPopup/PopperPopup.svelte +66 -0
  68. package/dist/stories/developer tools/components/Popper/PopperPopup/PopperPopup.svelte.d.ts +34 -0
  69. package/dist/stories/developer tools/components/Popper/PopperPopup/utils/getPopupPosition.d.ts +21 -0
  70. package/dist/stories/developer tools/components/Popper/PopperPopup/utils/getPopupPosition.js +62 -0
  71. package/dist/stories/developer tools/components/Popper/Positions/AutoPosition/AutoPosition.stories.svelte +89 -0
  72. package/dist/stories/developer tools/components/Popper/Positions/AutoPosition/AutoPosition.stories.svelte.d.ts +18 -0
  73. package/dist/stories/developer tools/components/Popper/Positions/Positions.stories.svelte +111 -0
  74. package/dist/stories/developer tools/components/Popper/Positions/Positions.stories.svelte.d.ts +18 -0
  75. package/dist/stories/developer tools/components/UtilityButton/Size/Size.stories.svelte +3 -5
  76. package/dist/stories/developer tools/components/UtilityButton/UtilityButton.stories.svelte +0 -4
  77. package/dist/stories/developer tools/components/UtilityButton/UtilityButton.svelte +5 -2
  78. package/dist/stories/developer tools/components/UtilityButton/UtilityButton.svelte.d.ts +1 -1
  79. package/dist/stories/developer tools/directives/clickOutside/clickOutside.d.ts +3 -0
  80. package/dist/stories/developer tools/directives/clickOutside/clickOutside.js +14 -0
  81. package/dist/stories/developer tools/directives/clickOutside/index.mdx +25 -0
  82. package/dist/styles/_z-index.css +9 -0
  83. package/dist/styles/global.css +1 -0
  84. package/dist/types/position.d.ts +4 -0
  85. package/dist/types/position.js +2 -0
  86. package/package.json +3 -3
  87. package/src/lib/index.ts +50 -9
  88. package/src/lib/stories/components/Form/Button/Button.svelte +14 -10
  89. package/src/lib/stories/components/Form/FormControl/FormControl.svelte +7 -4
  90. package/src/lib/stories/components/Form/Label/Label.svelte +4 -2
  91. package/src/lib/stories/components/Form/Message/Message.svelte +4 -2
  92. package/src/lib/stories/components/Form/PasswordInput/PasswordInput.svelte +48 -49
  93. package/src/lib/stories/components/Form/Select/Select.svelte +501 -0
  94. package/src/lib/stories/components/Form/TextInput/TextInput.svelte +32 -59
  95. package/src/lib/stories/components/Layout/Menu/Menu.svelte +65 -0
  96. package/src/lib/stories/components/Layout/Menu/MenuItem/MenuItem.svelte +268 -0
  97. package/src/lib/stories/components/Layout/Paper/Paper.svelte +8 -9
  98. package/src/lib/stories/components/Layout/Separator/Separator.svelte +96 -0
  99. package/src/lib/stories/components/Layout/Separator/utils/scss/mixins.scss +24 -0
  100. package/src/lib/stories/developer tools/components/DynamicInput/DynamicInput.svelte +195 -0
  101. package/src/lib/stories/developer tools/components/InputEnclosure/InputEnclosure.svelte +5 -2
  102. package/src/lib/stories/developer tools/components/Popper/Popper.svelte +159 -0
  103. package/src/lib/stories/developer tools/components/Popper/PopperPopup/PopperPopup.svelte +120 -0
  104. package/src/lib/stories/developer tools/components/Popper/PopperPopup/utils/getPopupPosition.ts +87 -0
  105. package/src/lib/stories/developer tools/components/UtilityButton/UtilityButton.svelte +4 -2
  106. package/src/lib/stories/developer tools/directives/clickOutside/clickOutside.ts +17 -0
  107. package/src/lib/styles/_z-index.css +9 -0
  108. package/src/lib/styles/global.css +1 -0
  109. package/src/lib/types/position.ts +5 -0
  110. package/dist/stories/components/Form/SimpleSelect/Events/Events.stories.svelte +0 -47
  111. package/dist/stories/components/Form/SimpleSelect/Roundness/Roundness.stories.svelte +0 -24
  112. package/dist/stories/components/Form/SimpleSelect/SimpleSelect.stories.svelte +0 -57
  113. package/dist/stories/components/Form/SimpleSelect/SimpleSelect.svelte +0 -69
  114. package/dist/stories/components/Form/SimpleSelect/SimpleSelect.svelte.d.ts +0 -51
  115. package/dist/stories/components/Form/SimpleSelect/WithIcon/WithIcon.stories.svelte +0 -36
  116. package/src/lib/stories/components/Form/SimpleSelect/SimpleSelect.svelte +0 -160
  117. /package/dist/stories/components/Form/{SimpleSelect → Select}/Events/Events.stories.svelte.d.ts +0 -0
  118. /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
- /** Form: SimpleSelect */
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';
@@ -54,6 +54,6 @@ import { Button } '@flightlesslabs/dodo-ui';
54
54
 
55
55
  ## Explore more
56
56
 
57
- - [Dark Theme ?](?path=/docs/developer-tools-philosophy-themes--docs#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">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();
5
- export {};
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
- interface ButtonProps {
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,5 @@
1
1
  import type { Snippet } from 'svelte';
2
- interface FormControlProps {
2
+ export interface FormControlProps {
3
3
  /** FormControl contents goes here */
4
4
  children?: Snippet;
5
5
  /** Label for FormControl */
@@ -1,5 +1,8 @@
1
- <script lang="ts">let { children, class: className = '', for: htmlFor, form, ref = $bindable(), } = $props();
2
- export {};
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,5 @@
1
1
  import type { Snippet } from 'svelte';
2
- interface LabelProps {
2
+ export interface LabelProps {
3
3
  /** Label contents goes here */
4
4
  children?: Snippet;
5
5
  /** Label ref */
@@ -1,5 +1,8 @@
1
- <script lang="ts">let { children, class: className = '', color = 'primary', ref = $bindable(), size = 'normal', } = $props();
2
- export {};
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(e);
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(e);
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
- <input
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
- <UtilityButton {size} title="Toggle password" class="passwordToggle" onclick={ontoggleMod}>
65
- {#if customPasswordToggleIcon}
66
- {@render customPasswordToggleIconTyped(toggle)}
67
- {:else if toggle}
68
- <Icon icon="mdi:eye-off" width="24" height="24" />
69
- {:else}
70
- <Icon icon="mdi:eye" width="24" height="24" />
71
- {/if}
72
- </UtilityButton>
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 input {
78
- flex: 1;
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--normal input {
88
- font-size: 1rem;
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--small input {
92
- padding: 0 var(--dodo-ui-space);
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
- import type { Snippet } from 'svelte';
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 }} />