@bexis2/bexis2-core-ui 0.2.32 → 0.3.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.
@@ -0,0 +1,99 @@
1
+ export const bexis2Theme = {
2
+ name: 'bexis2Theme',
3
+ properties: {
4
+ // =~= Theme Properties =~=
5
+ "--theme-font-family-base": `system-ui`,
6
+ "--theme-font-family-heading": `system-ui`,
7
+ "--theme-font-color-base": "var(--color-surface-900)",
8
+ "--theme-font-color-dark": "255 255 255",
9
+ "--theme-rounded-base": "4px",
10
+ "--theme-rounded-container": "4px",
11
+ "--theme-border-base": "1px",
12
+ // =~= Theme On-X Colors =~=
13
+ "--on-primary": "255 255 255",
14
+ "--on-secondary": "255 255 255",
15
+ "--on-tertiary": "0 0 0",
16
+ "--on-success": "255 255 255",
17
+ "--on-warning": "255 255 255",
18
+ "--on-error": "255 255 255",
19
+ "--on-surface": "255 255 255",
20
+ // =~= Theme Colors =~=
21
+ // primary | #45b2a1
22
+ "--color-primary-50": "227 243 241",
23
+ "--color-primary-100": "218 240 236",
24
+ "--color-primary-200": "209 236 232",
25
+ "--color-primary-300": "181 224 217",
26
+ "--color-primary-400": "125 201 189",
27
+ "--color-primary-500": "69 178 161",
28
+ "--color-primary-600": "62 160 145",
29
+ "--color-primary-700": "52 134 121",
30
+ "--color-primary-800": "41 107 97",
31
+ "--color-primary-900": "34 87 79",
32
+ // secondary | #ff9700
33
+ "--color-secondary-50": "255 239 217",
34
+ "--color-secondary-100": "255 234 204",
35
+ "--color-secondary-200": "255 229 191",
36
+ "--color-secondary-300": "255 213 153",
37
+ "--color-secondary-400": "255 182 77",
38
+ "--color-secondary-500": "255 151 0",
39
+ "--color-secondary-600": "230 136 0",
40
+ "--color-secondary-700": "191 113 0",
41
+ "--color-secondary-800": "153 91 0",
42
+ "--color-secondary-900": "125 74 0",
43
+ // tertiary | #bee1da
44
+ "--color-tertiary-50": "245 251 249",
45
+ "--color-tertiary-100": "242 249 248",
46
+ "--color-tertiary-200": "239 248 246",
47
+ "--color-tertiary-300": "229 243 240",
48
+ "--color-tertiary-400": "210 234 229",
49
+ "--color-tertiary-500": "190 225 218",
50
+ "--color-tertiary-600": "171 203 196",
51
+ "--color-tertiary-700": "143 169 164",
52
+ "--color-tertiary-800": "114 135 131",
53
+ "--color-tertiary-900": "93 110 107",
54
+ // success | #4BB543
55
+ "--color-success-50": "228 244 227",
56
+ "--color-success-100": "219 240 217",
57
+ "--color-success-200": "210 237 208",
58
+ "--color-success-300": "183 225 180",
59
+ "--color-success-400": "129 203 123",
60
+ "--color-success-500": "75 181 67",
61
+ "--color-success-600": "68 163 60",
62
+ "--color-success-700": "56 136 50",
63
+ "--color-success-800": "45 109 40",
64
+ "--color-success-900": "37 89 33",
65
+ // warning | #EAB308
66
+ "--color-warning-50": "252 244 218",
67
+ "--color-warning-100": "251 240 206",
68
+ "--color-warning-200": "250 236 193",
69
+ "--color-warning-300": "247 225 156",
70
+ "--color-warning-400": "240 202 82",
71
+ "--color-warning-500": "234 179 8",
72
+ "--color-warning-600": "211 161 7",
73
+ "--color-warning-700": "176 134 6",
74
+ "--color-warning-800": "140 107 5",
75
+ "--color-warning-900": "115 88 4",
76
+ // error | #FF0000
77
+ "--color-error-50": "255 217 217",
78
+ "--color-error-100": "255 204 204",
79
+ "--color-error-200": "255 191 191",
80
+ "--color-error-300": "255 153 153",
81
+ "--color-error-400": "255 77 77",
82
+ "--color-error-500": "255 0 0",
83
+ "--color-error-600": "230 0 0",
84
+ "--color-error-700": "191 0 0",
85
+ "--color-error-800": "153 0 0",
86
+ "--color-error-900": "125 0 0",
87
+ // surface | #c7c7c7
88
+ "--color-surface-50": "247 247 247",
89
+ "--color-surface-100": "244 244 244",
90
+ "--color-surface-200": "241 241 241",
91
+ "--color-surface-300": "233 233 233",
92
+ "--color-surface-400": "216 216 216",
93
+ "--color-surface-500": "199 199 199",
94
+ "--color-surface-600": "179 179 179",
95
+ "--color-surface-700": "149 149 149",
96
+ "--color-surface-800": "119 119 119",
97
+ "--color-surface-900": "98 98 98", // #626262
98
+ }
99
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bexis2/bexis2-core-ui",
3
- "version": "0.2.32",
3
+ "version": "0.3.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vite dev",
@@ -19,13 +19,15 @@
19
19
  },
