firstly 0.3.0 → 0.4.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 (163) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/esm/SqlDatabase/FF_LogToConsole.js +9 -14
  3. package/esm/carbone/CarboneController.js +2 -1
  4. package/esm/changeLog/index.d.ts +0 -5
  5. package/esm/core/helper.d.ts +2 -0
  6. package/esm/core/helper.js +3 -0
  7. package/esm/core/index.d.ts +0 -0
  8. package/esm/core/index.js +5 -0
  9. package/esm/core/tailwind.d.ts +21 -0
  10. package/esm/core/tailwind.js +22 -0
  11. package/esm/core/tryCatch.d.ts +44 -0
  12. package/esm/core/tryCatch.js +34 -0
  13. package/esm/cron/server/index.js +1 -1
  14. package/esm/feedback/FeedbackController.js +3 -2
  15. package/esm/feedback/index.d.ts +7 -2
  16. package/esm/feedback/index.js +1 -2
  17. package/esm/feedback/server/index.d.ts +0 -5
  18. package/esm/feedback/server/index.js +1 -1
  19. package/esm/formats/strings.js +2 -2
  20. package/esm/index.d.ts +16 -0
  21. package/esm/index.js +13 -0
  22. package/esm/svelte/FF_Repo.svelte.d.ts +0 -2
  23. package/esm/svelte/FF_Repo.svelte.js +1 -17
  24. package/esm/svelte/helpers/debounce.js +1 -1
  25. package/esm/svelte/index.d.ts +2 -24
  26. package/esm/svelte/index.js +2 -22
  27. package/esm/{ui → svelte/ui}/Icon.svelte +1 -1
  28. package/esm/virtual/StateDemoEnum.d.ts +3 -3
  29. package/esm/virtual/StateDemoEnum.js +3 -3
  30. package/esm/virtual/UIEntity.js +1 -2
  31. package/package.json +6 -24
  32. package/esm/bin/cmd.d.ts +0 -1
  33. package/esm/bin/cmd.js +0 -638
  34. package/esm/feedback/ui/DialogIssue.svelte +0 -149
  35. package/esm/feedback/ui/DialogIssue.svelte.d.ts +0 -22
  36. package/esm/feedback/ui/DialogIssues.svelte +0 -114
  37. package/esm/feedback/ui/DialogIssues.svelte.d.ts +0 -22
  38. package/esm/feedback/ui/DialogMilestones.svelte +0 -43
  39. package/esm/feedback/ui/DialogMilestones.svelte.d.ts +0 -20
  40. package/esm/feedback/ui/Feedback.svelte +0 -16
  41. package/esm/feedback/ui/Feedback.svelte.d.ts +0 -18
  42. package/esm/internals/FF_Entity.d.ts +0 -2
  43. package/esm/internals/FF_Fields.d.ts +0 -11
  44. package/esm/internals/FF_Fields.js +0 -144
  45. package/esm/internals/cellsBuildor.d.ts +0 -47
  46. package/esm/internals/cellsBuildor.js +0 -141
  47. package/esm/internals/helper.d.ts +0 -49
  48. package/esm/internals/helper.js +0 -162
  49. package/esm/internals/index.d.ts +0 -78
  50. package/esm/internals/index.js +0 -45
  51. package/esm/internals/storeItem.d.ts +0 -19
  52. package/esm/internals/storeItem.js +0 -190
  53. package/esm/internals/storeList.d.ts +0 -34
  54. package/esm/internals/storeList.js +0 -108
  55. package/esm/internals/theme.d.ts +0 -4
  56. package/esm/internals/theme.js +0 -4
  57. package/esm/server/index.d.ts +0 -52
  58. package/esm/server/index.js +0 -87
  59. package/esm/svelte/FF_Cell.svelte +0 -103
  60. package/esm/svelte/FF_Cell.svelte.d.ts +0 -33
  61. package/esm/svelte/FF_Cell_Caption.svelte +0 -20
  62. package/esm/svelte/FF_Cell_Caption.svelte.d.ts +0 -31
  63. package/esm/svelte/FF_Cell_Display.svelte +0 -61
  64. package/esm/svelte/FF_Cell_Display.svelte.d.ts +0 -29
  65. package/esm/svelte/FF_Cell_Edit.svelte +0 -104
  66. package/esm/svelte/FF_Cell_Edit.svelte.d.ts +0 -32
  67. package/esm/svelte/FF_Cell_Error.svelte +0 -20
  68. package/esm/svelte/FF_Cell_Error.svelte.d.ts +0 -31
  69. package/esm/svelte/FF_Cell_Hint.svelte +0 -20
  70. package/esm/svelte/FF_Cell_Hint.svelte.d.ts +0 -31
  71. package/esm/svelte/FF_Config.svelte +0 -29
  72. package/esm/svelte/FF_Config.svelte.d.ts +0 -9
  73. package/esm/svelte/FF_Form.svelte +0 -155
  74. package/esm/svelte/FF_Form.svelte.d.ts +0 -37
  75. package/esm/svelte/FF_Grid.svelte +0 -257
  76. package/esm/svelte/FF_Grid.svelte.d.ts +0 -37
  77. package/esm/svelte/FF_Layout.svelte +0 -62
  78. package/esm/svelte/FF_Layout.svelte.d.ts +0 -31
  79. package/esm/svelte/actions/intersection.d.ts +0 -6
  80. package/esm/svelte/actions/intersection.js +0 -17
  81. package/esm/svelte/customField.d.ts +0 -69
  82. package/esm/svelte/customField.js +0 -4
  83. package/esm/svelte/dialog/DialogManagement.svelte +0 -98
  84. package/esm/svelte/dialog/DialogManagement.svelte.d.ts +0 -18
  85. package/esm/svelte/dialog/DialogPrimitive.svelte +0 -156
  86. package/esm/svelte/dialog/DialogPrimitive.svelte.d.ts +0 -38
  87. package/esm/svelte/dialog/dialog.d.ts +0 -58
  88. package/esm/svelte/dialog/dialog.js +0 -130
  89. package/esm/svelte/ff_Config.svelte.d.ts +0 -91
  90. package/esm/svelte/ff_Config.svelte.js +0 -111
  91. package/esm/svelte/firstly.css +0 -14
  92. package/esm/svelte/helpers.d.ts +0 -30
  93. package/esm/svelte/helpers.js +0 -38
  94. package/esm/svelte/tryCatch.d.ts +0 -12
  95. package/esm/svelte/tryCatch.js +0 -18
  96. package/esm/sveltekit/server/index.d.ts +0 -5
  97. package/esm/sveltekit/server/index.js +0 -24
  98. package/esm/ui/Button.svelte +0 -90
  99. package/esm/ui/Button.svelte.d.ts +0 -11
  100. package/esm/ui/Clipboardable.svelte +0 -25
  101. package/esm/ui/Clipboardable.svelte.d.ts +0 -12
  102. package/esm/ui/Field.svelte +0 -391
  103. package/esm/ui/Field.svelte.d.ts +0 -40
  104. package/esm/ui/FieldGroup.svelte +0 -117
  105. package/esm/ui/FieldGroup.svelte.d.ts +0 -44
  106. package/esm/ui/Grid.svelte +0 -262
  107. package/esm/ui/Grid.svelte.d.ts +0 -57
  108. package/esm/ui/Grid2.svelte +0 -290
  109. package/esm/ui/Grid2.svelte.d.ts +0 -57
  110. package/esm/ui/GridLoading.svelte +0 -58
  111. package/esm/ui/GridLoading.svelte.d.ts +0 -23
  112. package/esm/ui/GridPaginate.svelte +0 -69
  113. package/esm/ui/GridPaginate.svelte.d.ts +0 -23
  114. package/esm/ui/GridPaginate2.svelte +0 -25
  115. package/esm/ui/GridPaginate2.svelte.d.ts +0 -7
  116. package/esm/ui/Loading.svelte +0 -16
  117. package/esm/ui/Loading.svelte.d.ts +0 -31
  118. package/esm/ui/Tooltip.svelte +0 -45
  119. package/esm/ui/Tooltip.svelte.d.ts +0 -32
  120. package/esm/ui/dialog/DialogForm.svelte +0 -76
  121. package/esm/ui/dialog/DialogForm.svelte.d.ts +0 -21
  122. package/esm/ui/dialog/DialogManagement.svelte +0 -96
  123. package/esm/ui/dialog/DialogManagement.svelte.d.ts +0 -26
  124. package/esm/ui/dialog/DialogPrimitive.svelte +0 -90
  125. package/esm/ui/dialog/DialogPrimitive.svelte.d.ts +0 -38
  126. package/esm/ui/dialog/FormEditAction.svelte +0 -62
  127. package/esm/ui/dialog/FormEditAction.svelte.d.ts +0 -31
  128. package/esm/ui/dialog/dialog.d.ts +0 -60
  129. package/esm/ui/dialog/dialog.js +0 -100
  130. package/esm/ui/index.d.ts +0 -6
  131. package/esm/ui/index.js +0 -20
  132. package/esm/ui/internals/FieldContainer.svelte +0 -39
  133. package/esm/ui/internals/FieldContainer.svelte.d.ts +0 -18
  134. package/esm/ui/internals/Input.svelte +0 -143
  135. package/esm/ui/internals/Input.svelte.d.ts +0 -37
  136. package/esm/ui/internals/Textarea.svelte +0 -66
  137. package/esm/ui/internals/Textarea.svelte.d.ts +0 -33
  138. package/esm/ui/internals/select/MultiSelectMelt.svelte +0 -260
  139. package/esm/ui/internals/select/MultiSelectMelt.svelte.d.ts +0 -32
  140. package/esm/ui/internals/select/Select2.svelte +0 -88
  141. package/esm/ui/internals/select/Select2.svelte.d.ts +0 -12
  142. package/esm/ui/internals/select/SelectMelt.svelte +0 -289
  143. package/esm/ui/internals/select/SelectMelt.svelte.d.ts +0 -40
  144. package/esm/ui/internals/select/SelectRadio.svelte +0 -43
  145. package/esm/ui/internals/select/SelectRadio.svelte.d.ts +0 -27
  146. package/esm/ui/link/Link.svelte +0 -33
  147. package/esm/ui/link/Link.svelte.d.ts +0 -33
  148. package/esm/ui/link/LinkPlus.svelte +0 -63
  149. package/esm/ui/link/LinkPlus.svelte.d.ts +0 -9
  150. package/esm/utils/tailwind.d.ts +0 -2
  151. package/esm/utils/tailwind.js +0 -3
  152. package/esm/utils/transition.d.ts +0 -9
  153. package/esm/utils/transition.js +0 -33
  154. /package/esm/{internals → core}/BaseEnum.d.ts +0 -0
  155. /package/esm/{internals → core}/BaseEnum.js +0 -0
  156. /package/esm/{internals → core}/FF_Entity.js +0 -0
  157. /package/esm/{internals → core}/common.d.ts +0 -0
  158. /package/esm/{internals → core}/common.js +0 -0
  159. /package/esm/{utils → core}/types.d.ts +0 -0
  160. /package/esm/{utils → core}/types.js +0 -0
  161. /package/esm/{ui → svelte/ui}/Icon.svelte.d.ts +0 -0
  162. /package/esm/{ui → svelte/ui}/LibIcon.d.ts +0 -0
  163. /package/esm/{ui → svelte/ui}/LibIcon.js +0 -0
