@redvars/peacock 3.8.4 → 3.8.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/accordion-item.js +28 -38
- package/dist/accordion-item.js.map +1 -1
- package/dist/accordion.js +8 -0
- package/dist/accordion.js.map +1 -1
- package/dist/button.js +21 -17
- package/dist/button.js.map +1 -1
- package/dist/custom-elements-jsdocs.json +212 -33
- package/dist/custom-elements.json +852 -143
- package/dist/floating-controller-CZYwnRVu.js +185 -0
- package/dist/floating-controller-CZYwnRVu.js.map +1 -0
- package/dist/{floating-controller-CnUZnOhK.js → floating-ui.dom-oQieRCpS.js} +2 -183
- package/dist/floating-ui.dom-oQieRCpS.js.map +1 -0
- package/dist/html-editor.js +3 -21091
- package/dist/html-editor.js.map +1 -1
- package/dist/index-DcbiqHpf.js +21091 -0
- package/dist/index-DcbiqHpf.js.map +1 -0
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/loader.js +7 -2
- package/dist/loader.js.map +1 -1
- package/dist/markdown-editor.js +4439 -0
- package/dist/markdown-editor.js.map +1 -0
- package/dist/menu.js +2 -1
- package/dist/menu.js.map +1 -1
- package/dist/pagination.js +15 -10
- package/dist/pagination.js.map +1 -1
- package/dist/popover.js +2 -1
- package/dist/popover.js.map +1 -1
- package/dist/{select-D85kpjUt.js → select-CnnPbvpQ.js} +68 -71
- package/dist/select-CnnPbvpQ.js.map +1 -0
- package/dist/src/accordion/accordion-item.d.ts +0 -6
- package/dist/src/accordion/accordion.d.ts +5 -0
- package/dist/src/button/button/button.d.ts +16 -16
- package/dist/src/index.d.ts +1 -0
- package/dist/src/input/input.d.ts +5 -5
- package/dist/src/markdown-editor/index.d.ts +2 -0
- package/dist/src/markdown-editor/markdown-editor.d.ts +116 -0
- package/dist/sub-menu.js +2 -1
- package/dist/sub-menu.js.map +1 -1
- package/dist/table.js +4 -9
- package/dist/table.js.map +1 -1
- package/dist/tooltip.js +2 -1
- package/dist/tooltip.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -1
- package/readme.md +2 -2
- package/src/accordion/accordion-item.scss +34 -12
- package/src/accordion/accordion-item.ts +27 -38
- package/src/accordion/accordion.ts +7 -0
- package/src/button/button/button-sizes.scss +4 -0
- package/src/button/button/button.ts +17 -17
- package/src/index.ts +1 -0
- package/src/input/input.ts +85 -82
- package/src/loader.ts +4 -0
- package/src/markdown-editor/index.ts +3 -0
- package/src/markdown-editor/markdown-editor.scss +378 -0
- package/src/markdown-editor/markdown-editor.ts +994 -0
- package/src/pagination/pagination.scss +15 -10
- package/src/table/table.scss +3 -9
- package/src/table/table.ts +1 -1
- package/dist/floating-controller-CnUZnOhK.js.map +0 -1
- package/dist/select-D85kpjUt.js.map +0 -1
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@redvars/peacock",
|
|
3
3
|
"description": "The foundation for beautiful user interfaces",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
|
-
"version": "3.8.
|
|
5
|
+
"version": "3.8.6",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"module": "dist/index.js",
|
|
@@ -50,13 +50,16 @@
|
|
|
50
50
|
"@tiptap/extension-underline": "^2.11.3",
|
|
51
51
|
"@tiptap/pm": "^2.11.3",
|
|
52
52
|
"@tiptap/starter-kit": "^2.11.3",
|
|
53
|
+
"@tiptap/suggestion": "^2.11.3",
|
|
53
54
|
"@types/prettier": "^3.0.0",
|
|
54
55
|
"d3": "^7.9.0",
|
|
55
56
|
"install": "^0.13.0",
|
|
56
57
|
"js-beautify": "^1.15.4",
|
|
57
58
|
"lit": "^3.1.4",
|
|
59
|
+
"marked": "^14.1.3",
|
|
58
60
|
"modern-monaco": "^0.4.0",
|
|
59
61
|
"monaco-editor": "^0.55.1",
|
|
62
|
+
"turndown": "^7.2.0",
|
|
60
63
|
"npm": "^11.11.0",
|
|
61
64
|
"prettier": "^3.8.1",
|
|
62
65
|
"rollup-plugin-postcss": "^4.0.2",
|
|
@@ -75,6 +78,7 @@
|
|
|
75
78
|
"@types/js-beautify": "^1.14.3",
|
|
76
79
|
"@types/mocha": "^10.0.7",
|
|
77
80
|
"@types/prismjs": "^1.26.6",
|
|
81
|
+
"@types/turndown": "^5.0.5",
|
|
78
82
|
"@typescript-eslint/eslint-plugin": "^7.16.0",
|
|
79
83
|
"@typescript-eslint/parser": "^7.16.0",
|
|
80
84
|
"@wc-toolkit/jsdoc-tags": "^1.1.0",
|
package/readme.md
CHANGED
|
@@ -44,9 +44,9 @@ Visit [https://peacock.redvars.com](https://peacock.redvars.com) to view the doc
|
|
|
44
44
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
45
45
|
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
|
|
46
46
|
|
|
47
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@redvars/peacock@3.8.
|
|
47
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@redvars/peacock@3.8.6/dist/assets/styles.css"></link>
|
|
48
48
|
<script type='module'
|
|
49
|
-
src='https://cdn.jsdelivr.net/npm/@redvars/peacock@3.8.
|
|
49
|
+
src='https://cdn.jsdelivr.net/npm/@redvars/peacock@3.8.6/dist/loader.js'></script>
|
|
50
50
|
</head>
|
|
51
51
|
|
|
52
52
|
<wc-button>Button</wc-button>
|
|
@@ -13,7 +13,10 @@
|
|
|
13
13
|
.expansion-panel {
|
|
14
14
|
border: var(--_accordion-item-border, 1px solid var(--color-outline-variant));
|
|
15
15
|
border-radius: var(--shape-corner-medium); // 12dp — M3 medium shape
|
|
16
|
-
background-color: var(
|
|
16
|
+
background-color: var(
|
|
17
|
+
--_accordion-item-background,
|
|
18
|
+
var(--color-surface-container-low)
|
|
19
|
+
);
|
|
17
20
|
overflow: hidden; // clip children to border-radius
|
|
18
21
|
transition:
|
|
19
22
|
background-color var(--duration-medium1) var(--easing-standard),
|
|
@@ -24,6 +27,7 @@
|
|
|
24
27
|
.header-button {
|
|
25
28
|
position: relative;
|
|
26
29
|
display: flex;
|
|
30
|
+
flex-direction: row-reverse;
|
|
27
31
|
align-items: center;
|
|
28
32
|
width: 100%;
|
|
29
33
|
min-height: 3rem; // 48dp — grows with description
|
|
@@ -62,6 +66,11 @@
|
|
|
62
66
|
}
|
|
63
67
|
}
|
|
64
68
|
|
|
69
|
+
.header-content {
|
|
70
|
+
display: flex;
|
|
71
|
+
flex: 1;
|
|
72
|
+
}
|
|
73
|
+
|
|
65
74
|
// ─── Header Label (title + description column) ──────────────────────────────
|
|
66
75
|
|
|
67
76
|
.header-label {
|
|
@@ -117,7 +126,8 @@
|
|
|
117
126
|
.panel-content {
|
|
118
127
|
display: grid;
|
|
119
128
|
grid-template-rows: 0fr;
|
|
120
|
-
transition: grid-template-rows var(--duration-medium1)
|
|
129
|
+
transition: grid-template-rows var(--duration-medium1)
|
|
130
|
+
var(--easing-standard);
|
|
121
131
|
}
|
|
122
132
|
|
|
123
133
|
.content-inner {
|
|
@@ -130,8 +140,16 @@
|
|
|
130
140
|
// ─── Disabled State ─────────────────────────────────────────────────────────
|
|
131
141
|
|
|
132
142
|
&.disabled {
|
|
133
|
-
background-color: color-mix(
|
|
134
|
-
|
|
143
|
+
background-color: color-mix(
|
|
144
|
+
in srgb,
|
|
145
|
+
var(--color-surface-container-low) 38%,
|
|
146
|
+
transparent
|
|
147
|
+
);
|
|
148
|
+
border-color: color-mix(
|
|
149
|
+
in srgb,
|
|
150
|
+
var(--color-outline-variant) 38%,
|
|
151
|
+
transparent
|
|
152
|
+
);
|
|
135
153
|
|
|
136
154
|
.header-button {
|
|
137
155
|
cursor: not-allowed;
|
|
@@ -163,20 +181,24 @@
|
|
|
163
181
|
// ─── Disabled State (border + bg dimmed) ────────────────────────────────────
|
|
164
182
|
|
|
165
183
|
&.disabled {
|
|
166
|
-
background-color: color-mix(
|
|
167
|
-
|
|
184
|
+
background-color: color-mix(
|
|
185
|
+
in srgb,
|
|
186
|
+
var(--color-surface-container-low) 38%,
|
|
187
|
+
transparent
|
|
188
|
+
);
|
|
189
|
+
border-color: color-mix(
|
|
190
|
+
in srgb,
|
|
191
|
+
var(--color-outline-variant) 38%,
|
|
192
|
+
transparent
|
|
193
|
+
);
|
|
168
194
|
}
|
|
169
195
|
}
|
|
170
196
|
|
|
171
197
|
// ─── Toggle position: before ─────────────────────────────────────────────────
|
|
172
198
|
|
|
173
|
-
:host([toggle
|
|
199
|
+
:host-context([leading-toggle]) {
|
|
174
200
|
.header-button {
|
|
175
|
-
flex-direction: row
|
|
201
|
+
flex-direction: row;
|
|
176
202
|
justify-content: flex-end;
|
|
177
203
|
}
|
|
178
|
-
|
|
179
|
-
.header-label {
|
|
180
|
-
flex: 1;
|
|
181
|
-
}
|
|
182
204
|
}
|
|
@@ -56,14 +56,6 @@ export class AccordionItem extends LitElement {
|
|
|
56
56
|
@property({ type: Boolean, reflect: true, attribute: 'hide-toggle' })
|
|
57
57
|
hideToggle: boolean = false;
|
|
58
58
|
|
|
59
|
-
/**
|
|
60
|
-
* Position of the toggle icon relative to the panel title.
|
|
61
|
-
* `'after'` places it at the trailing end (default, matches M3).
|
|
62
|
-
* `'before'` places it at the leading start.
|
|
63
|
-
*/
|
|
64
|
-
@property({ type: String, reflect: true, attribute: 'toggle-position' })
|
|
65
|
-
togglePosition: 'before' | 'after' = 'after';
|
|
66
|
-
|
|
67
59
|
/** True when the `description` slot contains at least one non-empty node. */
|
|
68
60
|
@state()
|
|
69
61
|
private _hasDescriptionSlot = false;
|
|
@@ -136,37 +128,34 @@ export class AccordionItem extends LitElement {
|
|
|
136
128
|
?disabled=${this.disabled}
|
|
137
129
|
@click=${this._handleToggle}
|
|
138
130
|
>
|
|
139
|
-
${this.
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
131
|
+
${this._renderToggleIcon()}
|
|
132
|
+
<div class="header-content">
|
|
133
|
+
<span class="header-label">
|
|
134
|
+
<span part="title" class="panel-title">
|
|
135
|
+
<slot
|
|
136
|
+
name="heading"
|
|
137
|
+
@slotchange=${(e: Event) =>
|
|
138
|
+
AccordionItem._onSlotChange(e, v => {
|
|
139
|
+
this._hasHeadingSlot = v;
|
|
140
|
+
})}
|
|
141
|
+
></slot>
|
|
142
|
+
</span>
|
|
143
|
+
<span
|
|
144
|
+
part="description"
|
|
145
|
+
class="panel-description"
|
|
146
|
+
?hidden=${!this._hasDescriptionSlot}
|
|
147
|
+
>
|
|
148
|
+
<slot
|
|
149
|
+
name="description"
|
|
150
|
+
@slotchange=${(e: Event) =>
|
|
151
|
+
AccordionItem._onSlotChange(e, v => {
|
|
152
|
+
this._hasDescriptionSlot = v;
|
|
153
|
+
})}
|
|
154
|
+
></slot>
|
|
155
|
+
</span>
|
|
151
156
|
</span>
|
|
152
|
-
<
|
|
153
|
-
|
|
154
|
-
class="panel-description"
|
|
155
|
-
?hidden=${!this._hasDescriptionSlot}
|
|
156
|
-
>
|
|
157
|
-
<slot
|
|
158
|
-
name="description"
|
|
159
|
-
@slotchange=${(e: Event) =>
|
|
160
|
-
AccordionItem._onSlotChange(e, v => {
|
|
161
|
-
this._hasDescriptionSlot = v;
|
|
162
|
-
})}
|
|
163
|
-
></slot>
|
|
164
|
-
</span>
|
|
165
|
-
</span>
|
|
166
|
-
<slot name="header-actions" class="header-actions"></slot>
|
|
167
|
-
${this.togglePosition === 'after'
|
|
168
|
-
? this._renderToggleIcon()
|
|
169
|
-
: nothing}
|
|
157
|
+
<slot name="header-actions" class="header-actions"></slot>
|
|
158
|
+
</div>
|
|
170
159
|
</button>
|
|
171
160
|
<div
|
|
172
161
|
id=${`panel-content-${this.#id}`}
|
|
@@ -45,6 +45,13 @@ export class Accordion extends LitElement {
|
|
|
45
45
|
@property({ type: String, reflect: true })
|
|
46
46
|
variant: 'default' | 'flat' = 'default';
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* When `true`, the toggle icon is placed at the leading start of the header.
|
|
50
|
+
* When `false` (default), the icon is placed at the trailing end.
|
|
51
|
+
*/
|
|
52
|
+
@property({ type: Boolean, reflect: true, attribute: 'leading-toggle' })
|
|
53
|
+
leadingToggle = false;
|
|
54
|
+
|
|
48
55
|
@queryAssignedElements({ selector: 'wc-accordion-item' })
|
|
49
56
|
items!: Array<AccordionItem>;
|
|
50
57
|
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
--button-height: 2rem;
|
|
6
6
|
--private-button-icon-size: 1rem;
|
|
7
7
|
--private-button-container-padding: 0.75rem;
|
|
8
|
+
--private-button-icon-label-spacing: 0.5rem;
|
|
8
9
|
|
|
9
10
|
--private-button-font-size: 0.875rem !important;
|
|
10
11
|
--private-button-font-weight: var(--font-weight-medium) !important;
|
|
@@ -30,6 +31,7 @@
|
|
|
30
31
|
--button-height: 3.5rem;
|
|
31
32
|
--private-button-icon-size: 1.5rem;
|
|
32
33
|
--private-button-container-padding: 1.5rem;
|
|
34
|
+
--private-button-icon-label-spacing: 0.5rem;
|
|
33
35
|
|
|
34
36
|
--private-button-font-size: 1rem !important;
|
|
35
37
|
--private-button-font-weight: var(--font-weight-medium) !important;
|
|
@@ -42,6 +44,7 @@
|
|
|
42
44
|
--button-height: 6rem;
|
|
43
45
|
--private-button-icon-size: 2rem;
|
|
44
46
|
--private-button-container-padding: 3rem;
|
|
47
|
+
--private-button-icon-label-spacing: 0.75rem;
|
|
45
48
|
|
|
46
49
|
--private-button-font-size: 1.5rem !important;
|
|
47
50
|
--private-button-font-weight: var(--font-weight-regular) !important;
|
|
@@ -54,6 +57,7 @@
|
|
|
54
57
|
--button-height: 8.5rem;
|
|
55
58
|
--private-button-icon-size: 2.5rem;
|
|
56
59
|
--private-button-container-padding: 4rem;
|
|
60
|
+
--private-button-icon-label-spacing: 1rem;
|
|
57
61
|
|
|
58
62
|
--private-button-font-size: 2rem !important;
|
|
59
63
|
--private-button-font-weight: var(--font-weight-regular) !important;
|
|
@@ -44,30 +44,30 @@ export type {
|
|
|
44
44
|
* @overview
|
|
45
45
|
* <p>Buttons are clickable elements that are used to trigger actions. They communicate calls to action to the user and allow users to interact with pages in a variety of ways. Button labels express what action will occur when the user interacts with it.</p>
|
|
46
46
|
*
|
|
47
|
-
* @cssprop --button-container-shape
|
|
47
|
+
* @cssprop --button-container-shape - Defines the border radius of the button container shape.
|
|
48
48
|
*
|
|
49
|
-
* @cssprop --button-container-shape-start-start
|
|
50
|
-
* @cssprop --button-container-shape-start-end
|
|
51
|
-
* @cssprop --button-container-shape-end-start
|
|
52
|
-
* @cssprop --button-container-shape-end-end
|
|
49
|
+
* @cssprop --button-container-shape-start-start - Defines the start position of the button container shape.
|
|
50
|
+
* @cssprop --button-container-shape-start-end - Defines the end position of the button container shape.
|
|
51
|
+
* @cssprop --button-container-shape-end-start - Defines the start position of the button container shape.
|
|
52
|
+
* @cssprop --button-container-shape-end-end - Defines the end position of the button container shape.
|
|
53
53
|
*
|
|
54
54
|
*
|
|
55
|
-
* @cssprop --filled-button-container-color
|
|
56
|
-
* @cssprop --filled-button-label-text-color
|
|
55
|
+
* @cssprop --filled-button-container-color - Color of the filled button container.
|
|
56
|
+
* @cssprop --filled-button-label-text-color - Text color of the filled button label.
|
|
57
57
|
*
|
|
58
|
-
* @cssprop --outlined-button-container-color
|
|
59
|
-
* @cssprop --outlined-button-label-text-color
|
|
58
|
+
* @cssprop --outlined-button-container-color - Color of the outlined button container.
|
|
59
|
+
* @cssprop --outlined-button-label-text-color - Text color of the outlined button label.
|
|
60
60
|
*
|
|
61
|
-
* @cssprop --text-button-label-text-color
|
|
61
|
+
* @cssprop --text-button-label-text-color - Text color of the text button label.
|
|
62
62
|
*
|
|
63
|
-
* @cssprop --tonal-button-container-color
|
|
64
|
-
* @cssprop --tonal-button-label-text-color
|
|
63
|
+
* @cssprop --tonal-button-container-color - Color of the tonal button container.
|
|
64
|
+
* @cssprop --tonal-button-label-text-color - Text color of the tonal button label.
|
|
65
65
|
*
|
|
66
|
-
* @cssprop --elevated-button-container-color
|
|
67
|
-
* @cssprop --elevated-button-label-text-color
|
|
66
|
+
* @cssprop --elevated-button-container-color - Color of the elevated button container.
|
|
67
|
+
* @cssprop --elevated-button-label-text-color - Text color of the elevated button label.
|
|
68
68
|
*
|
|
69
|
-
* @cssprop --neo-button-container-color
|
|
70
|
-
* @cssprop --neo-button-label-text-color
|
|
69
|
+
* @cssprop --neo-button-container-color - Color of the neo button container.
|
|
70
|
+
* @cssprop --neo-button-label-text-color - Text color of the neo button label.
|
|
71
71
|
*
|
|
72
72
|
* @fires {MouseEvent} click - Dispatched when the button is clicked.
|
|
73
73
|
*
|
|
@@ -104,7 +104,7 @@ export class Button extends mixinBaseButton(
|
|
|
104
104
|
* When `false`, the icon is placed before the label (leading).
|
|
105
105
|
*/
|
|
106
106
|
@property({ type: Boolean, reflect: true, attribute: 'trailing-icon' })
|
|
107
|
-
trailingIcon =
|
|
107
|
+
trailingIcon = false;
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
110
|
* Button size.
|
package/src/index.ts
CHANGED
|
@@ -47,6 +47,7 @@ export { Item } from './item/index.js';
|
|
|
47
47
|
export { CodeHighlighter } from './code-highlighter/index.js';
|
|
48
48
|
export { CodeEditor } from './code-editor/index.js';
|
|
49
49
|
export { HtmlEditor } from './html-editor/index.js';
|
|
50
|
+
export { MarkdownEditor } from './markdown-editor/index.js';
|
|
50
51
|
export { Image } from './image/index.js';
|
|
51
52
|
export { Svg } from './svg/index.js';
|
|
52
53
|
export { Tab, TabGroup, TabPanel, Tabs } from './tabs/index.js';
|
package/src/input/input.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { html, nothing } from
|
|
2
|
-
import { property, query, state } from
|
|
1
|
+
import { html, nothing } from "lit";
|
|
2
|
+
import { property, query, state } from "lit/decorators.js";
|
|
3
3
|
|
|
4
|
-
import { redispatchEvent } from
|
|
5
|
-
import { spread } from
|
|
4
|
+
import { redispatchEvent } from "@/__internal/utils/dispatch-event-utils.js";
|
|
5
|
+
import { spread } from "@/__internal/directive/spread.js";
|
|
6
6
|
|
|
7
|
-
import BaseInput from
|
|
8
|
-
import styles from
|
|
7
|
+
import BaseInput from "./BaseInput.js";
|
|
8
|
+
import styles from "./input.scss";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @label Input
|
|
@@ -23,46 +23,52 @@ export class Input extends BaseInput {
|
|
|
23
23
|
static styles = [styles];
|
|
24
24
|
|
|
25
25
|
@property({ type: String })
|
|
26
|
-
value =
|
|
26
|
+
value = "";
|
|
27
27
|
|
|
28
28
|
@property({ type: String })
|
|
29
|
-
name: string =
|
|
29
|
+
name: string = "";
|
|
30
30
|
|
|
31
|
-
@property({ type: String })
|
|
31
|
+
@property({ type: String })
|
|
32
|
+
placeholder = "";
|
|
32
33
|
|
|
33
|
-
@property({ type: String })
|
|
34
|
+
@property({ type: String })
|
|
35
|
+
label = "";
|
|
34
36
|
|
|
35
|
-
@property({ type: Boolean, reflect: true })
|
|
37
|
+
@property({ type: Boolean, reflect: true })
|
|
38
|
+
inline = false;
|
|
36
39
|
|
|
37
|
-
@property({ type: String, reflect: true })
|
|
40
|
+
@property({ type: String, reflect: true })
|
|
41
|
+
size: "sm" | "md" | "lg" = "md";
|
|
38
42
|
|
|
39
|
-
@property({ type: String })
|
|
40
|
-
|
|
43
|
+
@property({ type: String })
|
|
44
|
+
type: "text" | "password" | "email" | "tel" = "text";
|
|
41
45
|
|
|
42
|
-
@property({ type: String })
|
|
46
|
+
@property({ type: String })
|
|
47
|
+
autocomplete: "on" | "off" = "off";
|
|
43
48
|
|
|
44
|
-
@property({ type: Object })
|
|
49
|
+
@property({ type: Object })
|
|
50
|
+
configAria: Record<string, string> = {};
|
|
45
51
|
|
|
46
52
|
@property({ type: String })
|
|
47
|
-
variant:
|
|
53
|
+
variant: "filled" | "outlined" | "default" = "default";
|
|
48
54
|
|
|
49
55
|
/**
|
|
50
56
|
* Helper text to display below the input.
|
|
51
57
|
*/
|
|
52
|
-
@property({ type: String, attribute:
|
|
53
|
-
helperText: string =
|
|
58
|
+
@property({ type: String, attribute: "helper-text" })
|
|
59
|
+
helperText: string = "";
|
|
54
60
|
|
|
55
61
|
@property({ type: Boolean })
|
|
56
62
|
error: boolean = false;
|
|
57
63
|
|
|
58
|
-
@property({ type: String, attribute:
|
|
59
|
-
errorText: string =
|
|
64
|
+
@property({ type: String, attribute: "error-text" })
|
|
65
|
+
errorText: string = "";
|
|
60
66
|
|
|
61
67
|
@property({ type: Boolean })
|
|
62
68
|
warning: boolean = false;
|
|
63
69
|
|
|
64
|
-
@property({ type: String, attribute:
|
|
65
|
-
warningText: string =
|
|
70
|
+
@property({ type: String, attribute: "warning-text" })
|
|
71
|
+
warningText: string = "";
|
|
66
72
|
|
|
67
73
|
@state()
|
|
68
74
|
private focused = false;
|
|
@@ -74,15 +80,16 @@ export class Input extends BaseInput {
|
|
|
74
80
|
* Returns true when the text field has been interacted with. Native
|
|
75
81
|
* validation errors only display in response to user interactions.
|
|
76
82
|
*/
|
|
77
|
-
@state()
|
|
83
|
+
@state()
|
|
84
|
+
private dirty = false;
|
|
78
85
|
|
|
79
|
-
@query(
|
|
86
|
+
@query(".input-element")
|
|
80
87
|
private inputElement?: HTMLInputElement;
|
|
81
88
|
|
|
82
89
|
override async focus() {
|
|
83
90
|
await Promise.all([
|
|
84
|
-
customElements.whenDefined(
|
|
85
|
-
customElements.whenDefined(
|
|
91
|
+
customElements.whenDefined("wc-input"),
|
|
92
|
+
customElements.whenDefined("wc-field"),
|
|
86
93
|
]);
|
|
87
94
|
await this.updateComplete;
|
|
88
95
|
this.inputElement?.focus();
|
|
@@ -94,8 +101,8 @@ export class Input extends BaseInput {
|
|
|
94
101
|
}
|
|
95
102
|
|
|
96
103
|
private handleInitialAttributes() {
|
|
97
|
-
Array.from(this.attributes).forEach(attr => {
|
|
98
|
-
if (attr.name.startsWith(
|
|
104
|
+
Array.from(this.attributes).forEach((attr) => {
|
|
105
|
+
if (attr.name.startsWith("aria-")) {
|
|
99
106
|
this.configAria[attr.name] = attr.value;
|
|
100
107
|
this.removeAttribute(attr.name);
|
|
101
108
|
}
|
|
@@ -108,7 +115,7 @@ export class Input extends BaseInput {
|
|
|
108
115
|
}
|
|
109
116
|
|
|
110
117
|
private __handleFocusChange = (event: FocusEvent) => {
|
|
111
|
-
this.focused = event.type ===
|
|
118
|
+
this.focused = event.type === "focus";
|
|
112
119
|
};
|
|
113
120
|
|
|
114
121
|
private __redispatchEvent(event: Event) {
|
|
@@ -116,72 +123,68 @@ export class Input extends BaseInput {
|
|
|
116
123
|
}
|
|
117
124
|
|
|
118
125
|
render() {
|
|
119
|
-
const displayType =
|
|
120
|
-
|
|
126
|
+
const displayType = this.type === "password" && this.passwordVisible
|
|
127
|
+
? "text"
|
|
128
|
+
: this.type;
|
|
121
129
|
|
|
122
130
|
return html`
|
|
123
131
|
<wc-field
|
|
124
|
-
?required
|
|
125
|
-
?disabled
|
|
126
|
-
?readonly
|
|
127
|
-
?skeleton
|
|
128
|
-
helper-text
|
|
129
|
-
?error
|
|
130
|
-
error-text
|
|
131
|
-
?warning
|
|
132
|
-
variant
|
|
133
|
-
?populated
|
|
134
|
-
warning-text
|
|
135
|
-
label
|
|
136
|
-
?focused
|
|
137
|
-
.host
|
|
132
|
+
?required="${this.required}"
|
|
133
|
+
?disabled="${this.disabled}"
|
|
134
|
+
?readonly="${this.readonly}"
|
|
135
|
+
?skeleton="${this.skeleton}"
|
|
136
|
+
helper-text="${this.helperText}"
|
|
137
|
+
?error="${this.error}"
|
|
138
|
+
error-text="${this.errorText}"
|
|
139
|
+
?warning="${this.warning}"
|
|
140
|
+
variant="${this.variant}"
|
|
141
|
+
?populated="${!!this.value}"
|
|
142
|
+
warning-text="${this.warningText}"
|
|
143
|
+
label="${this.label}"
|
|
144
|
+
?focused="${this.focused}"
|
|
145
|
+
.host="${this}"
|
|
138
146
|
class="input-wrapper"
|
|
139
147
|
>
|
|
140
148
|
<slot name="start" slot="field-start"></slot>
|
|
141
149
|
|
|
142
150
|
<input
|
|
143
151
|
class="input input-element"
|
|
144
|
-
name
|
|
145
|
-
type
|
|
146
|
-
placeholder
|
|
147
|
-
autocomplete
|
|
148
|
-
.value
|
|
149
|
-
?readonly
|
|
150
|
-
?required
|
|
151
|
-
?disabled
|
|
152
|
-
@input
|
|
153
|
-
@change
|
|
154
|
-
@focus
|
|
155
|
-
@blur
|
|
152
|
+
name="${this.name}"
|
|
153
|
+
type="${displayType}"
|
|
154
|
+
placeholder="${this.placeholder}"
|
|
155
|
+
autocomplete="${this.autocomplete}"
|
|
156
|
+
.value="${this.value}"
|
|
157
|
+
?readonly="${this.readonly}"
|
|
158
|
+
?required="${this.required}"
|
|
159
|
+
?disabled="${this.disabled}"
|
|
160
|
+
@input="${this.__handleInput}"
|
|
161
|
+
@change="${this.__redispatchEvent}"
|
|
162
|
+
@focus="${this.__handleFocusChange}"
|
|
163
|
+
@blur="${this.__handleFocusChange}"
|
|
156
164
|
${spread(this.configAria)}
|
|
157
165
|
/>
|
|
158
166
|
|
|
159
|
-
|
|
167
|
+
<slot name="end" slot="field-end"></slot>
|
|
168
|
+
|
|
169
|
+
${this.type === "password"
|
|
160
170
|
? html`
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
: 'visibility'}
|
|
178
|
-
></wc-icon>
|
|
179
|
-
</wc-icon-button>
|
|
180
|
-
</wc-tooltip>
|
|
181
|
-
`
|
|
171
|
+
<wc-icon-button
|
|
172
|
+
class="password-toggle"
|
|
173
|
+
variant="text"
|
|
174
|
+
slot="field-end"
|
|
175
|
+
tooltip="${this.passwordVisible
|
|
176
|
+
? "Hide password"
|
|
177
|
+
: "Show password"}"
|
|
178
|
+
@click="${() => {
|
|
179
|
+
this.passwordVisible = !this.passwordVisible;
|
|
180
|
+
}}"
|
|
181
|
+
>
|
|
182
|
+
<wc-icon
|
|
183
|
+
name="${this.passwordVisible ? "visibility_off" : "visibility"}"
|
|
184
|
+
></wc-icon>
|
|
185
|
+
</wc-icon-button>
|
|
186
|
+
`
|
|
182
187
|
: nothing}
|
|
183
|
-
|
|
184
|
-
<slot name="end" slot="field-end"></slot>
|
|
185
188
|
</wc-field>
|
|
186
189
|
`;
|
|
187
190
|
}
|
package/src/loader.ts
CHANGED
|
@@ -262,6 +262,10 @@ const loaderConfig: LoaderConfig = {
|
|
|
262
262
|
importPath: `${distDirectory}/html-editor.js`,
|
|
263
263
|
dependencies: ['wc-code-editor'],
|
|
264
264
|
},
|
|
265
|
+
'wc-markdown-editor': {
|
|
266
|
+
importPath: `${distDirectory}/markdown-editor.js`,
|
|
267
|
+
dependencies: ['wc-code-editor'],
|
|
268
|
+
},
|
|
265
269
|
'wc-code-highlighter': {
|
|
266
270
|
importPath: `${distDirectory}/code-highlighter.js`,
|
|
267
271
|
},
|