@invopop/popui 0.1.49 → 0.1.51

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.
@@ -34,6 +34,7 @@
34
34
  disabled,
35
35
  stackedLeft,
36
36
  stackedRight,
37
+ shortcut,
37
38
  onclick,
38
39
  class: `${fullWidthClass} ${className || ''}`,
39
40
  ...rest
@@ -1,12 +1,21 @@
1
1
  <script lang="ts">
2
2
  import 'flag-icons/css/flag-icons.min.css'
3
3
  import type { BaseFlagProps } from './types'
4
+ import { Icon } from '@steeze-ui/svelte-icon'
5
+ import { World } from '@invopop/ui-icons'
4
6
 
5
7
  let { country = '' }: BaseFlagProps = $props()
6
8
 
7
9
  let iso = $derived(country.toLowerCase())
10
+ let isGlobal = $derived(country.toUpperCase() === 'GLOBAL')
8
11
  </script>
9
12
 
10
- <div class="w-3.5 h-2.5 rounded-[1.5px] overflow-hidden flex items-center justify-center">
11
- <span class="fi fi-{country.toLocaleLowerCase()} text-[14px] leading-none"></span>
12
- </div>
13
+ {#if isGlobal}
14
+ <div class="w-3.5 h-2.5 flex items-center justify-center">
15
+ <Icon src={World} class="size-3.5 text-icon" />
16
+ </div>
17
+ {:else}
18
+ <div class="w-3.5 h-2.5 rounded-[1.5px] overflow-hidden flex items-center justify-center">
19
+ <span class="fi fi-{country.toLocaleLowerCase()} text-[14px] leading-none"></span>
20
+ </div>
21
+ {/if}
@@ -19,12 +19,10 @@
19
19
  }: CardCheckboxProps = $props()
20
20
 
