@lavalogic/scoria 0.30.0 → 0.31.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.
@@ -25,7 +25,7 @@
25
25
  minWidth,
26
26
  minHeight,
27
27
  width,
28
- height
28
+ height,
29
29
  }: DesktopModalProps = $props();
30
30
  </script>
31
31
 
@@ -96,7 +96,10 @@
96
96
  </div>
97
97
 
98
98
  {#if isLoading}
99
- <LoadingOverlay absolute message={loadingMessage} />
99
+ <LoadingOverlay
100
+ absolute
101
+ message={loadingMessage}
102
+ />
100
103
  {/if}
101
104
  </Modal>
102
105
 
@@ -4,8 +4,11 @@
4
4
  lang="ts"
5
5
  generics="CommonDenominator"
6
6
  >
7
+ import { ellipses } from '../Helpers/Helpers.svelte.js';
8
+ import { Colour } from '../scss/colours.js';
7
9
  import HorizontalTabGroupButton from './HorizontalTabGroupButton.svelte';
8
10
  import type { HorizontalTabGroupProps } from './HorizontalTabGroupProps.js';
11
+ import TextInput from './TextInput.svelte';
9
12
  let {
10
13
  // name: _name, //FIXME why is this not implemented?
11
14
  tabComponent,
@@ -13,7 +16,24 @@
13
16
  selected,
14
17
  noRadius = false,
15
18
  grow = false,
19
+ filterable = false,
20
+ filterFn,
16
21
  }: HorizontalTabGroupProps<CommonDenominator> = $props();
22
+
23
+ // svelte-ignore state_referenced_locally
24
+ let filteredTabs = $state(tabs);
25
+
26
+ $effect(() => {
27
+ const term = searchValue;
28
+ const id = setTimeout(() => {
29
+ filteredTabs = filterFn ? tabs.filter((t) => filterFn(t, term)) : tabs;
30
+ }, 300);
31
+ return () => {
32
+ clearTimeout(id);
33
+ };
34
+ });
35
+
36
+ let searchValue = $state('');
17
37
  </script>
18
38
 
19
39
  <div
@@ -22,14 +42,24 @@
22
42
  class:grow
23
43
  >
24
44
  <div class="tabs">
45
+ {#if filterable}
46
+ <div class="searchbar">
47
+ <TextInput
48
+ bind:value={searchValue}
49
+ placeholder="Search any keyword to find matches{ellipses}"
50
+ rightIcon={{ name: 'search-1', colour: Colour['$ui-blue-4'] }}
51
+ />
52
+ </div>
53
+ {/if}
25
54
  {#if tabComponent}
26
- {#each tabs as option (option)}
55
+ {#each filteredTabs as option (option)}
27
56
  {@render tabComponent(option, selected === option)}
28
57
  {/each}
29
58
  {:else}
30
- {#each tabs as option (option)}
59
+ {#each filteredTabs as option (option)}
31
60
  <HorizontalTabGroupButton
32
61
  {option}
62
+ noRadius={noRadius || filterable}
33
63
  selected={selected === option}
34
64
  />
35
65
  {/each}
@@ -43,7 +73,15 @@
43
73
  </div>
44
74
  </div>
45
75
 
46
- <style>.wrapper {
76
+ <style>.searchbar {
77
+ display: flex;
78
+ width: 100%;
79
+ padding: 0.5rem;
80
+ background-color: #ffffff;
81
+ min-width: 330px;
82
+ }
83
+
84
+ .wrapper {
47
85
  box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.1333333333);
48
86
  border-radius: 4px;
49
87
  display: flex;
@@ -65,6 +103,8 @@
65
103
  border-radius: 4px 0 0 4px;
66
104
  display: flex;
67
105
  flex-flow: column nowrap;
106
+ padding-top: 1px;
107
+ gap: 1px;
68
108
  min-width: 10rem;
69
109
  background-color: #e9ecf1;
70
110
  border-right: solid 1px #cbd4da;
@@ -6,13 +6,11 @@
6
6
  >
7
7
  import { devCatch } from '../Helpers/Helpers.svelte.js';
8
8
  import { Colour } from '../scss/colours.js';
9
-
10
9
  import { Size } from '../Types/Internal/Size.js';
11
-
12
10
  import Icon from './Icon.svelte';
13
11
  import type { TabGroupButtonProps } from './TabGroupButtonProps.js';
14
12
 
15
- let { option, selected }: TabGroupButtonProps<Args> = $props();
13
+ let { option, selected, noRadius = false }: TabGroupButtonProps<Args> = $props();
16
14
 
17
15
  let disabled = $state(true);
18
16
  let visible = $state(true);
@@ -68,13 +66,15 @@
68
66
  class:invalid={!isValid}
69
67
  {disabled}
70
68
  class:hidden={!visible}
69
+ class:no-radius={noRadius}
71
70
  >
72
- <Icon
71
+ <div class="selected-marker"></div>
72
+ <!-- <Icon
73
73
  name="nothing"
74
74
  colour={Colour['$brand-primary']}
75
75
  size={Size.Small}
76
76
  {...option.iconLeft}
77
- />
77
+ /> -->
78
78
 
79
79
  {option.label}
80
80
  {#if !isValid}
@@ -83,13 +83,13 @@
83
83
  colour={Colour['$error-border']}
84
84
  size={Size.Small}
85
85
  />
86
- {:else}
86
+ <!-- {:else}
87
87
  <Icon
88
88
  name="nothing"
89
89
  colour={Colour['$brand-primary']}
90
90
  size={Size.Small}
91
91
  {...option.iconRight}
92
- />
92
+ /> -->
93
93
  {/if}
94
94
  </button>
95
95
 
@@ -102,27 +102,52 @@
102
102
  cursor: pointer;
103
103
  font-size: 1rem;
104
104
  font-weight: 500;
105
- padding: 0.75rem;
106
- background-color: transparent;
105
+ padding: 1rem;
106
+ background-color: #ffffff;
107
107
  border: none;
108
- transition: border-color ease-out 0.15s 0s, background-color ease-out 0.15s 0s, color ease-out 0.15s 0s, fill ease-out 0.15s 0s;
109
108
  text-align: start;
110
109
  display: flex;
111
110
  flex-flow: row nowrap;
112
111
  align-items: center;
113
112
  width: 100%;
114
- justify-content: space-between;
115
113
  gap: 0.5rem;
114
+ position: relative;
115
+ transition: border-color ease-out 0.15s 0s, background-color ease-out 0.15s 0s, color ease-out 0.15s 0s, fill ease-out 0.15s 0s;
116
116
  }
117
- .tab:first-child {
118
- border-radius: 4px 0 0 0;
117
+ .tab .selected-marker {
118
+ position: absolute;
119
+ left: 0;
120
+ top: 0;
121
+ bottom: 0;
122
+ height: 100%;
123
+ opacity: 0;
124
+ background-color: #259fc7;
125
+ width: 0.3333333333rem;
126
+ transition: border-color ease-out 0.15s 0s, background-color ease-out 0.15s 0s, color ease-out 0.15s 0s, fill ease-out 0.15s 0s, opacity ease-out 0.15s 0s;
119
127
  }
120
128
  .tab.selected {
121
- background-color: white;
129
+ color: #259fc7;
130
+ }
131
+ .tab.selected .selected-marker {
132
+ opacity: 1;
133
+ }
134
+ .tab:hover, .tab.selected:hover {
135
+ color: #49b8dc;
136
+ background-color: #f4f7f9;
137
+ }
138
+ .tab:hover .selected-marker, .tab.selected:hover .selected-marker {
139
+ opacity: 1;
140
+ background-color: #49b8dc;
141
+ }
142
+ .tab:not(.no-radius):first-child {
143
+ border-radius: 4px 0 0 0;
122
144
  }
123
145
  .tab:hover, .tab.selected:hover, .tab.invalid:hover {
124
146
  background-color: #f4f7f9;
125
147
  }
148
+ .tab.invalid .selected-marker {
149
+ background-color: #aa1414 !important;
150
+ }
126
151
  .tab.invalid {
127
- color: #aa1414;
152
+ color: #aa1414 !important;
128
153
  }</style>
@@ -1,10 +1,22 @@
1
1
  import type { TabOption } from '../Types/Internal/TabOption.js';
2
2
  import type { Snippet } from 'svelte';
3
- export interface HorizontalTabGroupProps<CommonDenominator> {
3
+ export type HorizontalTabGroupProps<CommonDenominator> = HorizontalTabGroupPropsWithSearch<CommonDenominator> | HorizontalTabGroupPropsWithoutSearch<CommonDenominator>;
4
+ interface HorizontalTabGroupPropsBase<CommonDenominator> {
4
5
  name?: string;
5
6
  tabComponent?: Snippet<[TabOption<CommonDenominator>, boolean]>;
6
7
  noRadius?: boolean;
7
8
  grow?: boolean;
8
9
  tabs: Array<TabOption<CommonDenominator>>;
9
10
  selected: TabOption<CommonDenominator> | undefined;
11
+ filterable?: boolean;
12
+ filterFn?: (item: TabOption<CommonDenominator>, filterValue: string) => boolean;
10
13
  }
14
+ export interface HorizontalTabGroupPropsWithoutSearch<CommonDenominator> extends HorizontalTabGroupPropsBase<CommonDenominator> {
15
+ filterable?: false;
16
+ filterFn?: never;
17
+ }
18
+ export interface HorizontalTabGroupPropsWithSearch<CommonDenominator> extends HorizontalTabGroupPropsBase<CommonDenominator> {
19
+ filterable: true;
20
+ filterFn: (item: TabOption<CommonDenominator>, filterValue: string) => boolean;
21
+ }
22
+ export {};
@@ -1,7 +1,8 @@
1
1
  <svelte:options runes />
2
2
 
3
3
  <script lang="ts">
4
- import { Icon, Size } from '@lavalogic/scoria';
4
+ import { Size } from '../../Types/Internal/Size.js';
5
+ import Icon from '../Icon.svelte';
5
6
  import type { NavProps } from './NavProps.js';
6
7
  import ServicesNav from './ServicesNav.svelte';
7
8
 
@@ -1,7 +1,9 @@
1
1
  <svelte:options runes />
2
2
 
3
3
  <script lang="ts">
4
- import { Colour, Icon, Size } from '@lavalogic/scoria';
4
+ import { Colour } from '../../scss/colours.js';
5
+ import { Size } from '../../Types/Internal/Size.js';
6
+ import Icon from '../Icon.svelte';
5
7
  import type { NavServiceMenuListProps } from './NavServiceMenuListProps.js';
6
8
  import ServiceMenuItem from './ServiceMenuItem.svelte';
7
9
 
@@ -4,7 +4,9 @@
4
4
  import { dev } from '$app/environment';
5
5
  import { resolve } from '$app/paths';
6
6
  import { page } from '$app/state';
7
- import { devCatch, Icon, Size } from '@lavalogic/scoria';
7
+ import { devCatch } from '../../Helpers/Helpers.svelte.js';
8
+ import { Size } from '../../Types/Internal/Size.js';
9
+ import Icon from '../Icon.svelte';
8
10
  import { Dimensions } from './Dimensions.js';
9
11
  import type { SideMenuItemProps } from './SideMenuItemProps.js';
10
12
 
@@ -1,7 +1,8 @@
1
1
  <svelte:options runes />
2
2
 
3
3
  <script lang="ts">
4
- import { HorizontalTabGroup, type TabOption } from '@lavalogic/scoria';
4
+ import type { TabOption } from '../../Types/Internal/TabOption.js';
5
+ import HorizontalTabGroup from '../HorizontalTabGroup.svelte';
5
6
  import NavTab from './NavTab.svelte';
6
7
  import type { ServicesNavProps } from './ServicesNavProps.js';
7
8
 
@@ -1,9 +1,5 @@
1
1
  import type { CallbackButtonWithIcon } from './CallbackButtonWithIcon.js';
2
- export declare const SideMenuItemVariant: {
3
- readonly Nav: "Nav";
4
- readonly Tab: "Tab";
5
- };
6
- export type SideMenuItemVariant = (typeof SideMenuItemVariant)[keyof typeof SideMenuItemVariant];
2
+ import type { SideMenuItemVariant } from './SideMenuItemVariant.js';
7
3
  export interface SideMenuItemProps {
8
4
  item: CallbackButtonWithIcon;
9
5
  selected?: boolean;
@@ -1,5 +1 @@
1
- export const SideMenuItemVariant = {
2
- Nav: 'Nav',
3
- Tab: 'Tab',
4
- };
5
- Object.freeze(SideMenuItemVariant);
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export declare const SideMenuItemVariant: {
2
+ readonly Nav: "Nav";
3
+ readonly Tab: "Tab";
4
+ };
5
+ export type SideMenuItemVariant = (typeof SideMenuItemVariant)[keyof typeof SideMenuItemVariant];
@@ -0,0 +1,5 @@
1
+ export const SideMenuItemVariant = {
2
+ Nav: 'Nav',
3
+ Tab: 'Tab',
4
+ };
5
+ Object.freeze(SideMenuItemVariant);
@@ -2,4 +2,5 @@ import type { TabOption } from '../Types/Internal/TabOption.js';
2
2
  export interface TabGroupButtonProps<Args> {
3
3
  option: TabOption<Args>;
4
4
  selected: boolean;
5
+ noRadius?: boolean;
5
6
  }
@@ -54,6 +54,7 @@ export declare function hasQuery<FilterValueType>(customFilter: CustomFilter<Fil
54
54
  export declare function isDateTuple(value: unknown): value is [Date | null, Date | null];
55
55
  export declare function isNumericArray(value: unknown): value is Array<number | null>;
56
56
  export declare function isValidityTuple(v: Validity | ValidityWrapper | undefined): v is ValidityWrapper;
57
+ export declare const ellipses = "\u2026";
57
58
  export declare const loadingText = "loading\u2026";
58
59
  export declare function isKeyOf<T extends object>(key: string, obj: T): key is string & keyof T;
59
60
  export interface ICreateTableArgs<T extends object, RowIdType extends Primitive> {
@@ -410,6 +410,7 @@ export function isNumericArray(value) {
410
410
  export function isValidityTuple(v) {
411
411
  return v != null && typeof v == 'object';
412
412
  }
413
+ export const ellipses = '…';
413
414
  export const loadingText = 'loading…';
414
415
  export function isKeyOf(key, obj) {
415
416
  return key in obj;
package/dist/index.d.ts CHANGED
@@ -68,7 +68,8 @@ export { default as NavTab } from './Components/Nav/NavTab.svelte';
68
68
  export { default as ServiceMenuItem } from './Components/Nav/ServiceMenuItem.svelte';
69
69
  export { default as ServicesNav } from './Components/Nav/ServicesNav.svelte';
70
70
  export { type ServicesNavProps } from './Components/Nav/ServicesNavProps.js';
71
- export { SideMenuItemVariant, type SideMenuItemProps, } from './Components/Nav/SideMenuItemProps.js';
71
+ export { type SideMenuItemProps } from './Components/Nav/SideMenuItemProps.js';
72
+ export { SideMenuItemVariant } from './Components/Nav/SideMenuItemVariant.js';
72
73
  export { default as NumberInput } from './Components/NumberInput.svelte';
73
74
  export type { NumberInputProps } from './Components/NumberInputProps.js';
74
75
  export { type PartialIconProps } from './Components/PartialIconProps.js';
@@ -222,11 +223,10 @@ export { TooltipContext } from './Contexts/TooltipContext.svelte.js';
222
223
  export { UntypedInputContext } from './Contexts/UntypedInputContext.svelte.js';
223
224
  export { Delay } from './Delay/Delay.js';
224
225
  export { DATAMatrix } from './Helpers/Datamatrix.js';
225
- export { asyncAll, asyncEvery, asyncFilter, asyncFilterIndices, asyncFlatMap, asyncForEach, asyncMap, asyncSleep, asyncSome, autoPluralise, createLocalTable, devCatch, generateShortUUID, generateUUID, getAccessorSortingFn, getCanvasContext, getErrorMessage, gridItem, isDateTuple, isNumericArray, isValidEmailAddress, loadingText, localTimeFormat, passthrough, refWrapper, SQLFriendly, SQLFriendlyWithLocalTime, vowels, type ICreateTableArgs, } from './Helpers/Helpers.svelte.js';
226
+ export { asyncAll, asyncEvery, asyncFilter, asyncFilterIndices, asyncFlatMap, asyncForEach, asyncMap, asyncSleep, asyncSome, autoPluralise, createLocalTable, devCatch, ellipses, generateShortUUID, generateUUID, getAccessorSortingFn, getCanvasContext, getErrorMessage, gridItem, isDateTuple, isNumericArray, isValidEmailAddress, loadingText, localTimeFormat, passthrough, refWrapper, SQLFriendly, SQLFriendlyWithLocalTime, vowels, type ICreateTableArgs, } from './Helpers/Helpers.svelte.js';
226
227
  export { type INamed } from './Helpers/INamed.js';
227
228
  export { Colour, ColourSet } from './scss/colours.js';
228
229
  export { Sizing } from './scss/sizing.js';
229
- export { AttributeOperation } from './Types/Internal/AttributeOperation.js';
230
230
  export { type BigRadioOption } from './Types/Internal/BigRadioOption.js';
231
231
  export { type ButtonProp } from './Types/Internal/ButtonProp.js';
232
232
  export { type CallbackButton } from './Types/Internal/CallbackButton.js';
package/dist/index.js CHANGED
@@ -48,7 +48,8 @@ export { default as NavTab } from './Components/Nav/NavTab.svelte';
48
48
  export { default as ServiceMenuItem } from './Components/Nav/ServiceMenuItem.svelte';
49
49
  export { default as ServicesNav } from './Components/Nav/ServicesNav.svelte';
50
50
  export {} from './Components/Nav/ServicesNavProps.js';
51
- export { SideMenuItemVariant, } from './Components/Nav/SideMenuItemProps.js';
51
+ export {} from './Components/Nav/SideMenuItemProps.js';
52
+ export { SideMenuItemVariant } from './Components/Nav/SideMenuItemVariant.js';
52
53
  export { default as NumberInput } from './Components/NumberInput.svelte';
53
54
  export {} from './Components/PartialIconProps.js';
54
55
  export { default as PasswordInput } from './Components/PasswordInput.svelte';
@@ -165,11 +166,10 @@ export { TooltipContext } from './Contexts/TooltipContext.svelte.js';
165
166
  export { UntypedInputContext } from './Contexts/UntypedInputContext.svelte.js';
166
167
  export { Delay } from './Delay/Delay.js';
167
168
  export { DATAMatrix } from './Helpers/Datamatrix.js';
168
- export { asyncAll, asyncEvery, asyncFilter, asyncFilterIndices, asyncFlatMap, asyncForEach, asyncMap, asyncSleep, asyncSome, autoPluralise, createLocalTable, devCatch, generateShortUUID, generateUUID, getAccessorSortingFn, getCanvasContext, getErrorMessage, gridItem, isDateTuple, isNumericArray, isValidEmailAddress, loadingText, localTimeFormat, passthrough, refWrapper, SQLFriendly, SQLFriendlyWithLocalTime, vowels, } from './Helpers/Helpers.svelte.js';
169
+ export { asyncAll, asyncEvery, asyncFilter, asyncFilterIndices, asyncFlatMap, asyncForEach, asyncMap, asyncSleep, asyncSome, autoPluralise, createLocalTable, devCatch, ellipses, generateShortUUID, generateUUID, getAccessorSortingFn, getCanvasContext, getErrorMessage, gridItem, isDateTuple, isNumericArray, isValidEmailAddress, loadingText, localTimeFormat, passthrough, refWrapper, SQLFriendly, SQLFriendlyWithLocalTime, vowels, } from './Helpers/Helpers.svelte.js';
169
170
  export {} from './Helpers/INamed.js';
170
171
  export { Colour, ColourSet } from './scss/colours.js';
171
172
  export { Sizing } from './scss/sizing.js';
172
- export { AttributeOperation } from './Types/Internal/AttributeOperation.js';
173
173
  export {} from './Types/Internal/BigRadioOption.js';
174
174
  export {} from './Types/Internal/ButtonProp.js';
175
175
  export {} from './Types/Internal/CallbackButton.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.30.0",
4
+ "version": "0.31.0",
5
5
  "publishConfig": {
6
6
  "access": "restricted"
7
7
  },
@@ -1,31 +0,0 @@
1
- export declare const AttributeOperation: {
2
- readonly Preadvice: "Preadvice";
3
- readonly RequiredAtPreadvice: "Preadvice";
4
- readonly Order: "Order";
5
- readonly RequiredAtOrder: "Order";
6
- readonly Despatch: "Despatch";
7
- readonly RequiredAtDespatch: "RequiredAtDespatch";
8
- readonly ValidateAtDespatch: "ValidateAtDespatch";
9
- readonly Kit: "Kit";
10
- readonly RequiredAtKit: "RequiredAtKit";
11
- readonly ValidateAtKit: "ValidateAtKit";
12
- readonly Pack: "Pack";
13
- readonly RequiredAtPack: "RequiredAtPack";
14
- readonly ValidateAtPack: "ValidateAtPack";
15
- readonly Pick: "Pick";
16
- readonly RequiredAtPick: "RequiredAtPick";
17
- readonly ValidateAtPick: "ValidateAtPick";
18
- readonly Receipt: "Receipt";
19
- readonly RequiredAtReceipt: "RequiredAtReceipt";
20
- readonly ValidateAtReceipt: "ValidateAtReceipt";
21
- readonly ReceiptReturn: "ReceiptReturn";
22
- readonly RequiredAtReceiptReturn: "RequiredAtReceiptReturn";
23
- readonly ValidateAtReceiptReturn: "ValidateAtReceiptReturn";
24
- readonly Sort: "Sort";
25
- readonly RequiredAtSort: "RequiredAtSort";
26
- readonly ValidateAtSort: "ValidateAtSort";
27
- readonly StockTake: "StockTake";
28
- readonly RequiredAtStockTake: "RequiredAtStockTake";
29
- readonly ValidateAtStockTake: "ValidateAtStockTake";
30
- };
31
- export type AttributeOperation = (typeof AttributeOperation)[keyof typeof AttributeOperation];
@@ -1,31 +0,0 @@
1
- export const AttributeOperation = {
2
- Preadvice: 'Preadvice',
3
- RequiredAtPreadvice: 'Preadvice', //functionally identical
4
- Order: 'Order',
5
- RequiredAtOrder: 'Order', // functionally identical
6
- Despatch: 'Despatch',
7
- RequiredAtDespatch: 'RequiredAtDespatch',
8
- ValidateAtDespatch: 'ValidateAtDespatch',
9
- Kit: 'Kit',
10
- RequiredAtKit: 'RequiredAtKit',
11
- ValidateAtKit: 'ValidateAtKit',
12
- Pack: 'Pack',
13
- RequiredAtPack: 'RequiredAtPack',
14
- ValidateAtPack: 'ValidateAtPack',
15
- Pick: 'Pick',
16
- RequiredAtPick: 'RequiredAtPick',
17
- ValidateAtPick: 'ValidateAtPick',
18
- Receipt: 'Receipt',
19
- RequiredAtReceipt: 'RequiredAtReceipt',
20
- ValidateAtReceipt: 'ValidateAtReceipt',
21
- ReceiptReturn: 'ReceiptReturn',
22
- RequiredAtReceiptReturn: 'RequiredAtReceiptReturn',
23
- ValidateAtReceiptReturn: 'ValidateAtReceiptReturn',
24
- Sort: 'Sort',
25
- RequiredAtSort: 'RequiredAtSort',
26
- ValidateAtSort: 'ValidateAtSort',
27
- StockTake: 'StockTake',
28
- RequiredAtStockTake: 'RequiredAtStockTake',
29
- ValidateAtStockTake: 'ValidateAtStockTake'
30
- };
31
- Object.freeze(AttributeOperation);