@iroco/ui 1.0.0-9 → 1.0.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 +7 -5
- package/dist/Alert.stories.svelte +19 -20
- package/dist/Alert.stories.svelte.d.ts +17 -35
- package/dist/Alert.svelte +12 -5
- package/dist/Alert.svelte.d.ts +7 -18
- package/dist/Button.stories.svelte +16 -12
- package/dist/Button.stories.svelte.d.ts +17 -43
- package/dist/Button.svelte +41 -12
- package/dist/Button.svelte.d.ts +20 -38
- package/dist/DataTable.stories.svelte +24 -19
- package/dist/DataTable.stories.svelte.d.ts +17 -27
- package/dist/DataTable.svelte +40 -25
- package/dist/DataTable.svelte.d.ts +17 -24
- package/dist/IconBurger.stories.svelte +8 -12
- package/dist/IconBurger.stories.svelte.d.ts +17 -46
- package/dist/IconBurger.svelte +7 -2
- package/dist/IconBurger.svelte.d.ts +6 -16
- package/dist/IconClose.stories.svelte +6 -12
- package/dist/IconClose.stories.svelte.d.ts +17 -46
- package/dist/IconClose.svelte +7 -2
- package/dist/IconClose.svelte.d.ts +6 -16
- package/dist/IconFloppyDisk.stories.svelte +4 -11
- package/dist/IconFloppyDisk.stories.svelte.d.ts +17 -53
- package/dist/IconFloppyDisk.svelte +8 -3
- package/dist/IconFloppyDisk.svelte.d.ts +7 -17
- package/dist/IconInfo.stories.svelte +8 -11
- package/dist/IconInfo.stories.svelte.d.ts +17 -48
- package/dist/IconInfo.svelte +7 -2
- package/dist/IconInfo.svelte.d.ts +6 -16
- package/dist/IconIrocoLogo.stories.svelte +8 -8
- package/dist/IconIrocoLogo.stories.svelte.d.ts +17 -55
- package/dist/IconIrocoLogo.svelte +16 -6
- package/dist/IconIrocoLogo.svelte.d.ts +9 -19
- package/dist/IconMoreSign.stories.svelte +7 -14
- package/dist/IconMoreSign.stories.svelte.d.ts +17 -48
- package/dist/IconMoreSign.svelte +7 -2
- package/dist/IconMoreSign.svelte.d.ts +6 -16
- package/dist/IconTrashCan.stories.svelte +6 -12
- package/dist/IconTrashCan.stories.svelte.d.ts +17 -48
- package/dist/IconTrashCan.svelte +8 -3
- package/dist/IconTrashCan.svelte.d.ts +7 -17
- package/dist/ImageArticle.stories.svelte +11 -8
- package/dist/ImageArticle.stories.svelte.d.ts +17 -64
- package/dist/ImageArticle.svelte +37 -165
- package/dist/ImageArticle.svelte.d.ts +11 -21
- package/dist/IrocoLogo.stories.svelte +12 -7
- package/dist/IrocoLogo.stories.svelte.d.ts +17 -48
- package/dist/IrocoLogo.svelte +13 -4
- package/dist/IrocoLogo.svelte.d.ts +8 -18
- package/dist/Loader.stories.svelte +11 -8
- package/dist/Loader.stories.svelte.d.ts +17 -27
- package/dist/Loader.svelte +19 -18
- package/dist/Loader.svelte.d.ts +16 -12
- package/dist/NavBar.stories.svelte +29 -20
- package/dist/NavBar.stories.svelte.d.ts +17 -35
- package/dist/NavBar.svelte +51 -183
- package/dist/NavBar.svelte.d.ts +31 -20
- package/dist/Navigation.stories.svelte +30 -28
- package/dist/Navigation.stories.svelte.d.ts +17 -57
- package/dist/Navigation.svelte +32 -14
- package/dist/Navigation.svelte.d.ts +18 -20
- package/dist/NumberInput.stories.svelte +12 -7
- package/dist/NumberInput.stories.svelte.d.ts +17 -75
- package/dist/NumberInput.svelte +26 -8
- package/dist/NumberInput.svelte.d.ts +13 -24
- package/dist/RadioButton.stories.svelte +17 -30
- package/dist/RadioButton.stories.svelte.d.ts +17 -54
- package/dist/RadioButton.svelte +25 -11
- package/dist/RadioButton.svelte.d.ts +10 -20
- package/dist/SlottedComponentWrapper.svelte +4 -4
- package/dist/SlottedComponentWrapper.svelte.d.ts +4 -22
- package/dist/TextInput.stories.svelte +24 -47
- package/dist/TextInput.stories.svelte.d.ts +17 -109
- package/dist/TextInput.svelte +46 -25
- package/dist/TextInput.svelte.d.ts +19 -30
- package/dist/definition.d.ts +0 -5
- package/dist/definition.js +0 -11
- package/dist/index.d.ts +14 -10
- package/dist/index.js +14 -10
- package/dist/scss/button.scss +7 -3
- package/dist/scss/colors.scss +21 -11
- package/dist/scss/fields/_input.scss +1 -1
- package/dist/scss/fields/_style.scss +2 -2
- package/package.json +49 -48
- package/dist/RadioButtonTest.svelte +0 -10
- package/dist/RadioButtonTest.svelte.d.ts +0 -19
|
@@ -1,37 +1,19 @@
|
|
|
1
|
-
export namespace meta {
|
|
2
|
-
export let title: string;
|
|
3
|
-
export { NavBar as component };
|
|
4
|
-
export namespace argTypes {
|
|
5
|
-
namespace type {
|
|
6
|
-
namespace control {
|
|
7
|
-
let type_1: string;
|
|
8
|
-
export { type_1 as type };
|
|
9
|
-
}
|
|
10
|
-
let options: string[];
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
/** @typedef {typeof __propDef.props} NavBarProps */
|
|
15
|
-
/** @typedef {typeof __propDef.events} NavBarEvents */
|
|
16
|
-
/** @typedef {typeof __propDef.slots} NavBarSlots */
|
|
17
|
-
export default class NavBar extends SvelteComponent<{
|
|
18
|
-
[x: string]: never;
|
|
19
|
-
}, {
|
|
20
|
-
[evt: string]: CustomEvent<any>;
|
|
21
|
-
}, {}> {
|
|
22
|
-
}
|
|
23
|
-
export type NavBarProps = typeof __propDef.props;
|
|
24
|
-
export type NavBarEvents = typeof __propDef.events;
|
|
25
|
-
export type NavBarSlots = typeof __propDef.slots;
|
|
26
1
|
import { NavBar } from './index';
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
2
|
+
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> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
31
12
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const NavBar: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {}, {}, string>;
|
|
18
|
+
type NavBar = InstanceType<typeof NavBar>;
|
|
19
|
+
export default NavBar;
|
package/dist/NavBar.svelte
CHANGED
|
@@ -1,32 +1,43 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { createBubbler } from 'svelte/legacy';
|
|
3
|
+
|
|
4
|
+
const bubble = createBubbler();
|
|
5
|
+
import { IconClose } from './index';
|
|
6
|
+
import { createEventDispatcher } from 'svelte';
|
|
7
|
+
import { NavigationItemType, NavigationItem } from './definition.js';
|
|
8
|
+
|
|
9
|
+
interface Props {
|
|
10
|
+
navigationItems: Array<NavigationItem>;
|
|
11
|
+
type: 'sidebar' | 'topbar';
|
|
12
|
+
version?: string | null;
|
|
13
|
+
navigating?: { to: { url: { pathname: string } } } | null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
let { navigationItems, type, version = null, navigating = null }: Props = $props();
|
|
18
|
+
|
|
19
|
+
const dispatch = createEventDispatcher();
|
|
20
|
+
|
|
21
|
+
const handleClickLink = (menuItem: NavigationItem) => {
|
|
22
|
+
if (typeof menuItem.hrefOrCallback === 'function') {
|
|
23
|
+
menuItem.hrefOrCallback();
|
|
24
|
+
return false; // to avoid calling href
|
|
25
|
+
}
|
|
26
|
+
dispatch('click_link');
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
function isActive(current: string, item: NavigationItem): boolean {
|
|
30
|
+
if (typeof item.hrefOrCallback === 'string') {
|
|
31
|
+
return item.hrefOrCallback === current;
|
|
32
|
+
}
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
let active = $derived(navigating?.to.url.pathname ?? '');
|
|
26
37
|
</script>
|
|
27
38
|
|
|
28
39
|
<nav data-testid={type} class="nav__{type}">
|
|
29
|
-
<button title="Close menu"
|
|
40
|
+
<button title="Close menu" onclick={bubble('click')} class="nav__{type}__close">
|
|
30
41
|
<IconClose width="3em" height="3em" />
|
|
31
42
|
</button>
|
|
32
43
|
|
|
@@ -39,7 +50,7 @@ $:
|
|
|
39
50
|
</form>
|
|
40
51
|
{:else}
|
|
41
52
|
<a
|
|
42
|
-
|
|
53
|
+
onclick={() => handleClickLink(item)}
|
|
43
54
|
href={typeof item.hrefOrCallback === 'string' ? item.hrefOrCallback : '#'}
|
|
44
55
|
class:iroco-ui-button={item.type === NavigationItemType.BUTTON}
|
|
45
56
|
class:iroco-ui-button--small={item.type === NavigationItemType.BUTTON}
|
|
@@ -106,6 +117,7 @@ $:
|
|
|
106
117
|
max-width: calc(100% - 20px);
|
|
107
118
|
}
|
|
108
119
|
}
|
|
120
|
+
|
|
109
121
|
.container-large {
|
|
110
122
|
width: calc(100% - 20px);
|
|
111
123
|
max-width: 1280px;
|
|
@@ -148,6 +160,7 @@ $:
|
|
|
148
160
|
max-width: calc(100% - 20px);
|
|
149
161
|
}
|
|
150
162
|
}
|
|
163
|
+
|
|
151
164
|
.container-medium {
|
|
152
165
|
width: calc(100% - 20px);
|
|
153
166
|
max-width: 884px;
|
|
@@ -185,6 +198,7 @@ $:
|
|
|
185
198
|
max-width: calc(100% - 20px);
|
|
186
199
|
}
|
|
187
200
|
}
|
|
201
|
+
|
|
188
202
|
.container-small {
|
|
189
203
|
width: calc(100% - 20px);
|
|
190
204
|
max-width: 496px;
|
|
@@ -207,159 +221,7 @@ $:
|
|
|
207
221
|
max-width: calc(100% - 20px);
|
|
208
222
|
}
|
|
209
223
|
}
|
|
210
|
-
|
|
211
|
-
width: calc(100% - 20px);
|
|
212
|
-
max-width: 2360px;
|
|
213
|
-
margin-left: auto;
|
|
214
|
-
margin-right: auto;
|
|
215
|
-
transition: max-width ease-out 200ms;
|
|
216
|
-
}
|
|
217
|
-
@media all and (max-width: 2560px) {
|
|
218
|
-
.container-wide {
|
|
219
|
-
max-width: 1620px;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
@media all and (max-width: 1800px) {
|
|
223
|
-
.container-wide {
|
|
224
|
-
max-width: 1280px;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
@media all and (max-width: 1440px) {
|
|
228
|
-
.container-wide {
|
|
229
|
-
max-width: 884px;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
@media all and (max-width: 1024px) {
|
|
233
|
-
.container-wide {
|
|
234
|
-
max-width: 648px;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
@media all and (max-width: 768px) {
|
|
238
|
-
.container-wide {
|
|
239
|
-
max-width: 496px;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
@media all and (max-width: 596px) {
|
|
243
|
-
.container-wide {
|
|
244
|
-
max-width: 365px;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
@media all and (max-width: 425px) {
|
|
248
|
-
.container-wide {
|
|
249
|
-
max-width: calc(100% - 60px);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
@media all and (max-width: 375px) {
|
|
253
|
-
.container-wide {
|
|
254
|
-
max-width: calc(100% - 40px);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
@media all and (max-width: 320px) {
|
|
258
|
-
.container-wide {
|
|
259
|
-
max-width: calc(100% - 20px);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
.container-large {
|
|
263
|
-
width: calc(100% - 20px);
|
|
264
|
-
max-width: 1280px;
|
|
265
|
-
margin-left: auto;
|
|
266
|
-
margin-right: auto;
|
|
267
|
-
transition: max-width ease-out 200ms;
|
|
268
|
-
}
|
|
269
|
-
@media all and (max-width: 1440px) {
|
|
270
|
-
.container-large {
|
|
271
|
-
max-width: 884px;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
@media all and (max-width: 1024px) {
|
|
275
|
-
.container-large {
|
|
276
|
-
max-width: 648px;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
@media all and (max-width: 768px) {
|
|
280
|
-
.container-large {
|
|
281
|
-
max-width: 496px;
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
@media all and (max-width: 596px) {
|
|
285
|
-
.container-large {
|
|
286
|
-
max-width: 365px;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
@media all and (max-width: 425px) {
|
|
290
|
-
.container-large {
|
|
291
|
-
max-width: calc(100% - 60px);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
@media all and (max-width: 375px) {
|
|
295
|
-
.container-large {
|
|
296
|
-
max-width: calc(100% - 40px);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
@media all and (max-width: 320px) {
|
|
300
|
-
.container-large {
|
|
301
|
-
max-width: calc(100% - 20px);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
.container-medium {
|
|
305
|
-
width: calc(100% - 20px);
|
|
306
|
-
max-width: 884px;
|
|
307
|
-
margin-left: auto;
|
|
308
|
-
margin-right: auto;
|
|
309
|
-
transition: max-width ease-out 200ms;
|
|
310
|
-
}
|
|
311
|
-
@media all and (max-width: 1024px) {
|
|
312
|
-
.container-medium {
|
|
313
|
-
max-width: 648px;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
@media all and (max-width: 768px) {
|
|
317
|
-
.container-medium {
|
|
318
|
-
max-width: 496px;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
@media all and (max-width: 596px) {
|
|
322
|
-
.container-medium {
|
|
323
|
-
max-width: 365px;
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
@media all and (max-width: 425px) {
|
|
327
|
-
.container-medium {
|
|
328
|
-
max-width: calc(100% - 60px);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
@media all and (max-width: 375px) {
|
|
332
|
-
.container-medium {
|
|
333
|
-
max-width: calc(100% - 40px);
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
@media all and (max-width: 320px) {
|
|
337
|
-
.container-medium {
|
|
338
|
-
max-width: calc(100% - 20px);
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
.container-small {
|
|
342
|
-
width: calc(100% - 20px);
|
|
343
|
-
max-width: 496px;
|
|
344
|
-
margin-left: auto;
|
|
345
|
-
margin-right: auto;
|
|
346
|
-
transition: max-width ease-out 200ms;
|
|
347
|
-
}
|
|
348
|
-
@media all and (max-width: 425px) {
|
|
349
|
-
.container-small {
|
|
350
|
-
max-width: calc(100% - 60px);
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
@media all and (max-width: 375px) {
|
|
354
|
-
.container-small {
|
|
355
|
-
max-width: calc(100% - 40px);
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
@media all and (max-width: 320px) {
|
|
359
|
-
.container-small {
|
|
360
|
-
max-width: calc(100% - 20px);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
224
|
+
|
|
363
225
|
.iroco-ui-button {
|
|
364
226
|
cursor: pointer;
|
|
365
227
|
-webkit-touch-callout: none;
|
|
@@ -375,9 +237,9 @@ $:
|
|
|
375
237
|
border-radius: 0.3em;
|
|
376
238
|
}
|
|
377
239
|
.iroco-ui-button--basic {
|
|
378
|
-
color: var(--btn-
|
|
379
|
-
background: var(--btn-
|
|
380
|
-
border: 1px solid var(--btn-
|
|
240
|
+
color: var(--btn-secondary-label);
|
|
241
|
+
background: var(--btn-secondary-bg);
|
|
242
|
+
border: 1px solid var(--btn-secondary-border);
|
|
381
243
|
}
|
|
382
244
|
.iroco-ui-button--dark {
|
|
383
245
|
background: var(--dark-btn-primary-bg);
|
|
@@ -414,6 +276,10 @@ $:
|
|
|
414
276
|
.iroco-ui-button.disabled:hover, .iroco-ui-button:disabled:hover {
|
|
415
277
|
box-shadow: none;
|
|
416
278
|
}
|
|
279
|
+
.iroco-ui-button--full-width {
|
|
280
|
+
width: 100%;
|
|
281
|
+
}
|
|
282
|
+
|
|
417
283
|
.iroco-ui-link {
|
|
418
284
|
background: none;
|
|
419
285
|
border: none;
|
|
@@ -421,6 +287,7 @@ $:
|
|
|
421
287
|
color: var(--color-text);
|
|
422
288
|
cursor: pointer;
|
|
423
289
|
}
|
|
290
|
+
|
|
424
291
|
.nav__sidebar__item, .nav__topbar__item {
|
|
425
292
|
text-decoration: none;
|
|
426
293
|
display: block;
|
|
@@ -476,6 +343,7 @@ $:
|
|
|
476
343
|
padding-left: 2em;
|
|
477
344
|
color: var(--color-text-dark);
|
|
478
345
|
}
|
|
346
|
+
|
|
479
347
|
@media all and (max-width: 768px) {
|
|
480
348
|
.nav__sidebar, .nav__topbar {
|
|
481
349
|
position: fixed;
|
package/dist/NavBar.svelte.d.ts
CHANGED
|
@@ -1,22 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
1
|
+
import { NavigationItem } from './definition.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
navigationItems: Array<NavigationItem>;
|
|
4
|
+
type: 'sidebar' | 'topbar';
|
|
5
|
+
version?: string | null;
|
|
6
|
+
navigating?: {
|
|
7
|
+
to: {
|
|
8
|
+
url: {
|
|
9
|
+
pathname: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
} | null;
|
|
13
|
+
}
|
|
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: Props & {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
14
24
|
};
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
export type NavBarProps = typeof __propDef.props;
|
|
18
|
-
export type NavBarEvents = typeof __propDef.events;
|
|
19
|
-
export type NavBarSlots = typeof __propDef.slots;
|
|
20
|
-
export default class NavBar extends SvelteComponent<NavBarProps, NavBarEvents, NavBarSlots> {
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
21
26
|
}
|
|
22
|
-
|
|
27
|
+
declare const NavBar: $$__sveltets_2_IsomorphicComponent<Props, {
|
|
28
|
+
click_link: CustomEvent<any>;
|
|
29
|
+
} & {
|
|
30
|
+
[evt: string]: CustomEvent<any>;
|
|
31
|
+
}, {}, {}, "">;
|
|
32
|
+
type NavBar = InstanceType<typeof NavBar>;
|
|
33
|
+
export default NavBar;
|
|
@@ -1,48 +1,50 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import Navigation from './
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { Navigation } from './index';
|
|
3
3
|
import { NavigationItem, NavigationItemType } from './definition';
|
|
4
|
+
import { defineMeta, setTemplate } from '@storybook/addon-svelte-csf';
|
|
5
|
+
|
|
6
|
+
const { Story } = defineMeta({
|
|
7
|
+
|
|
4
8
|
|
|
5
|
-
export const meta = {
|
|
6
9
|
title: 'Navigation',
|
|
7
10
|
component: Navigation,
|
|
8
11
|
argTypes: {
|
|
9
|
-
type: {
|
|
10
|
-
control: { type: 'select' },
|
|
11
|
-
options: ['sidebar', 'topbar']
|
|
12
|
-
},
|
|
13
|
-
title: {
|
|
14
|
-
control: { type: 'text' }
|
|
15
|
-
},
|
|
16
|
-
version: {
|
|
17
|
-
control: { type: 'text' }
|
|
18
|
-
},
|
|
19
12
|
color: {
|
|
20
13
|
control: { type: 'color' }
|
|
21
14
|
}
|
|
15
|
+
},
|
|
16
|
+
args: {
|
|
17
|
+
type: 'topbar',
|
|
18
|
+
navigationItems: [
|
|
19
|
+
new NavigationItem('About', `/about`),
|
|
20
|
+
new NavigationItem('Foo', `/foo`),
|
|
21
|
+
new NavigationItem('Bar', `/bar`),
|
|
22
|
+
new NavigationItem('Button', `/bar`, NavigationItemType.BUTTON),
|
|
23
|
+
new NavigationItem('Anchor', `/bar`, NavigationItemType.ANCHOR),
|
|
24
|
+
new NavigationItem('Form', `/bar`, NavigationItemType.FORM)
|
|
25
|
+
]
|
|
22
26
|
}
|
|
23
|
-
};
|
|
27
|
+
});
|
|
24
28
|
</script>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
import { Story, Template } from '@storybook/addon-svelte-csf';
|
|
29
|
+
<script lang="ts">
|
|
30
|
+
setTemplate(template);
|
|
28
31
|
</script>
|
|
29
32
|
|
|
30
|
-
|
|
33
|
+
{#snippet template({ ...args })}
|
|
31
34
|
<Navigation
|
|
32
35
|
{...args}
|
|
33
|
-
navigationItems={[
|
|
34
|
-
new NavigationItem('About', `/about`),
|
|
35
|
-
new NavigationItem('Foo', `/foo`),
|
|
36
|
-
new NavigationItem('Bar', `/bar`),
|
|
37
|
-
new NavigationItem('Button', `/bar`, NavigationItemType.BUTTON),
|
|
38
|
-
new NavigationItem('Anchor', `/bar`, NavigationItemType.ANCHOR),
|
|
39
|
-
new NavigationItem('Form', `/bar`, NavigationItemType.FORM)
|
|
40
|
-
]}
|
|
41
36
|
/>
|
|
42
|
-
|
|
37
|
+
{/snippet}
|
|
43
38
|
|
|
44
39
|
<Story name="Default" />
|
|
45
40
|
<Story name="Sidebar" args={{ type: 'sidebar' }} />
|
|
46
|
-
|
|
47
41
|
<Story name="Title" args={{ title: 'Alternative title' }} />
|
|
48
42
|
<Story name="Color" args={{ color: '#ABCDEF' }} />
|
|
43
|
+
<Story name="Active" args={{
|
|
44
|
+
navigating:{to:{url:{pathname:"/bar"}}},
|
|
45
|
+
navigationItems: [
|
|
46
|
+
new NavigationItem('About', `/about`),
|
|
47
|
+
new NavigationItem('Foo', `/foo`),
|
|
48
|
+
new NavigationItem('Bar', `/bar`),
|
|
49
|
+
]
|
|
50
|
+
}} />
|
|
@@ -1,59 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
let type_2: string;
|
|
15
|
-
export { type_2 as type };
|
|
16
|
-
}
|
|
17
|
-
export { control_1 as control };
|
|
18
|
-
}
|
|
19
|
-
export { title_1 as title };
|
|
20
|
-
export namespace version {
|
|
21
|
-
export namespace control_2 {
|
|
22
|
-
let type_3: string;
|
|
23
|
-
export { type_3 as type };
|
|
24
|
-
}
|
|
25
|
-
export { control_2 as control };
|
|
26
|
-
}
|
|
27
|
-
export namespace color {
|
|
28
|
-
export namespace control_3 {
|
|
29
|
-
let type_4: string;
|
|
30
|
-
export { type_4 as type };
|
|
31
|
-
}
|
|
32
|
-
export { control_3 as control };
|
|
33
|
-
}
|
|
34
|
-
}
|
|
1
|
+
import { Navigation } from './index';
|
|
2
|
+
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> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
35
14
|
}
|
|
36
|
-
|
|
37
|
-
/** @typedef {typeof __propDef.events} NavigationEvents */
|
|
38
|
-
/** @typedef {typeof __propDef.slots} NavigationSlots */
|
|
39
|
-
export default class Navigation extends SvelteComponent<{
|
|
40
|
-
[x: string]: never;
|
|
41
|
-
}, {
|
|
15
|
+
declare const Navigation: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
42
16
|
[evt: string]: CustomEvent<any>;
|
|
43
|
-
}, {}
|
|
44
|
-
|
|
45
|
-
export
|
|
46
|
-
export type NavigationEvents = typeof __propDef.events;
|
|
47
|
-
export type NavigationSlots = typeof __propDef.slots;
|
|
48
|
-
import Navigation from './Navigation.svelte';
|
|
49
|
-
import { SvelteComponent } from "svelte";
|
|
50
|
-
declare const __propDef: {
|
|
51
|
-
props: {
|
|
52
|
-
[x: string]: never;
|
|
53
|
-
};
|
|
54
|
-
events: {
|
|
55
|
-
[evt: string]: CustomEvent<any>;
|
|
56
|
-
};
|
|
57
|
-
slots: {};
|
|
58
|
-
};
|
|
59
|
-
export {};
|
|
17
|
+
}, {}, {}, string>;
|
|
18
|
+
type Navigation = InstanceType<typeof Navigation>;
|
|
19
|
+
export default Navigation;
|
package/dist/Navigation.svelte
CHANGED
|
@@ -1,16 +1,28 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import NavBar from
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { NavigationItem } from './definition';
|
|
3
|
+
import { Color } from './definition';
|
|
4
|
+
import { IconBurger, IconIrocoLogo, IrocoLogo, NavBar } from './';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
baseUrl = '',
|
|
8
|
+
href = `${baseUrl}/`,
|
|
9
|
+
navigationItems,
|
|
10
|
+
type = 'topbar',
|
|
11
|
+
title = null,
|
|
12
|
+
version = null,
|
|
13
|
+
color = Color.green,
|
|
14
|
+
navigating
|
|
15
|
+
}: {
|
|
16
|
+
baseUrl?: string;
|
|
17
|
+
href?: string;
|
|
18
|
+
navigationItems: Array<NavigationItem>;
|
|
19
|
+
type?: 'sidebar' | 'topbar';
|
|
20
|
+
title?: string | null;
|
|
21
|
+
version?: string | null;
|
|
22
|
+
color?: Color|string;
|
|
23
|
+
navigating?: { to: { url: { pathname: string } } } | null
|
|
24
|
+
} = $props();
|
|
25
|
+
let showMenu = $state(false);
|
|
14
26
|
</script>
|
|
15
27
|
|
|
16
28
|
<div class="navigation--mobile">
|
|
@@ -23,7 +35,7 @@ let showMenu = false;
|
|
|
23
35
|
{/if}
|
|
24
36
|
</div>
|
|
25
37
|
|
|
26
|
-
<button title="Menu button"
|
|
38
|
+
<button title="Menu button" onclick={() => (showMenu = true)} class="navigation--mobile__button">
|
|
27
39
|
<IconBurger width="3em" height="3em" />
|
|
28
40
|
</button>
|
|
29
41
|
|
|
@@ -33,6 +45,7 @@ let showMenu = false;
|
|
|
33
45
|
on:click={() => (showMenu = false)}
|
|
34
46
|
{type}
|
|
35
47
|
{navigationItems}
|
|
48
|
+
{navigating}
|
|
36
49
|
{version}
|
|
37
50
|
/>
|
|
38
51
|
{/if}
|
|
@@ -102,6 +115,7 @@ let showMenu = false;
|
|
|
102
115
|
max-width: calc(100% - 20px);
|
|
103
116
|
}
|
|
104
117
|
}
|
|
118
|
+
|
|
105
119
|
.container-large {
|
|
106
120
|
width: calc(100% - 20px);
|
|
107
121
|
max-width: 1280px;
|
|
@@ -144,6 +158,7 @@ let showMenu = false;
|
|
|
144
158
|
max-width: calc(100% - 20px);
|
|
145
159
|
}
|
|
146
160
|
}
|
|
161
|
+
|
|
147
162
|
.container-medium {
|
|
148
163
|
width: calc(100% - 20px);
|
|
149
164
|
max-width: 884px;
|
|
@@ -181,6 +196,7 @@ let showMenu = false;
|
|
|
181
196
|
max-width: calc(100% - 20px);
|
|
182
197
|
}
|
|
183
198
|
}
|
|
199
|
+
|
|
184
200
|
.container-small {
|
|
185
201
|
width: calc(100% - 20px);
|
|
186
202
|
max-width: 496px;
|
|
@@ -203,6 +219,7 @@ let showMenu = false;
|
|
|
203
219
|
max-width: calc(100% - 20px);
|
|
204
220
|
}
|
|
205
221
|
}
|
|
222
|
+
|
|
206
223
|
.navigation {
|
|
207
224
|
display: flex;
|
|
208
225
|
flex-direction: row;
|
|
@@ -221,6 +238,7 @@ let showMenu = false;
|
|
|
221
238
|
.navigation__title-container h1 {
|
|
222
239
|
padding-left: 1em;
|
|
223
240
|
}
|
|
241
|
+
|
|
224
242
|
@media all and (max-width: 768px) {
|
|
225
243
|
.navigation {
|
|
226
244
|
display: none;
|