@dvcol/neo-svelte 0.1.2 → 0.1.4

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 (152) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/README.md +25 -26
  3. package/dist/buttons/NeoButton.svelte +140 -128
  4. package/dist/buttons/NeoButtonGroup.svelte +99 -108
  5. package/dist/buttons/neo-button-group.model.d.ts +18 -19
  6. package/dist/buttons/neo-button.model.d.ts +6 -10
  7. package/dist/cards/NeoCard.svelte +176 -73
  8. package/dist/cards/NeoCard.svelte.d.ts +1 -1
  9. package/dist/cards/neo-card.model.d.ts +29 -1
  10. package/dist/containers/NeoTransitionContainer.svelte +13 -2
  11. package/dist/containers/neo-transition-container.model.d.ts +9 -1
  12. package/dist/divider/NeoDivider.svelte +11 -11
  13. package/dist/icons/IconAccount.svelte +10 -2
  14. package/dist/icons/IconAdd.svelte +10 -2
  15. package/dist/icons/IconAlert.svelte +2 -2
  16. package/dist/icons/IconCalendar.svelte +23 -0
  17. package/dist/icons/IconCalendar.svelte.d.ts +26 -0
  18. package/dist/icons/IconCheckbox.svelte +87 -0
  19. package/dist/icons/IconCheckbox.svelte.d.ts +55 -0
  20. package/dist/icons/IconCircleLoading.svelte +2 -2
  21. package/dist/icons/IconClear.svelte +10 -2
  22. package/dist/icons/IconClose.svelte +2 -2
  23. package/dist/icons/IconConfirm.svelte +2 -2
  24. package/dist/icons/IconDownload.svelte +17 -0
  25. package/dist/icons/IconDownload.svelte.d.ts +26 -0
  26. package/dist/icons/IconEmpty.svelte +2 -2
  27. package/dist/icons/IconFileUpload.svelte +2 -2
  28. package/dist/icons/IconGithub.svelte +2 -2
  29. package/dist/icons/IconImage.svelte +2 -2
  30. package/dist/icons/IconMinus.svelte +2 -2
  31. package/dist/icons/IconMoon.svelte +2 -2
  32. package/dist/icons/IconPaint.svelte +19 -0
  33. package/dist/icons/{IconSunrise.svelte.d.ts → IconPaint.svelte.d.ts} +3 -3
  34. package/dist/icons/IconPencil.svelte +13 -0
  35. package/dist/icons/IconPencil.svelte.d.ts +26 -0
  36. package/dist/icons/IconRadio.svelte +14 -0
  37. package/dist/icons/IconRadio.svelte.d.ts +22 -0
  38. package/dist/icons/IconSave.svelte +1 -1
  39. package/dist/icons/IconSave.svelte.d.ts +3 -3
  40. package/dist/icons/IconSaveOff.svelte +1 -1
  41. package/dist/icons/IconSaveOff.svelte.d.ts +3 -3
  42. package/dist/icons/IconSearch.svelte +2 -2
  43. package/dist/icons/IconSun.svelte +3 -3
  44. package/dist/icons/{IconSunrise.svelte → IconSunFull.svelte} +5 -4
  45. package/dist/icons/IconSunFull.svelte.d.ts +26 -0
  46. package/dist/icons/IconVideo.svelte +2 -2
  47. package/dist/icons/IconWatch.svelte +2 -2
  48. package/dist/icons/IconWatchOff.svelte +2 -2
  49. package/dist/inputs/NeoCheckbox.svelte +316 -0
  50. package/dist/inputs/NeoCheckbox.svelte.d.ts +19 -0
  51. package/dist/inputs/NeoColorPicker.svelte +140 -0
  52. package/dist/inputs/NeoColorPicker.svelte.d.ts +19 -0
  53. package/dist/inputs/NeoDateTime.svelte +96 -0
  54. package/dist/inputs/NeoDateTime.svelte.d.ts +19 -0
  55. package/dist/inputs/NeoFilePicker.svelte +528 -0
  56. package/dist/inputs/NeoFilePicker.svelte.d.ts +19 -0
  57. package/dist/inputs/NeoFilePickerCard.svelte +314 -0
  58. package/dist/inputs/NeoFilePickerCard.svelte.d.ts +19 -0
  59. package/dist/inputs/NeoNumberStep.svelte +174 -0
  60. package/dist/inputs/NeoNumberStep.svelte.d.ts +19 -0
  61. package/dist/inputs/NeoPassword.svelte +86 -17
  62. package/dist/inputs/NeoPassword.svelte.d.ts +19 -16
  63. package/dist/inputs/NeoPin.svelte +589 -0
  64. package/dist/inputs/NeoPin.svelte.d.ts +19 -0
  65. package/dist/inputs/NeoRadio.svelte +254 -0
  66. package/dist/inputs/NeoRadio.svelte.d.ts +19 -0
  67. package/dist/inputs/NeoRange.svelte +518 -0
  68. package/dist/inputs/NeoRange.svelte.d.ts +18 -0
  69. package/dist/inputs/NeoSwitch.svelte +373 -0
  70. package/dist/inputs/NeoSwitch.svelte.d.ts +19 -0
  71. package/dist/inputs/NeoTextarea.svelte +335 -301
  72. package/dist/inputs/NeoTextarea.svelte.d.ts +5 -2
  73. package/dist/inputs/common/NeoAffix.svelte +166 -0
  74. package/dist/inputs/common/NeoAffix.svelte.d.ts +19 -0
  75. package/dist/inputs/common/NeoBaseInput.svelte +338 -0
  76. package/dist/inputs/common/NeoBaseInput.svelte.d.ts +30 -0
  77. package/dist/inputs/common/NeoInput.svelte +684 -0
  78. package/dist/inputs/{NeoInput.svelte.d.ts → common/NeoInput.svelte.d.ts} +2 -10
  79. package/dist/inputs/common/NeoInputValidation.svelte +45 -0
  80. package/dist/inputs/common/NeoInputValidation.svelte.d.ts +22 -0
  81. package/dist/inputs/common/NeoLabel.svelte +93 -0
  82. package/dist/inputs/common/NeoLabel.svelte.d.ts +19 -0
  83. package/dist/inputs/{NeoValidation.svelte → common/NeoValidation.svelte} +9 -16
  84. package/dist/inputs/common/NeoValidation.svelte.d.ts +22 -0
  85. package/dist/inputs/common/neo-affix.model.d.ts +32 -0
  86. package/dist/inputs/common/neo-input-validation.model.d.ts +20 -0
  87. package/dist/inputs/common/neo-input-validation.model.js +1 -0
  88. package/dist/inputs/{neo-input.model.d.ts → common/neo-input.model.d.ts} +148 -68
  89. package/dist/inputs/common/neo-label.model.d.ts +36 -0
  90. package/dist/inputs/common/neo-label.model.js +1 -0
  91. package/dist/inputs/common/neo-validation.model.d.ts +70 -0
  92. package/dist/inputs/common/neo-validation.model.js +1 -0
  93. package/dist/inputs/index.d.ts +2 -2
  94. package/dist/inputs/index.js +1 -1
  95. package/dist/inputs/neo-checkbox.model.d.ts +9 -0
  96. package/dist/inputs/neo-checkbox.model.js +1 -0
  97. package/dist/inputs/neo-color-picker.model.d.ts +17 -0
  98. package/dist/inputs/neo-color-picker.model.js +1 -0
  99. package/dist/inputs/neo-date-time.model.d.ts +8 -0
  100. package/dist/inputs/neo-date-time.model.js +1 -0
  101. package/dist/inputs/neo-file-picker.model.d.ts +138 -0
  102. package/dist/inputs/neo-file-picker.model.js +1 -0
  103. package/dist/inputs/neo-number-step.model.d.ts +24 -0
  104. package/dist/inputs/neo-number-step.model.js +1 -0
  105. package/dist/inputs/neo-password.model.d.ts +13 -0
  106. package/dist/inputs/neo-password.model.js +1 -0
  107. package/dist/inputs/neo-pin.model.d.ts +47 -0
  108. package/dist/inputs/neo-pin.model.js +1 -0
  109. package/dist/inputs/neo-radio.model.d.ts +3 -0
  110. package/dist/inputs/neo-radio.model.js +1 -0
  111. package/dist/inputs/neo-switch.model.d.ts +9 -0
  112. package/dist/inputs/neo-switch.model.js +1 -0
  113. package/dist/nav/NeoTab.svelte +29 -25
  114. package/dist/nav/NeoTabPanel.svelte +1 -1
  115. package/dist/nav/NeoTabs.svelte +51 -44
  116. package/dist/nav/NeoTabsCard.svelte +8 -10
  117. package/dist/nav/neo-tabs-context.svelte.d.ts +2 -11
  118. package/dist/nav/neo-tabs-context.svelte.js +1 -41
  119. package/dist/nav/neo-tabs.model.d.ts +6 -0
  120. package/dist/providers/NeoThemeProvider.svelte +417 -305
  121. package/dist/providers/NeoThemeSelector.svelte +10 -10
  122. package/dist/providers/neo-theme-provider-context.svelte.js +16 -15
  123. package/dist/providers/neo-theme-provider.model.d.ts +6 -6
  124. package/dist/providers/neo-theme-provider.model.js +17 -12
  125. package/dist/providers/neo-theme-selector.model.d.ts +2 -2
  126. package/dist/skeletons/NeoSkeletonMedia.svelte +4 -4
  127. package/dist/skeletons/NeoSkeletonText.svelte +12 -12
  128. package/dist/styles/common/colors.scss +85 -97
  129. package/dist/styles/common/filters.scss +17 -0
  130. package/dist/styles/common/shadows.scss +531 -293
  131. package/dist/styles/common/spacing.scss +7 -3
  132. package/dist/styles/common/typography.scss +1 -1
  133. package/dist/styles/common/utils.scss +1 -1
  134. package/dist/styles/common/z-index.scss +1 -1
  135. package/dist/styles/mixin.scss +80 -27
  136. package/dist/styles/reset.scss +8 -1
  137. package/dist/styles/theme.scss +39 -16
  138. package/dist/utils/html-element.utils.d.ts +3 -0
  139. package/dist/utils/regex.utils.d.ts +3 -0
  140. package/dist/utils/regex.utils.js +3 -0
  141. package/dist/utils/shadow.utils.d.ts +30 -3
  142. package/dist/utils/shadow.utils.js +41 -14
  143. package/dist/utils/transition.utils.d.ts +4 -0
  144. package/dist/utils/transition.utils.js +10 -1
  145. package/dist/utils/utils.svelte.d.ts +6 -0
  146. package/dist/utils/utils.svelte.js +13 -0
  147. package/package.json +13 -12
  148. package/dist/inputs/NeoInput.svelte +0 -750
  149. package/dist/inputs/NeoValidation.svelte.d.ts +0 -22
  150. package/dist/inputs/neo-validation.model.d.ts +0 -40
  151. /package/dist/inputs/{neo-validation.model.js → common/neo-affix.model.js} +0 -0
  152. /package/dist/inputs/{neo-input.model.js → common/neo-input.model.js} +0 -0
