@r2digisolutions/components 0.1.6 → 0.1.7

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 (72) hide show
  1. package/README.md +1 -1
  2. package/dist/components/atoms/Checkbox/Checkbox.svelte +10 -3
  3. package/dist/components/atoms/Checkbox/Checkbox.svelte.d.ts +3 -0
  4. package/dist/components/atoms/Input/Input.svelte +17 -2
  5. package/dist/components/atoms/Input/Input.svelte.d.ts +6 -1
  6. package/dist/components/atoms/MarqueeRect/MarqueeRect.svelte +21 -0
  7. package/dist/components/atoms/MarqueeRect/MarqueeRect.svelte.d.ts +8 -0
  8. package/dist/components/atoms/Textarea/Textarea.svelte +4 -1
  9. package/dist/components/atoms/Textarea/Textarea.svelte.d.ts +1 -0
  10. package/dist/components/atoms/Toggle/Toggle.svelte +1 -1
  11. package/dist/components/molecules/BulkActionBar/BulkActionBar.svelte +19 -5
  12. package/dist/components/molecules/CodeEditor/CodeEditor.svelte +13 -10
  13. package/dist/components/molecules/ColorPicker/ColorPicker.svelte +166 -96
  14. package/dist/components/molecules/ConditionalFormatPanel/ConditionalFormatPanel.stories.d.ts +9 -0
  15. package/dist/components/molecules/ConditionalFormatPanel/ConditionalFormatPanel.stories.js +8 -0
  16. package/dist/components/molecules/ConditionalFormatPanel/ConditionalFormatPanel.svelte +412 -0
  17. package/dist/components/molecules/ConditionalFormatPanel/ConditionalFormatPanel.svelte.d.ts +14 -0
  18. package/dist/components/molecules/ConditionalFormatPanel/ConditionalFormatPanelStory.svelte +27 -0
  19. package/dist/components/molecules/ConditionalFormatPanel/ConditionalFormatPanelStory.svelte.d.ts +3 -0
  20. package/dist/components/molecules/ContextMenu/ContextMenu.svelte +73 -21
  21. package/dist/components/molecules/ContextMenu/ContextMenu.svelte.d.ts +8 -1
  22. package/dist/components/molecules/DateTimePicker/DateTimePicker.svelte.d.ts +1 -1
  23. package/dist/components/molecules/FormDateTimePicker/FormDateTimePicker.svelte.d.ts +1 -1
  24. package/dist/components/molecules/Gauge/Gauge.stories.d.ts +1 -1
  25. package/dist/components/molecules/InfiniteScroll/InfiniteScroll.stories.d.ts +1 -1
  26. package/dist/components/organisms/AssetPickerPage/AssetPickerPage.svelte.d.ts +1 -1
  27. package/dist/components/organisms/BacklogPage/BacklogPage.svelte.d.ts +1 -1
  28. package/dist/components/organisms/CalendarApp/CalendarApp.svelte.d.ts +1 -1
  29. package/dist/components/organisms/DataGrid/DataGrid.stories.d.ts +65 -0
  30. package/dist/components/organisms/DataGrid/DataGrid.stories.js +95 -0
  31. package/dist/components/organisms/DataGrid/DataGrid.svelte +2264 -0
  32. package/dist/components/organisms/DataGrid/DataGrid.svelte.d.ts +99 -0
  33. package/dist/components/organisms/DataGrid/DataGridStory.svelte +659 -0
  34. package/dist/components/organisms/DataGrid/DataGridStory.svelte.d.ts +11 -0
  35. package/dist/components/organisms/DataGrid/breakpoints.d.ts +10 -0
  36. package/dist/components/organisms/DataGrid/breakpoints.js +20 -0
  37. package/dist/components/organisms/DataGrid/cellEditors.d.ts +8 -0
  38. package/dist/components/organisms/DataGrid/cellEditors.js +59 -0
  39. package/dist/components/organisms/DataGrid/conditionalFormat.d.ts +11 -0
  40. package/dist/components/organisms/DataGrid/conditionalFormat.js +98 -0
  41. package/dist/components/organisms/DataGrid/filterRows.d.ts +5 -0
  42. package/dist/components/organisms/DataGrid/filterRows.js +60 -0
  43. package/dist/components/organisms/DataGrid/marks.d.ts +9 -0
  44. package/dist/components/organisms/DataGrid/marks.js +91 -0
  45. package/dist/components/organisms/DataGrid/types.d.ts +126 -0
  46. package/dist/components/organisms/DataGrid/types.js +21 -0
  47. package/dist/components/organisms/ResourceStudio/ResourceStudio.stories.d.ts +33 -0
  48. package/dist/components/organisms/ResourceStudio/ResourceStudio.stories.js +56 -0
  49. package/dist/components/organisms/ResourceStudio/ResourceStudio.svelte +830 -0
  50. package/dist/components/organisms/ResourceStudio/ResourceStudio.svelte.d.ts +68 -0
  51. package/dist/components/organisms/ResourceStudio/ResourceStudioStory.svelte +600 -0
  52. package/dist/components/organisms/ResourceStudio/ResourceStudioStory.svelte.d.ts +7 -0
  53. package/dist/components/organisms/ResourceStudio/fieldsToColumns.d.ts +4 -0
  54. package/dist/components/organisms/ResourceStudio/fieldsToColumns.js +20 -0
  55. package/dist/components/organisms/ResourceStudio/fieldsToSchema.d.ts +6 -0
  56. package/dist/components/organisms/ResourceStudio/fieldsToSchema.js +53 -0
  57. package/dist/components/organisms/ResourceStudio/types.d.ts +69 -0
  58. package/dist/components/organisms/ResourceStudio/types.js +15 -0
  59. package/dist/components/organisms/Scheduler/Scheduler.svelte.d.ts +1 -1
  60. package/dist/components/organisms/SchemaForm/SchemaForm.svelte +10 -3
  61. package/dist/components/organisms/SchemaForm/SchemaForm.svelte.d.ts +1 -0
  62. package/dist/components/templates/ResourceStudioTemplate/ResourceStudioTemplate.stories.d.ts +25 -0
  63. package/dist/components/templates/ResourceStudioTemplate/ResourceStudioTemplate.stories.js +18 -0
  64. package/dist/components/templates/ResourceStudioTemplate/ResourceStudioTemplate.svelte +192 -0
  65. package/dist/components/templates/ResourceStudioTemplate/ResourceStudioTemplate.svelte.d.ts +62 -0
  66. package/dist/components/templates/ResourceStudioTemplate/ResourceStudioTemplateStory.svelte +129 -0
  67. package/dist/components/templates/ResourceStudioTemplate/ResourceStudioTemplateStory.svelte.d.ts +7 -0
  68. package/dist/index.d.ts +11 -0
  69. package/dist/index.js +8 -0
  70. package/dist/utils/marqueeSelect.d.ts +48 -0
  71. package/dist/utils/marqueeSelect.js +189 -0
  72. package/package.json +1 -1
