fuma 1.0.20 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/README.md +1 -1
  2. package/dist/action/list/handlers.d.ts +2 -2
  3. package/dist/action/list/index.d.ts +2 -0
  4. package/dist/action/list/index.js +1 -0
  5. package/dist/action/list/trigger.d.ts +7 -1
  6. package/dist/action/list/trigger.js +2 -2
  7. package/dist/private/Meta.svelte +32 -27
  8. package/dist/private/Meta.svelte.d.ts +29 -17
  9. package/dist/private/api.d.ts +1 -1
  10. package/dist/private/store.d.ts +0 -1
  11. package/dist/server/parseFormData.d.ts +1 -1
  12. package/dist/server/parseQuery.d.ts +1 -1
  13. package/dist/server/sse.d.ts +0 -1
  14. package/dist/store/isSmallScreen.d.ts +0 -1
  15. package/dist/store/param.d.ts +0 -2
  16. package/dist/store/session.d.ts +0 -1
  17. package/dist/ui/badge/Badge.svelte +4 -3
  18. package/dist/ui/badge/Badge.svelte.d.ts +19 -15
  19. package/dist/ui/button/ButtonCopy.svelte +35 -32
  20. package/dist/ui/button/ButtonCopy.svelte.d.ts +23 -21
  21. package/dist/ui/button/ButtonDelete.svelte +23 -21
  22. package/dist/ui/button/ButtonDelete.svelte.d.ts +32 -20
  23. package/dist/ui/card/Card.svelte +13 -10
  24. package/dist/ui/card/Card.svelte.d.ts +39 -24
  25. package/dist/ui/card/CardBasic.svelte +5 -4
  26. package/dist/ui/card/CardBasic.svelte.d.ts +29 -18
  27. package/dist/ui/card/CardCollapse.svelte +35 -31
  28. package/dist/ui/card/CardCollapse.svelte.d.ts +37 -23
  29. package/dist/ui/card/CardFullScreen.svelte +8 -6
  30. package/dist/ui/card/CardFullScreen.svelte.d.ts +35 -20
  31. package/dist/ui/card/CardLink.svelte +5 -4
  32. package/dist/ui/card/CardLink.svelte.d.ts +29 -18
  33. package/dist/ui/dialog/Dialog.svelte +41 -34
  34. package/dist/ui/dialog/Dialog.svelte.d.ts +36 -23
  35. package/dist/ui/dialog/DialogConfirm.svelte +6 -4
  36. package/dist/ui/dialog/DialogConfirm.svelte.d.ts +33 -19
  37. package/dist/ui/drawer/Drawer.svelte +47 -38
  38. package/dist/ui/drawer/Drawer.svelte.d.ts +81 -46
  39. package/dist/ui/drawer/drawerFly.d.ts +0 -1
  40. package/dist/ui/drawer/layers.d.ts +0 -1
  41. package/dist/ui/form/Form.svelte +106 -87
  42. package/dist/ui/form/Form.svelte.d.ts +29 -16
  43. package/dist/ui/form/FormInput.svelte +12 -6
  44. package/dist/ui/form/FormSection.svelte +24 -17
  45. package/dist/ui/form/FormSection.svelte.d.ts +37 -25
  46. package/dist/ui/icon/Icon.svelte +35 -32
  47. package/dist/ui/icon/Icon.svelte.d.ts +25 -21
  48. package/dist/ui/index.d.ts +0 -1
  49. package/dist/ui/index.js +0 -1
  50. package/dist/ui/input/FormControl.svelte +48 -36
  51. package/dist/ui/input/FormControl.svelte.d.ts +32 -30
  52. package/dist/ui/input/InputBoolean.svelte +29 -22
  53. package/dist/ui/input/InputBoolean.svelte.d.ts +43 -35
  54. package/dist/ui/input/InputCheckboxs.svelte +37 -34
  55. package/dist/ui/input/InputCheckboxs.svelte.d.ts +54 -39
  56. package/dist/ui/input/InputCheckboxsMenu.svelte +64 -47
  57. package/dist/ui/input/InputCheckboxsMenu.svelte.d.ts +56 -41
  58. package/dist/ui/input/InputCheckboxsTree.svelte +9 -6
  59. package/dist/ui/input/InputCheckboxsTree.svelte.d.ts +22 -18
  60. package/dist/ui/input/InputCheckboxsTreeNodes.svelte +36 -28
  61. package/dist/ui/input/InputCheckboxsTreeNodes.svelte.d.ts +20 -16
  62. package/dist/ui/input/InputCombo.svelte +76 -65
  63. package/dist/ui/input/InputCombo.svelte.d.ts +55 -39
  64. package/dist/ui/input/InputDate.svelte +36 -29
  65. package/dist/ui/input/InputDate.svelte.d.ts +20 -16
  66. package/dist/ui/input/InputDateTime.svelte +37 -30
  67. package/dist/ui/input/InputDateTime.svelte.d.ts +20 -16
  68. package/dist/ui/input/InputImage.svelte +52 -45
  69. package/dist/ui/input/InputImage.svelte.d.ts +40 -27
  70. package/dist/ui/input/InputImagePreview.svelte +24 -20
  71. package/dist/ui/input/InputImagePreview.svelte.d.ts +25 -21
  72. package/dist/ui/input/InputNumber.svelte +28 -22
  73. package/dist/ui/input/InputNumber.svelte.d.ts +20 -20
  74. package/dist/ui/input/InputOptionInParam.svelte +12 -10
  75. package/dist/ui/input/InputOptionInParam.svelte.d.ts +21 -17
  76. package/dist/ui/input/InputOptions.svelte +40 -34
  77. package/dist/ui/input/InputOptions.svelte.d.ts +19 -15
  78. package/dist/ui/input/InputPassword.svelte +22 -18
  79. package/dist/ui/input/InputPassword.svelte.d.ts +43 -35
  80. package/dist/ui/input/InputRadio.svelte +51 -46
  81. package/dist/ui/input/InputRadio.svelte.d.ts +53 -38
  82. package/dist/ui/input/InputRelation.svelte +129 -112
  83. package/dist/ui/input/InputRelation.svelte.d.ts +39 -53
  84. package/dist/ui/input/InputRelations.svelte +96 -90
  85. package/dist/ui/input/InputRelations.svelte.d.ts +35 -37
  86. package/dist/ui/input/InputSearch.svelte +14 -11
  87. package/dist/ui/input/InputSearch.svelte.d.ts +25 -21
  88. package/dist/ui/input/InputSelect.svelte +59 -46
  89. package/dist/ui/input/InputSelect.svelte.d.ts +23 -19
  90. package/dist/ui/input/InputText.svelte +29 -28
  91. package/dist/ui/input/InputText.svelte.d.ts +41 -28
  92. package/dist/ui/input/InputTextarea.svelte +20 -19
  93. package/dist/ui/input/InputTextarea.svelte.d.ts +20 -20
  94. package/dist/ui/input/InputTime.svelte +43 -36
  95. package/dist/ui/input/InputTime.svelte.d.ts +21 -36
  96. package/dist/ui/input/RelationAfter.svelte +13 -9
  97. package/dist/ui/input/RelationAfter.svelte.d.ts +24 -20
  98. package/dist/ui/input/SelectorList.svelte +16 -12
  99. package/dist/ui/input/SelectorList.svelte.d.ts +29 -20
  100. package/dist/ui/input/textRich/InputTextRich.svelte +63 -59
  101. package/dist/ui/input/textRich/InputTextRich.svelte.d.ts +36 -38
  102. package/dist/ui/input/textRich/SuggesionList.svelte +13 -9
  103. package/dist/ui/input/textRich/SuggesionList.svelte.d.ts +19 -15
  104. package/dist/ui/input/textRich/ToolMark.svelte +12 -9
  105. package/dist/ui/input/textRich/ToolMark.svelte.d.ts +22 -18
  106. package/dist/ui/input/textRich/ToolMarkColor.svelte +16 -12
  107. package/dist/ui/input/textRich/ToolMarkColor.svelte.d.ts +21 -17
  108. package/dist/ui/input/textRich/ToolMarkLink.svelte +46 -38
  109. package/dist/ui/input/textRich/ToolMarkLink.svelte.d.ts +18 -14
  110. package/dist/ui/input/textRich/ToolMenu.svelte +34 -19
  111. package/dist/ui/input/textRich/ToolMenu.svelte.d.ts +30 -26
  112. package/dist/ui/input/textRich/ToolMenuAlign.svelte +13 -9
  113. package/dist/ui/input/textRich/ToolMenuAlign.svelte.d.ts +18 -14
  114. package/dist/ui/input/textRich/ToolMenuInsert.svelte +12 -7
  115. package/dist/ui/input/textRich/ToolMenuInsert.svelte.d.ts +20 -16
  116. package/dist/ui/input/textRich/ToolMenuNode.svelte +14 -10
  117. package/dist/ui/input/textRich/ToolMenuNode.svelte.d.ts +18 -14
  118. package/dist/ui/input/textRich/ToolsBar.svelte +21 -14
  119. package/dist/ui/input/textRich/ToolsBar.svelte.d.ts +19 -17
  120. package/dist/ui/input/textRich/suggestion.d.ts +0 -1
  121. package/dist/ui/login/Login.svelte +37 -31
  122. package/dist/ui/login/Login.svelte.d.ts +18 -14
  123. package/dist/ui/menu/ContextMenu.svelte +37 -31
  124. package/dist/ui/menu/ContextMenu.svelte.d.ts +38 -25
  125. package/dist/ui/menu/DropDown.svelte +92 -83
  126. package/dist/ui/menu/DropDown.svelte.d.ts +46 -33
  127. package/dist/ui/menu/DropDownMenu.svelte +25 -18
  128. package/dist/ui/menu/DropDownMenu.svelte.d.ts +30 -19
  129. package/dist/ui/mode/ToggleMode.svelte +28 -16
  130. package/dist/ui/mode/ToggleMode.svelte.d.ts +34 -17
  131. package/dist/ui/pagination/Pagination.svelte +9 -8
  132. package/dist/ui/pagination/Pagination.svelte.d.ts +18 -14
  133. package/dist/ui/placeholder/Placeholder.svelte +4 -3
  134. package/dist/ui/placeholder/Placeholder.svelte.d.ts +28 -17
  135. package/dist/ui/placeholder/PlaceholderImage.svelte +6 -4
  136. package/dist/ui/placeholder/PlaceholderImage.svelte.d.ts +28 -17
  137. package/dist/ui/range/RangePicker.svelte +76 -63
  138. package/dist/ui/range/RangePicker.svelte.d.ts +29 -24
  139. package/dist/ui/range/RangePickerButton.svelte +43 -35
  140. package/dist/ui/range/RangePickerButton.svelte.d.ts +21 -17
  141. package/dist/ui/table/Table.svelte +35 -28
  142. package/dist/ui/table/Table.svelte.d.ts +24 -19
  143. package/dist/ui/table/TableBody.svelte +18 -12
  144. package/dist/ui/table/TableBody.svelte.d.ts +20 -15
  145. package/dist/ui/table/TableCell.svelte +13 -10
  146. package/dist/ui/table/TableCell.svelte.d.ts +19 -14
  147. package/dist/ui/table/TableFieldsEdition.svelte +58 -52
  148. package/dist/ui/table/TableFieldsEdition.svelte.d.ts +20 -15
  149. package/dist/ui/table/TableHead.svelte +20 -21
  150. package/dist/ui/table/TableHead.svelte.d.ts +19 -14
  151. package/dist/ui/table/TableViewSelect.svelte +50 -37
  152. package/dist/ui/table/TableViewSelect.svelte.d.ts +27 -23
  153. package/dist/ui/table/cell/TableCellArray.svelte +5 -3
  154. package/dist/ui/table/cell/TableCellArray.svelte.d.ts +18 -14
  155. package/dist/ui/table/cell/TableCellBoolean.svelte +4 -3
  156. package/dist/ui/table/cell/TableCellBoolean.svelte.d.ts +18 -14
  157. package/dist/ui/table/cell/TableCellNumber.svelte +2 -1
  158. package/dist/ui/table/cell/TableCellNumber.svelte.d.ts +18 -14
  159. package/dist/ui/table/cell/TableCellString.svelte +5 -2
  160. package/dist/ui/table/cell/TableCellString.svelte.d.ts +19 -25
  161. package/dist/ui/table/field.d.ts +32 -40
  162. package/dist/ui/table/field.js +1 -1
  163. package/dist/ui/table/head/TableHeadBoolean.svelte +6 -3
  164. package/dist/ui/table/head/TableHeadBoolean.svelte.d.ts +18 -24
  165. package/dist/ui/table/head/TableHeadDate.svelte +61 -113
  166. package/dist/ui/table/head/TableHeadDate.svelte.d.ts +18 -24
  167. package/dist/ui/table/head/TableHeadDefault.svelte +5 -2
  168. package/dist/ui/table/head/TableHeadDefault.svelte.d.ts +18 -24
  169. package/dist/ui/table/head/TableHeadNumber.svelte +67 -76
  170. package/dist/ui/table/head/TableHeadNumber.svelte.d.ts +18 -24
  171. package/dist/ui/table/head/TableHeadSelect.svelte +47 -41
  172. package/dist/ui/table/head/TableHeadSelect.svelte.d.ts +21 -27
  173. package/dist/ui/table/head/TableHeadString.svelte +14 -8
  174. package/dist/ui/table/head/TableHeadString.svelte.d.ts +18 -24
  175. package/dist/ui/tabs/Tabs.svelte +8 -5
  176. package/dist/ui/tabs/Tabs.svelte.d.ts +19 -15
  177. package/dist/ui/tabs/TabsIcon.svelte +31 -28
  178. package/dist/ui/tabs/TabsIcon.svelte.d.ts +21 -17
  179. package/dist/utils/eventEmitter.d.ts +4 -4
  180. package/dist/utils/tippy.d.ts +1 -1
  181. package/dist/validation/form.d.ts +0 -1
  182. package/dist/validation/zod.d.ts +96 -162
  183. package/dist/validation/zod.js +2 -4
  184. package/package.json +134 -138
  185. package/dist/ui/form/FormInput.svelte.d.ts +0 -152
  186. package/dist/ui/form/formInput.d.ts +0 -90
  187. package/dist/ui/slot/Slot.svelte +0 -35
  188. package/dist/ui/slot/Slot.svelte.d.ts +0 -22
  189. package/dist/ui/slot/Span.svelte +0 -4
  190. package/dist/ui/slot/Span.svelte.d.ts +0 -16
  191. package/dist/ui/slot/index.d.ts +0 -1
  192. package/dist/ui/slot/index.js +0 -1
  193. package/dist/ui/table/head/OrderButtons.svelte +0 -37
  194. package/dist/ui/table/head/OrderButtons.svelte.d.ts +0 -20
  195. package/dist/ui/table/head/index.d.ts +0 -19