@@ -1,38 +0,0 @@
1
- import { type BaseItemLight } from '../../internals';
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;
12
- };
13
- z_$$bindings?: Bindings;
14
- }
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 DialogPrimitive: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
21
- detail?: BaseItemLight | undefined;
22
- open?: boolean;
23
- classes?: {
24
- root?: string;
25
- };
26
- }, {
27
- default: {};
28
- actions: {};
29
- }>, {
30
- change: CustomEvent<any>;
31
- } & {
32
- [evt: string]: CustomEvent<any>;
33
- }, {
34
- default: {};
35
- actions: {};
36
- }, {}, string>;
37
- type DialogPrimitive = InstanceType<typeof DialogPrimitive>;
38
- export default DialogPrimitive;
@@ -1,62 +0,0 @@
1
- <script lang="ts" generics="T extends any">
2
- import { createEventDispatcher } from 'svelte'
3
-
4
- import type { StoreItem } from '../../internals'
5
- import Button from '../Button.svelte'
6
- import Icon from '../Icon.svelte'
7
- import { LibIcon_Add, LibIcon_Check, LibIcon_Delete } from '../LibIcon'
8
- import type { DialogType } from './dialog'
9
-
10
- export let store: StoreItem<T>
11
- export let type: DialogType
12
- export let wDelete = false
13
-
14
- export let textCreate = 'Créer'
15
-
16
- const dispatch = createEventDispatcher()
17
-
18
- function dispatchDelete() {
19
- dispatch('delete')
20
- }
21
- </script>
22
-
23
- <div class="mt-2 flex items-center justify-between">
24
- {#if type === 'update'}
25
- <div class="flex items-center justify-start">
26
- {#if wDelete}
27
- <Button
28
- type="button"
29
- onclick={dispatchDelete}
30
- class="mr-4 btn-error"
31
- isLoading={$store.loading}
32
- >
33
- <Icon data={LibIcon_Delete} />
34
- </Button>
35
- {/if}
36
-
37
- <div>
38
- {#if $store.globalError}
39
- <span class="text-xs text-error">{$store.globalError}</span>
40
- {/if}
41
- </div>
42
- </div>
43
-
44
- <Button class="btn-primary" {...$$restProps} isLoading={$store.loading}>
45
- <Icon data={LibIcon_Check} />
46
- <p>Sauvegarder</p>
47
- </Button>
48
- {/if}
49
-
50
- {#if type === 'insert'}
51
- <div>
52
- {#if $store.globalError}
53
- <span class="text-xs text-error">{$store.globalError}</span>
54
- {/if}
55
- </div>
56
-
57
- <Button class="btn-primary" {...$$restProps} isLoading={$store.loading}>
58
- <Icon data={LibIcon_Add} />
59
- <p>{textCreate}</p>
60
- </Button>
61
- {/if}
62
- </div>
@@ -1,31 +0,0 @@
1
- import type { StoreItem } from '../../internals';
2
- import type { DialogType } from './dialog';
3
- declare class __sveltets_Render<T extends any> {
4
- props(): {
5
- [x: string]: any;
6
- store: StoreItem<T>;
7
- type: DialogType;
8
- wDelete?: boolean | undefined;
9
- textCreate?: string | undefined;
10
- };
11
- events(): {
12
- delete: CustomEvent<any>;
13
- } & {
14
- [evt: string]: CustomEvent<any>;
15
- };
16
- slots(): {};
17
- bindings(): string;
18
- exports(): {};
19
- }
20
- interface $$IsomorphicComponent {
21
- new <T extends any>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
22
- $$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
23
- } & ReturnType<__sveltets_Render<T>['exports']>;
24
- <T extends any>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {
25
- $$events?: ReturnType<__sveltets_Render<T>['events']>;
26
- }): ReturnType<__sveltets_Render<T>['exports']>;
27
- z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
28
- }
29
- declare const FormEditAction: $$IsomorphicComponent;
30
- type FormEditAction<T extends any> = InstanceType<typeof FormEditAction<T>>;
31
- export default FormEditAction;
@@ -1,60 +0,0 @@
1
- import type { Component, SvelteComponent } from 'svelte';
2
- import { type Repository } from 'remult';
3
- import type { BaseItemLight } from '../../internals/BaseEnum';
4
- import type { CellsInput } from '../../internals/cellsBuildor';
5
- import type { StoreItem } from '../../internals/storeItem';
6
- import type { FF_Repo } from '../../svelte';
7
- export type DialogClasses = {
8
- /**
9
- * for example `overflow-auto` to have a scrollbar in the dialog
10
- */
11
- root?: string;
12
- formGrid?: FormGrid;
13
- };
14
- export type FormGrid = 'grid-cols-1' | 'grid-cols-2' | 'grid-cols-3' | 'grid-cols-4' | 'grid-cols-1 lg:grid-cols-4';
15
- export type DialogMetaData<entityType = any> = {
16
- detail?: BaseItemLight;
17
- repo?: Repository<entityType>;
18
- store?: StoreItem<entityType>;
19
- cells?: CellsInput<entityType>;
20
- defaults?: Partial<entityType>;
21
- classes?: DialogClasses;
22
- component?: new (...args: any[]) => SvelteComponent;
23
- componentS5?: Component;
24
- props?: any;
25
- children?: any;
26
- reThrow?: boolean;
27
- wDelete?: boolean;
28
- focusKey?: string;
29
- topicPrefixText?: string;
30
- r?: FF_Repo<entityType>;
31
- };
32
- type ResultClose<entityType = any> = {
33
- success: boolean;
34
- item?: entityType;
35
- };
36
- export type DialogType = 'custom' | 'confirm' | 'confirmDelete' | 'insert' | 'update' | 'view';
37
- export type DialogFormType<entityType> = {
38
- cells?: CellsInput<entityType>;
39
- defaults?: Partial<entityType>;
40
- classes?: DialogClasses;
41
- reThrow?: boolean;
42
- wDelete?: boolean;
43
- topicPrefixText?: string;
44
- focusKey?: string;
45
- };
46
- export type DialogMetaDataInternal<entityType = any> = DialogMetaData<entityType> & {
47
- id: number;
48
- type: DialogType;
49
- resolve: (result: ResultClose) => void;
50
- };
51
- export declare const dialog: {
52
- confirm: (topic: string, text: string, icon?: string) => Promise<ResultClose<any>>;
53
- confirmDelete: (topic: string) => Promise<ResultClose<any>>;
54
- form: <entityType>(type: "insert" | "update" | "view", topic: string, repo: Repository<entityType>, settings: DialogFormType<entityType>) => Promise<ResultClose<any>>;
55
- show: (dialog: DialogMetaData) => Promise<ResultClose<any>>;
56
- close: (id: number, result: ResultClose) => void;
57
- closeAll: () => void;
58
- subscribe: (this: void, run: import("svelte/store").Subscriber<DialogMetaDataInternal<any>[]>, invalidate?: () => void) => import("svelte/store").Unsubscriber;
59
- };
60
- export {};
@@ -1,100 +0,0 @@
1
- import { writable } from 'svelte/store';
2
- import {} from 'remult';
3
- import { LibIcon_Add, LibIcon_Delete, LibIcon_Edit, LibIcon_Search } from '../LibIcon';
4
- const createDialogManagement = () => {
5
- const { subscribe, update } = writable([]);
6
- // internal...
7
- const show = (dialog, type) => {
8
- let resolve;
9
- const promise = new Promise((res) => {
10
- resolve = res;
11
- });
12
- update((dialogs) => {
13
- return [...dialogs, { ...dialog, id: dialogs.length + 1, resolve, type }];
14
- });
15
- return promise;
16
- };
17
- return {
18
- confirm: (topic, text, icon) => {
19
- const detail = {
20
- detail: {
21
- caption: 'A Confirmer',
22
- icon: { data: icon },
23
- },
24
- children: `
25
- <p>
26
- ${topic}
27
- <br />
28
- ${text}
29
- </p>
30
- `,
31
- };
32
- return show(detail, 'confirm');
33
- },
34
- confirmDelete: (topic) => {
35
- const detail = {
36
- detail: {
37
- caption: 'Supprimer',
38
- icon: { data: LibIcon_Delete },
39
- },
40
- children: topic
41
- ? `<p>Confirmez vous la suppression de: <br />- <b>${topic}</b> ?</p>`
42
- : 'Confirmer la suppression ?',
43
- };
44
- return show(detail, 'confirmDelete');
45
- },
46
- form: (type, topic, repo, settings) => {
47
- const topicPrefixText = settings?.topicPrefixText
48
- ? settings?.topicPrefixText + ' '
49
- : type === 'insert'
50
- ? `Créer `
51
- : type === 'update'
52
- ? 'Modifier '
53
- : 'Détail ';
54
- const detail = {
55
- detail: {
56
- caption: (topicPrefixText + topic).trim(),
57
- icon: {
58
- data: type === 'insert' ? LibIcon_Add : type === 'update' ? LibIcon_Edit : LibIcon_Search,
59
- },
60
- },
61
- repo,
62
- // store,
63
- cells: settings.cells ?? [],
64
- defaults: settings?.defaults,
65
- classes: settings?.classes,
66
- reThrow: settings?.reThrow,
67
- wDelete: settings?.wDelete,
68
- focusKey: settings?.focusKey,
69
- topicPrefixText,
70
- };
71
- // @ts-ignore
72
- return show(detail, type);
73
- },
74
- show: (dialog) => {
75
- return show(dialog, 'custom');
76
- },
77
- // next step, give a result typed!
78
- close: (id, result) => {
79
- update((dialogs) => {
80
- dialogs.forEach((dialog) => {
81
- if (dialog.id === id) {
82
- dialog.resolve(result);
83
- }
84
- });
85
- return dialogs.filter((dialog) => dialog.id !== id);
86
- });
87
- },
88
- // usefull on navigation you want to close all popups
89
- closeAll: () => {
90
- update((dialogs) => {
91
- dialogs.forEach((dialog) => {
92
- dialog.resolve({ success: false });
93
- });
94
- return [];
95
- });
96
- },
97
- subscribe,
98
- };
99
- };
100
- export const dialog = createDialogManagement();
package/esm/ui/index.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import type { FieldMetadata } from 'remult';
2
- import type { Cell } from '../internals';
3
- export type Align = 'text-left' | 'text-center' | 'text-right';
4
- export declare const align: (f?: FieldMetadata, isSlot?: boolean) => Align;
5
- export declare const getAligns: (cells: Cell<any>[], withAction: boolean) => Align[];
6
- export declare const baseTable = "overflow-x-auto rounded-box bg-base-300/60";
package/esm/ui/index.js DELETED
@@ -1,20 +0,0 @@
1
- export const align = (f, isSlot) => {
2
- if (isSlot) {
3
- return 'text-center';
4
- }
5
- if (f?.inputType === 'number') {
6
- return 'text-right';
7
- }
8
- else if (f?.inputType === 'date' || f?.inputType === 'dateOnly') {
9
- return 'text-center';
10
- }
11
- return 'text-left';
12
- };
13
- export const getAligns = (cells, withAction) => {
14
- const cols = [...cells.map((c) => align(c.field, c.kind === 'slot'))];
15
- if (withAction) {
16
- cols.push('text-right');
17
- }
18
- return cols;
19
- };
20
- export const baseTable = 'overflow-x-auto rounded-box bg-base-300/60';
@@ -1,39 +0,0 @@
1
- <script lang="ts">
2
- import { tw } from '../../utils/tailwind'
3
-
4
- interface Props {
5
- label?: string
6
- forId: string
7
- required?: boolean
8
- error?: string
9
- /**
10
- * example usage for paginate
11
- * classes={{ label: 'justify-end' }}
12
- */
13
- classes?: { label?: string; slot?: string }
14
- children?: import('svelte').Snippet
15
- }
16
-
17
- let {
18
- label = 'label',
19
- forId,
20
- required = false,
21
- error = '',
22
- classes = {},
23
- children,
24
- }: Props = $props()
25
- </script>
26
-
27
- <fieldset class="fieldset w-full">
28
- <label for={forId} class={tw(`label flex gap-1 px-2 justify-between`, classes.label)}>
29
- <span class="label-text pl-2 text-xs text-base-content/60">
30
- {label}{required ? ' *' : ''}
31
- </span>
32
- {#if error}
33
- <span class="label-text-alt truncate text-error">{error}</span>
34
- {/if}
35
- </label>
36
- <div class={tw('grid h-12 w-full text-base', classes.slot)}>
37
- {@render children?.()}
38
- </div>
39
- </fieldset>
@@ -1,18 +0,0 @@
1
- interface Props {
2
- label?: string;
3
- forId: string;
4
- required?: boolean;
5
- error?: string;
6
- /**
7
- * example usage for paginate
8
- * classes={{ label: 'justify-end' }}
9
- */
10
- classes?: {
11
- label?: string;
12
- slot?: string;
13
- };
14
- children?: import('svelte').Snippet;
15
- }
16
- declare const FieldContainer: import("svelte").Component<Props, {}, "">;
17
- type FieldContainer = ReturnType<typeof FieldContainer>;
18
- export default FieldContainer;
@@ -1,143 +0,0 @@
1
- <script lang="ts">
2
- import { createEventDispatcher, tick } from 'svelte'
3
- import type { HTMLInputAttributes } from 'svelte/elements'
4
-
5
- import { tw } from '../../utils/tailwind'
6
-
7
- export let value: HTMLInputAttributes['value'] = undefined
8
-
9
- const dispatch = createEventDispatcher()
10
-
11
- export let focus: boolean = false
12
- const focusNow = (node: any) => {
13
- if (focus) {
14
- tick().then(() => {
15
- node.focus()
16
- })
17
- }
18
- }
19
-
20
- // OPTION Dedounce
21
- export let withDedounce: boolean = false
22
- let timer: any = null
23
- const debounce = (fn: () => void) => {
24
- clearTimeout(timer)
25
- timer = setTimeout(() => {
26
- fn()
27
- }, 444)
28
- }
29
- function dispatchInput(value: any) {
30
- if ($$restProps.type === 'date') {
31
- if (value || value === null) {
32
- dispatch('input', { value: transformDate(value) })
33
- }
34
- } else {
35
- dispatch('input', { value })
36
- }
37
- }
38
-
39
- let className: string | undefined | null = undefined
40
- export { className as class }
41
-
42
- const handleInput = (e: any) => {
43
- const target: HTMLInputElement = e.target as HTMLInputElement
44
-
45
- if ($$restProps.type === 'number') {
46
- // If we see a `.` or a `,` don't continue and wait for the next input !
47
- if (e.data === '.' || e.data === ',') {
48
- // e.preventDefault()
49
- value = target.value.toString().replaceAll(',', '.')
50
- } else if (target.value === '') {
51
- // Could be good one day ?
52
- // if (target.min) {
53
- // value = target.min
54
- // } else {
55
- // value = null
56
- // }
57
- value = null
58
- } else {
59
- // This convert well the input into a valid number... But "12,0" will be converted into "12" so we can't write "12,01" for example!
60
- // value = +target.value
61
-
62
- // For now, let's always put a "." as a separator.
63
- value = target.value.toString().replaceAll(',', '.')
64
- }
65
- } else if ($$restProps.type === 'date') {
66
- if (target.value === '') {
67
- value = null!
68
- } else {
69
- value = target.value
70
- }
71
- } else {
72
- value = target.value
73
- }
74
-
75
- if (withDedounce) {
76
- return debounce(() => {
77
- dispatchInput(value)
78
- })
79
- } else {
80
- dispatchInput(value)
81
- }
82
- }
83
-
84
- const transformDate = (input: string | null) => {
85
- if (input === null) {
86
- return null
87
- }
88
- const rawDateSplited = input.split('-')
89
-
90
- if (rawDateSplited.length === 3) {
91
- const yearSplited = rawDateSplited[0].split('')
92
- if (
93
- yearSplited.length === 4 &&
94
- yearSplited[0] === '0' &&
95
- yearSplited[1] === '0' &&
96
- yearSplited[2] !== '0'
97
- ) {
98
- return `20${yearSplited[2]}${yearSplited[3]}-${rawDateSplited[1]}-${rawDateSplited[2]}`
99
- }
100
- }
101
-
102
- return input
103
- }
104
-
105
- const handleKeyup = (event: KeyboardEvent) => {
106
- if ($$restProps.type === 'date') {
107
- // @ts-ignore
108
- value = transformDate(event.target.value)
109
- }
110
- }
111
- </script>
112
-
113
- <input
114
- use:focusNow
115
- class={tw('w-full px-2', className)}
116
- on:input={handleInput}
117
- bind:value
118
- on:blur
119
- on:change
120
- on:click
121
- on:focus
122
- on:keydown
123
- on:keypress
124
- on:keyup={handleKeyup}
125
- on:mouseover
126
- on:mouseenter
127
- on:mouseleave
128
- on:paste
129
- {...$$restProps}
130
- />
131
-
132
- <style>
133
- input[type='number'] {
134
- -webkit-appearance: textfield;
135
- -moz-appearance: textfield;
136
- appearance: textfield;
137
- }
138
-
139
- input[type='number']::-webkit-inner-spin-button,
140
- input[type='number']::-webkit-outer-spin-button {
141
- -webkit-appearance: none;
142
- }
143
- </style>
@@ -1,37 +0,0 @@
1
- import type { HTMLInputAttributes } from 'svelte/elements';
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;
12
- };
13
- z_$$bindings?: Bindings;
14
- }
15
- declare const Input: $$__sveltets_2_IsomorphicComponent<{
16
- [x: string]: any;
17
- value?: HTMLInputAttributes["value"];
18
- focus?: boolean | undefined;
19
- withDedounce?: boolean | undefined;
20
- class?: string | undefined | null | undefined;
21
- }, {
22
- blur: FocusEvent;
23
- change: Event;
24
- click: PointerEvent;
25
- focus: FocusEvent;
26
- keydown: KeyboardEvent;
27
- keypress: KeyboardEvent;
28
- mouseover: MouseEvent;
29
- mouseenter: MouseEvent;
30
- mouseleave: MouseEvent;
31
- paste: ClipboardEvent;
32
- input: CustomEvent<any>;
33
- } & {
34
- [evt: string]: CustomEvent<any>;
35
- }, {}, {}, string>;
36
- type Input = InstanceType<typeof Input>;
37
- export default Input;
@@ -1,66 +0,0 @@
1
- <script lang="ts">
2
- import { createEventDispatcher, onMount } from 'svelte'
3
-
4
- export let name: string | null = null
5
- export let id = ''
6
- export let rows = 4
7
- export let placeholder = ''
8
- export let focus = false
9
- export let value = ''
10
- export let readonly = false
11
- export const error = false
12
- // unused but needed to avoid Field error 👇
13
- export let align: `left` | `right` = `left`
14
- const _tmp = align
15
-
16
- const dispatch = createEventDispatcher()
17
-
18
- let reference: HTMLTextAreaElement
19
-
20
- const focusNow = (node: HTMLTextAreaElement) => {
21
- if (focus) {
22
- node.focus()
23
- }
24
- }
25
-
26
- onMount(() => {
27
- if (!reference) {
28
- return
29
- }
30
- if (!focus) {
31
- return
32
- }
33
- reference.focus()
34
- })
35
- function dispatchInput(value: any) {
36
- dispatch('input', { value })
37
- }
38
- </script>
39
-
40
- {#if readonly}
41
- <span class="flex min-h-8 max-w-full items-center px-3 py-1 text-sm md:min-h-[2.5rem]">
42
- <div class="overflow-hidden">
43
- {@html value ?? '-'}
44
- </div>
45
- </span>
46
- {:else}
47
- <textarea
48
- use:focusNow
49
- {...$$restProps}
50
- class="shadow-neutral-focus md:rounded-xls
51
- textarea flex h-max min-h-8
52
- w-full items-center rounded-lg bg-transparent text-xs
53
- shadow-sm md:text-sm lg:min-h-[2.5rem]"
54
- id={id || name || 'default-textarea-id'}
55
- {name}
56
- {placeholder}
57
- autocomplete="off"
58
- bind:this={reference}
59
- bind:value
60
- {rows}
61
- on:input={(e) => {
62
- // @ts-ignore
63
- dispatchInput(e.target.value)
64
- }}
65
- ></textarea>
66
- {/if}
@@ -1,33 +0,0 @@
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;
11
- };
12
- z_$$bindings?: Bindings;
13
- }
14
- declare const Textarea: $$__sveltets_2_IsomorphicComponent<{
15
- [x: string]: any;
16
- name?: string | null | undefined;
17
- id?: string | undefined;
18
- rows?: number | undefined;
19
- placeholder?: string | undefined;
20
- focus?: boolean | undefined;
21
- value?: string | undefined;
22
- readonly?: boolean | undefined;
23
- error?: false | undefined;
24
- align?: `left` | `right` | undefined;
25
- }, {
26
- input: CustomEvent<any>;
27
- } & {
28
- [evt: string]: CustomEvent<any>;
29
- }, {}, {
30
- error: false;
31
- }, string>;
32
- type Textarea = InstanceType<typeof Textarea>;
33
- export default Textarea;