@streamscloud/kit 0.2.23 → 0.2.25

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);
@@ -172,6 +172,7 @@ const isStretchContent = $derived(position === 'full-screen' || position === 'fu
172
172
  overflow: hidden;
173
173
  }
174
174
  .dialog-container__content {
175
+ container-type: inline-size;
175
176
  width: 100%;
176
177
  max-width: var(--_dialog-container--custom-width, var(--_dialog-container--max-width));
177
178
  border-radius: var(--_dialog-container--border-radius);
@@ -84,6 +84,12 @@ A structured dialog panel with header (title + close button), scrollable body, a
84
84
  color: var(--_dialog--color);
85
85
  border-radius: var(--_dialog--border-radius);
86
86
  box-shadow: 0 4px 24px var(--_dialog--shadow-color);
87
+ /* Set 'container-type: inline-size;' to reference container*/
88
+ }
89
+ @container (width < 768px) {
90
+ .dialog {
91
+ --_dialog--padding-inline: var(--sc-kit--dialog--padding-inline, 1rem);
92
+ }
87
93
  }
88
94
  .dialog__header {
89
95
  display: flex;
@@ -93,6 +99,11 @@ A structured dialog panel with header (title + close button), scrollable body, a
93
99
  gap: 1rem;
94
100
  padding: var(--_dialog--header--padding-block) var(--_dialog--header--padding-inline);
95
101
  border-bottom: 1px solid var(--_dialog--border-color);
102
+ -webkit-user-drag: none;
103
+ user-select: none;
104
+ }
105
+ .dialog__header :global([contenteditable]) {
106
+ user-select: text;
96
107
  }
97
108
  .dialog__title {
98
109
  flex: 1;
@@ -129,9 +140,15 @@ A structured dialog panel with header (title + close button), scrollable body, a
129
140
  .dialog__footer {
130
141
  display: flex;
131
142
  flex-shrink: 0;
143
+ margin-top: auto;
132
144
  align-items: center;
133
145
  justify-content: flex-end;
134
146
  gap: 0.75rem;
135
147
  padding: var(--_dialog--padding-block) var(--_dialog--padding-inline);
136
148
  border-top: 1px solid var(--_dialog--border-color);
149
+ -webkit-user-drag: none;
150
+ user-select: none;
151
+ }
152
+ .dialog__footer :global([contenteditable]) {
153
+ user-select: text;
137
154
  }</style>
@@ -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.23",
3
+ "version": "0.2.25",
4
4
  "author": "StreamsCloud",
5
5
  "repository": {
6
6
  "type": "git",