@justeattakeaway/pie-select 0.0.0-snapshot-release-20250306125923
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/README.md +91 -0
- package/custom-elements.json +217 -0
- package/declaration.d.ts +9 -0
- package/dist/index.d.ts +65 -0
- package/dist/index.js +104 -0
- package/dist/react.d.ts +70 -0
- package/dist/react.js +17 -0
- package/package.json +50 -0
- package/src/defs-react.ts +3 -0
- package/src/defs.ts +40 -0
- package/src/index.ts +135 -0
- package/src/react.ts +19 -0
- package/src/select.scss +97 -0
package/README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img align="center" src="../../../readme_image.png" height="200" alt="">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://www.npmjs.com/@justeattakeaway/pie-select">
|
|
7
|
+
<img alt="GitHub Workflow Status" src="https://img.shields.io/npm/v/@justeattakeaway/pie-select.svg">
|
|
8
|
+
</a>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
# Table of Contents
|
|
12
|
+
|
|
13
|
+
1. [Introduction](#pie-select)
|
|
14
|
+
2. [Installation](#installation)
|
|
15
|
+
3. [Importing the component](#importing-the-component)
|
|
16
|
+
4. [Peer Dependencies](#peer-dependencies)
|
|
17
|
+
5. [Props](#props)
|
|
18
|
+
6. [Contributing](#contributing)
|
|
19
|
+
|
|
20
|
+
## pie-select
|
|
21
|
+
|
|
22
|
+
`pie-select` is a Web Component built using the Lit library.
|
|
23
|
+
|
|
24
|
+
This component can be easily integrated into various frontend frameworks and customized through a set of properties.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
To install `pie-select` in your application, run the following on your command line:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# npm
|
|
33
|
+
$ npm i @justeattakeaway/pie-select
|
|
34
|
+
|
|
35
|
+
# yarn
|
|
36
|
+
$ yarn add @justeattakeaway/pie-select
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
For full information on using PIE components as part of an application, check out the [Getting Started Guide](https://github.com/justeattakeaway/pie/wiki/Getting-started-with-PIE-Web-Components).
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Importing the component
|
|
43
|
+
|
|
44
|
+
#### JavaScript
|
|
45
|
+
```js
|
|
46
|
+
// Default – for Native JS Applications, Vue, Angular, Svelte, etc.
|
|
47
|
+
import { PieSelect } from '@justeattakeaway/pie-select';
|
|
48
|
+
|
|
49
|
+
// If you don't need to reference the imported object, you can simply
|
|
50
|
+
// import the module which registers the component as a custom element.
|
|
51
|
+
import '@justeattakeaway/pie-select';
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
#### React
|
|
55
|
+
```js
|
|
56
|
+
// React
|
|
57
|
+
// For React, you will need to import our React-specific component build
|
|
58
|
+
// which wraps the web component using @lit/react
|
|
59
|
+
import { PieSelect } from '@justeattakeaway/pie-select/dist/react';
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
> [!NOTE]
|
|
63
|
+
> When using the React version of the component, please make sure to also
|
|
64
|
+
> include React as a [peer dependency](#peer-dependencies) in your project.
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
## Peer Dependencies
|
|
68
|
+
|
|
69
|
+
> [!IMPORTANT]
|
|
70
|
+
> When using `pie-select`, you will also need to include a couple of dependencies to ensure the component renders as expected. See [the PIE Wiki](https://github.com/justeattakeaway/pie/wiki/Getting-started-with-PIE-Web-Components#expected-dependencies) for more information and how to include these in your application.
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
## Props
|
|
74
|
+
|
|
75
|
+
| Property | Type | Default | Description |
|
|
76
|
+
|---|---|---|---|
|
|
77
|
+
| - | - | - | - |
|
|
78
|
+
|
|
79
|
+
In your markup or JSX, you can then use these to set the properties for the `pie-select` component:
|
|
80
|
+
|
|
81
|
+
```html
|
|
82
|
+
<!-- Native HTML -->
|
|
83
|
+
<pie-select></pie-select>
|
|
84
|
+
|
|
85
|
+
<!-- JSX -->
|
|
86
|
+
<PieSelect></PieSelect>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Contributing
|
|
90
|
+
|
|
91
|
+
Check out our [contributing guide](https://github.com/justeattakeaway/pie/wiki/Contributing-Guide) for more information on [local development](https://github.com/justeattakeaway/pie/wiki/Contributing-Guide#local-development) and how to run specific [component tests](https://github.com/justeattakeaway/pie/wiki/Contributing-Guide#testing).
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "1.0.0",
|
|
3
|
+
"readme": "",
|
|
4
|
+
"modules": [
|
|
5
|
+
{
|
|
6
|
+
"kind": "javascript-module",
|
|
7
|
+
"path": "src/defs-react.js",
|
|
8
|
+
"declarations": [],
|
|
9
|
+
"exports": []
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"kind": "javascript-module",
|
|
13
|
+
"path": "src/defs.js",
|
|
14
|
+
"declarations": [
|
|
15
|
+
{
|
|
16
|
+
"kind": "variable",
|
|
17
|
+
"name": "sizes",
|
|
18
|
+
"type": {
|
|
19
|
+
"text": "['small', 'medium', 'large']"
|
|
20
|
+
},
|
|
21
|
+
"default": "['small', 'medium', 'large']"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"kind": "variable",
|
|
25
|
+
"name": "statusTypes",
|
|
26
|
+
"type": {
|
|
27
|
+
"text": "['default', 'error']"
|
|
28
|
+
},
|
|
29
|
+
"default": "['default', 'error']"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"kind": "variable",
|
|
33
|
+
"name": "defaultProps",
|
|
34
|
+
"type": {
|
|
35
|
+
"text": "DefaultProps"
|
|
36
|
+
},
|
|
37
|
+
"default": "{\n size: 'medium',\n status: 'default',\n disabled: false,\n}"
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"exports": [
|
|
41
|
+
{
|
|
42
|
+
"kind": "js",
|
|
43
|
+
"name": "sizes",
|
|
44
|
+
"declaration": {
|
|
45
|
+
"name": "sizes",
|
|
46
|
+
"module": "src/defs.js"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"kind": "js",
|
|
51
|
+
"name": "statusTypes",
|
|
52
|
+
"declaration": {
|
|
53
|
+
"name": "statusTypes",
|
|
54
|
+
"module": "src/defs.js"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"kind": "js",
|
|
59
|
+
"name": "defaultProps",
|
|
60
|
+
"declaration": {
|
|
61
|
+
"name": "defaultProps",
|
|
62
|
+
"module": "src/defs.js"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"kind": "javascript-module",
|
|
69
|
+
"path": "src/index.js",
|
|
70
|
+
"declarations": [
|
|
71
|
+
{
|
|
72
|
+
"kind": "class",
|
|
73
|
+
"description": "",
|
|
74
|
+
"name": "PieSelect",
|
|
75
|
+
"members": [
|
|
76
|
+
{
|
|
77
|
+
"kind": "field",
|
|
78
|
+
"name": "shadowRootOptions",
|
|
79
|
+
"type": {
|
|
80
|
+
"text": "object"
|
|
81
|
+
},
|
|
82
|
+
"static": true,
|
|
83
|
+
"default": "{ ...LitElement.shadowRootOptions, delegatesFocus: true }"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"kind": "field",
|
|
87
|
+
"name": "size",
|
|
88
|
+
"privacy": "public",
|
|
89
|
+
"attribute": "size"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"kind": "field",
|
|
93
|
+
"name": "disabled",
|
|
94
|
+
"privacy": "public",
|
|
95
|
+
"attribute": "disabled"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"kind": "field",
|
|
99
|
+
"name": "status",
|
|
100
|
+
"privacy": "public",
|
|
101
|
+
"attribute": "status"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"kind": "field",
|
|
105
|
+
"name": "assistiveText",
|
|
106
|
+
"type": {
|
|
107
|
+
"text": "SelectProps['assistiveText']"
|
|
108
|
+
},
|
|
109
|
+
"privacy": "public",
|
|
110
|
+
"attribute": "assistiveText"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"kind": "field",
|
|
114
|
+
"name": "name",
|
|
115
|
+
"type": {
|
|
116
|
+
"text": "SelectProps['name']"
|
|
117
|
+
},
|
|
118
|
+
"privacy": "public",
|
|
119
|
+
"attribute": "name"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"kind": "field",
|
|
123
|
+
"name": "focusTarget",
|
|
124
|
+
"type": {
|
|
125
|
+
"text": "HTMLElement"
|
|
126
|
+
},
|
|
127
|
+
"privacy": "public"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"kind": "field",
|
|
131
|
+
"name": "_leadingIconNodes",
|
|
132
|
+
"type": {
|
|
133
|
+
"text": "Array<Node>"
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"kind": "field",
|
|
138
|
+
"name": "_hasLeadingIcon",
|
|
139
|
+
"type": {
|
|
140
|
+
"text": "boolean"
|
|
141
|
+
},
|
|
142
|
+
"privacy": "private",
|
|
143
|
+
"default": "false"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"kind": "method",
|
|
147
|
+
"name": "handleLeadingIconSlotchange",
|
|
148
|
+
"privacy": "private"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"kind": "method",
|
|
152
|
+
"name": "renderAssistiveText"
|
|
153
|
+
}
|
|
154
|
+
],
|
|
155
|
+
"attributes": [
|
|
156
|
+
{
|
|
157
|
+
"name": "size",
|
|
158
|
+
"fieldName": "size"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"name": "disabled",
|
|
162
|
+
"fieldName": "disabled"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"name": "status",
|
|
166
|
+
"fieldName": "status"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"name": "assistiveText",
|
|
170
|
+
"type": {
|
|
171
|
+
"text": "SelectProps['assistiveText']"
|
|
172
|
+
},
|
|
173
|
+
"fieldName": "assistiveText"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"name": "name",
|
|
177
|
+
"type": {
|
|
178
|
+
"text": "SelectProps['name']"
|
|
179
|
+
},
|
|
180
|
+
"fieldName": "name"
|
|
181
|
+
}
|
|
182
|
+
],
|
|
183
|
+
"mixins": [
|
|
184
|
+
{
|
|
185
|
+
"name": "RtlMixin",
|
|
186
|
+
"package": "@justeattakeaway/pie-webc-core"
|
|
187
|
+
}
|
|
188
|
+
],
|
|
189
|
+
"superclass": {
|
|
190
|
+
"name": "LitElement",
|
|
191
|
+
"package": "lit"
|
|
192
|
+
},
|
|
193
|
+
"tagName": "pie-select",
|
|
194
|
+
"customElement": true
|
|
195
|
+
}
|
|
196
|
+
],
|
|
197
|
+
"exports": [
|
|
198
|
+
{
|
|
199
|
+
"kind": "js",
|
|
200
|
+
"name": "*",
|
|
201
|
+
"declaration": {
|
|
202
|
+
"name": "*",
|
|
203
|
+
"package": "./defs"
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"kind": "js",
|
|
208
|
+
"name": "PieSelect",
|
|
209
|
+
"declaration": {
|
|
210
|
+
"name": "PieSelect",
|
|
211
|
+
"module": "src/index.js"
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
]
|
|
215
|
+
}
|
|
216
|
+
]
|
|
217
|
+
}
|
package/declaration.d.ts
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ComponentDefaultProps } from '@justeattakeaway/pie-webc-core';
|
|
2
|
+
import type { CSSResult } from 'lit';
|
|
3
|
+
import type { GenericConstructor } from '@justeattakeaway/pie-webc-core';
|
|
4
|
+
import type { LitElement } from 'lit';
|
|
5
|
+
import type { nothing } from 'lit';
|
|
6
|
+
import type { RTLInterface } from '@justeattakeaway/pie-webc-core';
|
|
7
|
+
import type { TemplateResult } from 'lit-html';
|
|
8
|
+
|
|
9
|
+
declare type DefaultProps = ComponentDefaultProps<SelectProps, keyof Omit<SelectProps, 'name' | 'assistiveText'>>;
|
|
10
|
+
|
|
11
|
+
export declare const defaultProps: DefaultProps;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @tagname pie-select
|
|
15
|
+
*/
|
|
16
|
+
export declare class PieSelect extends PieSelect_base implements SelectProps {
|
|
17
|
+
static shadowRootOptions: {
|
|
18
|
+
delegatesFocus: boolean;
|
|
19
|
+
mode: ShadowRootMode;
|
|
20
|
+
slotAssignment?: SlotAssignmentMode | undefined;
|
|
21
|
+
};
|
|
22
|
+
size: "small" | "medium" | "large";
|
|
23
|
+
disabled: boolean;
|
|
24
|
+
status: "default" | "error";
|
|
25
|
+
assistiveText: SelectProps['assistiveText'];
|
|
26
|
+
name: SelectProps['name'];
|
|
27
|
+
focusTarget: HTMLElement;
|
|
28
|
+
_leadingIconNodes: Array<Node>;
|
|
29
|
+
private _hasLeadingIcon;
|
|
30
|
+
private handleLeadingIconSlotchange;
|
|
31
|
+
renderAssistiveText(): typeof nothing | TemplateResult<1>;
|
|
32
|
+
render(): TemplateResult<1>;
|
|
33
|
+
static styles: CSSResult;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare const PieSelect_base: GenericConstructor<RTLInterface> & typeof LitElement;
|
|
37
|
+
|
|
38
|
+
export declare interface SelectProps {
|
|
39
|
+
/**
|
|
40
|
+
* The size of the select component. Can be `small`, `medium` or `large`. Defaults to `medium`.
|
|
41
|
+
*/
|
|
42
|
+
size?: typeof sizes[number];
|
|
43
|
+
/**
|
|
44
|
+
* Same as the HTML disabled attribute - indicates whether the select is disabled.
|
|
45
|
+
*/
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* An optional assistive text to display below the select element. Must be provided when the status is success or error.
|
|
49
|
+
*/
|
|
50
|
+
assistiveText?: string;
|
|
51
|
+
/**
|
|
52
|
+
* The status of the select component / assistive text. Can be default or error.
|
|
53
|
+
*/
|
|
54
|
+
status?: typeof statusTypes[number];
|
|
55
|
+
/**
|
|
56
|
+
* The name of the select (used as a key/value pair with `value`). This is required in order to work properly with forms.
|
|
57
|
+
*/
|
|
58
|
+
name?: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export declare const sizes: readonly ["small", "medium", "large"];
|
|
62
|
+
|
|
63
|
+
export declare const statusTypes: readonly ["default", "error"];
|
|
64
|
+
|
|
65
|
+
export { }
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { LitElement as h, nothing as x, html as b, unsafeCSS as y } from "lit";
|
|
2
|
+
import { RtlMixin as k, validPropertyValues as f, defineCustomElement as I } from "@justeattakeaway/pie-webc-core";
|
|
3
|
+
import { property as c, query as z, queryAssignedNodes as $, state as w } from "lit/decorators.js";
|
|
4
|
+
import { ifDefined as d } from "lit/directives/if-defined.js";
|
|
5
|
+
import { classMap as L } from "lit/directives/class-map.js";
|
|
6
|
+
import "@justeattakeaway/pie-icons-webc/dist/IconChevronDown.js";
|
|
7
|
+
const T = "*,*:after,*:before{box-sizing:inherit}.c-select{--select-padding-block: var(--dt-spacing-c);--select-padding-inline-start: var(--dt-spacing-d);--select-padding-inline-end: var(--dt-spacing-h);--select-background-color: var(--dt-color-container-default);--select-text-color: var(--dt-color-content-default);--select-border-color: var(--dt-color-border-form);--select-font-size: calc(var(--dt-font-body-l-size) * 1px);--select-line-height: calc(var(--dt-font-body-l-line-height) * 1px);--select-height: 48px;--select-cursor: pointer;position:relative;color:var(--select-text-color)}.c-select select{border:1px solid var(--select-border-color);border-radius:var(--dt-radius-rounded-c);padding-inline-start:var(--select-padding-inline-start);padding-inline-end:var(--select-padding-inline-end);padding-block-start:var(--select-padding-block);padding-block-end:var(--select-padding-block);font-size:var(--select-font-size);line-height:var(--select-line-height);background-color:var(--select-background-color);color:inherit;cursor:var(--select-cursor);outline:0;-webkit-appearance:none;-moz-appearance:none;appearance:none}.c-select select:focus-within{box-shadow:0 0 0 2px var(--dt-color-focus-inner),0 0 0 4px var(--dt-color-focus-outer);outline:none}.c-select.c-select--small{--select-padding-block: var(--dt-spacing-b);--select-height: 40px}.c-select.c-select--large{--select-padding-block: var(--dt-spacing-d);--select-height: 56px}.c-select.c-select--error{--select-border-color: var(--dt-color-support-error)}.c-select.c-select--withLeadingIcon{--select-padding-inline-start: calc(var(--dt-spacing-h) - var(--dt-spacing-a))}.c-select ::slotted([slot=leadingIcon]),.c-select .c-select-trailing-icon{position:absolute;top:50%;transform:translateY(-50%);pointer-events:none}.c-select:not(.is-disabled) ::slotted([slot=leadingIcon]),.c-select:not(.is-disabled) .c-select-trailing-icon{color:var(--dt-color-content-subdued)}.c-select ::slotted([slot=leadingIcon]){--icon-display-override: block;--icon-size-override: 24px;inset-inline-start:var(--dt-spacing-d)}.c-select .c-select-trailing-icon{inset-inline-end:var(--dt-spacing-d)}@media (hover: hover){.c-select:hover{--select-background-color: hsl(var(--dt-color-container-default-h), var(--dt-color-container-default-s), calc(var(--dt-color-container-default-l) + calc(-1 * var(--dt-color-hover-01))))}@supports (background-color: color-mix(in srgb,black,white)){.c-select:hover{--select-background-color: color-mix(in srgb, var(--dt-color-hover-01-bg) var(--dt-color-hover-01), var(--dt-color-container-default))}}}.c-select.is-disabled{--select-background-color: var(--dt-color-disabled-01);--select-border-color: var(--dt-color-disabled-01);--select-text-color: var(--dt-color-content-disabled);--select-cursor: auto}", _ = ["small", "medium", "large"], S = ["default", "error"], i = {
|
|
8
|
+
size: "medium",
|
|
9
|
+
status: "default",
|
|
10
|
+
disabled: !1
|
|
11
|
+
};
|
|
12
|
+
var C = Object.defineProperty, s = (u, a, o, n) => {
|
|
13
|
+
for (var t = void 0, r = u.length - 1, l; r >= 0; r--)
|
|
14
|
+
(l = u[r]) && (t = l(a, o, t) || t);
|
|
15
|
+
return t && C(a, o, t), t;
|
|
16
|
+
};
|
|
17
|
+
const v = "pie-select", g = "assistive-text", p = class p extends k(h) {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments), this.size = i.size, this.disabled = i.disabled, this.status = i.status, this._hasLeadingIcon = !1;
|
|
20
|
+
}
|
|
21
|
+
handleLeadingIconSlotchange() {
|
|
22
|
+
this._hasLeadingIcon = !!this._leadingIconNodes.length;
|
|
23
|
+
}
|
|
24
|
+
renderAssistiveText() {
|
|
25
|
+
return this.assistiveText ? b`
|
|
26
|
+
<pie-assistive-text
|
|
27
|
+
id="${g}"
|
|
28
|
+
variant=${d(this.status)}
|
|
29
|
+
data-test-id="pie-textarea-assistive-text">
|
|
30
|
+
${this.assistiveText}
|
|
31
|
+
</pie-assistive-text>
|
|
32
|
+
` : x;
|
|
33
|
+
}
|
|
34
|
+
render() {
|
|
35
|
+
const {
|
|
36
|
+
assistiveText: a,
|
|
37
|
+
disabled: o,
|
|
38
|
+
status: n,
|
|
39
|
+
size: t,
|
|
40
|
+
name: r,
|
|
41
|
+
_hasLeadingIcon: l
|
|
42
|
+
} = this, m = {
|
|
43
|
+
"c-select": !0,
|
|
44
|
+
[`c-select--${t}`]: !0,
|
|
45
|
+
[`c-select--${n}`]: !0,
|
|
46
|
+
"c-select--withLeadingIcon": l,
|
|
47
|
+
"is-disabled": o
|
|
48
|
+
};
|
|
49
|
+
return b`
|
|
50
|
+
<div
|
|
51
|
+
class="${L(m)}"
|
|
52
|
+
data-test-id="pie-select-shell">
|
|
53
|
+
<slot name="leadingIcon" @slotchange=${this.handleLeadingIconSlotchange}></slot>
|
|
54
|
+
<select
|
|
55
|
+
name=${d(r)}
|
|
56
|
+
?disabled=${o}
|
|
57
|
+
aria-describedby=${d(a ? g : void 0)}
|
|
58
|
+
aria-invalid=${n === "error" ? "true" : "false"}
|
|
59
|
+
aria-errormessage="${d(n === "error" ? g : void 0)}">
|
|
60
|
+
<option value="dog">Dog</option>
|
|
61
|
+
<option value="cat">Cat</option>
|
|
62
|
+
<option value="hamster">Hamster</option>
|
|
63
|
+
</select>
|
|
64
|
+
<icon-chevron-down size='s' class='c-select-trailing-icon'></icon-chevron-down>
|
|
65
|
+
</div>
|
|
66
|
+
${this.renderAssistiveText()}
|
|
67
|
+
`;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
p.shadowRootOptions = { ...h.shadowRootOptions, delegatesFocus: !0 }, p.styles = y(T);
|
|
71
|
+
let e = p;
|
|
72
|
+
s([
|
|
73
|
+
c({ type: String }),
|
|
74
|
+
f(v, _, i.size)
|
|
75
|
+
], e.prototype, "size");
|
|
76
|
+
s([
|
|
77
|
+
c({ type: Boolean })
|
|
78
|
+
], e.prototype, "disabled");
|
|
79
|
+
s([
|
|
80
|
+
c({ type: String }),
|
|
81
|
+
f(v, S, i.status)
|
|
82
|
+
], e.prototype, "status");
|
|
83
|
+
s([
|
|
84
|
+
c({ type: String })
|
|
85
|
+
], e.prototype, "assistiveText");
|
|
86
|
+
s([
|
|
87
|
+
c({ type: String })
|
|
88
|
+
], e.prototype, "name");
|
|
89
|
+
s([
|
|
90
|
+
z("select")
|
|
91
|
+
], e.prototype, "focusTarget");
|
|
92
|
+
s([
|
|
93
|
+
$({ slot: "leadingIcon", flatten: !0 })
|
|
94
|
+
], e.prototype, "_leadingIconNodes");
|
|
95
|
+
s([
|
|
96
|
+
w()
|
|
97
|
+
], e.prototype, "_hasLeadingIcon");
|
|
98
|
+
I(v, e);
|
|
99
|
+
export {
|
|
100
|
+
e as PieSelect,
|
|
101
|
+
i as defaultProps,
|
|
102
|
+
_ as sizes,
|
|
103
|
+
S as statusTypes
|
|
104
|
+
};
|
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ComponentDefaultProps } from '@justeattakeaway/pie-webc-core';
|
|
2
|
+
import type { CSSResult } from 'lit';
|
|
3
|
+
import type { GenericConstructor } from '@justeattakeaway/pie-webc-core';
|
|
4
|
+
import type { LitElement } from 'lit';
|
|
5
|
+
import type { nothing } from 'lit';
|
|
6
|
+
import * as React_2 from 'react';
|
|
7
|
+
import type { RTLInterface } from '@justeattakeaway/pie-webc-core';
|
|
8
|
+
import type { TemplateResult } from 'lit-html';
|
|
9
|
+
|
|
10
|
+
declare type DefaultProps = ComponentDefaultProps<SelectProps, keyof Omit<SelectProps, 'name' | 'assistiveText'>>;
|
|
11
|
+
|
|
12
|
+
export declare const defaultProps: DefaultProps;
|
|
13
|
+
|
|
14
|
+
export declare const PieSelect: React_2.ForwardRefExoticComponent<SelectProps & React_2.RefAttributes<PieSelect_2> & ReactBaseType>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @tagname pie-select
|
|
18
|
+
*/
|
|
19
|
+
declare class PieSelect_2 extends PieSelect_base implements SelectProps {
|
|
20
|
+
static shadowRootOptions: {
|
|
21
|
+
delegatesFocus: boolean;
|
|
22
|
+
mode: ShadowRootMode;
|
|
23
|
+
slotAssignment?: SlotAssignmentMode | undefined;
|
|
24
|
+
};
|
|
25
|
+
size: "small" | "medium" | "large";
|
|
26
|
+
disabled: boolean;
|
|
27
|
+
status: "default" | "error";
|
|
28
|
+
assistiveText: SelectProps['assistiveText'];
|
|
29
|
+
name: SelectProps['name'];
|
|
30
|
+
focusTarget: HTMLElement;
|
|
31
|
+
_leadingIconNodes: Array<Node>;
|
|
32
|
+
private _hasLeadingIcon;
|
|
33
|
+
private handleLeadingIconSlotchange;
|
|
34
|
+
renderAssistiveText(): typeof nothing | TemplateResult<1>;
|
|
35
|
+
render(): TemplateResult<1>;
|
|
36
|
+
static styles: CSSResult;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare const PieSelect_base: GenericConstructor<RTLInterface> & typeof LitElement;
|
|
40
|
+
|
|
41
|
+
declare type ReactBaseType = React_2.HTMLAttributes<HTMLSelectElement>;
|
|
42
|
+
|
|
43
|
+
export declare interface SelectProps {
|
|
44
|
+
/**
|
|
45
|
+
* The size of the select component. Can be `small`, `medium` or `large`. Defaults to `medium`.
|
|
46
|
+
*/
|
|
47
|
+
size?: typeof sizes[number];
|
|
48
|
+
/**
|
|
49
|
+
* Same as the HTML disabled attribute - indicates whether the select is disabled.
|
|
50
|
+
*/
|
|
51
|
+
disabled?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* An optional assistive text to display below the select element. Must be provided when the status is success or error.
|
|
54
|
+
*/
|
|
55
|
+
assistiveText?: string;
|
|
56
|
+
/**
|
|
57
|
+
* The status of the select component / assistive text. Can be default or error.
|
|
58
|
+
*/
|
|
59
|
+
status?: typeof statusTypes[number];
|
|
60
|
+
/**
|
|
61
|
+
* The name of the select (used as a key/value pair with `value`). This is required in order to work properly with forms.
|
|
62
|
+
*/
|
|
63
|
+
name?: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export declare const sizes: readonly ["small", "medium", "large"];
|
|
67
|
+
|
|
68
|
+
export declare const statusTypes: readonly ["default", "error"];
|
|
69
|
+
|
|
70
|
+
export { }
|
package/dist/react.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as e from "react";
|
|
2
|
+
import { createComponent as t } from "@lit/react";
|
|
3
|
+
import { PieSelect as s } from "./index.js";
|
|
4
|
+
import { defaultProps as l, sizes as p, statusTypes as n } from "./index.js";
|
|
5
|
+
const o = t({
|
|
6
|
+
displayName: "PieSelect",
|
|
7
|
+
elementClass: s,
|
|
8
|
+
react: e,
|
|
9
|
+
tagName: "pie-select",
|
|
10
|
+
events: {}
|
|
11
|
+
}), r = o;
|
|
12
|
+
export {
|
|
13
|
+
r as PieSelect,
|
|
14
|
+
l as defaultProps,
|
|
15
|
+
p as sizes,
|
|
16
|
+
n as statusTypes
|
|
17
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@justeattakeaway/pie-select",
|
|
3
|
+
"description": "PIE Design System Select built using Web Components",
|
|
4
|
+
"version": "0.0.0-snapshot-release-20250306125923",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"module": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"custom-elements.json",
|
|
11
|
+
"src",
|
|
12
|
+
"dist",
|
|
13
|
+
"**/*.d.ts"
|
|
14
|
+
],
|
|
15
|
+
"pieMetadata": {
|
|
16
|
+
"componentStatus": "alpha"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "run -T vite build",
|
|
20
|
+
"build:react-wrapper": "npx build-react-wrapper",
|
|
21
|
+
"create:manifest": "yarn cem analyze --litelement",
|
|
22
|
+
"lint:scripts": "run -T eslint .",
|
|
23
|
+
"lint:scripts:fix": "yarn lint:scripts --fix",
|
|
24
|
+
"lint:style": "run -T stylelint ./src/**/*.{css,scss}",
|
|
25
|
+
"lint:style:fix": "yarn lint:style --fix",
|
|
26
|
+
"watch": "run -T vite build --watch",
|
|
27
|
+
"test:browsers": "npx playwright test -c ./playwright-lit.config.ts",
|
|
28
|
+
"test:browsers:ci": "yarn test:browsers",
|
|
29
|
+
"test:visual": "run -T cross-env-shell PERCY_TOKEN=${PERCY_TOKEN_PIE_SELECT} percy exec --allowed-hostname cloudfront.net -- npx playwright test -c ./playwright-lit-visual.config.ts",
|
|
30
|
+
"test:visual:ci": "yarn test:visual"
|
|
31
|
+
},
|
|
32
|
+
"author": "Just Eat Takeaway.com - Design System Team",
|
|
33
|
+
"license": "Apache-2.0",
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@custom-elements-manifest/analyzer": "0.9.0",
|
|
36
|
+
"@justeattakeaway/pie-components-config": "0.18.0",
|
|
37
|
+
"@justeattakeaway/pie-css": "0.15.1",
|
|
38
|
+
"cem-plugin-module-file-extensions": "0.0.5"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@justeattakeaway/pie-webc-core": "0.24.2"
|
|
42
|
+
},
|
|
43
|
+
"volta": {
|
|
44
|
+
"extends": "../../../package.json"
|
|
45
|
+
},
|
|
46
|
+
"customElements": "custom-elements.json",
|
|
47
|
+
"sideEffects": [
|
|
48
|
+
"dist/*.js"
|
|
49
|
+
]
|
|
50
|
+
}
|
package/src/defs.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type ComponentDefaultProps } from '@justeattakeaway/pie-webc-core';
|
|
2
|
+
|
|
3
|
+
export const sizes = ['small', 'medium', 'large'] as const;
|
|
4
|
+
|
|
5
|
+
export const statusTypes = ['default', 'error'] as const;
|
|
6
|
+
|
|
7
|
+
export interface SelectProps {
|
|
8
|
+
/**
|
|
9
|
+
* The size of the select component. Can be `small`, `medium` or `large`. Defaults to `medium`.
|
|
10
|
+
*/
|
|
11
|
+
size?: typeof sizes[number];
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Same as the HTML disabled attribute - indicates whether the select is disabled.
|
|
15
|
+
*/
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* An optional assistive text to display below the select element. Must be provided when the status is success or error.
|
|
20
|
+
*/
|
|
21
|
+
assistiveText?: string;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The status of the select component / assistive text. Can be default or error.
|
|
25
|
+
*/
|
|
26
|
+
status?: typeof statusTypes[number];
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The name of the select (used as a key/value pair with `value`). This is required in order to work properly with forms.
|
|
30
|
+
*/
|
|
31
|
+
name?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
type DefaultProps = ComponentDefaultProps<SelectProps, keyof Omit<SelectProps, 'name' | 'assistiveText' >>;
|
|
35
|
+
|
|
36
|
+
export const defaultProps: DefaultProps = {
|
|
37
|
+
size: 'medium',
|
|
38
|
+
status: 'default',
|
|
39
|
+
disabled: false,
|
|
40
|
+
};
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LitElement,
|
|
3
|
+
html,
|
|
4
|
+
nothing,
|
|
5
|
+
unsafeCSS,
|
|
6
|
+
} from 'lit';
|
|
7
|
+
import {
|
|
8
|
+
RtlMixin,
|
|
9
|
+
defineCustomElement,
|
|
10
|
+
validPropertyValues,
|
|
11
|
+
} from '@justeattakeaway/pie-webc-core';
|
|
12
|
+
import {
|
|
13
|
+
property,
|
|
14
|
+
query,
|
|
15
|
+
queryAssignedNodes,
|
|
16
|
+
state,
|
|
17
|
+
} from 'lit/decorators.js';
|
|
18
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
19
|
+
import { classMap, type ClassInfo } from 'lit/directives/class-map.js';
|
|
20
|
+
import '@justeattakeaway/pie-icons-webc/dist/IconChevronDown.js';
|
|
21
|
+
|
|
22
|
+
import styles from './select.scss?inline';
|
|
23
|
+
import {
|
|
24
|
+
defaultProps,
|
|
25
|
+
sizes,
|
|
26
|
+
statusTypes,
|
|
27
|
+
type SelectProps,
|
|
28
|
+
} from './defs';
|
|
29
|
+
|
|
30
|
+
// Valid values available to consumers
|
|
31
|
+
export * from './defs';
|
|
32
|
+
|
|
33
|
+
const componentSelector = 'pie-select';
|
|
34
|
+
const assistiveTextIdValue = 'assistive-text';
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @tagname pie-select
|
|
38
|
+
*/
|
|
39
|
+
export class PieSelect extends RtlMixin(LitElement) implements SelectProps {
|
|
40
|
+
static shadowRootOptions = { ...LitElement.shadowRootOptions, delegatesFocus: true };
|
|
41
|
+
|
|
42
|
+
@property({ type: String })
|
|
43
|
+
@validPropertyValues(componentSelector, sizes, defaultProps.size)
|
|
44
|
+
public size = defaultProps.size;
|
|
45
|
+
|
|
46
|
+
@property({ type: Boolean })
|
|
47
|
+
public disabled = defaultProps.disabled;
|
|
48
|
+
|
|
49
|
+
@property({ type: String })
|
|
50
|
+
@validPropertyValues(componentSelector, statusTypes, defaultProps.status)
|
|
51
|
+
public status = defaultProps.status;
|
|
52
|
+
|
|
53
|
+
@property({ type: String })
|
|
54
|
+
public assistiveText: SelectProps['assistiveText'];
|
|
55
|
+
|
|
56
|
+
@property({ type: String })
|
|
57
|
+
public name: SelectProps['name'];
|
|
58
|
+
|
|
59
|
+
@query('select')
|
|
60
|
+
public focusTarget!: HTMLElement;
|
|
61
|
+
|
|
62
|
+
@queryAssignedNodes({ slot: 'leadingIcon', flatten: true }) _leadingIconNodes!: Array<Node>;
|
|
63
|
+
|
|
64
|
+
@state()
|
|
65
|
+
private _hasLeadingIcon = false;
|
|
66
|
+
|
|
67
|
+
private handleLeadingIconSlotchange () {
|
|
68
|
+
this._hasLeadingIcon = Boolean(this._leadingIconNodes.length);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
renderAssistiveText () {
|
|
72
|
+
if (!this.assistiveText) {
|
|
73
|
+
return nothing;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return html`
|
|
77
|
+
<pie-assistive-text
|
|
78
|
+
id="${assistiveTextIdValue}"
|
|
79
|
+
variant=${ifDefined(this.status)}
|
|
80
|
+
data-test-id="pie-textarea-assistive-text">
|
|
81
|
+
${this.assistiveText}
|
|
82
|
+
</pie-assistive-text>
|
|
83
|
+
`;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
render () {
|
|
87
|
+
const {
|
|
88
|
+
assistiveText,
|
|
89
|
+
disabled,
|
|
90
|
+
status,
|
|
91
|
+
size,
|
|
92
|
+
name,
|
|
93
|
+
_hasLeadingIcon,
|
|
94
|
+
} = this;
|
|
95
|
+
|
|
96
|
+
const classes : ClassInfo = {
|
|
97
|
+
'c-select': true,
|
|
98
|
+
[`c-select--${size}`]: true,
|
|
99
|
+
[`c-select--${status}`]: true,
|
|
100
|
+
'c-select--withLeadingIcon': _hasLeadingIcon,
|
|
101
|
+
'is-disabled': disabled,
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
return html`
|
|
105
|
+
<div
|
|
106
|
+
class="${classMap(classes)}"
|
|
107
|
+
data-test-id="pie-select-shell">
|
|
108
|
+
<slot name="leadingIcon" @slotchange=${this.handleLeadingIconSlotchange}></slot>
|
|
109
|
+
<select
|
|
110
|
+
name=${ifDefined(name)}
|
|
111
|
+
?disabled=${disabled}
|
|
112
|
+
aria-describedby=${ifDefined(assistiveText ? assistiveTextIdValue : undefined)}
|
|
113
|
+
aria-invalid=${status === 'error' ? 'true' : 'false'}
|
|
114
|
+
aria-errormessage="${ifDefined(status === 'error' ? assistiveTextIdValue : undefined)}">
|
|
115
|
+
<option value="dog">Dog</option>
|
|
116
|
+
<option value="cat">Cat</option>
|
|
117
|
+
<option value="hamster">Hamster</option>
|
|
118
|
+
</select>
|
|
119
|
+
<icon-chevron-down size='s' class='c-select-trailing-icon'></icon-chevron-down>
|
|
120
|
+
</div>
|
|
121
|
+
${this.renderAssistiveText()}
|
|
122
|
+
`;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Renders a `CSSResult` generated from SCSS by Vite
|
|
126
|
+
static styles = unsafeCSS(styles);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
defineCustomElement(componentSelector, PieSelect);
|
|
130
|
+
|
|
131
|
+
declare global {
|
|
132
|
+
interface HTMLElementTagNameMap {
|
|
133
|
+
[componentSelector]: PieSelect;
|
|
134
|
+
}
|
|
135
|
+
}
|
package/src/react.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { createComponent } from '@lit/react';
|
|
3
|
+
import { PieSelect as PieSelectLit } from './index';
|
|
4
|
+
import { type SelectProps } from './defs';
|
|
5
|
+
|
|
6
|
+
export * from './defs';
|
|
7
|
+
|
|
8
|
+
const PieSelectReact = createComponent({
|
|
9
|
+
displayName: 'PieSelect',
|
|
10
|
+
elementClass: PieSelectLit,
|
|
11
|
+
react: React,
|
|
12
|
+
tagName: 'pie-select',
|
|
13
|
+
events: {},
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
type ReactBaseType = React.HTMLAttributes<HTMLSelectElement>
|
|
17
|
+
|
|
18
|
+
export const PieSelect = PieSelectReact as React.ForwardRefExoticComponent<React.PropsWithoutRef<SelectProps>
|
|
19
|
+
& React.RefAttributes<PieSelectLit> & ReactBaseType>;
|
package/src/select.scss
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
@use '@justeattakeaway/pie-css/scss' as p;
|
|
2
|
+
|
|
3
|
+
.c-select {
|
|
4
|
+
--select-padding-block: var(--dt-spacing-c);
|
|
5
|
+
--select-padding-inline-start: var(--dt-spacing-d);
|
|
6
|
+
--select-padding-inline-end: var(--dt-spacing-h);
|
|
7
|
+
--select-background-color: var(--dt-color-container-default);
|
|
8
|
+
--select-text-color: var(--dt-color-content-default);
|
|
9
|
+
--select-border-color: var(--dt-color-border-form);
|
|
10
|
+
--select-font-size: #{p.font-size(--dt-font-body-l-size)};
|
|
11
|
+
--select-line-height: #{p.font-size(--dt-font-body-l-line-height)};
|
|
12
|
+
--select-height: 48px;
|
|
13
|
+
--select-cursor: pointer;
|
|
14
|
+
|
|
15
|
+
position: relative;
|
|
16
|
+
color: var(--select-text-color);
|
|
17
|
+
|
|
18
|
+
select {
|
|
19
|
+
border: 1px solid var(--select-border-color);
|
|
20
|
+
border-radius: var(--dt-radius-rounded-c);
|
|
21
|
+
padding-inline-start: var(--select-padding-inline-start);
|
|
22
|
+
padding-inline-end: var(--select-padding-inline-end);
|
|
23
|
+
padding-block-start: var(--select-padding-block);
|
|
24
|
+
padding-block-end: var(--select-padding-block);
|
|
25
|
+
font-size: var(--select-font-size);
|
|
26
|
+
line-height: var(--select-line-height);
|
|
27
|
+
background-color: var(--select-background-color);
|
|
28
|
+
color: inherit;
|
|
29
|
+
cursor: var(--select-cursor);
|
|
30
|
+
outline: 0;
|
|
31
|
+
-webkit-appearance: none;
|
|
32
|
+
-moz-appearance: none;
|
|
33
|
+
appearance: none;
|
|
34
|
+
|
|
35
|
+
&:focus-within {
|
|
36
|
+
@include p.focus;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&.c-select--small {
|
|
41
|
+
--select-padding-block: var(--dt-spacing-b);
|
|
42
|
+
--select-height: 40px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&.c-select--large {
|
|
46
|
+
--select-padding-block: var(--dt-spacing-d);
|
|
47
|
+
--select-height: 56px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&.c-select--error {
|
|
51
|
+
--select-border-color: var(--dt-color-support-error);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&.c-select--withLeadingIcon {
|
|
55
|
+
--select-padding-inline-start: calc(var(--dt-spacing-h) - var(--dt-spacing-a));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
::slotted([slot="leadingIcon"]),
|
|
59
|
+
.c-select-trailing-icon {
|
|
60
|
+
position: absolute;
|
|
61
|
+
top: 50%;
|
|
62
|
+
transform: translateY(-50%);
|
|
63
|
+
pointer-events: none;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&:not(.is-disabled) ::slotted([slot="leadingIcon"]),
|
|
67
|
+
&:not(.is-disabled) .c-select-trailing-icon {
|
|
68
|
+
color: var(--dt-color-content-subdued);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
::slotted([slot="leadingIcon"]) {
|
|
72
|
+
--icon-display-override: block;
|
|
73
|
+
--icon-size-override: 24px;
|
|
74
|
+
inset-inline-start: var(--dt-spacing-d);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.c-select-trailing-icon {
|
|
78
|
+
inset-inline-end: var(--dt-spacing-d);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@media (hover: hover) {
|
|
82
|
+
&:hover {
|
|
83
|
+
--select-background-color: hsl(var(--dt-color-container-default-h), var(--dt-color-container-default-s), calc(var(--dt-color-container-default-l) + calc(-1 * var(--dt-color-hover-01))));
|
|
84
|
+
|
|
85
|
+
@supports (background-color: color-mix(in srgb, black, white)) {
|
|
86
|
+
--select-background-color: color-mix(in srgb, var(--dt-color-hover-01-bg) var(--dt-color-hover-01), var(--dt-color-container-default));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&.is-disabled {
|
|
92
|
+
--select-background-color: var(--dt-color-disabled-01);
|
|
93
|
+
--select-border-color: var(--dt-color-disabled-01);
|
|
94
|
+
--select-text-color: var(--dt-color-content-disabled);
|
|
95
|
+
--select-cursor: auto;
|
|
96
|
+
}
|
|
97
|
+
}
|