@invopop/popui 0.0.93 → 0.0.95

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.
@@ -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,24 +1,26 @@
1
1
  <script>import clsx from "clsx";
2
2
  import { Icon } from "@steeze-ui/svelte-icon";
3
3
  import InputRadio from "./InputRadio.svelte";
4
- export let id;
4
+ export let id = Math.random().toString(36).slice(2, 7);
5
+ export let name = "";
5
6
  export let title = "";
6
7
  export let description = "";
7
8
  export let accentText = "";
8
9
  export let checked = false;
10
+ export let icon = void 0;
11
+ export let hideRadio = false;
9
12
  $:
10
13
  styles = clsx(
11
14
  { "border-workspace-accent shadow-active": checked },
12
15
  { "border-neutral-200 hover:border-neutral-300": !checked }
13
16
  );
14
- export let icon = void 0;
15
17
  </script>
16
18
 
17
19
  <label for={id} class="{styles} border rounded-lg w-full text-left cursor-pointer block">
18
20
  <div class="py-2 pr-2 pl-3 flex items-start justify-between">
19
21
  <div class="flex space-x-2">
20
22
  {#if icon}
21
- <Icon src={icon} class="h-5 w-5 mt-0.5 text-neutral-800 flex-shrink-0" />
23
+ <Icon src={icon} class="h-5 w-5 mt-0.5 text-neutral-500 flex-shrink-0" />
22
24
  {/if}
23
25
  <div class="flex flex-col space-y-0.5">
24
26
  <span class="text-base text-neutral-800 font-medium">{title}</span>
@@ -31,13 +33,13 @@ export let icon = void 0;
31
33
  {description}
32
34
  </p>
33
35
  </span>
34
- {:else}
35
- <span class="text-sm text-neutral-300">No description</span>
36
36
  {/if}
37
37
  </div>
38
38
  </div>
39
39
 
40
- <InputRadio {id} {checked} on:change />
40
+ <div class:hidden={hideRadio}>
41
+ <InputRadio {id} {name} {checked} on:change />
42
+ </div>
41
43
  </div>
42
44
  {#if !!$$slots.footer}
43
45
  <div class="bg-neutral-50 rounded-b-lg px-3 py-2.5 border-t border-neutral-100">
@@ -2,12 +2,14 @@ import { SvelteComponent } from "svelte";
2
2
  import { type IconSource } from '@steeze-ui/svelte-icon';
3
3
  declare const __propDef: {
4
4
  props: {
5
- id: any;
5
+ id?: string | undefined;
6
+ name?: string | undefined;
6
7
  title?: string | undefined;
7
8
  description?: string | undefined;
8
9
  accentText?: string | undefined;
9
10
  checked?: boolean | undefined;
10
11
  icon?: IconSource | undefined;
12
+ hideRadio?: boolean | undefined;
11
13
  };
12
14
  events: {
13
15
  change: CustomEvent<any>;
@@ -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 {};
@@ -1,7 +1,8 @@
1
1
  <script>import { createEventDispatcher } from "svelte";
2
2
  import { dispatchWcEvent } from "./wcdispatch.js";
3
3
  export let checked = false;
4
- export let id = "";
4
+ export let id = Math.random().toString(36).slice(2, 7);
5
+ export let name = "";
5
6
  let el;
6
7
  const dispatch = createEventDispatcher();
7
8
  $:
@@ -21,6 +22,7 @@ function updateInput(event) {
21
22
  bind:this={el}
22
23
  type="radio"
23
24
  {id}
25
+ {name}
24
26
  {checked}
25
27
  class="form-radio h-5 w-5 border-neutral-200 text-workspace-accent focus:ring-0 focus:ring-offset-0 cursor-pointer"
26
28
  {...$$restProps}
@@ -4,6 +4,7 @@ declare const __propDef: {
4
4
  [x: string]: any;
5
5
  checked?: boolean | undefined;
6
6
  id?: string | undefined;
7
+ name?: string | undefined;
7
8
  };
8
9
  events: {
9
10
  change: CustomEvent<any>;
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.93",
4
+ "version": "0.0.95",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
7
7
  "build": "vite build && npm run package",