@websline/system-components 1.4.6 → 1.4.8

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.
@@ -0,0 +1,26 @@
1
+ <script>
2
+ /**
3
+ * @typedef {Object} Props
4
+ * @property {string} [color=""] Icon color
5
+ * @property {number} [height=24] Icon height
6
+ * @property {number} [strokeWidth=1.5] Icon StrokeWidth
7
+ * @property {number} [width=24] Icon width
8
+ */
9
+
10
+ /** @type {Props} */
11
+ let { color, height, width, strokeWidth, ...rest } = $props();
12
+ </script>
13
+
14
+ <svg
15
+ {height}
16
+ {width}
17
+ viewBox="0 0 20 20"
18
+ fill="none"
19
+ xmlns="http://www.w3.org/2000/svg"
20
+ {...rest}>
21
+ <path
22
+ d="M7.77843 2.5H15.0512L10.6067 7.75H16.6673L6.97035 17.5L8.99055 10.375H3.33398L7.77843 2.5Z"
23
+ stroke={color}
24
+ stroke-width={strokeWidth}
25
+ stroke-linejoin="round" />
26
+ </svg>
@@ -0,0 +1,41 @@
1
+ export default Lightning;
2
+ type Lightning = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<Props>): void;
5
+ };
6
+ declare const Lightning: import("svelte").Component<{
7
+ /**
8
+ * Icon color
9
+ */
10
+ color?: string;
11
+ /**
12
+ * Icon height
13
+ */
14
+ height?: number;
15
+ /**
16
+ * Icon StrokeWidth
17
+ */
18
+ strokeWidth?: number;
19
+ /**
20
+ * Icon width
21
+ */
22
+ width?: number;
23
+ }, {}, "">;
24
+ type Props = {
25
+ /**
26
+ * Icon color
27
+ */
28
+ color?: string;
29
+ /**
30
+ * Icon height
31
+ */
32
+ height?: number;
33
+ /**
34
+ * Icon StrokeWidth
35
+ */
36
+ strokeWidth?: number;
37
+ /**
38
+ * Icon width
39
+ */
40
+ width?: number;
41
+ };
@@ -60,6 +60,7 @@ export { default as Info } from "./Info.svelte";
60
60
  export { default as Intergration } from "./Intergration.svelte";
61
61
  export { default as Italic } from "./Italic.svelte";
62
62
  export { default as Layout } from "./Layout.svelte";
63
+ export { default as Lightning } from "./Lightning.svelte";
63
64
  export { default as Link } from "./Link.svelte";
64
65
  export { default as LinkAi } from "./LinkAi.svelte";
65
66
  export { default as ListOrdered } from "./ListOrdered.svelte";
@@ -60,6 +60,7 @@ export { default as Info } from "./Info.svelte";
60
60
  export { default as Intergration } from "./Intergration.svelte";
61
61
  export { default as Italic } from "./Italic.svelte";
62
62
  export { default as Layout } from "./Layout.svelte";
63
+ export { default as Lightning } from "./Lightning.svelte";
63
64
  export { default as Link } from "./Link.svelte";
64
65
  export { default as LinkAi } from "./LinkAi.svelte";
65
66
  export { default as ListOrdered } from "./ListOrdered.svelte";
@@ -52,6 +52,7 @@
52
52
  error,
53
53
  id,
54
54
  name,
55
+ onchange,
55
56
  required,
56
57
  value = "on",
57
58
  ...rest
@@ -77,6 +78,7 @@
77
78
  } else {
78
79
  checked = e.target.checked;
79
80
  }
81
+ onchange?.(e);
80
82
  };
81
83
 
