@hyvor/design 2.0.8-beta.3 → 2.0.8
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/cloud/HyvorBar/BarUser.svelte +5 -1
- package/dist/cloud/HyvorBar/HyvorBar.svelte +10 -5
- package/dist/cloud/ResourceCreator/ResourceCreator.svelte +53 -53
- package/dist/components/Checkbox/Checkbox.svelte +17 -11
- package/dist/components/Select/Select.svelte +174 -0
- package/dist/components/Select/Select.svelte.d.ts +20 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/package.json +1 -1
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
import { getCloudContext } from '../CloudContext/cloudContextState.svelte.js';
|
|
9
9
|
|
|
10
10
|
const cloudContext = $derived(getCloudContext());
|
|
11
|
-
const logoutUrl =
|
|
11
|
+
const logoutUrl = $derived(
|
|
12
|
+
cloudContext.deployment === 'cloud'
|
|
13
|
+
? `${cloudContext.instance}/account/logout`
|
|
14
|
+
: '/api/oidc/logout'
|
|
15
|
+
);
|
|
12
16
|
</script>
|
|
13
17
|
|
|
14
18
|
<div class="wrap">
|
|
@@ -80,16 +80,21 @@
|
|
|
80
80
|
{getName()}
|
|
81
81
|
</span>
|
|
82
82
|
</a>
|
|
83
|
-
<BarProducts mobile={mobileShow} />
|
|
84
83
|
|
|
85
|
-
{#if
|
|
86
|
-
<
|
|
84
|
+
{#if deployment === 'cloud'}
|
|
85
|
+
<BarProducts mobile={mobileShow} />
|
|
86
|
+
|
|
87
|
+
{#if organization}
|
|
88
|
+
<BarOrganization />
|
|
89
|
+
{/if}
|
|
90
|
+
<BarLicense name={getName()} />
|
|
87
91
|
{/if}
|
|
88
|
-
<BarLicense name={getName()} />
|
|
89
92
|
</div>
|
|
90
93
|
<div class="center"></div>
|
|
91
94
|
<div class="right">
|
|
92
|
-
|
|
95
|
+
{#if deployment === 'cloud'}
|
|
96
|
+
<BarNotice />
|
|
97
|
+
{/if}
|
|
93
98
|
|
|
94
99
|
<div class="hidden-on-mobile">
|
|
95
100
|
{#if deployment === 'cloud'}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import IconButton from '../../components/IconButton/IconButton.svelte';
|
|
3
3
|
import IconX from '@hyvor/icons/IconX';
|
|
4
|
-
import Button from '../../components/Button/Button.svelte';
|
|
5
|
-
import { onMount, type ComponentProps } from 'svelte';
|
|
6
4
|
import {
|
|
7
5
|
getCloudContext,
|
|
8
6
|
type CloudContextOrganization
|
|
@@ -56,7 +54,7 @@
|
|
|
56
54
|
ondisplay
|
|
57
55
|
}: Props = $props();
|
|
58
56
|
|
|
59
|
-
const { callbacks, organization } = $derived(getCloudContext());
|
|
57
|
+
const { callbacks, organization, deployment } = $derived(getCloudContext());
|
|
60
58
|
|
|
61
59
|
let orgName = $state('');
|
|
62
60
|
let orgNameError = $state('');
|
|
@@ -130,62 +128,64 @@
|
|
|
130
128
|
</div>
|
|
131
129
|
|
|
132
130
|
<div class="content">
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
131
|
+
{#if deployment === 'cloud'}
|
|
132
|
+
<Accordian
|
|
133
|
+
title="Organization"
|
|
134
|
+
belowTitle={organization?.name}
|
|
135
|
+
show={organizationAccordianOpen}
|
|
136
|
+
footer={!organization}
|
|
137
|
+
buttonText="Create Organization"
|
|
138
|
+
onButtonClick={handleOrganizationCreation}
|
|
139
|
+
onToggle={() => {
|
|
140
|
+
organizationAccordianOpen = !organizationAccordianOpen;
|
|
142
141
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}}
|
|
159
|
-
/>
|
|
160
|
-
</div>
|
|
161
|
-
{:else}
|
|
162
|
-
<div class="org-creator">
|
|
163
|
-
<FormControl>
|
|
164
|
-
<TextInput
|
|
165
|
-
bind:value={orgName}
|
|
166
|
-
bind:input={orgNameInput}
|
|
167
|
-
block
|
|
168
|
-
placeholder="Organization Name"
|
|
169
|
-
disabled={creatingOrganization}
|
|
170
|
-
onkeyup={(e) => {
|
|
171
|
-
if (e.key === 'Enter') {
|
|
172
|
-
handleOrganizationCreation();
|
|
173
|
-
}
|
|
142
|
+
if (organizationAccordianOpen && contentAccordianOpen) {
|
|
143
|
+
contentAccordianOpen = false;
|
|
144
|
+
}
|
|
145
|
+
}}
|
|
146
|
+
toggleLocked={creatingResource}
|
|
147
|
+
loading={creatingOrganization}
|
|
148
|
+
>
|
|
149
|
+
{#if organization}
|
|
150
|
+
<div class="org-switcher">
|
|
151
|
+
<OrganizationSwitcher
|
|
152
|
+
manageButton={false}
|
|
153
|
+
createButtonText="Create new organization"
|
|
154
|
+
createButtonProps={{
|
|
155
|
+
size: 'medium',
|
|
156
|
+
color: 'input'
|
|
174
157
|
}}
|
|
175
158
|
/>
|
|
159
|
+
</div>
|
|
160
|
+
{:else}
|
|
161
|
+
<div class="org-creator">
|
|
162
|
+
<FormControl>
|
|
163
|
+
<TextInput
|
|
164
|
+
bind:value={orgName}
|
|
165
|
+
bind:input={orgNameInput}
|
|
166
|
+
block
|
|
167
|
+
placeholder="Organization Name"
|
|
168
|
+
disabled={creatingOrganization}
|
|
169
|
+
onkeyup={(e) => {
|
|
170
|
+
if (e.key === 'Enter') {
|
|
171
|
+
handleOrganizationCreation();
|
|
172
|
+
}
|
|
173
|
+
}}
|
|
174
|
+
/>
|
|
176
175
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
176
|
+
{#if orgNameError}
|
|
177
|
+
<Validation state="error">{orgNameError}</Validation>
|
|
178
|
+
{/if}
|
|
179
|
+
</FormControl>
|
|
181
180
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
181
|
+
<div class="org-note">
|
|
182
|
+
<IconInfoCircle size={12} />
|
|
183
|
+
Organizations can be used across HYVOR products.
|
|
184
|
+
</div>
|
|
185
185
|
</div>
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
186
|
+
{/if}
|
|
187
|
+
</Accordian>
|
|
188
|
+
{/if}
|
|
189
189
|
|
|
190
190
|
<Accordian
|
|
191
191
|
title={resourceTitle}
|
|
@@ -106,6 +106,9 @@
|
|
|
106
106
|
border-radius: 2px;
|
|
107
107
|
outline: 1px solid var(--accent);
|
|
108
108
|
position: relative;
|
|
109
|
+
transition:
|
|
110
|
+
0.2s background-color,
|
|
111
|
+
0.2s box-shadow;
|
|
109
112
|
}
|
|
110
113
|
|
|
111
114
|
span.placeholder:focus-visible {
|
|
@@ -113,10 +116,10 @@
|
|
|
113
116
|
}
|
|
114
117
|
|
|
115
118
|
/* the check icon */
|
|
116
|
-
span.placeholder
|
|
119
|
+
span.placeholder::after {
|
|
117
120
|
content: '';
|
|
118
121
|
position: absolute;
|
|
119
|
-
display: none;
|
|
122
|
+
/* display: none; */
|
|
120
123
|
|
|
121
124
|
/* check icon */
|
|
122
125
|
left: 4.5px;
|
|
@@ -127,6 +130,7 @@
|
|
|
127
130
|
border-width: 0 3px 3px 0;
|
|
128
131
|
transform: rotate(45deg);
|
|
129
132
|
transition: 0.2s box-shadow;
|
|
133
|
+
opacity: 0;
|
|
130
134
|
}
|
|
131
135
|
|
|
132
136
|
.checkbox-wrap:hover span.placeholder {
|
|
@@ -142,20 +146,22 @@
|
|
|
142
146
|
}
|
|
143
147
|
|
|
144
148
|
input:checked ~ span.placeholder:after {
|
|
145
|
-
|
|
149
|
+
opacity: 1;
|
|
146
150
|
}
|
|
147
|
-
|
|
148
|
-
/* disabled styles */
|
|
149
151
|
input:disabled ~ span.placeholder {
|
|
150
152
|
background-color: var(--accent-light);
|
|
151
|
-
border: none !important;
|
|
152
|
-
opacity: 0.2;
|
|
153
|
-
cursor: not-allowed;
|
|
154
153
|
box-shadow: none !important;
|
|
154
|
+
outline: rgba(0, 0, 0, 0.1);
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
input:disabled
|
|
158
|
-
|
|
159
|
-
|
|
157
|
+
input:disabled ~ span.placeholder::after {
|
|
158
|
+
opacity: 0.6;
|
|
159
|
+
border-color: var(--accent-text);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/* If the wrapper contains a disabled input, cursor changes to not-allowed */
|
|
163
|
+
.checkbox-wrap:has(input:disabled),
|
|
164
|
+
.checkbox-wrap:has(input:disabled) label {
|
|
165
|
+
cursor: not-allowed;
|
|
160
166
|
}
|
|
161
167
|
</style>
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
value?: string;
|
|
6
|
+
options?: Option[];
|
|
7
|
+
state?: 'default' | 'error' | 'success' | 'warning';
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
size?: 'small' | 'medium' | 'large' | 'x-small';
|
|
10
|
+
children?: Snippet;
|
|
11
|
+
start?: import('svelte').Snippet;
|
|
12
|
+
end?: import('svelte').Snippet;
|
|
13
|
+
block?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface Option {
|
|
18
|
+
value: string;
|
|
19
|
+
label: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let {
|
|
23
|
+
value = $bindable(''),
|
|
24
|
+
options = [],
|
|
25
|
+
state = 'default',
|
|
26
|
+
placeholder,
|
|
27
|
+
size = 'medium',
|
|
28
|
+
children,
|
|
29
|
+
start,
|
|
30
|
+
end,
|
|
31
|
+
block = true,
|
|
32
|
+
disabled = false,
|
|
33
|
+
...rest
|
|
34
|
+
}: Props = $props();
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<div class="input-wrap state-{state} size-{size}" class:block class:disabled>
|
|
38
|
+
{#if start}
|
|
39
|
+
<span class="slot start">
|
|
40
|
+
{@render start?.()}
|
|
41
|
+
</span>
|
|
42
|
+
{/if}
|
|
43
|
+
<select bind:value {disabled} {...rest}>
|
|
44
|
+
{#if children}
|
|
45
|
+
{@render children()}
|
|
46
|
+
{:else}
|
|
47
|
+
{#if placeholder}
|
|
48
|
+
<option value="" disabled selected={!value}>{placeholder}</option>
|
|
49
|
+
{/if}
|
|
50
|
+
|
|
51
|
+
{#each options as option}
|
|
52
|
+
<option value={option.value}>{option.label}</option>
|
|
53
|
+
{/each}
|
|
54
|
+
{/if}
|
|
55
|
+
</select>
|
|
56
|
+
{#if end}
|
|
57
|
+
<span class="slot end">
|
|
58
|
+
{@render end?.()}
|
|
59
|
+
</span>
|
|
60
|
+
{/if}
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
<style>
|
|
64
|
+
.input-wrap {
|
|
65
|
+
display: inline-flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
height: 30px;
|
|
68
|
+
padding: 0 15px;
|
|
69
|
+
border-radius: 20px;
|
|
70
|
+
background: var(--input);
|
|
71
|
+
transition: 0.2s box-shadow;
|
|
72
|
+
font-size: 14px;
|
|
73
|
+
--local-shadow-size: 2px;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.input-wrap:focus-within {
|
|
77
|
+
outline: 0;
|
|
78
|
+
box-shadow: 0 0 0 var(--local-shadow-size) var(--accent-light);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
select {
|
|
82
|
+
flex: 1;
|
|
83
|
+
width: 100%;
|
|
84
|
+
border: none;
|
|
85
|
+
font-family: inherit;
|
|
86
|
+
font-size: inherit;
|
|
87
|
+
background: transparent;
|
|
88
|
+
padding: 0;
|
|
89
|
+
margin: 0;
|
|
90
|
+
color: inherit;
|
|
91
|
+
height: 100%;
|
|
92
|
+
cursor: pointer;
|
|
93
|
+
}
|
|
94
|
+
select:focus {
|
|
95
|
+
outline: none;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/* Sizes for Select */
|
|
99
|
+
.input-wrap.size-small {
|
|
100
|
+
height: 26px;
|
|
101
|
+
font-size: 12px;
|
|
102
|
+
--local-shadow-size: 1px;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.input-wrap.size-large {
|
|
106
|
+
height: 36px;
|
|
107
|
+
font-size: 16px;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.input-wrap.size-x-small {
|
|
111
|
+
height: 20px;
|
|
112
|
+
font-size: 12px;
|
|
113
|
+
--local-shadow-size: 1px;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.input-wrap.size-medium {
|
|
117
|
+
height: 30px;
|
|
118
|
+
font-size: 14px;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/* styles for states */
|
|
122
|
+
.input-wrap.state-error {
|
|
123
|
+
box-shadow: 0 0 0 var(--local-shadow-size) var(--red-light);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.input-wrap.state-error:focus-within {
|
|
127
|
+
box-shadow: 0 0 0 calc(var(--local-shadow-size) + 1px) var(--red-light);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.input-wrap.state-success {
|
|
131
|
+
box-shadow: 0 0 0 2px var(--green-light);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.input-wrap.state-success:focus-within {
|
|
135
|
+
box-shadow: 0 0 0 calc(var(--local-shadow-size) + 1px) var(--green-light);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.input-wrap.state-warning {
|
|
139
|
+
box-shadow: 0 0 0 2px var(--orange-light);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.input-wrap.state-warning:focus-within {
|
|
143
|
+
box-shadow: 0 0 0 calc(var(--local-shadow-size) + 1px) var(--orange-light);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.input-wrap.block {
|
|
147
|
+
display: flex;
|
|
148
|
+
width: 100%;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.slot {
|
|
152
|
+
display: inline-flex;
|
|
153
|
+
align-items: center;
|
|
154
|
+
color: var(--text-light);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.slot.start {
|
|
158
|
+
margin-right: 8px;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.slot.end {
|
|
162
|
+
margin-left: 8px;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.input-wrap.disabled {
|
|
166
|
+
opacity: 0.5;
|
|
167
|
+
cursor: not-allowed;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.input-wrap.disabled select {
|
|
171
|
+
cursor: not-allowed;
|
|
172
|
+
/* pointer-events: none; */
|
|
173
|
+
}
|
|
174
|
+
</style>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
export interface Option {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
}
|
|
6
|
+
interface Props {
|
|
7
|
+
value?: string;
|
|
8
|
+
options?: Option[];
|
|
9
|
+
state?: 'default' | 'error' | 'success' | 'warning';
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
size?: 'small' | 'medium' | 'large' | 'x-small';
|
|
12
|
+
children?: Snippet;
|
|
13
|
+
start?: import('svelte').Snippet;
|
|
14
|
+
end?: import('svelte').Snippet;
|
|
15
|
+
block?: boolean;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
}
|
|
18
|
+
declare const Select: import("svelte").Component<Props, {}, "value">;
|
|
19
|
+
type Select = ReturnType<typeof Select>;
|
|
20
|
+
export default Select;
|
|
@@ -40,6 +40,7 @@ export { default as Radio } from './Radio/Radio.svelte';
|
|
|
40
40
|
export { default as Slider } from './Slider/Slider.svelte';
|
|
41
41
|
export { default as SplitControl } from './SplitControl/SplitControl.svelte';
|
|
42
42
|
export { default as Switch } from './Switch/Switch.svelte';
|
|
43
|
+
export { default as Select } from './Select/Select.svelte';
|
|
43
44
|
export { default as Table } from './Table/Table.svelte';
|
|
44
45
|
export { default as TableRow } from './Table/TableRow.svelte';
|
|
45
46
|
export { default as TableCell } from './Table/TableCell.svelte';
|
package/dist/components/index.js
CHANGED
|
@@ -40,6 +40,7 @@ export { default as Radio } from './Radio/Radio.svelte';
|
|
|
40
40
|
export { default as Slider } from './Slider/Slider.svelte';
|
|
41
41
|
export { default as SplitControl } from './SplitControl/SplitControl.svelte';
|
|
42
42
|
export { default as Switch } from './Switch/Switch.svelte';
|
|
43
|
+
export { default as Select } from './Select/Select.svelte';
|
|
43
44
|
export { default as Table } from './Table/Table.svelte';
|
|
44
45
|
export { default as TableRow } from './Table/TableRow.svelte';
|
|
45
46
|
export { default as TableCell } from './Table/TableCell.svelte';
|