fuma 1.0.15 → 1.0.17

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/private/Meta.svelte +27 -32
  2. package/dist/private/Meta.svelte.d.ts +0 -1
  3. package/dist/private/api.d.ts +1 -1
  4. package/dist/ui/badge/Badge.svelte +3 -4
  5. package/dist/ui/button/ButtonCopy.svelte +31 -37
  6. package/dist/ui/button/ButtonDelete.svelte +21 -23
  7. package/dist/ui/button/ButtonDelete.svelte.d.ts +0 -1
  8. package/dist/ui/card/Card.svelte +10 -13
  9. package/dist/ui/card/Card.svelte.d.ts +0 -1
  10. package/dist/ui/card/CardBasic.svelte +4 -5
  11. package/dist/ui/card/CardBasic.svelte.d.ts +0 -1
  12. package/dist/ui/card/CardCollapse.svelte +31 -35
  13. package/dist/ui/card/CardCollapse.svelte.d.ts +0 -1
  14. package/dist/ui/card/CardFullScreen.svelte +6 -8
  15. package/dist/ui/card/CardFullScreen.svelte.d.ts +0 -3
  16. package/dist/ui/card/CardLink.svelte +4 -5
  17. package/dist/ui/card/CardLink.svelte.d.ts +0 -1
  18. package/dist/ui/dialog/Dialog.svelte +34 -41
  19. package/dist/ui/dialog/Dialog.svelte.d.ts +0 -1
  20. package/dist/ui/dialog/DialogConfirm.svelte +4 -6
  21. package/dist/ui/dialog/DialogConfirm.svelte.d.ts +0 -1
  22. package/dist/ui/drawer/Drawer.svelte +37 -46
  23. package/dist/ui/drawer/Drawer.svelte.d.ts +0 -16
  24. package/dist/ui/form/Form.svelte +82 -100
  25. package/dist/ui/form/Form.svelte.d.ts +0 -1
  26. package/dist/ui/form/FormInput.svelte +6 -12
  27. package/dist/ui/form/FormInput.svelte.d.ts +0 -18
  28. package/dist/ui/form/FormSection.svelte +16 -23
  29. package/dist/ui/form/formInput.d.ts +0 -1
  30. package/dist/ui/icon/Icon.svelte +32 -35
  31. package/dist/ui/input/FormControl.svelte +32 -38
  32. package/dist/ui/input/FormControl.svelte.d.ts +0 -3
  33. package/dist/ui/input/InputBoolean.svelte +8 -13
  34. package/dist/ui/input/InputBoolean.svelte.d.ts +0 -3
  35. package/dist/ui/input/InputCheckboxs.svelte +20 -22
  36. package/dist/ui/input/InputCheckboxs.svelte.d.ts +0 -3
  37. package/dist/ui/input/InputCheckboxsMenu.svelte +35 -51
  38. package/dist/ui/input/InputCheckboxsMenu.svelte.d.ts +0 -3
  39. package/dist/ui/input/InputCheckboxsTree.svelte +6 -9
  40. package/dist/ui/input/InputCheckboxsTreeNodes.svelte +27 -35
  41. package/dist/ui/input/InputCombo.svelte +34 -43
  42. package/dist/ui/input/InputCombo.svelte.d.ts +0 -3
  43. package/dist/ui/input/InputDate.svelte +17 -22
  44. package/dist/ui/input/InputDateTime.svelte +18 -23
  45. package/dist/ui/input/InputImage.svelte +45 -52
  46. package/dist/ui/input/InputImage.svelte.d.ts +0 -1
  47. package/dist/ui/input/InputImagePreview.svelte +20 -24
  48. package/dist/ui/input/InputNumber.svelte +5 -10
  49. package/dist/ui/input/InputOptionInParam.svelte +10 -12
  50. package/dist/ui/input/InputOptions.svelte +34 -40
  51. package/dist/ui/input/InputPassword.svelte +5 -7
  52. package/dist/ui/input/InputPassword.svelte.d.ts +0 -3
  53. package/dist/ui/input/InputRadio.svelte +32 -36
  54. package/dist/ui/input/InputRadio.svelte.d.ts +0 -3
  55. package/dist/ui/input/InputRelation.svelte +67 -83
  56. package/dist/ui/input/InputRelation.svelte.d.ts +0 -1
  57. package/dist/ui/input/InputRelations.svelte +79 -92
  58. package/dist/ui/input/InputSearch.svelte +10 -13
  59. package/dist/ui/input/InputSelect.svelte +28 -39
  60. package/dist/ui/input/InputText.svelte +7 -8
  61. package/dist/ui/input/InputTextarea.svelte +6 -6
  62. package/dist/ui/input/InputTime.svelte +23 -29
  63. package/dist/ui/input/RelationAfter.svelte +9 -13
  64. package/dist/ui/input/SelectorList.svelte +12 -16
  65. package/dist/ui/input/SelectorList.svelte.d.ts +0 -4
  66. package/dist/ui/input/textRich/InputTextRich.svelte +50 -52
  67. package/dist/ui/input/textRich/InputTextRich.svelte.d.ts +9 -3
  68. package/dist/ui/input/textRich/SuggesionList.svelte +9 -13
  69. package/dist/ui/input/textRich/ToolMark.svelte +9 -12
  70. package/dist/ui/input/textRich/ToolMarkColor.svelte +11 -15
  71. package/dist/ui/input/textRich/ToolMarkLink.svelte +38 -46
  72. package/dist/ui/input/textRich/ToolMenu.svelte +19 -34
  73. package/dist/ui/input/textRich/ToolMenuAlign.svelte +9 -13
  74. package/dist/ui/input/textRich/ToolMenuInsert.svelte +7 -12
  75. package/dist/ui/input/textRich/ToolMenuNode.svelte +10 -14
  76. package/dist/ui/input/textRich/ToolsBar.svelte +11 -15
  77. package/dist/ui/login/Login.svelte +30 -36
  78. package/dist/ui/menu/ContextMenu.svelte +31 -37
  79. package/dist/ui/menu/ContextMenu.svelte.d.ts +0 -1
  80. package/dist/ui/menu/DropDown.svelte +83 -92
  81. package/dist/ui/menu/DropDown.svelte.d.ts +0 -1
  82. package/dist/ui/menu/DropDownMenu.svelte +18 -25
  83. package/dist/ui/menu/DropDownMenu.svelte.d.ts +0 -1
  84. package/dist/ui/mode/ToggleMode.svelte +14 -15
  85. package/dist/ui/mode/ToggleMode.svelte.d.ts +1 -6
  86. package/dist/ui/pagination/Pagination.svelte +8 -9
  87. package/dist/ui/placeholder/Placeholder.svelte +3 -4
  88. package/dist/ui/placeholder/Placeholder.svelte.d.ts +0 -1
  89. package/dist/ui/placeholder/PlaceholderImage.svelte +4 -6
  90. package/dist/ui/placeholder/PlaceholderImage.svelte.d.ts +0 -1
  91. package/dist/ui/range/RangePicker.svelte +62 -75
  92. package/dist/ui/range/RangePicker.svelte.d.ts +2 -2
  93. package/dist/ui/range/RangePickerButton.svelte +35 -43
  94. package/dist/ui/slot/Slot.svelte +25 -42
  95. package/dist/ui/slot/Span.svelte +1 -2
  96. package/dist/ui/table/Table.svelte +28 -35
  97. package/dist/ui/table/TableBody.svelte +12 -18
  98. package/dist/ui/table/TableCell.svelte +10 -13
  99. package/dist/ui/table/TableFieldsEdition.svelte +51 -57
  100. package/dist/ui/table/TableHead.svelte +20 -19
  101. package/dist/ui/table/TableViewSelect.svelte +37 -50
  102. package/dist/ui/table/cell/TableCellArray.svelte +3 -5
  103. package/dist/ui/table/cell/TableCellBoolean.svelte +3 -4
  104. package/dist/ui/table/cell/TableCellNumber.svelte +1 -2
  105. package/dist/ui/table/cell/TableCellString.svelte +2 -5
  106. package/dist/ui/table/head/OrderButtons.svelte +37 -0
  107. package/dist/ui/table/head/OrderButtons.svelte.d.ts +20 -0
  108. package/dist/ui/table/head/TableHeadBoolean.svelte +3 -6
  109. package/dist/ui/table/head/TableHeadDate.svelte +110 -61
  110. package/dist/ui/table/head/TableHeadDefault.svelte +2 -5
  111. package/dist/ui/table/head/TableHeadNumber.svelte +76 -67
  112. package/dist/ui/table/head/TableHeadSelect.svelte +41 -47
  113. package/dist/ui/table/head/TableHeadString.svelte +8 -14
  114. package/dist/ui/tabs/Tabs.svelte +5 -8
  115. package/dist/ui/tabs/TabsIcon.svelte +28 -31
  116. package/dist/validation/zod.d.ts +12 -0
  117. package/dist/validation/zod.js +4 -2
  118. package/package.json +1 -1
