@lukso/web-components 1.0.1 → 1.0.4
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 +62 -112
- package/dist/assets/fonts/Apax-Bold.woff2 +0 -0
- package/dist/assets/fonts/Apax-Light.woff2 +0 -0
- package/dist/assets/fonts/Apax-Medium.woff2 +0 -0
- package/dist/assets/fonts/Apax-Regular.woff2 +0 -0
- package/dist/assets/fonts/Inter-Bold.woff2 +0 -0
- package/dist/assets/fonts/Inter-ExtraBold.woff2 +0 -0
- package/dist/assets/fonts/Inter-Medium.woff2 +0 -0
- package/dist/assets/fonts/Inter-Regular.woff2 +0 -0
- package/dist/assets/fonts/Inter-SemiBold.woff2 +0 -0
- package/dist/assets/fonts/Inter-Thin.woff2 +0 -0
- package/dist/assets/fonts/PT-Mono-Bold.woff2 +0 -0
- package/dist/assets/fonts/PT-Mono-Regular.woff2 +0 -0
- package/dist/assets/fonts/index.cjs +1 -0
- package/dist/assets/fonts/index.js +4 -0
- package/dist/assets/fonts/index.ts +1 -0
- package/dist/directive-619b88dd.cjs +55 -0
- package/dist/directive-76d5504a.js +1128 -0
- package/dist/index.cjs +1 -0
- package/dist/index.js +6 -0
- package/dist/lukso-button-4b795065.js +57 -0
- package/dist/lukso-button-ab7e2769.cjs +17 -0
- package/dist/lukso-button.cjs +1 -0
- package/dist/lukso-button.js +2 -0
- package/dist/lukso-test.cjs +41 -0
- package/dist/lukso-test.js +710 -0
- package/dist/sass/color-palette.ts +69 -0
- package/dist/sass/component.scss +13 -0
- package/dist/sass/fonts.scss +97 -0
- package/dist/sass/index.cjs +1 -0
- package/dist/sass/index.js +4 -0
- package/dist/sass/index.ts +1 -0
- package/dist/sass/main.scss +12 -0
- package/dist/sass/typography.scss +122 -0
- package/dist/sass/variables.scss +5 -0
- package/dist/styles/index.cjs +1 -0
- package/dist/styles/index.js +4 -0
- package/dist/styles/main.css +181 -0
- package/dist/styles/main.css.map +1 -0
- package/package.json +78 -33
- package/src/components/lukso-button/index.ts +1 -0
- package/src/components/lukso-button/lukso-button.stories.ts +51 -0
- package/src/components/lukso-button/lukso-button.ts +55 -0
- package/src/components/lukso-test/index.ts +72 -0
- package/src/components/lukso-test/test.component.scss +7 -0
- package/src/components/lukso-test/test.stories.ts +31 -0
- package/src/docs/buttons.stories.mdx +35 -0
- package/src/docs/colors.stories.mdx +72 -0
- package/src/docs/typography.stories.mdx +360 -0
- package/src/globals.d.ts +1 -0
- package/src/index.ts +3 -0
- package/src/postcss.config.ts +8 -0
- package/src/shared/assets/fonts/Apax-Bold.woff2 +0 -0
- package/src/shared/assets/fonts/Apax-Light.woff2 +0 -0
- package/src/shared/assets/fonts/Apax-Medium.woff2 +0 -0
- package/src/shared/assets/fonts/Apax-Regular.woff2 +0 -0
- package/src/shared/assets/fonts/Inter-Bold.woff2 +0 -0
- package/src/shared/assets/fonts/Inter-ExtraBold.woff2 +0 -0
- package/src/shared/assets/fonts/Inter-Medium.woff2 +0 -0
- package/src/shared/assets/fonts/Inter-Regular.woff2 +0 -0
- package/src/shared/assets/fonts/Inter-SemiBold.woff2 +0 -0
- package/src/shared/assets/fonts/Inter-Thin.woff2 +0 -0
- package/src/shared/assets/fonts/PT-Mono-Bold.woff2 +0 -0
- package/src/shared/assets/fonts/PT-Mono-Regular.woff2 +0 -0
- package/src/shared/assets/fonts/index.ts +1 -0
- package/src/shared/directives/custom-class-map.ts +51 -0
- package/src/shared/globals.d.ts +5 -0
- package/src/shared/styles/color-palette.ts +69 -0
- package/src/shared/styles/component.scss +13 -0
- package/src/shared/styles/fonts.scss +97 -0
- package/src/shared/styles/index.ts +1 -0
- package/src/shared/styles/main.scss +12 -0
- package/src/shared/styles/typography.scss +122 -0
- package/src/shared/styles/variables.scss +5 -0
- package/src/shared/tailwind.element.ts +16 -0
- package/src/shared/utils/hslColorMap.ts +20 -0
- package/src/tailwind.config.ts +60 -0
- package/tools/color-palette.cjs +141 -0
- package/tools/color-palette.d.ts +50 -0
- package/tools/color-palette.d.ts.map +1 -0
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lukso/web-components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
|
-
"dist"
|
|
6
|
+
"dist/",
|
|
7
|
+
"src/",
|
|
8
|
+
"tools/",
|
|
9
|
+
"dist/assets/*"
|
|
7
10
|
],
|
|
8
11
|
"main": "./dist/index.cjs",
|
|
9
12
|
"module": "./dist/index.js",
|
|
@@ -11,21 +14,58 @@
|
|
|
11
14
|
"exports": {
|
|
12
15
|
".": {
|
|
13
16
|
"require": "./dist/index.cjs",
|
|
14
|
-
"import": "./dist/index.js"
|
|
17
|
+
"import": "./dist/index.js",
|
|
18
|
+
"types": "./dist/index.d.ts"
|
|
15
19
|
},
|
|
20
|
+
"./tailwind.config": "./tailwind.config.cjs",
|
|
21
|
+
"./assets/fonts/": "./dist/assets/fonts/",
|
|
22
|
+
"./assets/fonts": {
|
|
23
|
+
"require": "./dist/assets/fonts/index.cjs",
|
|
24
|
+
"import": "./dist/assets/fonts/index.js",
|
|
25
|
+
"types": "./dist/assets/fonts/index.d.ts"
|
|
26
|
+
},
|
|
27
|
+
"./styles/": "./dist/styles/",
|
|
28
|
+
"./styles": {
|
|
29
|
+
"require": "./dist/styles/index.cjs",
|
|
30
|
+
"import": "./dist/styles/index.js",
|
|
31
|
+
"types": "./dist/styles/index.d.ts"
|
|
32
|
+
},
|
|
33
|
+
"./sass/": "./dist/sass/",
|
|
34
|
+
"./sass": {
|
|
35
|
+
"require": "./dist/sass/index.cjs",
|
|
36
|
+
"import": "./dist/sass/index.js",
|
|
37
|
+
"types": "./dist/sass/index.d.ts"
|
|
38
|
+
},
|
|
39
|
+
"./tools/color-palette": "./tools/color-palette.cjs",
|
|
16
40
|
"./lukso-button": {
|
|
17
|
-
"require":
|
|
18
|
-
|
|
41
|
+
"require": [
|
|
42
|
+
"./dist/lukso-button.cjs"
|
|
43
|
+
],
|
|
44
|
+
"import": [
|
|
45
|
+
"./dist/lukso-button.js"
|
|
46
|
+
],
|
|
47
|
+
"types": [
|
|
48
|
+
"./dist/lukso-button.d.ts"
|
|
49
|
+
]
|
|
19
50
|
},
|
|
20
51
|
"./lukso-test": {
|
|
21
|
-
"require":
|
|
22
|
-
|
|
52
|
+
"require": [
|
|
53
|
+
"./dist/lukso-test.cjs"
|
|
54
|
+
],
|
|
55
|
+
"import": [
|
|
56
|
+
"./dist/lukso-test.js"
|
|
57
|
+
],
|
|
58
|
+
"types": [
|
|
59
|
+
"./dist/lukso-test.d.ts"
|
|
60
|
+
]
|
|
23
61
|
}
|
|
24
62
|
},
|
|
25
63
|
"scripts": {
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
64
|
+
"config-prepare": "tsc-bundle ./tsconfig.work.json --exportAs commonjs && renamer --force --chain find-replace --path-element ext --find '.js' --replace '.cjs' './tools/**/*.js'",
|
|
65
|
+
"start": "yarn config-prepare && concurrently 'vite build -w' 'yarn storybook'",
|
|
66
|
+
"dev": "yarn start",
|
|
67
|
+
"build": "yarn config-prepare && yarn analyze && vite build && yarn sass --verbose ./src/shared/styles/main.scss ./dist/styles/main.css && yarn build:list-exports",
|
|
68
|
+
"build:list-exports": "node ./listExports.cjs",
|
|
29
69
|
"lint": "npm-run-all --aggregate-output --continue-on-error --parallel 'lint:{eslint,css,fmt}'",
|
|
30
70
|
"lint:eslint": "eslint src --fix",
|
|
31
71
|
"lint:fmt": "prettier --check --loglevel=warn .",
|
|
@@ -33,10 +73,10 @@
|
|
|
33
73
|
"lint:fmt:fix": "prettier --write .",
|
|
34
74
|
"analyze": "cem analyze --litelement --globs 'src/**/index.ts' --exclude 'src/**/*.stories.ts'",
|
|
35
75
|
"analyze:watch": "cem analyze --litelement --globs 'src/**/index.ts' --exclude 'src/**/*.stories.ts' --watch",
|
|
36
|
-
"storybook": "concurrently 'yarn analyze:watch' 'storybook dev -p 6006'",
|
|
37
|
-
"build-storybook": "storybook build",
|
|
38
|
-
"test-storybook": "test-storybook",
|
|
39
|
-
"test": "yarn analyze && yarn build-storybook && concurrently -k -s first -n 'SB,TEST' -c 'magenta,blue' 'http-server storybook-static --port 6006' 'wait-on -v tcp:127.0.0.1:6006 && yarn test-storybook --url http://127.0.0.1:6006'",
|
|
76
|
+
"storybook": "yarn config-prepare && concurrently 'yarn analyze:watch' 'storybook dev -p 6006'",
|
|
77
|
+
"build-storybook": "yarn config-prepare && storybook build",
|
|
78
|
+
"test-storybook": "yarn config-prepare && test-storybook",
|
|
79
|
+
"test": "yarn analyze && yarn config-prepare && yarn build-storybook && concurrently -k -s first -n 'SB,TEST' -c 'magenta,blue' 'http-server storybook-static --port 6006' 'wait-on -v tcp:127.0.0.1:6006 && yarn test-storybook --url http://127.0.0.1:6006'",
|
|
40
80
|
"prepare": "husky install"
|
|
41
81
|
},
|
|
42
82
|
"lint-staged": {
|
|
@@ -52,51 +92,56 @@
|
|
|
52
92
|
]
|
|
53
93
|
},
|
|
54
94
|
"devDependencies": {
|
|
55
|
-
"@custom-elements-manifest/analyzer": "^0.6.
|
|
95
|
+
"@custom-elements-manifest/analyzer": "^0.6.8",
|
|
56
96
|
"@lit-labs/motion": "^1.0.3",
|
|
57
|
-
"@storybook/addon-controls": "^7.0.0-beta.
|
|
58
|
-
"@storybook/addon-essentials": "^7.0.0-beta.
|
|
59
|
-
"@storybook/addon-interactions": "^7.0.0-beta.
|
|
60
|
-
"@storybook/addon-links": "^7.0.0-beta.
|
|
61
|
-
"@storybook/blocks": "^7.0.0-beta.
|
|
62
|
-
"@storybook/builder-vite": "^7.0.0-beta.
|
|
97
|
+
"@storybook/addon-controls": "^7.0.0-beta.31",
|
|
98
|
+
"@storybook/addon-essentials": "^7.0.0-beta.31",
|
|
99
|
+
"@storybook/addon-interactions": "^7.0.0-beta.31",
|
|
100
|
+
"@storybook/addon-links": "^7.0.0-beta.31",
|
|
101
|
+
"@storybook/blocks": "^7.0.0-beta.31",
|
|
102
|
+
"@storybook/builder-vite": "^7.0.0-beta.31",
|
|
63
103
|
"@storybook/client-api": "^6.5.15",
|
|
64
104
|
"@storybook/jest": "^0.0.10",
|
|
65
|
-
"@storybook/test-runner": "^0.9.
|
|
105
|
+
"@storybook/test-runner": "^0.9.3",
|
|
66
106
|
"@storybook/testing-library": "^0.0.13",
|
|
67
|
-
"@storybook/web-components-vite": "^7.0.0-beta.
|
|
68
|
-
"@typescript-eslint/eslint-plugin": "^5.48.
|
|
69
|
-
"@typescript-eslint/parser": "^5.48.
|
|
107
|
+
"@storybook/web-components-vite": "^7.0.0-beta.31",
|
|
108
|
+
"@typescript-eslint/eslint-plugin": "^5.48.2",
|
|
109
|
+
"@typescript-eslint/parser": "^5.48.2",
|
|
70
110
|
"autoprefixer": "^10.4.13",
|
|
71
111
|
"concurrently": "^7.6.0",
|
|
72
|
-
"eslint": "^8.
|
|
112
|
+
"eslint": "^8.32.0",
|
|
73
113
|
"eslint-config-prettier": "^8.6.0",
|
|
74
|
-
"eslint-import-resolver-typescript": "^3.5.
|
|
75
|
-
"eslint-plugin-import": "^2.
|
|
114
|
+
"eslint-import-resolver-typescript": "^3.5.3",
|
|
115
|
+
"eslint-plugin-import": "^2.27.5",
|
|
76
116
|
"eslint-plugin-json": "^3.1.0",
|
|
77
|
-
"eslint-plugin-lit": "^1.
|
|
117
|
+
"eslint-plugin-lit": "^1.8.2",
|
|
78
118
|
"espree": "^9.4.1",
|
|
79
119
|
"http-server": "^14.1.1",
|
|
80
120
|
"husky": "^8.0.3",
|
|
81
121
|
"lint-staged": "^13.1.0",
|
|
82
|
-
"
|
|
122
|
+
"list-exports": "^1.0.4",
|
|
123
|
+
"lit": "^2.6.1",
|
|
83
124
|
"lit-analyzer": "^1.2.1",
|
|
84
|
-
"lit-html": "^2.
|
|
125
|
+
"lit-html": "^2.6.1",
|
|
85
126
|
"npm-run-all": "^4.1.5",
|
|
86
127
|
"playwright": "^1.29.2",
|
|
87
128
|
"postcss": "^8.4.21",
|
|
88
|
-
"prettier": "^2.8.
|
|
129
|
+
"prettier": "^2.8.3",
|
|
89
130
|
"react": "^18.2.0",
|
|
90
131
|
"react-dom": "^18.2.0",
|
|
132
|
+
"renamer": "^4.0.0",
|
|
91
133
|
"sass": "^1.57.1",
|
|
92
|
-
"storybook": "
|
|
134
|
+
"storybook": "7.0.0-beta.31",
|
|
93
135
|
"stylelint": "^14.16.1",
|
|
94
136
|
"stylelint-config-prettier": "^9.0.4",
|
|
95
137
|
"stylelint-config-standard-scss": "^6.1.0",
|
|
96
138
|
"stylelint-prettier": "^2.0.0",
|
|
97
139
|
"tailwindcss": "^3.2.4",
|
|
140
|
+
"tinycolor2": "^1.5.2",
|
|
98
141
|
"typescript": "^4.9.4",
|
|
142
|
+
"typescript-bundle": "^1.0.18",
|
|
99
143
|
"vite": "^4.0.4",
|
|
144
|
+
"vite-plugin-static-copy": "^0.13.0",
|
|
100
145
|
"wait-on": "^7.0.1"
|
|
101
146
|
},
|
|
102
147
|
"packageManager": "yarn@3.3.1",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './lukso-button'
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { html } from 'lit-html'
|
|
2
|
+
import { within } from '@storybook/testing-library'
|
|
3
|
+
import { expect } from '@storybook/jest'
|
|
4
|
+
import '../lukso-button'
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Design System/Atoms/Button',
|
|
8
|
+
component: 'lukso-button',
|
|
9
|
+
argTypes: {
|
|
10
|
+
variant: {
|
|
11
|
+
control: { type: 'select' },
|
|
12
|
+
options: ['primary', 'secondary', 'landing'],
|
|
13
|
+
},
|
|
14
|
+
disabled: {
|
|
15
|
+
control: { type: 'boolean' },
|
|
16
|
+
defaultValue: false,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
parameters: {
|
|
20
|
+
controls: {
|
|
21
|
+
exclude: ['defaultStyles', 'secondaryStyles', 'primaryStyles'],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const Template = ({ variant, disabled }) =>
|
|
27
|
+
html`<lukso-button variant=${variant} ?disabled=${disabled}
|
|
28
|
+
>Hello World</lukso-button
|
|
29
|
+
>`
|
|
30
|
+
|
|
31
|
+
export const Primary = Template.bind({})
|
|
32
|
+
Primary.args = {
|
|
33
|
+
variant: 'primary',
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
Primary.play = async ({ canvasElement }) => {
|
|
37
|
+
const canvas = within(canvasElement)
|
|
38
|
+
|
|
39
|
+
// 👇 Assert DOM structure
|
|
40
|
+
expect(canvas.getByText('Hello World')).toBeInTheDocument()
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const Secondary = Template.bind({})
|
|
44
|
+
Secondary.args = {
|
|
45
|
+
variant: 'secondary',
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const Landing = Template.bind({})
|
|
49
|
+
Landing.args = {
|
|
50
|
+
variant: 'landing',
|
|
51
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { html } from 'lit'
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js'
|
|
3
|
+
|
|
4
|
+
import { TailwindElement } from '../../shared/tailwind.element'
|
|
5
|
+
import { customClassMap } from '../../shared/directives/custom-class-map'
|
|
6
|
+
|
|
7
|
+
export type ButtonVariants = 'primary' | 'secondary' | 'landing'
|
|
8
|
+
|
|
9
|
+
@customElement('lukso-button')
|
|
10
|
+
export class LuksoButton extends TailwindElement {
|
|
11
|
+
@property({ type: String })
|
|
12
|
+
variant: ButtonVariants = 'primary'
|
|
13
|
+
|
|
14
|
+
@property({ type: Boolean })
|
|
15
|
+
disabled = false
|
|
16
|
+
|
|
17
|
+
private defaultStyles = `flex justify-center items-center relative gap-2 py-3 px-6 rounded-xl
|
|
18
|
+
border border-solid cursor-pointer paragraph-16-semi-bold`
|
|
19
|
+
|
|
20
|
+
private secondaryStyles = `bg-neutral-100 border-neutral-90 text-neutral-20 disabled:bg-neutral-90
|
|
21
|
+
disabled:border-neutral-90 disabled:text-neutral-100 hover:shadow-button-hover-secondary`
|
|
22
|
+
|
|
23
|
+
private primaryStyles = `bg-neutral-20 border-neutral-20 text-neutral-100
|
|
24
|
+
disabled:bg-neutral-90
|
|
25
|
+
disabled:border-neutral-90
|
|
26
|
+
hover:shadow-button-hover-primary
|
|
27
|
+
`
|
|
28
|
+
|
|
29
|
+
private landingStyles = `bg-purple-51 border-purple-51 text-neutral-100
|
|
30
|
+
disabled:bg-neutral-90 disabled:border-neutral-90
|
|
31
|
+
hover:shadow-button-hover-primary hover:bg-purple-58 hover:border-purple-58`
|
|
32
|
+
|
|
33
|
+
render() {
|
|
34
|
+
return html`
|
|
35
|
+
<button
|
|
36
|
+
data-testid="button"
|
|
37
|
+
?disabled=${this.disabled}
|
|
38
|
+
class=${customClassMap({
|
|
39
|
+
[this.defaultStyles]: true,
|
|
40
|
+
[this.primaryStyles]: this.variant === 'primary',
|
|
41
|
+
[this.secondaryStyles]: this.variant === 'secondary',
|
|
42
|
+
[this.landingStyles]: this.variant === 'landing',
|
|
43
|
+
})}
|
|
44
|
+
>
|
|
45
|
+
<slot></slot>
|
|
46
|
+
</button>
|
|
47
|
+
`
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
declare global {
|
|
52
|
+
interface HTMLElementTagNameMap {
|
|
53
|
+
'lukso-button': LuksoButton
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { html } from 'lit'
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js'
|
|
3
|
+
import { animate, AnimateController } from '@lit-labs/motion'
|
|
4
|
+
import { classMap } from 'lit/directives/class-map.js'
|
|
5
|
+
|
|
6
|
+
import { TailwindStyledElement } from '../../shared/tailwind.element'
|
|
7
|
+
import style from './test.component.scss?inline'
|
|
8
|
+
|
|
9
|
+
@customElement('lukso-test')
|
|
10
|
+
export class LuksoTest extends TailwindStyledElement(style) {
|
|
11
|
+
@property()
|
|
12
|
+
name = 'World'
|
|
13
|
+
|
|
14
|
+
@property()
|
|
15
|
+
private clicked = false
|
|
16
|
+
|
|
17
|
+
@property({ type: Boolean })
|
|
18
|
+
disabled = false
|
|
19
|
+
|
|
20
|
+
duration = 1000
|
|
21
|
+
controller = new AnimateController(this, {
|
|
22
|
+
defaultOptions: {
|
|
23
|
+
keyframeOptions: {
|
|
24
|
+
duration: this.duration,
|
|
25
|
+
fill: 'backwards',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
_onClick() {
|
|
31
|
+
if (this.disabled) {
|
|
32
|
+
return
|
|
33
|
+
}
|
|
34
|
+
this.clicked = true
|
|
35
|
+
setTimeout(() => {
|
|
36
|
+
this.clicked = false
|
|
37
|
+
}, 2000)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
render() {
|
|
41
|
+
const classes = {
|
|
42
|
+
'text-yellow-200': !this.disabled,
|
|
43
|
+
'p-2': true,
|
|
44
|
+
'rounded-full': true,
|
|
45
|
+
'text-24': true,
|
|
46
|
+
'bg-blue-800': this.clicked && !this.disabled,
|
|
47
|
+
'bg-blue-200': !this.clicked && !this.disabled,
|
|
48
|
+
}
|
|
49
|
+
return html`
|
|
50
|
+
<p class="heading-1">
|
|
51
|
+
Hello,
|
|
52
|
+
<b class="heading-4">${this.name}</b>
|
|
53
|
+
!
|
|
54
|
+
</p>
|
|
55
|
+
<button
|
|
56
|
+
?disabled=${this.disabled}
|
|
57
|
+
data-testid="button"
|
|
58
|
+
@click=${this._onClick}
|
|
59
|
+
class="hover:text-yellow-700 ${classMap(classes)}"
|
|
60
|
+
${animate()}
|
|
61
|
+
>
|
|
62
|
+
Hello world! 2
|
|
63
|
+
</button>
|
|
64
|
+
`
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
declare global {
|
|
69
|
+
interface HTMLElementTagNameMap {
|
|
70
|
+
'lukso-test': LuksoTest
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { html } from 'lit-html'
|
|
2
|
+
import { within } from '@storybook/testing-library'
|
|
3
|
+
import { expect } from '@storybook/jest'
|
|
4
|
+
|
|
5
|
+
import './index'
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Test',
|
|
9
|
+
component: 'lukso-test',
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function Primary({ disabled }) {
|
|
13
|
+
return html`<lukso-test ?disabled=${disabled}>Hello World</lukso-test>`
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
Primary.args = {
|
|
17
|
+
disabled: false,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
Primary.play = async ({ canvasElement }) => {
|
|
21
|
+
const canvas = within(canvasElement)
|
|
22
|
+
|
|
23
|
+
// 👇 Assert DOM structure
|
|
24
|
+
await expect(canvas.getByText('Hello World')).toBeInTheDocument()
|
|
25
|
+
|
|
26
|
+
// See https://storybook.js.org/docs/react/essentials/actions#automatically-matching-args to learn how to setup logging in the Actions panel
|
|
27
|
+
// await userEvent.click(canvas.getByTestId("button"));
|
|
28
|
+
|
|
29
|
+
// 👇 Assert DOM structure
|
|
30
|
+
await expect(canvas.getByText('Hello World')).toBeInTheDocument()
|
|
31
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Meta } from '@storybook/addon-docs'
|
|
2
|
+
import { html } from 'lit-html'
|
|
3
|
+
|
|
4
|
+
<Meta title="Design System/Atoms/Button" />
|
|
5
|
+
|
|
6
|
+
# Button component
|
|
7
|
+
|
|
8
|
+
This file is a documentation-only `MDX`file to customize Storybook's [DocsPage](https://storybook.js.org/docs/react/writing-docs/docs-page#replacing-docspage).
|
|
9
|
+
|
|
10
|
+
It can be further expanded with your own code snippets and include specific information related to your stories.
|
|
11
|
+
|
|
12
|
+
For example:
|
|
13
|
+
|
|
14
|
+
import { Story } from '@storybook/addon-docs'
|
|
15
|
+
|
|
16
|
+
## Button
|
|
17
|
+
|
|
18
|
+
Button is the primary component. It has four possible states.
|
|
19
|
+
|
|
20
|
+
- [Primary](?path=/docs/design-system-typography--currency-10-semi-bold)
|
|
21
|
+
- [Secondary](#design-system-atoms-button--secondary)
|
|
22
|
+
- [Large](#large)
|
|
23
|
+
- [Small](#small)
|
|
24
|
+
|
|
25
|
+
## With the story title defined
|
|
26
|
+
|
|
27
|
+
If you included the title in the story's default export, use this approach.
|
|
28
|
+
|
|
29
|
+
### Primary
|
|
30
|
+
|
|
31
|
+
<Story id="design-system-atoms-button--primary" />
|
|
32
|
+
|
|
33
|
+
### Secondary
|
|
34
|
+
|
|
35
|
+
<Story id="design-system-atoms-button--secondary" />
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Meta,
|
|
3
|
+
ColorPalette,
|
|
4
|
+
ColorItem,
|
|
5
|
+
Story,
|
|
6
|
+
Canvas,
|
|
7
|
+
Source,
|
|
8
|
+
} from '@storybook/addon-docs'
|
|
9
|
+
import { html } from 'lit-html'
|
|
10
|
+
import dedent from 'ts-dedent'
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
colorPalette,
|
|
14
|
+
neutral1,
|
|
15
|
+
neutral2,
|
|
16
|
+
neutral3,
|
|
17
|
+
} from '../shared/styles/color-palette'
|
|
18
|
+
|
|
19
|
+
<Meta title="Design System/Colors" />
|
|
20
|
+
|
|
21
|
+
<h1 id="typography">Colors</h1>
|
|
22
|
+
|
|
23
|
+
We use colors that has fixed `hue` and `saturation` and operate over `lightness` values.
|
|
24
|
+
For instance in `neutral-20` the lightness value is `20`.
|
|
25
|
+
|
|
26
|
+
### **Example Usage**
|
|
27
|
+
|
|
28
|
+
Apply color class like any other Tailwind color, for example:
|
|
29
|
+
|
|
30
|
+
```html
|
|
31
|
+
<span class="bg-neutral-20 text-honey-72">Text</span>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### **Color Palette**
|
|
35
|
+
|
|
36
|
+
<br />
|
|
37
|
+
|
|
38
|
+
<ColorPalette>
|
|
39
|
+
#### **Neutral Colors**
|
|
40
|
+
<br />
|
|
41
|
+
<br />
|
|
42
|
+
<ColorItem title="neutral" colors={neutral1} />
|
|
43
|
+
<ColorItem colors={neutral2} />
|
|
44
|
+
<ColorItem colors={neutral3} />
|
|
45
|
+
### **Accent Colors**
|
|
46
|
+
<br />
|
|
47
|
+
<br />
|
|
48
|
+
<ColorItem title="honey" colors={colorPalette.honey} />
|
|
49
|
+
<ColorItem title="coral" colors={colorPalette.coral} />
|
|
50
|
+
<ColorItem title="warm" colors={colorPalette.warm} />
|
|
51
|
+
<ColorItem title="sea salt" colors={colorPalette['sea-salt']} />
|
|
52
|
+
<ColorItem title="cloud" colors={colorPalette.cloud} />
|
|
53
|
+
<ColorItem title="ocean" colors={colorPalette.ocean} />
|
|
54
|
+
<ColorItem title="sky" colors={colorPalette.sky} />
|
|
55
|
+
<ColorItem title="lukso" colors={colorPalette.lukso} />
|
|
56
|
+
### **Utility Colors**
|
|
57
|
+
<br />
|
|
58
|
+
<br />
|
|
59
|
+
<ColorItem title="yellow" colors={colorPalette.yellow} />
|
|
60
|
+
<ColorItem title="green" colors={colorPalette.green} />
|
|
61
|
+
<ColorItem title="blue" colors={colorPalette.blue} />
|
|
62
|
+
<ColorItem title="red" colors={colorPalette.red} />
|
|
63
|
+
### **Purples**
|
|
64
|
+
<br />
|
|
65
|
+
<br />
|
|
66
|
+
<ColorItem title="purple" colors={colorPalette.purple} />
|
|
67
|
+
### **Gradients**
|
|
68
|
+
<br />
|
|
69
|
+
<br />
|
|
70
|
+
<ColorItem title="gradient-1" colors={colorPalette['gradient-1']} />
|
|
71
|
+
<ColorItem title="gradient-2" colors={colorPalette['gradient-2']} />
|
|
72
|
+
</ColorPalette>
|