@streamscloud/kit 0.2.4 → 0.2.5

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 (65) hide show
  1. package/dist/ui/badge/cmp.badge.svelte +85 -0
  2. package/dist/ui/badge/cmp.badge.svelte.d.ts +26 -0
  3. package/dist/ui/badge/index.d.ts +2 -0
  4. package/dist/ui/badge/index.js +1 -0
  5. package/dist/ui/badge/types.d.ts +1 -0
  6. package/dist/ui/badge/types.js +1 -0
  7. package/dist/ui/button/cmp.button.svelte.d.ts +1 -0
  8. package/dist/ui/button/cmp.options-button.svelte.d.ts +1 -0
  9. package/dist/ui/checkbox/cmp.checkbox.svelte +102 -0
  10. package/dist/ui/checkbox/cmp.checkbox.svelte.d.ts +34 -0
  11. package/dist/ui/checkbox/cmp.three-state-checkbox.svelte +112 -0
  12. package/dist/ui/checkbox/cmp.three-state-checkbox.svelte.d.ts +37 -0
  13. package/dist/ui/checkbox/index.d.ts +3 -0
  14. package/dist/ui/checkbox/index.js +2 -0
  15. package/dist/ui/checkbox/types.d.ts +1 -0
  16. package/dist/ui/checkbox/types.js +1 -0
  17. package/dist/ui/confirmation-dialog/cmp.confirmation-dialog.svelte +58 -0
  18. package/dist/ui/confirmation-dialog/cmp.confirmation-dialog.svelte.d.ts +9 -0
  19. package/dist/ui/confirmation-dialog/confirmation-dialog-localization.d.ts +4 -0
  20. package/dist/ui/confirmation-dialog/confirmation-dialog-localization.js +19 -0
  21. package/dist/ui/confirmation-dialog/index.d.ts +19 -0
  22. package/dist/ui/confirmation-dialog/index.js +22 -0
  23. package/dist/ui/confirmation-dialog/types.d.ts +7 -0
  24. package/dist/ui/confirmation-dialog/types.js +1 -0
  25. package/dist/ui/datetime-picker/cmp.datetime-picker.svelte +286 -0
  26. package/dist/ui/datetime-picker/cmp.datetime-picker.svelte.d.ts +37 -0
  27. package/dist/ui/datetime-picker/datetime-picker-localization.d.ts +5 -0
  28. package/dist/ui/datetime-picker/datetime-picker-localization.js +26 -0
  29. package/dist/ui/datetime-picker/flatpickr-theme.d.ts +1 -0
  30. package/dist/ui/datetime-picker/flatpickr-theme.js +13 -0
  31. package/dist/ui/datetime-picker/index.d.ts +2 -0
  32. package/dist/ui/datetime-picker/index.js +1 -0
  33. package/dist/ui/datetime-picker/types.d.ts +16 -0
  34. package/dist/ui/datetime-picker/types.js +1 -0
  35. package/dist/ui/dialog/cmp.dialog-button.svelte.d.ts +1 -0
  36. package/dist/ui/dropdown/cmp.dropdown.svelte +23 -9
  37. package/dist/ui/dropdown/cmp.dropdown.svelte.d.ts +7 -2
  38. package/dist/ui/dropdown/index.d.ts +0 -1
  39. package/dist/ui/dropdown/index.js +0 -1
  40. package/dist/ui/icon-text/cmp.icon-text.svelte +1 -1
  41. package/dist/ui/inputs/input/cmp.input-validatable.svelte.d.ts +1 -0
  42. package/dist/ui/inputs/input/cmp.input.svelte.d.ts +1 -0
  43. package/dist/ui/inputs/textarea/cmp.textarea-validatable.svelte.d.ts +2 -1
  44. package/dist/ui/inputs/textarea/cmp.textarea.svelte.d.ts +1 -0
  45. package/dist/ui/placeholder/cmp.placeholder.svelte +65 -0
  46. package/dist/ui/placeholder/cmp.placeholder.svelte.d.ts +19 -0
  47. package/dist/ui/placeholder/index.d.ts +1 -0
  48. package/dist/ui/placeholder/index.js +1 -0
  49. package/dist/ui/selects/_multiselect.scss +3 -3
  50. package/dist/ui/selects/_singleselect.scss +1 -1
  51. package/dist/ui/selects/cmp.multiselect.svelte +2 -2
  52. package/dist/ui/selects/cmp.search-multiselect.svelte +2 -2
  53. package/dist/ui/toggle/cmp.toggle.svelte +103 -0
  54. package/dist/ui/toggle/cmp.toggle.svelte.d.ts +25 -0
  55. package/dist/ui/toggle/index.d.ts +1 -0
  56. package/dist/ui/toggle/index.js +1 -0
  57. package/dist/ui/tooltip/cmp.tooltip.svelte +192 -0
  58. package/dist/ui/tooltip/cmp.tooltip.svelte.d.ts +31 -0
  59. package/dist/ui/tooltip/index.d.ts +2 -0
  60. package/dist/ui/tooltip/index.js +1 -0
  61. package/dist/ui/tooltip/types.d.ts +2 -0
  62. package/dist/ui/tooltip/types.js +1 -0
  63. package/package.json +31 -1
  64. package/dist/ui/dropdown/cmp.dropdown-panel.svelte +0 -29
  65. package/dist/ui/dropdown/cmp.dropdown-panel.svelte.d.ts +0 -18
