@widgetic/design-system 0.5.32 → 0.5.33

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.
@@ -52,6 +52,9 @@
52
52
  export let onForward: BreadcrumbsProps['onForward'] = () => {};
53
53
  // debug settings
54
54
  export let showDebugVisualizer: boolean = false;
55
+ /** When true, ancestor crumbs are valid folder drop targets for the file browser. */
56
+ export let enableFolderDropTargets: boolean = false;
57
+ export let rootDropTargetId: string = 'root';
55
58
 
56
59
  // A name a visitor wrote keeps a direction of its own on a right to left screen (a Latin folder name reads left to
57
60
  // right inside it); on a left to right screen no attribute is written and nothing changes.
@@ -302,8 +305,9 @@
302
305
  <span
303
306
  role="link"
304
307
  tabindex="0"
305
- class="{crumbTextClass} text-muted-foreground hover:text-foreground cursor-pointer whitespace-nowrap transition-colors duration-fast hover:underline"
308
+ class="{crumbTextClass} text-muted-foreground hover:text-foreground cursor-pointer whitespace-nowrap rounded-md px-1 transition-all duration-fast hover:underline data-[folder-drop-hover=true]:bg-accent data-[folder-drop-hover=true]:text-foreground data-[folder-drop-hover=true]:ring-2 data-[folder-drop-hover=true]:ring-brand"
306
309
  class:opacity-50={isLoading}
310
+ data-folder-drop-target={enableFolderDropTargets ? rootDropTargetId : undefined}
307
311
  style="pointer-events: {isLoading ? 'none' : 'auto'};"
308
312
  on:click={(e) => handleClick(e, -1)}
309
313
  on:keydown={(e) => handleKeyDown(e, -1)}
@@ -357,8 +361,11 @@
357
361
  dir={nameDirection}
358
362
  role="link"
359
363
  tabindex="0"
360
- class="{crumbTextClass} text-muted-foreground hover:text-foreground cursor-pointer transition-colors duration-fast hover:underline"
364
+ class="{crumbTextClass} text-muted-foreground hover:text-foreground cursor-pointer rounded-md px-1 transition-all duration-fast hover:underline data-[folder-drop-hover=true]:bg-accent data-[folder-drop-hover=true]:text-foreground data-[folder-drop-hover=true]:ring-2 data-[folder-drop-hover=true]:ring-brand"
361
365
  class:opacity-50={isLoading}
366
+ data-folder-drop-target={enableFolderDropTargets
367
+ ? currentPath[currentPath.length - itemsToShow + 1 + index]
368
+ : undefined}
362
369
  style="pointer-events: {isLoading ? 'none' : 'auto'};"
363
370
  on:click={(e) => handleClick(e, currentPath.length - itemsToShow + 1 + index)}