@@ -25,22 +25,6 @@ declare const __propDef: {
25
25
  invalidateAll?: boolean | undefined;
26
26
  state?: App.PageState | undefined;
27
27
  } | undefined) => Promise<void>) | undefined;
28
- children?: import("svelte").Snippet<[{
29
- open: (value?: number, options?: {
30
- replaceState?: boolean | undefined;
31
- noScroll?: boolean | undefined;
32
- keepFocus?: boolean | undefined;
33
- invalidateAll?: boolean | undefined;
34
- state?: App.PageState | undefined;
35
- } | undefined) => Promise<void>;
36
- close: (options?: {
37
- replaceState?: boolean | undefined;
38
- noScroll?: boolean | undefined;
39
- keepFocus?: boolean | undefined;
40
- invalidateAll?: boolean | undefined;
41
- state?: App.PageState | undefined;
42
- } | undefined) => Promise<void>;
43
- }]> | undefined;
44
28
  };
45
29
  events: {
46
30
  [evt: string]: CustomEvent<any>;
@@ -1,110 +1,92 @@
1
- <script lang="ts" context="module">
2
- import type { z } from 'zod'
3
- import type { FormDataInput } from './form.js'
4
- </script>
1
+ <script context="module"></script>
5
2
 
6
3
  <script
7
- lang="ts"
4
+
8
5
  generics="
9
6
  Shape extends z.ZodRawShape,
10
7
  ReturnData extends Record<string, unknown> = FormDataInput<Shape>,
11
8
  Data extends FormDataInput<Shape> = FormDataInput<Shape>
12
9
  "
13
- >
14
- import { createEventDispatcher, onMount } from 'svelte'
15
- import { fade } from 'svelte/transition'
16
- import { page } from '$app/stores'
17
- import { contextContainer } from '../context.js'
18
- import {
19
- initData,
20
- type FormField,
21
- type FormSectionProps,
22
- type BoolOrFunction,
23
- type Nullable,
24
- getFieldType,
25
- useHandleInput
26
- } from './form.js'
27
- import ButtonDelete from '../button/ButtonDelete.svelte'
28
-
29
- import { useForm, type UseFormOptions } from '../../validation/form.js'
30
- import FormInput from './FormInput.svelte'
31
- import FormSection from './FormSection.svelte'
32
-
33
- let klass = ''
34
- export { klass as class }
35
- export let classSection = ''
36
- export let classAction = ''
37
- export let model: Shape | undefined = undefined
38
- export let fields: FormField<Shape>[][] = []
39
- export let sections: FormSectionProps<Shape>[] = [{}]
40
- export let action = ''
41
- export let actionCreate = '_create'
42
- export let actionDelete = '_delete'
43
- export let actionUpdate = '_update'
44
-
45
- /** Ignore actionCreate, actionDelete and actionUpdate */
46
- export let simpleAction = false
47
-
48
- export let options: UseFormOptions<ReturnData> = {}
49
- let dataInput: Nullable<Data> = initData<Shape, Data>(fields)
50
- export { dataInput as data }
51
-
52
- let data = dataInput
53
-
54
- export function set<K extends keyof Shape>(key: K, value: Nullable<Data>[K]) {
55
- isDirty.set(true)
56
- data[key] = value
57
- }
58
- export function update(updater: (currentData: Nullable<Data>) => Nullable<Data>) {
59
- isDirty.set(true)
60
- data = updater(data)
61
- }
62
-
63
- const dispatch = createEventDispatcher<{
64
- success: { action: URL; data?: ReturnData }
65
- created: ReturnData
66
- updated: ReturnData
67
- deleted: void
68
- }>()
69
-
70
- const { enhance, setError } = useForm<ReturnData>({
71
- ...options,
72
- async onSuccess(url, data) {
73
- if (options.onSuccess) await options.onSuccess(url, data)
74
- dispatch('success', { action: url, data })
75
- const actionPath = url.pathname + url.search
76
- if (actionPath.includes(action + actionDelete)) dispatch('deleted')
77
- if (!data) return
78
- if (actionPath.includes(action + actionCreate)) dispatch('created', data)
79
- if (actionPath.includes(action + actionUpdate)) dispatch('updated', data)
80
- }
81
- })
82
- const { handleInput, isDirty } = useHandleInput({ model, setError })
83
-
84
- onMount(lookupValueFromParams)
85
- $: $isDirty ? (dataInput = data) : (data = dataInput)
86
-
87
- function lookupValueFromParams() {
88
- fields.flat().forEach(({ key }) => {
89
- if (data[key]) return
90
- const value = $page.url.searchParams.get(key)
91
- // TODO: fix data[key] type
92
- // @ts-ignore
93
- if (value && key in data) data[key] = value
94
- })
95
- }
96
-
97
- const actionPadding = getActionPadding()
98
- function getActionPadding(): string {
99
- const container = contextContainer.get()
100
- if (container === 'drawer') return 'bottom-0 -ml-8 -mr-4 pl-8 pr-4'
101
- if (container === 'card') return 'bottom-0 -mx-2 sm:-mx-8 px-2 sm:px-8'
102
- if (container === 'dialog') return '-bottom-4 -mx-4 px-4'
103
- return 'bottom-0'
104
- }
105
-
106
- const getBoolean = (bool?: BoolOrFunction<Shape>) => (_data: Nullable<Data>) =>
107
- typeof bool === 'boolean' || bool === undefined ? !!bool : !!bool(_data)
10
+ >import { createEventDispatcher, onMount } from "svelte";
11
+ import { fade } from "svelte/transition";
12
+ import { page } from "$app/stores";
13
+ import { contextContainer } from "../context.js";
14
+ import {
15
+ initData,
16
+ getFieldType,
17
+ useHandleInput
18
+ } from "./form.js";
19
+ import ButtonDelete from "../button/ButtonDelete.svelte";
20
+ import { useForm } from "../../validation/form.js";
21
+ import FormInput from "./FormInput.svelte";
22
+ import FormSection from "./FormSection.svelte";
23
+ let klass = "";
24
+ export { klass as class };
25
+ export let classSection = "";
26
+ export let classAction = "";
27
+ export let model = void 0;
28
+ export let fields = [];
29
+ export let sections = [{}];
30
+ export let action = "";
31
+ export let actionCreate = "_create";
32
+ export let actionDelete = "_delete";
33
+ export let actionUpdate = "_update";
34
+ export let simpleAction = false;
35
+ export let options = {};
36
+ let dataInput = initData(fields);
37
+ export { dataInput as data };
38
+ let data = dataInput;
39
+ export function set(key, value) {
40
+ isDirty.set(true);
41
+ data[key] = value;
42
+ }
43
+ export function update(updater) {
44
+ isDirty.set(true);
45
+ data = updater(data);
46
+ }
47
+ const dispatch = createEventDispatcher();
48
+ const { enhance, setError } = useForm({
49
+ ...options,
50
+ async onSuccess(url, data2) {
51
+ if (options.onSuccess)
52
+ await options.onSuccess(url, data2);
53
+ dispatch("success", { action: url, data: data2 });
54
+ const actionPath = url.pathname + url.search;
55
+ if (actionPath.includes(action + actionDelete))
56
+ dispatch("deleted");
57
+ if (!data2)
58
+ return;
59
+ if (actionPath.includes(action + actionCreate))
60
+ dispatch("created", data2);
61
+ if (actionPath.includes(action + actionUpdate))
62
+ dispatch("updated", data2);
63
+ }
64
+ });
65
+ const { handleInput, isDirty } = useHandleInput({ model, setError });
66
+ onMount(lookupValueFromParams);
67
+ $:
68
+ $isDirty ? dataInput = data : data = dataInput;
69
+ function lookupValueFromParams() {
70
+ fields.flat().forEach(({ key }) => {
71
+ if (data[key])
72
+ return;
73
+ const value = $page.url.searchParams.get(key);
74
+ if (value && key in data)
75
+ data[key] = value;
76
+ });
77
+ }
78
+ const actionPadding = getActionPadding();
79
+ function getActionPadding() {
80
+ const container = contextContainer.get();
81
+ if (container === "drawer")
82
+ return "bottom-0 -ml-8 -mr-4 pl-8 pr-4";
83
+ if (container === "card")
84
+ return "bottom-0 -mx-2 sm:-mx-8 px-2 sm:px-8";
85
+ if (container === "dialog")
86
+ return "-bottom-4 -mx-4 px-4";
87
+ return "bottom-0";
88
+ }
89
+ const getBoolean = (bool) => (_data) => typeof bool === "boolean" || bool === void 0 ? !!bool : !!bool(_data);
108
90
  </script>
109
91
 
110
92
  <form
@@ -20,7 +20,6 @@ declare class __sveltets_Render<Shape extends z.ZodRawShape, ReturnData extends
20
20
  data?: Nullable<Data> | undefined;
21
21
  set?: (<K extends keyof Shape>(key: K, value: Nullable<Data>[K]) => void) | undefined;
22
22
  update?: ((updater: (currentData: Nullable<Data>) => Nullable<Data>) => void) | undefined;
23
- children?: import("svelte").Snippet<[]> | undefined;
24
23
  };