@@ -0,0 +1,85 @@
1
+ <script lang="ts">const { color = undefined, rounded = false, children } = $props();
2
+ export {};
3
+ </script>
4
+
5
+ <div
6
+ class="badge"
7
+ class:badge--default={color === 'default'}
8
+ class:badge--gray={color === 'gray'}
9
+ class:badge--green={color === 'green'}
10
+ class:badge--red={color === 'red'}
11
+ class:badge--orange={color === 'orange'}
12
+ class:badge--blue={color === 'blue'}
13
+ class:badge--rounded={rounded}>
14
+ <div class="badge__content">
15
+ {@render children()}
16
+ </div>
17
+ </div>
18
+
19
+ <!--
20
+ @component
21
+ Displays a small color-coded label for statuses, categories, or counts.
22
+
23
+ ### CSS Custom Properties
24
+ | Property | Description | Default |
25
+ |---|---|---|
26
+ | `--sc-kit--badge--color` | Text color | `gray-800` / `white` |
27
+ | `--sc-kit--badge--background-color` | Background color | `white` / `gray-800` |
28
+ | `--sc-kit--badge--font-size` | Content font size | `0.625em` |
29
+ | `--sc-kit--badge--border-radius` | Corner radius | `0.25em` |
30
+ | `--sc-kit--badge--width` | Badge width | `5em` |
31
+ | `--sc-kit--badge--height` | Badge height | `1.5em` |
32
+ | `--sc-kit--badge--content-padding` | Content padding | `0` |
33
+ | `--sc-kit--badge--line-break` | Line break behavior | `auto` |
34
+ -->
35
+
36
+ <style>.badge {
37
+ --_badge--color: var(--sc-kit--badge--color, light-dark(#2e2e2e, #ffffff));
38
+ --_badge--background-color: var(--sc-kit--badge--background-color, light-dark(#ffffff, #2e2e2e));
39
+ --_badge--font-size: var(--sc-kit--badge--font-size, 0.625em);
40
+ --_badge--border-radius: var(--sc-kit--badge--border-radius, 0.25em);
41
+ --_badge--width: var(--sc-kit--badge--width, 5em);
42
+ --_badge--height: var(--sc-kit--badge--height, 1.5em);
43
+ --_badge--content-padding: var(--sc-kit--badge--content-padding, 0rem);
44
+ --_badge--line-break: var(--sc-kit--badge--line-break, auto);
45
+ display: inline-flex;
46
+ justify-content: center;
47
+ align-items: center;
48
+ color: var(--_badge--color);
49
+ background: var(--_badge--background-color);
50
+ width: var(--_badge--width);
51
+ height: var(--_badge--height);
52
+ border-radius: var(--_badge--border-radius);
53
+ line-break: var(--_badge--line-break);
54
+ }
55
+ .badge__content {
56
+ font-size: var(--_badge--font-size);
57
+ padding: var(--_badge--content-padding);
58
+ }
59
+ .badge--default {
60
+ --_badge--color: light-dark(#2e2e2e, #ffffff);
61
+ --_badge--background-color: light-dark(#ffffff, #2e2e2e);
62
+ }
63
+ .badge--gray {
64
+ --_badge--color: light-dark(#6b7280, #f2f2f3);
65
+ --_badge--background-color: light-dark(#f2f2f3, #374151);
66
+ }
67
+ .badge--green {
68
+ --_badge--color: #0cce6b;
69
+ --_badge--background-color: #ecfef4;
70
+ }
71
+ .badge--red {
72
+ --_badge--color: #e71d36;
73
+ --_badge--background-color: #fef1f3;
74
+ }
75
+ .badge--orange {
76
+ --_badge--color: #ffa62b;
77
+ --_badge--background-color: #fffbeb;
78
+ }
79
+ .badge--blue {
80
+ --_badge--color: light-dark(#144ab0, #5a8dec);
81
+ --_badge--background-color: #f9fafb;
82
+ }
83
+ .badge--rounded {
84
+ --_badge--border-radius: calc(var(--_badge--height) / 2);
85
+ }</style>
@@ -0,0 +1,26 @@
1
+ import type { BadgeColor } from './types';
2
+ import type { Snippet } from 'svelte';
3
+ type Props = {
4
+ /** @default undefined */
5
+ color?: BadgeColor | null;
6
+ rounded?: boolean;
7
+ children: Snippet;
8
+ };
9
+ /**
10
+ * Displays a small color-coded label for statuses, categories, or counts.
11
+ *
12
+ * ### CSS Custom Properties
13
+ * | Property | Description | Default |
14
+ * |---|---|---|
15
+ * | `--sc-kit--badge--color` | Text color | `gray-800` / `white` |
16
+ * | `--sc-kit--badge--background-color` | Background color | `white` / `gray-800` |
17
+ * | `--sc-kit--badge--font-size` | Content font size | `0.625em` |
18
+ * | `--sc-kit--badge--border-radius` | Corner radius | `0.25em` |
19
+ * | `--sc-kit--badge--width` | Badge width | `5em` |
20
+ * | `--sc-kit--badge--height` | Badge height | `1.5em` |
21
+ * | `--sc-kit--badge--content-padding` | Content padding | `0` |
22
+ * | `--sc-kit--badge--line-break` | Line break behavior | `auto` |
23
+ */
24
+ declare const Cmp: import("svelte").Component<Props, {}, "">;
25
+ type Cmp = ReturnType<typeof Cmp>;
26
+ export default Cmp;
@@ -0,0 +1,2 @@
1
+ export { default as Badge } from './cmp.badge.svelte';
2
+ export type { BadgeColor } from './types';
@@ -0,0 +1 @@
1
+ export { default as Badge } from './cmp.badge.svelte';
@@ -0,0 +1 @@
1
+ export type BadgeColor = 'default' | 'blue' | 'green' | 'gray' | 'orange' | 'red';
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,7 @@
1
1
  import type { ButtonSize, ButtonVariant } from './resources/types';
2
2
  import type { Snippet } from 'svelte';
3
3
  type Props = {
4
+ /** @default 'button' */
4
5
  type?: 'button' | 'submit' | 'reset';
5
6
  disabled?: boolean;
6
7
  autofocus?: boolean;
@@ -2,6 +2,7 @@ import type { ButtonSize, ButtonVariant } from './resources/types';
2
2
  import { type Placement } from '@popperjs/core';
3
3
  import type { Snippet } from 'svelte';
4
4
  type Props = {
5
+ /** @default 'button' */
5
6
  type?: 'button' | 'submit' | 'reset';
6
7
  disabled?: boolean;
7
8
  autofocus?: boolean;
@@ -0,0 +1,102 @@
1
+ <script lang="ts">import { Icon } from '../icon';
2
+ import IconCheckboxChecked from '@fluentui/svg-icons/icons/checkbox_checked_20_filled.svg?raw';
3
+ import IconCheckboxUnchecked from '@fluentui/svg-icons/icons/checkbox_unchecked_20_regular.svg?raw';
4
+ const { checked, disabled = false, label = undefined, stopPropagation = true, title = '', checkedIcon = IconCheckboxChecked, uncheckedIcon = IconCheckboxUnchecked, children, on } = $props();
5
+ let iconRef;
6
+ const onCheckboxClick = (event) => {
7
+ if (stopPropagation) {
8
+ event.stopPropagation();
9
+ }
10
+ if (disabled) {
11
+ return;
12
+ }
13
+ on?.change(!checked);
14
+ };
15
+ const onCheckboxKeyPress = (event) => {
16
+ if (event.code === 'Space' || event.key === ' ') {
17
+ event.preventDefault();
18
+ onCheckboxClick(event);
19
+ setTimeout(() => {
20
+ iconRef.focus();
21
+ });
22
+ }
23
+ };
24
+ </script>
25
+
26
+ <div
27
+ class="checkbox"
28
+ onclick={onCheckboxClick}
29
+ class:checkbox--disabled={disabled}
30
+ class:checkbox--align-top={!!children}
31
+ title={title}
32
+ onkeydown={onCheckboxKeyPress}
33
+ role="none">
34
+ <!-- svelte-ignore a11y_no_noninteractive_tabindex -->
35
+ <span class="checkbox__icon" class:checkbox__icon--checked={checked} tabindex="0" bind:this={iconRef}>
36
+ <Icon src={checked ? checkedIcon : uncheckedIcon} />
37
+ </span>
38
+ {#if label}
39
+ <span class="checkbox__label">{label}</span>
40
+ {:else if children}
41
+ <div class="checkbox__body">
42
+ {@render children()}
43
+ </div>
44
+ {/if}
45
+ </div>
46
+
47
+ <!--
48
+ @component
49
+ A checkbox control with optional label or custom body content.
50
+
51
+ ### CSS Custom Properties
52
+ | Property | Description | Default |
53
+ |---|---|---|
54
+ | `--sc-kit--checkbox--gap` | Gap between icon and label | `0.625em` |
55
+ | `--sc-kit--checkbox--icon--size` | Checkbox icon size | `1.5em` |
56
+ | `--sc-kit--checkbox--label--font-size` | Label font size | `1em` |
57
+ | `--sc-kit--checkbox--label--line-height` | Label line height | `1em` |
58
+ | `--sc-kit--checkbox--align-items` | Alignment when children present | `center` |
59
+ | `--sc-kit--checkbox--color` | Unchecked icon color | `neutral-500` / `neutral-600` |
60
+ | `--sc-kit--checkbox--color--checked` | Checked icon color | `primary-500` / `primary-400` |
61
+ -->
62
+
63
+ <style>.checkbox {
64
+ --_checkbox--gap: var(--sc-kit--checkbox--gap, 0.625em);
65
+ --_checkbox--icon--size: var(--sc-kit--checkbox--icon--size, 1.5em);
66
+ --_checkbox--label--font-size: var(--sc-kit--checkbox--label--font-size, 1em);
67
+ --_checkbox--label--line-height: var(--sc-kit--checkbox--label--line-height, 1em);
68
+ --_checkbox--align-items: var(--sc-kit--checkbox--align-items, center);
69
+ --_checkbox--color: var(--sc-kit--checkbox--color, light-dark(#6b7280, #4b5563));
70
+ --_checkbox--color--checked: var(--sc-kit--checkbox--color--checked, light-dark(#144ab0, #5a8dec));
71
+ display: inline-flex;
72
+ align-items: center;
73
+ gap: var(--_checkbox--gap);
74
+ }
75
+ .checkbox--align-top {
76
+ align-items: var(--_checkbox--align-items);
77
+ }
78
+ .checkbox__icon {
79
+ --sc-kit--icon--size: var(--_checkbox--icon--size);
80
+ --sc-kit--icon--color: var(--_checkbox--color);
81
+ cursor: pointer;
82
+ }
83
+ .checkbox__icon:focus {
84
+ filter: drop-shadow(1px 1px 0.5px rgba(0, 0, 0, 0.25));
85
+ }
86
+ .checkbox__icon--checked {
87
+ --sc-kit--icon--color: var(--_checkbox--color--checked);
88
+ }
89
+ .checkbox__label, .checkbox__body {
90
+ font-size: var(--_checkbox--label--font-size);
91
+ line-height: var(--_checkbox--label--line-height);
92
+ cursor: pointer;
93
+ -webkit-user-drag: none;
94
+ user-select: none;
95
+ }
96
+ .checkbox__label :global([contenteditable]), .checkbox__body :global([contenteditable]) {
97
+ user-select: text;
98
+ }
99
+ .checkbox--disabled {
100
+ opacity: 0.5;
101
+ cursor: default;
102
+ }</style>
@@ -0,0 +1,34 @@
1
+ import type { Snippet } from 'svelte';
2
+ type Props = {
3
+ checked: boolean;
4
+ disabled?: boolean;
5
+ label?: string;
6
+ /** @default true */
7
+ stopPropagation?: boolean;
8
+ title?: string;
9
+ /** Custom icon for checked state */
10
+ checkedIcon?: string;
11
+ /** Custom icon for unchecked state */
12
+ uncheckedIcon?: string;
13
+ children?: Snippet;
14
+ on?: {
15
+ change: (value: boolean) => void;
16
+ };
17
+ };
18
+ /**
19
+ * A checkbox control with optional label or custom body content.
20
+ *
21
+ * ### CSS Custom Properties
22
+ * | Property | Description | Default |
23
+ * |---|---|---|
24
+ * | `--sc-kit--checkbox--gap` | Gap between icon and label | `0.625em` |
25
+ * | `--sc-kit--checkbox--icon--size` | Checkbox icon size | `1.5em` |
26
+ * | `--sc-kit--checkbox--label--font-size` | Label font size | `1em` |
27
+ * | `--sc-kit--checkbox--label--line-height` | Label line height | `1em` |
28
+ * | `--sc-kit--checkbox--align-items` | Alignment when children present | `center` |
29
+ * | `--sc-kit--checkbox--color` | Unchecked icon color | `neutral-500` / `neutral-600` |
30
+ * | `--sc-kit--checkbox--color--checked` | Checked icon color | `primary-500` / `primary-400` |
31
+ */
32
+ declare const Cmp: import("svelte").Component<Props, {}, "">;
33
+ type Cmp = ReturnType<typeof Cmp>;
34
+ export default Cmp;
@@ -0,0 +1,112 @@
1
+ <script lang="ts">import { Icon } from '../icon';
2
+ import IconCheckboxChecked from '@fluentui/svg-icons/icons/checkbox_checked_20_filled.svg?raw';
3
+ import IconCheckboxIndeterminate from '@fluentui/svg-icons/icons/checkbox_indeterminate_20_filled.svg?raw';
4
+ import IconCheckboxUnchecked from '@fluentui/svg-icons/icons/checkbox_unchecked_20_regular.svg?raw';
5
+ const { state, disabled = false, label = undefined, stopPropagation = true, title = '', checkedIcon = IconCheckboxChecked, uncheckedIcon = IconCheckboxUnchecked, indeterminateIcon = IconCheckboxIndeterminate, children, on } = $props();
6
+ let iconRef;
7
+ const onCheckboxClick = (event) => {
8
+ if (stopPropagation) {
9
+ event.stopPropagation();
10
+ }
11
+ if (disabled) {
12
+ return;
13
+ }
14
+ on?.change(state !== 'checked');
15
+ };
16
+ const onCheckboxKeyPress = (event) => {
17
+ if (event.code === 'Space' || event.key === ' ') {
18
+ event.preventDefault();
19
+ onCheckboxClick(event);
20
+ setTimeout(() => {
21
+ iconRef.focus();
22
+ });
23
+ }
24
+ };
25
+ const checkboxIcon = $derived.by(() => {
26
+ if (state === 'checked') {
27
+ return checkedIcon;
28
+ }
29
+ if (state === 'indeterminate') {
30
+ return indeterminateIcon;
31
+ }
32
+ return uncheckedIcon;
33
+ });
34
+ </script>
35
+
36
+ <div
37
+ class="checkbox"
38
+ onclick={onCheckboxClick}
39
+ class:checkbox--disabled={disabled}
40
+ class:checkbox--align-top={!!children}
41
+ title={title}
42
+ onkeydown={onCheckboxKeyPress}
43
+ role="none">
44
+ <!-- svelte-ignore a11y_no_noninteractive_tabindex -->
45
+ <span class="checkbox__icon" class:checkbox__icon--checked={state !== 'unchecked'} tabindex="0" bind:this={iconRef}>
46
+ <Icon src={checkboxIcon} />
47
+ </span>
48
+ {#if label}
49
+ <span class="checkbox__label">{label}</span>
50
+ {:else if children}
51
+ <div class="checkbox__body">
52
+ {@render children()}
53
+ </div>
54
+ {/if}
55
+ </div>
56
+
57
+ <!--
58
+ @component
59
+ A three-state checkbox (unchecked, checked, indeterminate) with optional label or custom body.
60
+
61
+ ### CSS Custom Properties
62
+ | Property | Description | Default |
63
+ |---|---|---|
64
+ | `--sc-kit--checkbox--gap` | Gap between icon and label | `0.625em` |
65
+ | `--sc-kit--checkbox--icon--size` | Checkbox icon size | `1.5em` |
66
+ | `--sc-kit--checkbox--label--font-size` | Label font size | `1em` |
67
+ | `--sc-kit--checkbox--label--line-height` | Label line height | `1em` |
68
+ | `--sc-kit--checkbox--align-items` | Alignment when children present | `center` |
69
+ | `--sc-kit--checkbox--color` | Unchecked icon color | `neutral-500` / `neutral-600` |
70
+ | `--sc-kit--checkbox--color--checked` | Checked/indeterminate icon color | `primary-500` / `primary-400` |
71
+ -->
72
+
73
+ <style>.checkbox {
74
+ --_checkbox--gap: var(--sc-kit--checkbox--gap, 0.625em);
75
+ --_checkbox--icon--size: var(--sc-kit--checkbox--icon--size, 1.5em);
76
+ --_checkbox--label--font-size: var(--sc-kit--checkbox--label--font-size, 1em);
77
+ --_checkbox--label--line-height: var(--sc-kit--checkbox--label--line-height, 1em);
78
+ --_checkbox--align-items: var(--sc-kit--checkbox--align-items, center);
79
+ --_checkbox--color: var(--sc-kit--checkbox--color, light-dark(#6b7280, #4b5563));
80
+ --_checkbox--color--checked: var(--sc-kit--checkbox--color--checked, light-dark(#144ab0, #5a8dec));
81
+ display: inline-flex;
82
+ align-items: center;
83
+ gap: var(--_checkbox--gap);
84
+ }
85
+ .checkbox--align-top {
86
+ align-items: var(--_checkbox--align-items);
87
+ }
88
+ .checkbox__icon {
89
+ --sc-kit--icon--size: var(--_checkbox--icon--size);
90
+ --sc-kit--icon--color: var(--_checkbox--color);
91
+ cursor: pointer;
92
+ }
93
+ .checkbox__icon:focus {
94
+ filter: drop-shadow(1px 1px 0.5px rgba(0, 0, 0, 0.25));
95
+ }
96
+ .checkbox__icon--checked {
97
+ --sc-kit--icon--color: var(--_checkbox--color--checked);
98
+ }
99
+ .checkbox__label, .checkbox__body {
100
+ font-size: var(--_checkbox--label--font-size);
101
+ line-height: var(--_checkbox--label--line-height);
102
+ cursor: pointer;
103
+ -webkit-user-drag: none;
104
+ user-select: none;
105
+ }
106
+ .checkbox__label :global([contenteditable]), .checkbox__body :global([contenteditable]) {
107
+ user-select: text;
108
+ }
109
+ .checkbox--disabled {
110
+ opacity: 0.5;
111
+ cursor: default;
112
+ }</style>
@@ -0,0 +1,37 @@
1
+ import type { CheckboxState } from './types';
2
+ import type { Snippet } from 'svelte';
3
+ type Props = {
4
+ state: CheckboxState;
5
+ disabled?: boolean;
6
+ label?: string;
7
+ /** @default true */
8
+ stopPropagation?: boolean;
9
+ title?: string;
10
+ /** Custom icon for checked state */
11
+ checkedIcon?: string;
12
+ /** Custom icon for unchecked state */
13
+ uncheckedIcon?: string;
14
+ /** Custom icon for indeterminate state */
15
+ indeterminateIcon?: string;
16
+ children?: Snippet;
17
+ on?: {
18
+ change: (value: boolean) => void;
19
+ };
20
+ };
21
+ /**
22
+ * A three-state checkbox (unchecked, checked, indeterminate) with optional label or custom body.
23
+ *
24
+ * ### CSS Custom Properties
25
+ * | Property | Description | Default |
26
+ * |---|---|---|
27
+ * | `--sc-kit--checkbox--gap` | Gap between icon and label | `0.625em` |
28
+ * | `--sc-kit--checkbox--icon--size` | Checkbox icon size | `1.5em` |
29
+ * | `--sc-kit--checkbox--label--font-size` | Label font size | `1em` |
30
+ * | `--sc-kit--checkbox--label--line-height` | Label line height | `1em` |
31
+ * | `--sc-kit--checkbox--align-items` | Alignment when children present | `center` |
32
+ * | `--sc-kit--checkbox--color` | Unchecked icon color | `neutral-500` / `neutral-600` |
33
+ * | `--sc-kit--checkbox--color--checked` | Checked/indeterminate icon color | `primary-500` / `primary-400` |
34
+ */
35
+ declare const Cmp: import("svelte").Component<Props, {}, "">;
36
+ type Cmp = ReturnType<typeof Cmp>;
37
+ export default Cmp;
@@ -0,0 +1,3 @@
1
+ export { default as Checkbox } from './cmp.checkbox.svelte';
2
+ export { default as ThreeStateCheckbox } from './cmp.three-state-checkbox.svelte';
3
+ export type { CheckboxState } from './types';
@@ -0,0 +1,2 @@
1
+ export { default as Checkbox } from './cmp.checkbox.svelte';
2
+ export { default as ThreeStateCheckbox } from './cmp.three-state-checkbox.svelte';
@@ -0,0 +1 @@
1
+ export type CheckboxState = 'unchecked' | 'checked' | 'indeterminate';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,58 @@
1
+ <script lang="ts">import { Dialog, DialogButton, DialogCancelButton } from '../dialog';
2
+ import { IconText } from '../icon-text';
3
+ import { ConfirmationDialogLocalization } from './confirmation-dialog-localization';
4
+ import {} from './types';
5
+ import { untrack } from 'svelte';
6
+ const { controller, data } = $props();
7
+ const localization = new ConfirmationDialogLocalization();
8
+ const titleText = $derived(data.title);
9
+ const bodyText = $derived(data.text);
10
+ const style = $derived(data.style);
11
+ const icon = $derived(data.icon);
12
+ const STYLE_TO_VARIANT = {
13
+ alert: 'alert',
14
+ warning: 'warning',
15
+ info: 'primary'
16
+ };
17
+ const buttonVariant = $derived(STYLE_TO_VARIANT[style]);
18
+ const confirm = () => {
19
+ controller.ok(true);
20
+ };
21
+ const close = () => {
22
+ controller.cancel(false);
23
+ };
24
+ untrack(() => {
25
+ controller.updateSettings({ closeOnClickOutside: true, closeOnEsc: true });
26
+ controller.updateContainerSettings({ size: 'small', position: 'center' });
27
+ });
28
+ </script>
29
+
30
+ <div class="confirmation-dialog" class:confirmation-dialog--alert={style === 'alert'} class:confirmation-dialog--warning={style === 'warning'}>
31
+ <Dialog controller={controller} hideCloseButton={true}>
32
+ {#snippet title()}
33
+ {titleText}
34
+ {/snippet}
35
+ {#snippet body()}
36
+ {#if bodyText}
37
+ {bodyText}
38
+ {/if}
39
+ {/snippet}
40
+ {#snippet footer()}
41
+ <DialogCancelButton on={{ click: close }}>{localization.no}</DialogCancelButton>
42
+ <DialogButton on={{ click: confirm }} autofocus={true} variant={buttonVariant}>
43
+ {#if icon}
44
+ <IconText icon={icon}>
45
+ {localization.yes}
46
+ </IconText>
47
+ {:else}
48
+ {localization.yes}
49
+ {/if}
50
+ </DialogButton>
51
+ {/snippet}
52
+ </Dialog>
53
+ </div>
54
+
55
+ <style>.confirmation-dialog {
56
+ --sc-kit--dialog--body--padding-inline: 1.5rem;
57
+ --sc-kit--dialog--body--padding-block: 1.5rem 3rem;
58
+ }</style>
@@ -0,0 +1,9 @@
1
+ import { type DialogController } from '../dialog';
2
+ import { type ConfirmationDialogData } from './types';
3
+ type Props = {
4
+ controller: DialogController<boolean, boolean>;
5
+ data: ConfirmationDialogData;
6
+ };
7
+ declare const Cmp: import("svelte").Component<Props, {}, "">;
8
+ type Cmp = ReturnType<typeof Cmp>;
9
+ export default Cmp;
@@ -0,0 +1,4 @@
1
+ export declare class ConfirmationDialogLocalization {
2
+ get yes(): string;
3
+ get no(): string;
4
+ }
@@ -0,0 +1,19 @@
1
+ import { AppLocale } from '../../core/locale';
2
+ export class ConfirmationDialogLocalization {
3
+ get yes() {
4
+ return loc.yes[AppLocale.current];
5
+ }
6
+ get no() {
7
+ return loc.no[AppLocale.current];
8
+ }
9
+ }
10
+ const loc = {
11
+ yes: {
12
+ en: 'Yes',
13
+ no: 'Ja'
14
+ },
15
+ no: {
16
+ en: 'No',
17
+ no: 'Nei'
18
+ }
19
+ };
@@ -0,0 +1,19 @@
1
+ import { type ConfirmationDialogStyle } from './types';
2
+ /**
3
+ * Opens a confirmation dialog with Yes/No buttons.
4
+ *
5
+ * ### Options
6
+ * - `title` — dialog title text
7
+ * - `text` — optional body text
8
+ * - `style` — visual style: `'info'`, `'warning'`, or `'alert'` (default `'alert'`)
9
+ * - `icon` — optional SVG string for the confirm button icon
10
+ */
11
+ export declare const openConfirmationDialog: (init: {
12
+ title: string;
13
+ text?: string;
14
+ style?: ConfirmationDialogStyle;
15
+ icon?: string;
16
+ }) => Promise<{
17
+ wasCanceled: boolean;
18
+ }>;
19
+ export type { ConfirmationDialogStyle } from './types';
@@ -0,0 +1,22 @@
1
+ import { Dialogs } from '../dialog';
2
+ import ConfirmationDialog from './cmp.confirmation-dialog.svelte';
3
+ import {} from './types';
4
+ /**
5
+ * Opens a confirmation dialog with Yes/No buttons.
6
+ *
7
+ * ### Options
8
+ * - `title` — dialog title text
9
+ * - `text` — optional body text
10
+ * - `style` — visual style: `'info'`, `'warning'`, or `'alert'` (default `'alert'`)
11
+ * - `icon` — optional SVG string for the confirm button icon
12
+ */
13
+ export const openConfirmationDialog = async (init) => {
14
+ const { title, text = '', style = 'alert', icon } = init;
15
+ const data = { title, text, style, icon };
16
+ const res = await Dialogs.open({
17
+ view: ConfirmationDialog,
18
+ data,
19
+ explicitSettings: { closeOnClickOutside: false }
20
+ });
21
+ return { wasCanceled: res.wasCanceled };
22
+ };
@@ -0,0 +1,7 @@
1
+ export type ConfirmationDialogStyle = 'info' | 'warning' | 'alert';
2
+ export type ConfirmationDialogData = {
3
+ title: string;
4
+ text: string;
5
+ style: ConfirmationDialogStyle;
6
+ icon?: string;
7
+ };
@@ -0,0 +1 @@
1
+ export {};