@@ -1,55 +1,53 @@
1
- import { SvelteComponent } from "svelte";
2
1
  import type { HTMLInputAttributes } from 'svelte/elements';
3
- import type { ComponentAndProps } from '../../utils/component.js';
2
+ import { type Snippet } from 'svelte';
4
3
  declare class __sveltets_Render<RelationItem extends {
5
- id: string;
4
+ id: string | number;
6
5
  }> {
7
6
  props(): {
8
- key?: string | undefined;
9
- label?: string | undefined;
7
+ key?: string;
8
+ label?: string;
10
9
  search: (q: string) => Promise<RelationItem[]>;
11
- createUrl?: string | undefined;
12
- createTitle?: string | undefined;
10
+ createUrl?: string;
11
+ createTitle?: string;
13
12
  createIcon?: string | undefined;
14
- error?: string | undefined;
15
- placeholder?: string | undefined;
16
- flatMode?: boolean | undefined;
17
- slotItem?: ((item: RelationItem) => string | ComponentAndProps) | null | undefined;
18
- slotSuggestion?: ((item: RelationItem) => string | ComponentAndProps) | null | undefined;
13
+ error?: string;
14
+ placeholder?: string;
15
+ flatMode?: boolean;
16
+ slotItem: Snippet<[RelationItem]>;
17
+ slotSuggestion?: Snippet<[RelationItem]> | undefined;
19
18
  input?: HTMLInputAttributes | undefined;
20
- class?: string | undefined;
21
- classList?: string | undefined;
19
+ append?: Snippet | undefined;
20
+ class?: string;
21
+ classList?: string;
22
22
  value?: RelationItem[] | null | undefined;
23
23
  };
24
24
  events(): {
25
25
  input: CustomEvent<{
26
- value: string[];
26
+ value: (string | number)[];
27
27
  items: RelationItem[];
28
28
  }>;
29
29
  } & {
30
30
  [evt: string]: CustomEvent<any>;
31
31
  };
32
- slots(): {
33
- item: {
34
- item: RelationItem;
35
- };
36
- append: {};
37
- suggestion: {
38
- item: RelationItem;
39
- };
40
- };
32
+ slots(): {};
33
+ bindings(): string;
34
+ exports(): {};
41
35
  }