25
24
  events(): {
26
25
  success: CustomEvent<{
@@ -1,15 +1,9 @@
1
- <script lang="ts" generics="InputType extends FormInputsType">
2
- import { formInputs, type FormInputProps, type FormInputsType } from './formInput.js'
3
-
4
- type $$Props = FormInputProps<InputType> & {
5
- type: InputType
6
- value: FormInputProps<InputType>['value']
7
- }
8
-
9
- let inputType: InputType
10
- export { inputType as type }
11
- export let value: FormInputProps<InputType>['value']
12
- $: component = formInputs[inputType] as any
1
+ <script generics="InputType extends FormInputsType">import { formInputs } from "./formInput.js";
2
+ let inputType;
3
+ export { inputType as type };
4
+ export let value;
5
+ $:
6
+ component = formInputs[inputType];
13
7
  </script>
14
8
 
15
9
  <svelte:component this={component} bind:value {...$$restProps} />
@@ -39,7 +39,6 @@ declare class __sveltets_Render<InputType extends FormInputsType> {
39
39
  hide?: (() => void) | undefined;
40
40
  show?: (() => void) | undefined;
41
41
  setTippyProps?: ((props: Partial<import("tippy.js").Props>) => void) | undefined;
42
- children?: import("svelte").Snippet<[]> | undefined;
43
42
  } | undefined;
44
43
  flatMode?: boolean | undefined;
45
44
  slotItem?: ((item: any) => string | import("../../index.js").ComponentAndProps) | null | undefined;
@@ -49,10 +48,6 @@ declare class __sveltets_Render<InputType extends FormInputsType> {
49
48
  classList?: string | undefined;
50
49
  clear?: (() => Promise<void>) | undefined;
51
50
  }>): import("../index.js").InputRelation<any>;
52
- element?: {
53
- new (): HTMLElement;
54
- prototype: HTMLElement;
55
- } | undefined;
56
51
  };