20
20
  "devDependencies": {
21
21
  "@playwright/test": "^1.36.2",
22
- "@skeletonlabs/skeleton": "^1.9.0",
22
+ "@skeletonlabs/skeleton": "^2.5.0",
23
+ "@skeletonlabs/tw-plugin": "^0.2.4",
23
24
  "@sveltejs/adapter-auto": "^2.0.0",
24
25
  "@sveltejs/adapter-static": "^2.0.2",
25
26
  "@sveltejs/kit": "^1.5.0",
26
27
  "@sveltejs/package": "^2.0.2",
27
28
  "@tailwindcss/forms": "^0.5.3",
28
29
  "@tailwindcss/typography": "^0.5.9",
30
+ "@types/node": "^20.9.0",
29
31
  "@typescript-eslint/eslint-plugin": "^5.45.0",
30
32
  "@typescript-eslint/parser": "^5.45.0",
31
33
  "autoprefixer": "^10.4.14",
@@ -9,7 +9,8 @@
9
9
  import { lintGutter, linter } from '@codemirror/lint';
10
10
  import { json, jsonParseLinter } from '@codemirror/lang-json';
11
11
  import { oneDark } from '@codemirror/theme-one-dark';
12
- import { Modal, modalStore } from '@skeletonlabs/skeleton';
12
+ import { Modal, getModalStore} from '@skeletonlabs/skeleton';
13
+ const modalStore = getModalStore();
13
14
  import { faMoon, faSave, faSun } from '@fortawesome/free-regular-svg-icons';
14
15
  import { faArrowRotateLeft, faXmark } from '@fortawesome/free-solid-svg-icons';
15
16
  import type { ThemeSpec } from 'svelte-codemirror-editor';
@@ -148,11 +148,10 @@
148
148
 
149
149
  let message = files.accepted.length + ' is/are uploaded';
150
150
 
151
- let fileList:string[] = [];
152
- files.accepted.forEach(f => fileList.push(f.name))
151
+ let fileList: string[] = [];
152
+ files.accepted.forEach((f) => fileList.push(f.name));
153
153
 
154
-
155
- dispatch('success', { text: message , files: fileList});
154
+ dispatch('success', { text: message, files: fileList });
156
155
 
157
156
  files.accepted = [];
158
157
  }