42
- export type InputRelationsProps<RelationItem extends {
43
- id: string;
44
- }> = ReturnType<__sveltets_Render<RelationItem>['props']>;
45
- export type InputRelationsEvents<RelationItem extends {
46
- id: string;
47
- }> = ReturnType<__sveltets_Render<RelationItem>['events']>;
48
- export type InputRelationsSlots<RelationItem extends {
49
- id: string;
50
- }> = ReturnType<__sveltets_Render<RelationItem>['slots']>;
51
- export default class InputRelations<RelationItem extends {
52
- id: string;
53
- }> extends SvelteComponent<InputRelationsProps<RelationItem>, InputRelationsEvents<RelationItem>, InputRelationsSlots<RelationItem>> {
36
+ interface $$IsomorphicComponent {
37
+ new <RelationItem extends {
38
+ id: string | number;
39
+ }>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<RelationItem>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<RelationItem>['props']>, ReturnType<__sveltets_Render<RelationItem>['events']>, ReturnType<__sveltets_Render<RelationItem>['slots']>> & {
40
+ $$bindings?: ReturnType<__sveltets_Render<RelationItem>['bindings']>;
41
+ } & ReturnType<__sveltets_Render<RelationItem>['exports']>;
42
+ <RelationItem extends {
43
+ id: string | number;
44
+ }>(internal: unknown, props: ReturnType<__sveltets_Render<RelationItem>['props']> & {
45
+ $$events?: ReturnType<__sveltets_Render<RelationItem>['events']>;
46
+ }): ReturnType<__sveltets_Render<RelationItem>['exports']>;
47
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
54
48
  }
55
- export {};
49
+ declare const InputRelations: $$IsomorphicComponent;
50
+ type InputRelations<RelationItem extends {
51
+ id: string | number;
52
+ }> = InstanceType<typeof InputRelations<RelationItem>>;
53
+ export default InputRelations;
@@ -1,13 +1,16 @@
1
- <script>import { mdiClose } from "@mdi/js";
2
- import { browser } from "$app/environment";
3
- import { page } from "$app/stores";
4
- import { Icon } from "../icon/index.js";
5
- import { InputText } from "./index.js";
6
- let klass = "";
7
- export { klass as class };
8
- export let key = "search";
9
- export let value = $page.url.searchParams.get(key) || "";
10
- let inputElement;
1
+ <script lang="ts">
2
+ import { mdiClose } from '@mdi/js'
3
+ import { browser } from '$app/environment'
4
+ import { page } from '$app/stores'
5
+ import { Icon } from '../icon/index.js'
6
+ import { InputText } from './index.js'
7
+
8
+ let klass = ''
9
+ export { klass as class }
10
+ export let key = 'search'
11
+ export let value = $page.url.searchParams.get(key) || ''
12
+
13
+ let inputElement: HTMLInputElement
11
14
  </script>
12
15
 
13
16
  <InputText
@@ -23,7 +26,7 @@ let inputElement;
23
26
  input={{
24
27
  class: 'input-sm pr-8',
25
28
  placeholder: 'Recherche',
26
- autocomplete: 'fuck-off',
29
+ autocomplete: 'off',
27
30
  inputmode: 'search'
28
31
  }}
29
32
  classWrapper="relative {klass}"
@@ -1,23 +1,27 @@
1
- import { SvelteComponent } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- class?: string | undefined;
5
- key?: string | undefined;
6
- value?: string | undefined;
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: Props & {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
7
11
  };
8
- events: {
9
- blur: FocusEvent;
10
- input: Event;
11
- keydown: KeyboardEvent;
12
- keyup: KeyboardEvent;
13
- } & {
14
- [evt: string]: CustomEvent<any>;
15
- };
16
- slots: {};
17
- };
18
- export type InputSearchProps = typeof __propDef.props;
19
- export type InputSearchEvents = typeof __propDef.events;
20
- export type InputSearchSlots = typeof __propDef.slots;
21
- export default class InputSearch extends SvelteComponent<InputSearchProps, InputSearchEvents, InputSearchSlots> {
12
+ z_$$bindings?: Bindings;
22
13
  }
