@invopop/popui 0.1.51 → 0.1.52

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.
@@ -12,6 +12,7 @@
12
12
  placement = 'bottom-start',
13
13
  matchParentWidth = false,
14
14
  usePortal = true,
15
+ strategy: strategyProp,
15
16
  class: className = '',
16
17
  trigger,
17
18
  children,
@@ -19,7 +20,7 @@
19
20
  }: BaseDropdownProps = $props()
20
21
 
21
22
  // Conditional portal action - noop if disabled
22
- const conditionalPortal = usePortal ? portal : () => {}
23
+ const conditionalPortal = $derived(usePortal ? portal : () => {})
23
24
 
24
25
  const middleware = [offset(6), flip(), shift()]
25
26
 
@@ -38,8 +39,8 @@
38
39
 
39
40
  let closedFromClickOutside = $state(false)
40
41
 
41
- // Create floating actions with strategy based on usePortal
42
- const strategy = usePortal ? 'absolute' : 'fixed'
42
+ // Create floating actions with strategy based on prop or usePortal
43
+ const strategy = $derived(strategyProp ?? (usePortal ? 'absolute' : 'fixed'))
43
44
  const [floatingRef, floatingContent] = createFloatingActions({
44
45
  strategy,
45
46
  placement,
@@ -37,11 +37,11 @@
37
37
  <label for={id} class="cursor-pointer">
38
38
  <div class={containerStyles}>
39
39
  <div class={headerStyles}>
40
- <div class="flex grow items-start gap-1 min-w-0">
40
+ <div class="flex grow items-start gap-1 min-w-0" data-card-content>
41
41
  {#if icon}
42
- <Icon src={icon} class="size-4 text-icon shrink-0 mt-0.5" />
42
+ <Icon src={icon} class="size-4 text-icon shrink-0 mt-0.5" data-card-icon />
43
43
  {/if}
44
- <div class="flex flex-col gap-1 min-w-0">
44
+ <div class="flex flex-col gap-1 min-w-0" data-card-text>
45
45
  <span class="text-base font-medium text-foreground">
46
46
  {title}
47
47
  </span>
@@ -24,7 +24,8 @@
24
24
  onOpenChange,
25
25
  stackLeft = false,
26
26
  stackRight = false,
27
- multipleLabel = 'items'
27
+ multipleLabel = 'items',
28
+ strategy
28
29
  }: DropdownSelectProps = $props()
29
30
 
30
31
  let selectDropdown: BaseDropdown | undefined = $state()
@@ -128,6 +129,7 @@
128
129
  bind:isOpen
129
130
  placement="bottom-start"
130
131
  {fullWidth}
132
+ {strategy}
131
133
  bind:this={selectDropdown}
132
134
  class={fullWidth || isStacked ? '' : widthClass}
133
135
  >
@@ -4,14 +4,15 @@
4
4
  * This file can be imported in any project using:
5
5
  * @import "@invopop/popui/tailwind.theme.css";
6
6
  *
7
+ * To use the Geist Mono font, add this to your HTML or main CSS file:
8
+ * @import url('https://fonts.googleapis.com/css2?family=Geist+Mono:wght@100..900&display=swap');
9
+ *
7
10
  * Three-tier color system:
8
11
  * 1. Primitive colors: Raw color values from Figma (e.g., mint-100)
9
12
  * 2. Semantic colors: Named palettes using base colors (e.g., positive-100)
10
13
  * 3. Token colors: Application-specific using semantic colors (e.g., foreground-default)
11
14
  */
12
15
 
13
- @import url('https://fonts.googleapis.com/css2?family=Geist+Mono:wght@100..900&display=swap');
14
-
15
16
  @theme {
16
17
  /* ============================================
17
18
  PRIMITIVE COLORS
package/dist/types.d.ts CHANGED
@@ -216,6 +216,7 @@ export interface BaseDropdownProps {
216
216
  placement?: Placement;
217
217
  matchParentWidth?: boolean;
218
218
  usePortal?: boolean;
219
+ strategy?: 'absolute' | 'fixed';
219
220
  trigger?: Snippet;
220
221
  children?: Snippet;
221
222
  [key: string]: any;
@@ -364,6 +365,7 @@ export interface DropdownSelectProps {
364
365
  stackLeft?: boolean;
365
366
  stackRight?: boolean;
366
367
  multipleLabel?: string;
368
+ strategy?: 'absolute' | 'fixed';
367
369
  }
368
370
  export interface EmptyStateProps {
369
371
  icon?: Snippet;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@invopop/popui",
3
3
  "license": "MIT",
4
- "version": "0.1.51",
4
+ "version": "0.1.52",
5
5
  "repository": {
6
6
  "url": "https://github.com/invopop/popui"
7
7
  },