364
371
  on:keydown={(e) =>
@@ -383,8 +390,9 @@
383
390
  dir={nameDirection}
384
391
  role="link"
385
392
  tabindex="0"
386
- class="{crumbTextClass} text-muted-foreground hover:text-foreground cursor-pointer transition-colors duration-fast hover:underline"
393
+ class="{crumbTextClass} text-muted-foreground hover:text-foreground cursor-pointer rounded-md px-1 transition-all duration-fast hover:underline data-[folder-drop-hover=true]:bg-accent data-[folder-drop-hover=true]:text-foreground data-[folder-drop-hover=true]:ring-2 data-[folder-drop-hover=true]:ring-brand"
387
394
  class:opacity-50={isLoading}
395
+ data-folder-drop-target={enableFolderDropTargets ? currentPath[index] : undefined}
388
396
  style="pointer-events: {isLoading ? 'none' : 'auto'};"
389
397
  on:click={(e) => handleClick(e, index)}
390
398
  on:keydown={(e) => handleKeyDown(e, index)}
@@ -33,6 +33,8 @@ declare const Breadcrumbs: $$__sveltets_2_IsomorphicComponent<{
33
33
  onBack?: BreadcrumbsProps["onBack"];
34
34
  onForward?: BreadcrumbsProps["onForward"];
35
35
  showDebugVisualizer?: boolean;
36
+ /** When true, ancestor crumbs are valid folder drop targets for the file browser. */ enableFolderDropTargets?: boolean;
37
+ rootDropTargetId?: string;
36
38
  }, {
37
39
  [evt: string]: CustomEvent<any>;
38
40
  }, {}, {}, string>;
@@ -19,4 +19,8 @@ export interface BreadcrumbsProps {
19
19
  breadcrumbLabel?: string;
20
20
  /** Figma Crumbs Size=Compact: Heading/Section text and a 4px gap (a narrow header). Default: false (Size=Page). */
21
21
  compact?: boolean;
22
+ /** When true, ancestor crumbs accept file-browser drag-to-folder drops (`data-folder-drop-target`). */
23
+ enableFolderDropTargets?: boolean;
24
+ /** Folder id for the root crumb drop target (defaults to `root`). */
25
+ rootDropTargetId?: string;
22
26
  }
@@ -114,6 +114,8 @@
114
114
  // (1) pull the scroll area into that padding and (2) add matching padding-right so the cards stay on the
115
115
  // pe-8 line and the bar is centred in the leftover space between the cards and the dialog edge.
116
116
  const PANE_RIGHT_PADDING_PX = 32;
117
+ /** Moves the scroll rail toward the dialog edge while the content line stays on pe-8. */
118
+ const SCROLLBAR_SHIFT_TOWARD_EDGE_PX = 8;
117
119
  let paneScrollStyle = $state('');
118
120
 
119
121
  function overlayScrollbar(node: HTMLElement) {
@@ -125,7 +127,10 @@
125
127
  }
126
128
  // Read the real bar width (often ~14px in Chromium, 8px when thin styles apply).
127
129
  const barWidth = Math.max(node.offsetWidth - node.clientWidth, 8);
128
- const outerGap = Math.max((PANE_RIGHT_PADDING_PX - barWidth) / 2, 0);
130
+ const outerGap = Math.max(
131
+ (PANE_RIGHT_PADDING_PX - barWidth) / 2 - SCROLLBAR_SHIFT_TOWARD_EDGE_PX,
132
+ 0
133
+ );
129
134
  const pull = PANE_RIGHT_PADDING_PX - outerGap;
130
135
  // End side, not the right: the bar sits at the inline end of the page, so a dialog read right to left mirrors it
131
136
  // (tests/rtl/sourcePlacement.test.ts fails on a physical side). Left to right, this is margin-right/padding-right.
@@ -55,10 +55,13 @@
55
55
  --muted-foreground: var(--color-neutral-550);
56
56
  --accent: var(--color-alpha-dark-04);
57
57
  --accent-foreground: var(--color-dark);
58
- /* Hover of a surface that is already accent (soft controls, the search field, the rows of the editor).
59
- The Figma Hover variants stack a second accent fill on the first (4% over 4%); the nearest alpha primitive is 8%.
60
- Derived from the primitives, not a Figma variable. */
61
- --accent-hover: var(--color-alpha-dark-08);
58
+ /*
59
+ * Hover of a surface that is already accent (soft controls, the search field, the rows of the editor).
60
+ * The Figma Hover variants stack a second accent fill on the first (4% over 4%); the nearest alpha primitive is 8%.
61
+ * Opaque mix of page background and ink so outline and ghost hovers stay solid on a dark band behind them (transparent
62
+ * alpha tints would show the parent). Derived from the primitives, not a Figma variable.
63
+ */
64
+ --accent-hover: color-mix(in oklab, var(--background) 92%, var(--foreground) 8%);
62
65
  --destructive: var(--color-error);
63
66
  --destructive-foreground: var(--color-white);
64
67
  /* Warning icon and text, 5.0:1 on white, and the surface of the Warning toast (white text on it is 5.0:1 too). Never a button. */
@@ -159,9 +162,8 @@
159
162
  --muted-foreground: var(--color-alpha-light-70);
160
163
  --accent: var(--color-alpha-light-10);
161
164
  --accent-foreground: var(--color-white);
162
- /* Not a Figma variable, like --accent-hover of `:root`: the hover of a surface that is already accent, i.e. the accent
163
- stacked on itself (white at 10% over white at 10% is about 20%). */
164
- --accent-hover: color-mix(in oklab, var(--color-white) 20%, transparent);
165
+ /* Not a Figma variable, like `--accent-hover` of `:root`: the hover of a surface that is already accent — opaque 20% ink. */
166
+ --accent-hover: color-mix(in oklab, var(--background) 80%, var(--foreground) 20%);
165
167
  --destructive: var(--color-error-light);
166
168
  --destructive-foreground: var(--color-dark);
167
169
  --warning: var(--color-amber-light);
@@ -177,6 +179,16 @@
177
179
  --sidebar-ring: var(--color-sage-green);
178
180
  }
179
181
 
182
+ /*
183
+ * Inverse / marketing bands that are not a full `.dark` theme: only interactive tints flip so ghost, outline-like controls
184
+ * and fields use a light ink on the dark canvas. Text colours stay whatever the band sets; put `data-surface="dark"` on the
185
+ * wrapper (Tailwind does not read it — it is a hook for these tokens only).
186
+ */
187
+ [data-surface="dark"] {
188
+ --accent: color-mix(in oklab, var(--color-dark) 96%, var(--color-white) 4%);
189
+ --accent-hover: color-mix(in oklab, var(--color-dark) 92%, var(--color-white) 8%);
190
+ }
191
+
180
192
  @theme inline {
181
193
  --color-background: var(--background);
182
194
  --color-foreground: var(--foreground);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widgetic/design-system",
3
- "version": "0.5.32",
3
+ "version": "0.5.33",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "type": "module",
6
6
  "svelte": "./dist/index.js",