@lavalogic/scoria 0.40.5 → 0.40.7

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.
@@ -355,6 +355,10 @@ export declare const icons: {
355
355
  readonly box: 24;
356
356
  readonly svg: "<path fill-rule=\"evenodd\" d=\"M15.6 3.7a1 1 0 0 0-1.5 0l-9.7 9.7a2 2 0 0 0 0 2.9L8 19.8V21h13v-1H10.2L20.3 9.9c.4-.4.4-1 0-1.4l-4.7-4.8ZM5.8 14.8l2.2-2 3.3 3.2-2.1 2.2-3.4-3.4Zm3.6-3.5 3.3 3.3 5.5-5.4-3.4-3.4-5.4 5.5Z\" clip-rule=\"evenodd\"/>";
357
357
  };
358
+ readonly email: {
359
+ readonly box: 24;
360
+ readonly svg: "<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M20 5C21.1046 5 22 5.89543 22 7V17C22 18.1046 21.1046 19 20 19H4C2.89543 19 2 18.1046 2 17L2 7C2 5.89543 2.89543 5 4 5H20ZM13.043 13.8623C12.4027 14.2536 11.5973 14.2536 10.957 13.8623L9.47949 12.96L4.47656 16.8506C4.62898 16.9446 4.80779 17 5 17H19C19.1919 17 19.3702 16.9443 19.5225 16.8506L14.5195 12.96L13.043 13.8623ZM4 15.2217L8.03906 12.0791L4 8.61035V15.2217ZM15.96 12.0791L20 15.2217V8.61035L15.96 12.0791ZM5 7C4.89813 7 4.79963 7.01466 4.70703 7.04297L11.4785 12.1816C11.7986 12.3772 12.2014 12.3772 12.5215 12.1816L19.292 7.04297C19.1996 7.01483 19.1015 7 19 7H5Z\" />";
361
+ };
358
362
  readonly error: {
359
363
  readonly box: 12;
360
364
  readonly svg: "<path d=\"M6,1.2A4.8,4.8,0,1,1,1.2,6,4.8,4.8,0,0,1,6,1.2Zm0-1A5.76,5.76,0,1,0,11.76,6,5.76,5.76,0,0,0,6,.24ZM5.52,3.06h1V6.9h-1ZM6,9a.6.6,0,1,1,.6-.6A.6.6,0,0,1,6,9Z\"/>";
@@ -468,6 +468,10 @@ export const icons = {
468
468
  box: 24,
469
469
  svg: `<path fill-rule="evenodd" d="M15.6 3.7a1 1 0 0 0-1.5 0l-9.7 9.7a2 2 0 0 0 0 2.9L8 19.8V21h13v-1H10.2L20.3 9.9c.4-.4.4-1 0-1.4l-4.7-4.8ZM5.8 14.8l2.2-2 3.3 3.2-2.1 2.2-3.4-3.4Zm3.6-3.5 3.3 3.3 5.5-5.4-3.4-3.4-5.4 5.5Z" clip-rule="evenodd"/>`,
470
470
  },
471
+ email: {
472
+ box: 24,
473
+ svg: `<path fill-rule="evenodd" clip-rule="evenodd" d="M20 5C21.1046 5 22 5.89543 22 7V17C22 18.1046 21.1046 19 20 19H4C2.89543 19 2 18.1046 2 17L2 7C2 5.89543 2.89543 5 4 5H20ZM13.043 13.8623C12.4027 14.2536 11.5973 14.2536 10.957 13.8623L9.47949 12.96L4.47656 16.8506C4.62898 16.9446 4.80779 17 5 17H19C19.1919 17 19.3702 16.9443 19.5225 16.8506L14.5195 12.96L13.043 13.8623ZM4 15.2217L8.03906 12.0791L4 8.61035V15.2217ZM15.96 12.0791L20 15.2217V8.61035L15.96 12.0791ZM5 7C4.89813 7 4.79963 7.01466 4.70703 7.04297L11.4785 12.1816C11.7986 12.3772 12.2014 12.3772 12.5215 12.1816L19.292 7.04297C19.1996 7.01483 19.1015 7 19 7H5Z" />`,
474
+ },
471
475
  error: {
472
476
  box,
473
477
  svg: `<path d="M6,1.2A4.8,4.8,0,1,1,1.2,6,4.8,4.8,0,0,1,6,1.2Zm0-1A5.76,5.76,0,1,0,11.76,6,5.76,5.76,0,0,0,6,.24ZM5.52,3.06h1V6.9h-1ZM6,9a.6.6,0,1,1,.6-.6A.6.6,0,0,1,6,9Z"/>`,
@@ -0,0 +1,107 @@
1
+ <svelte:options runes />
2
+
3
+ <!--
4
+ @component
5
+ A single-select group of large, clickable cards — each an optional leading
6
+ icon, a label, and optional helper text. Use it instead of a `SingleSelect`
7
+ when the choices benefit from a sentence of explanation (e.g. picking a
8
+ report's delivery method or output format).
9
+
10
+ Controlled: pass `selected` and update it in `onchange`. Accessible as a
11
+ native radio group (the radio inputs are visually hidden but focusable).
12
+ -->
13
+ <script
14
+ lang="ts"
15
+ generics="T"
16
+ >
17
+ import { Colour } from '../scss/colours.js';
18
+ import { Size } from '../Types/Internal/Size.js';
19
+ import type { OptionCardsProps } from './OptionCardsProps.js';
20
+ import Icon from './Icon.svelte';
21
+
22
+ let { name, options, selected, onchange }: OptionCardsProps<T> = $props();
23
+ </script>
24
+
25
+ <div
26
+ class="option-cards"
27
+ role="radiogroup"
28
+ >
29
+ {#each options as option (option.value)}
30
+ {@const isSelected = selected === option.value}
31
+ <label
32
+ class="card"
33
+ class:selected={isSelected}
34
+ >
35
+ <input
36
+ class="native"
37
+ type="radio"
38
+ {name}
39
+ checked={isSelected}
40
+ onchange={() => void onchange?.(option.value)}
41
+ />
42
+ {#if option.icon}
43
+ <Icon
44
+ name={option.icon}
45
+ size={Size.Large}
46
+ colour={isSelected ? Colour['$brand-primary'] : Colour['$ui-blue-14']}
47
+ />
48
+ {/if}
49
+ <span class="title">{option.label}</span>
50
+ {#if option.info}
51
+ <span class="info">{option.info}</span>
52
+ {/if}
53
+ </label>
54
+ {/each}
55
+ </div>
56
+
57
+ <style>.option-cards {
58
+ display: flex;
59
+ flex-flow: row wrap;
60
+ gap: 0.75rem;
61
+ }
62
+
63
+ .card {
64
+ flex: 1 1 0;
65
+ min-width: 9rem;
66
+ display: flex;
67
+ flex-flow: column nowrap;
68
+ gap: 0.25rem;
69
+ padding: 0.85rem 1rem;
70
+ border: solid 1px #cbd4da;
71
+ border-radius: 4px;
72
+ background-color: #ffffff;
73
+ color: #647d8e;
74
+ cursor: pointer;
75
+ }
76
+
77
+ /* Visually hidden but keyboard-focusable (drives :focus-within). */
78
+ .native {
79
+ position: absolute;
80
+ width: 1px;
81
+ height: 1px;
82
+ opacity: 0;
83
+ pointer-events: none;
84
+ }
85
+
86
+ .title {
87
+ color: #3a4952;
88
+ font-weight: 600;
89
+ }
90
+
91
+ .info {
92
+ font-size: 0.8rem;
93
+ }
94
+
95
+ .card.selected {
96
+ border-color: #259fc7;
97
+ background-color: #f4fbfd;
98
+ color: #259fc7;
99
+ }
100
+ .card.selected .title {
101
+ color: #259fc7;
102
+ }
103
+
104
+ .card:focus-within {
105
+ outline: solid 2px #259fc7;
106
+ outline-offset: 2px;
107
+ }</style>
@@ -0,0 +1,34 @@
1
+ import type { OptionCardsProps } from './OptionCardsProps.js';
2
+ declare function $$render<T>(): {
3
+ props: OptionCardsProps<T>;
4
+ exports: {};
5
+ bindings: "";
6
+ slots: {};
7
+ events: {};
8
+ };
9
+ declare class __sveltets_Render<T> {
10
+ props(): ReturnType<typeof $$render<T>>['props'];
11
+ events(): ReturnType<typeof $$render<T>>['events'];
12
+ slots(): ReturnType<typeof $$render<T>>['slots'];
13
+ bindings(): "";
14
+ exports(): {};
15
+ }
16
+ interface $$IsomorphicComponent {
17
+ new <T>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
18
+ $$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
19
+ } & ReturnType<__sveltets_Render<T>['exports']>;
20
+ <T>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
21
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
22
+ }
23
+ /**
24
+ * A single-select group of large, clickable cards — each an optional leading
25
+ * icon, a label, and optional helper text. Use it instead of a `SingleSelect`
26
+ * when the choices benefit from a sentence of explanation (e.g. picking a
27
+ * report's delivery method or output format).
28
+ *
29
+ * Controlled: pass `selected` and update it in `onchange`. Accessible as a
30
+ * native radio group (the radio inputs are visually hidden but focusable).
31
+ */
32
+ declare const OptionCards: $$IsomorphicComponent;
33
+ type OptionCards<T> = InstanceType<typeof OptionCards<T>>;
34
+ export default OptionCards;
@@ -0,0 +1,19 @@
1
+ import type { OptionCard } from '../Types/Internal/OptionCard.js';
2
+ /**
3
+ * Props for {@link OptionCards} — a single-select group of large, clickable
4
+ * cards (icon + label + helper), used when a choice benefits from more
5
+ * explanation than a plain `SingleSelect` (e.g. a delivery/format chooser).
6
+ *
7
+ * Controlled component: pass `selected` and update it from `onchange`.
8
+ * `T` is compared with `===`; use a primitive or a stable reference.
9
+ */
10
+ export interface OptionCardsProps<T> {
11
+ /** `name` attribute shared by the underlying radio inputs. */
12
+ name?: string;
13
+ /** The option set rendered as cards. */
14
+ options: ReadonlyArray<OptionCard<T>>;
15
+ /** Currently-selected value. */
16
+ selected?: T;
17
+ /** Called when a card is chosen. May be `void` or `Promise<void>`. */
18
+ onchange?: (value: T) => void | Promise<void>;
19
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ import type { icons } from '../../Components/Icons.js';
2
+ /**
3
+ * A single option in an {@link OptionCards} picker — a selectable card with
4
+ * an optional leading icon, a label, and optional helper text. The generic
5
+ * carries the concrete value type so the surrounding component stays
6
+ * type-safe in its `onchange` callback.
7
+ */
8
+ export interface OptionCard<T> {
9
+ /** The option's value when selected (compared with `===`). */
10
+ value: T;
11
+ /** Visible card title. */
12
+ label: string;
13
+ /** Optional helper text under the title. */
14
+ info?: string;
15
+ /** Optional leading icon, looked up in the frozen icon registry. */
16
+ icon?: keyof typeof icons;
17
+ }
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.d.ts CHANGED
@@ -11,6 +11,8 @@ export { default as Pagination } from './Components/Base/Pagination.svelte';
11
11
  export { type PaginationProps } from './Components/Base/PaginationProps.js';
12
12
  export { default as BigRadioSet } from './Components/BigRadioSet.svelte';
13
13
  export type { BigRadioSetProps } from './Components/BigRadioSetProps.js';
14
+ export { default as OptionCards } from './Components/OptionCards.svelte';
15
+ export type { OptionCardsProps } from './Components/OptionCardsProps.js';
14
16
  export { default as Bubble } from './Components/Bubble.svelte';
15
17
  export { type BubbleColour } from './Components/BubbleColour.js';
16
18
  export { type BubbleProps } from './Components/BubbleProps.js';
@@ -187,6 +189,7 @@ export { type UseTooltipHandlers, type UseTooltipOptions, useTooltip, } from './
187
189
  export { Colour, ColourSet } from './scss/colours.js';
188
190
  export { Sizing } from './scss/sizing.js';
189
191
  export { type BigRadioOption } from './Types/Internal/BigRadioOption.js';
192
+ export { type OptionCard } from './Types/Internal/OptionCard.js';
190
193
  export { type ButtonProp } from './Types/Internal/ButtonProp.js';
191
194
  export { type CallbackButton } from './Types/Internal/CallbackButton.js';
192
195
  export { type DateChange } from './Types/Internal/DateChange.js';
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ export {} from './Components/Base/ContextWrapperProps.js';
7
7
  export { default as Pagination } from './Components/Base/Pagination.svelte';
8
8
  export {} from './Components/Base/PaginationProps.js';
9
9
  export { default as BigRadioSet } from './Components/BigRadioSet.svelte';
10
+ export { default as OptionCards } from './Components/OptionCards.svelte';
10
11
  export { default as Bubble } from './Components/Bubble.svelte';
11
12
  export {} from './Components/BubbleColour.js';
12
13
  export {} from './Components/BubbleProps.js';
@@ -146,6 +147,7 @@ export { useTooltip, } from './Helpers/useTooltip.svelte.js';
146
147
  export { Colour, ColourSet } from './scss/colours.js';
147
148
  export { Sizing } from './scss/sizing.js';
148
149
  export {} from './Types/Internal/BigRadioOption.js';
150
+ export {} from './Types/Internal/OptionCard.js';
149
151
  export {} from './Types/Internal/ButtonProp.js';
150
152
  export {} from './Types/Internal/CallbackButton.js';
151
153
  export {} from './Types/Internal/DateChange.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lavalogic/scoria",
3
3
  "description": "Svelte components used for the FloWMS Web Frontend",
4
- "version": "0.40.5",
4
+ "version": "0.40.7",
5
5
  "publishConfig": {
6
6
  "access": "restricted"
7
7
  },