package/README.md CHANGED
@@ -65,7 +65,7 @@ pnpm release
65
65
  Esto hace bump de versión, commit, tag `vX.Y.Z` y push. CI entonces:
66
66
 
67
67
  1. Publica `@r2digisolutions/components` en npm
68
- 2. Crea un **GitHub Release** con notas generadas desde los commits desde el tag anterior
68
+ 2. Crea un **GitHub Release** con el enlace a npm y la lista de commits desde el tag anterior
69
69
 
70
70
  Mismo flujo que usan muchas libs con `bumpp` / `release-it` (tag → CI → npm + GitHub Release).
71
71
 
@@ -10,7 +10,10 @@
10
10
  value?: string;
11
11
  size?: 'sm' | 'md' | 'lg';
12
12
  class?: string;
13
+ /** Accessible name when no visible label is provided. */
14
+ 'aria-label'?: string;
13
15
  onchange?: (checked: boolean) => void;
16
+ onclick?: (e: MouseEvent) => void;
14
17
  }
15
18
 
16
19
  let {
@@ -24,7 +27,9 @@
24
27
  value,
25
28
  size = 'md',
26
29
  class: className = '',
27
- onchange
30
+ 'aria-label': ariaLabel,
31
+ onchange,
32
+ onclick
28
33
  }: CheckboxProps = $props();
29
34
 
30
35
  const inputId = $derived(id ?? `checkbox-${Math.random().toString(36).slice(2, 9)}`);
@@ -48,7 +53,7 @@
48
53
  onchange?.(checked);
49
54
  }
50
55
 
