@functionalcms/svelte-components 4.9.8 → 4.10.2
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/dist/components/form/Select.svelte +163 -0
- package/dist/components/form/Select.svelte.d.ts +21 -0
- package/dist/components/form/Switch.svelte +3 -0
- package/dist/components/form/Switch.svelte.d.ts +1 -0
- package/dist/components/layouts/FoldablePanel.svelte +16 -0
- package/dist/components/layouts/FoldablePanel.svelte.d.ts +7 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.server.d.ts +10 -0
- package/dist/index.server.js +9 -0
- package/package.json +4 -5
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from "../../utils.js";
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
uniqueId: string;
|
|
6
|
+
name: string;
|
|
7
|
+
labelCopy: string;
|
|
8
|
+
options: Array<{ value: string; label: string }>;
|
|
9
|
+
size: string;
|
|
10
|
+
multipleSize: number;
|
|
11
|
+
isMultiple: boolean;
|
|
12
|
+
defaultOptionLabel: string;
|
|
13
|
+
isDisabled: boolean;
|
|
14
|
+
isSkinned: boolean;
|
|
15
|
+
css: string;
|
|
16
|
+
singleSelected?: string; // singleSelected can be used for two-way bindings
|
|
17
|
+
multiSelected?: Array<string>; // If we don't make it seems Svelte gets confused:
|
|
18
|
+
selected: (value: string | Array<string>) => void:
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
let {
|
|
22
|
+
uniqueId = '',
|
|
23
|
+
name = '',
|
|
24
|
+
labelCopy = '',
|
|
25
|
+
options = [],
|
|
26
|
+
size = '',
|
|
27
|
+
multipleSize = 1,
|
|
28
|
+
isMultiple = false,
|
|
29
|
+
defaultOptionLabel = 'Please select an option',
|
|
30
|
+
isDisabled = false,
|
|
31
|
+
isSkinned = true,
|
|
32
|
+
css = '',
|
|
33
|
+
singleSelected = $bindable(''),
|
|
34
|
+
multiSelected = $bindable([]), // multiSelected can be used for two-way bindings
|
|
35
|
+
selected = () => {},
|
|
36
|
+
}: Partial<Props> = $props();
|
|
37
|
+
|
|
38
|
+
const changeHandler = () => {
|
|
39
|
+
// dispatch('selected', isMultiple ? multiSelected : singleSelected);
|
|
40
|
+
selected(isMultiple ? multiSelected : singleSelected);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
let disable = isDisabled;
|
|
44
|
+
let classes = $derived(
|
|
45
|
+
cn(
|
|
46
|
+
isSkinned ? 'select' : 'select-base',
|
|
47
|
+
size ? `select-${size}` : '',
|
|
48
|
+
css ? `${css}` : ''));
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<label class="screenreader-only" for={uniqueId}> {labelCopy} </label>
|
|
52
|
+
{#if isMultiple}
|
|
53
|
+
<select
|
|
54
|
+
id={uniqueId}
|
|
55
|
+
class={classes}
|
|
56
|
+
{name}
|
|
57
|
+
disabled={disable}
|
|
58
|
+
multiple
|
|
59
|
+
size={multipleSize}
|
|
60
|
+
bind:value={multiSelected}
|
|
61
|
+
onchange={changeHandler}
|
|
62
|
+
>
|
|
63
|
+
{#each options as { value, label }}
|
|
64
|
+
<option {value}>{label}</option>
|
|
65
|
+
{/each}
|
|
66
|
+
</select>
|
|
67
|
+
{:else}
|
|
68
|
+
<select
|
|
69
|
+
id={uniqueId}
|
|
70
|
+
class={classes}
|
|
71
|
+
{name}
|
|
72
|
+
disabled={disable}
|
|
73
|
+
bind:value={singleSelected}
|
|
74
|
+
onchange={changeHandler}
|
|
75
|
+
>
|
|
76
|
+
<option value="" disabled selected>
|
|
77
|
+
{defaultOptionLabel}
|
|
78
|
+
</option>
|
|
79
|
+
{#each options as { value, label }}
|
|
80
|
+
<option {value}>{label}</option>
|
|
81
|
+
{/each}
|
|
82
|
+
</select>
|
|
83
|
+
{/if}
|
|
84
|
+
|
|
85
|
+
<style>
|
|
86
|
+
.select,
|
|
87
|
+
.select-base {
|
|
88
|
+
display: block;
|
|
89
|
+
width: 100%;
|
|
90
|
+
/* stylelint-disable-next-line property-no-vendor-prefix */
|
|
91
|
+
-webkit-appearance: none;
|
|
92
|
+
/* stylelint-disable-next-line property-no-vendor-prefix */
|
|
93
|
+
-moz-appearance: none;
|
|
94
|
+
appearance: none;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.select,
|
|
98
|
+
.select-skin {
|
|
99
|
+
padding: var(--fluid-6) var(--fluid-32) var(--fluid-6) var(--fluid-12);
|
|
100
|
+
-moz-padding-start: calc(var(--fluid-12) - 3px);
|
|
101
|
+
font-size: var(--fluid-16);
|
|
102
|
+
font-weight: 400;
|
|
103
|
+
line-height: 1.5;
|
|
104
|
+
color: var(--agnostic-dark);
|
|
105
|
+
border: 1px solid var(--agnostic-select-border-color, var(--agnostic-gray-light));
|
|
106
|
+
border-radius: var(--agnostic-radius);
|
|
107
|
+
transition:
|
|
108
|
+
border-color var(--agnostic-timing-fast) ease-in-out,
|
|
109
|
+
box-shadow var(--agnostic-timing-fast) ease-in-out;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* Only shows the down arrow SVG if in single mode */
|
|
113
|
+
.select:not([multiple]) {
|
|
114
|
+
background-color: inherit;
|
|
115
|
+
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23333330' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
|
|
116
|
+
background-repeat: no-repeat;
|
|
117
|
+
background-position: right var(--fluid-12) center;
|
|
118
|
+
background-size: var(--fluid-16) var(--fluid-12);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.select:focus {
|
|
122
|
+
border-color: var(--agnostic-focus-ring-color);
|
|
123
|
+
box-shadow: 0 0 0 var(--agnostic-focus-ring-outline-width) var(--agnostic-focus-ring-color);
|
|
124
|
+
|
|
125
|
+
/* Needed for High Contrast mode */
|
|
126
|
+
outline: var(--agnostic-focus-ring-outline-width) var(--agnostic-focus-ring-outline-style)
|
|
127
|
+
var(--agnostic-focus-ring-outline-color);
|
|
128
|
+
transition: box-shadow var(--agnostic-timing-fast) ease-out;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.select-base,
|
|
132
|
+
.select:disabled {
|
|
133
|
+
background-color: var(--agnostic-disabled-bg);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.select-base,
|
|
137
|
+
.select:-moz-focusring {
|
|
138
|
+
color: transparent;
|
|
139
|
+
text-shadow: 0 0 0 var(--agnostic-dark);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
@media (prefers-reduced-motion), (update: slow) {
|
|
143
|
+
.select,
|
|
144
|
+
.select-base,
|
|
145
|
+
.select:focus {
|
|
146
|
+
transition: none;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.select-small {
|
|
151
|
+
padding-top: var(--fluid-4);
|
|
152
|
+
padding-bottom: var(--fluid-4);
|
|
153
|
+
padding-left: var(--fluid-8);
|
|
154
|
+
font-size: var(--fluid-14);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.select-large {
|
|
158
|
+
padding-top: var(--fluid-8);
|
|
159
|
+
padding-bottom: var(--fluid-8);
|
|
160
|
+
padding-left: var(--fluid-16);
|
|
161
|
+
font-size: var(--fluid-18);
|
|
162
|
+
}
|
|
163
|
+
</style>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
declare const Select: import("svelte").Component<Partial<{
|
|
2
|
+
uniqueId: string;
|
|
3
|
+
name: string;
|
|
4
|
+
labelCopy: string;
|
|
5
|
+
options: Array<{
|
|
6
|
+
value: string;
|
|
7
|
+
label: string;
|
|
8
|
+
}>;
|
|
9
|
+
size: string;
|
|
10
|
+
multipleSize: number;
|
|
11
|
+
isMultiple: boolean;
|
|
12
|
+
defaultOptionLabel: string;
|
|
13
|
+
isDisabled: boolean;
|
|
14
|
+
isSkinned: boolean;
|
|
15
|
+
css: string;
|
|
16
|
+
singleSelected?: string;
|
|
17
|
+
multiSelected?: Array<string>;
|
|
18
|
+
selected: (value: string | Array<string>) => void;
|
|
19
|
+
}>, {}, "singleSelected" | "multiSelected">;
|
|
20
|
+
type Select = ReturnType<typeof Select>;
|
|
21
|
+
export default Select;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
interface Props {
|
|
5
5
|
id: string;
|
|
6
|
+
name: string;
|
|
6
7
|
label: string;
|
|
7
8
|
css: string;
|
|
8
9
|
labelPosition: string;
|
|
@@ -14,6 +15,7 @@
|
|
|
14
15
|
}
|
|
15
16
|
let {
|
|
16
17
|
id = '',
|
|
18
|
+
name= '',
|
|
17
19
|
label = '',
|
|
18
20
|
css = '',
|
|
19
21
|
labelPosition = 'left',
|
|
@@ -68,6 +70,7 @@
|
|
|
68
70
|
type="checkbox"
|
|
69
71
|
class="switch-input"
|
|
70
72
|
{id}
|
|
73
|
+
{name}
|
|
71
74
|
bind:checked={isChecked}
|
|
72
75
|
disabled={isDisabled}
|
|
73
76
|
onclick={handleClick}
|
package/dist/index.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export { default as ChoiceInput } from './components/form/ChoiceInput.svelte';
|
|
|
32
32
|
export type { ChoiceInputOption } from './components/form/utils.js';
|
|
33
33
|
export { default as AntiBot } from './components/form/AntiBot.svelte';
|
|
34
34
|
export { default as Dropzone } from './components/form/Dropzone.svelte';
|
|
35
|
+
export { default as Select } from './components/form/Select.svelte';
|
|
35
36
|
export { default as Markdown } from './components/content/Markdown.svelte';
|
|
36
37
|
export { type BlogPost, listAllPosts, importPost } from './components/blog/blog.js';
|
|
37
38
|
export { default as EasyTools } from './components/integrations/EasyTools.svelte';
|
package/dist/index.js
CHANGED
|
@@ -44,6 +44,7 @@ export { default as Switch } from './components/form/Switch.svelte';
|
|
|
44
44
|
export { default as ChoiceInput } from './components/form/ChoiceInput.svelte';
|
|
45
45
|
export { default as AntiBot } from './components/form/AntiBot.svelte';
|
|
46
46
|
export { default as Dropzone } from './components/form/Dropzone.svelte';
|
|
47
|
+
export { default as Select } from './components/form/Select.svelte';
|
|
47
48
|
/*
|
|
48
49
|
* Content
|
|
49
50
|
*/
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { authenticationHandle } from './auth/authenticationHandle.ts';
|
|
2
|
+
export { default as authorizationHandle } from './auth/authorizationHandle.ts';
|
|
3
|
+
export { default as errorHandler } from './auth/errorHandle.ts';
|
|
4
|
+
export { redisSessionProvider } from './auth/redisSessionProvider.ts';
|
|
5
|
+
export { machineAuthenticationProvider } from './auth/machineAuthenticationProvider.ts';
|
|
6
|
+
export { userAuthenticationProvider } from './auth/userAuthenticationProvider.ts';
|
|
7
|
+
export { getBlobService, getCommunicationService, getDataService, getTemplateService, getWebsiteService, getAIService, getAuthService, } from './server-side/getServices.ts';
|
|
8
|
+
export type { RedirectResponse } from './auth/RedirectResponse.ts';
|
|
9
|
+
export { createMachineTokenApprovedLocals } from './auth/getMachineAccessToken.ts';
|
|
10
|
+
export { isHuman } from './components/form/AntiBot.ts';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { authenticationHandle } from './auth/authenticationHandle.ts';
|
|
2
|
+
export { default as authorizationHandle } from './auth/authorizationHandle.ts';
|
|
3
|
+
export { default as errorHandler } from './auth/errorHandle.ts';
|
|
4
|
+
export { redisSessionProvider } from './auth/redisSessionProvider.ts';
|
|
5
|
+
export { machineAuthenticationProvider } from './auth/machineAuthenticationProvider.ts';
|
|
6
|
+
export { userAuthenticationProvider } from './auth/userAuthenticationProvider.ts';
|
|
7
|
+
export { getBlobService, getCommunicationService, getDataService, getTemplateService, getWebsiteService, getAIService, getAuthService, } from './server-side/getServices.ts';
|
|
8
|
+
export { createMachineTokenApprovedLocals } from './auth/getMachineAccessToken.ts';
|
|
9
|
+
export { isHuman } from './components/form/AntiBot.ts';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@functionalcms/svelte-components",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.10.2",
|
|
4
4
|
"watch": {
|
|
5
5
|
"build": {
|
|
6
6
|
"patterns": [
|
|
@@ -53,7 +53,6 @@
|
|
|
53
53
|
"eslint": "^9.7.0",
|
|
54
54
|
"eslint-config-prettier": "^9.1.0",
|
|
55
55
|
"eslint-plugin-svelte": "^2.36.0",
|
|
56
|
-
"npm-watch": "^0.13.0",
|
|
57
56
|
"prettier": "^3.3.2",
|
|
58
57
|
"prettier-plugin-svelte": "^3.2.6",
|
|
59
58
|
"publint": "^0.3.8",
|
|
@@ -64,14 +63,14 @@
|
|
|
64
63
|
"typescript": "^5.0.0",
|
|
65
64
|
"typescript-eslint": "^8.0.0",
|
|
66
65
|
"vite": "^5.4.11",
|
|
66
|
+
"npm-watch": "^0.13.0",
|
|
67
67
|
"zod": "^3.24.1"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@lucide/svelte": "^0.501.0",
|
|
71
|
-
"embla-carousel-svelte": "^8.5.2",
|
|
72
70
|
"ioredis": "^5.4.2",
|
|
71
|
+
"embla-carousel-svelte": "^8.5.2",
|
|
73
72
|
"marked": "^15.0.6",
|
|
74
|
-
"oauth4webapi": "^3.1.4"
|
|
73
|
+
"oauth4webapi": "^3.1.4"
|
|
75
74
|
},
|
|
76
75
|
"peerDependencies": {
|
|
77
76
|
"@sveltejs/kit": "^2.15.3",
|