@marianmeres/stuic 1.20.0 → 1.22.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 (32) hide show
  1. package/dist/actions/autogrow.d.ts +8 -0
  2. package/dist/actions/autogrow.js +22 -0
  3. package/dist/actions/trim.d.ts +4 -0
  4. package/dist/actions/trim.js +18 -0
  5. package/dist/actions/validate.d.ts +22 -0
  6. package/dist/actions/validate.js +80 -0
  7. package/dist/components/AlertConfirmPrompt/AlertConfirmPrompt.svelte +465 -0
  8. package/dist/components/AlertConfirmPrompt/AlertConfirmPrompt.svelte.d.ts +104 -0
  9. package/dist/components/AlertConfirmPrompt/acp-icons.d.ts +7 -0
  10. package/dist/components/AlertConfirmPrompt/acp-icons.js +134 -0
  11. package/dist/components/AlertConfirmPrompt/alert-confirm-prompt.d.ts +55 -0
  12. package/dist/components/AlertConfirmPrompt/alert-confirm-prompt.js +126 -0
  13. package/dist/components/Button/Button.svelte +19 -10
  14. package/dist/components/Button/Button.svelte.d.ts +1 -1
  15. package/dist/components/Input/Field.svelte +179 -0
  16. package/dist/components/Input/Field.svelte.d.ts +63 -0
  17. package/dist/components/Input/FieldCheckbox.svelte +102 -0
  18. package/dist/components/Input/FieldCheckbox.svelte.d.ts +34 -0
  19. package/dist/components/Input/FieldRadios.svelte +51 -0
  20. package/dist/components/Input/FieldRadios.svelte.d.ts +31 -0
  21. package/dist/components/Input/FieldSelect.svelte +125 -0
  22. package/dist/components/Input/FieldSelect.svelte.d.ts +47 -0
  23. package/dist/components/Input/Fieldset.svelte +27 -0
  24. package/dist/components/Input/Fieldset.svelte.d.ts +20 -0
  25. package/dist/components/Input/XFieldRadioInternal.svelte +102 -0
  26. package/dist/components/Input/XFieldRadioInternal.svelte.d.ts +33 -0
  27. package/dist/components/Switch/Switch.svelte.d.ts +1 -1
  28. package/dist/components/Thc/Thc.svelte +15 -0
  29. package/dist/components/Thc/Thc.svelte.d.ts +28 -0
  30. package/dist/index.d.ts +11 -0
  31. package/dist/index.js +13 -0
  32. package/package.json +3 -2
