vira 22.2.1 → 23.0.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.
- package/dist/elements/define-vira-element.d.ts +22 -1
- package/dist/elements/define-vira-element.js +18 -1
- package/dist/elements/dropdown/dropdown-helpers.d.ts +26 -3
- package/dist/elements/dropdown/dropdown-helpers.js +26 -3
- package/dist/elements/dropdown/vira-dropdown-item.element.d.ts +17 -6
- package/dist/elements/dropdown/vira-dropdown-item.element.js +12 -6
- package/dist/elements/dropdown/vira-dropdown-options.element.d.ts +14 -3
- package/dist/elements/dropdown/vira-dropdown-options.element.js +18 -7
- package/dist/elements/dropdown/vira-dropdown.element.d.ts +20 -8
- package/dist/elements/dropdown/vira-dropdown.element.js +28 -16
- package/dist/elements/index.d.ts +10 -10
- package/dist/elements/index.js +10 -10
- package/dist/elements/shared-text-input-logic.d.ts +20 -0
- package/dist/elements/shared-text-input-logic.js +13 -3
- package/dist/elements/vira-button.element.d.ts +17 -5
- package/dist/elements/vira-button.element.js +27 -15
- package/dist/elements/vira-collapsible-wrapper.element.d.ts +9 -2
- package/dist/elements/vira-collapsible-wrapper.element.js +10 -3
- package/dist/elements/vira-icon.element.d.ts +10 -3
- package/dist/elements/vira-icon.element.js +9 -2
- package/dist/elements/vira-image.element.d.ts +7 -7
- package/dist/elements/vira-image.element.js +20 -17
- package/dist/elements/vira-input.element.d.ts +20 -7
- package/dist/elements/vira-input.element.js +32 -16
- package/dist/elements/vira-link.element.d.ts +10 -2
- package/dist/elements/vira-link.element.js +11 -3
- package/dist/icons/icon-color.test-helper.d.ts +6 -0
- package/dist/icons/icon-color.test-helper.js +9 -0
- package/dist/icons/icon-css-vars.d.ts +10 -3
- package/dist/icons/icon-css-vars.js +7 -0
- package/dist/icons/icon-svg.d.ts +17 -1
- package/dist/icons/icon-svg.js +13 -2
- package/dist/icons/icon-svgs/check-24.icon.d.ts +8 -1
- package/dist/icons/icon-svgs/check-24.icon.js +9 -2
- package/dist/icons/icon-svgs/chevron-up-24.icon.d.ts +8 -1
- package/dist/icons/icon-svgs/chevron-up-24.icon.js +9 -2
- package/dist/icons/icon-svgs/close-x-24.icon.d.ts +8 -1
- package/dist/icons/icon-svgs/close-x-24.icon.js +9 -2
- package/dist/icons/icon-svgs/element-16.icon.d.ts +8 -1
- package/dist/icons/icon-svgs/element-16.icon.js +9 -2
- package/dist/icons/icon-svgs/element-24.icon.d.ts +8 -1
- package/dist/icons/icon-svgs/element-24.icon.js +9 -2
- package/dist/icons/icon-svgs/eye-closed-24.icon.d.ts +8 -1
- package/dist/icons/icon-svgs/eye-closed-24.icon.js +9 -2
- package/dist/icons/icon-svgs/eye-open-24.icon.d.ts +8 -1
- package/dist/icons/icon-svgs/eye-open-24.icon.js +9 -3
- package/dist/icons/icon-svgs/loader-24.icon.d.ts +8 -1
- package/dist/icons/icon-svgs/loader-24.icon.js +9 -2
- package/dist/icons/icon-svgs/loader-animated-24.icon.d.ts +8 -1
- package/dist/icons/icon-svgs/loader-animated-24.icon.js +10 -3
- package/dist/icons/icon-svgs/options-24.icon.d.ts +8 -1
- package/dist/icons/icon-svgs/options-24.icon.js +10 -3
- package/dist/icons/icon-svgs/status-failure-24.icon.d.ts +8 -1
- package/dist/icons/icon-svgs/status-failure-24.icon.js +9 -2
- package/dist/icons/icon-svgs/status-in-progress-24.icon.d.ts +8 -1
- package/dist/icons/icon-svgs/status-in-progress-24.icon.js +9 -2
- package/dist/icons/icon-svgs/status-success-24.icon.d.ts +8 -1
- package/dist/icons/icon-svgs/status-success-24.icon.js +9 -2
- package/dist/icons/index.d.ts +33 -28
- package/dist/icons/index.js +33 -28
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -5
- package/dist/re-exports/colorjs-io.d.ts +12 -0
- package/dist/re-exports/colorjs-io.js +7 -0
- package/dist/re-exports/index.d.ts +1 -1
- package/dist/re-exports/index.js +1 -1
- package/dist/styles/border.d.ts +7 -1
- package/dist/styles/border.js +6 -0
- package/dist/styles/color.d.ts +12 -2
- package/dist/styles/color.js +12 -2
- package/dist/styles/disabled.d.ts +5 -0
- package/dist/styles/disabled.js +5 -0
- package/dist/styles/durations.d.ts +17 -7
- package/dist/styles/durations.js +14 -4
- package/dist/styles/focus.d.ts +12 -4
- package/dist/styles/focus.js +11 -3
- package/dist/styles/form-themes.d.ts +12 -6
- package/dist/styles/form-themes.js +7 -1
- package/dist/styles/index.d.ts +10 -10
- package/dist/styles/index.js +10 -10
- package/dist/styles/native-styles.d.ts +11 -0
- package/dist/styles/native-styles.js +11 -0
- package/dist/styles/scrollbar.d.ts +5 -0
- package/dist/styles/scrollbar.js +5 -0
- package/dist/styles/shadows.d.ts +5 -0
- package/dist/styles/shadows.js +5 -0
- package/dist/styles/user-select.d.ts +5 -0
- package/dist/styles/user-select.js +5 -0
- package/dist/util/index.d.ts +1 -1
- package/dist/util/index.js +1 -1
- package/dist/util/pop-up-manager.d.ts +61 -6
- package/dist/util/pop-up-manager.js +43 -33
- package/package.json +34 -30
- package/dist/elements/dropdown/dropdown.mock.d.ts +0 -13
- package/dist/elements/dropdown/dropdown.mock.js +0 -18
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A wrapper element that can collapse and expand to fit its content dynamically and efficiently.
|
|
3
|
+
*
|
|
4
|
+
* @category Collapsible
|
|
5
|
+
* @category Elements
|
|
6
|
+
* @see https://electrovir.github.io/element-vir/vira/book/elements/vira-collapsible-wrapper
|
|
7
|
+
*/
|
|
1
8
|
export declare const ViraCollapsibleWrapper: import("element-vir").DeclarativeElementDefinition<"vira-collapsible-wrapper", {
|
|
2
9
|
expanded: boolean;
|
|
3
10
|
}, {
|
|
4
11
|
contentHeight: number;
|
|
5
12
|
}, {
|
|
6
|
-
expandChange: import("element-vir").
|
|
7
|
-
}, "vira-collapsible-wrapper-expanded",
|
|
13
|
+
expandChange: import("element-vir").DefineEvent<boolean>;
|
|
14
|
+
}, "vira-collapsible-wrapper-expanded", "vira-collapsible-wrapper-", readonly ["header"]>;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { css, defineElementEvent, html, listen, onResize } from 'element-vir';
|
|
2
|
-
import { noNativeFormStyles, viraAnimationDurations } from '../styles';
|
|
3
|
-
import { defineViraElement } from './define-vira-element';
|
|
2
|
+
import { noNativeFormStyles, viraAnimationDurations } from '../styles/index.js';
|
|
3
|
+
import { defineViraElement } from './define-vira-element.js';
|
|
4
|
+
/**
|
|
5
|
+
* A wrapper element that can collapse and expand to fit its content dynamically and efficiently.
|
|
6
|
+
*
|
|
7
|
+
* @category Collapsible
|
|
8
|
+
* @category Elements
|
|
9
|
+
* @see https://electrovir.github.io/element-vir/vira/book/elements/vira-collapsible-wrapper
|
|
10
|
+
*/
|
|
4
11
|
export const ViraCollapsibleWrapper = defineViraElement()({
|
|
5
12
|
tagName: 'vira-collapsible-wrapper',
|
|
6
13
|
hostClasses: {
|
|
@@ -39,7 +46,7 @@ export const ViraCollapsibleWrapper = defineViraElement()({
|
|
|
39
46
|
stateInitStatic: {
|
|
40
47
|
contentHeight: 0,
|
|
41
48
|
},
|
|
42
|
-
|
|
49
|
+
render({ state, slotNames, updateState, dispatch, events, inputs }) {
|
|
43
50
|
const collapsingStyles = inputs.expanded
|
|
44
51
|
? css `
|
|
45
52
|
height: ${state.contentHeight}px;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import { ViraIconSvg } from '../icons/icon-svg';
|
|
1
|
+
import { ViraIconSvg } from '../icons/icon-svg.js';
|
|
2
|
+
/**
|
|
3
|
+
* An element that renders a single {@link ViraIconSvg}.
|
|
4
|
+
*
|
|
5
|
+
* @category Icon
|
|
6
|
+
* @category Elements
|
|
7
|
+
* @see https://electrovir.github.io/element-vir/vira/book/elements/vira-icon
|
|
8
|
+
*/
|
|
2
9
|
export declare const ViraIcon: import("element-vir").DeclarativeElementDefinition<"vira-icon", {
|
|
3
|
-
icon: Pick<ViraIconSvg,
|
|
10
|
+
icon: Pick<ViraIconSvg, "svgTemplate"> | undefined;
|
|
4
11
|
/** Ignores the given icon's embedded size and causes the <svg> element to fill its parent. */
|
|
5
12
|
fitContainer?: boolean | undefined;
|
|
6
|
-
}, {}, {}, "vira-icon-fit-container",
|
|
13
|
+
}, {}, {}, "vira-icon-fit-container", "vira-icon-", readonly []>;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { css } from 'element-vir';
|
|
2
|
-
import { defineViraElement } from './define-vira-element';
|
|
2
|
+
import { defineViraElement } from './define-vira-element.js';
|
|
3
|
+
/**
|
|
4
|
+
* An element that renders a single {@link ViraIconSvg}.
|
|
5
|
+
*
|
|
6
|
+
* @category Icon
|
|
7
|
+
* @category Elements
|
|
8
|
+
* @see https://electrovir.github.io/element-vir/vira/book/elements/vira-icon
|
|
9
|
+
*/
|
|
3
10
|
export const ViraIcon = defineViraElement()({
|
|
4
11
|
tagName: 'vira-icon',
|
|
5
12
|
hostClasses: {
|
|
@@ -24,7 +31,7 @@ export const ViraIcon = defineViraElement()({
|
|
|
24
31
|
width: 100%;
|
|
25
32
|
}
|
|
26
33
|
`,
|
|
27
|
-
|
|
34
|
+
render({ inputs }) {
|
|
28
35
|
if (!inputs.icon) {
|
|
29
36
|
return '';
|
|
30
37
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { Dimensions } from '@augment-vir/common';
|
|
2
2
|
import { Duration, DurationUnit } from 'date-vir';
|
|
3
|
-
export declare enum ViraImageSlotNameEnum {
|
|
4
|
-
Loading = "loading",
|
|
5
|
-
Error = "error"
|
|
6
|
-
}
|
|
7
3
|
/**
|
|
8
4
|
* An `<img>` element wrapper that handles size constraints and includes slots for loading and error
|
|
9
5
|
* indicators.
|
|
10
6
|
*
|
|
11
7
|
* Use CSS properties to constrain the image. In particular, set `min-height` and `min-width` on
|
|
12
8
|
* this to control the size of the loader and error slots.
|
|
9
|
+
*
|
|
10
|
+
* @category Image
|
|
11
|
+
* @category Elements
|
|
12
|
+
* @see https://electrovir.github.io/element-vir/vira/book/elements/vira-image
|
|
13
13
|
*/
|
|
14
14
|
export declare const ViraImage: import("element-vir").DeclarativeElementDefinition<"vira-image", {
|
|
15
15
|
/** The URL of the image to load. This is passed directly to the `<img>` element. */
|
|
@@ -40,6 +40,6 @@ export declare const ViraImage: import("element-vir").DeclarativeElementDefiniti
|
|
|
40
40
|
[url: string]: true;
|
|
41
41
|
}>;
|
|
42
42
|
}, {
|
|
43
|
-
imageLoad: import("element-vir").
|
|
44
|
-
imageError: import("element-vir").
|
|
45
|
-
}, "vira-image-height-constrained",
|
|
43
|
+
imageLoad: import("element-vir").DefineEvent<void>;
|
|
44
|
+
imageError: import("element-vir").DefineEvent<unknown>;
|
|
45
|
+
}, "vira-image-height-constrained", "vira-image-", readonly ["loading", "error"]>;
|
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
import { wait } from '@augment-vir/common';
|
|
2
2
|
import { classMap, css, defineElementEvent, html, listen, renderIf } from 'element-vir';
|
|
3
|
-
import { LoaderAnimated24Icon, StatusFailure24Icon } from '../icons';
|
|
4
|
-
import { defineViraElement } from './define-vira-element';
|
|
5
|
-
import { ViraIcon } from './vira-icon.element';
|
|
6
|
-
export var ViraImageSlotNameEnum;
|
|
7
|
-
(function (ViraImageSlotNameEnum) {
|
|
8
|
-
ViraImageSlotNameEnum["Loading"] = "loading";
|
|
9
|
-
ViraImageSlotNameEnum["Error"] = "error";
|
|
10
|
-
})(ViraImageSlotNameEnum || (ViraImageSlotNameEnum = {}));
|
|
3
|
+
import { LoaderAnimated24Icon, StatusFailure24Icon } from '../icons/index.js';
|
|
4
|
+
import { defineViraElement } from './define-vira-element.js';
|
|
5
|
+
import { ViraIcon } from './vira-icon.element.js';
|
|
11
6
|
/**
|
|
12
7
|
* An `<img>` element wrapper that handles size constraints and includes slots for loading and error
|
|
13
8
|
* indicators.
|
|
14
9
|
*
|
|
15
10
|
* Use CSS properties to constrain the image. In particular, set `min-height` and `min-width` on
|
|
16
11
|
* this to control the size of the loader and error slots.
|
|
12
|
+
*
|
|
13
|
+
* @category Image
|
|
14
|
+
* @category Elements
|
|
15
|
+
* @see https://electrovir.github.io/element-vir/vira/book/elements/vira-image
|
|
17
16
|
*/
|
|
18
17
|
export const ViraImage = defineViraElement()({
|
|
19
18
|
tagName: 'vira-image',
|
|
20
19
|
hostClasses: {
|
|
21
20
|
'vira-image-height-constrained': ({ inputs }) => inputs.dominantDimension === 'height',
|
|
22
21
|
},
|
|
22
|
+
slotNames: [
|
|
23
|
+
'loading',
|
|
24
|
+
'error',
|
|
25
|
+
],
|
|
23
26
|
events: {
|
|
24
27
|
imageLoad: defineElementEvent(),
|
|
25
28
|
imageError: defineElementEvent(),
|
|
@@ -83,7 +86,7 @@ export const ViraImage = defineViraElement()({
|
|
|
83
86
|
*/
|
|
84
87
|
erroredUrls: {},
|
|
85
88
|
},
|
|
86
|
-
|
|
89
|
+
render({ inputs, state, updateState, dispatch, events, slotNames }) {
|
|
87
90
|
/**
|
|
88
91
|
* Saved off for use in the image listeners. This is used to eliminate race conditions
|
|
89
92
|
* between image events and the input URL changing.
|
|
@@ -91,17 +94,17 @@ export const ViraImage = defineViraElement()({
|
|
|
91
94
|
const imageUrl = inputs.imageUrl;
|
|
92
95
|
const statusTemplate = state.erroredUrls[imageUrl]
|
|
93
96
|
? html `
|
|
94
|
-
<slot class="status-wrapper" name=${
|
|
97
|
+
<slot class="status-wrapper" name=${slotNames.error}>
|
|
95
98
|
<${ViraIcon.assign({ icon: StatusFailure24Icon })} class="error"></${ViraIcon}>
|
|
96
99
|
</slot>
|
|
97
100
|
`
|
|
98
|
-
:
|
|
99
|
-
?
|
|
100
|
-
|
|
101
|
+
: state.loadedUrls[imageUrl]
|
|
102
|
+
? undefined
|
|
103
|
+
: html `
|
|
104
|
+
<slot class="status-wrapper" name=${slotNames.loading}>
|
|
101
105
|
<${ViraIcon.assign({ icon: LoaderAnimated24Icon })}></${ViraIcon}>
|
|
102
106
|
</slot>
|
|
103
|
-
|
|
104
|
-
: undefined;
|
|
107
|
+
`;
|
|
105
108
|
return html `
|
|
106
109
|
${renderIf(!!statusTemplate, statusTemplate)}
|
|
107
110
|
<img
|
|
@@ -110,7 +113,7 @@ export const ViraImage = defineViraElement()({
|
|
|
110
113
|
})}
|
|
111
114
|
${listen('load', async () => {
|
|
112
115
|
if (inputs._debugLoadDelay) {
|
|
113
|
-
await wait(inputs._debugLoadDelay
|
|
116
|
+
await wait(inputs._debugLoadDelay);
|
|
114
117
|
}
|
|
115
118
|
updateState({
|
|
116
119
|
loadedUrls: {
|
|
@@ -122,7 +125,7 @@ export const ViraImage = defineViraElement()({
|
|
|
122
125
|
})}
|
|
123
126
|
${listen('error', async (event) => {
|
|
124
127
|
if (inputs._debugLoadDelay) {
|
|
125
|
-
await wait(inputs._debugLoadDelay
|
|
128
|
+
await wait(inputs._debugLoadDelay);
|
|
126
129
|
}
|
|
127
130
|
updateState({
|
|
128
131
|
erroredUrls: {
|
|
@@ -1,13 +1,26 @@
|
|
|
1
|
-
import { ViraIconSvg } from '../icons';
|
|
2
|
-
import { SharedTextInputElementInputs } from './shared-text-input-logic';
|
|
3
|
-
export * from './shared-text-input-logic';
|
|
1
|
+
import { ViraIconSvg } from '../icons/index.js';
|
|
2
|
+
import { SharedTextInputElementInputs } from './shared-text-input-logic.js';
|
|
3
|
+
export * from './shared-text-input-logic.js';
|
|
4
|
+
/**
|
|
5
|
+
* Input types for {@link ViraInput}.
|
|
6
|
+
*
|
|
7
|
+
* @category Input
|
|
8
|
+
*/
|
|
4
9
|
export declare enum ViraInputType {
|
|
5
10
|
Default = "text",
|
|
6
11
|
Password = "password",
|
|
7
12
|
Email = "email"
|
|
8
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* A single line input element with all listeners properly attached. Multiple types are allowed with
|
|
16
|
+
* {@link ViraInputType}.
|
|
17
|
+
*
|
|
18
|
+
* @category Input
|
|
19
|
+
* @category Elements
|
|
20
|
+
* @see https://electrovir.github.io/element-vir/vira/book/elements/vira-input
|
|
21
|
+
*/
|
|
9
22
|
export declare const ViraInput: import("element-vir").DeclarativeElementDefinition<"vira-input", {
|
|
10
|
-
icon?: undefined | Pick<ViraIconSvg,
|
|
23
|
+
icon?: undefined | Pick<ViraIconSvg, "svgTemplate">;
|
|
11
24
|
/** A suffix that, if provided, is shown following the user input field. */
|
|
12
25
|
suffix?: string | undefined;
|
|
13
26
|
showClearButton?: boolean | undefined;
|
|
@@ -20,11 +33,11 @@ export declare const ViraInput: import("element-vir").DeclarativeElementDefiniti
|
|
|
20
33
|
* Fires whenever a user input created a new value. Does not fire if all input letters are
|
|
21
34
|
* filtered out due to input restrictions.
|
|
22
35
|
*/
|
|
23
|
-
valueChange: import("element-vir").
|
|
36
|
+
valueChange: import("element-vir").DefineEvent<string>;
|
|
24
37
|
/**
|
|
25
38
|
* Fires when inputs are blocked. Useful for showing warnings or error messages to inform
|
|
26
39
|
* the user why their input did not propagate if it was blocked. This does not fire for text
|
|
27
40
|
* that was blocked out of programmatic "value" property assignments.
|
|
28
41
|
*/
|
|
29
|
-
inputBlocked: import("element-vir").
|
|
30
|
-
}, "vira-input-disabled" | "vira-input-fit-text" | "vira-input-clear-button-shown", "vira-input-background-color" | "vira-input-placeholder-color" | "vira-input-text-color" | "vira-input-border-color" | "vira-input-focus-border-color" | "vira-input-text-selection-color" | "vira-input-action-button-color" | "vira-input-clear-button-hover-color" | "vira-input-clear-button-active-color" | "vira-input-show-password-button-hover-color" | "vira-input-show-password-button-active-color" | "vira-input-padding-horizontal" | "vira-input-padding-vertical", readonly
|
|
42
|
+
inputBlocked: import("element-vir").DefineEvent<string>;
|
|
43
|
+
}, "vira-input-disabled" | "vira-input-fit-text" | "vira-input-clear-button-shown", "vira-input-background-color" | "vira-input-placeholder-color" | "vira-input-text-color" | "vira-input-border-color" | "vira-input-focus-border-color" | "vira-input-text-selection-color" | "vira-input-action-button-color" | "vira-input-clear-button-hover-color" | "vira-input-clear-button-active-color" | "vira-input-show-password-button-hover-color" | "vira-input-show-password-button-active-color" | "vira-input-padding-horizontal" | "vira-input-padding-vertical", readonly []>;
|
|
@@ -1,19 +1,32 @@
|
|
|
1
1
|
import { css, defineElementEvent, html, listen, onResize, renderIf, } from 'element-vir';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { noNativeFormStyles } from '../styles/native-styles';
|
|
7
|
-
import { defineViraElement } from './define-vira-element';
|
|
8
|
-
import { filterTextInputValue, textInputListener, } from './shared-text-input-logic';
|
|
9
|
-
import { ViraIcon } from './vira-icon.element';
|
|
10
|
-
export * from './shared-text-input-logic';
|
|
2
|
+
import { CloseX24Icon } from '../icons/icon-svgs/close-x-24.icon.js';
|
|
3
|
+
import { EyeClosed24Icon, EyeOpen24Icon } from '../icons/index.js';
|
|
4
|
+
import { createFocusStyles, viraFocusCssVars } from '../styles/focus.js';
|
|
5
|
+
import { noUserSelect, viraAnimationDurations, viraBorders, viraDisabledStyles, } from '../styles/index.js';
|
|
6
|
+
import { noNativeFormStyles } from '../styles/native-styles.js';
|
|
7
|
+
import { defineViraElement } from './define-vira-element.js';
|
|
8
|
+
import { filterTextInputValue, textInputListener, } from './shared-text-input-logic.js';
|
|
9
|
+
import { ViraIcon } from './vira-icon.element.js';
|
|
10
|
+
export * from './shared-text-input-logic.js';
|
|
11
|
+
/**
|
|
12
|
+
* Input types for {@link ViraInput}.
|
|
13
|
+
*
|
|
14
|
+
* @category Input
|
|
15
|
+
*/
|
|
11
16
|
export var ViraInputType;
|
|
12
17
|
(function (ViraInputType) {
|
|
13
18
|
ViraInputType["Default"] = "text";
|
|
14
19
|
ViraInputType["Password"] = "password";
|
|
15
20
|
ViraInputType["Email"] = "email";
|
|
16
21
|
})(ViraInputType || (ViraInputType = {}));
|
|
22
|
+
/**
|
|
23
|
+
* A single line input element with all listeners properly attached. Multiple types are allowed with
|
|
24
|
+
* {@link ViraInputType}.
|
|
25
|
+
*
|
|
26
|
+
* @category Input
|
|
27
|
+
* @category Elements
|
|
28
|
+
* @see https://electrovir.github.io/element-vir/vira/book/elements/vira-input
|
|
29
|
+
*/
|
|
17
30
|
export const ViraInput = defineViraElement()({
|
|
18
31
|
tagName: 'vira-input',
|
|
19
32
|
hostClasses: {
|
|
@@ -31,7 +44,9 @@ export const ViraInput = defineViraElement()({
|
|
|
31
44
|
'vira-input-action-button-color': '#aaaaaa',
|
|
32
45
|
'vira-input-clear-button-hover-color': '#ff0000',
|
|
33
46
|
'vira-input-clear-button-active-color': '#b30000',
|
|
47
|
+
// eslint-disable-next-line sonarjs/no-hardcoded-credentials
|
|
34
48
|
'vira-input-show-password-button-hover-color': '#0a89ff',
|
|
49
|
+
// eslint-disable-next-line sonarjs/no-hardcoded-credentials
|
|
35
50
|
'vira-input-show-password-button-active-color': '#0261ba',
|
|
36
51
|
'vira-input-padding-horizontal': '10px',
|
|
37
52
|
'vira-input-padding-vertical': '6px',
|
|
@@ -236,9 +251,9 @@ export const ViraInput = defineViraElement()({
|
|
|
236
251
|
forcedInputWidth: 0,
|
|
237
252
|
showPassword: false,
|
|
238
253
|
},
|
|
239
|
-
|
|
254
|
+
render: ({ inputs, dispatch, state, updateState, events }) => {
|
|
240
255
|
const { filtered: filteredValue } = filterTextInputValue({
|
|
241
|
-
value: inputs.value
|
|
256
|
+
value: inputs.value,
|
|
242
257
|
allowed: inputs.allowedInputs,
|
|
243
258
|
blocked: inputs.blockedInputs,
|
|
244
259
|
});
|
|
@@ -252,6 +267,7 @@ export const ViraInput = defineViraElement()({
|
|
|
252
267
|
width: ${state.forcedInputWidth}px;
|
|
253
268
|
`
|
|
254
269
|
: '';
|
|
270
|
+
const shouldBlockBrowserHelps = inputs.disableBrowserHelps || inputs.type !== ViraInputType.Default;
|
|
255
271
|
return html `
|
|
256
272
|
<label>
|
|
257
273
|
${iconTemplate}
|
|
@@ -268,10 +284,10 @@ export const ViraInput = defineViraElement()({
|
|
|
268
284
|
<input
|
|
269
285
|
type=${calculateEffectiveInputType(inputs.type, state.showPassword)}
|
|
270
286
|
style=${forcedInputWidthStyles}
|
|
271
|
-
autocomplete=${
|
|
272
|
-
autocorrect=${
|
|
273
|
-
autocapitalize=${
|
|
274
|
-
spellcheck=${
|
|
287
|
+
autocomplete=${shouldBlockBrowserHelps ? 'off' : ''}
|
|
288
|
+
autocorrect=${shouldBlockBrowserHelps ? 'off' : ''}
|
|
289
|
+
autocapitalize=${shouldBlockBrowserHelps ? 'off' : ''}
|
|
290
|
+
spellcheck=${shouldBlockBrowserHelps ? 'false' : ''}
|
|
275
291
|
?disabled=${inputs.disabled}
|
|
276
292
|
.value=${filteredValue}
|
|
277
293
|
${listen('input', (event) => {
|
|
@@ -303,7 +319,7 @@ export const ViraInput = defineViraElement()({
|
|
|
303
319
|
<${ViraIcon.assign({ icon: CloseX24Icon })}></${ViraIcon}>
|
|
304
320
|
</button>
|
|
305
321
|
`)}
|
|
306
|
-
${renderIf(
|
|
322
|
+
${renderIf(inputs.type === ViraInputType.Password, html `
|
|
307
323
|
<button
|
|
308
324
|
class="show-password-button"
|
|
309
325
|
title="show password"
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { FullRoute, SpaRouter } from 'spa-router-vir';
|
|
2
2
|
import { RequireExactlyOne } from 'type-fest';
|
|
3
|
+
/**
|
|
4
|
+
* A hyperlink wrapper element that can be configured to emit route change events rather than just
|
|
5
|
+
* being a raw link.
|
|
6
|
+
*
|
|
7
|
+
* @category Link
|
|
8
|
+
* @category Elements
|
|
9
|
+
* @see https://electrovir.github.io/element-vir/vira/book/elements/vira-link
|
|
10
|
+
*/
|
|
3
11
|
export declare const ViraLink: import("element-vir").DeclarativeElementDefinition<"vira-link", RequireExactlyOne<{
|
|
4
12
|
/**
|
|
5
13
|
* A full raw URL link that will navigate the current window away or open a new tab. If this
|
|
@@ -15,7 +23,7 @@ export declare const ViraLink: import("element-vir").DeclarativeElementDefinitio
|
|
|
15
23
|
*/
|
|
16
24
|
route: {
|
|
17
25
|
route: FullRoute<any, any, any>;
|
|
18
|
-
router: Pick<SpaRouter<any, any, any>,
|
|
26
|
+
router: Pick<SpaRouter<any, any, any>, "createRouteUrl" | "setRouteOnDirectNavigation">;
|
|
19
27
|
scrollToTop?: boolean;
|
|
20
28
|
};
|
|
21
|
-
}>, {}, {},
|
|
29
|
+
}>, {}, {}, "vira-link-", "vira-link-hover-color", readonly []>;
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { css, html, listen } from 'element-vir';
|
|
2
|
-
import { defineViraElement } from './define-vira-element';
|
|
2
|
+
import { defineViraElement } from './define-vira-element.js';
|
|
3
|
+
/**
|
|
4
|
+
* A hyperlink wrapper element that can be configured to emit route change events rather than just
|
|
5
|
+
* being a raw link.
|
|
6
|
+
*
|
|
7
|
+
* @category Link
|
|
8
|
+
* @category Elements
|
|
9
|
+
* @see https://electrovir.github.io/element-vir/vira/book/elements/vira-link
|
|
10
|
+
*/
|
|
3
11
|
export const ViraLink = defineViraElement()({
|
|
4
12
|
tagName: 'vira-link',
|
|
5
13
|
cssVars: {
|
|
@@ -28,7 +36,7 @@ export const ViraLink = defineViraElement()({
|
|
|
28
36
|
color: ${cssVars['vira-link-hover-color'].value};
|
|
29
37
|
}
|
|
30
38
|
`,
|
|
31
|
-
|
|
39
|
+
render({ inputs }) {
|
|
32
40
|
function clickCallback(event) {
|
|
33
41
|
if (!inputs.route) {
|
|
34
42
|
return;
|
|
@@ -49,7 +57,7 @@ export const ViraLink = defineViraElement()({
|
|
|
49
57
|
else {
|
|
50
58
|
const linkUrl = inputs.link
|
|
51
59
|
? inputs.link.url
|
|
52
|
-
: inputs.route
|
|
60
|
+
: inputs.route.router.createRouteUrl(inputs.route.route);
|
|
53
61
|
/** Noopener and noreferrer are needed for security reasons, do not remove! */
|
|
54
62
|
return html `
|
|
55
63
|
<a href=${linkUrl} rel="noopener noreferrer" ${listen('click', clickCallback)}>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export var ColorType;
|
|
2
|
+
(function (ColorType) {
|
|
3
|
+
ColorType["Color"] = "color";
|
|
4
|
+
ColorType["Fill"] = "fill";
|
|
5
|
+
ColorType["Stroke"] = "stroke";
|
|
6
|
+
})(ColorType || (ColorType = {}));
|
|
7
|
+
export function extractIconColor(element, colorType) {
|
|
8
|
+
return window.getComputedStyle(element).getPropertyValue(colorType);
|
|
9
|
+
}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS vars that are supported by all Vira SVG icons.
|
|
3
|
+
*
|
|
4
|
+
* @category Icon
|
|
5
|
+
* @category CSS Vars
|
|
6
|
+
* @category Styles
|
|
7
|
+
*/
|
|
1
8
|
export declare const viraIconCssVars: import("lit-css-vars").CssVarDefinitions<{
|
|
2
9
|
/** To be used for coloring an icon's stroke. */
|
|
3
|
-
'vira-icon-stroke-color':
|
|
10
|
+
readonly 'vira-icon-stroke-color': "currentColor";
|
|
4
11
|
/** To be used for coloring an icon's fill. */
|
|
5
|
-
'vira-icon-fill-color':
|
|
6
|
-
'vira-icon-stroke-width':
|
|
12
|
+
readonly 'vira-icon-fill-color': "none";
|
|
13
|
+
readonly 'vira-icon-stroke-width': "1px";
|
|
7
14
|
}>;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { defineCssVars } from 'lit-css-vars';
|
|
2
|
+
/**
|
|
3
|
+
* CSS vars that are supported by all Vira SVG icons.
|
|
4
|
+
*
|
|
5
|
+
* @category Icon
|
|
6
|
+
* @category CSS Vars
|
|
7
|
+
* @category Styles
|
|
8
|
+
*/
|
|
2
9
|
export const viraIconCssVars = defineCssVars({
|
|
3
10
|
/** To be used for coloring an icon's stroke. */
|
|
4
11
|
'vira-icon-stroke-color': 'currentColor',
|
package/dist/icons/icon-svg.d.ts
CHANGED
|
@@ -1,11 +1,27 @@
|
|
|
1
1
|
import { TemplateResult } from 'element-vir';
|
|
2
|
-
import { viraIconCssVars } from './icon-css-vars';
|
|
2
|
+
import { viraIconCssVars } from './icon-css-vars.js';
|
|
3
|
+
/**
|
|
4
|
+
* An individual Vira icon SVG definition.
|
|
5
|
+
*
|
|
6
|
+
* @category Icon
|
|
7
|
+
*/
|
|
3
8
|
export type ViraIconSvg = {
|
|
4
9
|
name: string;
|
|
5
10
|
svgTemplate: TemplateResult;
|
|
6
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* A function used to define an individual Vira icon SVG.
|
|
14
|
+
*
|
|
15
|
+
* @category Icon
|
|
16
|
+
*/
|
|
7
17
|
export declare function defineIcon({ name, svgTemplate, }: {
|
|
8
18
|
name: string;
|
|
9
19
|
svgTemplate: TemplateResult;
|
|
10
20
|
}): ViraIconSvg;
|
|
21
|
+
/**
|
|
22
|
+
* Wraps an existing icon with a specific color and outputs another icon that can be used anywhere
|
|
23
|
+
* the original icon can be used.
|
|
24
|
+
*
|
|
25
|
+
* @category Icon
|
|
26
|
+
*/
|
|
11
27
|
export declare function createColoredIcon(icon: ViraIconSvg, colors: Partial<Record<keyof typeof viraIconCssVars, string>>): ViraIconSvg;
|
package/dist/icons/icon-svg.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { getObjectTypedKeys } from '@augment-vir/common';
|
|
2
2
|
import { html } from 'element-vir';
|
|
3
|
-
import { getAssertedValidColor } from '../styles/color';
|
|
4
|
-
import { viraIconCssVars } from './icon-css-vars';
|
|
3
|
+
import { getAssertedValidColor } from '../styles/color.js';
|
|
4
|
+
import { viraIconCssVars } from './icon-css-vars.js';
|
|
5
|
+
/**
|
|
6
|
+
* A function used to define an individual Vira icon SVG.
|
|
7
|
+
*
|
|
8
|
+
* @category Icon
|
|
9
|
+
*/
|
|
5
10
|
export function defineIcon({ name, svgTemplate, }) {
|
|
6
11
|
const iconSvg = {
|
|
7
12
|
name,
|
|
@@ -9,6 +14,12 @@ export function defineIcon({ name, svgTemplate, }) {
|
|
|
9
14
|
};
|
|
10
15
|
return iconSvg;
|
|
11
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Wraps an existing icon with a specific color and outputs another icon that can be used anywhere
|
|
19
|
+
* the original icon can be used.
|
|
20
|
+
*
|
|
21
|
+
* @category Icon
|
|
22
|
+
*/
|
|
12
23
|
export function createColoredIcon(icon, colors) {
|
|
13
24
|
const colorStyles = getObjectTypedKeys(colors)
|
|
14
25
|
.map((cssVarName) => {
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* A checkmark.
|
|
3
|
+
*
|
|
4
|
+
* @category Icon
|
|
5
|
+
* @category SVG
|
|
6
|
+
* @see https://electrovir.github.io/element-vir/vira/book/icons/check24icon
|
|
7
|
+
*/
|
|
8
|
+
export declare const Check24Icon: import("../icon-svg.js").ViraIconSvg;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { html } from 'element-vir';
|
|
2
|
-
import { viraIconCssVars } from '../icon-css-vars';
|
|
3
|
-
import { defineIcon } from '../icon-svg';
|
|
2
|
+
import { viraIconCssVars } from '../icon-css-vars.js';
|
|
3
|
+
import { defineIcon } from '../icon-svg.js';
|
|
4
|
+
/**
|
|
5
|
+
* A checkmark.
|
|
6
|
+
*
|
|
7
|
+
* @category Icon
|
|
8
|
+
* @category SVG
|
|
9
|
+
* @see https://electrovir.github.io/element-vir/vira/book/icons/check24icon
|
|
10
|
+
*/
|
|
4
11
|
export const Check24Icon = defineIcon({
|
|
5
12
|
name: 'Check24Icon',
|
|
6
13
|
svgTemplate: html `
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* A chevron that points upwards. For an icon that points downwards, rotate this icon.
|
|
3
|
+
*
|
|
4
|
+
* @category Icon
|
|
5
|
+
* @category SVG
|
|
6
|
+
* @see https://electrovir.github.io/element-vir/vira/book/icons/chevronup24icon
|
|
7
|
+
*/
|
|
8
|
+
export declare const ChevronUp24Icon: import("../icon-svg.js").ViraIconSvg;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { html } from 'element-vir';
|
|
2
|
-
import { viraIconCssVars } from '../icon-css-vars';
|
|
3
|
-
import { defineIcon } from '../icon-svg';
|
|
2
|
+
import { viraIconCssVars } from '../icon-css-vars.js';
|
|
3
|
+
import { defineIcon } from '../icon-svg.js';
|
|
4
|
+
/**
|
|
5
|
+
* A chevron that points upwards. For an icon that points downwards, rotate this icon.
|
|
6
|
+
*
|
|
7
|
+
* @category Icon
|
|
8
|
+
* @category SVG
|
|
9
|
+
* @see https://electrovir.github.io/element-vir/vira/book/icons/chevronup24icon
|
|
10
|
+
*/
|
|
4
11
|
export const ChevronUp24Icon = defineIcon({
|
|
5
12
|
name: 'ChevronUp24Icon',
|
|
6
13
|
svgTemplate: html `
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* An x icon meant to be used as a "close" button.
|
|
3
|
+
*
|
|
4
|
+
* @category Icon
|
|
5
|
+
* @category SVG
|
|
6
|
+
* @see https://electrovir.github.io/element-vir/vira/book/icons/closex24icon
|
|
7
|
+
*/
|
|
8
|
+
export declare const CloseX24Icon: import("../icon-svg.js").ViraIconSvg;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { html } from 'element-vir';
|
|
2
|
-
import { viraIconCssVars } from '../icon-css-vars';
|
|
3
|
-
import { defineIcon } from '../icon-svg';
|
|
2
|
+
import { viraIconCssVars } from '../icon-css-vars.js';
|
|
3
|
+
import { defineIcon } from '../icon-svg.js';
|
|
4
|
+
/**
|
|
5
|
+
* An x icon meant to be used as a "close" button.
|
|
6
|
+
*
|
|
7
|
+
* @category Icon
|
|
8
|
+
* @category SVG
|
|
9
|
+
* @see https://electrovir.github.io/element-vir/vira/book/icons/closex24icon
|
|
10
|
+
*/
|
|
4
11
|
export const CloseX24Icon = defineIcon({
|
|
5
12
|
name: 'CloseX24Icon',
|
|
6
13
|
svgTemplate: html `
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* An icon symbol that represents an HTML element.
|
|
3
|
+
*
|
|
4
|
+
* @category Icon
|
|
5
|
+
* @category SVG
|
|
6
|
+
* @see https://electrovir.github.io/element-vir/vira/book/icons/element16icon
|
|
7
|
+
*/
|
|
8
|
+
export declare const Element16Icon: import("../icon-svg.js").ViraIconSvg;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { html } from 'element-vir';
|
|
2
|
-
import { viraIconCssVars } from '../icon-css-vars';
|
|
3
|
-
import { defineIcon } from '../icon-svg';
|
|
2
|
+
import { viraIconCssVars } from '../icon-css-vars.js';
|
|
3
|
+
import { defineIcon } from '../icon-svg.js';
|
|
4
|
+
/**
|
|
5
|
+
* An icon symbol that represents an HTML element.
|
|
6
|
+
*
|
|
7
|
+
* @category Icon
|
|
8
|
+
* @category SVG
|
|
9
|
+
* @see https://electrovir.github.io/element-vir/vira/book/icons/element16icon
|
|
10
|
+
*/
|
|
4
11
|
export const Element16Icon = defineIcon({
|
|
5
12
|
name: 'Element16Icon',
|
|
6
13
|
svgTemplate: html `
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* An icon symbol that represents an HTML element.
|
|
3
|
+
*
|
|
4
|
+
* @category Icon
|
|
5
|
+
* @category SVG
|
|
6
|
+
* @see https://electrovir.github.io/element-vir/vira/book/icons/element24icon
|
|
7
|
+
*/
|
|
8
|
+
export declare const Element24Icon: import("../icon-svg.js").ViraIconSvg;
|