23
- export {};
14
+ declare const InputSearch: $$__sveltets_2_IsomorphicComponent<{
15
+ class?: string;
16
+ key?: string;
17
+ value?: string;
18
+ }, {
19
+ blur: FocusEvent;
20
+ input: Event;
21
+ keydown: KeyboardEvent;
22
+ keyup: KeyboardEvent;
23
+ } & {
24
+ [evt: string]: CustomEvent<any>;
25
+ }, {}, {}, string>;
26
+ type InputSearch = InstanceType<typeof InputSearch>;
27
+ export default InputSearch;
@@ -1,55 +1,68 @@
1
- <script>import { createEventDispatcher, onMount } from "svelte";
2
- import { mdiUnfoldMoreHorizontal } from "@mdi/js";
3
- import { Icon } from "../icon/index.js";
4
- import { DropDown } from "../menu/index.js";
5
- import { SelectorList, FormControl } from "./index.js";
6
- import { parseOptions } from "../../utils/options.js";
7
- $:
8
- ({ value: _value, options, tippyProps, placeholder, ...props } = $$props);
9
- export let value = _value;
10
- $:
11
- _options = parseOptions(options);
12
- $:
13
- selectedOption = _options.find((opt) => opt.value === value);
14
- let dropDown;
15
- let button;
16
- const dispatch = createEventDispatcher();
17
- let focusIndex = 0;
18
- onMount(() => {
19
- const index = _options.findIndex((opt) => opt.value === value);
20
- focusIndex = index === -1 ? 0 : index;
21
- });
22
- function onSelect(index) {
23
- focusIndex = index;
24
- value = _options[index].value;
25
- dispatch("input", value);
26
- dispatch("select", value);
27
- dropDown.hide();
28
- }
1
+ <script lang="ts">
2
+ import { createEventDispatcher, onMount } from 'svelte'
3
+ import { mdiUnfoldMoreHorizontal } from '@mdi/js'
4
+
5
+ import { Icon } from '../icon/index.js'
6
+ import { DropDown } from '../menu/index.js'
7
+ import { SelectorList, FormControl, type InputProps } from './index.js'
8
+
9
+ import { type Options, parseOptions } from '../../utils/options.js'
10
+ import type { TippyProps } from '../../utils/tippy.js'
11
+
12
+ type $$Props = Omit<InputProps, 'input' | 'inputElement'> & {
13
+ options: Options
14
+ tippyProps?: TippyProps
15
+ placeholder?: string
16
+ }
17
+ $: ({ value: _value, options, tippyProps, placeholder, ...props } = $$props as $$Props)
18
+ export let value = _value
19
+
20
+ $: _options = parseOptions(options)
21
+ $: selectedOption = _options.find((opt) => opt.value === value)
22
+
23
+ let dropDown: DropDown
24
+ let button: HTMLButtonElement
25
+ const dispatch = createEventDispatcher<{ input: string; select: string }>()
26
+
27
+ let focusIndex = 0
28
+ onMount(() => {
29
+ const index = _options.findIndex((opt) => opt.value === value)
30
+ focusIndex = index === -1 ? 0 : index
31
+ })
32
+
33
+ function onSelect(index: number) {
34
+ focusIndex = index
35
+ value = _options[index].value
36
+ dispatch('input', value)
37
+ dispatch('select', value)
38
+ dropDown.hide()
39
+ }
29
40
  </script>
