@daikin-oss/design-system-web-components 0.0.0 → 0.2.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/README.md +145 -88
- package/dist/cjs/colors.cjs +80 -0
- package/{lib → dist/cjs}/colors.d.ts +0 -1
- package/dist/cjs/components/button/daikin-button.cjs +197 -0
- package/dist/cjs/components/button/daikin-button.d.ts +59 -0
- package/dist/cjs/components/button/index.d.ts +1 -0
- package/dist/cjs/components/checkbox/daikin-checkbox.cjs +183 -0
- package/dist/cjs/components/checkbox/daikin-checkbox.d.ts +68 -0
- package/dist/cjs/components/checkbox/index.d.ts +1 -0
- package/dist/cjs/components/index.d.ts +7 -0
- package/dist/cjs/components/input-group/daikin-input-group.cjs +119 -0
- package/dist/cjs/components/input-group/daikin-input-group.d.ts +47 -0
- package/dist/cjs/components/input-group/index.d.ts +1 -0
- package/dist/cjs/components/notification/daikin-notification.cjs +209 -0
- package/dist/cjs/components/notification/daikin-notification.d.ts +62 -0
- package/dist/cjs/components/notification/index.d.ts +1 -0
- package/dist/cjs/components/radio/daikin-radio.cjs +150 -0
- package/dist/cjs/components/radio/daikin-radio.d.ts +66 -0
- package/dist/cjs/components/radio/index.d.ts +1 -0
- package/dist/cjs/components/text-input/daikin-text-input.cjs +137 -0
- package/dist/cjs/components/text-input/daikin-text-input.d.ts +54 -0
- package/dist/cjs/components/text-input/index.d.ts +1 -0
- package/dist/cjs/components/textarea/daikin-textarea.cjs +168 -0
- package/dist/cjs/components/textarea/daikin-textarea.d.ts +56 -0
- package/dist/cjs/components/textarea/index.d.ts +1 -0
- package/dist/cjs/constants/events.cjs +4 -0
- package/dist/cjs/constants/events.d.ts +1 -0
- package/dist/cjs/index.cjs +39 -0
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/lit-analyzer-types.d.ts +112 -0
- package/dist/cjs/tailwind.css.cjs +6 -0
- package/dist/cjs/type-utils.d.ts +25 -0
- package/dist/{colors.d.ts → es/colors.d.ts} +0 -1
- package/dist/es/colors.js +80 -0
- package/dist/es/components/button/daikin-button.d.ts +59 -0
- package/dist/es/components/button/daikin-button.js +198 -0
- package/dist/es/components/button/index.d.ts +1 -0
- package/dist/es/components/checkbox/daikin-checkbox.d.ts +68 -0
- package/dist/es/components/checkbox/daikin-checkbox.js +184 -0
- package/dist/es/components/checkbox/index.d.ts +1 -0
- package/dist/es/components/index.d.ts +7 -0
- package/dist/es/components/input-group/daikin-input-group.d.ts +47 -0
- package/dist/es/components/input-group/daikin-input-group.js +120 -0
- package/dist/es/components/input-group/index.d.ts +1 -0
- package/dist/es/components/notification/daikin-notification.d.ts +62 -0
- package/dist/es/components/notification/daikin-notification.js +210 -0
- package/dist/es/components/notification/index.d.ts +1 -0
- package/dist/es/components/radio/daikin-radio.d.ts +66 -0
- package/dist/es/components/radio/daikin-radio.js +151 -0
- package/dist/es/components/radio/index.d.ts +1 -0
- package/dist/es/components/text-input/daikin-text-input.d.ts +54 -0
- package/dist/es/components/text-input/daikin-text-input.js +138 -0
- package/dist/es/components/text-input/index.d.ts +1 -0
- package/dist/es/components/textarea/daikin-textarea.d.ts +56 -0
- package/dist/es/components/textarea/daikin-textarea.js +169 -0
- package/dist/es/components/textarea/index.d.ts +1 -0
- package/dist/es/constants/events.d.ts +1 -0
- package/dist/es/constants/events.js +4 -0
- package/dist/es/index.d.ts +3 -0
- package/dist/es/index.js +18 -0
- package/dist/es/lit-analyzer-types.d.ts +112 -0
- package/dist/es/tailwind.css.js +6 -0
- package/dist/es/type-utils.d.ts +25 -0
- package/icons/checkbox-checked.svg +4 -0
- package/icons/checkbox-indeterminate.svg +3 -0
- package/icons/input-group-error.svg +11 -0
- package/icons/notification-close.svg +5 -0
- package/icons/notification-status-alarm.svg +5 -0
- package/icons/notification-status-information.svg +5 -0
- package/icons/notification-status-negative.svg +3 -0
- package/icons/notification-status-positive.svg +5 -0
- package/icons/notification-status-warning.svg +5 -0
- package/icons/radio-checked.svg +4 -0
- package/icons/radio-unchecked.svg +4 -0
- package/package.json +116 -82
- package/dist/_virtual/_tslib.js +0 -31
- package/dist/_virtual/_tslib.js.map +0 -1
- package/dist/colors.d.ts.map +0 -1
- package/dist/colors.js +0 -81
- package/dist/colors.js.map +0 -1
- package/dist/components/button/button.css.js +0 -7
- package/dist/components/button/button.css.js.map +0 -1
- package/dist/components/button/daikin-button.d.ts +0 -28
- package/dist/components/button/daikin-button.d.ts.map +0 -1
- package/dist/components/button/daikin-button.js +0 -125
- package/dist/components/button/daikin-button.js.map +0 -1
- package/dist/components/button/index.d.ts +0 -2
- package/dist/components/button/index.d.ts.map +0 -1
- package/dist/components/button/index.js +0 -2
- package/dist/components/button/index.js.map +0 -1
- package/dist/components/button/stories/common.d.ts +0 -15
- package/dist/components/button/stories/common.d.ts.map +0 -1
- package/dist/components/index.d.ts +0 -2
- package/dist/components/index.d.ts.map +0 -1
- package/dist/components/index.js +0 -2
- package/dist/components/index.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -3
- package/dist/index.js.map +0 -1
- package/dist/node_modules/@daikinlab/dds-tokens/build/js/DKN/Light/variables.js +0 -66
- package/dist/node_modules/@daikinlab/dds-tokens/build/js/DKN/Light/variables.js.map +0 -1
- package/dist/node_modules/@lit/reactive-element/node/css-tag.js +0 -9
- package/dist/node_modules/@lit/reactive-element/node/css-tag.js.map +0 -1
- package/dist/node_modules/@lit/reactive-element/node/decorators/custom-element.js +0 -9
- package/dist/node_modules/@lit/reactive-element/node/decorators/custom-element.js.map +0 -1
- package/dist/node_modules/@lit/reactive-element/node/decorators/property.js +0 -9
- package/dist/node_modules/@lit/reactive-element/node/decorators/property.js.map +0 -1
- package/dist/node_modules/@lit/reactive-element/node/decorators/query-assigned-elements.js +0 -6
- package/dist/node_modules/@lit/reactive-element/node/decorators/query-assigned-elements.js.map +0 -1
- package/dist/node_modules/@lit/reactive-element/node/reactive-element.js +0 -12
- package/dist/node_modules/@lit/reactive-element/node/reactive-element.js.map +0 -1
- package/dist/node_modules/@lit-labs/ssr-dom-shim/index.js +0 -122
- package/dist/node_modules/@lit-labs/ssr-dom-shim/index.js.map +0 -1
- package/dist/node_modules/@lit-labs/ssr-dom-shim/lib/element-internals.js +0 -85
- package/dist/node_modules/@lit-labs/ssr-dom-shim/lib/element-internals.js.map +0 -1
- package/dist/node_modules/@netlify/classnames-template-literals/dist/classnames-template-literals.esm.js +0 -13
- package/dist/node_modules/@netlify/classnames-template-literals/dist/classnames-template-literals.esm.js.map +0 -1
- package/dist/node_modules/lit-element/lit-element.js +0 -13
- package/dist/node_modules/lit-element/lit-element.js.map +0 -1
- package/dist/node_modules/lit-html/node/lit-html.js +0 -9
- package/dist/node_modules/lit-html/node/lit-html.js.map +0 -1
- package/dist/node_modules/style-inject/dist/style-inject.es.js +0 -29
- package/dist/node_modules/style-inject/dist/style-inject.es.js.map +0 -1
- package/dist/tailwind.css.js +0 -7
- package/dist/tailwind.css.js.map +0 -1
- package/lib/_virtual/_tslib.js +0 -33
- package/lib/_virtual/_tslib.js.map +0 -1
- package/lib/colors.d.ts.map +0 -1
- package/lib/colors.js +0 -83
- package/lib/colors.js.map +0 -1
- package/lib/components/button/button.css.js +0 -9
- package/lib/components/button/button.css.js.map +0 -1
- package/lib/components/button/daikin-button.d.ts +0 -28
- package/lib/components/button/daikin-button.d.ts.map +0 -1
- package/lib/components/button/daikin-button.js +0 -127
- package/lib/components/button/daikin-button.js.map +0 -1
- package/lib/components/button/index.d.ts +0 -2
- package/lib/components/button/index.d.ts.map +0 -1
- package/lib/components/button/index.js +0 -5
- package/lib/components/button/index.js.map +0 -1
- package/lib/components/button/stories/common.d.ts +0 -15
- package/lib/components/button/stories/common.d.ts.map +0 -1
- package/lib/components/index.d.ts +0 -2
- package/lib/components/index.d.ts.map +0 -1
- package/lib/components/index.js +0 -5
- package/lib/components/index.js.map +0 -1
- package/lib/index.d.ts +0 -3
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -9
- package/lib/index.js.map +0 -1
- package/lib/node_modules/@daikinlab/dds-tokens/build/js/DKN/Light/variables.js +0 -125
- package/lib/node_modules/@daikinlab/dds-tokens/build/js/DKN/Light/variables.js.map +0 -1
- package/lib/node_modules/@lit/reactive-element/node/css-tag.js +0 -16
- package/lib/node_modules/@lit/reactive-element/node/css-tag.js.map +0 -1
- package/lib/node_modules/@lit/reactive-element/node/decorators/custom-element.js +0 -11
- package/lib/node_modules/@lit/reactive-element/node/decorators/custom-element.js.map +0 -1
- package/lib/node_modules/@lit/reactive-element/node/decorators/property.js +0 -11
- package/lib/node_modules/@lit/reactive-element/node/decorators/property.js.map +0 -1
- package/lib/node_modules/@lit/reactive-element/node/decorators/query-assigned-elements.js +0 -8
- package/lib/node_modules/@lit/reactive-element/node/decorators/query-assigned-elements.js.map +0 -1
- package/lib/node_modules/@lit/reactive-element/node/reactive-element.js +0 -21
- package/lib/node_modules/@lit/reactive-element/node/reactive-element.js.map +0 -1
- package/lib/node_modules/@lit-labs/ssr-dom-shim/index.js +0 -126
- package/lib/node_modules/@lit-labs/ssr-dom-shim/index.js.map +0 -1
- package/lib/node_modules/@lit-labs/ssr-dom-shim/lib/element-internals.js +0 -87
- package/lib/node_modules/@lit-labs/ssr-dom-shim/lib/element-internals.js.map +0 -1
- package/lib/node_modules/@netlify/classnames-template-literals/dist/classnames-template-literals.esm.js +0 -15
- package/lib/node_modules/@netlify/classnames-template-literals/dist/classnames-template-literals.esm.js.map +0 -1
- package/lib/node_modules/lit-element/lit-element.js +0 -20
- package/lib/node_modules/lit-element/lit-element.js.map +0 -1
- package/lib/node_modules/lit-html/node/lit-html.js +0 -14
- package/lib/node_modules/lit-html/node/lit-html.js.map +0 -1
- package/lib/node_modules/style-inject/dist/style-inject.es.js +0 -31
- package/lib/node_modules/style-inject/dist/style-inject.es.js.map +0 -1
- package/lib/tailwind.css.js +0 -9
- package/lib/tailwind.css.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,157 +1,214 @@
|
|
|
1
1
|
# Daikin Design System - Web Components
|
|
2
2
|
|
|
3
|
-
This project is an implementation of the Daikin Design Kit using
|
|
3
|
+
This project is an implementation of the Daikin Design Kit using Web Components.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
---
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
Start by installing the package:
|
|
8
10
|
|
|
9
11
|
```bash
|
|
10
|
-
npm i
|
|
12
|
+
npm i @daikin-oss/design-system-web-components
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
You can then import necessary components in your bundle:
|
|
16
|
+
|
|
17
|
+
```javascript
|
|
18
|
+
import "@daikin-oss/design-system-web-components/dist/components/button/index.js";
|
|
11
19
|
```
|
|
12
20
|
|
|
13
|
-
|
|
21
|
+
By default, out-of-the-box, the styles are for Daikin brand in light mode.
|
|
14
22
|
|
|
15
|
-
|
|
16
|
-
Tailwind classes are also purged.
|
|
23
|
+
### Dark Mode and Brands/Themes
|
|
17
24
|
|
|
18
|
-
|
|
25
|
+
_Due to the encapsulation of styles by the Web Components specification, how themes are applied may change in the future._
|
|
26
|
+
|
|
27
|
+
For dark-mode support and non-daikin brands, you need to add the `tokens` package and include the CSS reference in your html:
|
|
19
28
|
|
|
20
29
|
```bash
|
|
21
|
-
npm
|
|
30
|
+
npm install '@daikin-oss/dds-tokens
|
|
22
31
|
```
|
|
23
32
|
|
|
24
|
-
|
|
33
|
+
#### Dark Mode
|
|
25
34
|
|
|
26
|
-
|
|
35
|
+
Reference the CSS in HTML:
|
|
36
|
+
|
|
37
|
+
```html
|
|
38
|
+
<link
|
|
39
|
+
rel="stylesheet"
|
|
40
|
+
href="node_modules/@daikin-oss/dds-tokens/build/css/DKN/Dark/buttons.css"
|
|
41
|
+
media="(prefers-color-scheme: dark)"
|
|
42
|
+
/>
|
|
43
|
+
```
|
|
27
44
|
|
|
28
|
-
|
|
45
|
+
Using CSS `@import` with `prefers-color-scheme`:
|
|
29
46
|
|
|
30
|
-
```
|
|
31
|
-
|
|
47
|
+
```css
|
|
48
|
+
@import "@daikin-oss/dds-tokens/css/daikin/Dark/buttons.css"
|
|
49
|
+
(prefers-color-scheme: dark);
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
#### Other brands/themes
|
|
53
|
+
|
|
54
|
+
Reference the CSS in HTML:
|
|
55
|
+
|
|
56
|
+
```html
|
|
57
|
+
<link
|
|
58
|
+
rel="stylesheet"
|
|
59
|
+
href="node_modules/@daikin-oss/dds-tokens/build/css/AAF/Dark/buttons.css"
|
|
60
|
+
media="(prefers-color-scheme: light)"
|
|
61
|
+
/>
|
|
62
|
+
<link
|
|
63
|
+
rel="stylesheet"
|
|
64
|
+
href="node_modules/@daikin-oss/dds-tokens/build/css/AAF/Dark/buttons.css"
|
|
65
|
+
media="(prefers-color-scheme: dark)"
|
|
66
|
+
/>
|
|
32
67
|
```
|
|
33
68
|
|
|
34
|
-
|
|
69
|
+
Using CSS `@import` with `prefers-color-scheme`:
|
|
35
70
|
|
|
36
|
-
```
|
|
37
|
-
|
|
71
|
+
```css
|
|
72
|
+
@import "@daikin-oss/dds-tokens/css/aaf/Light/buttons.css"
|
|
73
|
+
(prefers-color-scheme: light);
|
|
74
|
+
@import "@daikin-oss/dds-tokens/css/aaf/Dark/buttons.css"
|
|
75
|
+
(prefers-color-scheme: dark);
|
|
38
76
|
```
|
|
39
77
|
|
|
40
|
-
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Contribution
|
|
41
81
|
|
|
42
|
-
|
|
82
|
+
The following are instructions for package contributors.
|
|
43
83
|
|
|
44
|
-
|
|
84
|
+
### Setup
|
|
85
|
+
|
|
86
|
+
Clone and install dependencies:
|
|
45
87
|
|
|
46
88
|
```bash
|
|
47
|
-
|
|
89
|
+
git clone https://github.com/dsv-rp/DDS.git
|
|
90
|
+
cd DDS
|
|
91
|
+
|
|
92
|
+
# install dependencies
|
|
93
|
+
npm i
|
|
94
|
+
|
|
95
|
+
# install Playwright browsers
|
|
96
|
+
npx playwright install
|
|
48
97
|
```
|
|
49
98
|
|
|
50
|
-
|
|
99
|
+
### Build
|
|
51
100
|
|
|
52
|
-
|
|
53
|
-
Currently, web components has full support in most major frameworks [except for React](https://custom-elements-everywhere.com/).
|
|
54
|
-
As such, we test both web components by themselves, and also test when imported by React:
|
|
101
|
+
To build files for production:
|
|
55
102
|
|
|
56
103
|
```bash
|
|
57
|
-
npm run
|
|
104
|
+
npm run build
|
|
58
105
|
```
|
|
59
106
|
|
|
60
|
-
|
|
107
|
+
Vite is used to transform TypeScript code into JavaScript that runs in modern browsers.
|
|
61
108
|
|
|
62
|
-
|
|
109
|
+
The built files are written to `/dist`.
|
|
63
110
|
|
|
64
|
-
|
|
111
|
+
### Documentation
|
|
65
112
|
|
|
66
|
-
|
|
67
|
-
import {
|
|
68
|
-
buttonColorBackgroundPrimaryActive
|
|
69
|
-
} from '@daikinlab/dds-tokens/js/daikin/Light/variables.js';
|
|
113
|
+
Storybook is used to document design system components/tools/examples.
|
|
70
114
|
|
|
71
|
-
|
|
72
|
-
static styles = css`
|
|
73
|
-
:host {
|
|
74
|
-
--defaultButtonColorBackgroundPrimaryActive: ${unsafeCSS(
|
|
75
|
-
buttonColorBackgroundPrimaryActive
|
|
76
|
-
)};
|
|
77
|
-
}
|
|
78
|
-
`;
|
|
79
|
-
|
|
80
|
-
...rest of the code
|
|
81
|
-
}
|
|
82
|
-
```
|
|
115
|
+
To run in development mode:
|
|
83
116
|
|
|
84
|
-
|
|
117
|
+
```bash
|
|
118
|
+
# Web Components version
|
|
119
|
+
npm run storybook
|
|
85
120
|
|
|
86
|
-
|
|
87
|
-
|
|
121
|
+
# or React version
|
|
122
|
+
npm run storybook:react
|
|
88
123
|
```
|
|
89
124
|
|
|
90
|
-
|
|
125
|
+
To produce distributable files in `/storybook-static/web-components` and `/storybook-static/react` folder:
|
|
91
126
|
|
|
92
|
-
|
|
127
|
+
```bash
|
|
128
|
+
npm run build-storybook
|
|
129
|
+
```
|
|
93
130
|
|
|
94
|
-
|
|
131
|
+
### Testing
|
|
95
132
|
|
|
96
|
-
|
|
97
|
-
npm install '@daikinlab/dds-tokens
|
|
98
|
-
```
|
|
133
|
+
There are currently two test suites: VRT (Visual Regression Test) and Interaction Test.
|
|
99
134
|
|
|
100
|
-
|
|
135
|
+
Visual regression testing, placed in `*.visual.test.ts`, is done by Playwright running in a container.
|
|
136
|
+
To eliminate rendering differences between environments, the browser which takes the screenshots must run on a container.
|
|
101
137
|
|
|
102
|
-
|
|
138
|
+
Currently, Web Components has full support in most major frameworks [except for React](https://custom-elements-everywhere.com/).
|
|
139
|
+
As such, we test both Web Components by themselves, and also test when imported by React:
|
|
103
140
|
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
|
|
141
|
+
```bash
|
|
142
|
+
# start a container for running the browsers
|
|
143
|
+
docker compose up -d
|
|
107
144
|
|
|
108
|
-
|
|
145
|
+
# run VRT for Web Components and React versions
|
|
146
|
+
npm run test:visual
|
|
109
147
|
|
|
148
|
+
# stop the container
|
|
149
|
+
docker compose down
|
|
110
150
|
```
|
|
111
|
-
@import '@daikinlab/dds-tokens/css/daikin/Dark/buttons.css'
|
|
112
|
-
(prefers-color-scheme: dark);
|
|
113
151
|
|
|
114
|
-
|
|
152
|
+
For Podman users, use `podman-compose -f compose.podman.yaml` or `podman compose -f compose.podman.yaml` instead of `docker compose`.
|
|
115
153
|
|
|
116
|
-
|
|
154
|
+
To update snapshots, use `npm run test:visual-update`
|
|
117
155
|
|
|
118
|
-
|
|
156
|
+
---
|
|
119
157
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
158
|
+
Interaction testing, placed in `*.stories.ts`, is performed by Storybook, which also uses Playwright internally.
|
|
159
|
+
Interaction tests do not use containers since rendering differences between environments do not matter.
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
npm run test:interaction
|
|
123
163
|
```
|
|
124
164
|
|
|
125
|
-
|
|
165
|
+
### Linting and Type checking
|
|
126
166
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
167
|
+
Linting is performed by ESLint for general linting of JavaScript and TypeScript, and [lit-analyzer](https://www.npmjs.com/package/lit-analyzer) to type check bindings in lit-html templates.
|
|
168
|
+
[cSpell](https://cspell.org/) is used for spell checking.
|
|
169
|
+
[ls-lint](https://ls-lint.org/) is also used to ensure that consistent filenames are used.
|
|
170
|
+
|
|
171
|
+
To lint the project, run:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
npm run lint
|
|
175
|
+
npx tsc -b
|
|
132
176
|
```
|
|
133
177
|
|
|
134
|
-
|
|
178
|
+
If you encounter an `Unknown word` error, add the word to the `cspell-dictionary.txt`.
|
|
135
179
|
|
|
136
|
-
|
|
180
|
+
### Design Tokens
|
|
137
181
|
|
|
138
|
-
|
|
182
|
+
_We are looking for a more efficient way to import tokens._
|
|
139
183
|
|
|
140
|
-
|
|
184
|
+
1. **Source of Truth**: The `tokens` we use is the foundation of our design styles and was grabbed from https://github.com/dsv-rp/dds-tokens/tree/main.
|
|
141
185
|
|
|
142
|
-
|
|
186
|
+
2. **Using in Components**: For the most part, we use the js variables to apply as the default style:
|
|
187
|
+
|
|
188
|
+
```javascript
|
|
189
|
+
import {
|
|
190
|
+
buttonColorBackgroundPrimaryActive
|
|
191
|
+
} from '@daikin-oss/dds-tokens/js/daikin/Light/variables.js';
|
|
143
192
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
|
|
193
|
+
class DaikinButton extends LitElement implements DaikinButtonProps {
|
|
194
|
+
static styles = css`
|
|
195
|
+
:host {
|
|
196
|
+
--defaultButtonColorBackgroundPrimaryActive: ${unsafeCSS(
|
|
197
|
+
buttonColorBackgroundPrimaryActive
|
|
198
|
+
)};
|
|
199
|
+
}
|
|
200
|
+
`;
|
|
201
|
+
|
|
202
|
+
/* ...rest of the code */
|
|
152
203
|
}
|
|
153
204
|
```
|
|
154
205
|
|
|
155
|
-
|
|
206
|
+
### TailwindCSS
|
|
207
|
+
|
|
208
|
+
There is a custom `daikinPlugin` managed [here](https://github.com/dsv-rp/tailwind).
|
|
209
|
+
|
|
210
|
+
### Developing with VSCode
|
|
211
|
+
|
|
212
|
+
This project provides recommended extensions and workspace settings for VSCode.
|
|
156
213
|
|
|
157
214
|
References [Daikin Design Kit](https://www.figma.com/file/VyaaU8Ta9yzyf0PsURWSSf/DDS%3A-Design-Kit?node-id=2421%3A7943)
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const variables_js = require("@daikin-oss/dds-tokens/js/daikin/Light/variables.js");
|
|
4
|
+
const DAIKIN_PRIMARY_BLUE = variables_js.colorBrandPrimary;
|
|
5
|
+
const DAIKIN_SECONDARY_BLUE = variables_js.colorBlue40;
|
|
6
|
+
const DAIKIN_DARK_GREY = variables_js.colorGrey90;
|
|
7
|
+
const DAIKIN_MEDIUM_GREY = variables_js.colorGrey70;
|
|
8
|
+
const DAIKIN_NEGATIVE = variables_js.colorRed60;
|
|
9
|
+
const DAIKIN_WARNING = variables_js.colorYellow50;
|
|
10
|
+
const DAIKIN_POSITIVE = variables_js.colorGreen60;
|
|
11
|
+
const colors = {
|
|
12
|
+
daikinBlue: {
|
|
13
|
+
50: variables_js.colorBlue10,
|
|
14
|
+
100: variables_js.colorBlue20,
|
|
15
|
+
200: variables_js.colorBlue30,
|
|
16
|
+
300: DAIKIN_SECONDARY_BLUE,
|
|
17
|
+
400: variables_js.colorBlue50,
|
|
18
|
+
500: DAIKIN_PRIMARY_BLUE,
|
|
19
|
+
600: variables_js.colorBlue70,
|
|
20
|
+
700: variables_js.colorBlue80,
|
|
21
|
+
800: variables_js.colorBlue90,
|
|
22
|
+
900: variables_js.colorBlue100,
|
|
23
|
+
DEFAULT: DAIKIN_PRIMARY_BLUE
|
|
24
|
+
},
|
|
25
|
+
daikinNeutral: {
|
|
26
|
+
50: variables_js.colorGrey10,
|
|
27
|
+
100: variables_js.colorGrey20,
|
|
28
|
+
200: variables_js.colorGrey30,
|
|
29
|
+
300: variables_js.colorGrey40,
|
|
30
|
+
400: variables_js.colorGrey50,
|
|
31
|
+
500: variables_js.colorGrey60,
|
|
32
|
+
600: DAIKIN_MEDIUM_GREY,
|
|
33
|
+
700: variables_js.colorGrey80,
|
|
34
|
+
800: DAIKIN_DARK_GREY,
|
|
35
|
+
900: variables_js.colorGrey100
|
|
36
|
+
},
|
|
37
|
+
daikinRed: {
|
|
38
|
+
50: variables_js.colorRed10,
|
|
39
|
+
100: variables_js.colorRed20,
|
|
40
|
+
200: variables_js.colorRed30,
|
|
41
|
+
300: variables_js.colorRed40,
|
|
42
|
+
400: variables_js.colorRed50,
|
|
43
|
+
500: DAIKIN_NEGATIVE,
|
|
44
|
+
600: variables_js.colorRed70,
|
|
45
|
+
700: variables_js.colorRed80,
|
|
46
|
+
800: variables_js.colorRed90,
|
|
47
|
+
900: variables_js.colorRed100,
|
|
48
|
+
1e3: variables_js.colorRed110,
|
|
49
|
+
DEFAULT: DAIKIN_NEGATIVE
|
|
50
|
+
},
|
|
51
|
+
daikinYellow: {
|
|
52
|
+
50: variables_js.colorYellow10,
|
|
53
|
+
100: variables_js.colorYellow20,
|
|
54
|
+
200: variables_js.colorYellow30,
|
|
55
|
+
300: variables_js.colorYellow40,
|
|
56
|
+
400: DAIKIN_WARNING,
|
|
57
|
+
500: variables_js.colorYellow60,
|
|
58
|
+
600: variables_js.colorYellow70,
|
|
59
|
+
700: variables_js.colorYellow80,
|
|
60
|
+
800: variables_js.colorYellow90,
|
|
61
|
+
900: variables_js.colorYellow100,
|
|
62
|
+
1e3: variables_js.colorYellow110,
|
|
63
|
+
DEFAULT: DAIKIN_WARNING
|
|
64
|
+
},
|
|
65
|
+
daikinGreen: {
|
|
66
|
+
50: variables_js.colorGreen10,
|
|
67
|
+
100: variables_js.colorGreen20,
|
|
68
|
+
200: variables_js.colorGreen30,
|
|
69
|
+
300: variables_js.colorGreen40,
|
|
70
|
+
400: variables_js.colorGreen50,
|
|
71
|
+
500: DAIKIN_POSITIVE,
|
|
72
|
+
600: variables_js.colorGreen70,
|
|
73
|
+
700: variables_js.colorGreen80,
|
|
74
|
+
800: variables_js.colorGreen90,
|
|
75
|
+
900: variables_js.colorGreen100,
|
|
76
|
+
1e3: variables_js.colorGreen110,
|
|
77
|
+
DEFAULT: DAIKIN_POSITIVE
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
exports.colors = colors;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const variables_js = require("@daikin-oss/dds-tokens/js/daikin/Light/variables.js");
|
|
4
|
+
const classVarianceAuthority = require("class-variance-authority");
|
|
5
|
+
const lit = require("lit");
|
|
6
|
+
const decorators_js = require("lit/decorators.js");
|
|
7
|
+
const tailwind = require("../../tailwind.css.cjs");
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
11
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
12
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
13
|
+
if (decorator = decorators[i])
|
|
14
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
15
|
+
if (kind && result) __defProp(target, key, result);
|
|
16
|
+
return result;
|
|
17
|
+
};
|
|
18
|
+
const cvaButton = classVarianceAuthority.cva(
|
|
19
|
+
[
|
|
20
|
+
"inline-flex",
|
|
21
|
+
"justify-center",
|
|
22
|
+
"items-center",
|
|
23
|
+
"font-daikinSerif",
|
|
24
|
+
"font-bold",
|
|
25
|
+
"rounded-lg",
|
|
26
|
+
"tracking-wide",
|
|
27
|
+
"text-wrap",
|
|
28
|
+
"disabled:cursor-default",
|
|
29
|
+
"w-full",
|
|
30
|
+
"h-full"
|
|
31
|
+
],
|
|
32
|
+
{
|
|
33
|
+
variants: {
|
|
34
|
+
intent: {
|
|
35
|
+
primary: [
|
|
36
|
+
"text-white",
|
|
37
|
+
"bg-[--buttonColorBackgroundPrimaryActive]",
|
|
38
|
+
"enabled:focus-visible:bg-[--buttonColorBackgroundPrimaryFocus]",
|
|
39
|
+
"enabled:hover:bg-[--buttonColorBackgroundPrimaryHover]",
|
|
40
|
+
"enabled:active:bg-[--buttonColorBackgroundPrimaryPress]",
|
|
41
|
+
"disabled:bg-[--buttonColorBackgroundPrimaryDisabled]",
|
|
42
|
+
"focus-visible:outline-none"
|
|
43
|
+
],
|
|
44
|
+
secondary: [
|
|
45
|
+
"border-2",
|
|
46
|
+
"bg-white",
|
|
47
|
+
"text-daikinBlue-500",
|
|
48
|
+
"border-daikinBlue-500",
|
|
49
|
+
"enabled:hover:text-daikinBlue-300",
|
|
50
|
+
"enabled:hover:border-daikinBlue-300",
|
|
51
|
+
"enabled:active:text-daikinBlue-600",
|
|
52
|
+
"enabled:active:border-daikinBlue-600",
|
|
53
|
+
"enabled:focus-visible:text-daikinBlue-700",
|
|
54
|
+
"enabled:focus-visible:border-daikinBlue-700",
|
|
55
|
+
"disabled:border-daikinNeutral-300",
|
|
56
|
+
"disabled:text-daikinNeutral-400",
|
|
57
|
+
"disabled:border",
|
|
58
|
+
"focus-visible:outline-none"
|
|
59
|
+
],
|
|
60
|
+
tertiary: [
|
|
61
|
+
"text-daikinBlue-400",
|
|
62
|
+
"bg-none",
|
|
63
|
+
"border-none",
|
|
64
|
+
"shadow-none",
|
|
65
|
+
"enabled:hover:bg-daikinNeutral-100",
|
|
66
|
+
"disabled:bg-transparent",
|
|
67
|
+
"disabled:text-daikinNeutral-400"
|
|
68
|
+
],
|
|
69
|
+
primaryDanger: [
|
|
70
|
+
"bg-daikinRed",
|
|
71
|
+
"text-white",
|
|
72
|
+
"enabled:hover:bg-daikinRed-400",
|
|
73
|
+
"enabled:focus-visible:bg-daikinRed-700",
|
|
74
|
+
"enabled:active:bg-daikinRed-700",
|
|
75
|
+
"disabled:bg-daikinNeutral-300",
|
|
76
|
+
"focus-visible:outline-none"
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
size: {
|
|
80
|
+
default: ["px-4", "text-[14px]"],
|
|
81
|
+
condensed: ["px-[10px]", "text-[12px]"]
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
defaultVariants: {
|
|
85
|
+
intent: "primary",
|
|
86
|
+
size: "condensed"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
exports.DaikinButton = class DaikinButton extends lit.LitElement {
|
|
91
|
+
constructor() {
|
|
92
|
+
super(...arguments);
|
|
93
|
+
this.variant = "primary";
|
|
94
|
+
this.disabled = false;
|
|
95
|
+
this.rightIcon = "";
|
|
96
|
+
this.leftIcon = "";
|
|
97
|
+
this.href = "";
|
|
98
|
+
this.size = "default";
|
|
99
|
+
this.type = "button";
|
|
100
|
+
this.role = "button";
|
|
101
|
+
this.isLoading = false;
|
|
102
|
+
}
|
|
103
|
+
render() {
|
|
104
|
+
const buttonClassName = cvaButton({
|
|
105
|
+
intent: this.variant,
|
|
106
|
+
size: this.size
|
|
107
|
+
});
|
|
108
|
+
const content = lit.html`
|
|
109
|
+
<slot name="leftIcon"></slot>
|
|
110
|
+
<span><slot></slot></span>
|
|
111
|
+
<slot name="rightIcon"></slot>
|
|
112
|
+
`;
|
|
113
|
+
if (this.href) {
|
|
114
|
+
return lit.html` <a
|
|
115
|
+
href="${this.href}"
|
|
116
|
+
class="${buttonClassName}"
|
|
117
|
+
role="${this.role}"
|
|
118
|
+
>
|
|
119
|
+
${content}
|
|
120
|
+
</a>`;
|
|
121
|
+
}
|
|
122
|
+
return lit.html`
|
|
123
|
+
<button
|
|
124
|
+
class="${buttonClassName}"
|
|
125
|
+
?disabled="${this.disabled}"
|
|
126
|
+
type="${this.type}"
|
|
127
|
+
role="${this.role}"
|
|
128
|
+
>
|
|
129
|
+
${content}
|
|
130
|
+
</button>
|
|
131
|
+
`;
|
|
132
|
+
}
|
|
133
|
+
focus(options) {
|
|
134
|
+
var _a, _b;
|
|
135
|
+
(_b = (_a = this.shadowRoot) == null ? void 0 : _a.querySelector("button")) == null ? void 0 : _b.focus(options);
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
exports.DaikinButton.styles = lit.css`
|
|
139
|
+
${lit.unsafeCSS(tailwind.default)}
|
|
140
|
+
|
|
141
|
+
:host {
|
|
142
|
+
--buttonColorBackgroundPrimaryActive: ${lit.unsafeCSS(
|
|
143
|
+
variables_js.buttonColorBackgroundPrimaryActive
|
|
144
|
+
)};
|
|
145
|
+
--buttonColorBackgroundPrimaryFocus: ${lit.unsafeCSS(
|
|
146
|
+
variables_js.buttonColorBackgroundPrimaryFocus
|
|
147
|
+
)};
|
|
148
|
+
--buttonColorBackgroundPrimaryHover: ${lit.unsafeCSS(
|
|
149
|
+
variables_js.buttonColorBackgroundPrimaryHover
|
|
150
|
+
)};
|
|
151
|
+
--buttonColorBackgroundPrimaryPress: ${lit.unsafeCSS(
|
|
152
|
+
variables_js.buttonColorBackgroundPrimaryPress
|
|
153
|
+
)};
|
|
154
|
+
--buttonColorBackgroundPrimaryDisabled: ${lit.unsafeCSS(
|
|
155
|
+
variables_js.buttonColorBackgroundPrimaryDisabled
|
|
156
|
+
)};
|
|
157
|
+
|
|
158
|
+
display: inline-block;
|
|
159
|
+
width: fit-content;
|
|
160
|
+
min-height: 42px;
|
|
161
|
+
height: 1px;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
:host([size="condensed"]) {
|
|
165
|
+
min-height: 32px;
|
|
166
|
+
}
|
|
167
|
+
`;
|
|
168
|
+
__decorateClass([
|
|
169
|
+
decorators_js.property({ type: String })
|
|
170
|
+
], exports.DaikinButton.prototype, "variant", 2);
|
|
171
|
+
__decorateClass([
|
|
172
|
+
decorators_js.property({ type: Boolean, reflect: true })
|
|
173
|
+
], exports.DaikinButton.prototype, "disabled", 2);
|
|
174
|
+
__decorateClass([
|
|
175
|
+
decorators_js.property({ type: String, reflect: true })
|
|
176
|
+
], exports.DaikinButton.prototype, "rightIcon", 2);
|
|
177
|
+
__decorateClass([
|
|
178
|
+
decorators_js.property({ type: String, reflect: true })
|
|
179
|
+
], exports.DaikinButton.prototype, "leftIcon", 2);
|
|
180
|
+
__decorateClass([
|
|
181
|
+
decorators_js.property({ type: String, reflect: true })
|
|
182
|
+
], exports.DaikinButton.prototype, "href", 2);
|
|
183
|
+
__decorateClass([
|
|
184
|
+
decorators_js.property({ type: String, reflect: true })
|
|
185
|
+
], exports.DaikinButton.prototype, "size", 2);
|
|
186
|
+
__decorateClass([
|
|
187
|
+
decorators_js.property({ type: String, reflect: true })
|
|
188
|
+
], exports.DaikinButton.prototype, "type", 2);
|
|
189
|
+
__decorateClass([
|
|
190
|
+
decorators_js.property({ type: String, reflect: true })
|
|
191
|
+
], exports.DaikinButton.prototype, "role", 2);
|
|
192
|
+
__decorateClass([
|
|
193
|
+
decorators_js.property({ type: Boolean })
|
|
194
|
+
], exports.DaikinButton.prototype, "isLoading", 2);
|
|
195
|
+
exports.DaikinButton = __decorateClass([
|
|
196
|
+
decorators_js.customElement("daikin-button")
|
|
197
|
+
], exports.DaikinButton);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { ARIARole } from '../../lit-analyzer-types';
|
|
3
|
+
import { MergeVariantProps } from '../../type-utils';
|
|
4
|
+
|
|
5
|
+
declare const cvaButton: (props?: ({
|
|
6
|
+
intent?: "primary" | "secondary" | "tertiary" | "primaryDanger" | null | undefined;
|
|
7
|
+
size?: "default" | "condensed" | null | undefined;
|
|
8
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
9
|
+
type ButtonVariantProps = MergeVariantProps<typeof cvaButton>;
|
|
10
|
+
/**
|
|
11
|
+
* Primary UI component for user interaction
|
|
12
|
+
*/
|
|
13
|
+
export declare class DaikinButton extends LitElement {
|
|
14
|
+
static readonly styles: import('lit').CSSResult;
|
|
15
|
+
/**
|
|
16
|
+
* Type of variant.
|
|
17
|
+
*/
|
|
18
|
+
variant: ButtonVariantProps["intent"];
|
|
19
|
+
/**
|
|
20
|
+
* `true` if the button should be disabled.
|
|
21
|
+
*/
|
|
22
|
+
disabled: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Set a icon in the right of button label.
|
|
25
|
+
*/
|
|
26
|
+
rightIcon: string;
|
|
27
|
+
/**
|
|
28
|
+
* Set a icon in the left of button label.
|
|
29
|
+
*/
|
|
30
|
+
leftIcon: string;
|
|
31
|
+
/**
|
|
32
|
+
* Link `href`. If present, this button is rendered as `<a>`.
|
|
33
|
+
*/
|
|
34
|
+
href: string;
|
|
35
|
+
/**
|
|
36
|
+
* Specify the button size.
|
|
37
|
+
*/
|
|
38
|
+
size: ButtonVariantProps["size"];
|
|
39
|
+
/**
|
|
40
|
+
* Specify the button type.
|
|
41
|
+
*/
|
|
42
|
+
type: "button" | "submit" | "reset";
|
|
43
|
+
/**
|
|
44
|
+
* Specify the button role.
|
|
45
|
+
*/
|
|
46
|
+
role: ARIARole;
|
|
47
|
+
/**
|
|
48
|
+
* Specify whether the button is loading.
|
|
49
|
+
*/
|
|
50
|
+
isLoading: boolean;
|
|
51
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
52
|
+
focus(options?: FocusOptions | undefined): void;
|
|
53
|
+
}
|
|
54
|
+
declare global {
|
|
55
|
+
interface HTMLElementTagNameMap {
|
|
56
|
+
"daikin-button": DaikinButton;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './daikin-button';
|