revotech-ui-kit 0.0.2 → 0.0.4-beta
Sign up to get free protection for your applications and to get access to all the features.
- package/.github/workflows/deploy-storybook.yml +107 -0
- package/.storybook/main.ts +3 -3
- package/assume_role.sh +18 -0
- package/dist/183c6c38.js +1 -0
- package/dist/f28fd4b1.js +1 -0
- package/dist/index.ts +1 -0
- package/dist/public/globals.css +2215 -0
- package/dist/public/tailwind-lib.css +115 -0
- package/dist/src/assets/icons/arrows.icon.js +20 -0
- package/dist/src/assets/icons/arrows.icon.js.map +1 -0
- package/dist/src/assets/icons/index.js +4 -0
- package/dist/src/assets/icons/index.js.map +1 -0
- package/dist/src/assets/icons/search.icon.js +19 -0
- package/dist/src/assets/icons/search.icon.js.map +1 -0
- package/dist/src/assets/icons/tick.icon.js +20 -0
- package/dist/src/assets/icons/tick.icon.js.map +1 -0
- package/dist/src/components/atoms/alert/alert-description.js +18 -0
- package/dist/src/components/atoms/alert/alert-description.js.map +1 -0
- package/dist/src/components/atoms/alert/alert-title.js +20 -0
- package/dist/src/components/atoms/alert/alert-title.js.map +1 -0
- package/dist/src/components/atoms/alert/alert.atom.js +55 -0
- package/dist/src/components/atoms/alert/alert.atom.js.map +1 -0
- package/dist/src/components/atoms/alert/alert.stories.js +62 -0
- package/dist/src/components/atoms/alert/alert.stories.js.map +1 -0
- package/dist/src/components/atoms/alert/alert.styles.js +21 -0
- package/dist/src/components/atoms/alert/alert.styles.js.map +1 -0
- package/dist/src/components/atoms/alert/alert.types.js +2 -0
- package/dist/src/components/atoms/alert/alert.types.js.map +1 -0
- package/dist/src/components/atoms/badge/badge.atom.js +43 -0
- package/dist/src/components/atoms/badge/badge.atom.js.map +1 -0
- package/dist/src/components/atoms/badge/badge.stories.js +110 -0
- package/dist/src/components/atoms/badge/badge.stories.js.map +1 -0
- package/dist/src/components/atoms/badge/badge.style.js +17 -0
- package/dist/src/components/atoms/badge/badge.style.js.map +1 -0
- package/dist/src/components/atoms/badge/badge.type.js +2 -0
- package/dist/src/components/atoms/badge/badge.type.js.map +1 -0
- package/dist/src/components/atoms/button/button.atom.js +67 -0
- package/dist/src/components/atoms/button/button.atom.js.map +1 -0
- package/dist/src/components/atoms/button/button.stories.js +204 -0
- package/dist/src/components/atoms/button/button.stories.js.map +1 -0
- package/dist/src/components/atoms/button/button.style.js +24 -0
- package/dist/src/components/atoms/button/button.style.js.map +1 -0
- package/dist/src/components/atoms/button/button.type.js +2 -0
- package/dist/src/components/atoms/button/button.type.js.map +1 -0
- package/dist/src/components/atoms/card/card-content.js +17 -0
- package/dist/src/components/atoms/card/card-content.js.map +1 -0
- package/dist/src/components/atoms/card/card-description.js +17 -0
- package/dist/src/components/atoms/card/card-description.js.map +1 -0
- package/dist/src/components/atoms/card/card-footer.js +17 -0
- package/dist/src/components/atoms/card/card-footer.js.map +1 -0
- package/dist/src/components/atoms/card/card-header.js +17 -0
- package/dist/src/components/atoms/card/card-header.js.map +1 -0
- package/dist/src/components/atoms/card/card-title.js +17 -0
- package/dist/src/components/atoms/card/card-title.js.map +1 -0
- package/dist/src/components/atoms/card/card.atom.js +25 -0
- package/dist/src/components/atoms/card/card.atom.js.map +1 -0
- package/dist/src/components/atoms/card/card.stories.js +136 -0
- package/dist/src/components/atoms/card/card.stories.js.map +1 -0
- package/dist/src/components/atoms/checkbox/checkbox.atom.js +87 -0
- package/dist/src/components/atoms/checkbox/checkbox.atom.js.map +1 -0
- package/dist/src/components/atoms/checkbox/checkbox.stories.js +244 -0
- package/dist/src/components/atoms/checkbox/checkbox.stories.js.map +1 -0
- package/dist/src/components/atoms/checkbox/checkbox.style.js +3 -0
- package/dist/src/components/atoms/checkbox/checkbox.style.js.map +1 -0
- package/dist/src/components/atoms/checkbox/checkbox.type.js +2 -0
- package/dist/src/components/atoms/checkbox/checkbox.type.js.map +1 -0
- package/dist/src/components/atoms/combo-box/combo-box-input.js +47 -0
- package/dist/src/components/atoms/combo-box/combo-box-input.js.map +1 -0
- package/dist/src/components/atoms/combo-box/combo-box-item.js +85 -0
- package/dist/src/components/atoms/combo-box/combo-box-item.js.map +1 -0
- package/dist/src/components/atoms/combo-box/combo-box-list.js +67 -0
- package/dist/src/components/atoms/combo-box/combo-box-list.js.map +1 -0
- package/dist/src/components/atoms/combo-box/combo-box.atom.js +199 -0
- package/dist/src/components/atoms/combo-box/combo-box.atom.js.map +1 -0
- package/dist/src/components/atoms/combo-box/combo-box.stories.js +86 -0
- package/dist/src/components/atoms/combo-box/combo-box.stories.js.map +1 -0
- package/dist/src/components/atoms/command-empty/command-empty.atom.js +54 -0
- package/dist/src/components/atoms/command-empty/command-empty.atom.js.map +1 -0
- package/dist/src/components/atoms/command-group/command-group.atom.js +71 -0
- package/dist/src/components/atoms/command-group/command-group.atom.js.map +1 -0
- package/dist/src/components/atoms/command-item/command-item.atom.js +80 -0
- package/dist/src/components/atoms/command-item/command-item.atom.js.map +1 -0
- package/dist/src/components/atoms/command-list/command-list.atom.js +36 -0
- package/dist/src/components/atoms/command-list/command-list.atom.js.map +1 -0
- package/dist/src/components/atoms/command-separator/command-separator.atom.js +52 -0
- package/dist/src/components/atoms/command-separator/command-separator.atom.js.map +1 -0
- package/dist/src/components/atoms/dialog/dialog-close.js +47 -0
- package/dist/src/components/atoms/dialog/dialog-close.js.map +1 -0
- package/dist/src/components/atoms/dialog/dialog-content.js +72 -0
- package/dist/src/components/atoms/dialog/dialog-content.js.map +1 -0
- package/dist/src/components/atoms/dialog/dialog-footer.js +22 -0
- package/dist/src/components/atoms/dialog/dialog-footer.js.map +1 -0
- package/dist/src/components/atoms/dialog/dialog-header.js +40 -0
- package/dist/src/components/atoms/dialog/dialog-header.js.map +1 -0
- package/dist/src/components/atoms/dialog/dialog-overly.js +20 -0
- package/dist/src/components/atoms/dialog/dialog-overly.js.map +1 -0
- package/dist/src/components/atoms/dialog/dialog-trigger.js +54 -0
- package/dist/src/components/atoms/dialog/dialog-trigger.js.map +1 -0
- package/dist/src/components/atoms/dialog/dialog.atom.js +79 -0
- package/dist/src/components/atoms/dialog/dialog.atom.js.map +1 -0
- package/dist/src/components/atoms/dialog/dialog.stories.js +88 -0
- package/dist/src/components/atoms/dialog/dialog.stories.js.map +1 -0
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-checkbox-Item.js +117 -0
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-checkbox-Item.js.map +1 -0
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-content.js +81 -0
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-content.js.map +1 -0
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-group.js +71 -0
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-group.js.map +1 -0
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-item.js +80 -0
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-item.js.map +1 -0
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-radio-item.js +118 -0
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-radio-item.js.map +1 -0
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-seperator.js +52 -0
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-seperator.js.map +1 -0
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-shortcut.js +20 -0
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-shortcut.js.map +1 -0
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu.atom.js +79 -0
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu.atom.js.map +1 -0
- package/dist/src/components/atoms/dropdownMenu/dropdownMenu.stories.js +211 -0
- package/dist/src/components/atoms/dropdownMenu/dropdownMenu.stories.js.map +1 -0
- package/dist/src/components/atoms/dropdownMenu/dropdownMenu.style.js +4 -0
- package/dist/src/components/atoms/dropdownMenu/dropdownMenu.style.js.map +1 -0
- package/dist/src/components/atoms/index.js +14 -0
- package/dist/src/components/atoms/index.js.map +1 -0
- package/dist/src/components/atoms/input/input.atom.js +93 -0
- package/dist/src/components/atoms/input/input.atom.js.map +1 -0
- package/dist/src/components/atoms/input/input.stories.js +382 -0
- package/dist/src/components/atoms/input/input.stories.js.map +1 -0
- package/dist/src/components/atoms/input/input.styles.js +2 -0
- package/dist/src/components/atoms/input/input.styles.js.map +1 -0
- package/dist/src/components/atoms/input/input.type.js +2 -0
- package/dist/src/components/atoms/input/input.type.js.map +1 -0
- package/dist/src/components/atoms/label/label.atom.js +68 -0
- package/dist/src/components/atoms/label/label.atom.js.map +1 -0
- package/dist/src/components/atoms/label/label.stories.js +85 -0
- package/dist/src/components/atoms/label/label.stories.js.map +1 -0
- package/dist/src/components/atoms/label/label.style.js +3 -0
- package/dist/src/components/atoms/label/label.style.js.map +1 -0
- package/dist/src/components/atoms/popover/popover-content.js +64 -0
- package/dist/src/components/atoms/popover/popover-content.js.map +1 -0
- package/dist/src/components/atoms/popover/popover-trigger.js +51 -0
- package/dist/src/components/atoms/popover/popover-trigger.js.map +1 -0
- package/dist/src/components/atoms/popover/popover.atom.js +40 -0
- package/dist/src/components/atoms/popover/popover.atom.js.map +1 -0
- package/dist/src/components/atoms/popover/popover.stories.js +69 -0
- package/dist/src/components/atoms/popover/popover.stories.js.map +1 -0
- package/dist/src/components/atoms/popover/popover.style.js +21 -0
- package/dist/src/components/atoms/popover/popover.style.js.map +1 -0
- package/dist/src/components/atoms/popover/popover.types.js +4 -0
- package/dist/src/components/atoms/popover/popover.types.js.map +1 -0
- package/dist/src/components/atoms/toggle/defs.js +30 -0
- package/dist/src/components/atoms/toggle/defs.js.map +1 -0
- package/dist/src/components/atoms/toggle/toggle.atom.js +72 -0
- package/dist/src/components/atoms/toggle/toggle.atom.js.map +1 -0
- package/dist/src/components/atoms/toggle/toggle.stories.js +189 -0
- package/dist/src/components/atoms/toggle/toggle.stories.js.map +1 -0
- package/dist/src/components/atoms/toggle/toggle.style.js +19 -0
- package/dist/src/components/atoms/toggle/toggle.style.js.map +1 -0
- package/dist/src/components/command/command.js +410 -0
- package/dist/src/components/command/command.js.map +1 -0
- package/dist/src/components/command/command.stories.js +153 -0
- package/dist/src/components/command/command.stories.js.map +1 -0
- package/dist/src/components/index.js +3 -0
- package/dist/src/components/index.js.map +1 -0
- package/dist/src/components/molecules/command/command.molecules.js +27 -0
- package/dist/src/components/molecules/command/command.molecules.js.map +1 -0
- package/dist/src/components/molecules/command-input/command-input.atom.js +127 -0
- package/dist/src/components/molecules/command-input/command-input.atom.js.map +1 -0
- package/dist/src/components/molecules/dropdownMenu/dropdownMenu.molecules.js +2 -0
- package/dist/src/components/molecules/dropdownMenu/dropdownMenu.molecules.js.map +1 -0
- package/dist/src/components/molecules/index.js +2 -0
- package/dist/src/components/molecules/index.js.map +1 -0
- package/dist/src/helpers/base-element.js +64 -0
- package/dist/src/helpers/base-element.js.map +1 -0
- package/dist/src/helpers/index.js +4 -0
- package/dist/src/helpers/index.js.map +1 -0
- package/dist/src/helpers/mouse-conroller.helper.js +33 -0
- package/dist/src/helpers/mouse-conroller.helper.js.map +1 -0
- package/dist/src/helpers/style.helpers.js +6 -0
- package/dist/src/helpers/style.helpers.js.map +1 -0
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/interfaces/actionable.interface.js +2 -0
- package/dist/src/interfaces/actionable.interface.js.map +1 -0
- package/dist/src/interfaces/atomic.interface.js +2 -0
- package/dist/src/interfaces/atomic.interface.js.map +1 -0
- package/dist/src/interfaces/changeable.interface.js +2 -0
- package/dist/src/interfaces/changeable.interface.js.map +1 -0
- package/dist/src/interfaces/child-support-atomic.interface.js +2 -0
- package/dist/src/interfaces/child-support-atomic.interface.js.map +1 -0
- package/dist/src/interfaces/index.js +7 -0
- package/dist/src/interfaces/index.js.map +1 -0
- package/dist/src/interfaces/intractable.interface.js +2 -0
- package/dist/src/interfaces/intractable.interface.js.map +1 -0
- package/dist/src/interfaces/variant.interface.js +2 -0
- package/dist/src/interfaces/variant.interface.js.map +1 -0
- package/dist/src/lib/index.js +2 -0
- package/dist/src/lib/index.js.map +1 -0
- package/dist/src/lib/next/next.lib.js +2 -0
- package/dist/src/lib/next/next.lib.js.map +1 -0
- package/dist/src/lib/react/react.lib.js +16 -0
- package/dist/src/lib/react/react.lib.js.map +1 -0
- package/dist/src/lib/tw-styles.js +1956 -0
- package/dist/src/lib/tw-styles.js.map +1 -0
- package/dist/src/styles/index.js +2 -0
- package/dist/src/styles/index.js.map +1 -0
- package/dist/src/styles/tw.styles.js +2218 -0
- package/dist/src/styles/tw.styles.js.map +1 -0
- package/dist/src/wc-ui-app.js +88 -0
- package/dist/src/wc-ui-app.js.map +1 -0
- package/dist/sw.js +2 -0
- package/dist/sw.js.map +1 -0
- package/dist/test/wc-ui-app.test.js +18 -0
- package/dist/test/wc-ui-app.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/workbox-a523fd56.js +2 -0
- package/dist/workbox-a523fd56.js.map +1 -0
- package/index.html +18 -66
- package/package.json +42 -18
- package/rollup.config.js +25 -13
- package/src/assets/icons/arrows.icon.ts +20 -0
- package/src/assets/icons/index.ts +3 -0
- package/src/assets/icons/search.icon.ts +19 -0
- package/src/assets/icons/tick.icon.ts +20 -0
- package/src/chai-custom.d.ts +0 -0
- package/src/components/atoms/alert/alert-description.ts +15 -0
- package/src/components/atoms/alert/alert-title.ts +17 -0
- package/src/components/atoms/alert/alert.atom.ts +51 -0
- package/src/components/atoms/alert/alert.stories.ts +71 -0
- package/src/components/atoms/alert/alert.styles.ts +21 -0
- package/src/components/atoms/alert/alert.types.ts +1 -0
- package/src/components/atoms/badge/badge.atom.ts +40 -0
- package/src/components/atoms/badge/badge.stories.ts +118 -0
- package/src/components/atoms/badge/badge.style.ts +24 -0
- package/src/components/atoms/badge/badge.type.ts +7 -0
- package/src/components/atoms/button/button.atom.ts +22 -8
- package/src/components/atoms/button/button.stories.ts +177 -139
- package/src/components/atoms/card/card-content.ts +15 -0
- package/src/components/atoms/card/card-description.ts +15 -0
- package/src/components/atoms/card/card-footer.ts +15 -0
- package/src/components/atoms/card/card-header.ts +15 -0
- package/src/components/atoms/card/card-title.ts +15 -0
- package/src/components/atoms/card/card.atom.ts +31 -0
- package/src/components/atoms/card/card.stories.ts +149 -0
- package/src/components/atoms/checkbox/checkbox.atom.ts +30 -16
- package/src/components/atoms/checkbox/checkbox.stories.ts +292 -25
- package/src/components/atoms/checkbox/checkbox.style.ts +5 -0
- package/src/components/atoms/checkbox/checkbox.type.ts +24 -0
- package/src/components/atoms/combo-box/combo-box-input.ts +33 -0
- package/src/components/atoms/combo-box/combo-box-item.ts +59 -0
- package/src/components/atoms/combo-box/combo-box-list.ts +57 -0
- package/src/components/atoms/combo-box/combo-box.atom.ts +187 -0
- package/src/components/atoms/combo-box/combo-box.stories.ts +95 -0
- package/src/components/atoms/command-empty/command-empty.atom.ts +2 -2
- package/src/components/atoms/command-group/command-group.atom.ts +1 -1
- package/src/components/atoms/command-item/command-item.atom.ts +2 -2
- package/src/components/atoms/command-list/command-list.atom.ts +2 -2
- package/src/components/atoms/command-separator/command-separator.atom.ts +2 -2
- package/src/components/atoms/dialog/dialog-close.ts +50 -0
- package/src/components/atoms/dialog/dialog-content.ts +71 -0
- package/src/components/atoms/dialog/dialog-footer.ts +22 -0
- package/src/components/atoms/dialog/dialog-header.ts +36 -0
- package/src/components/atoms/dialog/dialog-overly.ts +20 -0
- package/src/components/atoms/dialog/dialog-trigger.ts +54 -0
- package/src/components/atoms/dialog/dialog.atom.ts +3 -226
- package/src/components/atoms/dialog/dialog.stories.ts +11 -4
- package/src/components/atoms/dropdownMenu/dropdown-menu-checkbox-Item.ts +106 -0
- package/src/components/atoms/dropdownMenu/dropdown-menu-content.ts +79 -0
- package/src/components/atoms/dropdownMenu/dropdown-menu-group.ts +60 -0
- package/src/components/atoms/dropdownMenu/dropdown-menu-item.ts +74 -0
- package/src/components/atoms/dropdownMenu/dropdown-menu-radio-item.ts +107 -0
- package/src/components/atoms/dropdownMenu/dropdown-menu-seperator.ts +44 -0
- package/src/components/atoms/dropdownMenu/dropdown-menu-shortcut.ts +17 -0
- package/src/components/atoms/dropdownMenu/dropdown-menu.atom.ts +84 -0
- package/src/components/atoms/dropdownMenu/dropdownMenu.stories.ts +220 -0
- package/src/components/atoms/dropdownMenu/dropdownMenu.style.ts +7 -0
- package/src/components/atoms/index.ts +3 -0
- package/src/components/atoms/input/input.atom.ts +64 -10
- package/src/components/atoms/input/input.stories.ts +426 -64
- package/src/components/atoms/input/input.styles.ts +2 -0
- package/src/components/atoms/input/input.type.ts +42 -8
- package/src/components/atoms/label/label.atom.ts +31 -7
- package/src/components/atoms/label/label.stories.ts +87 -3
- package/src/components/atoms/popover/popover-content.ts +58 -0
- package/src/components/atoms/popover/popover-trigger.ts +50 -0
- package/src/components/atoms/popover/popover.atom.ts +34 -0
- package/src/components/atoms/popover/popover.stories.ts +79 -0
- package/src/components/atoms/popover/popover.style.ts +25 -0
- package/src/components/atoms/popover/popover.types.ts +3 -0
- package/src/components/atoms/toggle/defs.ts +29 -0
- package/src/components/atoms/toggle/toggle.atom.ts +58 -0
- package/src/components/atoms/toggle/toggle.stories.ts +204 -0
- package/src/components/atoms/toggle/toggle.style.ts +22 -0
- package/src/components/molecules/command/command.molecules.ts +2 -2
- package/src/components/molecules/command-input/command-input.atom.ts +3 -3
- package/src/components/molecules/dropdownMenu/dropdownMenu.molecules.ts +0 -0
- package/src/globals.css +475 -66
- package/src/helpers/base-element.ts +79 -0
- package/src/helpers/index.ts +1 -0
- package/src/index.d.ts +1 -0
- package/src/index.ts +1 -0
- package/src/lib/react/react.lib.ts +18 -0
- package/src/lib/tw-styles.ts +1957 -0
- package/src/styles/tw.styles.ts +2051 -1699
- package/src/tailwind-lib.css +26 -6
- package/tailwind.config.js +174 -38
- package/tsconfig.json +6 -1
- package/src/components/popover.ts +0 -247
package/package.json
CHANGED
@@ -3,9 +3,16 @@
|
|
3
3
|
"description": "Webcomponent wc-ui following open-wc recommendations",
|
4
4
|
"license": "MIT",
|
5
5
|
"author": "wc-ui",
|
6
|
-
"version": "0.0.
|
6
|
+
"version": "0.0.4-beta",
|
7
7
|
"type": "module",
|
8
|
+
"main": "dist/[hash].js",
|
9
|
+
"types": "dist/index.d.ts",
|
8
10
|
"scripts": {
|
11
|
+
"release": "npm version $(semver $npm_package_version -i major) && npm publish --tag latest",
|
12
|
+
"release:minor": "npm version $(semver $npm_package_version -i minor) && npm publish --tag latest",
|
13
|
+
"release:patch": "npm version $(semver $npm_package_version -i patch) && npm publish --tag latest",
|
14
|
+
"release:beta": "npm version $(semver $npm_package_version -i prerelease --preid $(npm whoami) ) && npm publish --tag beta",
|
15
|
+
"dev": "rollup -c -w",
|
9
16
|
"clean": "rimraf dist",
|
10
17
|
"copy-files": "copyfiles -u 1 src/**/*.html src/**/*.css src/**/*.js dist/public/",
|
11
18
|
"lint": "eslint --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
|
@@ -13,40 +20,58 @@
|
|
13
20
|
"test": "tsc && wtr --coverage",
|
14
21
|
"test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\"",
|
15
22
|
"storybook": "storybook dev -p 6006",
|
16
|
-
"storybook
|
17
|
-
"build": "
|
23
|
+
"test-storybook": "test-storybook",
|
24
|
+
"storybook:build": "storybook build",
|
25
|
+
"build": "NODE_ENV=production rollup -c",
|
18
26
|
"start:build": "web-dev-server --root-dir dist --app-index index.html --open",
|
19
27
|
"analyze": "cem analyze --litelement",
|
20
28
|
"start": "npm run clean && tsc && npm run copy-files && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
|
21
|
-
"tw:watch": "concurrently \"tailwindcss -i ./src/tailwind-lib.css -o ./src/globals.css --watch\" \"twlit --input ./src/globals.css --output ./src/
|
29
|
+
"tw:watch": "concurrently \"tailwindcss -i ./src/tailwind-lib.css -o ./src/globals.css --watch\" \"twlit --input ./src/globals.css --output ./src/styles/tw.styles.ts \"",
|
30
|
+
"build-storybook": "storybook build"
|
22
31
|
},
|
23
32
|
"dependencies": {
|
33
|
+
"@lit-labs/react": "^1.2.0",
|
34
|
+
"@open-wc/lit-helpers": "^0.7.0",
|
24
35
|
"@storybook/addon-essentials": "^8.0.0",
|
25
36
|
"@storybook/addon-links": "^8.0.0",
|
26
37
|
"@storybook/web-components": "^8.0.0",
|
27
38
|
"@storybook/web-components-vite": "^8.0.0",
|
28
39
|
"class-variance-authority": "^0.7.0",
|
29
40
|
"clsx": "^2.1.0",
|
41
|
+
"husky": "^9.1.4",
|
30
42
|
"lit": "^3.1.2",
|
31
|
-
"
|
43
|
+
"playwright": "^1.47.1",
|
44
|
+
"react": "^18.3.1",
|
45
|
+
"storybook": "^8.3.4",
|
32
46
|
"tailwind-merge": "^2.2.1",
|
33
47
|
"tailwindcss-animate": "^1.0.7"
|
34
48
|
},
|
35
49
|
"devDependencies": {
|
36
50
|
"@babel/preset-env": "^7.16.4",
|
51
|
+
"@chromatic-com/storybook": "^1.9.0",
|
37
52
|
"@custom-elements-manifest/analyzer": "^0.4.17",
|
38
53
|
"@open-wc/building-rollup": "^2.0.2",
|
39
54
|
"@open-wc/eslint-config": "^9.2.1",
|
40
55
|
"@open-wc/testing": "^3.1.6",
|
41
|
-
"@rollup/plugin-babel": "^5.3.
|
42
|
-
"@rollup/plugin-
|
56
|
+
"@rollup/plugin-babel": "^5.3.1",
|
57
|
+
"@rollup/plugin-commonjs": "^28.0.1",
|
58
|
+
"@rollup/plugin-json": "^6.1.0",
|
59
|
+
"@rollup/plugin-node-resolve": "^13.3.0",
|
60
|
+
"@storybook/addon-interactions": "^8.2.9",
|
61
|
+
"@storybook/blocks": "^8.2.9",
|
43
62
|
"@storybook/builder-vite": "^8.0.0",
|
63
|
+
"@storybook/jest": "^0.2.3",
|
64
|
+
"@storybook/test": "^8.2.9",
|
65
|
+
"@storybook/test-runner": "^0.19.1",
|
66
|
+
"@storybook/testing-library": "^0.2.2",
|
67
|
+
"@testing-library/dom": "^10.4.0",
|
68
|
+
"@testing-library/jest-dom": "^6.4.8",
|
44
69
|
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
45
70
|
"@typescript-eslint/parser": "^5.48.0",
|
46
71
|
"@web/dev-server": "^0.1.34",
|
47
72
|
"@web/dev-server-storybook": "^0.5.4",
|
48
|
-
"@web/rollup-plugin-html": "^1.11.
|
49
|
-
"@web/rollup-plugin-import-meta-assets": "^1.0.
|
73
|
+
"@web/rollup-plugin-html": "^1.11.1",
|
74
|
+
"@web/rollup-plugin-import-meta-assets": "^1.0.8",
|
50
75
|
"@web/test-runner": "^0.14.0",
|
51
76
|
"babel-plugin-template-html-minifier": "^4.1.0",
|
52
77
|
"concurrently": "^5.3.0",
|
@@ -54,23 +79,27 @@
|
|
54
79
|
"deepmerge": "^4.2.2",
|
55
80
|
"eslint": "^8.31.0",
|
56
81
|
"eslint-config-prettier": "^8.3.0",
|
57
|
-
"
|
82
|
+
"eslint-plugin-storybook": "^0.8.0",
|
58
83
|
"lint-staged": "^10.5.4",
|
59
84
|
"prettier": "^2.4.1",
|
60
85
|
"rimraf": "^3.0.2",
|
61
|
-
"rollup": "^2.
|
86
|
+
"rollup": "^2.79.2",
|
62
87
|
"rollup-plugin-esbuild": "^5.0.0",
|
88
|
+
"rollup-plugin-livereload": "^2.0.5",
|
89
|
+
"rollup-plugin-serve": "^1.1.1",
|
90
|
+
"rollup-plugin-terser": "^7.0.2",
|
63
91
|
"rollup-plugin-workbox": "^6.2.0",
|
64
92
|
"tailwindcss": "^3.4.1",
|
65
93
|
"tslib": "^2.3.1",
|
66
94
|
"twlit": "^0.0.1-alpha.37",
|
67
|
-
"typescript": "^5.
|
95
|
+
"typescript": "^5.6.3"
|
68
96
|
},
|
69
97
|
"eslintConfig": {
|
70
98
|
"parser": "@typescript-eslint/parser",
|
71
99
|
"extends": [
|
72
100
|
"@open-wc",
|
73
|
-
"prettier"
|
101
|
+
"prettier",
|
102
|
+
"plugin:storybook/recommended"
|
74
103
|
],
|
75
104
|
"plugins": [
|
76
105
|
"@typescript-eslint"
|
@@ -102,11 +131,6 @@
|
|
102
131
|
"singleQuote": true,
|
103
132
|
"arrowParens": "avoid"
|
104
133
|
},
|
105
|
-
"husky": {
|
106
|
-
"hooks": {
|
107
|
-
"pre-commit": "lint-staged"
|
108
|
-
}
|
109
|
-
},
|
110
134
|
"lint-staged": {
|
111
135
|
"*.ts": [
|
112
136
|
"eslint --fix",
|
package/rollup.config.js
CHANGED
@@ -1,13 +1,19 @@
|
|
1
1
|
import nodeResolve from '@rollup/plugin-node-resolve';
|
2
|
+
import commonjs from '@rollup/plugin-commonjs';
|
2
3
|
import babel from '@rollup/plugin-babel';
|
3
4
|
import html from '@web/rollup-plugin-html';
|
4
5
|
import { importMetaAssets } from '@web/rollup-plugin-import-meta-assets';
|
5
6
|
import esbuild from 'rollup-plugin-esbuild';
|
6
7
|
import { generateSW } from 'rollup-plugin-workbox';
|
8
|
+
import serve from 'rollup-plugin-serve';
|
9
|
+
import livereload from 'rollup-plugin-livereload';
|
10
|
+
import { terser } from 'rollup-plugin-terser';
|
7
11
|
import path from 'path';
|
8
12
|
|
13
|
+
const isProd = process.env.NODE_ENV === 'production';
|
14
|
+
|
9
15
|
export default {
|
10
|
-
input: 'index.
|
16
|
+
input: 'src/index.ts', // Entry file for TypeScript
|
11
17
|
output: {
|
12
18
|
entryFileNames: '[hash].js',
|
13
19
|
chunkFileNames: '[hash].js',
|
@@ -15,26 +21,23 @@ export default {
|
|
15
21
|
format: 'es',
|
16
22
|
dir: 'dist',
|
17
23
|
},
|
18
|
-
preserveEntrySignatures: false,
|
19
|
-
|
20
24
|
plugins: [
|
21
|
-
/** Enable using HTML as rollup entrypoint */
|
22
25
|
html({
|
23
26
|
minify: true,
|
24
27
|
injectServiceWorker: true,
|
25
28
|
serviceWorkerPath: 'dist/sw.js',
|
26
29
|
}),
|
27
|
-
/** Resolve bare module imports */
|
28
30
|
nodeResolve(),
|
29
|
-
|
31
|
+
commonjs(),
|
30
32
|
esbuild({
|
31
33
|
minify: true,
|
32
34
|
target: ['chrome64', 'firefox67', 'safari11.1'],
|
33
|
-
|
34
|
-
|
35
|
+
include: /\.ts$/,
|
36
|
+
}),
|
35
37
|
importMetaAssets(),
|
36
|
-
/** Minify html and css tagged template literals */
|
37
38
|
babel({
|
39
|
+
babelHelpers: 'bundled',
|
40
|
+
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
38
41
|
plugins: [
|
39
42
|
[
|
40
43
|
require.resolve('babel-plugin-template-html-minifier'),
|
@@ -53,19 +56,28 @@ export default {
|
|
53
56
|
],
|
54
57
|
],
|
55
58
|
}),
|
56
|
-
/** Create and inject a service worker */
|
57
59
|
generateSW({
|
58
60
|
globIgnores: ['polyfills/*.js', 'nomodule-*.js'],
|
59
61
|
navigateFallback: '/index.html',
|
60
|
-
// where to output the generated sw
|
61
62
|
swDest: path.join('dist', 'sw.js'),
|
62
|
-
// directory to match patterns against to be precached
|
63
63
|
globDirectory: path.join('dist'),
|
64
|
-
// cache any html js and css by default
|
65
64
|
globPatterns: ['**/*.{html,js,css,webmanifest}'],
|
66
65
|
skipWaiting: true,
|
67
66
|
clientsClaim: true,
|
68
67
|
runtimeCaching: [{ urlPattern: 'polyfills/*.js', handler: 'CacheFirst' }],
|
69
68
|
}),
|
69
|
+
!isProd &&
|
70
|
+
serve({
|
71
|
+
open: true,
|
72
|
+
contentBase: 'dist',
|
73
|
+
host: 'localhost',
|
74
|
+
port: 3000,
|
75
|
+
historyApiFallback: true, // Ensures SPA routing works
|
76
|
+
}),
|
77
|
+
!isProd && livereload('dist'),
|
78
|
+
isProd && terser(),
|
70
79
|
],
|
80
|
+
watch: {
|
81
|
+
clearScreen: false,
|
82
|
+
},
|
71
83
|
};
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { svg } from 'lit';
|
2
|
+
|
3
|
+
export function arrowsIcon() {
|
4
|
+
return svg` <svg
|
5
|
+
class="shrink-0 size-3.5 text-gray-500 dark:text-neutral-500"
|
6
|
+
xmlns="http://www.w3.org/2000/svg"
|
7
|
+
width="24"
|
8
|
+
height="24"
|
9
|
+
viewBox="0 0 24 24"
|
10
|
+
fill="none"
|
11
|
+
stroke="currentColor"
|
12
|
+
stroke-width="2"
|
13
|
+
stroke-linecap="round"
|
14
|
+
stroke-linejoin="round"
|
15
|
+
>
|
16
|
+
<path d="m7 15 5 5 5-5"></path>
|
17
|
+
<path d="m7 9 5-5 5 5"></path>
|
18
|
+
</svg>
|
19
|
+
`;
|
20
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { svg } from 'lit';
|
2
|
+
|
3
|
+
export function searchIcon() {
|
4
|
+
return svg` <svg
|
5
|
+
xmlns="http://www.w3.org/2000/svg"
|
6
|
+
width = "24"
|
7
|
+
height = "24"
|
8
|
+
viewBox = "0 0 24 24"
|
9
|
+
fill = "none"
|
10
|
+
stroke = "currentColor"
|
11
|
+
stroke-width="2"
|
12
|
+
stroke-linecap="round"
|
13
|
+
stroke-linejoin="round"
|
14
|
+
class="lucide lucide-search h-4 w-4 shrink-0 opacity-50" >
|
15
|
+
<circle cx="11" cy = "11" r = "8" > </circle>
|
16
|
+
<path d="m21 21-4.3-4.3"></path >
|
17
|
+
</svg>
|
18
|
+
`;
|
19
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { svg } from 'lit';
|
2
|
+
|
3
|
+
export function tickIcon() {
|
4
|
+
return svg`
|
5
|
+
<svg
|
6
|
+
class="shrink-0 size-3.5 text-blue-600 dark:text-blue-500"
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
8
|
+
width="24"
|
9
|
+
height="24"
|
10
|
+
viewBox="0 0 24 24"
|
11
|
+
fill="none"
|
12
|
+
stroke="currentColor"
|
13
|
+
stroke-width="2"
|
14
|
+
stroke-linecap="round"
|
15
|
+
stroke-linejoin="round"
|
16
|
+
>
|
17
|
+
<path d="M20 6 9 17l-5-5"></path>
|
18
|
+
</svg>
|
19
|
+
`;
|
20
|
+
}
|
File without changes
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
2
|
+
import { customElement } from 'lit/decorators.js';
|
3
|
+
|
4
|
+
@customElement('rtg-alert-description')
|
5
|
+
export class AlertDescription extends LitElement {
|
6
|
+
static styles = css`
|
7
|
+
:host {
|
8
|
+
display: block;
|
9
|
+
}
|
10
|
+
`;
|
11
|
+
|
12
|
+
render() {
|
13
|
+
return html`<slot></slot>`;
|
14
|
+
}
|
15
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
2
|
+
import { customElement } from 'lit/decorators.js';
|
3
|
+
|
4
|
+
@customElement('rtg-alert-title')
|
5
|
+
export class AlertTitle extends LitElement {
|
6
|
+
static styles = css`
|
7
|
+
:host {
|
8
|
+
display: block;
|
9
|
+
font-weight: bold;
|
10
|
+
margin-bottom: 0.5rem;
|
11
|
+
}
|
12
|
+
`;
|
13
|
+
|
14
|
+
render() {
|
15
|
+
return html`<slot></slot>`;
|
16
|
+
}
|
17
|
+
}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
2
|
+
import { property } from 'lit/decorators.js';
|
3
|
+
import { customElement } from 'lit/decorators.js';
|
4
|
+
import { alertStyle } from './alert.styles';
|
5
|
+
import { TWStyles } from '../../../styles';
|
6
|
+
import { AlertTitle } from './alert-title';
|
7
|
+
import { AlertDescription } from './alert-description';
|
8
|
+
|
9
|
+
@customElement('rtg-alert')
|
10
|
+
class Alert extends LitElement {
|
11
|
+
static styles = [
|
12
|
+
css`
|
13
|
+
:host {
|
14
|
+
display: block;
|
15
|
+
margin-bottom: 1rem;
|
16
|
+
}
|
17
|
+
.alert {
|
18
|
+
border: 1px solid transparent;
|
19
|
+
border-radius: 0.375rem;
|
20
|
+
}
|
21
|
+
.title {
|
22
|
+
font-weight: bold;
|
23
|
+
margin-bottom: 0.5rem;
|
24
|
+
}
|
25
|
+
`,
|
26
|
+
TWStyles,
|
27
|
+
];
|
28
|
+
static alertVairants = alertStyle;
|
29
|
+
|
30
|
+
@property({ type: String }) variant:
|
31
|
+
| 'success'
|
32
|
+
| 'error'
|
33
|
+
| 'warning'
|
34
|
+
| 'info' = 'info';
|
35
|
+
@property({ type: String }) size: 'default' | 'large' | 'small' = 'default';
|
36
|
+
|
37
|
+
private get alertClasses() {
|
38
|
+
return alertStyle({ variant: this.variant, size: this.size });
|
39
|
+
}
|
40
|
+
|
41
|
+
render() {
|
42
|
+
return html`
|
43
|
+
<div class="alert ${this.alertClasses}">
|
44
|
+
<slot name="title"></slot>
|
45
|
+
<slot name="description"></slot>
|
46
|
+
</div>
|
47
|
+
`;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
export { Alert, AlertDescription, AlertTitle };
|
@@ -0,0 +1,71 @@
|
|
1
|
+
import { html } from 'lit';
|
2
|
+
import { Meta, StoryObj } from '@storybook/web-components';
|
3
|
+
import './alert.atom';
|
4
|
+
import { Alert as AlertComponent } from './alert.atom';
|
5
|
+
|
6
|
+
import { expect, within, waitFor } from '@storybook/test';
|
7
|
+
|
8
|
+
const testAlertBehavior = async (args: any, canvasElement: any) => {
|
9
|
+
const canvas = within(canvasElement);
|
10
|
+
// 1. Test:Alert exits
|
11
|
+
const alert = await waitFor(() => canvas.getByTestId('alert-id'));
|
12
|
+
|
13
|
+
//2. Test: Alert should have correct variant
|
14
|
+
expect(alert).toHaveAttribute('variant', args.variant);
|
15
|
+
|
16
|
+
//3. Test: Alert should have correct size
|
17
|
+
expect(alert).toHaveAttribute('size', args.size);
|
18
|
+
if (alert.shadowRoot) {
|
19
|
+
const innerDiv = alert.shadowRoot.querySelector('div');
|
20
|
+
//4. Test: Alert should have correct class
|
21
|
+
const expectedClasses = AlertComponent.alertVairants({
|
22
|
+
variant: args.variant,
|
23
|
+
size: args.size,
|
24
|
+
});
|
25
|
+
expect(innerDiv).toHaveClass(`alert ${expectedClasses}`);
|
26
|
+
}
|
27
|
+
};
|
28
|
+
|
29
|
+
export default {
|
30
|
+
title: 'components/atoms/alert',
|
31
|
+
tags: ['autodocs'],
|
32
|
+
|
33
|
+
argTypes: {
|
34
|
+
variant: {
|
35
|
+
control: 'select',
|
36
|
+
options: ['success', 'error', 'warning', 'info'],
|
37
|
+
},
|
38
|
+
size: {
|
39
|
+
control: 'select',
|
40
|
+
options: ['default', 'large', 'small'],
|
41
|
+
},
|
42
|
+
title: {
|
43
|
+
control: 'text',
|
44
|
+
},
|
45
|
+
message: {
|
46
|
+
control: 'text',
|
47
|
+
},
|
48
|
+
},
|
49
|
+
} as Meta;
|
50
|
+
|
51
|
+
type Story = StoryObj;
|
52
|
+
|
53
|
+
export const AlertStory: Story = {
|
54
|
+
args: {
|
55
|
+
variant: 'info',
|
56
|
+
size: 'default',
|
57
|
+
title: 'Information',
|
58
|
+
message: 'This is an information message.',
|
59
|
+
},
|
60
|
+
render: ({ variant, size, message, title }) => html`
|
61
|
+
<rtg-alert data-testid="alert-id" variant=${variant} size=${size}>
|
62
|
+
<rtg-alert-title slot="title">${title}</rtg-alert-title>
|
63
|
+
<rtg-alert-description slot="description"
|
64
|
+
>${message}</rtg-alert-description
|
65
|
+
>
|
66
|
+
</rtg-alert>
|
67
|
+
`,
|
68
|
+
play: async ({ args, canvasElement }) => {
|
69
|
+
await testAlertBehavior(args, canvasElement);
|
70
|
+
},
|
71
|
+
};
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { cva } from 'class-variance-authority';
|
2
|
+
|
3
|
+
export const alertStyle = cva('p-4 rounded-sm text-sm font-medium', {
|
4
|
+
variants: {
|
5
|
+
variant: {
|
6
|
+
success: 'bg-green-100 text-green-800 border-green-200',
|
7
|
+
error: 'bg-red-100 text-red-800 border-red-200',
|
8
|
+
warning: 'bg-yellow-100 text-yellow-800 border-yellow-200',
|
9
|
+
info: 'bg-blue-100 text-blue-800 border-blue-200',
|
10
|
+
},
|
11
|
+
size: {
|
12
|
+
small: 'text-sm',
|
13
|
+
default: 'text-base',
|
14
|
+
large: 'text-xl',
|
15
|
+
},
|
16
|
+
},
|
17
|
+
defaultVariants: {
|
18
|
+
variant: 'info',
|
19
|
+
size: 'default',
|
20
|
+
},
|
21
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import { html, css } from 'lit';
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
3
|
+
import { cn, BaseElement } from '../../../helpers';
|
4
|
+
import { badgeStyle } from './badge.style';
|
5
|
+
import { BadgeVariant } from './badge.type';
|
6
|
+
import { TWStyles } from '../../../styles';
|
7
|
+
import { spread } from '@open-wc/lit-helpers';
|
8
|
+
|
9
|
+
@customElement('rtg-badge')
|
10
|
+
export class Badge extends BaseElement {
|
11
|
+
static badgeVariants = badgeStyle;
|
12
|
+
|
13
|
+
@property({ type: String }) variant: BadgeVariant = 'default';
|
14
|
+
|
15
|
+
static styles = [css``, TWStyles];
|
16
|
+
|
17
|
+
protected getAttributesToExclude(): string[] {
|
18
|
+
return ['variant'];
|
19
|
+
}
|
20
|
+
|
21
|
+
render() {
|
22
|
+
const attributes = this.getFilteredAttributes();
|
23
|
+
|
24
|
+
return html`
|
25
|
+
<div
|
26
|
+
id="rtg-badge-id"
|
27
|
+
class="
|
28
|
+
${cn(
|
29
|
+
Badge.badgeVariants({
|
30
|
+
variant: this.variant,
|
31
|
+
className: this.className,
|
32
|
+
})
|
33
|
+
)}"
|
34
|
+
${spread(attributes)}
|
35
|
+
>
|
36
|
+
<slot></slot>
|
37
|
+
</div>
|
38
|
+
`;
|
39
|
+
}
|
40
|
+
}
|
@@ -0,0 +1,118 @@
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/web-components';
|
2
|
+
import { html } from 'lit';
|
3
|
+
import './badge.atom';
|
4
|
+
import { expect, within, waitFor, userEvent } from '@storybook/test';
|
5
|
+
|
6
|
+
const meta: Meta = {
|
7
|
+
component: 'components/badge',
|
8
|
+
tags: ['autodocs'],
|
9
|
+
argTypes: {
|
10
|
+
variant: {
|
11
|
+
control: {
|
12
|
+
type: 'select',
|
13
|
+
},
|
14
|
+
description: 'Choose the visual style of the badge.',
|
15
|
+
table: {
|
16
|
+
defaultValue: { summary: 'default' },
|
17
|
+
},
|
18
|
+
options: [
|
19
|
+
'default',
|
20
|
+
'destructive',
|
21
|
+
'outline',
|
22
|
+
'secondary',
|
23
|
+
'ghost',
|
24
|
+
'link',
|
25
|
+
],
|
26
|
+
},
|
27
|
+
label: {
|
28
|
+
control: 'text',
|
29
|
+
description:
|
30
|
+
' The text displayed on the button. Can also be a function returning the label dynamically.',
|
31
|
+
table: {
|
32
|
+
defaultValue: { summary: '' },
|
33
|
+
},
|
34
|
+
},
|
35
|
+
},
|
36
|
+
};
|
37
|
+
|
38
|
+
const testBadgeBehavior = async (args: any, canvasElement: any) => {
|
39
|
+
const canvas = within(canvasElement);
|
40
|
+
const badge = await waitFor(() => canvas.getByTestId('badge-id'));
|
41
|
+
expect(badge).toBeVisible();
|
42
|
+
if (badge.shadowRoot) {
|
43
|
+
const badgeItem = await badge.shadowRoot.getElementById('rtg-badge-id');
|
44
|
+
if (badgeItem) {
|
45
|
+
expect(badgeItem).toHaveClass(
|
46
|
+
'inline-flex items-center border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent rounded-full'
|
47
|
+
);
|
48
|
+
switch (args.variant) {
|
49
|
+
case 'default':
|
50
|
+
expect(badgeItem).toHaveClass('bg-primary');
|
51
|
+
expect(badgeItem).toHaveClass('text-primary-foreground');
|
52
|
+
break;
|
53
|
+
case 'destructive':
|
54
|
+
expect(badgeItem).toHaveClass('bg-destructive');
|
55
|
+
expect(badgeItem).toHaveClass('text-destructive-foreground');
|
56
|
+
break;
|
57
|
+
case 'outline':
|
58
|
+
expect(badgeItem).toHaveClass('border');
|
59
|
+
expect(badgeItem).toHaveClass('border-input');
|
60
|
+
expect(badgeItem).toHaveClass('bg-background');
|
61
|
+
expect(badgeItem).toHaveClass('shadow-sm');
|
62
|
+
expect(badgeItem).toHaveClass('hover:bg-accent');
|
63
|
+
expect(badgeItem).toHaveClass('hover:text-accent-foreground');
|
64
|
+
break;
|
65
|
+
case 'secondary':
|
66
|
+
expect(badgeItem).toHaveClass('bg-secondary');
|
67
|
+
expect(badgeItem).toHaveClass('text-secondary-foreground');
|
68
|
+
break;
|
69
|
+
case 'ghost':
|
70
|
+
expect(badgeItem).toHaveClass('hover:bg-accent');
|
71
|
+
expect(badgeItem).toHaveClass('hover:text-accent-foreground');
|
72
|
+
break;
|
73
|
+
case 'link':
|
74
|
+
expect(badgeItem).toHaveClass('text-primary');
|
75
|
+
expect(badgeItem).toHaveClass('underline');
|
76
|
+
break;
|
77
|
+
}
|
78
|
+
await userEvent.hover(badgeItem);
|
79
|
+
switch (args.variant) {
|
80
|
+
case 'outline':
|
81
|
+
expect(badgeItem).toHaveClass('hover:bg-accent');
|
82
|
+
expect(badgeItem).toHaveClass('hover:text-accent-foreground');
|
83
|
+
break;
|
84
|
+
case 'ghost':
|
85
|
+
expect(badgeItem).toHaveClass('bg-accent');
|
86
|
+
expect(badgeItem).toHaveClass('text-accent-foreground');
|
87
|
+
break;
|
88
|
+
case 'link':
|
89
|
+
expect(badgeItem).toHaveClass('text-primary');
|
90
|
+
expect(badgeItem).toHaveClass('underline');
|
91
|
+
break;
|
92
|
+
default:
|
93
|
+
break;
|
94
|
+
}
|
95
|
+
const focusedBadge = canvas.getByTestId('badge-id');
|
96
|
+
console.log(focusedBadge.textContent, args.label);
|
97
|
+
expect(focusedBadge.textContent).toContain(args.label);
|
98
|
+
}
|
99
|
+
}
|
100
|
+
};
|
101
|
+
|
102
|
+
export default meta;
|
103
|
+
type Story = StoryObj;
|
104
|
+
|
105
|
+
export const Badge: Story = {
|
106
|
+
args: {
|
107
|
+
variant: 'default',
|
108
|
+
label: 'badge',
|
109
|
+
},
|
110
|
+
render: ({ variant, label }) => html`
|
111
|
+
<rtg-badge data-testid="badge-id" variant=${variant}>
|
112
|
+
<p>${label}</p>
|
113
|
+
</rtg-badge>
|
114
|
+
`,
|
115
|
+
play: async ({ args, canvasElement }) => {
|
116
|
+
await testBadgeBehavior(args, canvasElement);
|
117
|
+
},
|
118
|
+
};
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { cva } from 'class-variance-authority';
|
2
|
+
|
3
|
+
export const badgeStyle = cva(
|
4
|
+
'inline-flex items-center border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent rounded-full',
|
5
|
+
{
|
6
|
+
variants: {
|
7
|
+
variant: {
|
8
|
+
default:
|
9
|
+
'bg-primary text-primary-foreground shadow hover:bg-primary/90',
|
10
|
+
destructive:
|
11
|
+
'bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90',
|
12
|
+
outline:
|
13
|
+
'border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground',
|
14
|
+
secondary:
|
15
|
+
'bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80',
|
16
|
+
ghost: 'hover:bg-accent hover:text-accent-foreground',
|
17
|
+
link: 'text-primary underline-offset-4 hover:underline',
|
18
|
+
},
|
19
|
+
},
|
20
|
+
defaultVariants: {
|
21
|
+
variant: 'default',
|
22
|
+
},
|
23
|
+
}
|
24
|
+
);
|