@flightlesslabs/dodo-ui 0.17.2 → 0.19.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/dist/index.d.ts +8 -1
- package/dist/index.js +4 -0
- package/dist/stories/components/Form/DatePicker/DatePicker.svelte +1 -0
- package/dist/stories/components/Form/NumericInput/NumericInput.svelte +1 -0
- package/dist/stories/components/Form/PasswordInput/PasswordInput.svelte +1 -0
- package/dist/stories/components/Form/Search/Events/Events.stories.svelte +137 -0
- package/dist/stories/components/Form/Search/Events/Events.stories.svelte.d.ts +18 -0
- package/dist/stories/components/Form/Search/Roundness/Roundness.stories.svelte +21 -0
- package/dist/stories/components/Form/Search/Roundness/Roundness.stories.svelte.d.ts +26 -0
- package/dist/stories/components/Form/Search/Search.stories.svelte +40 -0
- package/dist/stories/components/Form/Search/Search.stories.svelte.d.ts +21 -0
- package/dist/stories/components/Form/Search/Search.svelte +142 -0
- package/dist/stories/components/Form/Search/Search.svelte.d.ts +66 -0
- package/dist/stories/components/Form/Search/SearchIcon/SearchIcon.stories.svelte +27 -0
- package/dist/stories/components/Form/Search/SearchIcon/SearchIcon.stories.svelte.d.ts +26 -0
- package/dist/stories/components/Form/Search/Size/Size.stories.svelte +17 -0
- package/dist/stories/components/Form/Search/Size/Size.stories.svelte.d.ts +26 -0
- package/dist/stories/components/Form/Search/WithIcon/WithIcon.stories.svelte +47 -0
- package/dist/stories/components/Form/Search/WithIcon/WithIcon.stories.svelte.d.ts +26 -0
- package/dist/stories/components/Form/Select/Select.svelte +1 -0
- package/dist/stories/components/Form/Select/Select.svelte.d.ts +4 -4
- package/dist/stories/components/Form/TextInput/TextInput.svelte +1 -0
- package/dist/stories/components/Layout/Accordian/Accordian.stories.svelte +52 -0
- package/dist/stories/components/Layout/Accordian/Accordian.stories.svelte.d.ts +21 -0
- package/dist/stories/components/Layout/Accordian/Accordian.svelte +121 -0
- package/dist/stories/components/Layout/Accordian/Accordian.svelte.d.ts +34 -0
- package/dist/stories/components/Layout/Accordian/Customize/Customize.stories.svelte +69 -0
- package/dist/stories/components/Layout/Accordian/Customize/Customize.stories.svelte.d.ts +18 -0
- package/dist/stories/components/Layout/Accordian/Events/Events.stories.svelte +30 -0
- package/dist/stories/components/Layout/Accordian/Events/Events.stories.svelte.d.ts +18 -0
- package/dist/stories/components/Layout/Accordian/Size/Size.stories.svelte +48 -0
- package/dist/stories/components/Layout/Accordian/Size/Size.stories.svelte.d.ts +26 -0
- package/dist/stories/developer tools/components/UtilityIcon/Size/Size.stories.svelte +25 -0
- package/dist/stories/developer tools/components/UtilityIcon/Size/Size.stories.svelte.d.ts +26 -0
- package/dist/stories/developer tools/components/UtilityIcon/UtilityIcon.stories.svelte +26 -0
- package/dist/stories/developer tools/components/UtilityIcon/UtilityIcon.stories.svelte.d.ts +21 -0
- package/dist/stories/developer tools/components/UtilityIcon/UtilityIcon.svelte +58 -0
- package/dist/stories/developer tools/components/UtilityIcon/UtilityIcon.svelte.d.ts +19 -0
- package/dist/types/special.d.ts +1 -0
- package/dist/types/special.js +1 -0
- package/package.json +11 -11
- package/src/lib/index.ts +14 -5
- package/src/lib/stories/components/Form/DatePicker/DatePicker.svelte +1 -0
- package/src/lib/stories/components/Form/NumericInput/NumericInput.svelte +1 -0
- package/src/lib/stories/components/Form/PasswordInput/PasswordInput.svelte +1 -0
- package/src/lib/stories/components/Form/Search/Search.svelte +285 -0
- package/src/lib/stories/components/Form/Select/Select.svelte +5 -5
- package/src/lib/stories/components/Form/TextInput/TextInput.svelte +1 -0
- package/src/lib/stories/components/Layout/Accordian/Accordian.svelte +195 -0
- package/src/lib/stories/developer tools/components/UtilityIcon/UtilityIcon.svelte +90 -0
- package/src/lib/types/special.ts +1 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { ComponentSize } from '$lib/types/size.js';
|
|
3
|
+
import type { IconPosition } from '$lib/types/special.js';
|
|
4
|
+
import Icon from '@iconify/svelte';
|
|
5
|
+
import { onMount, type Snippet } from 'svelte';
|
|
6
|
+
import type { EventHandler } from 'svelte/elements';
|
|
7
|
+
|
|
8
|
+
export type AccordianToggleEvent = Event & {
|
|
9
|
+
currentTarget: EventTarget & HTMLDetailsElement;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export interface AccordianProps {
|
|
13
|
+
/** Contents goes here */
|
|
14
|
+
children?: Snippet;
|
|
15
|
+
/** Accordian summary */
|
|
16
|
+
summary?: Snippet;
|
|
17
|
+
/** summary full width */
|
|
18
|
+
fullWidthSummary?: boolean;
|
|
19
|
+
/** Accordian ref */
|
|
20
|
+
ref?: HTMLDetailsElement;
|
|
21
|
+
/** Custom css class */
|
|
22
|
+
class?: string;
|
|
23
|
+
/** The toggle event handler */
|
|
24
|
+
ontoggle?: EventHandler<Event, HTMLDetailsElement>;
|
|
25
|
+
/** Open state, for dynmaic Accordians */
|
|
26
|
+
open?: boolean;
|
|
27
|
+
/** default Open, for static Accordians */
|
|
28
|
+
defaultOpen?: boolean;
|
|
29
|
+
/** How large should the button be? */
|
|
30
|
+
size?: ComponentSize;
|
|
31
|
+
/** Select Dropdown Arrow Position */
|
|
32
|
+
dropdownArrowPosition?: IconPosition;
|
|
33
|
+
/** Dropdown Arrow Icon */
|
|
34
|
+
customDropdownArrowIcon?: (open: boolean) => Snippet;
|
|
35
|
+
}
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<script lang="ts">
|
|
39
|
+
let {
|
|
40
|
+
class: className = '',
|
|
41
|
+
ref = $bindable<HTMLDetailsElement>(),
|
|
42
|
+
ontoggle,
|
|
43
|
+
open = $bindable<boolean>(),
|
|
44
|
+
defaultOpen,
|
|
45
|
+
summary,
|
|
46
|
+
children,
|
|
47
|
+
size = 'normal',
|
|
48
|
+
fullWidthSummary = false,
|
|
49
|
+
customDropdownArrowIcon: customDropdownArrowIconInternal,
|
|
50
|
+
dropdownArrowPosition = 'before',
|
|
51
|
+
}: AccordianProps = $props();
|
|
52
|
+
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
54
|
+
let customDropdownArrowIconTyped = customDropdownArrowIconInternal as any;
|
|
55
|
+
|
|
56
|
+
let isUserInteraction = $state(false);
|
|
57
|
+
|
|
58
|
+
function ontoggleMod(e: AccordianToggleEvent) {
|
|
59
|
+
if (isUserInteraction) {
|
|
60
|
+
if (ontoggle) {
|
|
61
|
+
ontoggle(e);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
isUserInteraction = false;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function onsummaryclick() {
|
|
69
|
+
isUserInteraction = true;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
onMount(() => {
|
|
73
|
+
if (open === true) {
|
|
74
|
+
ref.open = true;
|
|
75
|
+
} else if (open === false) {
|
|
76
|
+
ref.open = false;
|
|
77
|
+
} else if (defaultOpen === true) {
|
|
78
|
+
ref.open = true;
|
|
79
|
+
} else if (defaultOpen === false) {
|
|
80
|
+
ref.open = false;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
{#snippet dropdownArrowIcon()}
|
|
86
|
+
{#if customDropdownArrowIconTyped}
|
|
87
|
+
{@render customDropdownArrowIconTyped(open)}
|
|
88
|
+
{:else}
|
|
89
|
+
<div class="IconOpen">
|
|
90
|
+
<Icon icon="material-symbols:arrow-drop-up-rounded" width="32" height="32" />
|
|
91
|
+
</div>
|
|
92
|
+
<div class="IconClose">
|
|
93
|
+
<Icon icon="material-symbols:arrow-drop-down-rounded" width="32" height="32" />
|
|
94
|
+
</div>
|
|
95
|
+
{/if}
|
|
96
|
+
{/snippet}
|
|
97
|
+
|
|
98
|
+
<details
|
|
99
|
+
class:fullWidthSummary
|
|
100
|
+
class={['dodo-ui-Accordian', `size--${size}`, className].join(' ')}
|
|
101
|
+
bind:this={ref}
|
|
102
|
+
{open}
|
|
103
|
+
ontoggle={ontoggleMod}
|
|
104
|
+
>
|
|
105
|
+
{#if summary}
|
|
106
|
+
<summary onclick={onsummaryclick}>
|
|
107
|
+
{#if dropdownArrowPosition === 'before'}
|
|
108
|
+
<div class:open class="DropdownArrow before">
|
|
109
|
+
{@render dropdownArrowIcon()}
|
|
110
|
+
</div>
|
|
111
|
+
{/if}
|
|
112
|
+
{@render summary()}
|
|
113
|
+
{#if dropdownArrowPosition === 'after'}
|
|
114
|
+
<div class:open class="DropdownArrow after">
|
|
115
|
+
{@render dropdownArrowIcon()}
|
|
116
|
+
</div>
|
|
117
|
+
{/if}
|
|
118
|
+
</summary>
|
|
119
|
+
{/if}
|
|
120
|
+
|
|
121
|
+
{#if children}
|
|
122
|
+
<div class="AccordianContent">
|
|
123
|
+
{@render children()}
|
|
124
|
+
</div>
|
|
125
|
+
{/if}
|
|
126
|
+
</details>
|
|
127
|
+
|
|
128
|
+
<style lang="scss">
|
|
129
|
+
.dodo-ui-Accordian {
|
|
130
|
+
color: var(--dodo-color-neutral-900);
|
|
131
|
+
width: 100%;
|
|
132
|
+
|
|
133
|
+
summary {
|
|
134
|
+
display: inline-flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
cursor: pointer;
|
|
137
|
+
user-select: none;
|
|
138
|
+
font-weight: 500;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
&.fullWidthSummary {
|
|
142
|
+
summary {
|
|
143
|
+
display: flex;
|
|
144
|
+
width: 100%;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
&[open] {
|
|
149
|
+
.IconOpen {
|
|
150
|
+
display: flex;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.IconClose {
|
|
154
|
+
display: none;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
&:not([open]) {
|
|
159
|
+
.IconOpen {
|
|
160
|
+
display: none;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.IconClose {
|
|
164
|
+
display: flex;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
&.size {
|
|
169
|
+
&--normal {
|
|
170
|
+
summary {
|
|
171
|
+
font-size: 1rem;
|
|
172
|
+
min-height: var(--dodo-ui-element-height-normal);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
&--small {
|
|
177
|
+
summary {
|
|
178
|
+
font-size: 0.9rem;
|
|
179
|
+
min-height: var(--dodo-ui-element-height-small);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
&--large {
|
|
184
|
+
summary {
|
|
185
|
+
font-size: 1.1rem;
|
|
186
|
+
min-height: var(--dodo-ui-element-height-large);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.AccordianContent {
|
|
192
|
+
margin-top: var(--dodo-ui-space);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
</style>
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { ComponentSize } from '$lib/types/size.js';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
|
|
5
|
+
export interface UtilityIconProps {
|
|
6
|
+
/** Button contents goes here*/
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
/** Button ref */
|
|
9
|
+
ref?: HTMLSpanElement;
|
|
10
|
+
/** How large should the button be? */
|
|
11
|
+
size?: ComponentSize;
|
|
12
|
+
/** Button disabled state */
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
/** Id */
|
|
15
|
+
id?: string;
|
|
16
|
+
/** Custom css class*/
|
|
17
|
+
class?: string;
|
|
18
|
+
}
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<script lang="ts">
|
|
22
|
+
let {
|
|
23
|
+
children,
|
|
24
|
+
size = 'normal',
|
|
25
|
+
id,
|
|
26
|
+
class: className = '',
|
|
27
|
+
disabled = false,
|
|
28
|
+
ref = $bindable<HTMLButtonElement>(),
|
|
29
|
+
}: UtilityIconProps = $props();
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<span
|
|
33
|
+
class={['dodo-ui-UtilityIcon', `size--${size}`, className].join(' ')}
|
|
34
|
+
class:disabled
|
|
35
|
+
{id}
|
|
36
|
+
bind:this={ref}
|
|
37
|
+
>
|
|
38
|
+
{#if children}
|
|
39
|
+
{@render children()}
|
|
40
|
+
{/if}
|
|
41
|
+
</span>
|
|
42
|
+
|
|
43
|
+
<style lang="scss">
|
|
44
|
+
:global(:root) {
|
|
45
|
+
--dodo-ui-UtilityIcon-disabled-color: var(--dodo-color-neutral-400);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
:global(.dodo-theme--dark) {
|
|
49
|
+
--dodo-ui-UtilityIcon-disabled-color: var(--dodo-color-neutral-500);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.dodo-ui-UtilityIcon {
|
|
53
|
+
outline: none;
|
|
54
|
+
transition: all 150ms;
|
|
55
|
+
text-decoration: none;
|
|
56
|
+
margin: 0;
|
|
57
|
+
display: inline-flex;
|
|
58
|
+
justify-content: center;
|
|
59
|
+
align-items: center;
|
|
60
|
+
font-family: inherit;
|
|
61
|
+
background-color: transparent;
|
|
62
|
+
color: var(--dodo-color-neutral-600);
|
|
63
|
+
font-family: inherit;
|
|
64
|
+
|
|
65
|
+
&.size {
|
|
66
|
+
&--normal {
|
|
67
|
+
height: var(--dodo-ui-element-height-normal);
|
|
68
|
+
width: var(--dodo-ui-element-height-normal);
|
|
69
|
+
font-size: 1rem;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&--small {
|
|
73
|
+
height: var(--dodo-ui-element-height-small);
|
|
74
|
+
width: var(--dodo-ui-element-height-small);
|
|
75
|
+
font-size: 0.9rem;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&--large {
|
|
79
|
+
height: var(--dodo-ui-element-height-large);
|
|
80
|
+
width: var(--dodo-ui-element-height-large);
|
|
81
|
+
font-size: 1.1rem;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&.disabled {
|
|
86
|
+
cursor: initial;
|
|
87
|
+
color: var(--dodo-ui-UtilityIcon-disabled-color);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type IconPosition = false | 'before' | 'after';
|