57
52
  readonly relations: {
58
53
  new (options: import("svelte").ComponentConstructorOptions<{
@@ -72,10 +67,6 @@ declare class __sveltets_Render<InputType extends FormInputsType> {
72
67
  classList?: string | undefined;
73
68
  value?: any[] | null | undefined;
74
69
  }>): import("../index.js").InputRelations<any>;
75
- element?: {
76
- new (): HTMLElement;
77
- prototype: HTMLElement;
78
- } | undefined;
79
70
  };
80
71
  }[InputType]>> & {
81
72
  type: InputType;
@@ -117,7 +108,6 @@ declare class __sveltets_Render<InputType extends FormInputsType> {
117
108
  hide?: (() => void) | undefined;
118
109
  show?: (() => void) | undefined;
119
110
  setTippyProps?: ((props: Partial<import("tippy.js").Props>) => void) | undefined;
120
- children?: import("svelte").Snippet<[]> | undefined;
121
111
  } | undefined;
122
112
  flatMode?: boolean | undefined;
123
113
  slotItem?: ((item: any) => string | import("../../index.js").ComponentAndProps) | null | undefined;
@@ -127,10 +117,6 @@ declare class __sveltets_Render<InputType extends FormInputsType> {
127
117
  classList?: string | undefined;
128
118
  clear?: (() => Promise<void>) | undefined;
129
119
  }>): import("../index.js").InputRelation<any>;
