@momentum-design/components 0.18.5 → 0.18.6
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/browser/index.js +294 -117
- package/dist/browser/index.js.map +4 -4
- package/dist/components/formfieldwrapper/formfieldwrapper.constants.d.ts +3 -3
- package/dist/components/formfieldwrapper/formfieldwrapper.constants.js +3 -3
- package/dist/components/formfieldwrapper/formfieldwrapper.utils.js +4 -4
- package/dist/components/input/index.d.ts +10 -0
- package/dist/components/input/index.js +7 -0
- package/dist/components/input/input.component.d.ts +208 -0
- package/dist/components/input/input.component.js +401 -0
- package/dist/components/input/input.constants.d.ts +25 -0
- package/dist/components/input/input.constants.js +29 -0
- package/dist/components/input/input.styles.d.ts +2 -0
- package/dist/components/input/input.styles.js +118 -0
- package/dist/components/input/input.types.d.ts +4 -0
- package/dist/components/input/input.types.js +1 -0
- package/dist/custom-elements.json +1091 -281
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/react/index.d.ts +3 -2
- package/dist/react/index.js +3 -2
- package/dist/react/input/index.d.ts +39 -0
- package/dist/react/input/index.js +48 -0
- package/package.json +1 -1
@@ -0,0 +1,25 @@
|
|
1
|
+
declare const TAG_NAME: "mdc-input";
|
2
|
+
declare const AUTO_CAPITALIZE: {
|
3
|
+
readonly OFF: "off";
|
4
|
+
readonly NONE: "none";
|
5
|
+
readonly ON: "on";
|
6
|
+
readonly SENTENCES: "sentences";
|
7
|
+
readonly WORDS: "words";
|
8
|
+
readonly CHARACTERS: "characters";
|
9
|
+
};
|
10
|
+
declare const PREFIX_TEXT_OPTIONS: {
|
11
|
+
MAX_LENGTH: number;
|
12
|
+
HELPERTEXT: string;
|
13
|
+
VALIDATION: "error";
|
14
|
+
};
|
15
|
+
declare const DEFAULTS: {
|
16
|
+
VALIDATION: "default";
|
17
|
+
ICON_SIZE_VALUE: number;
|
18
|
+
ICON_SIZE_UNIT: string;
|
19
|
+
CLEAR_BUTTON_ICON: string;
|
20
|
+
CLEAR_BUTTON_VARIANT: "tertiary";
|
21
|
+
CLEAR_BUTTON_SIZE: 20;
|
22
|
+
PREFIX_TEXT_TYPE: "body-midsize-regular";
|
23
|
+
PREFIX_TEXT_TAG: "span";
|
24
|
+
};
|
25
|
+
export { TAG_NAME, PREFIX_TEXT_OPTIONS, AUTO_CAPITALIZE, DEFAULTS };
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import utils from '../../utils/tag-name';
|
2
|
+
import { BUTTON_VARIANTS, ICON_BUTTON_SIZES } from '../button/button.constants';
|
3
|
+
import { VALIDATION } from '../formfieldwrapper/formfieldwrapper.constants';
|
4
|
+
import { TYPE, VALID_TEXT_TAGS } from '../text/text.constants';
|
5
|
+
const TAG_NAME = utils.constructTagName('input');
|
6
|
+
const AUTO_CAPITALIZE = {
|
7
|
+
OFF: 'off',
|
8
|
+
NONE: 'none',
|
9
|
+
ON: 'on',
|
10
|
+
SENTENCES: 'sentences',
|
11
|
+
WORDS: 'words',
|
12
|
+
CHARACTERS: 'characters',
|
13
|
+
};
|
14
|
+
const PREFIX_TEXT_OPTIONS = {
|
15
|
+
MAX_LENGTH: 10,
|
16
|
+
HELPERTEXT: 'Prefix text should not exceed 10 characters',
|
17
|
+
VALIDATION: VALIDATION.ERROR,
|
18
|
+
};
|
19
|
+
const DEFAULTS = {
|
20
|
+
VALIDATION: VALIDATION.DEFAULT,
|
21
|
+
ICON_SIZE_VALUE: 1,
|
22
|
+
ICON_SIZE_UNIT: 'rem',
|
23
|
+
CLEAR_BUTTON_ICON: 'cancel-bold',
|
24
|
+
CLEAR_BUTTON_VARIANT: BUTTON_VARIANTS.TERTIARY,
|
25
|
+
CLEAR_BUTTON_SIZE: ICON_BUTTON_SIZES[20],
|
26
|
+
PREFIX_TEXT_TYPE: TYPE.BODY_MIDSIZE_REGULAR,
|
27
|
+
PREFIX_TEXT_TAG: VALID_TEXT_TAGS.SPAN,
|
28
|
+
};
|
29
|
+
export { TAG_NAME, PREFIX_TEXT_OPTIONS, AUTO_CAPITALIZE, DEFAULTS };
|
@@ -0,0 +1,118 @@
|
|
1
|
+
import { css } from 'lit';
|
2
|
+
import { hostFocusRingStyles } from '../../utils/styles';
|
3
|
+
const styles = [css `
|
4
|
+
:host{
|
5
|
+
--mdc-input-disabled-border-color: var(--mds-color-theme-outline-primary-disabled);
|
6
|
+
--mdc-input-disabled-text-color: var(--mds-color-theme-text-primary-disabled);
|
7
|
+
--mdc-input-disabled-background-color: var(--mds-color-theme-background-primary-disabled);
|
8
|
+
--mdc-input-border-color: var(--mds-color-theme-outline-input-normal);
|
9
|
+
--mdc-input-text-color: var(--mds-color-theme-text-primary-normal);
|
10
|
+
--mdc-input-background-color: var(--mds-color-theme-background-primary-ghost);
|
11
|
+
--mdc-input-selection-background-color: var(--mds-color-theme-background-accent-active);
|
12
|
+
--mdc-input-selection-text-color: var(--mds-color-theme-inverted-text-primary-normal);
|
13
|
+
--mdc-input-support-text-color: var(--mds-color-theme-text-secondary-normal);
|
14
|
+
--mdc-input-hover-background-color: var(--mds-color-theme-background-primary-hover);
|
15
|
+
--mdc-input-focused-background-color: var(--mds-color-theme-background-primary-active);
|
16
|
+
--mdc-input-focused-border-color: var(--mds-color-theme-outline-input-active);
|
17
|
+
--mdc-input-error-border-color: var(--mds-color-theme-text-error-normal);
|
18
|
+
--mdc-input-warning-border-color: var(--mds-color-theme-text-warning-normal);
|
19
|
+
--mdc-input-success-border-color: var(--mds-color-theme-text-success-normal);
|
20
|
+
--mdc-input-primary-border-color: var(--mds-color-theme-text-accent-normal);
|
21
|
+
}
|
22
|
+
|
23
|
+
:host, .input-container, .input-section, .input{
|
24
|
+
width: 100%;
|
25
|
+
}
|
26
|
+
|
27
|
+
:host([readonly]) .leading-icon {
|
28
|
+
color: var(--mdc-input-support-text-color);
|
29
|
+
}
|
30
|
+
|
31
|
+
:host([disabled]) .input,
|
32
|
+
:host([disabled]) .input::placeholder,
|
33
|
+
:host([disabled]) .prefix-text{
|
34
|
+
color: var(--mdc-input-disabled-text-color);
|
35
|
+
}
|
36
|
+
|
37
|
+
:host([disabled]) .input,
|
38
|
+
:host([readonly]) .input{
|
39
|
+
border-color: var(--mdc-input-disabled-border-color);
|
40
|
+
background: var(--mdc-input-disabled-background-color);
|
41
|
+
}
|
42
|
+
|
43
|
+
:host([disabled][help-text-type="default"]) .input-container,
|
44
|
+
:host([disabled][help-text-type="success"]) .input-container,
|
45
|
+
:host([disabled][help-text-type="warning"]) .input-container,
|
46
|
+
:host([disabled][help-text-type="error"]) .input-container,
|
47
|
+
:host([disabled][help-text-type="priority"]) .input-container{
|
48
|
+
border-color: var(--mdc-input-disabled-border-color);
|
49
|
+
}
|
50
|
+
|
51
|
+
.leading-icon{
|
52
|
+
aspect-ratio: 1;
|
53
|
+
}
|
54
|
+
|
55
|
+
.input-container{
|
56
|
+
height: 2rem;
|
57
|
+
border-radius: 0.5rem;
|
58
|
+
border: 0.0625rem solid var(--mdc-input-border-color);
|
59
|
+
display: flex;
|
60
|
+
align-items: center;
|
61
|
+
gap: 0.375rem;
|
62
|
+
padding: 0.34375rem 0.375rem 0.34375rem 0.75rem;
|
63
|
+
}
|
64
|
+
|
65
|
+
.input-section{
|
66
|
+
display: flex;
|
67
|
+
gap: 0.25rem;
|
68
|
+
}
|
69
|
+
|
70
|
+
.input {
|
71
|
+
border: none;
|
72
|
+
color: var(--mdc-input-text-color);
|
73
|
+
background-color: var(--mdc-input-background-color);
|
74
|
+
outline: none;
|
75
|
+
}
|
76
|
+
|
77
|
+
.input::selection {
|
78
|
+
background-color: var(--mdc-input-selection-background-color);
|
79
|
+
color: var(--mdc-input-selection-text-color);
|
80
|
+
}
|
81
|
+
|
82
|
+
.prefix-text{
|
83
|
+
color: var(--mdc-input-support-text-color);
|
84
|
+
white-space: nowrap; // restirct prefix text to be in one line
|
85
|
+
}
|
86
|
+
|
87
|
+
:host(:not([disabled])) .input-container:hover{
|
88
|
+
background-color: var(--mdc-input-hover-background-color);
|
89
|
+
}
|
90
|
+
|
91
|
+
:host(:not([disabled])) .input-container:active, :host(:not([disabled])) .input-container:focus-within{
|
92
|
+
background-color: var(--mdc-input-focused-background-color);
|
93
|
+
border-color: var(--mdc-input-focused-border-color);
|
94
|
+
}
|
95
|
+
|
96
|
+
.input::placeholder{
|
97
|
+
color: var(--mdc-input-support-text-color);
|
98
|
+
}
|
99
|
+
|
100
|
+
:host([help-text-type="error"]) .input-container {
|
101
|
+
border-color: var(--mdc-input-error-border-color);
|
102
|
+
}
|
103
|
+
:host([help-text-type="warning"]) .input-container {
|
104
|
+
border-color: var(--mdc-input-warning-border-color);
|
105
|
+
}
|
106
|
+
:host([help-text-type="success"]) .input-container {
|
107
|
+
border-color: var(--mdc-input-success-border-color);
|
108
|
+
}
|
109
|
+
:host([help-text-type="priority"]) .input-container {
|
110
|
+
border-color: var(--mdc-input-primary-border-color);
|
111
|
+
}
|
112
|
+
|
113
|
+
.hidden{
|
114
|
+
opacity: 0;
|
115
|
+
pointer-events: none;
|
116
|
+
}
|
117
|
+
`, ...hostFocusRingStyles(true)];
|
118
|
+
export default styles;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|