51
- // Apply indeterminate state via action
56
+ /** Keep DOM indeterminate in sync without bind loops. */
52
57
  function setIndeterminate(node: HTMLInputElement) {
53
58
  $effect(() => {
54
59
  node.indeterminate = indeterminate;
@@ -64,7 +69,8 @@
64
69
  {name}
65
70
  {value}
66
71
  {disabled}
67
- bind:checked
72
+ checked={checked}
73
+ aria-label={ariaLabel ?? label}
68
74
  {@attach setIndeterminate}
69
75
  class={[
70
76
  'shrink-0 cursor-pointer border-2 border-border bg-surface-elevated appearance-none transition-all duration-150',
@@ -86,6 +92,7 @@
86
92
  background-repeat: no-repeat;
87
93
  "
88
94
  onchange={handleChange}
95
+ {onclick}
89
96
  />
90
97
  </div>
91
98
 
@@ -9,7 +9,10 @@ interface CheckboxProps {
9
9
  value?: string;
10
10
  size?: 'sm' | 'md' | 'lg';
11
11
  class?: string;
12
+ /** Accessible name when no visible label is provided. */
13
+ 'aria-label'?: string;
12
14
  onchange?: (checked: boolean) => void;
15
+ onclick?: (e: MouseEvent) => void;
13
16
  }
14
17
  declare const Checkbox: import("svelte").Component<CheckboxProps, {}, "checked" | "indeterminate">;
15
18
  type Checkbox = ReturnType<typeof Checkbox>;
@@ -10,7 +10,7 @@
10
10
  label?: string;
11
11
  placeholder?: string;
12
12
  value?: string;
13
- type?: 'text' | 'email' | 'password' | 'number' | 'search' | 'tel' | 'url';
13
+ type?: 'text' | 'email' | 'password' | 'number' | 'search' | 'tel' | 'url' | 'date';
14
14
  status?: InputStatus;
15
15
  helperText?: string;
16
16
  disabled?: boolean;
@@ -21,10 +21,15 @@
21
21
  leadIcon?: Snippet;
22
22
  trailIcon?: Snippet;
23
23
  class?: string;
24
+ autofocus?: boolean;
25
+ min?: number;
26
+ max?: number;
27
+ step?: number;
24
28
  oninput?: (e: Event) => void;
25
29
  onchange?: (e: Event) => void;
26
30
  onfocus?: (e: FocusEvent) => void;
27
31
  onblur?: (e: FocusEvent) => void;
32
+ onkeydown?: (e: KeyboardEvent) => void;
28
33
  }
29
34
 
30
35
  let {
@@ -40,6 +45,10 @@
40
45
  readonly = false,
41
46
  required = false,
42
47
  clearable = false,
48
+ autofocus = false,
49
+ min,
50
+ max,
51
+ step,
43
52
  size = 'md',
44
53
  leadIcon,
45
54
  trailIcon,
@@ -47,7 +56,8 @@
47
56
  oninput,
48
57
  onchange,
49
58
  onfocus,
50
- onblur
59
+ onblur,
60
+ onkeydown
51
61
  }: InputProps = $props();
52
62
 
53
63
  const inputId = $derived(id ?? `input-${Math.random().toString(36).slice(2, 9)}`);
@@ -132,6 +142,10 @@
132
142
  {disabled}
133
143
  {readonly}
134
144
  {required}
145
+ {autofocus}
146
+ {min}
147
+ {max}
148
+ {step}
135
149
  bind:value
136
150
  aria-describedby={helperText ? helperId : undefined}
137
151
  aria-invalid={status === 'error'}
@@ -144,6 +158,7 @@
144
158
  {onchange}
145
159
  {onfocus}
146
160
  {onblur}
161
+ {onkeydown}
147
162
  />
148
163
 
149
164
  {#if hasClear}
@@ -7,7 +7,7 @@ interface InputProps {
7
7
  label?: string;
8
8
  placeholder?: string;
9
9
  value?: string;
10
- type?: 'text' | 'email' | 'password' | 'number' | 'search' | 'tel' | 'url';
10
+ type?: 'text' | 'email' | 'password' | 'number' | 'search' | 'tel' | 'url' | 'date';
11
11
  status?: InputStatus;
12
12
  helperText?: string;
13
13
  disabled?: boolean;
@@ -18,10 +18,15 @@ interface InputProps {
18
18
  leadIcon?: Snippet;
19
19
  trailIcon?: Snippet;
20
20
  class?: string;
21
+ autofocus?: boolean;
22
+ min?: number;
23
+ max?: number;
24
+ step?: number;
21
25
  oninput?: (e: Event) => void;
22
26
  onchange?: (e: Event) => void;
23
27
  onfocus?: (e: FocusEvent) => void;
24
28
  onblur?: (e: FocusEvent) => void;
29
+ onkeydown?: (e: KeyboardEvent) => void;
25
30
  }
26
31
  declare const Input: import("svelte").Component<InputProps, {}, "value">;
27
32
  type Input = ReturnType<typeof Input>;
@@ -0,0 +1,21 @@
1
+ <script lang="ts">
2
+ import type { MarqueeRect as MarqueeRectBox } from '../../../utils/marqueeSelect.js';
3
+
4
+ interface MarqueeRectProps {
5
+ rect?: MarqueeRectBox | null;
6
+ class?: string;
7
+ }
8
+
9
+ let { rect = null, class: className = '' }: MarqueeRectProps = $props();
10
+ </script>
11
+
12
+ {#if rect && rect.width > 0 && rect.height > 0}
13
+ <div
14
+ class={[
15
+ 'pointer-events-none absolute z-50 rounded-sm border border-brand-500 bg-brand-500/15',
16
+ className
17
+ ]}
18
+ style={`left:${rect.x}px;top:${rect.y}px;width:${rect.width}px;height:${rect.height}px`}
19
+ aria-hidden="true"
20
+ ></div>
21
+ {/if}
@@ -0,0 +1,8 @@
1
+ import type { MarqueeRect as MarqueeRectBox } from '../../../utils/marqueeSelect.js';
2
+ interface MarqueeRectProps {
3
+ rect?: MarqueeRectBox | null;
4
+ class?: string;
5
+ }
6
+ declare const MarqueeRect: import("svelte").Component<MarqueeRectProps, {}, "">;
7
+ type MarqueeRect = ReturnType<typeof MarqueeRect>;
8
+ export default MarqueeRect;
@@ -19,6 +19,7 @@
19
19
  onchange?: (e: Event) => void;
20
20
  onfocus?: (e: FocusEvent) => void;
21
21
  onblur?: (e: FocusEvent) => void;
22
+ onkeydown?: (e: KeyboardEvent) => void;
22
23
  }
23
24
 
24
25
  let {
@@ -40,7 +41,8 @@
40
41
  oninput,
41
42
  onchange,
42
43
  onfocus,
43
- onblur
44
+ onblur,
45
+ onkeydown
44
46
  }: TextareaProps = $props();
45
47
 
46
48
  const textareaId = $derived(id ?? `textarea-${Math.random().toString(36).slice(2, 9)}`);
@@ -118,6 +120,7 @@
118
120
  {onchange}
119
121
  {onfocus}
120
122
  {onblur}
123
+ {onkeydown}
121
124
  ></textarea>
122
125
  </div>
123
126
 
@@ -18,6 +18,7 @@ interface TextareaProps {
18
18
  onchange?: (e: Event) => void;
19
19
  onfocus?: (e: FocusEvent) => void;
20
20
  onblur?: (e: FocusEvent) => void;
21
+ onkeydown?: (e: KeyboardEvent) => void;
21
22
  }
22
23
  declare const Textarea: import("svelte").Component<TextareaProps, {}, "value">;
23
24
  type Textarea = ReturnType<typeof Textarea>;
@@ -61,7 +61,7 @@
61
61
  id={inputId}
62
62
  type="checkbox"
63
63
  class="sr-only"
64
- bind:checked
64
+ checked={checked}
65
65
  {disabled}
66
66
  onchange={handleChange}
67
67
  />
@@ -169,15 +169,29 @@
169
169
  onclear?.();
170
170
  }
171
171
  }
172
+
173
+ /** Dock sticks to the viewport bottom; portal avoids parent transform/overflow traps. */
174
+ function portalDock(node: HTMLElement) {
175
+ if (!(placement === 'dock' && sticky)) return {};
176
+ document.body.appendChild(node);
177
+ return {
178
+ destroy() {
179
+ node.remove();
180
+ }
181
+ };
182
+ }
183
+
184
+ const dockFixed = $derived(placement === 'dock' && sticky);
172
185
  </script>
173
186
 
174
187
  <svelte:window onkeydown={onKeydown} />
175
188
 
176
189
  {#if count > 0}
177
190
  <div
191
+ use:portalDock
178
192
  class={[
179
193
  placement === 'dock' && 'pointer-events-none z-30 flex justify-center',
180
- placement === 'dock' && sticky && 'sticky bottom-3 px-3',
194
+ dockFixed && 'fixed inset-x-0 bottom-3 z-50 px-3',
181
195
  placement === 'inline' && sticky && 'sticky bottom-0 z-20',
182
196
  className
183
197
  ]}
@@ -210,14 +224,14 @@
210
224
  </span>
211
225
  {/if}
212
226
 
213
- <div class="min-w-0 flex-1">
227
+ <div class="flex min-w-0 flex-1 flex-col leading-tight">
214
228
  <p class="truncate text-xs font-semibold text-primary sm:text-sm">{selectionText}</p>
215
229
  {#if description}
216
230
  <p class="truncate text-[11px] text-muted">{description}</p>
217
231
  {:else if canSelectAll}
218
232
  <button
219
233
  type="button"
220
- class="mt-0.5 text-[11px] font-medium text-brand-600 hover:underline dark:text-brand-400"
234
+ class="w-fit text-left text-[11px] font-medium text-brand-600 hover:underline dark:text-brand-400"
221
235
  onclick={() => onselectall?.()}
222
236
  >
223
237
  Select all {total}
@@ -225,7 +239,7 @@
225
239
  {:else if canSelectNone}
226
240
  <button
227
241
  type="button"
228
- class="mt-0.5 text-[11px] font-medium text-secondary hover:underline"
242
+ class="w-fit text-left text-[11px] font-medium text-secondary hover:underline"
229
243
  onclick={() => onselectnone?.()}
230
244
  >
231
245
  Clear selection
@@ -233,7 +247,7 @@
233
247
  {:else if resolvedHint}
234
248
  <p
235
249
  class={[
236
- 'mt-0.5 text-[11px]',
250
+ 'text-[11px]',
237
251
  pendingConfirm ? 'text-amber-700 dark:text-amber-300' : 'text-muted'
238
252
  ]}
239
253
  >
@@ -57,23 +57,27 @@
57
57
 
58
58
  <div
59
59
  class={[
60
- 'overflow-hidden rounded-xl border border-border bg-zinc-950 text-zinc-100 shadow-sm',
60
+ 'flex flex-col overflow-hidden rounded-xl border border-border bg-surface-elevated text-primary shadow-sm',
61
61
  className
62
62
  ]}
63
63
  >
64
64
  {#if filename || language}
65
- <div class="flex items-center justify-between border-b border-zinc-800 bg-zinc-900/80 px-3 py-1.5">
66
- <span class="truncate font-mono text-[11px] text-zinc-400">{filename || language}</span>
67
- <span class="rounded bg-zinc-800 px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wide text-zinc-500">
65
+ <div
66
+ class="flex shrink-0 items-center justify-between border-b border-border bg-surface-overlay/80 px-3 py-1.5"
67
+ >
68
+ <span class="truncate font-mono text-[11px] text-secondary">{filename || language}</span>
69
+ <span
70
+ class="rounded bg-surface-overlay px-1.5 py-0.5 font-mono text-[10px] tracking-wide text-muted uppercase"
71
+ >
68
72
  {language}
69
73
  </span>
70
74
  </div>
71
75
  {/if}
72
76
 
73
- <div class="relative flex" style:min-height={`${minHeight}px`}>
77
+ <div class="relative flex min-h-0 flex-1" style:min-height={`${minHeight}px`}>
74
78
  {#if showLineNumbers}
75
79
  <div
76
- class="select-none border-r border-zinc-800 bg-zinc-950/80 py-3 pl-3 pr-2 text-right font-mono text-[11px] leading-5 text-zinc-600"
80
+ class="select-none border-r border-border bg-surface-overlay/60 py-3 pr-2 pl-3 text-right font-mono text-[11px] leading-5 text-muted"
77
81
  aria-hidden="true"
78
82
  >
79
83
  {#each lineNums as n (n)}
@@ -82,11 +86,10 @@
82
86
  </div>
83
87
  {/if}
84
88
 
85
- <div class="relative min-w-0 flex-1">
89
+ <div class="relative min-h-0 min-w-0 flex-1">
86
90
  <textarea
87
91
  bind:this={textareaEl}
88
- class="absolute inset-0 z-10 h-full w-full resize-none bg-transparent p-3 font-mono text-[12px] leading-5 text-transparent caret-zinc-100 outline-none selection:bg-brand-500/40"
89
- style:min-height={`${minHeight}px`}
92
+ class="absolute inset-0 z-10 h-full w-full resize-none bg-transparent p-3 font-mono text-[12px] leading-5 text-transparent caret-[var(--text-primary)] outline-none selection:bg-brand-500/40"
90
93
  {value}
91
94
  {readonly}
92
95
  {placeholder}
@@ -100,7 +103,7 @@
100
103
  ></textarea>
101
104
  <pre
102
105
  bind:this={preEl}
103
- class="pointer-events-none absolute inset-0 overflow-auto whitespace-pre p-3 font-mono text-[12px] leading-5 text-zinc-200"
106
+ class="pointer-events-none absolute inset-0 overflow-auto whitespace-pre p-3 font-mono text-[12px] leading-5 text-primary"
104
107
  aria-hidden="true"
105
108
  ><code>{value || ' '}</code></pre>
106
109
  </div>