130
- element?: {
131
- new (): HTMLElement;
132
- prototype: HTMLElement;
133
- } | undefined;
134
120
  };
135
121
  readonly relations: {
136
122
  new (options: import("svelte").ComponentConstructorOptions<{
@@ -150,10 +136,6 @@ declare class __sveltets_Render<InputType extends FormInputsType> {
150
136
  classList?: string | undefined;
151
137
  value?: any[] | null | undefined;
152
138
  }>): import("../index.js").InputRelations<any>;
153
- element?: {
154
- new (): HTMLElement;
155
- prototype: HTMLElement;
156
- } | undefined;
157
139
  };
158
140
  }[InputType]>>["value"];
159
141
  };
@@ -1,26 +1,19 @@
1
- <script lang="ts">
2
- import { slide } from 'svelte/transition'
3
- import { mdiChevronRight } from '@mdi/js'
4
- import { Icon } from '../icon/index.js'
5
- type Props = { isActive?: boolean; class?: string; contentClass?: string }
6
- type $$Props = Props &
7
- ({ isReducible: true; title: string } | { isReducible?: false; title?: string })
8
-
9
- export let title = ''
10
- export let isActive = false
11
- export let isReducible = false
12
-
13
- let klass = ''
14
- export { klass as class }
15
- export let contentClass = ''
16
-
17
- function open() {
18
- isActive = true
19
- }
20
- function toggle(event: Event) {
21
- event.stopPropagation()
22
- isActive = !isActive
23
- }
1
+ <script>import { slide } from "svelte/transition";
2
+ import { mdiChevronRight } from "@mdi/js";
3
+ import { Icon } from "../icon/index.js";
4
+ export let title = "";
5
+ export let isActive = false;
6
+ export let isReducible = false;
7
+ let klass = "";
8
+ export { klass as class };
9
+ export let contentClass = "";
10
+ function open() {
11
+ isActive = true;
12
+ }
13
+ function toggle(event) {
14
+ event.stopPropagation();
15
+ isActive = !isActive;
16
+ }
24
17
  </script>
