@ibis-design/svelte 0.5.0 → 0.7.0
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 +42 -10
- package/dist/components/buttons/Button.svelte +106 -0
- package/dist/components/buttons/Button.svelte.d.ts +69 -0
- package/dist/components/buttons/DropdownButton.svelte +91 -0
- package/dist/components/buttons/DropdownButton.svelte.d.ts +33 -0
- package/dist/components/buttons/PillTab.svelte +84 -0
- package/dist/components/buttons/PillTab.svelte.d.ts +55 -0
- package/dist/components/containers/Banner.svelte +73 -0
- package/dist/components/containers/Banner.svelte.d.ts +16 -0
- package/dist/components/containers/Card.svelte +34 -0
- package/dist/components/containers/Card.svelte.d.ts +14 -0
- package/dist/components/containers/PillTabs.svelte +22 -0
- package/dist/components/containers/PillTabs.svelte.d.ts +6 -0
- package/dist/components/containers/TipIndicator.svelte +78 -0
- package/dist/components/containers/TipIndicator.svelte.d.ts +28 -0
- package/dist/components/containers/Toaster.svelte +75 -0
- package/dist/components/containers/Toaster.svelte.d.ts +16 -0
- package/dist/components/containers/Tooltip.svelte.d.ts +26 -0
- package/dist/components/inputs/.gitkeep +0 -0
- package/dist/components/inputs/Checkbox.svelte +95 -0
- package/dist/components/inputs/Checkbox.svelte.d.ts +33 -0
- package/dist/components/inputs/Chips.svelte +104 -0
- package/dist/components/inputs/Chips.svelte.d.ts +48 -0
- package/dist/components/inputs/Dropdown.svelte +83 -0
- package/dist/components/inputs/Dropdown.svelte.d.ts +15 -0
- package/dist/components/inputs/Radio.svelte +109 -0
- package/dist/components/inputs/Radio.svelte.d.ts +49 -0
- package/dist/components/inputs/Switch.svelte +45 -0
- package/dist/components/inputs/Switch.svelte.d.ts +21 -0
- package/dist/components/inputs/TextArea.svelte +65 -0
- package/dist/components/inputs/TextArea.svelte.d.ts +14 -0
- package/dist/components/inputs/TextInput.svelte +273 -0
- package/dist/components/inputs/TextInput.svelte.d.ts +140 -0
- package/dist/components/inputs/TextLink.svelte +102 -0
- package/dist/components/inputs/TextLink.svelte.d.ts +21 -0
- package/dist/index.d.ts +21 -20
- package/dist/index.js +36 -3187
- package/dist/layouts/AppLayout.svelte +83 -0
- package/dist/layouts/AppLayout.svelte.d.ts +20 -0
- package/dist/layouts/AuthLayout.svelte +63 -0
- package/dist/layouts/AuthLayout.svelte.d.ts +18 -0
- package/dist/layouts/DashboardLayout.svelte +88 -0
- package/dist/layouts/DashboardLayout.svelte.d.ts +20 -0
- package/dist/types/button.js +5 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.js +5 -0
- package/dist/types/layout.d.ts +1 -1
- package/dist/types/layout.js +1 -0
- package/package.json +16 -11
- package/dist/index.css +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/components/buttons/Button.svelte.d.ts +0 -1
- package/dist/lib/components/buttons/DropdownButton.svelte.d.ts +0 -1
- package/dist/lib/components/buttons/PillTab.svelte.d.ts +0 -1
- package/dist/lib/components/containers/Banner.svelte.d.ts +0 -1
- package/dist/lib/components/containers/Card.svelte.d.ts +0 -1
- package/dist/lib/components/containers/Toaster.svelte.d.ts +0 -1
- package/dist/lib/components/inputs/Checkbox.svelte.d.ts +0 -1
- package/dist/lib/components/inputs/Chips.svelte.d.ts +0 -1
- package/dist/lib/components/inputs/DateInput.svelte.d.ts +0 -1
- package/dist/lib/components/inputs/DateInput2.svelte.d.ts +0 -1
- package/dist/lib/components/inputs/Dropdown.svelte.d.ts +0 -1
- package/dist/lib/components/inputs/Password.svelte.d.ts +0 -1
- package/dist/lib/components/inputs/Radio.svelte.d.ts +0 -1
- package/dist/lib/components/inputs/TextArea.svelte.d.ts +0 -1
- package/dist/lib/components/inputs/TextInput.svelte.d.ts +0 -1
- package/dist/lib/components/inputs/TextLink.svelte.d.ts +0 -1
- package/dist/lib/layouts/AppLayout.svelte.d.ts +0 -1
- package/dist/lib/layouts/AuthLayout.svelte.d.ts +0 -1
- package/dist/lib/layouts/DashboardLayout.svelte.d.ts +0 -1
- /package/dist/{types/input.d.ts → components/containers/Tooltip.svelte} +0 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import "@ibis-design/css/components/textInput.css";
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import type { HTMLInputAttributes } from "svelte/elements";
|
|
4
|
+
interface Props extends HTMLInputAttributes {
|
|
5
|
+
/**
|
|
6
|
+
* The label for the input field.
|
|
7
|
+
*
|
|
8
|
+
* Provides a descriptive text for the input.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* <TextInput label="Username" placeholder="Enter your username" />
|
|
12
|
+
*/
|
|
13
|
+
label?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The size of the input field.
|
|
16
|
+
*
|
|
17
|
+
* @default "md"
|
|
18
|
+
* @example
|
|
19
|
+
* - `sm`: <TextInput inputSize="sm" />
|
|
20
|
+
* - `md`: <TextInput inputSize="md" />
|
|
21
|
+
* - `lg`: <TextInput inputSize="lg" />
|
|
22
|
+
*/
|
|
23
|
+
inputSize?: "sm" | "md" | "lg";
|
|
24
|
+
/**
|
|
25
|
+
* Shows a loading spinner inside the input field and disables interaction.
|
|
26
|
+
*
|
|
27
|
+
* Use when the input is waiting for async data, such as validating a field
|
|
28
|
+
* against a server or fetching autocomplete suggestions.
|
|
29
|
+
*
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
loading?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Denotes the input field as invalid.
|
|
35
|
+
*
|
|
36
|
+
* @default false
|
|
37
|
+
* @example
|
|
38
|
+
* <TextInput invalid={true} error="Please enter a valid email address." />
|
|
39
|
+
*/
|
|
40
|
+
invalid?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* A short description displayed below the label.
|
|
43
|
+
*
|
|
44
|
+
* Use to provide additional context about what the field expects,
|
|
45
|
+
* such as format requirements or usage guidance.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* <TextInput label="Username" description="This will be publicly visible." />
|
|
49
|
+
*/
|
|
50
|
+
description?: string;
|
|
51
|
+
/**
|
|
52
|
+
* The error message displayed when the input is invalid.
|
|
53
|
+
*
|
|
54
|
+
* Only rendered when both `invalid` is true and `error` is provided.
|
|
55
|
+
* Announced to screen readers via `role="alert"`.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* <TextInput invalid={true} error="This field is required." />
|
|
59
|
+
*/
|
|
60
|
+
error?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Helper text displayed below the input field.
|
|
63
|
+
*
|
|
64
|
+
* Use to provide supplementary guidance such as formatting hints or
|
|
65
|
+
* privacy notes. Not shown when the input is in an invalid state.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* <TextInput helpText="We'll never share your email with anyone else." />
|
|
69
|
+
*/
|
|
70
|
+
helpText?: string;
|
|
71
|
+
/**
|
|
72
|
+
* A Svelte Snippet rendered inside the input field, before the text.
|
|
73
|
+
*
|
|
74
|
+
* Use for complex content like icons or custom markup.
|
|
75
|
+
* For plain text, use `prefixText` instead.
|
|
76
|
+
* Cannot be used together with `prependSnippet`.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* {#snippet prefix()}<SearchIcon />{/snippet}
|
|
80
|
+
* <TextInput prefixSnippet={prefix} />
|
|
81
|
+
*/
|
|
82
|
+
prefixSnippet?: Snippet;
|
|
83
|
+
/**
|
|
84
|
+
* A Svelte Snippet rendered inside the input field, after the text.
|
|
85
|
+
*
|
|
86
|
+
* Use for complex content like icons or custom markup.
|
|
87
|
+
* For plain text, use `suffixText` instead.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* {#snippet suffix()}<EyeIcon />{/snippet}
|
|
91
|
+
* <TextInput suffixSnippet={suffix} />
|
|
92
|
+
*/
|
|
93
|
+
suffixSnippet?: Snippet;
|
|
94
|
+
/**
|
|
95
|
+
* A Svelte Snippet rendered outside and before the input field as an attached block.
|
|
96
|
+
*
|
|
97
|
+
* Use for complex content like icons or custom markup.
|
|
98
|
+
* For plain text, use `prependText` instead.
|
|
99
|
+
* Cannot be used together with `prefixSnippet`.
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* {#snippet prepend()}<span>https://</span>{/snippet}
|
|
103
|
+
* <TextInput prependSnippet={prepend} />
|
|
104
|
+
*/
|
|
105
|
+
prependSnippet?: Snippet;
|
|
106
|
+
/**
|
|
107
|
+
* Plain text rendered inside the input field, before the text.
|
|
108
|
+
*
|
|
109
|
+
* Use for simple symbols or short strings like `$` or `@`.
|
|
110
|
+
* For complex content, use `prefixSnippet` instead.
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* <TextInput prefixText="$" placeholder="0.00" />
|
|
114
|
+
*/
|
|
115
|
+
prefixText?: string;
|
|
116
|
+
/**
|
|
117
|
+
* Plain text rendered inside the input field, after the text.
|
|
118
|
+
*
|
|
119
|
+
* Use for simple strings like units or currency codes, e.g. `EUR` or `kg`.
|
|
120
|
+
* For complex content, use `suffixSnippet` instead.
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* <TextInput suffixText="EUR" placeholder="0.00" />
|
|
124
|
+
*/
|
|
125
|
+
suffixText?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Plain text rendered outside and before the input field as an attached block.
|
|
128
|
+
*
|
|
129
|
+
* Use for simple strings like `https://` or `+1`.
|
|
130
|
+
* For complex content, use `prependSnippet` instead.
|
|
131
|
+
* Cannot be used together with `prefixText`.
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* <TextInput prependText="https://" placeholder="example.com" />
|
|
135
|
+
*/
|
|
136
|
+
prependText?: string;
|
|
137
|
+
}
|
|
138
|
+
declare const TextInput: import("svelte").Component<Props, {}, "value">;
|
|
139
|
+
type TextInput = ReturnType<typeof TextInput>;
|
|
140
|
+
export default TextInput;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import "@ibis-design/css/components/textlink.css";
|
|
3
|
+
import type { HTMLAnchorAttributes } from "svelte/elements";
|
|
4
|
+
import type { Snippet } from "svelte";
|
|
5
|
+
|
|
6
|
+
interface Props extends HTMLAnchorAttributes {
|
|
7
|
+
href?: string;
|
|
8
|
+
target?: "_self" | "_blank" | "_parent" | "_top";
|
|
9
|
+
underline?: "always" | "hover" | "none";
|
|
10
|
+
linkSize?: "sm" | "md" | "lg";
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
loading?: boolean;
|
|
13
|
+
skeleton?: boolean;
|
|
14
|
+
label?: string;
|
|
15
|
+
children?: Snippet;
|
|
16
|
+
iconPrefix?: Snippet;
|
|
17
|
+
iconSuffix?: Snippet;
|
|
18
|
+
iconPrefixText?: string;
|
|
19
|
+
iconSuffixText?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let {
|
|
23
|
+
href,
|
|
24
|
+
target,
|
|
25
|
+
underline = "hover",
|
|
26
|
+
linkSize = "md",
|
|
27
|
+
disabled = false,
|
|
28
|
+
loading = false,
|
|
29
|
+
skeleton = false,
|
|
30
|
+
rel,
|
|
31
|
+
label,
|
|
32
|
+
children,
|
|
33
|
+
iconPrefix,
|
|
34
|
+
iconSuffix,
|
|
35
|
+
iconPrefixText,
|
|
36
|
+
iconSuffixText,
|
|
37
|
+
...rest
|
|
38
|
+
}: Props = $props();
|
|
39
|
+
|
|
40
|
+
const computedRel = $derived(target === "_blank" ? (rel ?? "noopener noreferrer") : rel);
|
|
41
|
+
|
|
42
|
+
$effect(() => {
|
|
43
|
+
if (disabled && href) {
|
|
44
|
+
console.warn("Disabled links should not have an href");
|
|
45
|
+
}
|
|
46
|
+
if (iconPrefix && iconPrefixText) {
|
|
47
|
+
console.warn("iconPrefix snippet takes priority over iconPrefixText when both are provided.");
|
|
48
|
+
}
|
|
49
|
+
if (iconSuffix && iconSuffixText) {
|
|
50
|
+
console.warn("iconSuffix snippet takes priority over iconSuffixText when both are provided.");
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<a
|
|
56
|
+
{...rest}
|
|
57
|
+
// href={disabled || skeleton ? undefined : href}
|
|
58
|
+
{target}
|
|
59
|
+
rel={computedRel}
|
|
60
|
+
aria-disabled={disabled || skeleton}
|
|
61
|
+
aria-busy={loading}
|
|
62
|
+
class=" ibis-link
|
|
63
|
+
ibis-link--{linkSize}
|
|
64
|
+
ibis-link--underline-{underline}
|
|
65
|
+
{disabled ? 'ibis-link--disabled' : ''}
|
|
66
|
+
{loading ? 'ibis-link--loading' : ''}
|
|
67
|
+
{skeleton ? 'ibis-link--skeleton' : ''}">
|
|
68
|
+
{#if iconPrefix || iconPrefixText}
|
|
69
|
+
<span class="ibis-link__icon ibis-link--prefix">
|
|
70
|
+
{#if iconPrefix}
|
|
71
|
+
{@render iconPrefix()}
|
|
72
|
+
{:else}
|
|
73
|
+
{iconPrefixText}
|
|
74
|
+
{/if}
|
|
75
|
+
</span>
|
|
76
|
+
{/if}
|
|
77
|
+
|
|
78
|
+
<span
|
|
79
|
+
class="ibis-link__content
|
|
80
|
+
{loading ? 'ibis-link__content--hidden' : ''}
|
|
81
|
+
{skeleton ? 'ibis-link__content--skeleton' : ''}">
|
|
82
|
+
{#if children}
|
|
83
|
+
{@render children?.()}
|
|
84
|
+
{:else if label}
|
|
85
|
+
{label}
|
|
86
|
+
{/if}
|
|
87
|
+
</span>
|
|
88
|
+
|
|
89
|
+
{#if iconSuffix || iconSuffixText}
|
|
90
|
+
<span class="ibis-link__icon ibis-link--suffix">
|
|
91
|
+
{#if iconSuffix}
|
|
92
|
+
{@render iconSuffix()}
|
|
93
|
+
{:else}
|
|
94
|
+
{iconSuffixText}
|
|
95
|
+
{/if}
|
|
96
|
+
</span>
|
|
97
|
+
{/if}
|
|
98
|
+
|
|
99
|
+
{#if loading}
|
|
100
|
+
<span class="ibis-link__loader" aria-hidden="true"></span>
|
|
101
|
+
{/if}
|
|
102
|
+
</a>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import "@ibis-design/css/components/textlink.css";
|
|
2
|
+
import type { HTMLAnchorAttributes } from "svelte/elements";
|
|
3
|
+
import type { Snippet } from "svelte";
|
|
4
|
+
interface Props extends HTMLAnchorAttributes {
|
|
5
|
+
href?: string;
|
|
6
|
+
target?: "_self" | "_blank" | "_parent" | "_top";
|
|
7
|
+
underline?: "always" | "hover" | "none";
|
|
8
|
+
linkSize?: "sm" | "md" | "lg";
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
loading?: boolean;
|
|
11
|
+
skeleton?: boolean;
|
|
12
|
+
label?: string;
|
|
13
|
+
children?: Snippet;
|
|
14
|
+
iconPrefix?: Snippet;
|
|
15
|
+
iconSuffix?: Snippet;
|
|
16
|
+
iconPrefixText?: string;
|
|
17
|
+
iconSuffixText?: string;
|
|
18
|
+
}
|
|
19
|
+
declare const TextLink: import("svelte").Component<Props, {}, "">;
|
|
20
|
+
type TextLink = ReturnType<typeof TextLink>;
|
|
21
|
+
export default TextLink;
|
package/dist/index.d.ts
CHANGED
|
@@ -13,23 +13,24 @@
|
|
|
13
13
|
*
|
|
14
14
|
* @packageDocumentation
|
|
15
15
|
*/
|
|
16
|
-
export { default as Button } from
|
|
17
|
-
export { default as DropdownButton } from
|
|
18
|
-
export { default as Card } from
|
|
19
|
-
export { default as AuthLayout } from
|
|
20
|
-
export { default as AppLayout } from
|
|
21
|
-
export { default as DashboardLayout } from
|
|
22
|
-
export { default as
|
|
23
|
-
export { default as
|
|
24
|
-
export { default as
|
|
25
|
-
export { default as
|
|
26
|
-
export { default as
|
|
27
|
-
export { default as
|
|
28
|
-
export { default as
|
|
29
|
-
export { default as
|
|
30
|
-
export { default as
|
|
31
|
-
export { default as
|
|
32
|
-
export { default as
|
|
33
|
-
export { default as
|
|
34
|
-
export { default as
|
|
35
|
-
export
|
|
16
|
+
export { default as Button } from "./components/buttons/Button.svelte";
|
|
17
|
+
export { default as DropdownButton } from "./components/buttons/DropdownButton.svelte";
|
|
18
|
+
export { default as Card } from "./components/containers/Card.svelte";
|
|
19
|
+
export { default as AuthLayout } from "./layouts/AuthLayout.svelte";
|
|
20
|
+
export { default as AppLayout } from "./layouts/AppLayout.svelte";
|
|
21
|
+
export { default as DashboardLayout } from "./layouts/DashboardLayout.svelte";
|
|
22
|
+
export { default as Dropdown } from "./components/inputs/Dropdown.svelte";
|
|
23
|
+
export { default as Chips } from "./components/inputs/Chips.svelte";
|
|
24
|
+
export { default as TextInput } from "./components/inputs/TextInput.svelte";
|
|
25
|
+
export { default as TextArea } from "./components/inputs/TextArea.svelte";
|
|
26
|
+
export { default as Checkbox } from "./components/inputs/Checkbox.svelte";
|
|
27
|
+
export { default as Radio } from "./components/inputs/Radio.svelte";
|
|
28
|
+
export { default as Switch } from "./components/inputs/Switch.svelte";
|
|
29
|
+
export { default as Banner } from "./components/containers/Banner.svelte";
|
|
30
|
+
export { default as PillTab } from "./components/buttons/PillTab.svelte";
|
|
31
|
+
export { default as Toaster } from "./components/containers/Toaster.svelte";
|
|
32
|
+
export { default as TextLink } from "./components/inputs/TextLink.svelte";
|
|
33
|
+
export { default as TipIndicator } from "./components/containers/TipIndicator.svelte";
|
|
34
|
+
export { default as PillTabs } from "./components/containers/PillTabs.svelte";
|
|
35
|
+
export { default as Tooltip } from "./components/containers/Tooltip.svelte";
|
|
36
|
+
export * from "./types/index";
|