@kubex/zinc 1.0.18 → 1.0.20
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/custom-elements.json +721 -8
- package/dist/vscode.html-custom-data.json +98 -3
- package/dist/web-types.json +195 -5
- package/dist/zn.d.ts +156 -4
- package/dist/zn.min.js +744 -668
- package/docs/pages/components/input-group.md +61 -0
- package/docs/pages/components/translations.md +53 -0
- package/package.json +1 -1
- package/src/components/audio-select/audio-select.component.ts +131 -0
- package/src/components/audio-select/audio-select.scss +4 -0
- package/src/components/audio-select/audio-select.test.ts +10 -0
- package/src/components/audio-select/index.ts +12 -0
- package/src/components/checkbox/checkbox.component.ts +66 -11
- package/src/components/checkbox/checkbox.scss +102 -15
- package/src/components/data-table/data-table.component.ts +7 -0
- package/src/components/inline-edit/inline-edit.component.ts +2 -1
- package/src/components/input-group/index.ts +12 -0
- package/src/components/input-group/input-group.component.ts +73 -0
- package/src/components/input-group/input-group.scss +65 -0
- package/src/components/input-group/input-group.test.ts +98 -0
- package/src/components/item/item.component.ts +5 -1
- package/src/components/item/item.scss +4 -0
- package/src/components/navbar/navbar.component.ts +21 -6
- package/src/components/navbar/navbar.scss +17 -1
- package/src/components/select/select.component.ts +7 -11
- package/src/components/select/select.scss +3 -3
- package/src/components/tabs/tabs.component.ts +33 -24
- package/src/components/translations/index.ts +6 -0
- package/src/components/translations/translations.component.ts +214 -0
- package/src/components/translations/translations.scss +15 -0
- package/src/components/translations/translations.test.ts +39 -0
- package/src/zinc.ts +3 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
meta:
|
|
3
|
+
title: Input Group
|
|
4
|
+
description: A wrapper component that groups inputs and selects visually.
|
|
5
|
+
layout: component
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Input Groups allow you to group multiple form controls together into a single visual unit.
|
|
9
|
+
|
|
10
|
+
```html:preview
|
|
11
|
+
<zn-input-group>
|
|
12
|
+
<zn-input placeholder="First Name"></zn-input>
|
|
13
|
+
<zn-input placeholder="Last Name"></zn-input>
|
|
14
|
+
</zn-input-group>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Examples
|
|
18
|
+
|
|
19
|
+
### Mixed Inputs and Selects
|
|
20
|
+
|
|
21
|
+
You can combine inputs and selects.
|
|
22
|
+
|
|
23
|
+
```html:preview
|
|
24
|
+
<zn-input-group>
|
|
25
|
+
<zn-select value="http://" style="width: 125px;">
|
|
26
|
+
<zn-option value="http://">http://</zn-option>
|
|
27
|
+
<zn-option value="https://">https://</zn-option>
|
|
28
|
+
</zn-select>
|
|
29
|
+
<zn-input placeholder="example.com"></zn-input>
|
|
30
|
+
</zn-input-group>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Multiple Inputs
|
|
34
|
+
|
|
35
|
+
```html:preview
|
|
36
|
+
<zn-input-group>
|
|
37
|
+
<zn-input placeholder="City"></zn-input>
|
|
38
|
+
<zn-input placeholder="State"></zn-input>
|
|
39
|
+
<zn-input placeholder="Zip"></zn-input>
|
|
40
|
+
</zn-input-group>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Labeled Group
|
|
44
|
+
|
|
45
|
+
Use the `label` attribute to add a label to the input group.
|
|
46
|
+
|
|
47
|
+
```html:preview
|
|
48
|
+
<zn-input-group label="Personal Information">
|
|
49
|
+
<zn-input placeholder="First Name"></zn-input>
|
|
50
|
+
<zn-input placeholder="Last Name"></zn-input>
|
|
51
|
+
</zn-input-group>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Input with Submit Button
|
|
55
|
+
|
|
56
|
+
```html:preview
|
|
57
|
+
<zn-input-group>
|
|
58
|
+
<zn-input placeholder="Email Address" type="email"></zn-input>
|
|
59
|
+
<zn-button>Subscribe</zn-button>
|
|
60
|
+
</zn-input-group>
|
|
61
|
+
```
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
meta:
|
|
3
|
+
title: Translations
|
|
4
|
+
description: A component for managing multi-language text input.
|
|
5
|
+
layout: component
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
The Translations component allows users to enter text for multiple languages, with a tabbed interface for switching
|
|
9
|
+
between languages.
|
|
10
|
+
|
|
11
|
+
```html:preview
|
|
12
|
+
<zn-translations></zn-translations>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Attributes
|
|
16
|
+
|
|
17
|
+
| Attribute | Type | Description |
|
|
18
|
+
|-------------|----------|---------------------------------------------------------------------------------------------|
|
|
19
|
+
| `languages` | `Object` | A key-value pair of language codes and names (e.g., `{ "en": "English", "fr": "French" }`). |
|
|
20
|
+
| `values` | `Object` | A key-value pair of language codes and translations. |
|
|
21
|
+
| `value` | `String` | A JSON string representing the current translations. |
|
|
22
|
+
|
|
23
|
+
## Examples
|
|
24
|
+
|
|
25
|
+
### With Label
|
|
26
|
+
|
|
27
|
+
```html:preview
|
|
28
|
+
|
|
29
|
+
<zn-translations
|
|
30
|
+
label="Description"
|
|
31
|
+
languages='{"en":"English","fr":"French","de":"German"}'>
|
|
32
|
+
</zn-translations>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Custom Languages
|
|
36
|
+
|
|
37
|
+
You can provide a custom list of available languages via the `languages` property.
|
|
38
|
+
|
|
39
|
+
```html:preview
|
|
40
|
+
|
|
41
|
+
<zn-translations
|
|
42
|
+
languages='{"en":"English","fr":"French","de":"German","es":"Spanish","it":"Italian","pt":"Portuguese","ru":"Russian","zh":"Chinese","ja":"Japanese","ar":"Arabic"}'></zn-translations>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Pre-filled Values
|
|
46
|
+
|
|
47
|
+
```html:preview
|
|
48
|
+
|
|
49
|
+
<zn-translations
|
|
50
|
+
languages='{"en":"English","fr":"French"}'
|
|
51
|
+
values='{"en":"Hello World","fr":"Bonjour le monde"}'
|
|
52
|
+
></zn-translations>
|
|
53
|
+
```
|
package/package.json
CHANGED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import {type CSSResultGroup, html, type PropertyValues, unsafeCSS} from 'lit';
|
|
2
|
+
import {property, state} from "lit/decorators.js";
|
|
3
|
+
import ZincElement from '../../internal/zinc-element';
|
|
4
|
+
import type {ZnChangeEvent} from "../../events/zn-change";
|
|
5
|
+
|
|
6
|
+
import styles from './audio-select.scss';
|
|
7
|
+
|
|
8
|
+
interface AudioFile {
|
|
9
|
+
name: string;
|
|
10
|
+
url: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @summary Short summary of the component's intended use.
|
|
15
|
+
* @documentation https://zinc.style/components/audio-select
|
|
16
|
+
* @status experimental
|
|
17
|
+
* @since 1.0
|
|
18
|
+
*
|
|
19
|
+
* @slot - The default slot.
|
|
20
|
+
* @slot actions - The actions slot.
|
|
21
|
+
* @slot footer - The footer slot.
|
|
22
|
+
*
|
|
23
|
+
* @csspart base - The component's base wrapper.
|
|
24
|
+
*
|
|
25
|
+
* @cssproperty --example - An example CSS custom property.
|
|
26
|
+
*/
|
|
27
|
+
export default class ZnAudioSelect extends ZincElement {
|
|
28
|
+
static styles: CSSResultGroup = unsafeCSS(styles);
|
|
29
|
+
|
|
30
|
+
@state() private _isPlaying: boolean = false;
|
|
31
|
+
private readonly _audio: HTMLAudioElement;
|
|
32
|
+
|
|
33
|
+
@property() value = '';
|
|
34
|
+
@property() label = '';
|
|
35
|
+
@property() placeholder = '';
|
|
36
|
+
@property({type: Object}) files: AudioFile[] = [];
|
|
37
|
+
|
|
38
|
+
constructor() {
|
|
39
|
+
super();
|
|
40
|
+
this._audio = new Audio();
|
|
41
|
+
|
|
42
|
+
// Handle audio ending naturally
|
|
43
|
+
this._audio.addEventListener('ended', () => {
|
|
44
|
+
this._isPlaying = false;
|
|
45
|
+
// Reset to start so pressing play again restarts the audio
|
|
46
|
+
this._audio.currentTime = 0;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
disconnectedCallback() {
|
|
51
|
+
super.disconnectedCallback();
|
|
52
|
+
this.stopAudio();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
updated(changedProperties: PropertyValues) {
|
|
56
|
+
super.updated(changedProperties);
|
|
57
|
+
|
|
58
|
+
if (changedProperties.has('value')) {
|
|
59
|
+
this.stopAudio();
|
|
60
|
+
if (this.value) {
|
|
61
|
+
this._audio.src = this.value;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
stopAudio() {
|
|
67
|
+
if (this._audio) {
|
|
68
|
+
this._audio.pause();
|
|
69
|
+
this._audio.currentTime = 0;
|
|
70
|
+
}
|
|
71
|
+
this._isPlaying = false;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
handleSelectChange(e: ZnChangeEvent) {
|
|
75
|
+
if (e.target !== e.currentTarget) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
this.value = (e.target as HTMLSelectElement).value;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
togglePreview(e: CustomEvent) {
|
|
83
|
+
e.stopPropagation();
|
|
84
|
+
|
|
85
|
+
if (!this.value) {
|
|
86
|
+
e.preventDefault();
|
|
87
|
+
this._isPlaying = false;
|
|
88
|
+
this.requestUpdate();
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (this._isPlaying) {
|
|
93
|
+
this._audio.pause();
|
|
94
|
+
this._isPlaying = false;
|
|
95
|
+
} else {
|
|
96
|
+
this._audio.play()
|
|
97
|
+
.then(() => {
|
|
98
|
+
this._isPlaying = true;
|
|
99
|
+
})
|
|
100
|
+
.catch(err => {
|
|
101
|
+
console.error("Audio playback failed:", err);
|
|
102
|
+
this._isPlaying = false;
|
|
103
|
+
this.requestUpdate();
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
render() {
|
|
109
|
+
return html`
|
|
110
|
+
<zn-select
|
|
111
|
+
label="${this.label}"
|
|
112
|
+
value="${this.value}"
|
|
113
|
+
@zn-change="${this.handleSelectChange}">
|
|
114
|
+
<zn-checkbox
|
|
115
|
+
slot="prefix"
|
|
116
|
+
checked-icon="pause"
|
|
117
|
+
unchecked-icon="play_arrow"
|
|
118
|
+
checked-color="primary"
|
|
119
|
+
unchecked-color="secondary"
|
|
120
|
+
?checked="${this._isPlaying}"
|
|
121
|
+
@zn-change="${this.togglePreview}">
|
|
122
|
+
</zn-checkbox>
|
|
123
|
+
|
|
124
|
+
<zn-option value="" disabled>${this.placeholder || 'Select audio'}</zn-option>
|
|
125
|
+
${this.files.map(file => html`
|
|
126
|
+
<zn-option value="${file.url}">${file.name}</zn-option>
|
|
127
|
+
`)}
|
|
128
|
+
</zn-select>
|
|
129
|
+
`;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import '../../../dist/zn.min.js';
|
|
2
|
+
import { expect, fixture, html } from '@open-wc/testing';
|
|
3
|
+
|
|
4
|
+
describe('<zn-audio-select>', () => {
|
|
5
|
+
it('should render a component', async () => {
|
|
6
|
+
const el = await fixture(html` <zn-audio-select></zn-audio-select> `);
|
|
7
|
+
|
|
8
|
+
expect(el).to.exist;
|
|
9
|
+
});
|
|
10
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import ZnAudioSelect from './audio-select.component';
|
|
2
|
+
|
|
3
|
+
export * from './audio-select.component';
|
|
4
|
+
export default ZnAudioSelect;
|
|
5
|
+
|
|
6
|
+
ZnAudioSelect.define('zn-audio-select');
|
|
7
|
+
|
|
8
|
+
declare global {
|
|
9
|
+
interface HTMLElementTagNameMap {
|
|
10
|
+
'zn-audio-select': ZnAudioSelect;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -13,6 +13,8 @@ import type {ZincFormControl} from '../../internal/zinc-element';
|
|
|
13
13
|
|
|
14
14
|
import styles from './checkbox.scss';
|
|
15
15
|
|
|
16
|
+
type ColorOption = 'default' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning' | 'transparent';
|
|
17
|
+
|
|
16
18
|
/**
|
|
17
19
|
* @summary Short summary of the component's intended use.
|
|
18
20
|
* @documentation https://zinc.style/components/checkbox
|
|
@@ -23,7 +25,7 @@ import styles from './checkbox.scss';
|
|
|
23
25
|
*
|
|
24
26
|
* @slot - The checkbox's label.
|
|
25
27
|
* @slot description - A description of the checkbox's label. Serves as help text for a checkbox item. Alternatively, you can use the `description` attribute.
|
|
26
|
-
*
|
|
28
|
+
* @slot selected-content - Use to nest rich content (like an input) inside a selected checkbox item. Use only with the contained style.
|
|
27
29
|
*
|
|
28
30
|
* @event zn-blur - Emitted when the checkbox loses focus.
|
|
29
31
|
* @event zn-change - Emitted when the checked state changes.
|
|
@@ -36,6 +38,7 @@ import styles from './checkbox.scss';
|
|
|
36
38
|
* @csspart control--checked - Matches the control part when the checkbox is checked.
|
|
37
39
|
* @csspart control--indeterminate - Matches the control part when the checkbox is indeterminate.
|
|
38
40
|
* @csspart checked-icon - The checked icon, an `<zn-icon>` element.
|
|
41
|
+
* @csspart unchecked-icon - The unchecked icon, an `<zn-icon>` element.
|
|
39
42
|
* @csspart indeterminate-icon - The indeterminate icon, an `<zn-icon>` element.
|
|
40
43
|
* @csspart label - The container that wraps the checkbox's label.
|
|
41
44
|
* @csspart description - The container that wraps the checkbox's description.
|
|
@@ -46,7 +49,7 @@ export default class ZnCheckbox extends ZincElement implements ZincFormControl {
|
|
|
46
49
|
static dependencies = {'zn-icon': ZnIcon};
|
|
47
50
|
|
|
48
51
|
private readonly formControlController = new FormControlController(this, {
|
|
49
|
-
value: (control: ZnCheckbox) => (control.checked ? control.value || 'on' : undefined),
|
|
52
|
+
value: (control: ZnCheckbox) => (control.checked ? control.value || 'on' : control.uncheckedValue || undefined),
|
|
50
53
|
defaultValue: (control: ZnCheckbox) => control.defaultChecked,
|
|
51
54
|
setValue: (control: ZnCheckbox, checked: boolean) => (control.checked = checked)
|
|
52
55
|
});
|
|
@@ -64,6 +67,9 @@ export default class ZnCheckbox extends ZincElement implements ZincFormControl {
|
|
|
64
67
|
/** The current value of the checkbox, submitted as a name/value pair with form data. */
|
|
65
68
|
@property() value: string;
|
|
66
69
|
|
|
70
|
+
/** The unchecked value of the checkbox, submitted as a name/value pair with form data. */
|
|
71
|
+
@property({attribute: 'unchecked-value', reflect: true}) uncheckedValue: string;
|
|
72
|
+
|
|
67
73
|
/** The checkbox's size. */
|
|
68
74
|
@property({reflect: true}) size: 'small' | 'medium' | 'large' = 'medium';
|
|
69
75
|
|
|
@@ -98,6 +104,9 @@ export default class ZnCheckbox extends ZincElement implements ZincFormControl {
|
|
|
98
104
|
/** Makes the checkbox a required field. */
|
|
99
105
|
@property({type: Boolean, reflect: true}) required = false;
|
|
100
106
|
|
|
107
|
+
/** Submits the form when checkbox is clicked. */
|
|
108
|
+
@property({attribute: 'submit-on-click', type: Boolean, reflect: true}) submitOnClick: boolean = false;
|
|
109
|
+
|
|
101
110
|
/** The checkbox's help text. If you need to display HTML, use the `description` slot instead. */
|
|
102
111
|
@property({attribute: 'description'}) description = '';
|
|
103
112
|
|
|
@@ -105,6 +114,21 @@ export default class ZnCheckbox extends ZincElement implements ZincFormControl {
|
|
|
105
114
|
|
|
106
115
|
@property({attribute: 'label-tooltip'}) labelTooltip: string;
|
|
107
116
|
|
|
117
|
+
/** The icon to show when the checkbox is checked. */
|
|
118
|
+
@property({attribute: 'checked-icon'}) checkedIcon = '';
|
|
119
|
+
|
|
120
|
+
/** The icon to show when the checkbox is unchecked. */
|
|
121
|
+
@property({attribute: 'unchecked-icon'}) uncheckedIcon = '';
|
|
122
|
+
|
|
123
|
+
/** The color of the checkbox. */
|
|
124
|
+
@property({reflect: true}) color: ColorOption = 'default';
|
|
125
|
+
|
|
126
|
+
/** The color of the checkbox when checked. Overrides `color`. */
|
|
127
|
+
@property({attribute: 'checked-color'}) checkedColor: ColorOption;
|
|
128
|
+
|
|
129
|
+
/** The color of the checkbox when unchecked. Overrides `color`. */
|
|
130
|
+
@property({attribute: 'unchecked-color'}) uncheckedColor: ColorOption;
|
|
131
|
+
|
|
108
132
|
/** Gets the validity state object */
|
|
109
133
|
get validity() {
|
|
110
134
|
return this.input?.validity;
|
|
@@ -131,6 +155,11 @@ export default class ZnCheckbox extends ZincElement implements ZincFormControl {
|
|
|
131
155
|
this.checked = !this.checked;
|
|
132
156
|
this.indeterminate = false;
|
|
133
157
|
this.emit('zn-change');
|
|
158
|
+
|
|
159
|
+
const form = this.getForm();
|
|
160
|
+
if (this.submitOnClick && form) {
|
|
161
|
+
form.requestSubmit();
|
|
162
|
+
}
|
|
134
163
|
}
|
|
135
164
|
|
|
136
165
|
private handleBlur() {
|
|
@@ -216,6 +245,11 @@ export default class ZnCheckbox extends ZincElement implements ZincFormControl {
|
|
|
216
245
|
const hasLabelTooltip = this.hasSlotController.test('label-tooltip');
|
|
217
246
|
const hasLabel = this.label || hasLabelSlot;
|
|
218
247
|
|
|
248
|
+
// Determine the effective color
|
|
249
|
+
const effectiveColor = (this.checked || this.indeterminate)
|
|
250
|
+
? (this.checkedColor || this.color)
|
|
251
|
+
: (this.uncheckedColor || this.color);
|
|
252
|
+
|
|
219
253
|
//
|
|
220
254
|
// NOTE: we use a <div> around the label slot because of this Chrome bug.
|
|
221
255
|
//
|
|
@@ -262,6 +296,14 @@ export default class ZnCheckbox extends ZincElement implements ZincFormControl {
|
|
|
262
296
|
'checkbox--small': this.size === 'small',
|
|
263
297
|
'checkbox--medium': this.size === 'medium',
|
|
264
298
|
'checkbox--large': this.size === 'large',
|
|
299
|
+
'checkbox--default': effectiveColor === 'default',
|
|
300
|
+
'checkbox--primary': effectiveColor === 'primary',
|
|
301
|
+
'checkbox--secondary': effectiveColor === 'secondary',
|
|
302
|
+
'checkbox--error': effectiveColor === 'error',
|
|
303
|
+
'checkbox--info': effectiveColor === 'info',
|
|
304
|
+
'checkbox--success': effectiveColor === 'success',
|
|
305
|
+
'checkbox--warning': effectiveColor === 'warning',
|
|
306
|
+
'checkbox--transparent': effectiveColor === 'transparent',
|
|
265
307
|
'checkbox--has-description': hasDescription,
|
|
266
308
|
'checkbox--has-selected-content': this.hasSlotController.test('selected-content')
|
|
267
309
|
})}>
|
|
@@ -289,15 +331,28 @@ export default class ZnCheckbox extends ZincElement implements ZincFormControl {
|
|
|
289
331
|
? ' control--indeterminate'
|
|
290
332
|
: ''}"
|
|
291
333
|
class="checkbox__control">
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
334
|
+
|
|
335
|
+
${this.checked && !this.indeterminate
|
|
336
|
+
? this.checkedIcon
|
|
337
|
+
? html`
|
|
338
|
+
<zn-icon part="checked-icon" class="checkbox__icon" src="${this.checkedIcon}"></zn-icon>`
|
|
339
|
+
: html`
|
|
340
|
+
<svg viewBox="0 0 24 24"
|
|
341
|
+
fill="none"
|
|
342
|
+
stroke="currentColor"
|
|
343
|
+
stroke-width="4"
|
|
344
|
+
stroke-linecap="round"
|
|
345
|
+
stroke-linejoin="round"
|
|
346
|
+
class="svg-icon">
|
|
347
|
+
<polyline class="checkbox__checked-icon" points="20 6 9 17 4 12"></polyline>
|
|
348
|
+
</svg>`
|
|
349
|
+
: ''}
|
|
350
|
+
|
|
351
|
+
${!this.checked && !this.indeterminate && this.uncheckedIcon
|
|
352
|
+
? html`
|
|
353
|
+
<zn-icon part="unchecked-icon" class="checkbox__icon" src="${this.uncheckedIcon}"></zn-icon>`
|
|
354
|
+
: ''}
|
|
355
|
+
|
|
301
356
|
${!this.checked && this.indeterminate
|
|
302
357
|
? html`
|
|
303
358
|
<zn-icon
|
|
@@ -25,6 +25,60 @@
|
|
|
25
25
|
vertical-align: middle;
|
|
26
26
|
cursor: pointer;
|
|
27
27
|
height: 100%;
|
|
28
|
+
|
|
29
|
+
--checkbox-color: var(--zn-color-primary-600);
|
|
30
|
+
--checkbox-color-hover: var(--zn-color-primary-500);
|
|
31
|
+
--checkbox-icon-color: var(--zn-color-neutral-0);
|
|
32
|
+
--checkbox-border-color: var(--zn-input-border-color);
|
|
33
|
+
--checkbox-bg-color: var(--zn-input-background-color);
|
|
34
|
+
|
|
35
|
+
&.checkbox--default {
|
|
36
|
+
--checkbox-color: var(--zn-color-primary-600);
|
|
37
|
+
--checkbox-color-hover: var(--zn-color-primary-500);
|
|
38
|
+
--checkbox-border-color: var(--zn-input-border-color);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&.checkbox--primary {
|
|
42
|
+
--checkbox-color: var(--zn-color-primary-600);
|
|
43
|
+
--checkbox-color-hover: var(--zn-color-primary-500);
|
|
44
|
+
--checkbox-border-color: var(--zn-color-primary-600);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&.checkbox--secondary {
|
|
48
|
+
--checkbox-color: var(--zn-color-neutral-600);
|
|
49
|
+
--checkbox-color-hover: var(--zn-color-neutral-500);
|
|
50
|
+
--checkbox-border-color: var(--zn-color-neutral-300);
|
|
51
|
+
--checkbox-bg-color: var(--zn-color-neutral-50);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&.checkbox--info {
|
|
55
|
+
--checkbox-color: var(--zn-color-info-600);
|
|
56
|
+
--checkbox-color-hover: var(--zn-color-info-500);
|
|
57
|
+
--checkbox-border-color: var(--zn-color-info-600);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&.checkbox--success {
|
|
61
|
+
--checkbox-color: var(--zn-color-success-600);
|
|
62
|
+
--checkbox-color-hover: var(--zn-color-success-500);
|
|
63
|
+
--checkbox-border-color: var(--zn-color-success-600);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&.checkbox--warning {
|
|
67
|
+
--checkbox-color: var(--zn-color-warning-600);
|
|
68
|
+
--checkbox-color-hover: var(--zn-color-warning-500);
|
|
69
|
+
--checkbox-border-color: var(--zn-color-warning-600);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&.checkbox--error {
|
|
73
|
+
--checkbox-color: var(--zn-color-danger-600);
|
|
74
|
+
--checkbox-color-hover: var(--zn-color-danger-500);
|
|
75
|
+
--checkbox-border-color: var(--zn-color-danger-600);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&.checkbox--transparent {
|
|
79
|
+
--checkbox-bg-color: transparent;
|
|
80
|
+
--checkbox-border-color: transparent;
|
|
81
|
+
}
|
|
28
82
|
}
|
|
29
83
|
|
|
30
84
|
.checkbox--small {
|
|
@@ -60,10 +114,10 @@
|
|
|
60
114
|
width: var(--toggle-size);
|
|
61
115
|
height: var(--toggle-size);
|
|
62
116
|
box-shadow: var(--zn-shadow-x-small);
|
|
63
|
-
border: solid var(--zn-input-border-width) var(--
|
|
117
|
+
border: solid var(--zn-input-border-width) var(--checkbox-border-color);
|
|
118
|
+
background-color: var(--checkbox-bg-color);
|
|
64
119
|
border-radius: 2px;
|
|
65
|
-
|
|
66
|
-
color: var(--zn-color-neutral-0);
|
|
120
|
+
color: var(--checkbox-icon-color);
|
|
67
121
|
transition: var(--zn-transition-fast) border-color,
|
|
68
122
|
var(--zn-transition-fast) background-color,
|
|
69
123
|
var(--zn-transition-fast) color,
|
|
@@ -80,7 +134,7 @@
|
|
|
80
134
|
|
|
81
135
|
.checkbox__indeterminate-icon {
|
|
82
136
|
--icon-size: var(--toggle-size);
|
|
83
|
-
--icon-color: var(--
|
|
137
|
+
--icon-color: var(--checkbox-icon-color);
|
|
84
138
|
|
|
85
139
|
display: inline-flex;
|
|
86
140
|
width: var(--toggle-size);
|
|
@@ -88,9 +142,9 @@
|
|
|
88
142
|
}
|
|
89
143
|
|
|
90
144
|
.svg-icon {
|
|
91
|
-
width: 70
|
|
92
|
-
height: 70
|
|
93
|
-
--icon-color: var(--
|
|
145
|
+
width: max(16px, 70%);
|
|
146
|
+
height: max(16px, 70%);
|
|
147
|
+
--icon-color: var(--checkbox-icon-color);
|
|
94
148
|
|
|
95
149
|
.checkbox__checked-icon {
|
|
96
150
|
stroke-dasharray: 24;
|
|
@@ -105,7 +159,7 @@
|
|
|
105
159
|
|
|
106
160
|
.checkbox--checked {
|
|
107
161
|
.svg-icon {
|
|
108
|
-
color: var(--
|
|
162
|
+
color: var(--checkbox-icon-color);
|
|
109
163
|
}
|
|
110
164
|
|
|
111
165
|
.checkbox__checked-icon {
|
|
@@ -115,13 +169,13 @@
|
|
|
115
169
|
|
|
116
170
|
/* Hover */
|
|
117
171
|
.checkbox:not(.checkbox--checked):not(.checkbox--disabled) .checkbox__control:hover {
|
|
118
|
-
border-color: var(--zn-input-border-color-hover);
|
|
172
|
+
border-color: var(--checkbox-color-hover, var(--zn-input-border-color-hover));
|
|
119
173
|
background-color: var(--zn-input-background-color-hover);
|
|
120
174
|
}
|
|
121
175
|
|
|
122
176
|
/* Focus */
|
|
123
177
|
.checkbox:not(.checkbox--checked):not(.checkbox--disabled) .checkbox__input:focus-visible ~ .checkbox__control {
|
|
124
|
-
border-color: var(--
|
|
178
|
+
border-color: var(--checkbox-color);
|
|
125
179
|
outline: var(--zn-focus-ring);
|
|
126
180
|
outline-offset: var(--zn-focus-ring-offset);
|
|
127
181
|
}
|
|
@@ -129,15 +183,16 @@
|
|
|
129
183
|
/* Checked/indeterminate */
|
|
130
184
|
.checkbox--checked .checkbox__control,
|
|
131
185
|
.checkbox--indeterminate .checkbox__control {
|
|
132
|
-
border-color: var(--
|
|
133
|
-
background-color: var(--
|
|
186
|
+
border-color: var(--checkbox-color);
|
|
187
|
+
background-color: var(--checkbox-color);
|
|
188
|
+
color: var(--checkbox-icon-color);
|
|
134
189
|
}
|
|
135
190
|
|
|
136
191
|
/* Checked/indeterminate + hover */
|
|
137
192
|
.checkbox.checkbox--checked:not(.checkbox--disabled) .checkbox__control:hover,
|
|
138
193
|
.checkbox.checkbox--indeterminate:not(.checkbox--disabled) .checkbox__control:hover {
|
|
139
|
-
border-color: var(--
|
|
140
|
-
background-color: var(--
|
|
194
|
+
border-color: var(--checkbox-color-hover);
|
|
195
|
+
background-color: var(--checkbox-color-hover);
|
|
141
196
|
}
|
|
142
197
|
|
|
143
198
|
/* Checked/indeterminate + focus */
|
|
@@ -243,7 +298,39 @@
|
|
|
243
298
|
background-color: var(--zn-color-purple-50);
|
|
244
299
|
}
|
|
245
300
|
|
|
301
|
+
.checkbox--primary .checkbox__control,
|
|
302
|
+
.checkbox--success .checkbox__control,
|
|
303
|
+
.checkbox--warning .checkbox__control,
|
|
304
|
+
.checkbox--error .checkbox__control,
|
|
305
|
+
.checkbox--info .checkbox__control {
|
|
306
|
+
background-color: var(--checkbox-color);
|
|
307
|
+
color: var(--zn-color-neutral-0);
|
|
308
|
+
border-color: var(--checkbox-color);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.checkbox--primary:not(.checkbox--checked):not(.checkbox--disabled) .checkbox__control:hover,
|
|
312
|
+
.checkbox--success:not(.checkbox--checked):not(.checkbox--disabled) .checkbox__control:hover,
|
|
313
|
+
.checkbox--warning:not(.checkbox--checked):not(.checkbox--disabled) .checkbox__control:hover,
|
|
314
|
+
.checkbox--error:not(.checkbox--checked):not(.checkbox--disabled) .checkbox__control:hover,
|
|
315
|
+
.checkbox--info:not(.checkbox--checked):not(.checkbox--disabled) .checkbox__control:hover {
|
|
316
|
+
background-color: var(--checkbox-color-hover);
|
|
317
|
+
border-color: var(--checkbox-color-hover);
|
|
318
|
+
color: var(--zn-color-neutral-0);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.checkbox--secondary .checkbox__control {
|
|
322
|
+
background-color: var(--zn-color-neutral-200);
|
|
323
|
+
color: var(--zn-color-neutral-700);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.checkbox--secondary:not(.checkbox--checked):not(.checkbox--disabled) .checkbox__control:hover {
|
|
327
|
+
background-color: var(--zn-color-neutral-300);
|
|
328
|
+
border-color: var(--zn-color-neutral-300);
|
|
329
|
+
color: var(--zn-color-neutral-800);
|
|
330
|
+
}
|
|
331
|
+
|
|
246
332
|
.checkbox--checked .checkbox__control {
|
|
247
|
-
background-color: var(--
|
|
333
|
+
background-color: var(--checkbox-color);
|
|
334
|
+
color: var(--zn-color-neutral-0);
|
|
248
335
|
}
|
|
249
336
|
}
|
|
@@ -44,6 +44,7 @@ interface Cell {
|
|
|
44
44
|
sortValue?: string;
|
|
45
45
|
uri?: string;
|
|
46
46
|
target?: string;
|
|
47
|
+
copyable?: boolean;
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
interface Row {
|
|
@@ -925,6 +926,12 @@ export default class ZnDataTable extends ZincElement {
|
|
|
925
926
|
<zn-icon src="${src}" color="${color}"></zn-icon> ${content}`;
|
|
926
927
|
}
|
|
927
928
|
|
|
929
|
+
if (data.copyable) {
|
|
930
|
+
return html`
|
|
931
|
+
${content}
|
|
932
|
+
<zn-copy-button value="${data.text}"></zn-copy-button>`;
|
|
933
|
+
}
|
|
934
|
+
|
|
928
935
|
return content;
|
|
929
936
|
}
|
|
930
937
|
|
|
@@ -140,7 +140,7 @@ export default class ZnInlineEdit extends ZincElement implements ZincFormControl
|
|
|
140
140
|
mouseEventHandler = (e: MouseEvent) => {
|
|
141
141
|
if (this.isEditing && !this.contains(e.target as Node)) {
|
|
142
142
|
this.isEditing = false;
|
|
143
|
-
this.
|
|
143
|
+
this.emit('zn-change');
|
|
144
144
|
this.input.blur();
|
|
145
145
|
}
|
|
146
146
|
};
|
|
@@ -204,6 +204,7 @@ export default class ZnInlineEdit extends ZincElement implements ZincFormControl
|
|
|
204
204
|
return;
|
|
205
205
|
}
|
|
206
206
|
this.value = (e.target as (HTMLInputElement | HTMLSelectElement)).value;
|
|
207
|
+
this.emit('zn-input');
|
|
207
208
|
};
|
|
208
209
|
|
|
209
210
|
protected render() {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import ZnInputGroup from './input-group.component';
|
|
2
|
+
|
|
3
|
+
export * from './input-group.component';
|
|
4
|
+
export default ZnInputGroup;
|
|
5
|
+
|
|
6
|
+
ZnInputGroup.define('zn-input-group');
|
|
7
|
+
|
|
8
|
+
declare global {
|
|
9
|
+
interface HTMLElementTagNameMap {
|
|
10
|
+
'zn-input-group': ZnInputGroup;
|
|
11
|
+
}
|
|
12
|
+
}
|