25
18
 
26
19
  <div>
@@ -60,7 +60,6 @@ export declare function relationProps<Item extends {
60
60
  hide?: (() => void) | undefined;
61
61
  show?: (() => void) | undefined;
62
62
  setTippyProps?: ((props: Partial<import("tippy.js").Props>) => void) | undefined;
63
- children?: import("svelte").Snippet<[]> | undefined;
64
63
  } | undefined;
65
64
  flatMode?: boolean | undefined;
66
65
  slotItem?: ((item: Item) => string | import("../..").ComponentAndProps) | null | undefined;
@@ -1,38 +1,35 @@
1
- <script lang="ts">
2
- import { tippy, type TippyProps, type TippyInstance } from '../../utils/tippy.js'
3
- import { onMount } from 'svelte'
4
-
5
- export let path: string
6
- export let title = ''
7
- export let size = 22
8
- let klass = ''
9
- export { klass as class }
10
- export let style = ''
11
- export let classSVG = ''
12
- export let tippyProps: Partial<TippyProps> = {}
13
- export let disableTitlePropagation = false
14
- const viewWidth = 24
15
- const viewHeight = 24
16
-
17
- let icon: HTMLElement
18
-
19
- let tip: TippyInstance | null = null
20
- $: tip?.setContent(title)
21
-
22
- onMount(() => {
23
- if (!title) return
24
- const parent = icon.parentElement
25
- const isButton = parent?.tagName === 'BUTTON' || parent?.tagName === 'A'
26
- const target = parent && isButton && !disableTitlePropagation ? parent : icon
27
- tip = tippy(target || icon, {
28
- content: title,
29
- trigger: 'mouseenter',
30
- ...tippyProps
31
- })
32
- return () => {
33
- tip?.destroy()
34
- }
35
- })
1
+ <script>import { tippy } from "../../utils/tippy.js";
2
+ import { onMount } from "svelte";
3
+ export let path;
4
+ export let title = "";
5
+ export let size = 22;
6
+ let klass = "";
7
+ export { klass as class };
8
+ export let style = "";
9
+ export let classSVG = "";
10
+ export let tippyProps = {};
11
+ export let disableTitlePropagation = false;
12
+ const viewWidth = 24;
13
+ const viewHeight = 24;
14
+ let icon;
15
+ let tip = null;
16
+ $:
17
+ tip?.setContent(title);
18
+ onMount(() => {
19
+ if (!title)
20
+ return;
21
+ const parent = icon.parentElement;
22
+ const isButton = parent?.tagName === "BUTTON" || parent?.tagName === "A";
23
+ const target = parent && isButton && !disableTitlePropagation ? parent : icon;
24
+ tip = tippy(target || icon, {
25
+ content: title,
26
+ trigger: "mouseenter",
27
+ ...tippyProps
28
+ });
29
+ return () => {
30
+ tip?.destroy();
31
+ };
32
+ });
36
33
  </script>
