@redvars/peacock 3.2.0 → 3.2.1
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-jsdocs.json +586 -586
- package/dist/custom-elements.json +4745 -4726
- package/dist/field.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/peacock-loader.js +3 -3
- package/dist/peacock-loader.js.map +1 -1
- package/dist/src/date-picker/date-picker.d.ts +50 -0
- package/dist/src/date-picker/index.d.ts +1 -0
- package/dist/src/field/field.d.ts +30 -0
- package/dist/src/field/index.d.ts +1 -0
- package/dist/src/index.d.ts +7 -1
- package/dist/src/input/index.d.ts +1 -7
- package/dist/src/input/input.d.ts +51 -0
- package/dist/src/number-field/index.d.ts +1 -0
- package/dist/src/number-field/number-field.d.ts +55 -0
- package/dist/src/switch/index.d.ts +1 -0
- package/dist/src/switch/switch.d.ts +89 -0
- package/dist/src/textarea/index.d.ts +1 -0
- package/dist/src/textarea/textarea.d.ts +51 -0
- package/dist/src/time-picker/index.d.ts +1 -0
- package/dist/src/time-picker/time-picker.d.ts +50 -0
- package/dist/switch-B3NU_cKN.js +2737 -0
- package/dist/switch-B3NU_cKN.js.map +1 -0
- package/dist/switch-BCbVyXJW.js +2736 -0
- package/dist/switch-BCbVyXJW.js.map +1 -0
- package/dist/switch-C7A-AMS6.js +2737 -0
- package/dist/switch-C7A-AMS6.js.map +1 -0
- package/dist/switch-Cqzu1Bd4.js +2737 -0
- package/dist/switch-Cqzu1Bd4.js.map +1 -0
- package/dist/switch-K9zwiDEK.js +2736 -0
- package/dist/switch-K9zwiDEK.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/typedoc.json +10361 -10361
- package/package.json +1 -1
- package/readme.md +51 -50
- package/src/{input/date-picker → date-picker}/date-picker.scss +1 -1
- package/src/{input/date-picker → date-picker}/date-picker.ts +3 -3
- package/src/date-picker/index.ts +1 -0
- package/src/{input/field → field}/field.scss +1 -1
- package/src/{input/field → field}/field.ts +1 -1
- package/src/field/index.ts +1 -0
- package/src/index.ts +7 -9
- package/src/input/index.ts +1 -7
- package/src/input/{input/input.scss → input.scss} +1 -1
- package/src/input/{input/input.ts → input.ts} +3 -3
- package/src/number-field/index.ts +1 -0
- package/src/{input/number/number.scss → number-field/number-field.scss} +1 -1
- package/src/{input/number → number-field}/number-field.ts +4 -4
- package/src/peacock-loader.ts +9 -9
- package/src/switch/index.ts +1 -0
- package/src/{input/toggle/toggle.scss → switch/switch.scss} +23 -23
- package/src/{input/toggle/toggle.ts → switch/switch.ts} +19 -21
- package/src/textarea/index.ts +1 -0
- package/src/{input/textarea → textarea}/textarea.scss +1 -1
- package/src/{input/textarea → textarea}/textarea.ts +3 -3
- package/src/time-picker/index.ts +1 -0
- package/src/{input/time-picker → time-picker}/time-picker.scss +1 -1
- package/src/{input/time-picker → time-picker}/time-picker.ts +3 -3
- package/src/input/toggle/index.ts +0 -1
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -45,7 +45,7 @@ Visit [https://peacock.redvars.com](https://goatui.com) to view the documentatio
|
|
|
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
47
|
<script type='module'
|
|
48
|
-
src='https://cdn.jsdelivr.net/npm/@redvars/peacock@3.
|
|
48
|
+
src='https://cdn.jsdelivr.net/npm/@redvars/peacock@3.2.0/dist/peacock-loader.js'></script>
|
|
49
49
|
</head>
|
|
50
50
|
|
|
51
51
|
<p-avatar name="Shivaji Varma"></p-avatar>
|
|
@@ -64,25 +64,25 @@ Input controls are UI design elements that allow users to input information into
|
|
|
64
64
|
collecting data and enabling user interactions. Some common examples of input controls include text fields, dropdown
|
|
65
65
|
menus, checkboxes, and radio buttons.
|
|
66
66
|
|
|
67
|
-
| Name
|
|
68
|
-
|
|
67
|
+
| Name | Component | State |
|
|
68
|
+
|---------------------------------------------------------------------|-------------------|-------|
|
|
69
69
|
| [Code editor](https://peacock.redvars.com/components/code-editor) | p-card-editor | 🟢 |
|
|
70
|
-
| Color picker
|
|
71
|
-
| [Checkbox](https://peacock.redvars.com/components/checkbox) |
|
|
72
|
-
| [Date picker](https://peacock.redvars.com/components/date-picker) |
|
|
73
|
-
| Date Time picker
|
|
74
|
-
| [Form control](https://peacock.redvars.com/components/form-control) |
|
|
75
|
-
| File picker
|
|
70
|
+
| Color picker | p-color-picker | 🔴 |
|
|
71
|
+
| [Checkbox](https://peacock.redvars.com/components/checkbox) | base-checkbox | 🟢 |
|
|
72
|
+
| [Date picker](https://peacock.redvars.com/components/date-picker) | date-picker | 🟡 |
|
|
73
|
+
| Date Time picker | p-datetime-picker | 🔴 |
|
|
74
|
+
| [Form control](https://peacock.redvars.com/components/form-control) | base-field | 🟡 |
|
|
75
|
+
| File picker | p-file-picker | 🔴 |
|
|
76
76
|
| [HTML editor](https://peacock.redvars.com/components/html-editor) | p-html-editor | 🟢 |
|
|
77
|
-
| [Input](https://peacock.redvars.com/components/input) |
|
|
77
|
+
| [Input](https://peacock.redvars.com/components/input) | input-field | 🟢 |
|
|
78
78
|
| [Input URL](https://peacock.redvars.com/components/input-url) | p-input-url | 🟢 |
|
|
79
|
-
| Month picker
|
|
80
|
-
| [Number](https://peacock.redvars.com/components/number) |
|
|
79
|
+
| Month picker | p-month-picker | 🔴 |
|
|
80
|
+
| [Number](https://peacock.redvars.com/components/number) | number-field | 🟢 |
|
|
81
81
|
| [Select](https://peacock.redvars.com/components/select) | p-select | 🟢 |
|
|
82
|
-
| [Textarea](https://peacock.redvars.com/components/textarea) |
|
|
83
|
-
| [Time picker](https://peacock.redvars.com/components/time-picker) |
|
|
82
|
+
| [Textarea](https://peacock.redvars.com/components/textarea) | textarea-field | 🟢 |
|
|
83
|
+
| [Time picker](https://peacock.redvars.com/components/time-picker) | time-picker | 🟡 |
|
|
84
84
|
| [URL input](https://peacock.redvars.com/components/url-input) | p-url-input. | 🔴 |
|
|
85
|
-
| Week picker
|
|
85
|
+
| Week picker | p-week-picker | 🔴 |
|
|
86
86
|
|
|
87
87
|
## Navigation
|
|
88
88
|
|
|
@@ -92,7 +92,7 @@ include menus, tabs, and breadcrumbs.
|
|
|
92
92
|
|
|
93
93
|
| Name | Component | State |
|
|
94
94
|
|--------------------------------------------------------|-----------------|-------|
|
|
95
|
-
| [Breadcrumb](https://peacock.redvars.com/components/breadcrumb) |
|
|
95
|
+
| [Breadcrumb](https://peacock.redvars.com/components/breadcrumb) | base-breadcrumb | 🟢 |
|
|
96
96
|
| [Dropdown](https://peacock.redvars.com/components/dropdown) | p-dropdown | 🟡 |
|
|
97
97
|
| [Menu](https://peacock.redvars.com/components/menu) | p-menu | 🟡 |
|
|
98
98
|
| [Tabs](https://peacock.redvars.com/components/tabs) | p-tabs | 🟢 |
|
|
@@ -100,17 +100,18 @@ include menus, tabs, and breadcrumbs.
|
|
|
100
100
|
## Informational
|
|
101
101
|
|
|
102
102
|
Informational components are UI elements that provide information to users. They communicate important messages,
|
|
103
|
-
updates, or instructions within the app or website. Some common examples of informational components
|
|
104
|
-
notifications, tooltips, and progress bars.
|
|
103
|
+
updates, or instructions within the app or website. Some common examples of informational components
|
|
104
|
+
include notifications, tooltips, and progress bars.
|
|
105
105
|
|
|
106
|
-
| Name
|
|
107
|
-
|
|
108
|
-
| [Badge](https://peacock.redvars.com/components/badge)
|
|
109
|
-
| [Progress](https://peacock.redvars.com/components/progress)
|
|
110
|
-
| [
|
|
111
|
-
| [
|
|
112
|
-
| [
|
|
113
|
-
| [Notification
|
|
106
|
+
| Name | Component | State |
|
|
107
|
+
|-------------------------------------------------------------------------------------|------------------------|-------|
|
|
108
|
+
| [Badge](https://peacock.redvars.com/components/badge) | base-badge | 🟢 |
|
|
109
|
+
| [Linear Progress](https://peacock.redvars.com/components/linear-progress) | linear-progress | 🟢 |
|
|
110
|
+
| [Circular Progress](https://peacock.redvars.com/components/circular-progress) | circular-progress | 🟢 |
|
|
111
|
+
| [Spinner](https://peacock.redvars.com/components/spinner) | p-spinner | 🟢 |
|
|
112
|
+
| [Tooltip](https://peacock.redvars.com/components/tooltip) | base-tooltip | 🟢 |
|
|
113
|
+
| [Notification](https://peacock.redvars.com/components/notification) | p-notification | 🟢 |
|
|
114
|
+
| [Notification Manager](https://peacock.redvars.com/components/notification-manager) | p-notification-manager | 🟢 |
|
|
114
115
|
|
|
115
116
|
|
|
116
117
|
## Containers
|
|
@@ -119,45 +120,45 @@ Containers are UI elements that group similar content together, making it easier
|
|
|
119
120
|
the interface. Examples of common containers include cards, carousels, and accordions, which provide structure and
|
|
120
121
|
organization to the content.
|
|
121
122
|
|
|
122
|
-
| Name
|
|
123
|
-
|
|
124
|
-
| [Accordion](https://peacock.redvars.com/components/accordion) |
|
|
125
|
-
| Card
|
|
123
|
+
| Name | Component | State |
|
|
124
|
+
|---------------------------------------------------------------|----------------|-------|
|
|
125
|
+
| [Accordion](https://peacock.redvars.com/components/accordion) | base-accordion | 🟢 |
|
|
126
|
+
| Card | p-card | 🟡 |
|
|
126
127
|
|
|
127
128
|
## General
|
|
128
129
|
|
|
129
130
|
These components are used for general purpose. They include
|
|
130
131
|
|
|
131
|
-
| Name
|
|
132
|
-
|
|
133
|
-
| [Avatar](https://peacock.redvars.com/components/avatar) |
|
|
134
|
-
| [Button](https://peacock.redvars.com/components/button) |
|
|
135
|
-
| [Button Group](https://peacock.redvars.com/components/button-group) |
|
|
132
|
+
| Name | Component | State |
|
|
133
|
+
|-------------------------------------------------------------------------------------|---------------------------|-------|
|
|
134
|
+
| [Avatar](https://peacock.redvars.com/components/avatar) | base-avatar | 🟢 |
|
|
135
|
+
| [Button](https://peacock.redvars.com/components/button) | base-button | 🟢 |
|
|
136
|
+
| [Button Group](https://peacock.redvars.com/components/button-group) | button-group | 🟢 |
|
|
136
137
|
| [Calendar](https://peacock.redvars.com/components/calendar) | p-calendar | 🟢 |
|
|
137
|
-
| Card Select
|
|
138
|
-
| [Code Highlighter](https://peacock.redvars.com/components/code-highlighter) |
|
|
139
|
-
| Column
|
|
138
|
+
| Card Select | p-cardselect | 🔴 |
|
|
139
|
+
| [Code Highlighter](https://peacock.redvars.com/components/code-highlighter) | code-highlighter | 🟢 |
|
|
140
|
+
| Column | p-col | 🔴 |
|
|
140
141
|
| [Empty State](https://peacock.redvars.com/components/empty-state) | p-empty-state | 🟡 |
|
|
141
142
|
| [Flow Designer ](https://peacock.redvars.com/components/flow-designer) | p-flow-designer | 🔵 |
|
|
142
|
-
| Grid
|
|
143
|
-
| Group
|
|
143
|
+
| Grid | p-grid | 🔴 |
|
|
144
|
+
| Group | p-group | 🔴 |
|
|
144
145
|
| [Header](https://peacock.redvars.com/components/header) | p-header | 🟢 |
|
|
145
|
-
| [Icon](https://peacock.redvars.com/components/icon) |
|
|
146
|
-
| [Link](https://peacock.redvars.com/components/link) |
|
|
146
|
+
| [Icon](https://peacock.redvars.com/components/icon) | base-icon | 🟢 |
|
|
147
|
+
| [Link](https://peacock.redvars.com/components/link) | base-link | 🟢 |
|
|
147
148
|
| [Modal](https://peacock.redvars.com/components/modal) | p-modal | 🟢 |
|
|
148
149
|
| [Notification Manager](https://peacock.redvars.com/components/notification-manager) | p-notification-manager | 🟡 |
|
|
149
|
-
| Observer
|
|
150
|
-
| Pagination
|
|
151
|
-
| Radio Group
|
|
152
|
-
| Row
|
|
150
|
+
| Observer | p-observer | 🔴 |
|
|
151
|
+
| Pagination | p-pagination | 🔴 |
|
|
152
|
+
| Radio Group | p-radiogroup | 🔴 |
|
|
153
|
+
| Row | p-row | 🔴 |
|
|
153
154
|
| [Slider](https://peacock.redvars.com/components/slider) | p-slider | 🟡 |
|
|
154
|
-
| Spoiler
|
|
155
|
-
| Stepper
|
|
155
|
+
| Spoiler | p-spoiler | 🔴 |
|
|
156
|
+
| Stepper | p-stepper | 🔴 |
|
|
156
157
|
| [Table](https://peacock.redvars.com/components/table) | p-table | 🟡 |
|
|
157
|
-
| [Tag](https://peacock.redvars.com/components/tag) / Chip |
|
|
158
|
+
| [Tag](https://peacock.redvars.com/components/tag) / Chip | base-tag | 🟢 |
|
|
158
159
|
| [Text](https://peacock.redvars.com/components/text) | p-text | 🟢 |
|
|
159
160
|
| [Tree View](https://peacock.redvars.com/components/tree-view) | p-tree-view | 🟡 |
|
|
160
|
-
| [
|
|
161
|
+
| [Switch](https://peacock.redvars.com/components/switch) | base-switch | 🟢 |
|
|
161
162
|
|
|
162
163
|
## Charts
|
|
163
164
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { html } from 'lit';
|
|
2
2
|
import { property, query, state } from 'lit/decorators.js';
|
|
3
|
-
import BaseInput from '../BaseInput.js';
|
|
3
|
+
import BaseInput from '../input/BaseInput.js';
|
|
4
4
|
import styles from './date-picker.scss';
|
|
5
|
-
import { spread } from '
|
|
6
|
-
import { redispatchEvent } from '
|
|
5
|
+
import { spread } from '../spread.js';
|
|
6
|
+
import { redispatchEvent } from '../utils.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @label Date Picker
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DatePicker } from './date-picker.js';
|
|
@@ -2,7 +2,7 @@ import { html, LitElement, nothing } from 'lit';
|
|
|
2
2
|
import { property, state } from 'lit/decorators.js';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
4
|
import styles from './field.scss';
|
|
5
|
-
import { observerSlotChangesWithCallback } from '
|
|
5
|
+
import { observerSlotChangesWithCallback } from '../utils.js';
|
|
6
6
|
|
|
7
7
|
export class Field extends LitElement {
|
|
8
8
|
static styles = [styles];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Field } from './field.js';
|
package/src/index.ts
CHANGED
|
@@ -15,15 +15,13 @@ export { Chip } from './chip/chip/index.js';
|
|
|
15
15
|
export { LinearProgress } from './progress/linear-progress/index.js';
|
|
16
16
|
export { CircularProgress } from './progress/circular-progress/index.js';
|
|
17
17
|
export { Skeleton } from './skeleton/index.js';
|
|
18
|
-
export {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
Toggle,
|
|
26
|
-
} from './input/index.js';
|
|
18
|
+
export { Input } from './input/index.js';
|
|
19
|
+
export { Field } from './field/index.js';
|
|
20
|
+
export { NumberField } from './number-field/index.js';
|
|
21
|
+
export { DatePicker } from './date-picker/index.js';
|
|
22
|
+
export { TimePicker } from './time-picker/index.js';
|
|
23
|
+
export { Textarea } from './textarea/index.js';
|
|
24
|
+
export { Switch } from './switch/index.js';
|
|
27
25
|
|
|
28
26
|
export { NumberCounter } from './number-counter/index.js';
|
|
29
27
|
export { EmptyState } from './empty-state/index.js';
|
package/src/input/index.ts
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
export { Input } from './input
|
|
2
|
-
export { Field } from './field/field.js';
|
|
3
|
-
export { NumberField } from './number/number-field.js';
|
|
4
|
-
export { Textarea } from './textarea/textarea.js';
|
|
5
|
-
export { DatePicker } from './date-picker/date-picker.js';
|
|
6
|
-
export { TimePicker } from './time-picker/time-picker.js';
|
|
7
|
-
export { Toggle } from './toggle/toggle.js';
|
|
1
|
+
export { Input } from './input.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { html, nothing } from 'lit';
|
|
2
2
|
import { property, query, state } from 'lit/decorators.js';
|
|
3
|
-
import BaseInput from '
|
|
3
|
+
import BaseInput from './BaseInput.js';
|
|
4
4
|
import styles from './input.scss';
|
|
5
|
-
import { spread } from '
|
|
6
|
-
import { redispatchEvent } from '
|
|
5
|
+
import { spread } from '../spread.js';
|
|
6
|
+
import { redispatchEvent } from '../utils.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @label Input
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { NumberField } from './number-field.js';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { html, nothing } from 'lit';
|
|
2
2
|
import { property, query, state } from 'lit/decorators.js';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
-
import BaseInput from '../BaseInput.js';
|
|
5
|
-
import styles from './number.scss';
|
|
6
|
-
import { spread } from '
|
|
7
|
-
import { redispatchEvent } from '
|
|
4
|
+
import BaseInput from '../input/BaseInput.js';
|
|
5
|
+
import styles from './number-field.scss';
|
|
6
|
+
import { spread } from '../spread.js';
|
|
7
|
+
import { redispatchEvent } from '../utils.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @label Number Field
|
package/src/peacock-loader.ts
CHANGED
|
@@ -12,13 +12,13 @@ import { Divider } from './divider/divider.js';
|
|
|
12
12
|
import { Button } from './button/button/button.js';
|
|
13
13
|
import { ButtonGroup } from './button/button-group/button-group.js';
|
|
14
14
|
import { IconButton } from './button/icon-button/icon-button.js';
|
|
15
|
-
import { Input } from './input/input
|
|
16
|
-
import { Field } from './
|
|
17
|
-
import { NumberField } from './
|
|
18
|
-
import { DatePicker } from './
|
|
19
|
-
import { TimePicker } from './
|
|
20
|
-
import { Textarea } from './
|
|
21
|
-
import {
|
|
15
|
+
import { Input } from './input/input.js';
|
|
16
|
+
import { Field } from './field/field.js';
|
|
17
|
+
import { NumberField } from './number-field/number-field.js';
|
|
18
|
+
import { DatePicker } from './date-picker/date-picker.js';
|
|
19
|
+
import { TimePicker } from './time-picker/time-picker.js';
|
|
20
|
+
import { Textarea } from './textarea/textarea.js';
|
|
21
|
+
import { Switch } from './switch/switch.js';
|
|
22
22
|
import { Checkbox } from './checkbox/checkbox.js';
|
|
23
23
|
|
|
24
24
|
import { Accordion } from './accordion/accordion/accordion.js';
|
|
@@ -147,8 +147,8 @@ const loaderConfig: LoaderConfig = {
|
|
|
147
147
|
'breadcrumb-item': {
|
|
148
148
|
CustomElementClass: BreadcrumbItem,
|
|
149
149
|
},
|
|
150
|
-
'base-
|
|
151
|
-
CustomElementClass:
|
|
150
|
+
'base-switch': {
|
|
151
|
+
CustomElementClass: Switch,
|
|
152
152
|
},
|
|
153
153
|
'base-checkbox': {
|
|
154
154
|
CustomElementClass: Checkbox,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Switch } from './switch.js';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
@use "
|
|
1
|
+
@use "../../scss/mixin";
|
|
2
2
|
|
|
3
3
|
@include mixin.base-styles;
|
|
4
4
|
|
|
5
5
|
:host {
|
|
6
6
|
display: inline-block;
|
|
7
|
-
--
|
|
8
|
-
--
|
|
7
|
+
--switch-track-color: var(--color-primary);
|
|
8
|
+
--switch-track-off-color: var(--color-surface-container-highest);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
.
|
|
11
|
+
.switch {
|
|
12
12
|
position: relative;
|
|
13
13
|
display: flex;
|
|
14
14
|
align-items: center;
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
|
|
35
35
|
.track {
|
|
36
36
|
position: relative;
|
|
37
|
-
background: var(--
|
|
37
|
+
background: var(--switch-track-off-color);
|
|
38
38
|
border: 2px solid var(--color-outline);
|
|
39
39
|
border-radius: var(--shape-corner-full);
|
|
40
40
|
cursor: pointer;
|
|
@@ -53,12 +53,12 @@
|
|
|
53
53
|
border-radius: var(--shape-corner-full);
|
|
54
54
|
transition: all var(--duration-short2) var(--easing-standard);
|
|
55
55
|
background: white;
|
|
56
|
-
height: var(--
|
|
57
|
-
width: var(--
|
|
58
|
-
background: var(--
|
|
56
|
+
height: var(--switch-handle-radius);
|
|
57
|
+
width: var(--switch-handle-radius);
|
|
58
|
+
background: var(--switch-handle-color);
|
|
59
59
|
.icon {
|
|
60
60
|
--icon-size: .75rem;
|
|
61
|
-
--icon-color: var(--
|
|
61
|
+
--icon-color: var(--switch-track-off-color);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
}
|
|
@@ -77,22 +77,22 @@
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
.
|
|
80
|
+
.switch.state-checked {
|
|
81
81
|
.track {
|
|
82
|
-
background: var(--
|
|
82
|
+
background: var(--switch-track-color);
|
|
83
83
|
border-color: transparent;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
.handle {
|
|
87
|
-
margin-inline-start: calc(100% - var(--
|
|
87
|
+
margin-inline-start: calc(100% - var(--switch-handle-radius));
|
|
88
88
|
.icon {
|
|
89
89
|
--icon-size: 1rem;
|
|
90
|
-
--icon-color: var(--
|
|
90
|
+
--icon-color: var(--switch-track-color);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
&.active .track {
|
|
95
|
-
border-color: var(--
|
|
95
|
+
border-color: var(--switch-track-color);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
&.has-focus:not(.active) {
|
|
@@ -104,24 +104,24 @@
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
.
|
|
107
|
+
.switch {
|
|
108
108
|
--_container-width: 3.25rem;
|
|
109
109
|
--_container-height: 2rem;
|
|
110
|
-
--
|
|
111
|
-
--
|
|
110
|
+
--switch-handle-radius: 16px;
|
|
111
|
+
--switch-handle-color: var(--color-outline);
|
|
112
112
|
|
|
113
113
|
&.state-checked {
|
|
114
|
-
--
|
|
115
|
-
--
|
|
114
|
+
--switch-handle-radius: 22px;
|
|
115
|
+
--switch-handle-color: var(--color-surface-container-lowest);
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
.
|
|
119
|
+
.switch.readonly {
|
|
120
120
|
cursor: default;
|
|
121
121
|
|
|
122
122
|
.track {
|
|
123
123
|
border-color: var(--color-outline);
|
|
124
|
-
background: var(--
|
|
124
|
+
background: var(--switch-track-off-color);
|
|
125
125
|
opacity: 0.38;
|
|
126
126
|
|
|
127
127
|
.handle {
|
|
@@ -131,11 +131,11 @@
|
|
|
131
131
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
.
|
|
134
|
+
.switch.disabled {
|
|
135
135
|
cursor: not-allowed;
|
|
136
136
|
.track {
|
|
137
137
|
border-color: var(--color-on-surface);
|
|
138
|
-
background: var(--
|
|
138
|
+
background: var(--switch-track-off-color);
|
|
139
139
|
opacity: 0.38;
|
|
140
140
|
|
|
141
141
|
.handle {
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import { html, nothing } from 'lit';
|
|
2
2
|
import { property, query, state } from 'lit/decorators.js';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
-
import { spread } from '
|
|
5
|
-
import styles from './
|
|
6
|
-
import BaseInput from '../BaseInput.js';
|
|
4
|
+
import { spread } from '../spread.js';
|
|
5
|
+
import styles from './switch.scss';
|
|
6
|
+
import BaseInput from '../input/BaseInput.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* @label
|
|
10
|
-
* @tag base-
|
|
11
|
-
* @rawTag
|
|
9
|
+
* @label Switch
|
|
10
|
+
* @tag base-switch
|
|
11
|
+
* @rawTag switch
|
|
12
12
|
*
|
|
13
13
|
* @summary Captures boolean input with an on/off switch interaction.
|
|
14
14
|
* @overview
|
|
15
15
|
* <p>Toggles are used to enable or disable a single option. They provide immediate feedback about whether an option is active or inactive.</p>
|
|
16
16
|
*
|
|
17
|
-
* @cssprop --
|
|
18
|
-
* @cssprop --
|
|
19
|
-
* @cssprop --
|
|
20
|
-
* @cssprop --
|
|
21
|
-
* @cssprop --
|
|
22
|
-
* @cssprop --
|
|
17
|
+
* @cssprop --switch-track-color: Color of the switch track when checked.
|
|
18
|
+
* @cssprop --switch-track-off-color: Color of the switch track when unchecked.
|
|
19
|
+
* @cssprop --switch-width: Width of the switch track.
|
|
20
|
+
* @cssprop --switch-height: Height of the switch track.
|
|
21
|
+
* @cssprop --switch-handle-radius: Size of the switch handle.
|
|
22
|
+
* @cssprop --switch-handle-color: Color of the switch handle.
|
|
23
23
|
*
|
|
24
|
-
* @fires {CustomEvent} change - Dispatched when the
|
|
25
|
-
* @fires {CustomEvent} blur - Dispatched when the
|
|
26
|
-
* @fires {CustomEvent} focus - Dispatched when the
|
|
24
|
+
* @fires {CustomEvent} change - Dispatched when the switch value changes.
|
|
25
|
+
* @fires {CustomEvent} blur - Dispatched when the switch loses focus.
|
|
26
|
+
* @fires {CustomEvent} focus - Dispatched when the switch receives focus.
|
|
27
27
|
*
|
|
28
28
|
* @example
|
|
29
29
|
* ```html
|
|
30
|
-
* <base-
|
|
30
|
+
* <base-switch value="true"></base-switch>
|
|
31
31
|
* ```
|
|
32
32
|
* @tags input, form
|
|
33
33
|
*/
|
|
34
|
-
export class
|
|
34
|
+
export class Switch extends BaseInput {
|
|
35
35
|
static styles = [styles];
|
|
36
36
|
|
|
37
37
|
@property({ type: Boolean })
|
|
@@ -44,7 +44,7 @@ export class Toggle extends BaseInput {
|
|
|
44
44
|
name: string = '';
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
|
-
* The
|
|
47
|
+
* The switch label.
|
|
48
48
|
*/
|
|
49
49
|
@property({ type: String })
|
|
50
50
|
label: string = '';
|
|
@@ -221,7 +221,7 @@ export class Toggle extends BaseInput {
|
|
|
221
221
|
|
|
222
222
|
render() {
|
|
223
223
|
const cssClasses = {
|
|
224
|
-
|
|
224
|
+
switch: true,
|
|
225
225
|
'state-checked': this.value,
|
|
226
226
|
'has-focus': this.hasFocus,
|
|
227
227
|
active: this.isActive,
|
|
@@ -269,5 +269,3 @@ export class Toggle extends BaseInput {
|
|
|
269
269
|
`;
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
|
-
|
|
273
|
-
customElements.define('base-toggle', Toggle);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Textarea } from './textarea.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { html } from 'lit';
|
|
2
2
|
import { property, query, state } from 'lit/decorators.js';
|
|
3
|
-
import BaseInput from '../BaseInput.js';
|
|
3
|
+
import BaseInput from '../input/BaseInput.js';
|
|
4
4
|
import styles from './textarea.scss';
|
|
5
|
-
import { spread } from '
|
|
6
|
-
import { redispatchEvent } from '
|
|
5
|
+
import { spread } from '../spread.js';
|
|
6
|
+
import { redispatchEvent } from '../utils.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @label Textarea
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TimePicker } from './time-picker.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { html } from 'lit';
|
|
2
2
|
import { property, query, state } from 'lit/decorators.js';
|
|
3
|
-
import BaseInput from '../BaseInput.js';
|
|
3
|
+
import BaseInput from '../input/BaseInput.js';
|
|
4
4
|
import styles from './time-picker.scss';
|
|
5
|
-
import { spread } from '
|
|
6
|
-
import { redispatchEvent } from '
|
|
5
|
+
import { spread } from '../spread.js';
|
|
6
|
+
import { redispatchEvent } from '../utils.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @label Time Picker
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Toggle } from './toggle.js';
|