@invopop/popui 0.0.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/README.md +146 -0
- package/dist/BaseButton.svelte +107 -0
- package/dist/BaseButton.svelte.d.ts +33 -0
- package/dist/BaseCard.svelte +50 -0
- package/dist/BaseCard.svelte.d.ts +25 -0
- package/dist/BaseCounter.svelte +16 -0
- package/dist/BaseCounter.svelte.d.ts +17 -0
- package/dist/BaseDropdown.svelte +46 -0
- package/dist/BaseDropdown.svelte.d.ts +24 -0
- package/dist/BaseFlag.svelte +14 -0
- package/dist/BaseFlag.svelte.d.ts +17 -0
- package/dist/BaseTable.svelte +148 -0
- package/dist/BaseTable.svelte.d.ts +33 -0
- package/dist/BaseTableActions.svelte +31 -0
- package/dist/BaseTableActions.svelte.d.ts +21 -0
- package/dist/BaseTableCell.svelte +90 -0
- package/dist/BaseTableCell.svelte.d.ts +26 -0
- package/dist/BaseTableHeader.svelte +75 -0
- package/dist/BaseTableHeader.svelte.d.ts +23 -0
- package/dist/BaseTableHeaderSortBy.svelte +22 -0
- package/dist/BaseTableHeaderSortBy.svelte.d.ts +20 -0
- package/dist/BaseTableRow.svelte +48 -0
- package/dist/BaseTableRow.svelte.d.ts +25 -0
- package/dist/ButtonFile.svelte +51 -0
- package/dist/ButtonFile.svelte.d.ts +25 -0
- package/dist/CardRelation.svelte +29 -0
- package/dist/CardRelation.svelte.d.ts +22 -0
- package/dist/CompanySelector.svelte +74 -0
- package/dist/CompanySelector.svelte.d.ts +23 -0
- package/dist/CounterWorkflow.svelte +15 -0
- package/dist/CounterWorkflow.svelte.d.ts +17 -0
- package/dist/DataListItem.svelte +22 -0
- package/dist/DataListItem.svelte.d.ts +22 -0
- package/dist/DatePicker.svelte +431 -0
- package/dist/DatePicker.svelte.d.ts +22 -0
- package/dist/DrawerContext.svelte +48 -0
- package/dist/DrawerContext.svelte.d.ts +23 -0
- package/dist/DrawerContextItem.svelte +93 -0
- package/dist/DrawerContextItem.svelte.d.ts +23 -0
- package/dist/DrawerContextWorkspace.svelte +40 -0
- package/dist/DrawerContextWorkspace.svelte.d.ts +20 -0
- package/dist/DropdownSelect.svelte +78 -0
- package/dist/DropdownSelect.svelte.d.ts +26 -0
- package/dist/EmptyStateIcon.svelte +46 -0
- package/dist/EmptyStateIcon.svelte.d.ts +22 -0
- package/dist/EmptyStateIllustration.svelte +58 -0
- package/dist/EmptyStateIllustration.svelte.d.ts +21 -0
- package/dist/FeedEvents.svelte +26 -0
- package/dist/FeedEvents.svelte.d.ts +17 -0
- package/dist/FeedIconEvent.svelte +10 -0
- package/dist/FeedIconEvent.svelte.d.ts +19 -0
- package/dist/FeedIconStatus.svelte +26 -0
- package/dist/FeedIconStatus.svelte.d.ts +17 -0
- package/dist/FeedItem.svelte +87 -0
- package/dist/FeedItem.svelte.d.ts +30 -0
- package/dist/FeedItemDetail.svelte +56 -0
- package/dist/FeedItemDetail.svelte.d.ts +23 -0
- package/dist/FeedViewer.svelte +19 -0
- package/dist/FeedViewer.svelte.d.ts +21 -0
- package/dist/FormLayoutModal.svelte +8 -0
- package/dist/FormLayoutModal.svelte.d.ts +29 -0
- package/dist/GlobalSearch.svelte +47 -0
- package/dist/GlobalSearch.svelte.d.ts +18 -0
- package/dist/InputCheckbox.svelte +20 -0
- package/dist/InputCheckbox.svelte.d.ts +18 -0
- package/dist/InputError.svelte +14 -0
- package/dist/InputError.svelte.d.ts +16 -0
- package/dist/InputLabel.svelte +5 -0
- package/dist/InputLabel.svelte.d.ts +17 -0
- package/dist/InputRadio.svelte +27 -0
- package/dist/InputRadio.svelte.d.ts +19 -0
- package/dist/InputSearch.svelte +69 -0
- package/dist/InputSearch.svelte.d.ts +32 -0
- package/dist/InputSelect.svelte +75 -0
- package/dist/InputSelect.svelte.d.ts +30 -0
- package/dist/InputText.svelte +63 -0
- package/dist/InputText.svelte.d.ts +26 -0
- package/dist/InputTextarea.svelte +42 -0
- package/dist/InputTextarea.svelte.d.ts +24 -0
- package/dist/InputToggle.svelte +33 -0
- package/dist/InputToggle.svelte.d.ts +18 -0
- package/dist/MenuItem.svelte +141 -0
- package/dist/MenuItem.svelte.d.ts +29 -0
- package/dist/ProfileAvatar.svelte +39 -0
- package/dist/ProfileAvatar.svelte.d.ts +21 -0
- package/dist/ProfileSelector.svelte +20 -0
- package/dist/ProfileSelector.svelte.d.ts +20 -0
- package/dist/SectionLayout.svelte +10 -0
- package/dist/SectionLayout.svelte.d.ts +18 -0
- package/dist/SeparatorHorizontal.svelte +14 -0
- package/dist/SeparatorHorizontal.svelte.d.ts +23 -0
- package/dist/ShortcutWrapper.svelte +6 -0
- package/dist/ShortcutWrapper.svelte.d.ts +27 -0
- package/dist/StatusLabel.svelte +20 -0
- package/dist/StatusLabel.svelte.d.ts +18 -0
- package/dist/Tabs.svelte +41 -0
- package/dist/Tabs.svelte.d.ts +20 -0
- package/dist/TagBeta.svelte +23 -0
- package/dist/TagBeta.svelte.d.ts +23 -0
- package/dist/TagSearch.svelte +46 -0
- package/dist/TagSearch.svelte.d.ts +22 -0
- package/dist/TagStatus.svelte +46 -0
- package/dist/TagStatus.svelte.d.ts +19 -0
- package/dist/TitleMain.svelte +6 -0
- package/dist/TitleMain.svelte.d.ts +18 -0
- package/dist/TitleSection.svelte +6 -0
- package/dist/TitleSection.svelte.d.ts +18 -0
- package/dist/UuidCopy.svelte +55 -0
- package/dist/UuidCopy.svelte.d.ts +26 -0
- package/dist/clickOutside.d.ts +4 -0
- package/dist/clickOutside.js +18 -0
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +1 -0
- package/dist/helpers.d.ts +6 -0
- package/dist/helpers.js +35 -0
- package/dist/index.d.ts +51 -0
- package/dist/index.js +101 -0
- package/dist/popui.css +1 -0
- package/dist/svg/BgPattern.svelte +20 -0
- package/dist/svg/BgPattern.svelte.d.ts +23 -0
- package/dist/svg/IconContact.svelte +114 -0
- package/dist/svg/IconContact.svelte.d.ts +16 -0
- package/dist/svg/IconEmpty.svelte +138 -0
- package/dist/svg/IconEmpty.svelte.d.ts +23 -0
- package/dist/svg/IconFile.svelte +91 -0
- package/dist/svg/IconFile.svelte.d.ts +16 -0
- package/dist/svg/IconInvoice.svelte +97 -0
- package/dist/svg/IconInvoice.svelte.d.ts +16 -0
- package/dist/svg/IconNoResults.svelte +83 -0
- package/dist/svg/IconNoResults.svelte.d.ts +16 -0
- package/dist/svg/IconPdf.svelte +93 -0
- package/dist/svg/IconPdf.svelte.d.ts +16 -0
- package/dist/svg/IconProduct.svelte +105 -0
- package/dist/svg/IconProduct.svelte.d.ts +16 -0
- package/dist/tw.theme.d.ts +135 -0
- package/dist/tw.theme.js +152 -0
- package/dist/types.d.ts +128 -0
- package/dist/types.js +1 -0
- package/dist/wcdispatch.d.ts +1 -0
- package/dist/wcdispatch.js +9 -0
- package/package.json +102 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script>import { createEventDispatcher } from "svelte";
|
|
2
|
+
import FeedItem from "./FeedItem.svelte";
|
|
3
|
+
const dispatch = createEventDispatcher();
|
|
4
|
+
export let items = [];
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<div>
|
|
8
|
+
{#each items as item, i (i)}
|
|
9
|
+
<FeedItem
|
|
10
|
+
{...item}
|
|
11
|
+
hasNext={i < items.length - 1}
|
|
12
|
+
on:open
|
|
13
|
+
on:copied
|
|
14
|
+
on:view={() => {
|
|
15
|
+
dispatch('view', item)
|
|
16
|
+
}}
|
|
17
|
+
/>
|
|
18
|
+
{/each}
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { FeedItemProps } from './types.js';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
items?: FeedItemProps[] | undefined;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
open: CustomEvent<any>;
|
|
9
|
+
copied: CustomEvent<any>;
|
|
10
|
+
view: CustomEvent<any>;
|
|
11
|
+
} & {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
};
|
|
14
|
+
slots: {};
|
|
15
|
+
};
|
|
16
|
+
export type FeedViewerProps = typeof __propDef.props;
|
|
17
|
+
export type FeedViewerEvents = typeof __propDef.events;
|
|
18
|
+
export type FeedViewerSlots = typeof __propDef.slots;
|
|
19
|
+
export default class FeedViewer extends SvelteComponent<FeedViewerProps, FeedViewerEvents, FeedViewerSlots> {
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} FormLayoutModalProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} FormLayoutModalEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} FormLayoutModalSlots */
|
|
4
|
+
export default class FormLayoutModal extends SvelteComponent<{
|
|
5
|
+
[x: string]: never;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {
|
|
9
|
+
default: {};
|
|
10
|
+
footer: {};
|
|
11
|
+
}> {
|
|
12
|
+
}
|
|
13
|
+
export type FormLayoutModalProps = typeof __propDef.props;
|
|
14
|
+
export type FormLayoutModalEvents = typeof __propDef.events;
|
|
15
|
+
export type FormLayoutModalSlots = typeof __propDef.slots;
|
|
16
|
+
import { SvelteComponent } from "svelte";
|
|
17
|
+
declare const __propDef: {
|
|
18
|
+
props: {
|
|
19
|
+
[x: string]: never;
|
|
20
|
+
};
|
|
21
|
+
events: {
|
|
22
|
+
[evt: string]: CustomEvent<any>;
|
|
23
|
+
};
|
|
24
|
+
slots: {
|
|
25
|
+
default: {};
|
|
26
|
+
footer: {};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script>import { Icon } from "@steeze-ui/svelte-icon";
|
|
2
|
+
import { Search, Slash } from "@invopop/ui-icons";
|
|
3
|
+
import { createEventDispatcher, onDestroy, onMount } from "svelte";
|
|
4
|
+
import clsx from "clsx";
|
|
5
|
+
import ShortcutWrapper from "./ShortcutWrapper.svelte";
|
|
6
|
+
import { GLOBAL_SEARCH_KEY } from "./constants.js";
|
|
7
|
+
const dispatch = createEventDispatcher();
|
|
8
|
+
export let collapsed = false;
|
|
9
|
+
$:
|
|
10
|
+
styles = clsx({
|
|
11
|
+
"space-x-1 w-full": !collapsed
|
|
12
|
+
});
|
|
13
|
+
function onKeyDown(event) {
|
|
14
|
+
if (event.key !== GLOBAL_SEARCH_KEY) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const activeElement = document.activeElement;
|
|
18
|
+
const isInputText = activeElement?.tagName === "INPUT" && ["text", "search"].includes(activeElement.type);
|
|
19
|
+
const isTextarea = activeElement?.tagName === "TEXTAREA";
|
|
20
|
+
if (isInputText || isTextarea) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
open();
|
|
24
|
+
}
|
|
25
|
+
function open() {
|
|
26
|
+
dispatch("open");
|
|
27
|
+
}
|
|
28
|
+
onMount(() => {
|
|
29
|
+
window.addEventListener("keydown", onKeyDown);
|
|
30
|
+
});
|
|
31
|
+
onDestroy(() => {
|
|
32
|
+
window.removeEventListener("keydown", onKeyDown);
|
|
33
|
+
});
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<button
|
|
37
|
+
class="{styles} flex items-center border pl-1.5 py-1.5 pr-2 border-white-10 bg-neutral-800/10 rounded-md"
|
|
38
|
+
on:click={() => open()}
|
|
39
|
+
>
|
|
40
|
+
<Icon src={Search} class="w-4 h-4 text-white-70" />
|
|
41
|
+
{#if !collapsed}
|
|
42
|
+
<span class="text-white-40 text-sm flex-1 text-left tracking-normal">Search</span>
|
|
43
|
+
<ShortcutWrapper>
|
|
44
|
+
<Icon src={Slash} class="w-3 h-3 text-white-70" />
|
|
45
|
+
</ShortcutWrapper>
|
|
46
|
+
{/if}
|
|
47
|
+
</button>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
collapsed?: boolean | undefined;
|
|
5
|
+
};
|
|
6
|
+
events: {
|
|
7
|
+
open: CustomEvent<any>;
|
|
8
|
+
} & {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {};
|
|
12
|
+
};
|
|
13
|
+
export type GlobalSearchProps = typeof __propDef.props;
|
|
14
|
+
export type GlobalSearchEvents = typeof __propDef.events;
|
|
15
|
+
export type GlobalSearchSlots = typeof __propDef.slots;
|
|
16
|
+
export default class GlobalSearch extends SvelteComponent<GlobalSearchProps, GlobalSearchEvents, GlobalSearchSlots> {
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script>import { createEventDispatcher } from "svelte";
|
|
2
|
+
import { dispatchWcEvent } from "./wcdispatch.js";
|
|
3
|
+
export let checked = false;
|
|
4
|
+
const dispatch = createEventDispatcher();
|
|
5
|
+
function updateInput(event) {
|
|
6
|
+
if (event instanceof CustomEvent)
|
|
7
|
+
return;
|
|
8
|
+
const target = event.target;
|
|
9
|
+
checked = target.checked;
|
|
10
|
+
dispatch("change", checked);
|
|
11
|
+
dispatchWcEvent(target, "change", checked);
|
|
12
|
+
}
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<input
|
|
16
|
+
type="checkbox"
|
|
17
|
+
{checked}
|
|
18
|
+
class="form-checkbox w-5 h-5 text-workspace-accent focus:text-workspace-accent rounded border border-neutral-200 focus:ring-0 focus:ring-offset-0"
|
|
19
|
+
on:change={updateInput}
|
|
20
|
+
/>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
checked?: boolean | undefined;
|
|
5
|
+
};
|
|
6
|
+
events: {
|
|
7
|
+
change: CustomEvent<any>;
|
|
8
|
+
} & {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {};
|
|
12
|
+
};
|
|
13
|
+
export type InputCheckboxProps = typeof __propDef.props;
|
|
14
|
+
export type InputCheckboxEvents = typeof __propDef.events;
|
|
15
|
+
export type InputCheckboxSlots = typeof __propDef.slots;
|
|
16
|
+
export default class InputCheckbox extends SvelteComponent<InputCheckboxProps, InputCheckboxEvents, InputCheckboxSlots> {
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script>export let errorText = "";
|
|
2
|
+
</script>
|
|
3
|
+
|
|
4
|
+
<p class="mt-2 text-sm text-danger-500 flex items-center space-x-1">
|
|
5
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
6
|
+
<path
|
|
7
|
+
fill-rule="evenodd"
|
|
8
|
+
clip-rule="evenodd"
|
|
9
|
+
d="M8 14.5C11.5899 14.5 14.5 11.5899 14.5 8C14.5 4.41015 11.5899 1.5 8 1.5C4.41015 1.5 1.5 4.41015 1.5 8C1.5 11.5899 4.41015 14.5 8 14.5ZM7.99999 9.35C7.66862 9.35 7.39999 9.08137 7.39999 8.75V4.75C7.39999 4.41863 7.66862 4.15 7.99999 4.15C8.33137 4.15 8.59999 4.41863 8.59999 4.75L8.59999 8.75C8.59999 9.08137 8.33136 9.35 7.99999 9.35ZM8.75 11C8.75 11.4142 8.41421 11.75 8 11.75C7.58579 11.75 7.25 11.4142 7.25 11C7.25 10.5858 7.58579 10.25 8 10.25C8.41421 10.25 8.75 10.5858 8.75 11Z"
|
|
10
|
+
fill="currentColor"
|
|
11
|
+
/>
|
|
12
|
+
</svg>
|
|
13
|
+
<span>{errorText}</span>
|
|
14
|
+
</p>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
errorText?: string | undefined;
|
|
5
|
+
};
|
|
6
|
+
events: {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
};
|
|
9
|
+
slots: {};
|
|
10
|
+
};
|
|
11
|
+
export type InputErrorProps = typeof __propDef.props;
|
|
12
|
+
export type InputErrorEvents = typeof __propDef.events;
|
|
13
|
+
export type InputErrorSlots = typeof __propDef.slots;
|
|
14
|
+
export default class InputError extends SvelteComponent<InputErrorProps, InputErrorEvents, InputErrorSlots> {
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
id?: string | undefined;
|
|
5
|
+
label?: string | undefined;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
};
|
|
12
|
+
export type InputLabelProps = typeof __propDef.props;
|
|
13
|
+
export type InputLabelEvents = typeof __propDef.events;
|
|
14
|
+
export type InputLabelSlots = typeof __propDef.slots;
|
|
15
|
+
export default class InputLabel extends SvelteComponent<InputLabelProps, InputLabelEvents, InputLabelSlots> {
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script>import { createEventDispatcher } from "svelte";
|
|
2
|
+
import { dispatchWcEvent } from "./wcdispatch.js";
|
|
3
|
+
export let checked = false;
|
|
4
|
+
export let id = "";
|
|
5
|
+
let el;
|
|
6
|
+
const dispatch = createEventDispatcher();
|
|
7
|
+
$:
|
|
8
|
+
if (el && checked) {
|
|
9
|
+
el.focus();
|
|
10
|
+
}
|
|
11
|
+
function updateInput(event) {
|
|
12
|
+
if (event instanceof CustomEvent)
|
|
13
|
+
return;
|
|
14
|
+
const target = event.target;
|
|
15
|
+
dispatch("change", target.checked);
|
|
16
|
+
dispatchWcEvent(target, "change", target.checked);
|
|
17
|
+
}
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<input
|
|
21
|
+
bind:this={el}
|
|
22
|
+
type="radio"
|
|
23
|
+
{id}
|
|
24
|
+
{checked}
|
|
25
|
+
class="form-radio h-5 w-5 border-neutral-200 text-workspace-accent focus:ring-0 focus:ring-offset-0"
|
|
26
|
+
on:change={updateInput}
|
|
27
|
+
/>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
checked?: boolean | undefined;
|
|
5
|
+
id?: string | undefined;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
change: CustomEvent<any>;
|
|
9
|
+
} & {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
};
|
|
12
|
+
slots: {};
|
|
13
|
+
};
|
|
14
|
+
export type InputRadioProps = typeof __propDef.props;
|
|
15
|
+
export type InputRadioEvents = typeof __propDef.events;
|
|
16
|
+
export type InputRadioSlots = typeof __propDef.slots;
|
|
17
|
+
export default class InputRadio extends SvelteComponent<InputRadioProps, InputRadioEvents, InputRadioSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<script>import { createEventDispatcher, onMount } from "svelte";
|
|
2
|
+
import { dispatchWcEvent } from "./wcdispatch.js";
|
|
3
|
+
import { Icon } from "@steeze-ui/svelte-icon";
|
|
4
|
+
import { Search } from "@invopop/ui-icons";
|
|
5
|
+
const dispatch = createEventDispatcher();
|
|
6
|
+
const debounce = (target) => {
|
|
7
|
+
clearTimeout(timer);
|
|
8
|
+
timer = setTimeout(() => {
|
|
9
|
+
dispatch("input", target.value);
|
|
10
|
+
dispatchWcEvent(target, "input", target.value);
|
|
11
|
+
}, 750);
|
|
12
|
+
};
|
|
13
|
+
export let value = "";
|
|
14
|
+
export let shortcut = "";
|
|
15
|
+
export let placeholder = "";
|
|
16
|
+
export let icon = Search;
|
|
17
|
+
export let focusOnLoad = false;
|
|
18
|
+
let input;
|
|
19
|
+
let timer;
|
|
20
|
+
export const focus = () => {
|
|
21
|
+
input.focus();
|
|
22
|
+
};
|
|
23
|
+
export const toggle = () => {
|
|
24
|
+
input === document.activeElement ? input.blur() : input.focus();
|
|
25
|
+
};
|
|
26
|
+
export const clear = () => {
|
|
27
|
+
value = "";
|
|
28
|
+
};
|
|
29
|
+
$:
|
|
30
|
+
shortcutKeys = shortcut.split("");
|
|
31
|
+
function handleInput(event) {
|
|
32
|
+
if (event instanceof CustomEvent)
|
|
33
|
+
return;
|
|
34
|
+
const target = event.target;
|
|
35
|
+
debounce(target);
|
|
36
|
+
}
|
|
37
|
+
onMount(() => {
|
|
38
|
+
if (!focusOnLoad)
|
|
39
|
+
return;
|
|
40
|
+
input.focus();
|
|
41
|
+
});
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<div class="relative flex items-center">
|
|
45
|
+
<input
|
|
46
|
+
bind:this={input}
|
|
47
|
+
bind:value
|
|
48
|
+
type="search"
|
|
49
|
+
class="py-[5px] pl-7 border border-neutral-200 hover:border-neutral-300 w-full rounded-md text-neutral-800 placeholder-neutral-500 text-base outline-none tracking-tight caret-workspace-accent focus:border-workspace-accent focus:shadow-active"
|
|
50
|
+
style:padding-right={`${shortcutKeys.length * 15 + 12}px`}
|
|
51
|
+
{placeholder}
|
|
52
|
+
on:input={handleInput}
|
|
53
|
+
on:focus={() => dispatch('focus')}
|
|
54
|
+
on:blur={(e) => dispatch('blur', e)}
|
|
55
|
+
on:click
|
|
56
|
+
/>
|
|
57
|
+
<Icon src={icon} class="absolute text-neutral-500 w-4 h-4 left-2" />
|
|
58
|
+
|
|
59
|
+
{#if shortcut}
|
|
60
|
+
<div class="absolute top-1 right-0 flex py-1.5 pr-1.5 space-x-1">
|
|
61
|
+
{#each shortcutKeys as key}
|
|
62
|
+
<kbd
|
|
63
|
+
class="w-4 h-4 flex justify-center items-center rounded-md border border-neutral-200 bg-neutral-100 font-sans text-sm text-neutral-500 font-semibold"
|
|
64
|
+
>{key}</kbd
|
|
65
|
+
>
|
|
66
|
+
{/each}
|
|
67
|
+
</div>
|
|
68
|
+
{/if}
|
|
69
|
+
</div>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import { type IconSource } from '@steeze-ui/svelte-icon';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
value?: string | undefined;
|
|
6
|
+
shortcut?: string | undefined;
|
|
7
|
+
placeholder?: string | undefined;
|
|
8
|
+
icon?: IconSource | undefined;
|
|
9
|
+
focusOnLoad?: boolean | undefined;
|
|
10
|
+
focus?: (() => void) | undefined;
|
|
11
|
+
toggle?: (() => void) | undefined;
|
|
12
|
+
clear?: (() => void) | undefined;
|
|
13
|
+
};
|
|
14
|
+
events: {
|
|
15
|
+
click: MouseEvent;
|
|
16
|
+
focus: CustomEvent<any>;
|
|
17
|
+
blur: CustomEvent<any>;
|
|
18
|
+
input: CustomEvent<any>;
|
|
19
|
+
} & {
|
|
20
|
+
[evt: string]: CustomEvent<any>;
|
|
21
|
+
};
|
|
22
|
+
slots: {};
|
|
23
|
+
};
|
|
24
|
+
export type InputSearchProps = typeof __propDef.props;
|
|
25
|
+
export type InputSearchEvents = typeof __propDef.events;
|
|
26
|
+
export type InputSearchSlots = typeof __propDef.slots;
|
|
27
|
+
export default class InputSearch extends SvelteComponent<InputSearchProps, InputSearchEvents, InputSearchSlots> {
|
|
28
|
+
get focus(): () => void;
|
|
29
|
+
get toggle(): () => void;
|
|
30
|
+
get clear(): () => void;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<script>import { Icon } from "@steeze-ui/svelte-icon";
|
|
2
|
+
import InputLabel from "./InputLabel.svelte";
|
|
3
|
+
import { createEventDispatcher } from "svelte";
|
|
4
|
+
import { resolveIcon } from "./helpers.js";
|
|
5
|
+
import { dispatchWcEvent } from "./wcdispatch.js";
|
|
6
|
+
import InputError from "./InputError.svelte";
|
|
7
|
+
const dispatch = createEventDispatcher();
|
|
8
|
+
export let id = Math.random().toString(36).slice(2, 7);
|
|
9
|
+
export let name = "";
|
|
10
|
+
export let label = "";
|
|
11
|
+
export let disabled = false;
|
|
12
|
+
export let value = "";
|
|
13
|
+
export let icon = void 0;
|
|
14
|
+
export let iconTheme = "default";
|
|
15
|
+
export let options = [];
|
|
16
|
+
export let placeholder = "Select one...";
|
|
17
|
+
export let disablePlaceholder = true;
|
|
18
|
+
export let errorText = "";
|
|
19
|
+
let resolvedIcon;
|
|
20
|
+
$: {
|
|
21
|
+
resolveIcon(icon).then((icon2) => {
|
|
22
|
+
resolvedIcon = icon2;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function handleChange(event) {
|
|
26
|
+
if (event instanceof CustomEvent)
|
|
27
|
+
return;
|
|
28
|
+
const target = event.target;
|
|
29
|
+
dispatch("change", target.value);
|
|
30
|
+
dispatchWcEvent(target, "change", target.value);
|
|
31
|
+
}
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
{#if label}
|
|
35
|
+
<InputLabel {id} {label} />
|
|
36
|
+
{/if}
|
|
37
|
+
<div class="relative">
|
|
38
|
+
<select
|
|
39
|
+
{id}
|
|
40
|
+
{name}
|
|
41
|
+
bind:value
|
|
42
|
+
{disabled}
|
|
43
|
+
class:pl-7={icon}
|
|
44
|
+
class:pl-2={!icon}
|
|
45
|
+
class="py-1.5 border border-neutral-200 hover:border-neutral-300 w-full rounded-md text-neutral-800 text-base pr-9 outline-none tracking-tight ui-select focus:border-workspace-accent focus:shadow-active"
|
|
46
|
+
on:change={handleChange}
|
|
47
|
+
>
|
|
48
|
+
<option value="" disabled={disablePlaceholder}>{placeholder}</option>
|
|
49
|
+
{#each options as option}
|
|
50
|
+
<option value={option.value}>{option.label}</option>
|
|
51
|
+
{/each}
|
|
52
|
+
</select>
|
|
53
|
+
{#if resolvedIcon}
|
|
54
|
+
<Icon
|
|
55
|
+
src={resolvedIcon}
|
|
56
|
+
theme={iconTheme}
|
|
57
|
+
class="h-4 w-4 absolute top-2 left-2 text-neutral-500"
|
|
58
|
+
/>
|
|
59
|
+
{/if}
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
{#if errorText}
|
|
63
|
+
<InputError {errorText} />
|
|
64
|
+
{/if}
|
|
65
|
+
|
|
66
|
+
<style>
|
|
67
|
+
.ui-select {
|
|
68
|
+
appearance: none;
|
|
69
|
+
-webkit-appearance: none;
|
|
70
|
+
-moz-appearance: none;
|
|
71
|
+
background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3QgeD0iMiIgeT0iMiIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2IiByeD0iNCIgZmlsbD0iI0YzRjRGNiIvPgo8cGF0aCBkPSJNNi41IDguMjUwMDRMMTAgMTEuNzVMMTMuNSA4LjI1IiBzdHJva2U9IiMwMzA3MTIiIHN0cm9rZS13aWR0aD0iMS4xIi8+Cjwvc3ZnPg==');
|
|
72
|
+
background-repeat: no-repeat;
|
|
73
|
+
background-position: center right 6px;
|
|
74
|
+
}
|
|
75
|
+
</style>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { IconTheme, SelectOption } from './types.ts';
|
|
3
|
+
import { type IconSource } from '@steeze-ui/svelte-icon';
|
|
4
|
+
declare const __propDef: {
|
|
5
|
+
props: {
|
|
6
|
+
id?: string | undefined;
|
|
7
|
+
name?: string | undefined;
|
|
8
|
+
label?: string | undefined;
|
|
9
|
+
disabled?: boolean | undefined;
|
|
10
|
+
value?: string | undefined;
|
|
11
|
+
icon?: IconSource | string | undefined;
|
|
12
|
+
iconTheme?: IconTheme | undefined;
|
|
13
|
+
options?: SelectOption[] | undefined;
|
|
14
|
+
placeholder?: string | undefined;
|
|
15
|
+
disablePlaceholder?: boolean | undefined;
|
|
16
|
+
errorText?: string | undefined;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
change: CustomEvent<any>;
|
|
20
|
+
} & {
|
|
21
|
+
[evt: string]: CustomEvent<any>;
|
|
22
|
+
};
|
|
23
|
+
slots: {};
|
|
24
|
+
};
|
|
25
|
+
export type InputSelectProps = typeof __propDef.props;
|
|
26
|
+
export type InputSelectEvents = typeof __propDef.events;
|
|
27
|
+
export type InputSelectSlots = typeof __propDef.slots;
|
|
28
|
+
export default class InputSelect extends SvelteComponent<InputSelectProps, InputSelectEvents, InputSelectSlots> {
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<script>import clsx from "clsx";
|
|
2
|
+
import { createEventDispatcher, onMount } from "svelte";
|
|
3
|
+
import InputLabel from "./InputLabel.svelte";
|
|
4
|
+
import { dispatchWcEvent } from "./wcdispatch.js";
|
|
5
|
+
import InputError from "./InputError.svelte";
|
|
6
|
+
export let id = Math.random().toString(36).slice(2, 7);
|
|
7
|
+
export let label = "";
|
|
8
|
+
export let placeholder = "";
|
|
9
|
+
export let errorText = "";
|
|
10
|
+
export let disabled = false;
|
|
11
|
+
export let value = "";
|
|
12
|
+
export let focusOnLoad = false;
|
|
13
|
+
let inputEl;
|
|
14
|
+
let timer;
|
|
15
|
+
const dispatch = createEventDispatcher();
|
|
16
|
+
const debounce = (target) => {
|
|
17
|
+
clearTimeout(timer);
|
|
18
|
+
timer = setTimeout(() => {
|
|
19
|
+
dispatch("input", target.value);
|
|
20
|
+
dispatchWcEvent(target, "input", target.value);
|
|
21
|
+
}, 750);
|
|
22
|
+
};
|
|
23
|
+
$:
|
|
24
|
+
inputStyles = clsx(
|
|
25
|
+
{ "pointer-events-none bg-neutral-50": disabled },
|
|
26
|
+
{
|
|
27
|
+
"text-danger-500 border-danger-400 outline-danger-400": errorText
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"border-neutral-200 hover:border-neutral-300 text-neutral-800 outline-none caret-workspace-accent focus:border-workspace-accent focus:shadow-active": !errorText
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
function handleInput(event) {
|
|
34
|
+
if (event instanceof CustomEvent)
|
|
35
|
+
return;
|
|
36
|
+
const target = event.target;
|
|
37
|
+
debounce(target);
|
|
38
|
+
}
|
|
39
|
+
onMount(() => {
|
|
40
|
+
if (!focusOnLoad)
|
|
41
|
+
return;
|
|
42
|
+
inputEl.focus();
|
|
43
|
+
});
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
{#if label}
|
|
47
|
+
<InputLabel {id} {label} />
|
|
48
|
+
{/if}
|
|
49
|
+
<input
|
|
50
|
+
{id}
|
|
51
|
+
bind:this={inputEl}
|
|
52
|
+
bind:value
|
|
53
|
+
type="text"
|
|
54
|
+
class="{inputStyles} py-1.5 px-2.5 border w-full rounded-md placeholder:text-neutral-500 text-base tracking-tight"
|
|
55
|
+
{placeholder}
|
|
56
|
+
readonly={disabled}
|
|
57
|
+
on:input={handleInput}
|
|
58
|
+
on:focus={() => dispatch('focus')}
|
|
59
|
+
on:blur={(e) => dispatch('blur', e)}
|
|
60
|
+
/>
|
|
61
|
+
{#if errorText}
|
|
62
|
+
<InputError {errorText} />
|
|
63
|
+
{/if}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
id?: string | undefined;
|
|
5
|
+
label?: string | undefined;
|
|
6
|
+
placeholder?: string | undefined;
|
|
7
|
+
errorText?: string | undefined;
|
|
8
|
+
disabled?: boolean | undefined;
|
|
9
|
+
value?: string | number | undefined;
|
|
10
|
+
focusOnLoad?: boolean | undefined;
|
|
11
|
+
};
|
|
12
|
+
events: {
|
|
13
|
+
focus: CustomEvent<any>;
|
|
14
|
+
blur: CustomEvent<any>;
|
|
15
|
+
input: CustomEvent<any>;
|
|
16
|
+
} & {
|
|
17
|
+
[evt: string]: CustomEvent<any>;
|
|
18
|
+
};
|
|
19
|
+
slots: {};
|
|
20
|
+
};
|
|
21
|
+
export type InputTextProps = typeof __propDef.props;
|
|
22
|
+
export type InputTextEvents = typeof __propDef.events;
|
|
23
|
+
export type InputTextSlots = typeof __propDef.slots;
|
|
24
|
+
export default class InputText extends SvelteComponent<InputTextProps, InputTextEvents, InputTextSlots> {
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script>import { createEventDispatcher } from "svelte";
|
|
2
|
+
import InputLabel from "./InputLabel.svelte";
|
|
3
|
+
import InputError from "./InputError.svelte";
|
|
4
|
+
import clsx from "clsx";
|
|
5
|
+
const dispatch = createEventDispatcher();
|
|
6
|
+
export let id = Math.random().toString(36).slice(2, 7);
|
|
7
|
+
export let label = "";
|
|
8
|
+
export let placeholder = "";
|
|
9
|
+
export let errorText = "";
|
|
10
|
+
export let disabled = false;
|
|
11
|
+
export let value = "";
|
|
12
|
+
export let rows = 4;
|
|
13
|
+
$:
|
|
14
|
+
inputStyles = clsx(
|
|
15
|
+
{ "pointer-events-none bg-neutral-50": disabled },
|
|
16
|
+
{
|
|
17
|
+
"text-danger-500 border-danger-400 outline-danger-400": errorText
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"border-neutral-200 hover:border-neutral-300 text-neutral-800 outline-none caret-workspace-accent focus:border-workspace-accent focus:shadow-active": !errorText
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
function handleInput(event) {
|
|
24
|
+
value = event.target.value;
|
|
25
|
+
dispatch("input", value);
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<InputLabel {id} {label} />
|
|
30
|
+
<textarea
|
|
31
|
+
{id}
|
|
32
|
+
{placeholder}
|
|
33
|
+
{value}
|
|
34
|
+
class="{inputStyles} py-1.5 px-3 border w-full rounded placeholder-neutral-500 text-base tracking-tight"
|
|
35
|
+
{disabled}
|
|
36
|
+
{rows}
|
|
37
|
+
on:input={handleInput}
|
|
38
|
+
/>
|
|
39
|
+
|
|
40
|
+
{#if errorText}
|
|
41
|
+
<InputError {errorText} />
|
|
42
|
+
{/if}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
id?: string | undefined;
|
|
5
|
+
label?: string | undefined;
|
|
6
|
+
placeholder?: string | undefined;
|
|
7
|
+
errorText?: string | undefined;
|
|
8
|
+
disabled?: boolean | undefined;
|
|
9
|
+
value?: string | number | undefined;
|
|
10
|
+
rows?: number | undefined;
|
|
11
|
+
};
|
|
12
|
+
events: {
|
|
13
|
+
input: CustomEvent<any>;
|
|
14
|
+
} & {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
};
|
|
17
|
+
slots: {};
|
|
18
|
+
};
|
|
19
|
+
export type InputTextareaProps = typeof __propDef.props;
|
|
20
|
+
export type InputTextareaEvents = typeof __propDef.events;
|
|
21
|
+
export type InputTextareaSlots = typeof __propDef.slots;
|
|
22
|
+
export default class InputTextarea extends SvelteComponent<InputTextareaProps, InputTextareaEvents, InputTextareaSlots> {
|
|
23
|
+
}
|
|
24
|
+
export {};
|