37
34
 
38
35
  <i bind:this={icon} class="grid place-content-center fill-base-content {klass}" {style}>
@@ -1,41 +1,35 @@
1
- <script lang="ts">
2
- import { slide } from 'svelte/transition'
3
- import { onMount, type ComponentType } from 'svelte'
4
- import { formContext } from '../../validation/form.js'
5
- import type { ComponentAndProps } from '../../utils/index.js'
6
- import { Slot } from '../index.js'
7
-
8
- let klass = ''
9
- export { klass as class }
10
- export let classLabel = ''
11
- export let key = ''
12
- export let label: ComponentAndProps | ComponentType | string = ''
13
- export let error = ''
14
- export let hint = ''
15
- export let prefix: string | number = ''
16
- export let prefixFor: string | number = ''
17
- export let enhanceDisabled = false
18
- export let labelPosition: LabelPosition = 'top'
19
-
20
- type LabelPosition = 'top' | 'left' | 'right'
21
-
22
- $: _key = prefix && key ? `${prefix}_${key}` : key || ''
23
-
24
- if (!enhanceDisabled) {
25
- const { setError } = formContext.get()
26
- setError[key] = (err) => (error = err)
27
- }
28
-
29
- let formControl: HTMLDivElement
30
- onMount(() => {
31
- const input = formControl.querySelector('input, textarea')
32
- if (!input) return
33
- const handleInput = () => (error = '')
34
- input.addEventListener('input', handleInput)
35
- return () => {
36
- input.removeEventListener('input', handleInput)
37
- }
38
- })
1
+ <script>import { slide } from "svelte/transition";
2
+ import { onMount } from "svelte";
3
+ import { formContext } from "../../validation/form.js";
4
+ import { Slot } from "../index.js";
5
+ let klass = "";
6
+ export { klass as class };
7
+ export let classLabel = "";
8
+ export let key = "";
9
+ export let label = "";
10
+ export let error = "";
11
+ export let hint = "";
12
+ export let prefix = "";
13
+ export let prefixFor = "";
14
+ export let enhanceDisabled = false;
15
+ export let labelPosition = "top";
16
+ $:
17
+ _key = prefix && key ? `${prefix}_${key}` : key || "";
18
+ if (!enhanceDisabled) {
19
+ const { setError } = formContext.get();
20
+ setError[key] = (err) => error = err;
21
+ }
22
+ let formControl;
23
+ onMount(() => {
24
+ const input = formControl.querySelector("input, textarea");
25
+ if (!input)
26
+ return;
27
+ const handleInput = () => error = "";
28
+ input.addEventListener("input", handleInput);
29
+ return () => {
30
+ input.removeEventListener("input", handleInput);
31
+ };
32
+ });
39
33
  </script>
40
34
 