@@ -1,6 +1,6 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" {...$$props}>
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" {...$$props} style:scale={$$props.scale} scale={undefined}>
2
2
  <mask id="lineMdYoutubeFilled0">
3
- <g fill="none" fill-opacity="0" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5">
3
+ <g fill="none" fill-opacity="0" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width={$$props.stroke ?? 1.5}>
4
4
  <path fill="#fff" stroke-dasharray="64" stroke-dashoffset="64" d="M12 5c9 0 9 0 9 7c0 7 0 7 -9 7c-9 0 -9 0 -9 -7c0 -7 0 -7 9 -7Z">
5
5
  <animate fill="freeze" attributeName="fill-opacity" begin="0.6s" dur="0.5s" values="0;1" />
6
6
  <animate fill="freeze" attributeName="stroke-dashoffset" dur="0.6s" values="64;0" />
@@ -1,4 +1,4 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" {...$$props}>
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" {...$$props} style:scale={$$props.scale} scale={undefined}>
2
2
  <circle cx="12" cy="12" r="0" fill="currentColor">
3
3
  <animate attributeName="r" dur="6s" keyTimes="0;0.03;0.97;1" repeatCount="indefinite" values="0;3;3;0" />
4
4
  </circle>
@@ -7,7 +7,7 @@
7
7
  stroke="currentColor"