82
84
  $effect(() => {
@@ -8,8 +8,10 @@
8
8
  content = "",
9
9
  fieldName = "",
10
10
  hideToolbar = false,
11
+ initialFocus = true,
11
12
  oninput,
12
13
  placeholder = "",
14
+ readonly = false,
13
15
  size = "medium",
14
16
  toolbarConfig = {
15
17
  bold: {
@@ -48,7 +50,7 @@
48
50
  let htmlInputValue = $state();
49
51
  let isContentPropUpdate = false;
50
52
 
51
- let styles = $derived(richTextEditorVariants({ hideToolbar, size }));
53
+ let styles = $derived(richTextEditorVariants({ hideToolbar, readonly, size }));
52
54
 
53
55
  setContext("richt-text-editor", () => editor);
54
56
 
@@ -132,6 +134,7 @@
132
134
  });
133
135
 
134
136
  editor = new Editor({
137
+ editable: !readonly,
135
138
  element: element,
136
139
  extensions: [
137
140
  StarterKit.configure({
@@ -183,7 +186,7 @@
183
186
  },
184
187
  });
185
188
 
186
- editor.commands.focus("end");
189
+ !readonly && initialFocus && editor.commands.focus("end");
187
190
  };
188
191
 
189
192
  $effect(() => {
@@ -8,8 +8,10 @@ declare const RichTextEditor: import("svelte").Component<{
8
8
  content?: string;
9
9
  fieldName?: string;
10
10
  hideToolbar?: boolean;
11
+ initialFocus?: boolean;
11
12
  oninput: any;
12
13
  placeholder?: string;
14
+ readonly?: boolean;
13
15
  size?: string;
14
16
  toolbarConfig?: Record<string, any>;
15
17
  } & Record<string, any>, {}, "">;
@@ -18,8 +20,10 @@ type $$ComponentProps = {
18
20
  content?: string;
19
21
  fieldName?: string;
20
22
  hideToolbar?: boolean;
23
+ initialFocus?: boolean;
21
24
  oninput: any;
22
25
  placeholder?: string;
26
+ readonly?: boolean;
23
27
  size?: string;
24
28
  toolbarConfig?: Record<string, any>;
25
29
  } & Record<string, any>;
@@ -4,6 +4,12 @@ export const richTextEditorVariants: import("tailwind-variants").TVReturnType<{
4
4
  field: string;
5
5
  };
6
6
  };
7
+ readonly: {
8
+ true: {
9
+ base: string;
10
+ toolbar: string;
11
+ };
12
+ };
7
13
  size: {
8
14
  small: {
9
15
  field: string;
@@ -25,6 +31,12 @@ export const richTextEditorVariants: import("tailwind-variants").TVReturnType<{
25
31
  field: string;
26
32
  };
27
33
  };
34
+ readonly: {
35
+ true: {
36
+ base: string;
37
+ toolbar: string;
38
+ };
39
+ };
28
40
  size: {
29
41
  small: {
30
42
  field: string;
@@ -46,6 +58,12 @@ export const richTextEditorVariants: import("tailwind-variants").TVReturnType<{
46
58
  field: string;
47
59
  };
48
60
  };
61
+ readonly: {
62
+ true: {
63
+ base: string;
64
+ toolbar: string;
65
+ };
66
+ };
49
67
  size: {
50
68
  small: {
51
69
  field: string;
@@ -4,10 +4,10 @@ const richTextEditorVariants = tv({
4
4
  slots: {
5
5
  base: "body-small text-neutral-800 dark:text-white",
6
6
  toolbar:
7
- "pointer flex gap-0.5 rounded-t-sm border border-b-0 border-neutral-300 px-5 py-2 dark:border-neutral-700",
7
+ "pointer flex gap-0.5 rounded-t-lg border border-b-0 border-neutral-300 px-5 py-2 dark:border-neutral-700",
8
8
  field: [
9
9
  "[&>div]:transition-[border] [&>div]:duration-300",
10
- "[&>div]:rounded-b-sm [&>div]:border [&>div]:border-neutral-300 [&>div]:outline-none dark:[&>div]:border-neutral-700",
10
+ "[&>div]:rounded-b-lg [&>div]:border [&>div]:border-neutral-300 [&>div]:outline-none dark:[&>div]:border-neutral-700",
11
11
  "[&>div]:h-full [&>div]:overflow-auto [&>div]:p-5",
12
12
  "[&>div>p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]",
13
13
  "[&>div>p.is-editor-empty:first-child::before]:float-left",
@@ -22,7 +22,13 @@ const richTextEditorVariants = tv({
22
22
  variants: {
23
23
  hideToolbar: {
24
24
  true: {
25
- field: "[&>div]:rounded-t-sm",
25
+ field: "[&>div]:rounded-t-lg",
26
+ },
27
+ },
28
+ readonly: {
29
+ true: {
30
+ base: "cursor-not-allowed",
31
+ toolbar: "pointer-events-none *:opacity-40",
26
32
  },
27
33
  },
28
34
  size: {
package/dist/index.d.ts CHANGED
@@ -12,7 +12,6 @@ export { addIconsToRegistry } from "./components/atoms/icon/index.js";
12
12
  export { default as Icon } from "./components/atoms/icon/Icon.svelte";
13
13
  export { default as IconButton } from "./components/atoms/actions/iconButton/IconButton.svelte";
14
14
  export { default as Input } from "./components/atoms/input/Input.svelte";
15
- export { default as InputDate } from "./components/atoms/inputDate/InputDate.svelte";
16
15
  export { default as Label } from "./components/atoms/label/Label.svelte";
17
16
  export { default as ProgressBar } from "./components/atoms/feedback/progressBar/ProgressBar.svelte";
18
17
  export { default as Radio } from "./components/atoms/radio/Radio.svelte";
package/dist/index.js CHANGED
@@ -17,7 +17,6 @@ export { addIconsToRegistry } from "./components/atoms/icon/index.js";
17
17
  export { default as Icon } from "./components/atoms/icon/Icon.svelte";
18
18
  export { default as IconButton } from "./components/atoms/actions/iconButton/IconButton.svelte";
19
19
  export { default as Input } from "./components/atoms/input/Input.svelte";
20
- export { default as InputDate } from "./components/atoms/inputDate/InputDate.svelte";
21
20
  export { default as Label } from "./components/atoms/label/Label.svelte";
22
21
  export { default as ProgressBar } from "./components/atoms/feedback/progressBar/ProgressBar.svelte";
23
22
  export { default as Radio } from "./components/atoms/radio/Radio.svelte";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websline/system-components",
3
- "version": "1.4.6",
3
+ "version": "1.4.8",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -1,114 +0,0 @@
1
- <script>
2
- import { Popover } from "bits-ui";
3
- import { getContext } from "svelte";
4
- import { IconButton } from "../../../index.js";
5
- import Picker from "./Picker.svelte";
6
- import { inputVariants } from "./input.variants.js";
7
-
8
- /**
9
- * @typedef {Object} Props
10
- * @property {string|import("svelte").SvelteComponent|Function} [adornmentStart=""] Content to display at the start of the input (e.g., icon or text)
11
- * @property {import("svelte").SvelteComponent} [children] Additional content to render inside the input component
12
- * @property {string} [class=""] Additional CSS classes to apply to the component
13
- * @property {boolean} [disabled] Whether the input is disabled
14
- * @property {boolean} [error] Whether the input has an error state
15
- * @property {string} [id] The ID of the input element
16
- * @property {string} [name] The name of the input, used for form submission
17
- * @property {string} [placeholder=""] Placeholder text for the input
18
- * @property {boolean} [readonly=false] Whether the input is read-only
19
- * @property {boolean} [required] Whether the input is required
20
- * @property {string} [value=""] The value of the input, bound to the component
21
- */
22
-
23
- /** @type {Props} */
24
- let {
25
- adornmentStart = "",
26
- children,
27
- class: className = "",
28
- disabled,
29
- error,
30
- id,
31
- name,
32
- placeholder = "",
33
- readonly = false,
34
- required,
35
- value = $bindable(),
36
- // TODO
37
- preventScroll = false,
38
- portalDisabled = true,
39
- portalTarget = "body",
40
- side = "bottom",
41
- sideOffset = 8,
42
- ...rest
43
- } = $props();
44
-
45
- let store = getContext("form-field-store") ?? null;
46
-
47
- let localValues = $derived.by(() => {
48
- const storeValues = typeof store === "function" ? store() : {};
49
-
50
- return {
51
- disabled: disabled ?? storeValues.disabled ?? false,
52
- error: error ?? storeValues.error ?? false,
53
- id: id ?? storeValues.id ?? "",
54
- required: required ?? storeValues.required ?? false,
55
- };
56
- });
57
-
58
- let styles = $derived(
59
- inputVariants({
60
- disabled: localValues.disabled,
61
- error: localValues.error,
62
- }),
63
- );
64
- </script>
65
-
66
- <Popover.Root>
67
- <div class={styles.base({ class: className })}>
68
- {#if adornmentStart}
69
- <div class={styles.adornmentStart()}>
70
- {#if typeof adornmentStart === "function"}
71
- {@render adornmentStart()}
72
- {:else}
73
- {adornmentStart}
74
- {/if}
75
- </div>
76
- {/if}
77
-
78
- {#if children}
79
- <!-- The date picker -->
80
- <Picker
81
- {children}
82
- {preventScroll}
83
- {portalDisabled}
84
- {portalTarget}
85
- {side}
86
- {sideOffset} />
87
- {/if}
88
-
89
- <input
90
- class={styles.input()}
91
- disabled={localValues.disabled}
92
- id={localValues.id}
93
- {name}
94
- {placeholder}
95
- {readonly}
96
- required={localValues.required}
97
- {...rest}
98
- bind:value />
99
-
100
- <div class={styles.adornmentEnd()}>
101
- <Popover.Trigger>
102
- {#snippet child({ props })}
103
- <IconButton
104
- color="transparent"
105
- icon="calendar"
106
- iconSize={24}
107
- shape="square"
108
- size="small"
109
- {...props} />
110
- {/snippet}
111
- </Popover.Trigger>
112
- </div>
113
- </div>
114
- </Popover.Root>
@@ -1,97 +0,0 @@
1
- export default InputDate;
2
- type InputDate = {
3
- $on?(type: string, callback: (e: any) => void): () => void;
4
- $set?(props: Partial<Props>): void;
5
- };
6
- declare const InputDate: import("svelte").Component<{
7
- /**
8
- * Content to display at the start of the input (e.g., icon or text)
9
- */
10
- adornmentStart?: string | import("svelte").SvelteComponent | Function;
11
- /**
12
- * Additional content to render inside the input component
13
- */
14
- children?: import("svelte").SvelteComponent;
15
- /**
16
- * Additional CSS classes to apply to the component
17
- */
18
- class?: string;
19
- /**
20
- * Whether the input is disabled
21
- */
22
- disabled?: boolean;
23
- /**
24
- * Whether the input has an error state
25
- */
26
- error?: boolean;
27
- /**
28
- * The ID of the input element
29
- */
30
- id?: string;
31
- /**
32
- * The name of the input, used for form submission
33
- */
34
- name?: string;
35
- /**
36
- * Placeholder text for the input
37
- */
38
- placeholder?: string;
39
- /**
40
- * Whether the input is read-only
41
- */
42
- readonly?: boolean;
43
- /**
44
- * Whether the input is required
45
- */
46
- required?: boolean;
47
- /**
48
- * The value of the input, bound to the component
49
- */
50
- value?: string;
51
- }, {}, "value">;
52
- type Props = {
53
- /**
54
- * Content to display at the start of the input (e.g., icon or text)
55
- */
56
- adornmentStart?: string | import("svelte").SvelteComponent | Function;
57
- /**
58
- * Additional content to render inside the input component
59
- */
60
- children?: import("svelte").SvelteComponent;
61
- /**
62
- * Additional CSS classes to apply to the component
63
- */
64
- class?: string;
65
- /**
66
- * Whether the input is disabled
67
- */
68
- disabled?: boolean;
69
- /**
70
- * Whether the input has an error state
71
- */
72
- error?: boolean;
73
- /**
74
- * The ID of the input element
75
- */
76
- id?: string;
77
- /**
78
- * The name of the input, used for form submission
79
- */
80
- name?: string;
81
- /**
82
- * Placeholder text for the input
83
- */
84
- placeholder?: string;
85
- /**
86
- * Whether the input is read-only
87
- */
88
- readonly?: boolean;
89
- /**
90
- * Whether the input is required
91
- */
92
- required?: boolean;
93
- /**
94
- * The value of the input, bound to the component
95
- */
96
- value?: string;
97
- };
@@ -1,36 +0,0 @@
1
- <script>
2
- import { Popover } from "bits-ui";
3
- import { quintOut } from "svelte/easing";
4
- import { scale } from "svelte/transition";
5
-
6
- let {
7
- children,
8
- preventScroll = false,
9
- portalDisabled = true,
10
- portalTarget = "body",
11
- side = "bottom",
12
- sideOffset = 8,
13
- ...rest
14
- } = $props();
15
- </script>
16
-
17
- <Popover.Portal disabled={portalDisabled} to={portalTarget}>
18
- <Popover.Content
19
- align="end"
20
- alignOffset={0}
21
- forceMount
22
- {preventScroll}
23
- {side}
24
- {sideOffset}
25
- {...rest}>
26
- {#snippet child({ open, props, wrapperProps })}
27
- {#if open}
28
- <div {...wrapperProps}>
29
- <div {...props} in:scale={{ duration: 300, easing: quintOut, start: 0.75 }}>
30
- {@render children()}
31
- </div>
32
- </div>
33
- {/if}
34
- {/snippet}
35
- </Popover.Content>
36
- </Popover.Portal>
@@ -1,21 +0,0 @@
1
- export default Picker;
2
- type Picker = {
3
- $on?(type: string, callback: (e: any) => void): () => void;
4
- $set?(props: Partial<$$ComponentProps>): void;
5
- };
6
- declare const Picker: import("svelte").Component<{
7
- children: any;
8
- preventScroll?: boolean;
9
- portalDisabled?: boolean;
10
- portalTarget?: string;
11
- side?: string;
12
- sideOffset?: number;
13
- } & Record<string, any>, {}, "">;
14
- type $$ComponentProps = {
15
- children: any;
16
- preventScroll?: boolean;
17
- portalDisabled?: boolean;
18
- portalTarget?: string;
19
- side?: string;
20
- sideOffset?: number;
21
- } & Record<string, any>;
@@ -1,64 +0,0 @@
1
- export const inputVariants: import("tailwind-variants").TVReturnType<{
2
- disabled: {
3
- true: {
4
- input: string;
5
- };
6
- };
7
- }, {
8
- adornmentStart: string;
9
- adornmentEnd: string;
10
- base: string;
11
- input: string;
12
- }, undefined, {
13
- disabled: {
14
- true: {
15
- base: string;
16
- };
17
- };
18
- error: {
19
- true: {
20
- base: string;
21
- };
22
- };
23
- }, {
24
- base: string[];
25
- }, import("tailwind-variants").TVReturnType<{
26
- disabled: {
27
- true: {
28
- base: string;
29
- };
30
- };
31
- error: {
32
- true: {
33
- base: string;
34
- };
35
- };
36
- }, {
37
- base: string[];
38
- }, undefined, {
39
- disabled: {
40
- true: {
41
- base: string;
42
- };
43
- };
44
- error: {
45
- true: {
46
- base: string;
47
- };
48
- };
49
- }, {
50
- base: string[];
51
- }, import("tailwind-variants").TVReturnType<{
52
- disabled: {
53
- true: {
54
- base: string;
55
- };
56
- };
57
- error: {
58
- true: {
59
- base: string;
60
- };
61
- };
62
- }, {
63
- base: string[];
64
- }, undefined, unknown, unknown, undefined>>>;
@@ -1,20 +0,0 @@
1
- import { inputBaseVariant, tv } from "../../../utils/tailwind.js";
2
-
3
- const inputVariants = tv({
4
- extend: inputBaseVariant,
5
- slots: {
6
- adornmentStart:
7
- "pointer-events-none shrink-0 body-small text-neutral-900 dark:text-neutral-200",
8
- adornmentEnd: "shrink-0 body-small text-neutral-900 dark:text-neutral-200",
9
- base: "flex h-10 items-center gap-2 pr-1",
10
- input:
11
- "h-full w-full appearance-none border-0 bg-transparent p-0 [font-size:inherit] leading-[inherit] focus:shadow-none focus:ring-0 focus:outline-0",
12
- },
13
- variants: {
14
- disabled: {
15
- true: { input: "cursor-not-allowed" },
16
- },
17
- },
18
- });
19
-
20
- export { inputVariants };