41
35
  <div class="form-control {klass}" bind:this={formControl}>
@@ -13,9 +13,6 @@ declare const __propDef: {
13
13
  prefixFor?: string | number | undefined;
14
14
  enhanceDisabled?: boolean | undefined;
15
15
  labelPosition?: ("top" | "left" | "right") | undefined;
16
- children?: import("svelte").Snippet<[{
17
- key: string;
18
- }]> | undefined;
19
16
  };
20
17
  events: {
21
18
  [evt: string]: CustomEvent<any>;
@@ -1,16 +1,11 @@
1
- <script lang="ts">
2
- import { createEventDispatcher } from 'svelte'
3
- import type { HTMLInputAttributes } from 'svelte/elements'
4
- import { FormControl, type InputProps, bindCheckedWithParams } from './index.js'
5
- import { USE_COERCE_BOOLEAN } from '../../utils/constant.js'
6
-
7
- type $$Props = InputProps<boolean> & { isRow?: boolean }
8
- export let value: boolean | null | undefined = false
9
- export let input: HTMLInputAttributes = {}
10
- export let inputElement: HTMLInputElement | undefined = undefined
11
- export let bindWithParams: boolean = false
12
-
13
- const dispatch = createEventDispatcher<{ change: boolean }>()
1
+ <script>import { createEventDispatcher } from "svelte";
2
+ import { FormControl, bindCheckedWithParams } from "./index.js";
3
+ import { USE_COERCE_BOOLEAN } from "../../utils/constant.js";
4
+ export let value = false;
5
+ export let input = {};
6
+ export let inputElement = void 0;
7
+ export let bindWithParams = false;
8
+ const dispatch = createEventDispatcher();
14
9
  </script>
15
10
 
16
11
  <FormControl {...$$restProps} let:key class="">
@@ -12,9 +12,6 @@ declare const __propDef: {
12
12
  prefixFor?: string | number | undefined;
13
13
  enhanceDisabled?: boolean | undefined;
14
14
  labelPosition?: ("top" | "left" | "right") | undefined;
15
- children?: import("svelte").Snippet<[{
16
- key: string;
17
- }]> | undefined;
18
15
  } & {
19
16
  input?: HTMLInputAttributes | undefined;
20
17
  inputElement?: HTMLInputElement | undefined;
@@ -1,25 +1,23 @@
1
- <script lang="ts">
2
- import { slide } from 'svelte/transition'
3
- import { FormControl, type InputProps } from './index.js'
4
- import { type Options, parseOptions } from '../../utils/options.js'
5
-
6
- type $$Props = InputProps<string[]> & { options: Options; checkboxesClass?: string }
7
- $: ({
8
- input,
9
- value: _value,
10
- options: _1,
11
- class: klass,
12
- checkboxesClass,
13
- hint,
14
- error,
15
- ...props
16
- } = $$props as $$Props)
17
- export let value: string[] | null | undefined = _value || []
18
- export let options: Options
19
-
20
- if (!value) value = []
21
-
22
- $: _options = parseOptions(options)
1
+ <script>import { slide } from "svelte/transition";
2
+ import { FormControl } from "./index.js";
3
+ import { parseOptions } from "../../utils/options.js";
4
+ $:
5
+ ({
6
+ input,
7
+ value: _value,
8
+ options: _1,
9
+ class: klass,
10
+ checkboxesClass,
11
+ hint,
12
+ error,
13
+ ...props
14
+ } = $$props);
15
+ export let value = _value || [];
16
+ export let options;
17
+ if (!value)
18
+ value = [];
19
+ $:
20
+ _options = parseOptions(options);
23
21
  </script>
24
22
 
25
23
  <div class={klass}>
@@ -12,9 +12,6 @@ declare const __propDef: {
12
12
  prefixFor?: string | number | undefined;
13
13
  enhanceDisabled?: boolean | undefined;
14
14
  labelPosition?: ("top" | "left" | "right") | undefined;
15
- children?: import("svelte").Snippet<[{
16
- key: string;
17
- }]> | undefined;
18
15
  } & {
19
16
  input?: import("svelte/elements.js").HTMLInputAttributes | undefined;
20
17
  inputElement?: HTMLInputElement | undefined;