8
8
  stroke-linecap="round"
9
9
  stroke-linejoin="round"
10
- stroke-width="1.5"
10
+ stroke-width={$$props.stroke ?? 1.5}
11
11
  d="M4 12c1.38 -0.77 4.42 -1.3 8 -1.3c3.58 0 6.62 0.53 8 1.3c-1.38 0.77 -4.42 1.3 -8 1.3c-3.58 0 -6.62 -0.53 -8 -1.3Z"
12
12
  >
13
13
  <animate
@@ -1,6 +1,6 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" {...$$props}>
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" {...$$props} style:scale={$$props.scale} scale={undefined}>
2
2
  <mask id="lineMdWatchOffLoop0">
3
- <g fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5">
3
+ <g fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width={$$props.stroke ?? 1.5}>
4
4
  <circle cx="12" cy="12" r="0" fill="#fff" stroke="none">
5
5
  <animate attributeName="r" dur="6s" keyTimes="0;0.03;0.97;1" repeatCount="indefinite" values="0;3;3;0" />
6
6
  </circle>
@@ -0,0 +1,316 @@
1
+ <script lang="ts">
2
+ import { toStyle } from '@dvcol/common-utils/common/class';
3
+ import { fade } from 'svelte/transition';
4
+
5
+ import type { NeoInputContext, NeoInputHTMLElement } from './common/neo-input.model.js';
6
+ import type { NeoCheckboxProps } from './neo-checkbox.model.js';
7
+
8
+ import IconCheckbox from '../icons/IconCheckbox.svelte';
9
+ import IconCircleLoading from '../icons/IconCircleLoading.svelte';
10
+ import NeoBaseInput from './common/NeoBaseInput.svelte';
11
+ import NeoInputValidation from './common/NeoInputValidation.svelte';
12
+ import NeoLabel from './common/NeoLabel.svelte';
13
+ import { computeShadowElevation } from '../utils/shadow.utils.js';
14
+ import { enterDefaultTransition } from '../utils/transition.utils.js';
15
+
16
+ /* eslint-disable prefer-const -- necessary for binding checked */
17
+ let {
18
+ // Snippets
19
+ label,
20
+ message,
21
+ error,
22
+
23
+ // State
24
+ type = 'checkbox',
25
+ id = label ? `neo-checkbox-${crypto.randomUUID()}` : undefined,
26
+ ref = $bindable(),
27
+ group = $bindable(),
28
+ checked = $bindable(false),
29
+ indeterminate = $bindable(false),
30
+ valid = $bindable(),
31
+ dirty = $bindable(false),
32
+ touched = $bindable(false),
33
+ focused = $bindable(false),
34
+ disabled,
35
+ required,
36
+ loading,
37
+ validation,
38
+
39
+ // Styles
40
+ start,
41
+ glass,
42
+ rounded,
43
+ skeleton,
44
+
45
+ elevation = 2,
46
+
47
+ // Actions
48
+ in: inAction,
49
+ out: outAction,
50
+ transition: transitionAction,
51
+
52
+ // Other props
53
+ labelRef = $bindable(),
54
+ labelProps,
55
+ messageTag = 'div',
56
+ messageProps,
57
+ containerTag = 'div',
58
+ containerProps,
59
+ wrapperTag = 'div',
60
+ wrapperProps,
61
+ ...rest
62
+ }: NeoCheckboxProps = $props();
63
+ /* eslint-enable prefer-const */
64
+
65
+ let initial = $state(checked);
66
+ let validationMessage = $state<string>(ref?.validationMessage ?? '');
67
+
68
+ let visible = $state(false);
69
+ let messageId = $state(`neo-checkbox-message-${crypto.randomUUID()}`);
70
+ const context = $derived<NeoInputContext<NeoInputHTMLElement>>({
71
+ // Ref
72
+ ref,
73
+
74
+ // Methods
75
+ mark: ref?.mark,
76
+ clear: ref?.clear,
77
+ change: ref?.change,
78
+ validate: ref?.validate,
79
+
80
+ // State
81
+ value: checked,
82
+ touched,
83
+ dirty,
84
+ valid,
85
+ readonly: rest.readonly,
86
+ disabled,
87
+
88
+ // Styles
89
+ rounded,
90
+ glass,
91
+ start,
92
+ skeleton,
93
+ });
94
+
95
+ const boxShadow = $derived(computeShadowElevation(elevation, { glass }, { max: 2, min: -2 }));
96
+ const checkedShadow = $derived(computeShadowElevation(-Math.abs(elevation), { glass, pressed: elevation > 0 }, { max: 2, min: -2 }));
97
+ </script>
98
+
99
+ <NeoInputValidation
100
+ tag={wrapperTag}
101
+ bind:visible
102
+ bind:messageId
103
+ {valid}
104
+ {validation}
105
+ {validationMessage}
106
+ {error}
107
+ {rounded}
108
+ {context}
109
+ {message}
110
+ {messageTag}
111
+ {messageProps}
112
+ in={inAction}
113
+ out={outAction}
114
+ transition={transitionAction}
115
+ {...wrapperProps}
116
+ style={toStyle('--neo-validation-padding: 0', wrapperProps?.style)}
117
+ >
118
+ <svelte:element this={containerTag} class:neo-checkbox-container={true} class:neo-rounded={rounded} class:neo-flat={!elevation} {...containerProps}>
119
+ <button
120
+ class="neo-checkbox-button"
121
+ role="checkbox"
122
+ aria-checked={indeterminate ? 'mixed' : checked}
123
+ class:neo-checked={checked || indeterminate}
124
+ class:neo-rounded={rounded}
125
+ class:neo-start={start}
126
+ class:neo-glass={glass}
127
+ class:neo-disabled={disabled}
128
+ class:neo-skeleton={skeleton}
129
+ class:neo-flat={!elevation}
130
+ class:neo-inset={elevation <= 0}
131
+ style:--neo-checkbox-box-shadow={boxShadow}
132
+ style:--neo-checkbox-checked-shadow={checkedShadow}
133
+ onclick={() => ref?.click()}
134
+ >
135
+ <span class="neo-checkbox-input">
136
+ <NeoBaseInput
137
+ aria-invalid={valid === undefined ? undefined : !valid}
138
+ aria-describedby={visible ? messageId : undefined}
139
+ {id}
140
+ bind:ref
141
+ bind:initial
142
+ bind:group
143
+ bind:checked
144
+ bind:indeterminate
145
+ bind:valid
146
+ bind:dirty
147
+ bind:touched
148
+ bind:focused
149
+ bind:validationMessage
150
+ {type}
151
+ {disabled}
152
+ {required}
153
+ {...rest}
154
+ hidden
155
+ aria-hidden
156
+ tabindex={-1}
157
+ />
158
+ </span>
159
+ {#if indeterminate}
160
+ <IconCheckbox circle={rounded} indeterminate />
161
+ {:else if checked}
162
+ <IconCheckbox circle={rounded} checked />
163
+ {:else}
164
+ <IconCheckbox circle={rounded} enter={touched} />
165
+ {/if}
166
+ </button>
167
+ <NeoLabel bind:ref={labelRef} for={id} {label} {disabled} {required} {...labelProps} />
168
+ {#if loading !== undefined}
169
+ <span class="neo-checkbox-suffix">
170
+ {#if loading}
171
+ <span class="neo-checkbox-loading" out:fade={enterDefaultTransition}>
172
+ <IconCircleLoading width="1rem" height="1rem" />
173
+ </span>
174
+ {/if}
175
+ </span>
176
+ {/if}
177
+ </svelte:element>
178
+ </NeoInputValidation>
179
+
180
+ <style>.neo-checkbox-container {
181
+ --neo-label-margin: 0 0 0 0.75rem;
182
+ --neo-label-padding: 0;
183
+ display: inline-flex;
184
+ align-items: center;
185
+ width: fit-content;
186
+ margin: 0;
187
+ padding: calc(0.375rem + var(--neo-checkbox-border-width, var(--neo-border-width, 1px))) 0.5rem 0.375rem;
188
+ border-radius: var(--neo-border-radius);
189
+ transition: box-shadow 0.3s ease, border-radius 0.3s ease;
190
+ }
191
+ .neo-checkbox-container.neo-rounded {
192
+ border-radius: var(--neo-border-radius-lg);
193
+ }
194
+ .neo-checkbox-container.neo-flat {
195
+ --neo-label-margin: 0 0 0 0.625rem;
196
+ }
197
+ .neo-checkbox-input {
198
+ display: none;
199
+ }
200
+ .neo-checkbox-button {
201
+ box-sizing: border-box;
202
+ min-width: fit-content;
203
+ margin: 0 0 0.125rem;
204
+ padding: 0.125rem;
205
+ color: inherit;
206
+ text-decoration: none;
207
+ background-color: color-mix(in srgb, transparent, currentcolor 1%);
208
+ border: var(--neo-checkbox-border-width, var(--neo-border-width, 1px)) var(--neo-checkbox-border-color, transparent) solid;
209
+ border-radius: var(--neo-border-radius-xs);
210
+ outline: none;
211
+ box-shadow: var(--neo-checkbox-box-shadow, var(--neo-box-shadow-raised-2));
212
+ cursor: pointer;
213
+ transition: color 0.3s ease, box-shadow 0.3s ease, border-radius 0.3s ease, border-color 0.3s ease, background-color 0.3s ease;
214
+ }
215
+ .neo-checkbox-button.neo-disabled, .neo-checkbox-button.neo-flat {
216
+ background-color: transparent;
217
+ border-color: var(--neo-input-border-color, var(--neo-border-color));
218
+ }
219
+ .neo-checkbox-button:focus-visible, .neo-checkbox-button.neo-checked {
220
+ box-shadow: var(--neo-checkbox-checked-shadow, var(--neo-box-shadow-pressed-2));
221
+ }
222
+ .neo-checkbox-button.neo-inset:focus-visible {
223
+ border-color: var(--neo-checkbox-border-color-focused, var(--neo-border-color-focused));
224
+ }
225
+ .neo-checkbox-button.neo-disabled {
226
+ color: var(--neo-text-color-disabled);
227
+ box-shadow: var(--neo-box-shadow-flat);
228
+ cursor: not-allowed;
229
+ opacity: var(--neo-card-opacity-disabled, var(--neo-opacity-disabled));
230
+ }
231
+ .neo-checkbox-button.neo-rounded {
232
+ border-radius: 50%;
233
+ }
234
+ .neo-checkbox-button.neo-glass {
235
+ /** Box Shadows raised */
236
+ --neo-box-shadow-raised-5: var(--neo-glass-box-shadow-raised-5);
237
+ --neo-box-shadow-raised-4: var(--neo-glass-box-shadow-raised-4);
238
+ --neo-box-shadow-raised-3: var(--neo-glass-box-shadow-raised-3);
239
+ --neo-box-shadow-raised-2: var(--neo-glass-box-shadow-raised-2);
240
+ --neo-box-shadow-raised-1: var(--neo-glass-box-shadow-raised-1);
241
+ /** Box Shadows inset */
242
+ --neo-box-shadow-inset-1: var(--neo-glass-box-shadow-inset-1);
243
+ --neo-box-shadow-inset-2: var(--neo-glass-box-shadow-inset-2);
244
+ --neo-box-shadow-inset-3: var(--neo-glass-box-shadow-inset-3);
245
+ --neo-box-shadow-inset-4: var(--neo-glass-box-shadow-inset-4);
246
+ --neo-box-shadow-inset-5: var(--neo-glass-box-shadow-inset-5);
247
+ /** Box Shadows pressed */
248
+ --neo-box-shadow-pressed-1: var(--neo-glass-box-shadow-pressed-1);
249
+ --neo-box-shadow-pressed-2: var(--neo-glass-box-shadow-pressed-2);
250
+ --neo-box-shadow-pressed-3: var(--neo-glass-box-shadow-pressed-3);
251
+ --neo-box-shadow-pressed-4: var(--neo-glass-box-shadow-pressed-4);
252
+ --neo-box-shadow-pressed-5: var(--neo-glass-box-shadow-pressed-5);
253
+ /** Box Shadows convex */
254
+ --neo-box-shadow-convex-1: var(--neo-glass-box-shadow-convex-1);
255
+ --neo-box-shadow-convex-2: var(--neo-glass-box-shadow-convex-2);
256
+ --neo-box-shadow-convex-3: var(--neo-glass-box-shadow-convex-3);
257
+ --neo-box-shadow-convex-4: var(--neo-glass-box-shadow-convex-4);
258
+ --neo-box-shadow-convex-5: var(--neo-glass-box-shadow-convex-5);
259
+ /** Skeleton color */
260
+ --neo-skeleton-color: var(--neo-glass-skeleton-color);
261
+ background-color: var(--neo-checkbox-bg-color, var(--neo-glass-background-color));
262
+ border-color: var(--neo-checkbox-border-color, var(--neo-glass-top-border-color) var(--neo-glass-right-border-color) var(--neo-glass-bottom-border-color) var(--neo-glass-left-border-color));
263
+ backdrop-filter: var(--neo-checkbox-glass-blur, var(--neo-blur-2) var(--neo-saturate-2));
264
+ }
265
+ @starting-style {
266
+ .neo-checkbox-button.neo-start {
267
+ box-shadow: var(--neo-box-shadow-flat);
268
+ }
269
+ }
270
+ .neo-checkbox-button.neo-skeleton {
271
+ box-shadow: var(--neo-box-shadow-flat);
272
+ pointer-events: none;
273
+ --neo-skeleton-color-start: var(--neo-skeleton-color);
274
+ --neo-skeleton-color-end: oklch(from var(--neo-skeleton-color) calc(l - var(--neo-skeleton-color-step, 0.05)) c h);
275
+ color: var(--neo-skeleton-color-start);
276
+ background-color: var(--neo-skeleton-color-start);
277
+ border-color: var(--neo-skeleton-color-start);
278
+ transition: background-color 1s ease, color 1s ease, border-color 1s ease;
279
+ animation: skeleton 3s var(--neo-transition-skeleton) infinite;
280
+ animation-delay: 1s;
281
+ }
282
+ .neo-checkbox-button.neo-skeleton::before, .neo-checkbox-button.neo-skeleton::after,
283
+ .neo-checkbox-button.neo-skeleton :global(> *::before),
284
+ .neo-checkbox-button.neo-skeleton :global(> *::after),
285
+ .neo-checkbox-button.neo-skeleton :global(> *) {
286
+ visibility: hidden;
287
+ pointer-events: none;
288
+ }
289
+ @keyframes skeleton {
290
+ 0% {
291
+ color: var(--neo-skeleton-color-start);
292
+ background-color: var(--neo-skeleton-color-start);
293
+ border-color: var(--neo-skeleton-color-start);
294
+ }
295
+ 40% {
296
+ color: var(--neo-skeleton-color-end);
297
+ background-color: var(--neo-skeleton-color-end);
298
+ border-color: var(--neo-skeleton-color-end);
299
+ }
300
+ 80% {
301
+ color: var(--neo-skeleton-color-start);
302
+ background-color: var(--neo-skeleton-color-start);
303
+ border-color: var(--neo-skeleton-color-start);
304
+ }
305
+ 100% {
306
+ color: var(--neo-skeleton-color-start);
307
+ background-color: var(--neo-skeleton-color-start);
308
+ border-color: var(--neo-skeleton-color-start);
309
+ }
310
+ }
311
+ .neo-checkbox-suffix {
312
+ width: 1rem;
313
+ height: 1rem;
314
+ margin-bottom: 0.125rem;
315
+ margin-left: 0.5rem;
316
+ }</style>
@@ -0,0 +1,19 @@
1
+ import type { NeoCheckboxProps } from './neo-checkbox.model.js';
2
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
+ $$bindings?: Bindings;
5
+ } & Exports;
6
+ (internal: unknown, props: Props & {
7
+ $$events?: Events;
8
+ $$slots?: Slots;
9
+ }): Exports & {
10
+ $set?: any;
11
+ $on?: any;
12
+ };
13
+ z_$$bindings?: Bindings;
14
+ }
15
+ declare const NeoCheckbox: $$__sveltets_2_IsomorphicComponent<NeoCheckboxProps, {
16
+ [evt: string]: CustomEvent<any>;
17
+ }, {}, {}, "group" | "ref" | "checked" | "focused" | "indeterminate" | "touched" | "dirty" | "valid" | "labelRef">;
18
+ type NeoCheckbox = InstanceType<typeof NeoCheckbox>;
19
+ export default NeoCheckbox;
@@ -0,0 +1,140 @@
1
+ <script lang="ts">
2
+ import type { FormEventHandler } from 'svelte/elements';
3
+ import type { NeoButtonProps } from '../buttons/neo-button.model.js';
4
+
5
+ import type { NeoColorPickerProps } from './neo-color-picker.model.js';
6
+
7
+ import NeoButton from '../buttons/NeoButton.svelte';
8
+ import IconPaint from '../icons/IconPaint.svelte';
9
+ import NeoInput from './common/NeoInput.svelte';
10
+ import { HexColorRegexString } from '../utils/regex.utils.js';
11
+ import { computeButtonShadows, getDefaultElevation } from '../utils/shadow.utils.js';
12
+
13
+ /* eslint-disable prefer-const -- necessary for binding checked */
14
+ let {
15
+ // State
16
+ ref = $bindable(),
17
+ value = $bindable(),
18
+ valid = $bindable(),
19
+ dirty = $bindable(false),
20
+ touched = $bindable(false),
21
+ hovered = $bindable(false),
22
+ focused = $bindable(false),
23
+ placeholder = 'Pick a color',
24
+ pattern = HexColorRegexString,
25
+ minlength = 7,
26
+ maxlength = 7,
27
+
28
+ // Other props
29
+ labelRef = $bindable(),
30
+ buttonProps,
31
+ pickerRef = $bindable(),
32
+ pickerProps,
33
+ ...rest
34
+ }: NeoColorPickerProps = $props();
35
+ /* eslint-enable prefer-const */
36
+
37
+ const onclick: NeoButtonProps['onclick'] = e => {
38
+ pickerRef?.focus?.();
39
+ pickerRef?.click?.();
40
+ pickerRef?.showPicker?.();
41
+ buttonProps?.onclick?.(e);
42
+ };
43
+
44
+ const elevation = $derived(rest?.elevation ?? getDefaultElevation(rest?.pressed));
45
+ const text = $derived(elevation >= 0 || !rest.pressed);
46
+ const style = $derived(computeButtonShadows(elevation, text));
47
+ const afterProps = $derived<NeoButtonProps>({
48
+ 'aria-label': 'Toggle picker',
49
+ title: 'Toggle picker',
50
+ skeleton: rest.skeleton,
51
+ disabled: rest.disabled,
52
+ rounded: rest.rounded,
53
+ glass: rest.glass,
54
+ start: rest.start,
55
+ text,
56
+ style,
57
+ ...buttonProps,
58
+ onclick,
59
+ });
60
+
61
+ const oninput: FormEventHandler<HTMLInputElement> = e => {
62
+ ref?.dispatchEvent(new InputEvent(e.type, e));
63
+ pickerProps?.oninput?.(e);
64
+ };
65
+
66
+ const onchange: FormEventHandler<HTMLInputElement> = e => {
67
+ ref?.dispatchEvent(new InputEvent(e.type, e));
68
+ pickerProps?.onchange?.(e);
69
+ };
70
+ </script>
71
+
72
+ {#snippet before()}
73
+ <input
74
+ class:neo-color-picker={true}
75
+ class:neo-rounded={rest.rounded}
76
+ class:neo-label={rest.label}
77
+ bind:this={pickerRef}
78
+ bind:value
79
+ type="color"
80
+ {oninput}
81
+ {onchange}
82
+ {...pickerProps}
83
+ />
84
+ {/snippet}
85
+
86
+ {#snippet after()}
87
+ <NeoButton {...afterProps}>
88
+ {#snippet icon()}
89
+ <IconPaint width="1.25rem" height="1.25rem" scale="var(--neo-input-icon-scale, 1.125)" />
90
+ {/snippet}
91
+ </NeoButton>
92
+ {/snippet}
93
+
94
+ <NeoInput
95
+ bind:ref
96
+ bind:labelRef
97
+ bind:value
98
+ bind:valid
99
+ bind:dirty
100
+ bind:touched
101
+ bind:hovered
102
+ bind:focused
103
+ type="text"
104
+ {placeholder}
105
+ {before}
106
+ {after}
107
+ {pattern}
108
+ {minlength}
109
+ {maxlength}
110
+ {...rest}
111
+ />
112
+
113
+ <style>.neo-color-picker {
114
+ box-sizing: border-box;
115
+ min-width: 3rem;
116
+ height: 100%;
117
+ min-height: 2.25rem;
118
+ margin: 0;
119
+ padding: 0;
120
+ border: none;
121
+ border-radius: var(--neo-border-radius-xs);
122
+ transition: border-radius 0.3s ease;
123
+ appearance: none;
124
+ aspect-ratio: 4/3;
125
+ }
126
+ .neo-color-picker::-webkit-color-swatch-wrapper {
127
+ padding: 0;
128
+ }
129
+ .neo-color-picker::-webkit-color-swatch-wrapper, .neo-color-picker::-webkit-color-swatch {
130
+ border: none;
131
+ }
132
+ .neo-color-picker::-webkit-color-swatch-wrapper, .neo-color-picker::-webkit-color-swatch, .neo-color-picker::-moz-color-swatch {
133
+ border-radius: var(--neo-border-radius-xs);
134
+ }
135
+ .neo-color-picker.neo-rounded {
136
+ border-radius: var(--neo-border-radius-lg);
137
+ }
138
+ .neo-color-picker.neo-rounded::-webkit-color-swatch-wrapper, .neo-color-picker.neo-rounded::-webkit-color-swatch, .neo-color-picker.neo-rounded::-moz-color-swatch {
139
+ border-radius: var(--neo-border-radius-lg);
140
+ }</style>
@@ -0,0 +1,19 @@
1
+ import type { NeoColorPickerProps } from './neo-color-picker.model.js';
2
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
+ $$bindings?: Bindings;
5
+ } & Exports;
6
+ (internal: unknown, props: Props & {
7
+ $$events?: Events;
8
+ $$slots?: Slots;
9
+ }): Exports & {
10
+ $set?: any;
11
+ $on?: any;
12
+ };
13
+ z_$$bindings?: Bindings;
14
+ }
15
+ declare const NeoColorPicker: $$__sveltets_2_IsomorphicComponent<NeoColorPickerProps, {
16
+ [evt: string]: CustomEvent<any>;
17
+ }, {}, {}, "value" | "ref" | "hovered" | "focused" | "touched" | "dirty" | "valid" | "labelRef" | "pickerRef">;
18
+ type NeoColorPicker = InstanceType<typeof NeoColorPicker>;
19
+ export default NeoColorPicker;
@@ -0,0 +1,96 @@
1
+ <script lang="ts">
2
+ import type { NeoButtonProps } from '../buttons/neo-button.model.js';
3
+ import type { NeoDateTimeProps } from './neo-date-time.model.js';
4
+
5
+ import NeoButton from '../buttons/NeoButton.svelte';
6
+
7
+ import IconCalendar from '../icons/IconCalendar.svelte';
8
+ import NeoInput from './common/NeoInput.svelte';
9
+ import { computeButtonShadows, getDefaultElevation } from '../utils/shadow.utils.js';
10
+
11
+ /* eslint-disable prefer-const -- necessary for binding checked */
12
+ let {
13
+ // State
14
+ type = 'date',
15
+ ref = $bindable(),
16
+ value = $bindable(),
17
+ valid = $bindable(),
18
+ dirty = $bindable(false),
19
+ touched = $bindable(false),
20
+ hovered = $bindable(false),
21
+ focused = $bindable(false),
22
+ placeholder = 'Select a date',
23
+
24
+ // Other props
25
+ labelRef = $bindable(),
26
+ buttonProps,
27
+ ...rest
28
+ }: NeoDateTimeProps = $props();
29
+ /* eslint-enable prefer-const */
30
+
31
+ const onclick: NeoButtonProps['onclick'] = e => {
32
+ ref?.focus?.();
33
+ ref?.click?.();
34
+ ref?.showPicker?.();
35
+ buttonProps?.onclick?.(e);
36
+ };
37
+
38
+ const elevation = $derived(rest?.elevation ?? getDefaultElevation(rest?.pressed));
39
+ const text = $derived(elevation >= 0 || !rest.pressed);
40
+ const style = $derived(computeButtonShadows(elevation, text));
41
+ const afterProps = $derived<NeoButtonProps>({
42
+ 'aria-label': 'Toggle picker',
43
+ title: 'Toggle picker',
44
+ skeleton: rest.skeleton,
45
+ disabled: rest.disabled,
46
+ rounded: rest.rounded,
47
+ glass: rest.glass,
48
+ start: rest.start,
49
+ text,
50
+ style,
51
+ ...buttonProps,
52
+ onclick,
53
+ });
54
+ </script>
55
+
56
+ {#snippet after()}
57
+ <NeoButton {...afterProps}>
58
+ {#snippet icon()}
59
+ <IconCalendar width="1.25rem" height="1.25rem" scale="var(--neo-input-icon-scale, 1.125)" />
60
+ {/snippet}
61
+ </NeoButton>
62
+ {/snippet}
63
+
64
+ <div class="neo-date-time" class:neo-picker={ref?.showPicker}>
65
+ <NeoInput
66
+ bind:ref
67
+ bind:labelRef
68
+ bind:value
69
+ bind:valid
70
+ bind:dirty
71
+ bind:touched
72
+ bind:hovered
73
+ bind:focused
74
+ {type}
75
+ {placeholder}
76
+ after={ref?.showPicker ? after : undefined}
77
+ {...rest}
78
+ />
79
+ </div>
80
+
81
+ <style>.neo-date-time.neo-picker :global(.neo-input::-webkit-calendar-picker-indicator) {
82
+ display: none; /* Hide the default date icon in WebKit browsers */
83
+ appearance: none; /* Hide the default date icon in Firefox */
84
+ }
85
+ .neo-date-time :global(.neo-input::-webkit-datetime-edit-text:focus),
86
+ .neo-date-time :global(.neo-input::-webkit-datetime-edit-fields-wrapper:focus),
87
+ .neo-date-time :global(.neo-input::-webkit-datetime-edit-hour-field:focus),
88
+ .neo-date-time :global(.neo-input::-webkit-datetime-edit-minute-field:focus),
89
+ .neo-date-time :global(.neo-input::-webkit-datetime-edit-day-field:focus),
90
+ .neo-date-time :global(.neo-input::-webkit-datetime-edit-week-field:focus),
91
+ .neo-date-time :global(.neo-input::-webkit-datetime-edit-month-field:focus),
92
+ .neo-date-time :global(.neo-input::-webkit-datetime-edit-year-field:focus) {
93
+ color: var(--neo-date-time-text-color, var(--neo-text-color));
94
+ background-color: var(--neo-date-time-text-highlight-color, var(--neo-text-highlight-color));
95
+ outline: none;
96
+ }</style>
@@ -0,0 +1,19 @@
1
+ import type { NeoDateTimeProps } from './neo-date-time.model.js';
2
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
+ $$bindings?: Bindings;
5
+ } & Exports;
6
+ (internal: unknown, props: Props & {
7
+ $$events?: Events;
8
+ $$slots?: Slots;
9
+ }): Exports & {
10
+ $set?: any;
11
+ $on?: any;
12
+ };
13
+ z_$$bindings?: Bindings;
14
+ }
15
+ declare const NeoDateTime: $$__sveltets_2_IsomorphicComponent<NeoDateTimeProps, {
16
+ [evt: string]: CustomEvent<any>;
17
+ }, {}, {}, "value" | "ref" | "hovered" | "focused" | "touched" | "dirty" | "valid" | "labelRef">;
18
+ type NeoDateTime = InstanceType<typeof NeoDateTime>;
19
+ export default NeoDateTime;