21
21
  let containerStyles = $derived(
22
- clsx('border gap-3', {
22
+ clsx('border gap-3 rounded-xl', {
23
23
  'border-foreground-selected': checked,
24
24
  'border-border': !checked,
25
- 'bg-background-default-secondary': disabled,
26
- 'rounded-lg': hideRadio,
27
- 'rounded-xl': !hideRadio
25
+ 'bg-background-default-secondary': disabled
28
26
  })
29
27
  )
30
28
 
@@ -42,6 +42,7 @@
42
42
  draggable = false,
43
43
  widthClass = 'w-60',
44
44
  collapsibleGroups = true,
45
+ flagPosition = 'after',
45
46
  onclick,
46
47
  onselect,
47
48
  onreorder,
@@ -473,7 +474,7 @@
473
474
  {:else}
474
475
  <div class:px-1={!item.groupBy} class:cursor-grab={draggable && !item.locked}>
475
476
  <DrawerContextItem
476
- item={{ ...item, focused: item.value === focusedItemValue }}
477
+ item={{ ...item, focused: item.value === focusedItemValue, flagPosition: item.flagPosition || flagPosition }}
477
478
  {multiple}
478
479
  {onclick}
479
480
  onchange={updateItem}
@@ -76,6 +76,8 @@
76
76
  <ProfileAvatar name={item?.label || ''} picture={item?.picture || ''} variant="sm" />
77
77
  {:else if item?.picture}
78
78
  <ProfileAvatar name={item?.label || ''} picture={item?.picture} variant="sm" />
79
+ {:else if typeof item?.icon === 'string'}
80
+ <img src={item.icon} alt="" class="w-4 h-4 text-icon {item?.locked ? 'opacity-30' : ''}" />
79
81
  {:else if item?.icon}
80
82
  <Icon
81
83
  src={item.icon}
@@ -91,9 +93,12 @@
91
93
  {#if item?.color}
92
94
  <TagStatus status={item.color} dot />
93
95
  {/if}
96
+ {#if item?.country && item?.flagPosition === 'before'}
97
+ <BaseFlag country={item.country} />
98
+ {/if}
94
99
  <span class="{labelStyles} text-base font-medium truncate">{item?.label || ''}</span>
95
100
 
96
- {#if item?.country}
101
+ {#if item?.country && item?.flagPosition === 'after'}
97
102
  <BaseFlag country={item.country} />
98
103
  <span class="text-xs font-medium text-foreground-default-secondary uppercase">
99
104
  {item.country}
@@ -6,6 +6,7 @@
6
6
  import DrawerContext from './DrawerContext.svelte'
7
7
  import clsx from 'clsx'
8
8
  import TagStatus from './TagStatus.svelte'
9
+ import BaseFlag from './BaseFlag.svelte'
9
10
  import { resolveIcon } from './helpers.js'
10
11
  import { buttonVariants } from './button/button.svelte'
11
12
 
@@ -18,6 +19,7 @@
18
19
  multiple = false,
19
20
  fullWidth = false,
20
21
  widthClass = 'min-w-[160px] max-w-[420px]',
22
+ flagPosition = 'before',
21
23
  onSelect,
22
24
  onOpenChange,
23
25
  stackLeft = false,
@@ -151,9 +153,16 @@
151
153
  <TagStatus dot status={selectedColor} />
152
154
  {@render label()}
153
155
  </div>
156
+ {:else if !multiple && selectedItem?.country}
157
+ <div class="flex items-center gap-1 flex-1 min-w-0">
158
+ <BaseFlag country={selectedItem.country} />
159
+ {@render label()}
160
+ </div>
154
161
  {:else if selectedIcon || resolvedIcon}
155
162
  <div class="flex items-center gap-1 flex-1 min-w-0">
156
- {#if selectedIcon}
163
+ {#if typeof selectedIcon === 'string'}
164
+ <img src={selectedIcon} alt="" class="size-4 flex-shrink-0 text-icon" />
165
+ {:else if selectedIcon}
157
166
  <Icon src={selectedIcon} {iconTheme} class="{selectedIconColor} size-4 flex-shrink-0" />
158
167
  {:else if resolvedIcon}
159
168
  <Icon src={resolvedIcon} {iconTheme} class="text-icon size-4 flex-shrink-0" />
@@ -169,6 +178,7 @@
169
178
  widthClass="min-w-[256px]"
170
179
  {multiple}
171
180
  {items}
181
+ {flagPosition}
172
182
  onclick={handleClick}
173
183
  onselect={handleSelected}
174
184
  />
@@ -170,11 +170,13 @@
170
170
  iconClass?: string
171
171
  stackedLeft?: boolean
172
172
  stackedRight?: boolean
173
+ shortcut?: boolean
173
174
  }
174
175
  </script>
175
176
 
176
177
  <script lang="ts">
177
178
  import { Icon } from '@steeze-ui/svelte-icon'
179
+ import ShortcutWrapper from '../ShortcutWrapper.svelte'
178
180
 
179
181
  let {
180
182
  class: className,
@@ -185,6 +187,7 @@
185
187
  iconClass = '',
186
188
  stackedLeft = false,
187
189
  stackedRight = false,
190
+ shortcut = false,
188
191
  ref = $bindable(null),
189
192
  href = undefined,
190
193
  type = 'button',
@@ -211,7 +214,7 @@
211
214
  )
212
215
  </script>
213
216
 
214
- {#snippet iconContent()}
217
+ {#snippet iconElement()}
215
218
  {#if icon}
216
219
  <div class={cn('relative z-10', iconClass && `[&_svg]:${iconClass}`)}>
217
220
  <Icon src={icon} class={iconSize} />
@@ -219,6 +222,18 @@
219
222
  {/if}
220
223
  {/snippet}
221
224
 
225
+ {#snippet iconContent()}
226
+ {#if shortcut}
227
+ <ShortcutWrapper
228
+ theme={['dark', 'primary', 'danger'].includes(variant) ? 'navigation' : 'light'}
229
+ >
230
+ {@render iconElement()}
231
+ </ShortcutWrapper>
232
+ {:else}
233
+ {@render iconElement()}
234
+ {/if}
235
+ {/snippet}
236
+
222
237
  {#snippet buttonContent()}
223
238
  <div
224
239
  class={cn(
@@ -112,6 +112,7 @@ export type ButtonProps = WithElementRef<HTMLButtonAttributes> & WithElementRef<
112
112
  iconClass?: string;
113
113
  stackedLeft?: boolean;
114
114
  stackedRight?: boolean;
115
+ shortcut?: boolean;
115
116
  };
116
117
  declare const Button: import("svelte").Component<ButtonProps, {}, "ref">;
117
118
  type Button = ReturnType<typeof Button>;
@@ -1,15 +1,17 @@
1
1
  /**
2
2
  * PopUI Tailwind v4 Theme Configuration
3
- *
3
+ *
4
4
  * This file can be imported in any project using:
5
5
  * @import "@invopop/popui/tailwind.theme.css";
6
- *
6
+ *
7
7
  * Three-tier color system:
8
8
  * 1. Primitive colors: Raw color values from Figma (e.g., mint-100)
9
9
  * 2. Semantic colors: Named palettes using base colors (e.g., positive-100)
10
10
  * 3. Token colors: Application-specific using semantic colors (e.g., foreground-default)
11
11
  */
12
12
 
13
+ @import url('https://fonts.googleapis.com/css2?family=Geist+Mono:wght@100..900&display=swap');
14
+
13
15
  @theme {
14
16
  /* ============================================
15
17
  PRIMITIVE COLORS
@@ -799,7 +801,7 @@
799
801
 
800
802
  /* Font Family */
801
803
  --font-sans: Inter, sans-serif;
802
- --font-mono: "Geist Mono", CommitMono, ui-monospace, Menlo, Monaco, Consolas, "Ubuntu Mono", "Roboto Mono", "DejaVu Sans Mono", monospace;
804
+ --font-mono: "Geist Mono", CommitMono, ui-monospace, Menlo, Monaco, Consolas, "Roboto Mono", "DejaVu Sans Mono", monospace;
803
805
 
804
806
  /* Font Features for Monospace */
805
807
  --font-mono-features: "ss02" on, "ss08" on, "ss09" on;
package/dist/types.d.ts CHANGED
@@ -30,7 +30,7 @@ export type DrawerOption = SelectOption & {
30
30
  destructive?: boolean;
31
31
  selected?: boolean;
32
32
  focused?: boolean;
33
- icon?: IconSource | undefined;
33
+ icon?: IconSource | string | undefined;
34
34
  rightIcon?: IconSource | undefined;
35
35
  country?: string;
36
36
  color?: StatusType;
@@ -42,6 +42,7 @@ export type DrawerOption = SelectOption & {
42
42
  groupBy?: string;
43
43
  useAvatar?: boolean;
44
44
  action?: Snippet<[DrawerOption]>;
45
+ flagPosition?: 'before' | 'after';
45
46
  };
46
47
  export type Company = {
47
48
  id: string;
@@ -332,6 +333,7 @@ export interface DrawerContextProps {
332
333
  draggable?: boolean;
333
334
  widthClass?: string;
334
335
  collapsibleGroups?: boolean;
336
+ flagPosition?: 'before' | 'after';
335
337
  onclick?: (value: AnyProp) => void;
336
338
  onselect?: (selected: DrawerOption[]) => void;
337
339
  onreorder?: (items: DrawerOption[]) => void;
@@ -356,6 +358,7 @@ export interface DropdownSelectProps {
356
358
  multiple?: boolean;
357
359
  fullWidth?: boolean;
358
360
  widthClass?: string;
361
+ flagPosition?: 'before' | 'after';
359
362
  onSelect?: (value: AnyProp) => void;
360
363
  onOpenChange?: (isOpen: boolean) => void;
361
364
  stackLeft?: boolean;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@invopop/popui",
3
3
  "license": "MIT",
4
- "version": "0.1.49",
4
+ "version": "0.1.51",
5
5
  "repository": {
6
6
  "url": "https://github.com/invopop/popui"
7
7
  },
@@ -85,7 +85,7 @@
85
85
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.5",
86
86
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
87
87
  "@floating-ui/core": "^1.5.1",
88
- "@invopop/ui-icons": "^0.0.82",
88
+ "@invopop/ui-icons": "^0.0.84",
89
89
  "@steeze-ui/heroicons": "^2.2.3",
90
90
  "@steeze-ui/svelte-icon": "^1.6.2",
91
91
  "@tailwindcss/vite": "^4.1.12",