@invopop/popui 0.0.104 → 0.1.1
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.
- package/dist/AlertDialog.svelte +84 -59
- package/dist/AlertDialog.svelte.d.ts +5 -29
- package/dist/BaseButton.svelte +106 -101
- package/dist/BaseButton.svelte.d.ts +4 -34
- package/dist/BaseCard.svelte +20 -12
- package/dist/BaseCard.svelte.d.ts +4 -26
- package/dist/BaseCounter.svelte +13 -9
- package/dist/BaseCounter.svelte.d.ts +4 -17
- package/dist/BaseDropdown.svelte +54 -38
- package/dist/BaseDropdown.svelte.d.ts +6 -26
- package/dist/BaseFlag.svelte +6 -4
- package/dist/BaseFlag.svelte.d.ts +4 -17
- package/dist/BaseTable.svelte +226 -188
- package/dist/BaseTable.svelte.d.ts +4 -39
- package/dist/BaseTableActions.svelte +43 -33
- package/dist/BaseTableActions.svelte.d.ts +6 -21
- package/dist/BaseTableCellContent.svelte +19 -13
- package/dist/BaseTableCellContent.svelte.d.ts +4 -24
- package/dist/BaseTableCheckbox.svelte +19 -12
- package/dist/BaseTableCheckbox.svelte.d.ts +4 -21
- package/dist/BaseTableHeaderContent.svelte +30 -22
- package/dist/BaseTableHeaderContent.svelte.d.ts +4 -21
- package/dist/BaseTableHeaderOrderBy.svelte +24 -0
- package/dist/BaseTableHeaderOrderBy.svelte.d.ts +4 -0
- package/dist/BaseTableRow.svelte +78 -60
- package/dist/BaseTableRow.svelte.d.ts +4 -32
- package/dist/Breadcrumbs.svelte +14 -10
- package/dist/Breadcrumbs.svelte.d.ts +4 -19
- package/dist/ButtonFile.svelte +40 -29
- package/dist/ButtonFile.svelte.d.ts +4 -26
- package/dist/ButtonUuidCopy.svelte +27 -20
- package/dist/ButtonUuidCopy.svelte.d.ts +4 -22
- package/dist/CardCheckbox.svelte +28 -19
- package/dist/CardCheckbox.svelte.d.ts +4 -28
- package/dist/CardRelation.svelte +9 -8
- package/dist/CardRelation.svelte.d.ts +4 -22
- package/dist/CompanySelector.svelte +49 -43
- package/dist/CompanySelector.svelte.d.ts +4 -22
- package/dist/CounterWorkflow.svelte +12 -8
- package/dist/CounterWorkflow.svelte.d.ts +4 -17
- package/dist/DataListItem.svelte +24 -14
- package/dist/DataListItem.svelte.d.ts +4 -22
- package/dist/DatePicker.svelte +186 -386
- package/dist/DatePicker.svelte.d.ts +4 -22
- package/dist/DrawerContext.svelte +33 -22
- package/dist/DrawerContext.svelte.d.ts +4 -24
- package/dist/DrawerContextItem.svelte +70 -57
- package/dist/DrawerContextItem.svelte.d.ts +4 -23
- package/dist/DrawerContextSeparator.svelte +1 -1
- package/dist/DrawerContextSeparator.svelte.d.ts +22 -19
- package/dist/DrawerContextWorkspace.svelte +31 -32
- package/dist/DrawerContextWorkspace.svelte.d.ts +4 -20
- package/dist/DropdownSelect.svelte +93 -81
- package/dist/DropdownSelect.svelte.d.ts +4 -27
- package/dist/EmptyStateIcon.svelte +13 -7
- package/dist/EmptyStateIcon.svelte.d.ts +4 -22
- package/dist/EmptyStateIllustration.svelte +41 -33
- package/dist/EmptyStateIllustration.svelte.d.ts +4 -21
- package/dist/FeedEvents.svelte +5 -2
- package/dist/FeedEvents.svelte.d.ts +4 -17
- package/dist/FeedIconEvent.svelte +5 -3
- package/dist/FeedIconEvent.svelte.d.ts +4 -19
- package/dist/FeedIconStatus.svelte +23 -18
- package/dist/FeedIconStatus.svelte.d.ts +4 -17
- package/dist/FeedItem.svelte +33 -28
- package/dist/FeedItem.svelte.d.ts +4 -30
- package/dist/FeedItemDetail.svelte +21 -13
- package/dist/FeedItemDetail.svelte.d.ts +4 -23
- package/dist/FeedViewer.svelte +6 -13
- package/dist/FeedViewer.svelte.d.ts +4 -21
- package/dist/FormLayoutModal.svelte +9 -3
- package/dist/FormLayoutModal.svelte.d.ts +4 -29
- package/dist/GlobalSearch.svelte +38 -31
- package/dist/GlobalSearch.svelte.d.ts +4 -18
- package/dist/InputCheckbox.svelte +23 -14
- package/dist/InputCheckbox.svelte.d.ts +4 -23
- package/dist/InputError.svelte +4 -1
- package/dist/InputError.svelte.d.ts +4 -16
- package/dist/InputLabel.svelte +5 -3
- package/dist/InputLabel.svelte.d.ts +4 -18
- package/dist/InputRadio.svelte +25 -19
- package/dist/InputRadio.svelte.d.ts +4 -21
- package/dist/InputSearch.svelte +66 -46
- package/dist/InputSearch.svelte.d.ts +9 -33
- package/dist/InputSelect.svelte +36 -33
- package/dist/InputSelect.svelte.d.ts +4 -31
- package/dist/InputText.svelte +64 -48
- package/dist/InputText.svelte.d.ts +4 -28
- package/dist/InputTextarea.svelte +38 -29
- package/dist/InputTextarea.svelte.d.ts +4 -25
- package/dist/InputToggle.svelte +29 -22
- package/dist/InputToggle.svelte.d.ts +4 -20
- package/dist/MenuItem.svelte +99 -87
- package/dist/MenuItem.svelte.d.ts +5 -29
- package/dist/MenuItemCollapsible.svelte +26 -18
- package/dist/MenuItemCollapsible.svelte.d.ts +4 -24
- package/dist/Notification.svelte +35 -31
- package/dist/Notification.svelte.d.ts +4 -20
- package/dist/ProfileAvatar.svelte +26 -19
- package/dist/ProfileAvatar.svelte.d.ts +4 -21
- package/dist/ProfileSelector.svelte +25 -17
- package/dist/ProfileSelector.svelte.d.ts +4 -22
- package/dist/SectionLayout.svelte +6 -3
- package/dist/SectionLayout.svelte.d.ts +4 -18
- package/dist/SeparatorHorizontal.svelte +1 -1
- package/dist/SeparatorHorizontal.svelte.d.ts +22 -19
- package/dist/ShortcutWrapper.svelte +7 -1
- package/dist/ShortcutWrapper.svelte.d.ts +4 -27
- package/dist/StatusLabel.svelte +16 -12
- package/dist/StatusLabel.svelte.d.ts +4 -18
- package/dist/StepIconList.svelte +44 -41
- package/dist/StepIconList.svelte.d.ts +4 -17
- package/dist/TagBeta.svelte.d.ts +22 -19
- package/dist/TagSearch.svelte +19 -20
- package/dist/TagSearch.svelte.d.ts +4 -22
- package/dist/TagStatus.svelte +42 -37
- package/dist/TagStatus.svelte.d.ts +4 -19
- package/dist/TitleMain.svelte +9 -2
- package/dist/TitleMain.svelte.d.ts +4 -18
- package/dist/TitleSection.svelte +9 -2
- package/dist/TitleSection.svelte.d.ts +4 -18
- package/dist/UuidCopy.svelte +61 -48
- package/dist/UuidCopy.svelte.d.ts +4 -26
- package/dist/alert-dialog/alert-dialog-action.svelte +15 -15
- package/dist/alert-dialog/alert-dialog-action.svelte.d.ts +5 -26
- package/dist/alert-dialog/alert-dialog-cancel.svelte +13 -10
- package/dist/alert-dialog/alert-dialog-cancel.svelte.d.ts +3 -22
- package/dist/alert-dialog/alert-dialog-content.svelte +19 -15
- package/dist/alert-dialog/alert-dialog-content.svelte.d.ts +6 -15
- package/dist/alert-dialog/alert-dialog-description.svelte +11 -6
- package/dist/alert-dialog/alert-dialog-description.svelte.d.ts +3 -16
- package/dist/alert-dialog/alert-dialog-footer.svelte +11 -5
- package/dist/alert-dialog/alert-dialog-footer.svelte.d.ts +4 -16
- package/dist/alert-dialog/alert-dialog-header.svelte +14 -5
- package/dist/alert-dialog/alert-dialog-header.svelte.d.ts +4 -16
- package/dist/alert-dialog/alert-dialog-overlay.svelte +10 -13
- package/dist/alert-dialog/alert-dialog-overlay.svelte.d.ts +3 -14
- package/dist/alert-dialog/alert-dialog-title.svelte +11 -8
- package/dist/alert-dialog/alert-dialog-title.svelte.d.ts +3 -16
- package/dist/alert-dialog/alert-dialog-trigger.svelte +6 -0
- package/dist/alert-dialog/alert-dialog-trigger.svelte.d.ts +4 -0
- package/dist/alert-dialog/index.d.ts +3 -4
- package/dist/alert-dialog/index.js +2 -2
- package/dist/button/button.svelte +76 -18
- package/dist/button/button.svelte.d.ts +62 -14
- package/dist/button/index.d.ts +2 -60
- package/dist/button/index.js +1 -26
- package/dist/helpers.d.ts +4 -1
- package/dist/helpers.js +35 -0
- package/dist/index.d.ts +1 -3
- package/dist/index.js +0 -4
- package/dist/range-calendar/index.d.ts +20 -0
- package/dist/range-calendar/index.js +22 -0
- package/dist/range-calendar/range-calendar-caption.svelte +71 -0
- package/dist/range-calendar/range-calendar-caption.svelte.d.ts +19 -0
- package/dist/range-calendar/range-calendar-cell.svelte +18 -0
- package/dist/range-calendar/range-calendar-cell.svelte.d.ts +4 -0
- package/dist/range-calendar/range-calendar-day.svelte +41 -0
- package/dist/range-calendar/range-calendar-day.svelte.d.ts +4 -0
- package/dist/range-calendar/range-calendar-grid-row.svelte +11 -0
- package/dist/range-calendar/range-calendar-grid-row.svelte.d.ts +4 -0
- package/dist/range-calendar/range-calendar-grid.svelte +15 -0
- package/dist/range-calendar/range-calendar-grid.svelte.d.ts +4 -0
- package/dist/range-calendar/range-calendar-head-cell.svelte +18 -0
- package/dist/range-calendar/range-calendar-head-cell.svelte.d.ts +4 -0
- package/dist/range-calendar/range-calendar-header.svelte +18 -0
- package/dist/range-calendar/range-calendar-header.svelte.d.ts +4 -0
- package/dist/range-calendar/range-calendar-heading.svelte +15 -0
- package/dist/range-calendar/range-calendar-heading.svelte.d.ts +4 -0
- package/dist/range-calendar/range-calendar-month-select.svelte +44 -0
- package/dist/range-calendar/range-calendar-month-select.svelte.d.ts +4 -0
- package/dist/range-calendar/range-calendar-month.svelte +14 -0
- package/dist/range-calendar/range-calendar-month.svelte.d.ts +5 -0
- package/dist/range-calendar/range-calendar-months.svelte +18 -0
- package/dist/range-calendar/range-calendar-months.svelte.d.ts +5 -0
- package/dist/range-calendar/range-calendar-nav.svelte +18 -0
- package/dist/range-calendar/range-calendar-nav.svelte.d.ts +5 -0
- package/dist/range-calendar/range-calendar-next-button.svelte +30 -0
- package/dist/range-calendar/range-calendar-next-button.svelte.d.ts +8 -0
- package/dist/range-calendar/range-calendar-prev-button.svelte +30 -0
- package/dist/range-calendar/range-calendar-prev-button.svelte.d.ts +8 -0
- package/dist/range-calendar/range-calendar-year-select.svelte +43 -0
- package/dist/range-calendar/range-calendar-year-select.svelte.d.ts +4 -0
- package/dist/range-calendar/range-calendar.svelte +109 -0
- package/dist/range-calendar/range-calendar.svelte.d.ts +21 -0
- package/dist/svg/BgPattern.svelte.d.ts +22 -19
- package/dist/svg/IconContact.svelte +6 -1
- package/dist/svg/IconContact.svelte.d.ts +5 -15
- package/dist/svg/IconEmpty.svelte.d.ts +22 -19
- package/dist/svg/IconFile.svelte +6 -1
- package/dist/svg/IconFile.svelte.d.ts +5 -15
- package/dist/svg/IconInvoice.svelte +6 -1
- package/dist/svg/IconInvoice.svelte.d.ts +5 -15
- package/dist/svg/IconNoResults.svelte +6 -1
- package/dist/svg/IconNoResults.svelte.d.ts +5 -15
- package/dist/svg/IconPdf.svelte +6 -1
- package/dist/svg/IconPdf.svelte.d.ts +5 -15
- package/dist/svg/IconProduct.svelte +6 -1
- package/dist/svg/IconProduct.svelte.d.ts +5 -15
- package/dist/table/table-body.svelte +10 -5
- package/dist/table/table-body.svelte.d.ts +4 -16
- package/dist/table/table-caption.svelte +14 -5
- package/dist/table/table-caption.svelte.d.ts +4 -16
- package/dist/table/table-cell.svelte +16 -7
- package/dist/table/table-cell.svelte.d.ts +4 -19
- package/dist/table/table-footer.svelte +14 -5
- package/dist/table/table-footer.svelte.d.ts +4 -16
- package/dist/table/table-head.svelte +11 -5
- package/dist/table/table-head.svelte.d.ts +4 -16
- package/dist/table/table-header.svelte +17 -8
- package/dist/table/table-header.svelte.d.ts +4 -19
- package/dist/table/table-row.svelte +22 -8
- package/dist/table/table-row.svelte.d.ts +4 -22
- package/dist/table/table.svelte +11 -6
- package/dist/table/table.svelte.d.ts +4 -16
- package/dist/tabs/tabs-content.svelte +13 -8
- package/dist/tabs/tabs-content.svelte.d.ts +3 -16
- package/dist/tabs/tabs-list.svelte +7 -6
- package/dist/tabs/tabs-list.svelte.d.ts +3 -16
- package/dist/tabs/tabs-trigger.svelte +13 -9
- package/dist/tabs/tabs-trigger.svelte.d.ts +3 -14
- package/dist/tabs/tabs.svelte +12 -7
- package/dist/tabs/tabs.svelte.d.ts +3 -16
- package/dist/tooltip/index.d.ts +5 -3
- package/dist/tooltip/index.js +5 -3
- package/dist/tooltip/tooltip-content.svelte +42 -23
- package/dist/tooltip/tooltip-content.svelte.d.ts +5 -15
- package/dist/tooltip/tooltip-trigger.svelte +8 -0
- package/dist/tooltip/tooltip-trigger.svelte.d.ts +4 -0
- package/dist/tw.theme.d.ts +2 -9
- package/dist/tw.theme.js +0 -5
- package/dist/types.d.ts +484 -25
- package/dist/utils.d.ts +10 -1
- package/package.json +30 -39
- package/README.md +0 -234
- package/dist/BaseTableHeaderSortBy.svelte +0 -22
- package/dist/BaseTableHeaderSortBy.svelte.d.ts +0 -20
- package/dist/ComboBox.svelte +0 -12
- package/dist/ComboBox.svelte.d.ts +0 -21
- package/dist/ComboBoxContent.svelte +0 -33
- package/dist/ComboBoxContent.svelte.d.ts +0 -20
- package/dist/ProgressBar.svelte +0 -6
- package/dist/ProgressBar.svelte.d.ts +0 -16
- package/dist/alert-dialog/alert-dialog-portal.svelte +0 -6
- package/dist/alert-dialog/alert-dialog-portal.svelte.d.ts +0 -17
- package/dist/popui.css +0 -1
- package/dist/wcdispatch.d.ts +0 -1
- package/dist/wcdispatch.js +0 -9
|
@@ -1,34 +1,45 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { DrawerContextProps, DrawerOption } from './types.ts'
|
|
3
|
+
import DrawerContextItem from './DrawerContextItem.svelte'
|
|
4
|
+
import InputSearch from './InputSearch.svelte'
|
|
5
|
+
import DrawerContextSeparator from './DrawerContextSeparator.svelte'
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
items = $bindable([]),
|
|
9
|
+
multiple = false,
|
|
10
|
+
searchable = false,
|
|
11
|
+
widthClass = 'w-60',
|
|
12
|
+
onclick,
|
|
13
|
+
onselect
|
|
14
|
+
}: DrawerContextProps = $props()
|
|
15
|
+
|
|
16
|
+
let selectedItems = $derived(items.filter((i) => i.selected))
|
|
17
|
+
$effect(() => {
|
|
18
|
+
onselect?.(selectedItems)
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
function updateItem(item: DrawerOption) {
|
|
22
|
+
items = items.map((i) => {
|
|
23
|
+
if (i.value === item.value) return item
|
|
24
|
+
return i
|
|
25
|
+
})
|
|
26
|
+
}
|
|
20
27
|
</script>
|
|
21
28
|
|
|
22
29
|
<div
|
|
23
|
-
class="{widthClass} border border-neutral-200 py-1 rounded-
|
|
30
|
+
class="{widthClass} border border-neutral-200 py-1 rounded-md shadow-lg space-y-0.5 bg-white max-h-80 overflow-y-auto"
|
|
24
31
|
>
|
|
25
|
-
|
|
32
|
+
{#if searchable}
|
|
33
|
+
<div class="px-2 mt-2 mb-1">
|
|
34
|
+
<InputSearch placeholder="Search" />
|
|
35
|
+
</div>
|
|
36
|
+
{/if}
|
|
26
37
|
<ul class="space-y-0.5 max-h-80 overflow-y-auto">
|
|
27
38
|
{#each items as item}
|
|
28
39
|
{#if item.separator}
|
|
29
40
|
<DrawerContextSeparator />
|
|
30
41
|
{:else}
|
|
31
|
-
<DrawerContextItem {item} {multiple}
|
|
42
|
+
<DrawerContextItem {item} {multiple} {onclick} onchange={updateItem} />
|
|
32
43
|
{/if}
|
|
33
44
|
{/each}
|
|
34
45
|
</ul>
|
|
@@ -1,24 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
items?: DrawerOption[] | undefined;
|
|
6
|
-
multiple?: boolean | undefined;
|
|
7
|
-
widthClass?: string | undefined;
|
|
8
|
-
};
|
|
9
|
-
events: {
|
|
10
|
-
click: CustomEvent<any>;
|
|
11
|
-
selected: CustomEvent<any>;
|
|
12
|
-
} & {
|
|
13
|
-
[evt: string]: CustomEvent<any>;
|
|
14
|
-
};
|
|
15
|
-
slots: {
|
|
16
|
-
default: {};
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
export type DrawerContextProps = typeof __propDef.props;
|
|
20
|
-
export type DrawerContextEvents = typeof __propDef.events;
|
|
21
|
-
export type DrawerContextSlots = typeof __propDef.slots;
|
|
22
|
-
export default class DrawerContext extends SvelteComponent<DrawerContextProps, DrawerContextEvents, DrawerContextSlots> {
|
|
23
|
-
}
|
|
24
|
-
export {};
|
|
1
|
+
import type { DrawerContextProps } from './types.ts';
|
|
2
|
+
declare const DrawerContext: import("svelte").Component<DrawerContextProps, {}, "items">;
|
|
3
|
+
type DrawerContext = ReturnType<typeof DrawerContext>;
|
|
4
|
+
export default DrawerContext;
|
|
@@ -1,61 +1,74 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { DrawerContextItemProps } from './types.ts'
|
|
3
|
+
import InputCheckbox from './InputCheckbox.svelte'
|
|
4
|
+
import { Icon } from '@steeze-ui/svelte-icon'
|
|
5
|
+
import { onMount } from 'svelte'
|
|
6
|
+
import { Success, Tick } from '@invopop/ui-icons'
|
|
7
|
+
import ProfileAvatar from './ProfileAvatar.svelte'
|
|
8
|
+
import clsx from 'clsx'
|
|
9
|
+
import BaseFlag from './BaseFlag.svelte'
|
|
10
|
+
import { getCountryName } from './helpers.js'
|
|
11
|
+
import TagStatus from './TagStatus.svelte'
|
|
12
|
+
|
|
13
|
+
let {
|
|
14
|
+
multiple = false,
|
|
15
|
+
item = $bindable(),
|
|
16
|
+
scrollIfSelected = false,
|
|
17
|
+
workspace = false,
|
|
18
|
+
onchange,
|
|
19
|
+
onclick
|
|
20
|
+
}: DrawerContextItemProps = $props()
|
|
21
|
+
|
|
22
|
+
let el: HTMLElement | undefined = $state()
|
|
23
|
+
|
|
24
|
+
let hasIcon = $derived(item.icon || workspace)
|
|
25
|
+
|
|
26
|
+
let styles = $derived(
|
|
27
|
+
clsx(
|
|
28
|
+
{ 'py-1 space-x-3': workspace },
|
|
29
|
+
{ 'py-1.5 space-x-1.5': !workspace },
|
|
30
|
+
{ 'pl-1.5': !hasIcon },
|
|
31
|
+
{ 'pl-2': hasIcon },
|
|
32
|
+
{ 'bg-workspace-accent-100': item.selected && !multiple },
|
|
33
|
+
{ 'group-hover:bg-neutral-100': (!item.selected && !item.disabled) || multiple }
|
|
34
|
+
)
|
|
35
|
+
)
|
|
36
|
+
let labelStyles = $derived(
|
|
37
|
+
clsx(
|
|
38
|
+
{ 'text-danger-500': item.destructive },
|
|
39
|
+
{ 'text-neutral-800': !item.destructive },
|
|
40
|
+
{ 'tracking-tight max-w-[200px]': workspace },
|
|
41
|
+
{ 'tracking-normal': !workspace }
|
|
42
|
+
)
|
|
43
|
+
)
|
|
44
|
+
let title = $derived(item.label.length > 25 ? item.label : undefined)
|
|
45
|
+
|
|
46
|
+
onMount(() => {
|
|
47
|
+
if (!scrollIfSelected) return
|
|
48
|
+
|
|
49
|
+
if (item.selected) {
|
|
50
|
+
el?.scrollIntoView()
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
function handleClick(event: MouseEvent) {
|
|
55
|
+
event.stopPropagation()
|
|
56
|
+
if (multiple) {
|
|
57
|
+
item.selected = !item.selected
|
|
58
|
+
onchange?.(item)
|
|
59
|
+
} else {
|
|
60
|
+
onclick?.(item.value)
|
|
61
|
+
}
|
|
41
62
|
}
|
|
42
|
-
});
|
|
43
63
|
</script>
|
|
44
64
|
|
|
45
65
|
<button
|
|
46
66
|
bind:this={el}
|
|
47
67
|
class="w-full px-1 py-0.5 disabled:opacity-30 group"
|
|
48
68
|
disabled={item.disabled}
|
|
49
|
-
|
|
50
|
-
if (multiple) {
|
|
51
|
-
item.selected = !item.selected
|
|
52
|
-
dispatch('change', item)
|
|
53
|
-
} else {
|
|
54
|
-
dispatch('click', item.value)
|
|
55
|
-
}
|
|
56
|
-
}}
|
|
69
|
+
onclick={handleClick}
|
|
57
70
|
>
|
|
58
|
-
<div class="{styles} rounded pr-
|
|
71
|
+
<div class="{styles} rounded pr-2 flex items-center justify-start w-full">
|
|
59
72
|
{#if workspace}
|
|
60
73
|
<ProfileAvatar name={item.label} picture={item.picture} large />
|
|
61
74
|
{:else if item.icon}
|
|
@@ -77,23 +90,23 @@ onMount(() => {
|
|
|
77
90
|
{#if item.country}
|
|
78
91
|
<span class="flex space-x-1 items-center">
|
|
79
92
|
<BaseFlag country={item.country} width={10} />
|
|
80
|
-
<span class="text-sm text-neutral-500 tracking-normal"
|
|
81
|
-
{getCountryName(item.country)}
|
|
82
|
-
|
|
93
|
+
<span class="text-sm text-neutral-500 tracking-normal"
|
|
94
|
+
>{getCountryName(item.country)}</span
|
|
95
|
+
>
|
|
83
96
|
</span>
|
|
84
97
|
{/if}
|
|
85
98
|
</div>
|
|
86
99
|
{#if multiple}
|
|
87
100
|
<InputCheckbox
|
|
88
101
|
bind:checked={item.selected}
|
|
89
|
-
|
|
90
|
-
|
|
102
|
+
onchange={() => {
|
|
103
|
+
onchange?.(item)
|
|
91
104
|
}}
|
|
92
105
|
/>
|
|
93
106
|
{:else if item.selected}
|
|
94
|
-
<Icon src={
|
|
107
|
+
<Icon src={Success} class="w-4 h-4 text-workspace-accent" />
|
|
95
108
|
{:else if item.rightIcon}
|
|
96
|
-
<Icon src={item.rightIcon} class="w-
|
|
109
|
+
<Icon src={item.rightIcon} class="w-4 h-4 text-neutral-400" />
|
|
97
110
|
{/if}
|
|
98
111
|
</div>
|
|
99
112
|
</button>
|
|
@@ -1,23 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
multiple?: boolean | undefined;
|
|
6
|
-
item: DrawerOption;
|
|
7
|
-
scrollIfSelected?: boolean | undefined;
|
|
8
|
-
workspace?: boolean | undefined;
|
|
9
|
-
};
|
|
10
|
-
events: {
|
|
11
|
-
change: CustomEvent<any>;
|
|
12
|
-
click: CustomEvent<any>;
|
|
13
|
-
} & {
|
|
14
|
-
[evt: string]: CustomEvent<any>;
|
|
15
|
-
};
|
|
16
|
-
slots: {};
|
|
17
|
-
};
|
|
18
|
-
export type DrawerContextItemProps = typeof __propDef.props;
|
|
19
|
-
export type DrawerContextItemEvents = typeof __propDef.events;
|
|
20
|
-
export type DrawerContextItemSlots = typeof __propDef.slots;
|
|
21
|
-
export default class DrawerContextItem extends SvelteComponent<DrawerContextItemProps, DrawerContextItemEvents, DrawerContextItemSlots> {
|
|
22
|
-
}
|
|
23
|
-
export {};
|
|
1
|
+
import type { DrawerContextItemProps } from './types.ts';
|
|
2
|
+
declare const DrawerContextItem: import("svelte").Component<DrawerContextItemProps, {}, "item">;
|
|
3
|
+
type DrawerContextItem = ReturnType<typeof DrawerContextItem>;
|
|
4
|
+
export default DrawerContextItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<li class="bg-neutral-100 h-px w-full"
|
|
1
|
+
<li class="bg-neutral-100 h-px w-full"></li>
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/** @typedef {typeof __propDef.slots} DrawerContextSeparatorSlots */
|
|
4
|
-
export default class DrawerContextSeparator extends SvelteComponent<{
|
|
1
|
+
export default DrawerContextSeparator;
|
|
2
|
+
type DrawerContextSeparator = SvelteComponent<{
|
|
5
3
|
[x: string]: never;
|
|
6
4
|
}, {
|
|
7
5
|
[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: {};
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
22
8
|
};
|
|
23
|
-
|
|
9
|
+
declare const DrawerContextSeparator: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
@@ -1,37 +1,36 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
let liveOpen = false
|
|
13
|
-
let sandboxOpen = false
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
liveOpen = true;
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { DrawerContextWorkspaceProps } from './types.ts'
|
|
3
|
+
import DrawerContextItem from './DrawerContextItem.svelte'
|
|
4
|
+
import { Icon } from '@steeze-ui/svelte-icon'
|
|
5
|
+
import { AddCircle, ExternalLink, Workspace } from '@invopop/ui-icons'
|
|
6
|
+
import BaseCounter from './BaseCounter.svelte'
|
|
7
|
+
import EmptyStateIcon from './EmptyStateIcon.svelte'
|
|
8
|
+
import { slide } from 'svelte/transition'
|
|
9
|
+
import { ChevronRight } from '@steeze-ui/heroicons'
|
|
10
|
+
|
|
11
|
+
let { items = [], multiple = false, onclick }: DrawerContextWorkspaceProps = $props()
|
|
12
|
+
let liveOpen = $state(false)
|
|
13
|
+
let sandboxOpen = $state(false)
|
|
14
|
+
let liveItems = $derived(items.filter((i) => !i.sandbox))
|
|
15
|
+
let sandboxItems = $derived(items.filter((i) => i.sandbox))
|
|
16
|
+
let selectedItem = $derived(items.find((i) => i.selected))
|
|
17
|
+
|
|
18
|
+
$effect(() => {
|
|
19
|
+
if (selectedItem) {
|
|
20
|
+
if (selectedItem.sandbox) {
|
|
21
|
+
sandboxOpen = true
|
|
22
|
+
} else {
|
|
23
|
+
liveOpen = true
|
|
24
|
+
}
|
|
26
25
|
}
|
|
27
|
-
}
|
|
26
|
+
})
|
|
28
27
|
</script>
|
|
29
28
|
|
|
30
29
|
<div class="w-[300px] border border-neutral-200 rounded-md shadow-lg bg-white">
|
|
31
30
|
<div class="max-h-[550px] overflow-hidden rounded-t-md">
|
|
32
31
|
<button
|
|
33
32
|
class="flex items-center justify-between bg-neutral-50 border-b border-neutral-200 rounded-t-sm h-9 py-2 pl-2.5 pr-3 text-base font-medium text-neutral-800 w-full"
|
|
34
|
-
|
|
33
|
+
onclick={() => {
|
|
35
34
|
if (liveOpen) return
|
|
36
35
|
liveOpen = true
|
|
37
36
|
sandboxOpen = false
|
|
@@ -61,7 +60,7 @@ $:
|
|
|
61
60
|
{/if}
|
|
62
61
|
<ul class="p-1 space-y-1">
|
|
63
62
|
{#each liveItems as item}
|
|
64
|
-
<DrawerContextItem {item} {multiple} workspace
|
|
63
|
+
<DrawerContextItem {item} {multiple} workspace {onclick} />
|
|
65
64
|
{/each}
|
|
66
65
|
</ul>
|
|
67
66
|
</div>
|
|
@@ -69,7 +68,7 @@ $:
|
|
|
69
68
|
<button
|
|
70
69
|
class="flex items-center justify-between bg-neutral-50 border-b border-neutral-200 h-9 py-2 pl-2.5 pr-3 text-base font-medium text-neutral-800 w-full"
|
|
71
70
|
class:border-t={liveOpen}
|
|
72
|
-
|
|
71
|
+
onclick={() => {
|
|
73
72
|
if (sandboxOpen) return
|
|
74
73
|
sandboxOpen = true
|
|
75
74
|
liveOpen = false
|
|
@@ -99,7 +98,7 @@ $:
|
|
|
99
98
|
{/if}
|
|
100
99
|
<ul class="p-1 space-y-1">
|
|
101
100
|
{#each sandboxItems as item}
|
|
102
|
-
<DrawerContextItem {item} {multiple} workspace
|
|
101
|
+
<DrawerContextItem {item} {multiple} workspace {onclick} />
|
|
103
102
|
{/each}
|
|
104
103
|
</ul>
|
|
105
104
|
</div>
|
|
@@ -110,8 +109,8 @@ $:
|
|
|
110
109
|
<li class="pl-1.5 py-1.5 pr-2 hover:bg-neutral-100 rounded-sm">
|
|
111
110
|
<button
|
|
112
111
|
class="flex items-center justify-between w-full"
|
|
113
|
-
|
|
114
|
-
|
|
112
|
+
onclick={() => {
|
|
113
|
+
onclick?.('add')
|
|
115
114
|
}}
|
|
116
115
|
>
|
|
117
116
|
<div class="flex items-center space-x-1.5">
|
|
@@ -1,20 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
items?: DrawerOption[] | undefined;
|
|
6
|
-
multiple?: boolean | undefined;
|
|
7
|
-
};
|
|
8
|
-
events: {
|
|
9
|
-
click: CustomEvent<any>;
|
|
10
|
-
} & {
|
|
11
|
-
[evt: string]: CustomEvent<any>;
|
|
12
|
-
};
|
|
13
|
-
slots: {};
|
|
14
|
-
};
|
|
15
|
-
export type DrawerContextWorkspaceProps = typeof __propDef.props;
|
|
16
|
-
export type DrawerContextWorkspaceEvents = typeof __propDef.events;
|
|
17
|
-
export type DrawerContextWorkspaceSlots = typeof __propDef.slots;
|
|
18
|
-
export default class DrawerContextWorkspace extends SvelteComponent<DrawerContextWorkspaceProps, DrawerContextWorkspaceEvents, DrawerContextWorkspaceSlots> {
|
|
19
|
-
}
|
|
20
|
-
export {};
|
|
1
|
+
import type { DrawerContextWorkspaceProps } from './types.ts';
|
|
2
|
+
declare const DrawerContextWorkspace: import("svelte").Component<DrawerContextWorkspaceProps, {}, "">;
|
|
3
|
+
type DrawerContextWorkspace = ReturnType<typeof DrawerContextWorkspace>;
|
|
4
|
+
export default DrawerContextWorkspace;
|
|
@@ -1,87 +1,99 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import BaseDropdown from
|
|
6
|
-
import DrawerContext from
|
|
7
|
-
import clsx from
|
|
8
|
-
import TagStatus from
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import isEqual from 'lodash-es/isEqual'
|
|
3
|
+
import type { AnyProp, DrawerOption, DropdownSelectProps } from './types.ts'
|
|
4
|
+
import { Icon, type IconSource } from '@steeze-ui/svelte-icon'
|
|
5
|
+
import BaseDropdown from './BaseDropdown.svelte'
|
|
6
|
+
import DrawerContext from './DrawerContext.svelte'
|
|
7
|
+
import clsx from 'clsx'
|
|
8
|
+
import TagStatus from './TagStatus.svelte'
|
|
9
|
+
import { resolveIcon } from './helpers.js'
|
|
10
|
+
|
|
11
|
+
let {
|
|
12
|
+
value = $bindable(''),
|
|
13
|
+
icon = undefined,
|
|
14
|
+
iconTheme = 'default',
|
|
15
|
+
options = [],
|
|
16
|
+
placeholder = '',
|
|
17
|
+
multiple = false,
|
|
18
|
+
fullWidth = false,
|
|
19
|
+
widthClass = 'min-w-[160px] max-w-[420px]',
|
|
20
|
+
onSelect
|
|
21
|
+
}: DropdownSelectProps = $props()
|
|
22
|
+
|
|
23
|
+
let selectDropdown: BaseDropdown | undefined = $state()
|
|
24
|
+
let resolvedIcon: IconSource | undefined = $state()
|
|
25
|
+
let isOpen = $state(false)
|
|
26
|
+
|
|
27
|
+
$effect(() => {
|
|
28
|
+
resolveIcon(icon).then((res) => (resolvedIcon = res))
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
let items = $derived(
|
|
32
|
+
options.map((o) => ({
|
|
33
|
+
...o,
|
|
34
|
+
selected: multiple
|
|
35
|
+
? Boolean((value as DrawerOption[]).find((v) => v.value === o.value))
|
|
36
|
+
: o.value === value
|
|
37
|
+
}))
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
let selectedItems = $derived(items.filter((i) => i.selected))
|
|
41
|
+
let selectedColor = $derived(!multiple && items.find((i) => i.selected)?.color)
|
|
42
|
+
let selectedIcon = $derived(!multiple && items.find((i) => i.selected)?.icon)
|
|
43
|
+
let selectedIconColor = $derived(
|
|
44
|
+
(!multiple && items.find((i) => i.selected)?.iconClass) || 'text-neutral-500'
|
|
45
|
+
)
|
|
46
|
+
let selectedLabel = $derived(
|
|
47
|
+
`${selectedItems[0]?.label || ''}${selectedItems.length > 1 ? ' and more...' : ''}` ||
|
|
48
|
+
placeholder
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
let styles = $derived(
|
|
52
|
+
clsx({
|
|
53
|
+
'shadow-active border-workspace-accent hover:border-workspace-accent': isOpen,
|
|
54
|
+
'border-neutral-100': !isOpen
|
|
55
|
+
})
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
function handleClick(val: AnyProp) {
|
|
59
|
+
value = val
|
|
60
|
+
|
|
61
|
+
onSelect?.(value)
|
|
62
|
+
|
|
63
|
+
if (multiple) return
|
|
64
|
+
|
|
65
|
+
selectDropdown?.toggle()
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function handleSelected(val: AnyProp) {
|
|
69
|
+
if (!multiple) return
|
|
70
|
+
|
|
71
|
+
// Avoid re-firing watcher
|
|
72
|
+
if (isEqual(value, val)) return
|
|
73
|
+
|
|
74
|
+
value = val
|
|
75
|
+
}
|
|
59
76
|
</script>
|
|
60
77
|
|
|
61
78
|
<BaseDropdown bind:isOpen placement="bottom-start" {fullWidth} bind:this={selectDropdown}>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
{multiple}
|
|
81
|
-
{items}
|
|
82
|
-
on:click={handleClick}
|
|
83
|
-
on:selected={handleSelected}
|
|
84
|
-
/>
|
|
79
|
+
{#snippet trigger()}
|
|
80
|
+
<div
|
|
81
|
+
class="{styles} dropdown-select max-w-[420px] flex items-center border hover:border-neutral-300 rounded-md py-1.25 pl-2 gap-1 bg-white whitespace-nowrap"
|
|
82
|
+
>
|
|
83
|
+
{#if selectedColor}
|
|
84
|
+
<TagStatus dot status={selectedColor} />
|
|
85
|
+
{:else if selectedIcon}
|
|
86
|
+
<Icon src={selectedIcon} {iconTheme} class="{selectedIconColor} h-4 w-4 flex-shrink-0" />
|
|
87
|
+
{:else if resolvedIcon}
|
|
88
|
+
<Icon src={resolvedIcon} {iconTheme} class="h-4 w-4 text-neutral-500 flex-shrink-0" />
|
|
89
|
+
{/if}
|
|
90
|
+
|
|
91
|
+
<span class="w-full pr-8 text-neutral-800 placeholder-neutral-800 text-base truncate">
|
|
92
|
+
{selectedLabel}
|
|
93
|
+
</span>
|
|
94
|
+
</div>
|
|
95
|
+
{/snippet}
|
|
96
|
+
<DrawerContext {widthClass} {multiple} {items} onclick={handleClick} onselect={handleSelected} />
|
|
85
97
|
</BaseDropdown>
|
|
86
98
|
|
|
87
99
|
<style>
|