@ni/nimble-components 2.0.2 → 2.1.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/esm/nimble-components/src/text-area/index.d.ts +22 -0
- package/dist/esm/nimble-components/src/text-area/styles.d.ts +1 -0
- package/dist/esm/nimble-components/src/text-area/types.d.ts +8 -0
- package/dist/esm/text-area/index.d.ts +22 -0
- package/dist/esm/text-area/index.js +31 -0
- package/dist/esm/text-area/index.js.map +1 -0
- package/dist/esm/text-area/styles.d.ts +1 -0
- package/dist/esm/text-area/styles.js +117 -0
- package/dist/esm/text-area/styles.js.map +1 -0
- package/dist/esm/text-area/types.d.ts +8 -0
- package/dist/esm/text-area/types.js +8 -0
- package/dist/esm/text-area/types.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TextArea as FoundationTextArea } from '@microsoft/fast-foundation';
|
|
2
|
+
import { TextAreaAppearance } from './types';
|
|
3
|
+
export type { TextArea };
|
|
4
|
+
declare global {
|
|
5
|
+
interface HTMLElementTagNameMap {
|
|
6
|
+
'nimble-text-area': TextArea;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A nimble-styed HTML text area
|
|
11
|
+
*/
|
|
12
|
+
declare class TextArea extends FoundationTextArea {
|
|
13
|
+
/**
|
|
14
|
+
* The appearance the text area should have.
|
|
15
|
+
*
|
|
16
|
+
* @public
|
|
17
|
+
* @remarks
|
|
18
|
+
* HTML Attribute: appearance
|
|
19
|
+
*/
|
|
20
|
+
appearance: TextAreaAppearance;
|
|
21
|
+
connectedCallback(): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import("@microsoft/fast-element").ElementStyles;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TextAreaResize } from '@microsoft/fast-foundation';
|
|
2
|
+
export { TextAreaResize };
|
|
3
|
+
export declare type TextAreaResizeAttribute = `${TextAreaResize}`;
|
|
4
|
+
export declare enum TextAreaAppearance {
|
|
5
|
+
Outline = "outline",
|
|
6
|
+
Block = "block"
|
|
7
|
+
}
|
|
8
|
+
export declare type TextAreaAppearanceAttribute = `${TextAreaAppearance}`;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TextArea as FoundationTextArea } from '@microsoft/fast-foundation';
|
|
2
|
+
import { TextAreaAppearance } from './types';
|
|
3
|
+
export type { TextArea };
|
|
4
|
+
declare global {
|
|
5
|
+
interface HTMLElementTagNameMap {
|
|
6
|
+
'nimble-text-area': TextArea;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A nimble-styed HTML text area
|
|
11
|
+
*/
|
|
12
|
+
declare class TextArea extends FoundationTextArea {
|
|
13
|
+
/**
|
|
14
|
+
* The appearance the text area should have.
|
|
15
|
+
*
|
|
16
|
+
* @public
|
|
17
|
+
* @remarks
|
|
18
|
+
* HTML Attribute: appearance
|
|
19
|
+
*/
|
|
20
|
+
appearance: TextAreaAppearance;
|
|
21
|
+
connectedCallback(): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { attr } from '@microsoft/fast-element';
|
|
3
|
+
import { DesignSystem, TextArea as FoundationTextArea, textAreaTemplate as template } from '@microsoft/fast-foundation';
|
|
4
|
+
import { styles } from './styles';
|
|
5
|
+
import { TextAreaAppearance } from './types';
|
|
6
|
+
/**
|
|
7
|
+
* A nimble-styed HTML text area
|
|
8
|
+
*/
|
|
9
|
+
class TextArea extends FoundationTextArea {
|
|
10
|
+
connectedCallback() {
|
|
11
|
+
super.connectedCallback();
|
|
12
|
+
if (!this.appearance) {
|
|
13
|
+
this.appearance = TextAreaAppearance.Outline;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
__decorate([
|
|
18
|
+
attr
|
|
19
|
+
], TextArea.prototype, "appearance", void 0);
|
|
20
|
+
const nimbleTextArea = TextArea.compose({
|
|
21
|
+
baseName: 'text-area',
|
|
22
|
+
baseClass: FoundationTextArea,
|
|
23
|
+
// @ts-expect-error FAST templates have incorrect type, see: https://github.com/microsoft/fast/issues/5047
|
|
24
|
+
template,
|
|
25
|
+
styles,
|
|
26
|
+
shadowOptions: {
|
|
27
|
+
delegatesFocus: true
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleTextArea());
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/text-area/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EACH,YAAY,EACZ,QAAQ,IAAI,kBAAkB,EAC9B,gBAAgB,IAAI,QAAQ,EAC/B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAU7C;;GAEG;AACH,MAAM,QAAS,SAAQ,kBAAkB;IAW9B,iBAAiB;QACpB,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YAClB,IAAI,CAAC,UAAU,GAAG,kBAAkB,CAAC,OAAO,CAAC;SAChD;IACL,CAAC;CACJ;AARG;IADC,IAAI;4CACkC;AAU3C,MAAM,cAAc,GAAG,QAAQ,CAAC,OAAO,CAAC;IACpC,QAAQ,EAAE,WAAW;IACrB,SAAS,EAAE,kBAAkB;IAC7B,0GAA0G;IAC1G,QAAQ;IACR,MAAM;IACN,aAAa,EAAE;QACX,cAAc,EAAE,IAAI;KACvB;CACJ,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,cAAc,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import("@microsoft/fast-element").ElementStyles;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { css } from '@microsoft/fast-element';
|
|
2
|
+
import { display } from '@microsoft/fast-foundation';
|
|
3
|
+
import { borderColorRgbPartial, borderColorHover, borderWidth, contentFontColor, contentFontColorDisabled, contentFontSize, fillColorSelectedRgbPartial, fontFamily, labelFontColor, labelFontColorDisabled, labelFontFamily, labelFontSize, labelFontWeight, labelHeight, labelTextTransform, smallDelay } from '../theme-provider/design-tokens';
|
|
4
|
+
import { appearanceBehavior } from '../utilities/style/appearance';
|
|
5
|
+
import { TextAreaAppearance } from './types';
|
|
6
|
+
export const styles = css `
|
|
7
|
+
${display('inline-block')}
|
|
8
|
+
|
|
9
|
+
:host {
|
|
10
|
+
font-family: ${fontFamily};
|
|
11
|
+
font-size: ${contentFontSize};
|
|
12
|
+
outline: none;
|
|
13
|
+
user-select: none;
|
|
14
|
+
color: ${contentFontColor};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
:host([disabled]) {
|
|
18
|
+
color: ${contentFontColorDisabled};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.label {
|
|
22
|
+
display: flex;
|
|
23
|
+
color: ${labelFontColor};
|
|
24
|
+
font-family: ${labelFontFamily};
|
|
25
|
+
font-size: ${labelFontSize};
|
|
26
|
+
font-weight: ${labelFontWeight};
|
|
27
|
+
line-height: ${labelHeight};
|
|
28
|
+
text-transform: ${labelTextTransform};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
:host([disabled]) .label {
|
|
32
|
+
color: ${labelFontColorDisabled};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.control {
|
|
36
|
+
-webkit-appearance: none;
|
|
37
|
+
font: inherit;
|
|
38
|
+
outline: none;
|
|
39
|
+
box-sizing: border-box;
|
|
40
|
+
position: relative;
|
|
41
|
+
color: inherit;
|
|
42
|
+
border-radius: 0px;
|
|
43
|
+
align-items: flex-end;
|
|
44
|
+
border: ${borderWidth} solid transparent;
|
|
45
|
+
padding: 8px;
|
|
46
|
+
transition: outline ${smallDelay}, border ${smallDelay};
|
|
47
|
+
resize: none;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@media (prefers-reduced-motion) {
|
|
51
|
+
.control {
|
|
52
|
+
transition-duration: 0s;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.control:hover {
|
|
57
|
+
border-color: ${borderColorHover};
|
|
58
|
+
outline: 1px solid ${borderColorHover};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.control:focus-within {
|
|
62
|
+
border-color: ${borderColorHover};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.control[readonly],
|
|
66
|
+
.control[readonly]:hover,
|
|
67
|
+
.control[readonly]:hover:focus-within,
|
|
68
|
+
.control[disabled],
|
|
69
|
+
.control[disabled]:hover {
|
|
70
|
+
border-color: rgba(${borderColorRgbPartial}, 0.1);
|
|
71
|
+
outline: none;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.control::selection {
|
|
75
|
+
color: ${labelFontColor};
|
|
76
|
+
background: rgba(${fillColorSelectedRgbPartial}, 0.3);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.control::placeholder {
|
|
80
|
+
color: ${labelFontColor};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.control[disabled]::placeholder {
|
|
84
|
+
color: ${contentFontColorDisabled};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
:host([resize='both']) .control {
|
|
88
|
+
resize: both;
|
|
89
|
+
}
|
|
90
|
+
:host([resize='horizontal']) .control {
|
|
91
|
+
resize: horizontal;
|
|
92
|
+
}
|
|
93
|
+
:host([resize='vertical']) .control {
|
|
94
|
+
resize: vertical;
|
|
95
|
+
}
|
|
96
|
+
`
|
|
97
|
+
// prettier-ignore
|
|
98
|
+
.withBehaviors(appearanceBehavior(TextAreaAppearance.Outline, css `
|
|
99
|
+
.control {
|
|
100
|
+
border-color: rgba(${borderColorRgbPartial}, 0.3);
|
|
101
|
+
background-color: transparent;
|
|
102
|
+
}
|
|
103
|
+
`), appearanceBehavior(TextAreaAppearance.Block, css `
|
|
104
|
+
.control {
|
|
105
|
+
background-color: rgba(${borderColorRgbPartial}, 0.1);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
:host([readonly]) .control {
|
|
109
|
+
background-color: transparent;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
:host([disabled]) .control {
|
|
113
|
+
border-color: transparent;
|
|
114
|
+
background-color: rgba(${borderColorRgbPartial}, 0.1);
|
|
115
|
+
}
|
|
116
|
+
`));
|
|
117
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/text-area/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EACH,qBAAqB,EACrB,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,wBAAwB,EACxB,eAAe,EACf,2BAA2B,EAC3B,UAAU,EACV,cAAc,EACd,sBAAsB,EACtB,eAAe,EACf,aAAa,EACb,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,UAAU,EACb,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,cAAc,CAAC;;;uBAGN,UAAU;qBACZ,eAAe;;;iBAGnB,gBAAgB;;;;iBAIhB,wBAAwB;;;;;iBAKxB,cAAc;uBACR,eAAe;qBACjB,aAAa;uBACX,eAAe;uBACf,WAAW;0BACR,kBAAkB;;;;iBAI3B,sBAAsB;;;;;;;;;;;;kBAYrB,WAAW;;8BAEC,UAAU,YAAY,UAAU;;;;;;;;;;;wBAWtC,gBAAgB;6BACX,gBAAgB;;;;wBAIrB,gBAAgB;;;;;;;;6BAQX,qBAAqB;;;;;iBAKjC,cAAc;2BACJ,2BAA2B;;;;iBAIrC,cAAc;;;;iBAId,wBAAwB;;;;;;;;;;;;CAYxC;IACG,kBAAkB;KACjB,aAAa,CACV,kBAAkB,CACd,kBAAkB,CAAC,OAAO,EAC1B,GAAG,CAAA;;yCAE0B,qBAAqB;;;aAGjD,CACJ,EACD,kBAAkB,CACd,kBAAkB,CAAC,KAAK,EACxB,GAAG,CAAA;;6CAE8B,qBAAqB;;;;;;;;;6CASrB,qBAAqB;;aAErD,CACJ,CACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TextAreaResize } from '@microsoft/fast-foundation';
|
|
2
|
+
export { TextAreaResize };
|
|
3
|
+
export declare type TextAreaResizeAttribute = `${TextAreaResize}`;
|
|
4
|
+
export declare enum TextAreaAppearance {
|
|
5
|
+
Outline = "outline",
|
|
6
|
+
Block = "block"
|
|
7
|
+
}
|
|
8
|
+
export declare type TextAreaAppearanceAttribute = `${TextAreaAppearance}`;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TextAreaResize } from '@microsoft/fast-foundation';
|
|
2
|
+
export { TextAreaResize };
|
|
3
|
+
export var TextAreaAppearance;
|
|
4
|
+
(function (TextAreaAppearance) {
|
|
5
|
+
TextAreaAppearance["Outline"] = "outline";
|
|
6
|
+
TextAreaAppearance["Block"] = "block";
|
|
7
|
+
})(TextAreaAppearance || (TextAreaAppearance = {}));
|
|
8
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/text-area/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,CAAC;AAG1B,MAAM,CAAN,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC1B,yCAAmB,CAAA;IACnB,qCAAe,CAAA;AACnB,CAAC,EAHW,kBAAkB,KAAlB,kBAAkB,QAG7B"}
|
package/package.json
CHANGED