30
41
 
31
42
  <DropDown bind:this={dropDown}>
32
43
  <svelte:fragment slot="activator">
33
- <FormControl {...props} let:key>
34
- <button
35
- bind:this={button}
36
- id={key}
37
- type="button"
38
- class="input-bordered flex h-12 items-center gap-2 rounded-lg border pl-4 pr-2 hover:bg-base-200/50"
39
- >
40
- {#if selectedOption}
41
- {#if selectedOption.icon}
42
- <Icon path={selectedOption.icon} size={21} class="opacity-70" />
44
+ <FormControl {...props}>
45
+ {#snippet children({ key })}
46
+ <button
47
+ bind:this={button}
48
+ id={key}
49
+ type="button"
50
+ class="input-bordered flex h-12 items-center gap-2 rounded-lg border pl-4 pr-2 hover:bg-base-200/50"
51
+ >
52
+ {#if selectedOption}
53
+ {#if selectedOption.icon}
54
+ <Icon path={selectedOption.icon} size={21} class="opacity-70" />
55
+ {/if}
56
+ <span>{selectedOption.label}</span>
57
+ {:else if placeholder}
58
+ <span class="opacity-60">{placeholder}</span>
43
59
  {/if}
44
- <span>{selectedOption.label}</span>
45
- {:else if placeholder}
46
- <span class="opacity-60">{placeholder}</span>
60
+ <Icon class="ml-auto" path={mdiUnfoldMoreHorizontal} size={18} />
61
+ </button>
62
+ {#if value !== undefined}
63
+ <input type="hidden" name={key} {value} />
47
64
  {/if}
48
- <Icon class="ml-auto" path={mdiUnfoldMoreHorizontal} size={18} />
49
- </button>
50
- {#if value !== undefined}
51
- <input type="hidden" name={key} {value} />
52
- {/if}
65
+ {/snippet}
53
66
  </FormControl>
54
67
  </svelte:fragment>
55
68
 
@@ -1,24 +1,28 @@
1
- import { SvelteComponent } from "svelte";
2
1
  import { type InputProps } from './index.js';
3
2
  import { type Options } from '../../utils/options.js';
4
3
  import type { TippyProps } from '../../utils/tippy.js';
5
- declare const __propDef: {
6
- props: Omit<InputProps, "input" | "inputElement"> & {
7
- options: Options;
8
- tippyProps?: TippyProps | undefined;
9
- placeholder?: string | undefined;
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: Props & {
9
+ $$events?: Events;
10
+ $$slots?: Slots;
11
+ }): Exports & {
12
+ $set?: any;
13
+ $on?: any;
10
14
  };
11
- events: {
12
- input: CustomEvent<string>;
13
- select: CustomEvent<string>;
14
- } & {
15
- [evt: string]: CustomEvent<any>;
16
- };
17
- slots: {};
18
- };
19
- export type InputSelectProps = typeof __propDef.props;
20
- export type InputSelectEvents = typeof __propDef.events;
21
- export type InputSelectSlots = typeof __propDef.slots;
22
- export default class InputSelect extends SvelteComponent<InputSelectProps, InputSelectEvents, InputSelectSlots> {
15
+ z_$$bindings?: Bindings;
23
16
  }
24
- export {};
17
+ declare const InputSelect: $$__sveltets_2_IsomorphicComponent<Omit<InputProps, "input" | "inputElement"> & {
18
+ options: Options;
19
+ tippyProps?: TippyProps;
20
+ placeholder?: string;
21
+ }, {
22
+ input: CustomEvent<string>;
23
+ select: CustomEvent<string>;
24
+ } & {
25
+ [evt: string]: CustomEvent<any>;
26
+ }, {}, {}, string>;
27
+ type InputSelect = InstanceType<typeof InputSelect>;
28
+ export default InputSelect;
@@ -1,32 +1,33 @@
1
- <script>import { FormControl, bindValueWithParams } from "./index.js";
2
- $:
3
- ({ input, value: _value, classWrapper, bindWithParams, ...props } = $$props);
4
- $:
5
- ({ class: inputClass, ...inputProps } = input || {});
6
- export let value = _value;
7
- export let inputElement = void 0;
1
+ <script lang="ts">
2
+ import { FormControl, bindValueWithParams, type InputProps } from './index.js'
3
+
4
+ type $$Props = InputProps
5
+ $: ({ input, value: _value, classWrapper, bindWithParams, ...props } = $$props as $$Props)
6
+ $: ({ class: inputClass, ...inputProps } = input || {})
7
+ export let value = _value
8
+ export let inputElement: HTMLInputElement | undefined = undefined
8
9
  </script>
9
10
 
10
11
  <FormControl {...props} enhanceDisabled={props.enhanceDisabled || bindWithParams} let:key>
11
- <slot name="label_append" slot="label_append" />
12
-
13
- <div class={classWrapper}>
14
- <slot name="prepend" {value} />
15
- <input
16
- bind:value
17
- on:input
18
- on:focus
19
- on:blur
20
- on:keydown
21
- on:keyup
22
- bind:this={inputElement}
23
- use:bindValueWithParams={{ bindEnable: bindWithParams, initValue: (v) => (value = v) }}
24
- type="text"
25
- name={key}
26
- id={key}
27
- class="input input-bordered w-full {inputClass || ''}"
28
- {...inputProps}
29
- />
30
- <slot name="append" {value} />
31
- </div>
12
+ {#snippet children({ key })}
13
+ <div class={classWrapper}>
14
+ <slot name="prepend" {value} />
15
+ <input
16
+ bind:value
17
+ on:input
18
+ on:focus
19
+ on:blur
20
+ on:keydown
21
+ on:keyup
22
+ bind:this={inputElement}
23
+ use:bindValueWithParams={{ bindEnable: bindWithParams, initValue: (v) => (value = v) }}
24
+ type="text"
25
+ name={key}
26
+ id={key}
27
+ class="input input-bordered w-full {inputClass || ''}"
28
+ {...inputProps}
29
+ />
30
+ <slot name="append" {value} />
31
+ </div>
32
+ {/snippet}
32
33
  </FormControl>
@@ -1,31 +1,44 @@
1
- import { SvelteComponent } from "svelte";
2
1
  import { type InputProps } from './index.js';
3
- declare const __propDef: {
4
- props: InputProps;
5
- events: {
6
- input: Event;
7
- focus: FocusEvent;
8
- blur: FocusEvent;
9
- keydown: KeyboardEvent;
10
- keyup: KeyboardEvent;
11
- } & {
12
- [evt: string]: CustomEvent<any>;
2
+ 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> {
3
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
+ $$bindings?: Bindings;
5
+ } & Exports;
6
+ (internal: unknown, props: Props & {
7
+ $$events?: Events;
8
+ $$slots?: Slots;
9
+ }): Exports & {
10
+ $set?: any;
11
+ $on?: any;
13
12
  };
14
- slots: {
15
- label_append: {
16
- slot: string;
17
- };
18
- prepend: {
19
- value: string | null | undefined;
20
- };
21
- append: {
22
- value: string | null | undefined;
23
- };
24
- };
25
- };
26
- export type InputTextProps = typeof __propDef.props;
27
- export type InputTextEvents = typeof __propDef.events;
28
- export type InputTextSlots = typeof __propDef.slots;
29
- export default class InputText extends SvelteComponent<InputTextProps, InputTextEvents, InputTextSlots> {
13
+ z_$$bindings?: Bindings;
30
14
  }
31
- export {};
15
+ type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
16
+ default: any;
17
+ } ? Props extends Record<string, never> ? any : {
18
+ children?: any;
19
+ } : {});
20
+ declare const InputText: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<InputProps, {
21
+ prepend: {
22
+ value: string | null | undefined;
23
+ };
24
+ append: {
25
+ value: string | null | undefined;
26
+ };
27
+ }>, {
28
+ input: Event;
29
+ focus: FocusEvent;
30
+ blur: FocusEvent;
31
+ keydown: KeyboardEvent;
32
+ keyup: KeyboardEvent;
33
+ } & {
34
+ [evt: string]: CustomEvent<any>;
35
+ }, {
36
+ prepend: {
37
+ value: string | null | undefined;
38
+ };
39
+ append: {
40
+ value: string | null | undefined;
41
+ };
42
+ }, {}, string>;
43
+ type InputText = InstanceType<typeof InputText>;
44
+ export default InputText;
@@ -1,22 +1,23 @@
1
- <script>import { FormControl } from "./index.js";
2
- $:
3
- ({ textarea, value: _value, ...props } = $$props);
4
- $:
5
- ({ class: inputClass, ...inputProps } = textarea || {});
6
- export let value = _value;
1
+ <script lang="ts">
2
+ import { FormControl, type TextareaProps } from './index.js'
3
+ type $$Props = TextareaProps
4
+ $: ({ textarea, value: _value, ...props } = $$props as $$Props)
5
+ $: ({ class: inputClass, ...inputProps } = textarea || {})
6
+ export let value = _value
7
7
  </script>
8
8
 
9
- <FormControl {...props} let:key>
10
- <slot name="label_append" slot="label_append" />
11
- <textarea
12
- bind:value
13
- on:input
14
- on:focus
15
- on:blur
16
- name={key}
17
- id={key}
18
- class="textarea textarea-bordered {inputClass || ''}"
19
- rows="4"
20
- {...inputProps}
21
- />
9
+ <FormControl {...props}>
10
+ {#snippet children({ key })}
11
+ <textarea
12
+ bind:value
13
+ on:input
14
+ on:focus
15
+ on:blur
16
+ name={key}
17
+ id={key}
18
+ class="textarea textarea-bordered {inputClass || ''}"
19
+ rows="4"
20
+ {...inputProps}
21
+ ></textarea>
22
+ {/snippet}
22
23
  </FormControl>
@@ -1,23 +1,23 @@
1
- import { SvelteComponent } from "svelte";
2
1
  import { type TextareaProps } from './index.js';
3
- declare const __propDef: {
4
- props: TextareaProps;
5
- events: {
6
- input: Event;
7
- focus: FocusEvent;
8
- blur: FocusEvent;
9
- } & {
10
- [evt: string]: CustomEvent<any>;
2
+ 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> {
3
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
+ $$bindings?: Bindings;
5
+ } & Exports;
6
+ (internal: unknown, props: Props & {
7
+ $$events?: Events;
8
+ $$slots?: Slots;
9
+ }): Exports & {
10
+ $set?: any;
11
+ $on?: any;
11
12
  };
12
- slots: {
13
- label_append: {
14
- slot: string;
15
- };
16
- };
17
- };
18
- export type InputTextareaProps = typeof __propDef.props;
19
- export type InputTextareaEvents = typeof __propDef.events;
20
- export type InputTextareaSlots = typeof __propDef.slots;
21
- export default class InputTextarea extends SvelteComponent<InputTextareaProps, InputTextareaEvents, InputTextareaSlots> {
13
+ z_$$bindings?: Bindings;
22
14
  }
23
- export {};
15
+ declare const InputTextarea: $$__sveltets_2_IsomorphicComponent<TextareaProps, {
16
+ input: Event;
17
+ focus: FocusEvent;
18
+ blur: FocusEvent;
19
+ } & {
20
+ [evt: string]: CustomEvent<any>;
21
+ }, {}, {}, string>;
22
+ type InputTextarea = InstanceType<typeof InputTextarea>;
23
+ export default InputTextarea;
@@ -1,39 +1,46 @@
1
- <script>import { createEventDispatcher } from "svelte";
2
- import { FormControl } from "./index.js";
3
- import dayjs from "dayjs";
4
- export let value = void 0;
5
- export let input = {};
6
- export let getDefaultDate = () => /* @__PURE__ */ new Date(0);
7
- $:
8
- ({ class: inputClass = "", ...inputProps } = input);
9
- const dispatch = createEventDispatcher();
10
- const onInput = ({ currentTarget }) => {
11
- value = getDateTime(currentTarget.value);
12
- dispatch("input", value);
13
- };
14
- function getDateTime(v) {
15
- if (!v)
16
- return value;
17
- const date = value ? new Date(value) : getDefaultDate();
18
- const dateString = [
19
- date.getFullYear().toString(),
20
- (date.getMonth() + 1).toString().padStart(2, "0"),
21
- date.getDate().toString().padStart(2, "0")
22
- ].join("-");
23
- return /* @__PURE__ */ new Date(`${dateString}T${v}`);
24
- }
1
+ <script lang="ts">
2
+ import { createEventDispatcher } from 'svelte'
3
+ import type { HTMLInputAttributes, FormEventHandler } from 'svelte/elements'
4
+ import { FormControl, type InputProps } from './index.js'
5
+ import dayjs from 'dayjs'
6
+ type $$Props = InputProps<Date>
7
+
8
+ export let value: Date | null | undefined = undefined
9
+ export let input: HTMLInputAttributes = {}
10
+
11
+ $: ({ class: inputClass = '', ...inputProps } = input)
12
+
13
+ const dispatch = createEventDispatcher<{ input: Date | null }>()
14
+
15
+ const onInput: FormEventHandler<HTMLInputElement> = ({ currentTarget }) => {
16
+ value = getDateTime(currentTarget.value)
17
+ dispatch('input', value)
18
+ }
19
+
20
+ function getDateTime(v: string | null | undefined): Date | null | undefined {
21
+ if (!v) return value
22
+ const date = new Date(value || 0)
23
+ const dateString = [
24
+ date.getFullYear().toString(),
25
+ (date.getMonth() + 1).toString().padStart(2, '0'),
26
+ date.getDate().toString().padStart(2, '0')
27
+ ].join('-')
28
+ return new Date(`${dateString}T${v}`)
29
+ }
25
30
  </script>
26
31
 
27
- <FormControl {...$$restProps} let:key>
28
- <input
29
- value={value && dayjs(value).format('HH:mm')}
30
- on:input={onInput}
31
- on:focus
32
- on:blur
33
- type="time"
34
- name={key}
35
- id={key}
36
- class="input input-bordered {inputClass}"
37
- {...inputProps}
38
- />
32
+ <FormControl {...$$restProps}>
33
+ {#snippet children({ key })}
34
+ <input
35
+ value={value && dayjs(value).format('HH:mm')}
36
+ on:input={onInput}
37
+ on:focus
38
+ on:blur
39
+ type="time"
40
+ name={key}
41
+ id={key}
42
+ class="input input-bordered {inputClass}"
43
+ {...inputProps}
44
+ />
45
+ {/snippet}
39
46
  </FormControl>