@streamscloud/kit 0.2.22 → 0.2.24

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.
@@ -17,6 +17,7 @@
17
17
  --_input--text--font-size: var(--_--input--text--font-size, #{functions.em(14)});
18
18
  --_input--text--color: var(--_--input--text--color, light-dark(#{colors.$color-gray-800}, #{colors.$color-white}));
19
19
  --_input--placeholder--color: var(--_--input--placeholder--color, light-dark(#{colors.$color-neutral-300}, #{colors.$color-neutral-600}));
20
+ --input--placeholder--color: var(--_--input--placeholder--color);
20
21
 
21
22
  --_input--accent-color: var(--_--input--accent-color, light-dark(#{colors.$color-primary-500}, #{colors.$color-primary-400}));
22
23
 
@@ -8,33 +8,30 @@ import IconColorF from '@fluentui/svg-icons/icons/color_20_regular.svg?raw';
8
8
  import IconDismiss from '@fluentui/svg-icons/icons/dismiss_20_regular.svg?raw';
9
9
  import { colord } from 'colord';
10
10
  import AwesomeColorPicker from 'svelte-awesome-color-picker';
11
- let { value, enableReset = false, on, children, defaultPreviewIcon } = $props();
11
+ let { value, defaultColor, enableReset = false, on, children, defaultPreviewIcon } = $props();
12
12
  const loc = new ColorPickerLocalization();
13
+ const displayColor = $derived(value || defaultColor || '');
13
14
  const textColor = $derived.by(() => {
14
- if (!value) {
15
+ if (!displayColor) {
15
16
  return null;
16
17
  }
18
+ const hex = colord(displayColor).toHex();
19
+ const color = hex.substring(1, 7);
20
+ const red = parseInt(color.substring(0, 2), 16);
21
+ const green = parseInt(color.substring(2, 4), 16);
22
+ const blue = parseInt(color.substring(4, 6), 16);
23
+ if (red * 0.299 + green * 0.587 + blue * 0.114 > 149) {
24
+ return '#000000';
25
+ }
17
26
  else {
18
- const hex = colord(value).toHex();
19
- const color = hex.substring(1, 7);
20
- const red = parseInt(color.substring(0, 2), 16);
21
- const green = parseInt(color.substring(2, 4), 16);
22
- const blue = parseInt(color.substring(4, 6), 16);
23
- if (red * 0.299 + green * 0.587 + blue * 0.114 > 149) {
24
- return '#000000';
25
- }
26
- else {
27
- return '#ffffff';
28
- }
27
+ return '#ffffff';
29
28
  }
30
29
  });
31
30
  const previewBackgroundColor = $derived.by(() => {
32
- if (!value) {
31
+ if (!displayColor) {
33
32
  return '';
34
33
  }
35
- else {
36
- return colord(value).toHex().substring(0, 7);
37
- }
34
+ return colord(displayColor).toHex().substring(0, 7);
38
35
  });
39
36
  const resetValue = (e) => {
40
37
  e.preventDefault();
@@ -62,18 +59,19 @@ const onColorPickerInput = ({ hex }) => {
62
59
  placeholder={loc.notSet}
63
60
  --sc-kit--input--background={previewBackgroundColor}
64
61
  --sc-kit--input--text--color={textColor}
65
- --sc-kit--input--icon--color={textColor}>
62
+ --sc-kit--input--icon--color={textColor}
63
+ --sc-kit--input--placeholder--color={textColor}>
66
64
  {#snippet icon()}
67
65
  {#if defaultPreviewIcon}
68
66
  {@render defaultPreviewIcon()}
69
67
  {:else}
70
- <Icon src={IconColorF} color={value ? null : 'gray'} />
68
+ <Icon src={IconColorF} color={displayColor ? null : 'gray'} />
71
69
  {/if}
72
70
  {/snippet}
73
71
  {#snippet clearButton()}
74
72
  {#if !value}
75
73
  <button type="button" inert={true}>
76
- <Icon src={IconChevronDown} color="gray" />
74
+ <Icon src={IconChevronDown} color={displayColor ? null : 'gray'} />
77
75
  </button>
78
76
  {:else}
79
77
  <button type="button" inert={!enableReset} onclick={resetValue}>
@@ -91,7 +89,11 @@ const onColorPickerInput = ({ hex }) => {
91
89
  {/snippet}
92
90
 
93
91
  <div class="color-picker__panel">
94
- <AwesomeColorPicker hex={value ? colord(value).toHex() : null} isDialog={false} onInput={onColorPickerInput} textInputModes={['hex']} />
92
+ <AwesomeColorPicker
93
+ hex={value ? colord(value).toHex() : defaultColor ? colord(defaultColor).toHex() : null}
94
+ isDialog={false}
95
+ onInput={onColorPickerInput}
96
+ textInputModes={['hex']} />
95
97
  </div>
96
98
  </Dropdown>
97
99
  </div>
@@ -121,6 +123,7 @@ A color picker that displays a swatch preview trigger and opens a dropdown panel
121
123
  }
122
124
  .color-picker__trigger {
123
125
  width: 100%;
126
+ transition: none;
124
127
  --sc-kit--input--text--font-size: var(--_color-picker--default-preview--font-size);
125
128
  --sc-kit--input--icon--size: var(--_color-picker--default-preview--icon-size);
126
129
  --sc-kit--input--height: var(--_color-picker--default-preview--height);
@@ -1,6 +1,8 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  type Props = {
3
3
  value: string | null | undefined;
4
+ /** Default color shown in the picker when value is empty (does not set the value itself) */
5
+ defaultColor?: string;
4
6
  /** Show dismiss icon to clear the color value */
5
7
  enableReset?: boolean;
6
8
  on?: {
@@ -208,6 +208,7 @@ A date/time picker powered by flatpickr, supporting date, time, and datetime mod
208
208
  --_input--text--font-size: var(--_--input--text--font-size, 0.875em);
209
209
  --_input--text--color: var(--_--input--text--color, light-dark(#2e2e2e, #ffffff));
210
210
  --_input--placeholder--color: var(--_--input--placeholder--color, light-dark(#d1d5db, #4b5563));
211
+ --input--placeholder--color: var(--_--input--placeholder--color);
211
212
  --_input--accent-color: var(--_--input--accent-color, light-dark(#144ab0, #5a8dec));
212
213
  --_input--padding--inline: var(--_--input--padding--inline, 0.5em);
213
214
  --_input--padding--block: var(--_--input--padding--block, 0);
@@ -59,6 +59,7 @@ const size = $derived(dialog.controller.containerSettings.size);
59
59
  const position = $derived(dialog.controller.containerSettings.position);
60
60
  const isCustomWidth = $derived(!DIALOG_SIZES.includes(size));
61
61
  const customWidth = $derived(isCustomWidth ? size : null);
62
+ const isStretchContent = $derived(position === 'full-screen' || position === 'full-height');
62
63
  </script>
63
64
 
64
65
  <dialog
@@ -79,7 +80,7 @@ const customWidth = $derived(isCustomWidth ? size : null);
79
80
  oncancel={handleCancel}
80
81
  onclick={handleBackdropClick}
81
82
  style:--dialog-container--custom-width={customWidth}>
82
- <div class="dialog-container__content">
83
+ <div class="dialog-container__content" class:dialog-container__content--stretch={isStretchContent}>
83
84
  <DialogView controller={dialog.controller} data={dialog.data as TData} />
84
85
  </div>
85
86
  </dialog>
@@ -176,9 +177,9 @@ const customWidth = $derived(isCustomWidth ? size : null);
176
177
  border-radius: var(--_dialog-container--border-radius);
177
178
  pointer-events: auto;
178
179
  }
179
-
180
- .dialog-container--position-full-screen .dialog-container__content,
181
- .dialog-container--position-full-height .dialog-container__content {
180
+ .dialog-container__content--stretch {
181
+ display: flex;
182
+ flex-direction: column;
182
183
  flex: 1;
183
184
  min-height: 0;
184
185
  }</style>
@@ -75,6 +75,7 @@ A structured dialog panel with header (title + close button), scrollable body, a
75
75
  --_dialog--header--padding-block: var(--sc-kit--dialog--header--padding-block, var(--_dialog--padding-block));
76
76
  --_dialog--header--padding-inline: var(--sc-kit--dialog--header--padding-inline, var(--_dialog--padding-inline));
77
77
  display: flex;
78
+ flex: 1;
78
79
  flex-direction: column;
79
80
  height: var(--_dialog--height);
80
81
  min-height: var(--_dialog--min-height);
@@ -152,6 +152,7 @@ Text/password input with optional clear button, icon, and emoji picker.
152
152
  --_input--text--font-size: var(--_--input--text--font-size, 0.875em);
153
153
  --_input--text--color: var(--_--input--text--color, light-dark(#2e2e2e, #ffffff));
154
154
  --_input--placeholder--color: var(--_--input--placeholder--color, light-dark(#d1d5db, #4b5563));
155
+ --input--placeholder--color: var(--_--input--placeholder--color);
155
156
  --_input--accent-color: var(--_--input--accent-color, light-dark(#144ab0, #5a8dec));
156
157
  --_input--padding--inline: var(--_--input--padding--inline, 0.5em);
157
158
  --_input--padding--block: var(--_--input--padding--block, 0);
@@ -169,6 +169,7 @@ Uses cleave-zen for formatting and cursor tracking.
169
169
  --_input--text--font-size: var(--_--input--text--font-size, 0.875em);
170
170
  --_input--text--color: var(--_--input--text--color, light-dark(#2e2e2e, #ffffff));
171
171
  --_input--placeholder--color: var(--_--input--placeholder--color, light-dark(#d1d5db, #4b5563));
172
+ --input--placeholder--color: var(--_--input--placeholder--color);
172
173
  --_input--accent-color: var(--_--input--accent-color, light-dark(#144ab0, #5a8dec));
173
174
  --_input--padding--inline: var(--_--input--padding--inline, 0.5em);
174
175
  --_input--padding--block: var(--_--input--padding--block, 0);
@@ -168,6 +168,7 @@ const setEditorValue = (editor, val) => {
168
168
  --_input--text--font-size: var(--_--input--text--font-size, 0.875em);
169
169
  --_input--text--color: var(--_--input--text--color, light-dark(#2e2e2e, #ffffff));
170
170
  --_input--placeholder--color: var(--_--input--placeholder--color, light-dark(#d1d5db, #4b5563));
171
+ --input--placeholder--color: var(--_--input--placeholder--color);
171
172
  --_input--accent-color: var(--_--input--accent-color, light-dark(#144ab0, #5a8dec));
172
173
  --_input--padding--inline: var(--_--input--padding--inline, 0.5em);
173
174
  --_input--padding--block: var(--_--input--padding--block, 0);
@@ -155,6 +155,7 @@ Auto-resizing textarea with optional emoji picker, single-line mode, and submit-
155
155
  --_input--text--font-size: var(--_--input--text--font-size, 0.875em);
156
156
  --_input--text--color: var(--_--input--text--color, light-dark(#2e2e2e, #ffffff));
157
157
  --_input--placeholder--color: var(--_--input--placeholder--color, light-dark(#d1d5db, #4b5563));
158
+ --input--placeholder--color: var(--_--input--placeholder--color);
158
159
  --_input--accent-color: var(--_--input--accent-color, light-dark(#144ab0, #5a8dec));
159
160
  --_input--padding--inline: var(--_--input--padding--inline, 0.5em);
160
161
  --_input--padding--block: var(--_--input--padding--block, 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamscloud/kit",
3
- "version": "0.2.22",
3
+ "version": "0.2.24",
4
4
  "author": "StreamsCloud",
5
5
  "repository": {
6
6
  "type": "git",