@@ -1,181 +1,180 @@
1
- <script>
2
- import InputContainer from './InputContainer.svelte';
3
-
4
- import Select from 'svelte-select';
5
- import { onMount } from 'svelte';
6
-
7
- export let source;
8
- export let target;
9
- export let id;
10
- export let title;
11
- export let itemId = 'value';
12
- export let itemLabel = 'label';
13
- export let itemGroup = 'group';
14
- export let isMulti = true;
15
- export let complexSource = false;
16
- export let complexTarget = false;
17
- export let required = false;
18
- export let feedback = [''];
19
- export let placeholder = '-- Please select --';
20
- export let invalid = false;
21
- export let loading = false;
22
- export let help = false;
23
- export let clearable = true;
24
- export let disabled = false;
25
-
26
-
27
- let isLoaded = false;
28
-
29
- $: value = null;
30
- $: updateTarget(value);
31
- $: target, setValue(target);
32
-
33
- let groupBy;
34
- $: groupBy;
35
-
36
- function updateTarget(selection) {
37
- //console.log("UPDATE target",selection);
38
- //different cases
39
- //a) source is complex model is simple return array
40
- if (complexSource && !complexTarget && isLoaded && isMulti) {
41
- //console.log('a) source is complex model is simple');
42
-
43
- target = [];
44
- for (let i in selection) {
45
- let item = selection[i];
46
- target.push(item[itemId]);
47
- }
48
- }
49
-
50
- if (!complexSource && !complexTarget && isLoaded && isMulti) {
51
- target = [];
52
-
53
- for (let i in selection) {
54
- target.push(selection[i].value);
55
- }
56
- }
57
-
58
- if (complexSource && complexTarget && isLoaded && isMulti) {
59
- //console.log("both complex",selection);
60
- target = selection;
61
- }
62
-
63
- if (complexSource && complexTarget && isLoaded && !isMulti) {
64
- target = selection;
65
- }
66
-
67
- if (!complexSource && !complexTarget && isLoaded && !isMulti) {
68
- target = selection.value;
69
- }
70
-
71
- if (complexSource && !complexTarget && isLoaded && !isMulti) {
72
- target = selection[itemLabel];
73
- //console.log('selection', selection);
74
- }
75
-
76
- //console.log('selection ' + title, selection);
77
- //console.log('target ' + title, target);
78
- }
79
-
80
- onMount(async () => {
81
- //console.log("OnMount", target)
82
- if(complexSource && complexTarget) // after on mount a setValue is needed when data is complex
83
- {
84
- setValue(target);
85
- }
86
- });
87
-
88
- function setValue(t) {
89
- //console.log("Set Value",t);
90
- //a) source is complex model is simple
91
- if (complexSource && !complexTarget && isMulti) {
92
- let items = [];
93
- // event.detail will be null unless isMulti is true and user has removed a single item
94
- for (let i in t) {
95
- let t = target[i];
96
- items.push(source.find((item) => item[itemId] === t));
97
- }
98
-
99
- isLoaded = true;
100
- if (items.length > 0) {
101
- value = items;
102
- }
103
- ////console.log(value);
104
- groupBy = (item) => item[itemGroup];
105
- }
106
-
107
- if (complexSource && complexTarget && isMulti) {
108
- value = t;
109
- isLoaded = true;
110
- groupBy = (item) => item[itemGroup];
111
- }
112
-
113
- //b) simple liust and simple model
114
- if (!complexSource && !complexTarget && isMulti) {
115
- //console.log('b) simple liust and simple model');
116
- //console.log('source', source);
117
- //console.log("target",t);
118
- isLoaded = true;
119
- //set target only if its nit empty
120
- if (t != null && t !== undefined && t != '') {
121
- //console.log('target', t);
122
- value = t;
123
- }
124
- }
125
-
126
- if (!isMulti) {
127
- //console.log("onmount",complexSource,complexTarget,value,target)
128
- if (!complexSource && !complexTarget) {
129
- value = {
130
- value: t,
131
- label: t
132
- };
133
- }
134
-
135
- if (complexSource && complexTarget) {
136
- value = t;
137
- groupBy = (item) => item[itemGroup];
138
- }
139
-
140
- if (complexSource && !complexTarget) {
141
- //value = target
142
- console.log(
143
- 'this case is currently not supported (complexSource,complexTarget,isMulti)',
144
- complexSource,
145
- complexTarget,
146
- isMulti
147
- );
148
- }
149
-
150
- isLoaded = true;
151
- }
152
-
153
- //console.log(t,value)
154
- }
155
- </script>
156
-
157
- <InputContainer {id} label={title} {feedback} {required} {help}>
158
- <Select
159
- {id}
160
- items={source}
161
- {groupBy}
162
- {itemId}
163
- label={itemLabel}
164
- multiple={isMulti}
165
- bind:value
166
- {placeholder}
167
- hasError={invalid}
168
- {loading}
169
- {clearable}
170
- {disabled}
171
- on:change
172
- on:input
173
- on:focus
174
- on:blur
175
- on:clear
176
- on:loaded
177
- on:error
178
- on:filter
179
- on:hoverItem
180
- />
181
- </InputContainer>
1
+ <script>
2
+ import InputContainer from './InputContainer.svelte';
3
+
4
+ import Select from 'svelte-select';
5
+ import { onMount } from 'svelte';
6
+
7
+ export let source;
8
+ export let target;
9
+ export let id;
10
+ export let title;
11
+ export let itemId = 'value';
12
+ export let itemLabel = 'label';
13
+ export let itemGroup = 'group';
14
+ export let isMulti = true;
15
+ export let complexSource = false;
16
+ export let complexTarget = false;
17
+ export let required = false;
18
+ export let feedback = [''];
19
+ export let placeholder = '-- Please select --';
20
+ export let invalid = false;
21
+ export let loading = false;
22
+ export let help = false;
23
+ export let clearable = true;
24
+ export let disabled = false;
25
+
26
+ let isLoaded = false;
27
+
28
+ $: value = null;
29
+ $: updateTarget(value);
30
+ $: target, setValue(target);
31
+
32
+ let groupBy;
33
+ $: groupBy;
34
+
35
+ function updateTarget(selection) {
36
+ //console.log("UPDATE target",selection);
37
+ //different cases
38
+ //a) source is complex model is simple return array
39
+ if (complexSource && !complexTarget && isLoaded && isMulti) {
40
+ //console.log('a) source is complex model is simple');
41
+
42
+ target = [];
43
+ for (let i in selection) {
44
+ let item = selection[i];
45
+ target.push(item[itemId]);
46
+ }
47
+ }
48
+
49
+ if (!complexSource && !complexTarget && isLoaded && isMulti) {
50
+ target = [];
51
+
52
+ for (let i in selection) {
53
+ target.push(selection[i].value);
54
+ }
55
+ }
56
+
57
+ if (complexSource && complexTarget && isLoaded && isMulti) {
58
+ //console.log("both complex",selection);
59
+ target = selection;
60
+ }
61
+
62
+ if (complexSource && complexTarget && isLoaded && !isMulti) {
63
+ target = selection;
64
+ }
65
+
66
+ if (!complexSource && !complexTarget && isLoaded && !isMulti) {
67
+ target = selection.value;
68
+ }
69
+
70
+ if (complexSource && !complexTarget && isLoaded && !isMulti) {
71
+ target = selection[itemLabel];
72
+ //console.log('selection', selection);
73
+ }
74
+
75
+ //console.log('selection ' + title, selection);
76
+ //console.log('target ' + title, target);
77
+ }
78
+
79
+ onMount(async () => {
80
+ //console.log("OnMount", target)
81
+ if (complexSource && complexTarget) {
82
+ // after on mount a setValue is needed when data is complex
83
+ setValue(target);
84
+ }
85
+ });
86
+
87
+ function setValue(t) {
88
+ //console.log("Set Value",t);
89
+ //a) source is complex model is simple
90
+ if (complexSource && !complexTarget && isMulti) {
91
+ let items = [];
92
+ // event.detail will be null unless isMulti is true and user has removed a single item
93
+ for (let i in t) {
94
+ let t = target[i];
95
+ items.push(source.find((item) => item[itemId] === t));
96
+ }
97
+
98
+ isLoaded = true;
99
+ if (items.length > 0) {
100
+ value = items;
101
+ }
102
+ ////console.log(value);
103
+ groupBy = (item) => item[itemGroup];
104
+ }
105
+
106
+ if (complexSource && complexTarget && isMulti) {
107
+ value = t;
108
+ isLoaded = true;
109
+ groupBy = (item) => item[itemGroup];
110
+ }
111
+
112
+ //b) simple liust and simple model
113
+ if (!complexSource && !complexTarget && isMulti) {
114
+ //console.log('b) simple liust and simple model');
115
+ //console.log('source', source);
116
+ //console.log("target",t);
117
+ isLoaded = true;
118
+ //set target only if its nit empty
119
+ if (t != null && t !== undefined && t != '') {
120
+ //console.log('target', t);
121
+ value = t;
122
+ }
123
+ }
124
+
125
+ if (!isMulti) {
126
+ //console.log("onmount",complexSource,complexTarget,value,target)
127
+ if (!complexSource && !complexTarget) {
128
+ value = {
129
+ value: t,
130
+ label: t
131
+ };
132
+ }
133
+
134
+ if (complexSource && complexTarget) {
135
+ value = t;
136
+ groupBy = (item) => item[itemGroup];
137
+ }
138
+
139
+ if (complexSource && !complexTarget) {
140
+ //value = target
141
+ console.log(
142
+ 'this case is currently not supported (complexSource,complexTarget,isMulti)',
143
+ complexSource,
144
+ complexTarget,
145
+ isMulti
146
+ );
147
+ }
148
+
149
+ isLoaded = true;
150
+ }
151
+
152
+ //console.log(t,value)
153
+ }
154
+ </script>
155
+
156
+ <InputContainer {id} label={title} {feedback} {required} {help}>
157
+ <Select
158
+ {id}
159
+ items={source}
160
+ {groupBy}
161
+ {itemId}
162
+ label={itemLabel}
163
+ multiple={isMulti}
164
+ bind:value
165
+ {placeholder}
166
+ hasError={invalid}
167
+ {loading}
168
+ {clearable}
169
+ {disabled}
170
+ on:change
171
+ on:input
172
+ on:focus
173
+ on:blur
174
+ on:clear
175
+ on:loaded
176
+ on:error
177
+ on:filter
178
+ on:hoverItem
179
+ />
180
+ </InputContainer>
@@ -1,12 +1,67 @@
1
1
  <script lang="ts">
