@invopop/popui 0.0.92 → 0.0.94

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.
@@ -47,7 +47,7 @@ $:
47
47
  { "py-1.5": big && $$slots.default },
48
48
  { "py-1": !big && $$slots.default },
49
49
  { "text-white": ["primary", "danger", "dark", "warning"].includes(variant) },
50
- { "text-neutral-800": ["default", "secondary"].includes(variant) },
50
+ { "text-neutral-800": ["default", "secondary", "outline"].includes(variant) },
51
51
  { "border border-white-10 hover:border-white-20 active:border-white-40": variant === "dark" },
52
52
  {
53
53
  "border border-neutral-200 hover:bg-neutral-100 active:border-neutral-300 active:bg-neutral-200": variant === "default"
@@ -13,7 +13,7 @@ $:
13
13
  label: a.label,
14
14
  value: a,
15
15
  icon: a.icon,
16
- footer: a.footer,
16
+ separator: a.separator,
17
17
  destructive: a.destructive
18
18
  }));
19
19
  $:
@@ -1,15 +1,12 @@
1
1
  <script>import DrawerContextItem from "./DrawerContextItem.svelte";
2
2
  import InputSearch from "./InputSearch.svelte";
3
3
  import { createEventDispatcher } from "svelte";
4
+ import DrawerContextSeparator from "./DrawerContextSeparator.svelte";
4
5
  const dispatch = createEventDispatcher();
5
6
  export let items = [];
6
7
  export let multiple = false;
7
8
  export let searchable = false;
8
9
  export let widthClass = "w-60";
9
- $:
10
- mainItems = items.filter((i) => !i.footer);
11
- $:
12
- footerItems = items.filter((i) => i.footer);
13
10
  $:
14
11
  selectedItems = items.filter((i) => i.selected);
15
12
  $:
@@ -32,17 +29,13 @@ function updateItem(event) {
32
29
  <InputSearch placeholder="Search" />
33
30
  </div>
34
31
  {/if}
35
- <ul class="px-1 space-y-1 max-h-80 overflow-y-auto">
36
- {#each mainItems as item}
37
- <DrawerContextItem {item} {multiple} on:click on:change={updateItem} />
32
+ <ul class="space-y-0.5 max-h-80 overflow-y-auto">
33
+ {#each items as item}
34
+ {#if item.separator}
35
+ <DrawerContextSeparator />
36
+ {:else}
37
+ <DrawerContextItem {item} {multiple} on:click on:change={updateItem} />
38
+ {/if}
38
39
  {/each}
39
40
  </ul>
40
- {#if footerItems.length}
41
- <hr class="!my-1 border-neutral-100" />
42
- <ul class="px-1 space-y-1">
43
- {#each footerItems as item}
44
- <DrawerContextItem {item} {multiple} on:click />
45
- {/each}
46
- </ul>
47
- {/if}
48
41
  </div>
@@ -18,11 +18,11 @@ $:
18
18
  $:
19
19
  styles = clsx(
20
20
  { "py-1 space-x-3": workspace },
21
- { "py-1.5 space-x-1": !workspace },
22
- { "px-1.5": hasIcon },
23
- { "px-2": !hasIcon },
21
+ { "py-1.5 space-x-1.5": !workspace },
22
+ { "pl-1.5": hasIcon },
23
+ { "pl-2": !hasIcon },
24
24
  { "bg-workspace-accent-100": item.selected && !multiple },
25
- { "hover:bg-neutral-100 rounded": !item.selected }
25
+ { "group-hover:bg-neutral-100": !item.selected || multiple }
26
26
  );
27
27
  $:
28
28
  labelStyles = clsx(
@@ -42,7 +42,8 @@ onMount(() => {
42
42
 
43
43
  <button
44
44
  bind:this={el}
45
- class="{styles} border border-transparent rounded pr-2 flex items-center justify-start w-full"
45
+ class="w-full px-1 py-0.5 disabled:opacity-30 group"
46
+ disabled={item.disabled}
46
47
  on:click|stopPropagation={() => {
47
48
  if (multiple) {
48
49
  item.selected = !item.selected
@@ -52,39 +53,45 @@ onMount(() => {
52
53
  }
53
54
  }}
54
55
  >
55
- {#if workspace}
56
- <ProfileAvatar name={item.label} picture={item.picture} large />
57
- {:else if item.icon}
58
- <Icon
59
- src={item.icon}
60
- class="w-4 h-4 {item.destructive ? 'text-danger-500' : item.iconClass || 'text-neutral-500'}"
61
- />
62
- {/if}
63
- <div class="whitespace-nowrap flex-1 text-left flex flex-col truncate" title={item.label}>
64
- <span class="flex items-center space-x-1.5">
65
- {#if item.color}
66
- <TagStatus status={item.color} dot />
67
- {/if}
68
- <span class="{labelStyles} text-base font-medium truncate">{item.label}</span>
69
- </span>
70
-
71
- {#if item.country}
72
- <span class="flex space-x-1 items-center">
73
- <BaseFlag country={item.country} width={10} />
74
- <span class="text-sm text-neutral-500 tracking-normal">{getCountryName(item.country)}</span>
56
+ <div class="{styles} rounded pr-1.5 flex items-center justify-start w-full">
57
+ {#if workspace}
58
+ <ProfileAvatar name={item.label} picture={item.picture} large />
59
+ {:else if item.icon}
60
+ <Icon
61
+ src={item.icon}
62
+ class="w-4 h-4 {item.destructive
63
+ ? 'text-danger-500'
64
+ : item.iconClass || 'text-neutral-500'}"
65
+ />
66
+ {/if}
67
+ <div class="whitespace-nowrap flex-1 text-left flex flex-col truncate" title={item.label}>
68
+ <span class="flex items-center space-x-1.5">
69
+ {#if item.color}
70
+ <TagStatus status={item.color} dot />
71
+ {/if}
72
+ <span class="{labelStyles} text-base font-medium truncate">{item.label}</span>
75
73
  </span>
74
+
75
+ {#if item.country}
76
+ <span class="flex space-x-1 items-center">
77
+ <BaseFlag country={item.country} width={10} />
78
+ <span class="text-sm text-neutral-500 tracking-normal"
79
+ >{getCountryName(item.country)}</span
80
+ >
81
+ </span>
82
+ {/if}
83
+ </div>
84
+ {#if multiple}
85
+ <InputCheckbox
86
+ bind:checked={item.selected}
87
+ on:change={() => {
88
+ dispatch('change', item)
89
+ }}
90
+ />
91
+ {:else if item.selected}
92
+ <Icon src={Tick} class="w-5 h-5 text-workspace-accent text-neutral-500" />
93
+ {:else if item.rightIcon}
94
+ <Icon src={item.rightIcon} class="w-5 h-5 text-neutral-800" />
76
95
  {/if}
77
96
  </div>
78
- {#if multiple}
79
- <InputCheckbox
80
- bind:checked={item.selected}
81
- on:change={() => {
82
- dispatch('change', item)
83
- }}
84
- />
85
- {:else if item.selected}
86
- <Icon src={Tick} class="w-5 h-5 text-workspace-accent text-neutral-500" />
87
- {:else if item.rightIcon}
88
- <Icon src={item.rightIcon} class="w-5 h-5 text-neutral-800" />
89
- {/if}
90
97
  </button>
@@ -0,0 +1 @@
1
+ <li class="bg-neutral-100 h-px w-full" />
@@ -0,0 +1,23 @@
1
+ /** @typedef {typeof __propDef.props} DrawerContextSeparatorProps */
2
+ /** @typedef {typeof __propDef.events} DrawerContextSeparatorEvents */
3
+ /** @typedef {typeof __propDef.slots} DrawerContextSeparatorSlots */
4
+ export default class DrawerContextSeparator extends SvelteComponent<{
5
+ [x: string]: never;
6
+ }, {
7
+ [evt: string]: CustomEvent<any>;
8
+ }, {}> {
9
+ }
10
+ export type DrawerContextSeparatorProps = typeof __propDef.props;
11
+ export type DrawerContextSeparatorEvents = typeof __propDef.events;
12
+ export type DrawerContextSeparatorSlots = typeof __propDef.slots;
13
+ import { SvelteComponent } from "svelte";
14
+ declare const __propDef: {
15
+ props: {
16
+ [x: string]: never;
17
+ };
18
+ events: {
19
+ [evt: string]: CustomEvent<any>;
20
+ };
21
+ slots: {};
22
+ };
23
+ export {};
@@ -7,9 +7,15 @@ $:
7
7
  icon = getIcon(type);
8
8
  $:
9
9
  styles = clsx(
10
- { "text-positive-500 bg-positive-50": type === "success" },
11
- { "text-danger-500 bg-danger-50": type === "error" },
12
- { "text-yellow-500 bg-yellow-50": type === "warning" }
10
+ { "bg-positive-50": type === "success" },
11
+ { "bg-danger-50": type === "error" },
12
+ { "bg-yellow-50": type === "warning" }
13
+ );
14
+ $:
15
+ textStyles = clsx(
16
+ { "text-positive-500": type === "success" },
17
+ { "text-danger-500": type === "error" },
18
+ { "text-yellow-500": type === "warning" }
13
19
  );
14
20
  function getIcon(type2) {
15
21
  switch (type2) {
@@ -29,6 +35,6 @@ function getIcon(type2) {
29
35
  {#if icon}
30
36
  <Icon src={icon} class="h-4 w-4" />
31
37
  {/if}
32
- <span class="flex-1">{message}</span>
38
+ <span class="{textStyles} flex-1">{message}</span>
33
39
  <slot />
34
40
  </div>
package/dist/index.d.ts CHANGED
@@ -19,6 +19,7 @@ import DataListItem from './DataListItem.svelte';
19
19
  import DatePicker from './DatePicker.svelte';
20
20
  import DrawerContext from './DrawerContext.svelte';
21
21
  import DrawerContextItem from './DrawerContextItem.svelte';
22
+ import DrawerContextSeparator from './DrawerContextSeparator.svelte';
22
23
  import DropdownSelect from './DropdownSelect.svelte';
23
24
  import EmptyStateIcon from './EmptyStateIcon.svelte';
24
25
  import EmptyStateIllustration from './EmptyStateIllustration.svelte';
@@ -73,4 +74,4 @@ import twTheme from './tw.theme.js';
73
74
  import { resolveIcon } from './helpers.js';
74
75
  import { getCountryName } from './helpers.js';
75
76
  import { getStatusType } from './helpers.js';
76
- export { AlertDialog, BaseButton, BaseCard, BaseCounter, BaseDropdown, BaseFlag, BaseTable, BaseTableActions, BaseTableHeaderContent, Breadcrumbs, ButtonFile, ButtonUuidCopy, CardCheckbox, CardRelation, ComboBox, CompanySelector, CounterWorkflow, DataListItem, DatePicker, DrawerContext, DrawerContextItem, DropdownSelect, EmptyStateIcon, EmptyStateIllustration, FeedEvents, FeedIconEvent, FeedIconStatus, FeedItem, FeedItemDetail, FeedViewer, GlobalSearch, InputCheckbox, InputError, InputLabel, InputRadio, InputSearch, InputSelect, InputText, InputTextarea, InputToggle, MenuItem, MenuItemCollapsible, Notification, ProfileAvatar, ProfileSelector, SectionLayout, SeparatorHorizontal, ShortcutWrapper, StatusLabel, StepIconList, Table, TableBody, TableCaption, TableFooter, TableHeader, TableRow, TableHead, TableCell, Tabs, TabsContent, TabsList, TabsTrigger, TagBeta, TagSearch, TagStatus, TitleMain, TitleSection, Tooltip, TooltipContent, TooltipTrigger, UuidCopy, twTheme, resolveIcon, getCountryName, getStatusType };
77
+ export { AlertDialog, BaseButton, BaseCard, BaseCounter, BaseDropdown, BaseFlag, BaseTable, BaseTableActions, BaseTableHeaderContent, Breadcrumbs, ButtonFile, ButtonUuidCopy, CardCheckbox, CardRelation, ComboBox, CompanySelector, CounterWorkflow, DataListItem, DatePicker, DrawerContext, DrawerContextItem, DrawerContextSeparator, DropdownSelect, EmptyStateIcon, EmptyStateIllustration, FeedEvents, FeedIconEvent, FeedIconStatus, FeedItem, FeedItemDetail, FeedViewer, GlobalSearch, InputCheckbox, InputError, InputLabel, InputRadio, InputSearch, InputSelect, InputText, InputTextarea, InputToggle, MenuItem, MenuItemCollapsible, Notification, ProfileAvatar, ProfileSelector, SectionLayout, SeparatorHorizontal, ShortcutWrapper, StatusLabel, StepIconList, Table, TableBody, TableCaption, TableFooter, TableHeader, TableRow, TableHead, TableCell, Tabs, TabsContent, TabsList, TabsTrigger, TagBeta, TagSearch, TagStatus, TitleMain, TitleSection, Tooltip, TooltipContent, TooltipTrigger, UuidCopy, twTheme, resolveIcon, getCountryName, getStatusType };
package/dist/index.js CHANGED
@@ -19,6 +19,7 @@ import DataListItem from './DataListItem.svelte'
19
19
  import DatePicker from './DatePicker.svelte'
20
20
  import DrawerContext from './DrawerContext.svelte'
21
21
  import DrawerContextItem from './DrawerContextItem.svelte'
22
+ import DrawerContextSeparator from './DrawerContextSeparator.svelte'
22
23
  import DropdownSelect from './DropdownSelect.svelte'
23
24
  import EmptyStateIcon from './EmptyStateIcon.svelte'
24
25
  import EmptyStateIllustration from './EmptyStateIllustration.svelte'
@@ -92,6 +93,7 @@ export {
92
93
  DatePicker,
93
94
  DrawerContext,
94
95
  DrawerContextItem,
96
+ DrawerContextSeparator,
95
97
  DropdownSelect,
96
98
  EmptyStateIcon,
97
99
  EmptyStateIllustration,
package/dist/types.d.ts CHANGED
@@ -16,7 +16,7 @@ export type SelectOption = {
16
16
  value: AnyProp;
17
17
  };
18
18
  export type DrawerOption = SelectOption & {
19
- footer?: boolean;
19
+ separator?: boolean;
20
20
  destructive?: boolean;
21
21
  selected?: boolean;
22
22
  icon?: IconSource | undefined;
@@ -26,6 +26,7 @@ export type DrawerOption = SelectOption & {
26
26
  picture?: string;
27
27
  sandbox?: boolean;
28
28
  iconClass?: string;
29
+ disabled?: boolean;
29
30
  };
30
31
  export type Company = {
31
32
  id: string;
@@ -84,9 +85,9 @@ export type TableDataRow = {
84
85
  };
85
86
  export type TableAction = {
86
87
  icon?: IconSource;
87
- label: string;
88
- slug: string;
89
- footer?: boolean;
88
+ label?: string;
89
+ slug?: string;
90
+ separator?: boolean;
90
91
  destructive?: boolean;
91
92
  value?: AnyProp;
92
93
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@invopop/popui",
3
3
  "license": "MIT",
4
- "version": "0.0.92",
4
+ "version": "0.0.94",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
7
7
  "build": "vite build && npm run package",