@@ -0,0 +1,63 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import { type ValidateOptions } from '../../index.js';
3
+ declare const __propDef: {
4
+ props: {
5
+ [x: string]: any;
6
+ class?: string | undefined;
7
+ labelClass?: string | undefined;
8
+ wrapClass?: string | undefined;
9
+ textareaClass?: string | undefined;
10
+ invalidClass?: string | undefined;
11
+ size?: "sm" | "md" | "lg" | undefined;
12
+ id?: string | undefined;
13
+ value: string;
14
+ label?: string | undefined;
15
+ type?: string | undefined;
16
+ name?: string | undefined;
17
+ tabindex?: number | undefined;
18
+ description?: string | undefined;
19
+ descriptionClass?: string | undefined;
20
+ disabled?: boolean | undefined;
21
+ readonly?: boolean | undefined;
22
+ required?: boolean | undefined;
23
+ placeholder?: string | undefined;
24
+ autocomplete?: string | undefined;
25
+ minlength?: number | undefined;
26
+ maxlength?: number | undefined;
27
+ min?: number | undefined;
28
+ max?: number | undefined;
29
+ pattern?: string | undefined;
30
+ step?: number | undefined;
31
+ useTrim?: boolean | undefined;
32
+ textareaAutoEnlarge?: boolean | undefined;
33
+ validationMessageClass?: string | undefined;
34
+ validate?: ValidateOptions | true | undefined;
35
+ };
36
+ events: {
37
+ input_mounted: CustomEvent<any>;
38
+ } & {
39
+ [evt: string]: CustomEvent<any>;
40
+ };
41
+ slots: {
42
+ label: {};
43
+ right_of_label: {};
44
+ input_before: {
45
+ id: string;
46
+ };
47
+ input_after: {
48
+ id: string;
49
+ };
50
+ input_below: {
51
+ id: string;
52
+ };
53
+ below: {
54
+ id: string;
55
+ };
56
+ };
57
+ };
58
+ export type FieldProps = typeof __propDef.props;
59
+ export type FieldEvents = typeof __propDef.events;
60
+ export type FieldSlots = typeof __propDef.slots;
61
+ export default class Field extends SvelteComponent<FieldProps, FieldEvents, FieldSlots> {
62
+ }
63
+ export {};
@@ -0,0 +1,102 @@
1
+ <script>import { twMerge } from "tailwind-merge";
2
+ import {
3
+ validate as validateAction
4
+ } from "../../index.js";
5
+ import { slide } from "svelte/transition";
6
+ import { getId } from "../../index.js";
7
+ let _class = "";
8
+ export { _class as class };
9
+ export let invalidClass = "border-primary";
10
+ export let labelClass = "";
11
+ export let descriptionClass = "";
12
+ export let size = "md";
13
+ export let id = getId();
14
+ export let checked = false;
15
+ export let label = "";
16
+ export let name = "";
17
+ export let description = "";
18
+ export let tabindex = 0;
19
+ export let disabled = void 0;
20
+ export let readonly = void 0;
21
+ export let required = void 0;
22
+ const labelSizePreset = {
23
+ sm: "text-sm",
24
+ md: "text-base",
25
+ lg: "text-base font-bold"
26
+ };
27
+ export let validationMessageClass = "";
28
+ export let validate = void 0;
29
+ let validation;
30
+ const setValidationResult = (res) => validation = res;
31
+ let idDesc = getId();
32
+ </script>
33
+
34
+ <div class={twMerge(`flex items-start mb-4 ${_class}`)}>
35
+ <div class="flex h-6 items-center ml-1">
36
+ <input
37
+ {id}
38
+ type="checkbox"
39
+ bind:checked
40
+ aria-checked={checked}
41
+ aria-describedby={description ? idDesc : undefined}
42
+ {name}
43
+ class={twMerge(`
44
+ size-4 rounded
45
+ bg-gray-100
46
+ border-gray-300
47
+ shadow-sm
48
+ text-primary
49
+ cursor-pointer
50
+ focus:border-primary
51
+ focus:ring-4
52
+ focus:ring-offset-0
53
+ focus:ring-primary
54
+ focus:ring-opacity-20
55
+ disabled:cursor-not-allowed
56
+ ${validation && !validation.valid ? invalidClass : ''}
57
+ `)}
58
+ {disabled}
59
+ {readonly}
60
+ {required}
61
+ {tabindex}
62
+ use:validateAction={validate
63
+ ? { ...(validate === true ? {} : validate), setValidationResult }
64
+ : undefined}
65
+ />
66
+ </div>
67
+ <div class="ml-3 w-full">
68
+ {#if label}
69
+ <label
70
+ for={id}
71
+ class={twMerge(`block w-full ${labelSizePreset[size]} ${labelClass}`)}
72
+ class:cursor-pointer={!disabled}
73
+ class:cursor-not-allowed={disabled}
74
+ >
75
+ {@html label}
76
+ </label>
77
+ {/if}
78
+ {#if validation && !validation?.valid}
79
+ <div
80
+ transition:slide={{ duration: 150 }}
81
+ class={twMerge(`text-xs text-primary tracking-tight ${validationMessageClass}`)}
82
+ >
83
+ {@html validation.message}
84
+ </div>
85
+ {/if}
86
+ {#if description || $$slots.description}
87
+ <!-- svelte-ignore a11y-click-events-have-key-events a11y-no-static-element-interactions -->
88
+ <div
89
+ class={twMerge(`text-sm opacity-50 ${descriptionClass}`)}
90
+ class:cursor-pointer={!disabled}
91
+ class:cursor-not-allowed={disabled}
92
+ on:click={() => !disabled && (checked = !checked)}
93
+ >
94
+ {#if $$slots.description}
95
+ <slot name="description" />
96
+ {:else}
97
+ {@html description}
98
+ {/if}
99
+ </div>
100
+ {/if}
101
+ </div>
102
+ </div>
@@ -0,0 +1,34 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import { type ValidateOptions } from '../../index.js';
3
+ declare const __propDef: {
4
+ props: {
5
+ class?: string | undefined;
6
+ invalidClass?: string | undefined;
7
+ labelClass?: string | undefined;
8
+ descriptionClass?: string | undefined;
9
+ size?: "sm" | "md" | "lg" | undefined;
10
+ id?: string | undefined;
11
+ checked?: boolean | undefined;
12
+ label?: string | undefined;
13
+ name?: string | undefined;
14
+ description?: string | undefined;
15
+ tabindex?: number | undefined;
16
+ disabled?: boolean | undefined;
17
+ readonly?: boolean | undefined;
18
+ required?: boolean | undefined;
19
+ validationMessageClass?: string | undefined;
20
+ validate?: ValidateOptions | true | undefined;
21
+ };
22
+ events: {
23
+ [evt: string]: CustomEvent<any>;
24
+ };
25
+ slots: {
26
+ description: {};
27
+ };
28
+ };
29
+ export type FieldCheckboxProps = typeof __propDef.props;
30
+ export type FieldCheckboxEvents = typeof __propDef.events;
31
+ export type FieldCheckboxSlots = typeof __propDef.slots;
32
+ export default class FieldCheckbox extends SvelteComponent<FieldCheckboxProps, FieldCheckboxEvents, FieldCheckboxSlots> {
33
+ }
34
+ export {};
@@ -0,0 +1,51 @@
1
+ <script>import { twMerge } from "tailwind-merge";
2
+ import XFieldRadioInternal from "./XFieldRadioInternal.svelte";
3
+ import { createClog } from "@marianmeres/clog";
4
+ import { getId } from "../../index.js";
5
+ const clog = createClog("FieldRadio");
6
+ export let options = [];
7
+ let _class = "";
8
+ export { _class as class };
9
+ export let optionClass = "";
10
+ export let labelClass = "";
11
+ export let descriptionClass = "";
12
+ export let invalidClass = "";
13
+ export let size = "md";
14
+ export let name = "";
15
+ export let value;
16
+ export let disabled = false;
17
+ export let required = false;
18
+ export let tabindex = 0;
19
+ let _options = [];
20
+ $:
21
+ _options = options.map((v) => {
22
+ if (typeof v === "string") {
23
+ v = { label: v };
24
+ }
25
+ return v;
26
+ });
27
+ $:
28
+ name ||= getId();
29
+ </script>
30
+
31
+ {#if options.length}
32
+ <div class={twMerge(`space-y-1 ${_class}`)}>
33
+ {#each _options as o, i}
34
+ <XFieldRadioInternal
35
+ bind:group={value}
36
+ {name}
37
+ label={o.label}
38
+ value={o.value || o.label}
39
+ description={o.description}
40
+ class={optionClass}
41
+ {labelClass}
42
+ {descriptionClass}
43
+ {disabled}
44
+ {tabindex}
45
+ {required}
46
+ {invalidClass}
47
+ {size}
48
+ />
49
+ {/each}
50
+ </div>
51
+ {/if}
@@ -0,0 +1,31 @@
1
+ import { SvelteComponent } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ options?: (string | {
5
+ label: string;
6
+ value?: string | undefined;
7
+ description?: string | undefined;
8
+ })[] | undefined;
9
+ class?: string | undefined;
10
+ optionClass?: string | undefined;
11
+ labelClass?: string | undefined;
12
+ descriptionClass?: string | undefined;
13
+ invalidClass?: string | undefined;
14
+ size?: "sm" | "md" | "lg" | undefined;
15
+ name?: string | undefined;
16
+ value: any;
17
+ disabled?: boolean | undefined;
18
+ required?: boolean | undefined;
19
+ tabindex?: number | undefined;
20
+ };
21
+ events: {
22
+ [evt: string]: CustomEvent<any>;
23
+ };
24
+ slots: {};
25
+ };
26
+ export type FieldRadiosProps = typeof __propDef.props;
27
+ export type FieldRadiosEvents = typeof __propDef.events;
28
+ export type FieldRadiosSlots = typeof __propDef.slots;
29
+ export default class FieldRadios extends SvelteComponent<FieldRadiosProps, FieldRadiosEvents, FieldRadiosSlots> {
30
+ }
31
+ export {};
@@ -0,0 +1,125 @@
1
+ <script>import { slide } from "svelte/transition";
2
+ import { twMerge } from "tailwind-merge";
3
+ import {
4
+ getId,
5
+ validate as validateAction
6
+ } from "../../index.js";
7
+ const inputSizePreset = {
8
+ sm: "text-sm placeholder:text-sm",
9
+ md: "text-base placeholder:text-base",
10
+ lg: "text-lg placeholder:text-lg"
11
+ };
12
+ const labelSizePreset = {
13
+ sm: "text-sm",
14
+ md: "text-base",
15
+ lg: "text-base font-bold"
16
+ };
17
+ export let options = [];
18
+ let _class = "";
19
+ export { _class as class };
20
+ export let wrapClass = "";
21
+ export let invalidClass = "border-primary";
22
+ export let size = "md";
23
+ export let id = getId();
24
+ export let value;
25
+ export let label = "";
26
+ export let name = "";
27
+ export let tabindex = 0;
28
+ export let description = "";
29
+ export let descriptionClass = "";
30
+ export let disabled = false;
31
+ export let required = false;
32
+ export let validationMessageClass = "";
33
+ export let validate = void 0;
34
+ let validation;
35
+ const setValidationResult = (res) => validation = res;
36
+ let _options = [];
37
+ $:
38
+ _options = options.map((v) => {
39
+ if (typeof v === "string") {
40
+ v = { label: v };
41
+ }
42
+ if (v.value === void 0) {
43
+ v.value = v.label;
44
+ }
45
+ return v;
46
+ });
47
+ $:
48
+ inputClass = twMerge(`
49
+ rounded-md border-0 block w-full flex-1
50
+ bg-transparent
51
+ tracking-tight
52
+ focus:outline-0 focus-visible:ring-0
53
+ placeholder:text-black/35 placeholder:tracking-tight
54
+ ${inputSizePreset[size]}
55
+ `);
56
+ </script>
57
+
58
+ <div class={twMerge(`mb-4 ${_class}`)}>
59
+ <div class="flex items-end px-2 mb-1">
60
+ {#if label || $$slots.label}
61
+ <label for={id} class="block flex-1 {labelSizePreset[size]}">
62
+ {#if $$slots.label}
63
+ <slot name="label" />
64
+ {:else}
65
+ {@html label}
66
+ {/if}
67
+ </label>
68
+ {/if}
69
+ <slot name="right_of_label" />
70
+ </div>
71
+ <div
72
+ class={twMerge(`
73
+ flex items-center
74
+ rounded-md border border-gray-300
75
+ bg-gray-100
76
+ focus-within:border-primary
77
+ focus-within:ring-4
78
+ focus-within:ring-primary
79
+ focus-within:ring-opacity-20
80
+ ${wrapClass}
81
+ ${validation && !validation.valid ? invalidClass : ''}
82
+ `)}
83
+ class:cursor-not-allowed={disabled}
84
+ class:opacity-50={disabled}
85
+ >
86
+ <slot name="input_before" {id} />
87
+ <select
88
+ class={inputClass}
89
+ bind:value
90
+ {disabled}
91
+ {required}
92
+ {tabindex}
93
+ {name}
94
+ use:validateAction={validate
95
+ ? { ...(validate === true ? {} : validate), setValidationResult }
96
+ : undefined}
97
+ >
98
+ {#each _options as o, i}
99
+ <option value={o.value}>{o.label}</option>
100
+ {/each}
101
+ </select>
102
+
103
+ <slot name="input_after" {id} />
104
+ </div>
105
+ {#if validation && !validation?.valid}
106
+ <div
107
+ transition:slide={{ duration: 150 }}
108
+ class={twMerge(
109
+ `mt-1 text-xs text-primary px-2 tracking-tight ${validationMessageClass}`
110
+ )}
111
+ >
112
+ {@html validation.message}
113
+ </div>
114
+ {/if}
115
+ {#if description}
116
+ <div class={twMerge(`mx-2 mt-1 text-sm opacity-50 ${descriptionClass}`)}>
117
+ {@html description}
118
+ </div>
119
+ {/if}
120
+ {#if $$slots.below}
121
+ <div class="mx-2 mt-1">
122
+ <slot name="below" {id} />
123
+ </div>
124
+ {/if}
125
+ </div>
@@ -0,0 +1,47 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import { type ValidateOptions } from '../../index.js';
3
+ declare const __propDef: {
4
+ props: {
5
+ options?: (string | {
6
+ label: string;
7
+ value?: string | undefined;
8
+ })[] | undefined;
9
+ class?: string | undefined;
10
+ wrapClass?: string | undefined;
11
+ invalidClass?: string | undefined;
12
+ size?: "sm" | "md" | "lg" | undefined;
13
+ id?: string | undefined;
14
+ value: any;
15
+ label?: string | undefined;
16
+ name?: string | undefined;
17
+ tabindex?: number | undefined;
18
+ description?: string | undefined;
19
+ descriptionClass?: string | undefined;
20
+ disabled?: boolean | undefined;
21
+ required?: boolean | undefined;
22
+ validationMessageClass?: string | undefined;
23
+ validate?: ValidateOptions | true | undefined;
24
+ };
25
+ events: {
26
+ [evt: string]: CustomEvent<any>;
27
+ };
28
+ slots: {
29
+ label: {};
30
+ right_of_label: {};
31
+ input_before: {
32
+ id: string;
33
+ };
34
+ input_after: {
35
+ id: string;
36
+ };
37
+ below: {
38
+ id: string;
39
+ };
40
+ };
41
+ };
42
+ export type FieldSelectProps = typeof __propDef.props;
43
+ export type FieldSelectEvents = typeof __propDef.events;
44
+ export type FieldSelectSlots = typeof __propDef.slots;
45
+ export default class FieldSelect extends SvelteComponent<FieldSelectProps, FieldSelectEvents, FieldSelectSlots> {
46
+ }
47
+ export {};
@@ -0,0 +1,27 @@
1
+ <script>import { twMerge } from "tailwind-merge";
2
+ let _class = "";
3
+ export { _class as class };
4
+ export let legend = "";
5
+ export let legendClass = "";
6
+ </script>
7
+
8
+ <fieldset
9
+ class={twMerge(`
10
+ border border-gray-200
11
+ p-4 pt-3
12
+ rounded-md
13
+ ${_class}
14
+ `)}
15
+ >
16
+ {#if legend}
17
+ <legend
18
+ class={twMerge(`
19
+ px-2
20
+ ${legendClass}
21
+ `)}
22
+ >
23
+ {@html legend}
24
+ </legend>
25
+ {/if}
26
+ <slot />
27
+ </fieldset>
@@ -0,0 +1,20 @@
1
+ import { SvelteComponent } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ class?: string | undefined;
5
+ legend?: string | undefined;
6
+ legendClass?: string | undefined;
7
+ };
8
+ events: {
9
+ [evt: string]: CustomEvent<any>;
10
+ };
11
+ slots: {
12
+ default: {};
13
+ };
14
+ };
15
+ export type FieldsetProps = typeof __propDef.props;
16
+ export type FieldsetEvents = typeof __propDef.events;
17
+ export type FieldsetSlots = typeof __propDef.slots;
18
+ export default class Fieldset extends SvelteComponent<FieldsetProps, FieldsetEvents, FieldsetSlots> {
19
+ }
20
+ export {};
@@ -0,0 +1,102 @@
1
+ <script>import { twMerge } from "tailwind-merge";
2
+ import {
3
+ getId,
4
+ validate as validateAction
5
+ } from "../../index.js";
6
+ import { slide } from "svelte/transition";
7
+ import { createEventDispatcher, onMount } from "svelte";
8
+ const dispatch = createEventDispatcher();
9
+ let _class = "";
10
+ export { _class as class };
11
+ export let invalidClass = "border-primary";
12
+ export let labelClass = "";
13
+ export let descriptionClass = "";
14
+ export let size = "md";
15
+ export let value;
16
+ export let group;
17
+ export let label;
18
+ export let name;
19
+ export let description = "";
20
+ export let tabindex = 0;
21
+ export let disabled = false;
22
+ export let required = false;
23
+ const labelSizePreset = {
24
+ sm: "text-sm",
25
+ md: "text-base",
26
+ lg: "text-base font-bold"
27
+ };
28
+ export let validationMessageClass = "";
29
+ export let validate = void 0;
30
+ let validation;
31
+ const setValidationResult = (res) => {
32
+ validation = res;
33
+ dispatch("validation", validation);
34
+ };
35
+ let id = getId();
36
+ let idDesc = getId();
37
+ </script>
38
+
39
+ <div class={twMerge(`flex items-start ${_class}`)}>
40
+ <div class="flex h-6 items-center ml-1">
41
+ <input
42
+ {id}
43
+ type="radio"
44
+ {value}
45
+ bind:group
46
+ aria-describedby={description ? idDesc : undefined}
47
+ {name}
48
+ class={twMerge(`
49
+ size-4 rounded-full
50
+ bg-gray-100
51
+ border-gray-300
52
+ shadow-sm
53
+ text-primary
54
+ cursor-pointer
55
+ focus:border-primary
56
+ focus:ring-4
57
+ focus:ring-offset-0
58
+ focus:ring-primary
59
+ focus:ring-opacity-20
60
+ disabled:cursor-not-allowed
61
+ ${validation && !validation.valid ? invalidClass : ''}
62
+ `)}
63
+ {disabled}
64
+ {required}
65
+ {tabindex}
66
+ use:validateAction={validate
67
+ ? { ...(validate === true ? {} : validate), setValidationResult }
68
+ : undefined}
69
+ />
70
+ </div>
71
+ <div class="ml-3 w-full">
72
+ {#if label}
73
+ <label
74
+ for={id}
75
+ class={twMerge(`block w-full ${labelSizePreset[size]} ${labelClass}`)}
76
+ class:cursor-pointer={!disabled}
77
+ class:cursor-not-allowed={disabled}
78
+ >
79
+ {@html label}
80
+ </label>
81
+ {/if}
82
+ {#if validation && !validation?.valid}
83
+ <div
84
+ transition:slide={{ duration: 150 }}
85
+ class={twMerge(`text-xs text-primary tracking-tight ${validationMessageClass}`)}
86
+ >
87
+ {@html validation.message}
88
+ </div>
89
+ {/if}
90
+ {#if description}
91
+ <!-- svelte-ignore a11y-click-events-have-key-events a11y-no-static-element-interactions -->
92
+ <div
93
+ class={twMerge(`text-sm opacity-50 ${descriptionClass}`)}
94
+ class:cursor-pointer={!disabled}
95
+ class:cursor-not-allowed={disabled}
96
+ on:click={() => !disabled && (group = value)}
97
+ >
98
+ {@html description}
99
+ </div>
100
+ {/if}
101
+ </div>
102
+ </div>
@@ -0,0 +1,33 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import { type ValidateOptions } from '../../index.js';
3
+ declare const __propDef: {
4
+ props: {
5
+ class?: string | undefined;
6
+ invalidClass?: string | undefined;
7
+ labelClass?: string | undefined;
8
+ descriptionClass?: string | undefined;
9
+ size?: "sm" | "md" | "lg" | undefined;
10
+ value: any;
11
+ group: any;
12
+ label: string;
13
+ name: string;
14
+ description?: string | undefined;
15
+ tabindex?: number | undefined;
16
+ disabled?: boolean | undefined;
17
+ required?: boolean | undefined;
18
+ validationMessageClass?: string | undefined;
19
+ validate?: ValidateOptions | true | undefined;
20
+ };
21
+ events: {
22
+ validation: CustomEvent<any>;
23
+ } & {
24
+ [evt: string]: CustomEvent<any>;
25
+ };
26
+ slots: {};
27
+ };
28
+ export type XFieldRadioInternalProps = typeof __propDef.props;
29
+ export type XFieldRadioInternalEvents = typeof __propDef.events;
30
+ export type XFieldRadioInternalSlots = typeof __propDef.slots;
31
+ export default class XFieldRadioInternal extends SvelteComponent<XFieldRadioInternalProps, XFieldRadioInternalEvents, XFieldRadioInternalSlots> {
32
+ }
33
+ export {};
@@ -35,7 +35,7 @@ declare const __propDef: {
35
35
  stopPropagation?: boolean | undefined;
36
36
  preventDefault?: boolean | undefined;
37
37
  preHook?: ((previosValue: boolean) => Promise<void | boolean>) | undefined;
38
- size?: "xs" | "sm" | "md" | "lg" | "xl" | undefined;
38
+ size?: "sm" | "md" | "lg" | "xs" | "xl" | undefined;
39
39
  };
40
40
  events: {
41
41
  click: MouseEvent;
@@ -0,0 +1,15 @@
1
+ <script context="module"></script>
2
+
3
+ <script>export let forceAsHtml = false;
4
+ export let thc;
5
+ </script>
6
+
7
+ {#if typeof thc === 'string'}
8
+ {#if forceAsHtml}{@html thc}{:else}{thc}{/if}
9
+ {:else if thc?.text}
10
+ {#if forceAsHtml}{@html thc.text}{:else}{thc.text}{/if}
11
+ {:else if thc?.html}
12
+ {@html thc.html}
13
+ {:else if thc?.component}
14
+ <svelte:component this={thc.component} {...thc?.props || {}} />
15
+ {/if}
@@ -0,0 +1,28 @@
1
+ import { SvelteComponent } from "svelte";
2
+ interface WithComponent {
3
+ component: any;
4
+ props?: Record<string, any>;
5
+ }
6
+ interface WithText {
7
+ text: string;
8
+ }
9
+ interface WithHtml {
10
+ html: string;
11
+ }
12
+ export type THC = string | WithText | WithHtml | WithComponent;
13
+ declare const __propDef: {
14
+ props: {
15
+ forceAsHtml?: boolean | undefined;
16
+ thc: THC;
17
+ };
18
+ events: {
19
+ [evt: string]: CustomEvent<any>;
20
+ };
21
+ slots: {};
22
+ };
23
+ export type ThcProps = typeof __propDef.props;
24
+ export type ThcEvents = typeof __propDef.events;
25
+ export type ThcSlots = typeof __propDef.slots;
26
+ export default class Thc extends SvelteComponent<ThcProps, ThcEvents, ThcSlots> {
27
+ }
28
+ export {};