2
- import { Toast } from '@skeletonlabs/skeleton';
2
+ import { onMount } from 'svelte';
3
+ import { Toast, getToastStore, type ToastSettings } from '@skeletonlabs/skeleton';
3
4
  import { notificationStore } from '$store/pageStores';
5
+ import type { notificationStoreType } from '$models/Models';
6
+ import {notificationType} from '$models/Enums'
7
+
8
+ const toastStore = getToastStore()
4
9
 
5
10
  let btnStyle: string;
6
11
  $: btnStyle =
7
12
  $notificationStore === undefined || $notificationStore.btnStyle === undefined
8
13
  ? notificationStore.getBtnStyle()
9
14
  : $notificationStore.btnStyle;
15
+
16
+
17
+ $:$notificationStore, triggerToast();
18
+
19
+ onMount(()=>{
20
+ toastStore.clear()
21
+ })
22
+
23
+ function triggerToast(){
24
+ toastStore.clear()
25
+
26
+ const timeout = 30000;
27
+ let classes = '';
28
+
29
+ if($notificationStore.message != undefined && $notificationStore.message != '')
30
+ {
31
+ switch ($notificationStore.notificationType) {
32
+ case notificationType.success:
33
+ classes =
34
+ 'bg-success-300 border-solid border-2 border-success-500 shadow-md text-surface-900';
35
+ break;
36
+ case notificationType.warning:
37
+ classes =
38
+ 'bg-warning-300 border-solid border-2 border-warning-500 shadow-md text-surface-900';
39
+ break;
40
+ case notificationType.error:
41
+ classes =
42
+ 'bg-error-300 border-solid border-2 border-error-500 shadow-md text-surface-900';
43
+ break;
44
+ case notificationType.surface:
45
+ classes =
46
+ 'bg-surface-300 border-solid border-2 border-surface-500 shadow-md text-surface-900';
47
+ break;
48
+ }
49
+
50
+ const notificationToast: ToastSettings = {
51
+ classes: classes,
52
+ message: $notificationStore.message,
53
+ timeout: timeout,
54
+ callback: () => {toastStore.clear()}
55
+ };
56
+
57
+ toastStore.trigger(notificationToast);
58
+
59
+ }
60
+
61
+ }
62
+
63
+
64
+
10
65
  </script>
11
66
 
12
67
  <Toast position="t" buttonDismiss={btnStyle} />
@@ -20,8 +20,7 @@
20
20
 
21
21
  storePopup.set({ computePosition, autoUpdate, offset, shift, flip, arrow });
22
22
 
23
- // stores
24
- import { helpStore } from '$store/pageStores';
23
+
25
24
  import Docs from './Docs.svelte';
26
25
 
27
26
  export let title = '';
@@ -33,7 +32,7 @@
33
32
  export let footer: boolean = true;
34
33
  export let help: boolean = false;
35
34
  export let contentLayoutType: pageContentLayoutType = pageContentLayoutType.center;
36
- export let fixLeft:boolean = true;
35
+ export let fixLeft: boolean = true;
37
36
 
38
37
  onMount(async () => {
39
38
  console.log('page');
@@ -53,7 +52,7 @@
53
52
  {/if}
54
53
 
55
54
  <div class="grid grid-cols-2">
56
- <Breadcrumb bind:title={title} />
55
+ <Breadcrumb bind:title />
57
56
  <Docs {links} {note} />
58
57
  </div>
59
58
  </svelte:fragment>