@iroco/ui 1.0.0-9 → 1.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 +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 +33 -12
- package/dist/Button.svelte.d.ts +13 -38
- package/dist/DataTable.stories.svelte +24 -19
- package/dist/DataTable.stories.svelte.d.ts +17 -27
- package/dist/DataTable.svelte +45 -25
- package/dist/DataTable.svelte.d.ts +16 -23
- 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 +18 -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 +15 -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 +49 -183
- package/dist/NavBar.svelte.d.ts +33 -20
- package/dist/Navigation.stories.svelte +30 -28
- package/dist/Navigation.stories.svelte.d.ts +17 -57
- package/dist/Navigation.svelte +35 -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 +26 -12
- 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 +45 -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,41 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { NavigationItemType } from
|
|
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 { IconClose } from './index';
|
|
3
|
+
import { createEventDispatcher } from 'svelte';
|
|
4
|
+
import { NavigationItemType, NavigationItem } from './definition.js';
|
|
5
|
+
import type { MouseEventHandler } from 'svelte/elements';
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
navigationItems: Array<NavigationItem>;
|
|
9
|
+
type: 'sidebar' | 'topbar';
|
|
10
|
+
version?: string | null;
|
|
11
|
+
navigating?: { to: { url: { pathname: string } } } | null;
|
|
12
|
+
onclick?: MouseEventHandler<HTMLButtonElement>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let { navigationItems, type, version = null, navigating = null, onclick }: Props = $props();
|
|
16
|
+
|
|
17
|
+
const dispatch = createEventDispatcher();
|
|
18
|
+
|
|
19
|
+
const handleClickLink = (menuItem: NavigationItem) => {
|
|
20
|
+
if (typeof menuItem.hrefOrCallback === 'function') {
|
|
21
|
+
menuItem.hrefOrCallback();
|
|
22
|
+
return false; // to avoid calling href
|
|
23
|
+
}
|
|
24
|
+
dispatch('click_link');
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
function isActive(current: string, item: NavigationItem): boolean {
|
|
28
|
+
if (typeof item.hrefOrCallback === 'string') {
|
|
29
|
+
return item.hrefOrCallback === current;
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let active = $derived(navigating?.to.url.pathname ?? '');
|
|
26
35
|
</script>
|
|
27
36
|
|
|
28
37
|
<nav data-testid={type} class="nav__{type}">
|
|
29
|
-
<button title="Close menu"
|
|
38
|
+
<button title="Close menu" {onclick} class="nav__{type}__close">
|
|
30
39
|
<IconClose width="3em" height="3em" />
|
|
31
40
|
</button>
|
|
32
41
|
|
|
@@ -39,7 +48,7 @@ $:
|
|
|
39
48
|
</form>
|
|
40
49
|
{:else}
|
|
41
50
|
<a
|
|
42
|
-
|
|
51
|
+
onclick={() => handleClickLink(item)}
|
|
43
52
|
href={typeof item.hrefOrCallback === 'string' ? item.hrefOrCallback : '#'}
|
|
44
53
|
class:iroco-ui-button={item.type === NavigationItemType.BUTTON}
|
|
45
54
|
class:iroco-ui-button--small={item.type === NavigationItemType.BUTTON}
|
|
@@ -106,6 +115,7 @@ $:
|
|
|
106
115
|
max-width: calc(100% - 20px);
|
|
107
116
|
}
|
|
108
117
|
}
|
|
118
|
+
|
|
109
119
|
.container-large {
|
|
110
120
|
width: calc(100% - 20px);
|
|
111
121
|
max-width: 1280px;
|
|
@@ -148,6 +158,7 @@ $:
|
|
|
148
158
|
max-width: calc(100% - 20px);
|
|
149
159
|
}
|
|
150
160
|
}
|
|
161
|
+
|
|
151
162
|
.container-medium {
|
|
152
163
|
width: calc(100% - 20px);
|
|
153
164
|
max-width: 884px;
|
|
@@ -185,6 +196,7 @@ $:
|
|
|
185
196
|
max-width: calc(100% - 20px);
|
|
186
197
|
}
|
|
187
198
|
}
|
|
199
|
+
|
|
188
200
|
.container-small {
|
|
189
201
|
width: calc(100% - 20px);
|
|
190
202
|
max-width: 496px;
|
|
@@ -207,159 +219,7 @@ $:
|
|
|
207
219
|
max-width: calc(100% - 20px);
|
|
208
220
|
}
|
|
209
221
|
}
|
|
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
|
-
}
|
|
222
|
+
|
|
363
223
|
.iroco-ui-button {
|
|
364
224
|
cursor: pointer;
|
|
365
225
|
-webkit-touch-callout: none;
|
|
@@ -375,9 +235,9 @@ $:
|
|
|
375
235
|
border-radius: 0.3em;
|
|
376
236
|
}
|
|
377
237
|
.iroco-ui-button--basic {
|
|
378
|
-
color: var(--btn-
|
|
379
|
-
background: var(--btn-
|
|
380
|
-
border: 1px solid var(--btn-
|
|
238
|
+
color: var(--btn-secondary-label);
|
|
239
|
+
background: var(--btn-secondary-bg);
|
|
240
|
+
border: 1px solid var(--btn-secondary-border);
|
|
381
241
|
}
|
|
382
242
|
.iroco-ui-button--dark {
|
|
383
243
|
background: var(--dark-btn-primary-bg);
|
|
@@ -414,6 +274,10 @@ $:
|
|
|
414
274
|
.iroco-ui-button.disabled:hover, .iroco-ui-button:disabled:hover {
|
|
415
275
|
box-shadow: none;
|
|
416
276
|
}
|
|
277
|
+
.iroco-ui-button--full-width {
|
|
278
|
+
width: 100%;
|
|
279
|
+
}
|
|
280
|
+
|
|
417
281
|
.iroco-ui-link {
|
|
418
282
|
background: none;
|
|
419
283
|
border: none;
|
|
@@ -421,6 +285,7 @@ $:
|
|
|
421
285
|
color: var(--color-text);
|
|
422
286
|
cursor: pointer;
|
|
423
287
|
}
|
|
288
|
+
|
|
424
289
|
.nav__sidebar__item, .nav__topbar__item {
|
|
425
290
|
text-decoration: none;
|
|
426
291
|
display: block;
|
|
@@ -476,6 +341,7 @@ $:
|
|
|
476
341
|
padding-left: 2em;
|
|
477
342
|
color: var(--color-text-dark);
|
|
478
343
|
}
|
|
344
|
+
|
|
479
345
|
@media all and (max-width: 768px) {
|
|
480
346
|
.nav__sidebar, .nav__topbar {
|
|
481
347
|
position: fixed;
|
package/dist/NavBar.svelte.d.ts
CHANGED
|
@@ -1,22 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { NavigationItem } from './definition.js';
|
|
2
|
+
import type { MouseEventHandler } from 'svelte/elements';
|
|
3
|
+
interface Props {
|
|
4
|
+
navigationItems: Array<NavigationItem>;
|
|
5
|
+
type: 'sidebar' | 'topbar';
|
|
6
|
+
version?: string | null;
|
|
7
|
+
navigating?: {
|
|
8
|
+
to: {
|
|
9
|
+
url: {
|
|
10
|
+
pathname: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
} | null;
|
|
14
|
+
onclick?: MouseEventHandler<HTMLButtonElement>;
|
|
15
|
+
}
|
|
16
|
+
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> {
|
|
17
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
18
|
+
$$bindings?: Bindings;
|
|
19
|
+
} & Exports;
|
|
20
|
+
(internal: unknown, props: Props & {
|
|
21
|
+
$$events?: Events;
|
|
22
|
+
$$slots?: Slots;
|
|
23
|
+
}): Exports & {
|
|
24
|
+
$set?: any;
|
|
25
|
+
$on?: any;
|
|
14
26
|
};
|
|
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> {
|
|
27
|
+
z_$$bindings?: Bindings;
|
|
21
28
|
}
|
|
22
|
-
|
|
29
|
+
declare const NavBar: $$__sveltets_2_IsomorphicComponent<Props, {
|
|
30
|
+
click_link: CustomEvent<any>;
|
|
31
|
+
} & {
|
|
32
|
+
[evt: string]: CustomEvent<any>;
|
|
33
|
+
}, {}, {}, "">;
|
|
34
|
+
type NavBar = InstanceType<typeof NavBar>;
|
|
35
|
+
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,31 @@
|
|
|
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
|
+
interface Props {
|
|
7
|
+
baseUrl?: string;
|
|
8
|
+
href?: string;
|
|
9
|
+
navigationItems: Array<NavigationItem>;
|
|
10
|
+
type?: 'sidebar' | 'topbar';
|
|
11
|
+
title?: string | null;
|
|
12
|
+
version?: string | null;
|
|
13
|
+
color?: Color | string;
|
|
14
|
+
navigating?: { to: { url: { pathname: string } } } | null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
let showMenu = $state(false);
|
|
18
|
+
|
|
19
|
+
let {
|
|
20
|
+
baseUrl = '',
|
|
21
|
+
href = `${baseUrl}/`,
|
|
22
|
+
navigationItems,
|
|
23
|
+
type = 'topbar',
|
|
24
|
+
title = null,
|
|
25
|
+
version = null,
|
|
26
|
+
color = Color.green,
|
|
27
|
+
navigating
|
|
28
|
+
}: Props = $props();
|
|
14
29
|
</script>
|
|
15
30
|
|
|
16
31
|
<div class="navigation--mobile">
|
|
@@ -23,7 +38,7 @@ let showMenu = false;
|
|
|
23
38
|
{/if}
|
|
24
39
|
</div>
|
|
25
40
|
|
|
26
|
-
<button title="Menu button"
|
|
41
|
+
<button title="Menu button" onclick={() => (showMenu = true)} class="navigation--mobile__button">
|
|
27
42
|
<IconBurger width="3em" height="3em" />
|
|
28
43
|
</button>
|
|
29
44
|
|
|
@@ -33,6 +48,7 @@ let showMenu = false;
|
|
|
33
48
|
on:click={() => (showMenu = false)}
|
|
34
49
|
{type}
|
|
35
50
|
{navigationItems}
|
|
51
|
+
{navigating}
|
|
36
52
|
{version}
|
|
37
53
|
/>
|
|
38
54
|
{/if}
|
|
@@ -102,6 +118,7 @@ let showMenu = false;
|
|
|
102
118
|
max-width: calc(100% - 20px);
|
|
103
119
|
}
|
|
104
120
|
}
|
|
121
|
+
|
|
105
122
|
.container-large {
|
|
106
123
|
width: calc(100% - 20px);
|
|
107
124
|
max-width: 1280px;
|
|
@@ -144,6 +161,7 @@ let showMenu = false;
|
|
|
144
161
|
max-width: calc(100% - 20px);
|
|
145
162
|
}
|
|
146
163
|
}
|
|
164
|
+
|
|
147
165
|
.container-medium {
|
|
148
166
|
width: calc(100% - 20px);
|
|
149
167
|
max-width: 884px;
|
|
@@ -181,6 +199,7 @@ let showMenu = false;
|
|
|
181
199
|
max-width: calc(100% - 20px);
|
|
182
200
|
}
|
|
183
201
|
}
|
|
202
|
+
|
|
184
203
|
.container-small {
|
|
185
204
|
width: calc(100% - 20px);
|
|
186
205
|
max-width: 496px;
|
|
@@ -203,6 +222,7 @@ let showMenu = false;
|
|
|
203
222
|
max-width: calc(100% - 20px);
|
|
204
223
|
}
|
|
205
224
|
}
|
|
225
|
+
|
|
206
226
|
.navigation {
|
|
207
227
|
display: flex;
|
|
208
228
|
flex-direction: row;
|
|
@@ -221,6 +241,7 @@ let showMenu = false;
|
|
|
221
241
|
.navigation__title-container h1 {
|
|
222
242
|
padding-left: 1em;
|
|
223
243
|
}
|
|
244
|
+
|
|
224
245
|
@media all and (max-width: 768px) {
|
|
225
246
|
.navigation {
|
|
226
247
|
display: none;
|