revotech-ui-kit 0.0.11 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.ts +1 -0
- package/dist/rollup-plugin-html-noop.js +1 -0
- package/dist/sw.js +2 -0
- package/dist/sw.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/workbox-a523fd56.js +2 -0
- package/dist/workbox-a523fd56.js.map +1 -0
- package/package.json +23 -17
- package/dist/revotech-ui-kit.cjs +0 -2293
- package/dist/revotech-ui-kit.js +0 -5608
- package/dist/src/assets/icons/arrows.icon.d.ts +0 -1
- package/dist/src/assets/icons/arrows.icon.js +0 -20
- package/dist/src/assets/icons/arrows.icon.js.map +0 -1
- package/dist/src/assets/icons/index.d.ts +0 -3
- package/dist/src/assets/icons/index.js +0 -4
- package/dist/src/assets/icons/index.js.map +0 -1
- package/dist/src/assets/icons/search.icon.d.ts +0 -1
- package/dist/src/assets/icons/search.icon.js +0 -19
- package/dist/src/assets/icons/search.icon.js.map +0 -1
- package/dist/src/assets/icons/tick.icon.d.ts +0 -1
- package/dist/src/assets/icons/tick.icon.js +0 -20
- package/dist/src/assets/icons/tick.icon.js.map +0 -1
- package/dist/src/components/atoms/alert/alert-description.d.ts +0 -5
- package/dist/src/components/atoms/alert/alert-description.js +0 -18
- package/dist/src/components/atoms/alert/alert-description.js.map +0 -1
- package/dist/src/components/atoms/alert/alert-title.d.ts +0 -5
- package/dist/src/components/atoms/alert/alert-title.js +0 -20
- package/dist/src/components/atoms/alert/alert-title.js.map +0 -1
- package/dist/src/components/atoms/alert/alert.atom.d.ts +0 -15
- package/dist/src/components/atoms/alert/alert.atom.js +0 -55
- package/dist/src/components/atoms/alert/alert.atom.js.map +0 -1
- package/dist/src/components/atoms/alert/alert.stories.d.ts +0 -6
- package/dist/src/components/atoms/alert/alert.stories.js +0 -62
- package/dist/src/components/atoms/alert/alert.stories.js.map +0 -1
- package/dist/src/components/atoms/alert/alert.styles.d.ts +0 -4
- package/dist/src/components/atoms/alert/alert.styles.js +0 -21
- package/dist/src/components/atoms/alert/alert.styles.js.map +0 -1
- package/dist/src/components/atoms/alert/alert.types.d.ts +0 -1
- package/dist/src/components/atoms/alert/alert.types.js +0 -2
- package/dist/src/components/atoms/alert/alert.types.js.map +0 -1
- package/dist/src/components/atoms/badge/badge.atom.d.ts +0 -16
- package/dist/src/components/atoms/badge/badge.atom.js +0 -43
- package/dist/src/components/atoms/badge/badge.atom.js.map +0 -1
- package/dist/src/components/atoms/badge/badge.stories.d.ts +0 -6
- package/dist/src/components/atoms/badge/badge.stories.js +0 -110
- package/dist/src/components/atoms/badge/badge.stories.js.map +0 -1
- package/dist/src/components/atoms/badge/badge.style.d.ts +0 -3
- package/dist/src/components/atoms/badge/badge.style.js +0 -17
- package/dist/src/components/atoms/badge/badge.style.js.map +0 -1
- package/dist/src/components/atoms/badge/badge.type.d.ts +0 -1
- package/dist/src/components/atoms/badge/badge.type.js +0 -2
- package/dist/src/components/atoms/badge/badge.type.js.map +0 -1
- package/dist/src/components/atoms/button/button.atom.d.ts +0 -22
- package/dist/src/components/atoms/button/button.atom.js +0 -67
- package/dist/src/components/atoms/button/button.atom.js.map +0 -1
- package/dist/src/components/atoms/button/button.stories.d.ts +0 -6
- package/dist/src/components/atoms/button/button.stories.js +0 -204
- package/dist/src/components/atoms/button/button.stories.js.map +0 -1
- package/dist/src/components/atoms/button/button.style.d.ts +0 -4
- package/dist/src/components/atoms/button/button.style.js +0 -24
- package/dist/src/components/atoms/button/button.style.js.map +0 -1
- package/dist/src/components/atoms/button/button.type.d.ts +0 -3
- package/dist/src/components/atoms/button/button.type.js +0 -2
- package/dist/src/components/atoms/button/button.type.js.map +0 -1
- package/dist/src/components/atoms/card/card-content.d.ts +0 -5
- package/dist/src/components/atoms/card/card-content.js +0 -17
- package/dist/src/components/atoms/card/card-content.js.map +0 -1
- package/dist/src/components/atoms/card/card-description.d.ts +0 -5
- package/dist/src/components/atoms/card/card-description.js +0 -17
- package/dist/src/components/atoms/card/card-description.js.map +0 -1
- package/dist/src/components/atoms/card/card-footer.d.ts +0 -5
- package/dist/src/components/atoms/card/card-footer.js +0 -17
- package/dist/src/components/atoms/card/card-footer.js.map +0 -1
- package/dist/src/components/atoms/card/card-header.d.ts +0 -5
- package/dist/src/components/atoms/card/card-header.js +0 -17
- package/dist/src/components/atoms/card/card-header.js.map +0 -1
- package/dist/src/components/atoms/card/card-title.d.ts +0 -5
- package/dist/src/components/atoms/card/card-title.js +0 -17
- package/dist/src/components/atoms/card/card-title.js.map +0 -1
- package/dist/src/components/atoms/card/card.atom.d.ts +0 -11
- package/dist/src/components/atoms/card/card.atom.js +0 -25
- package/dist/src/components/atoms/card/card.atom.js.map +0 -1
- package/dist/src/components/atoms/card/card.stories.d.ts +0 -6
- package/dist/src/components/atoms/card/card.stories.js +0 -136
- package/dist/src/components/atoms/card/card.stories.js.map +0 -1
- package/dist/src/components/atoms/checkbox/checkbox.atom.d.ts +0 -13
- package/dist/src/components/atoms/checkbox/checkbox.atom.js +0 -87
- package/dist/src/components/atoms/checkbox/checkbox.atom.js.map +0 -1
- package/dist/src/components/atoms/checkbox/checkbox.stories.d.ts +0 -8
- package/dist/src/components/atoms/checkbox/checkbox.stories.js +0 -244
- package/dist/src/components/atoms/checkbox/checkbox.stories.js.map +0 -1
- package/dist/src/components/atoms/checkbox/checkbox.style.d.ts +0 -2
- package/dist/src/components/atoms/checkbox/checkbox.style.js +0 -3
- package/dist/src/components/atoms/checkbox/checkbox.style.js.map +0 -1
- package/dist/src/components/atoms/checkbox/checkbox.type.d.ts +0 -21
- package/dist/src/components/atoms/checkbox/checkbox.type.js +0 -2
- package/dist/src/components/atoms/checkbox/checkbox.type.js.map +0 -1
- package/dist/src/components/atoms/combo-box/combo-box-input.d.ts +0 -8
- package/dist/src/components/atoms/combo-box/combo-box-input.js +0 -47
- package/dist/src/components/atoms/combo-box/combo-box-input.js.map +0 -1
- package/dist/src/components/atoms/combo-box/combo-box-item.d.ts +0 -12
- package/dist/src/components/atoms/combo-box/combo-box-item.js +0 -85
- package/dist/src/components/atoms/combo-box/combo-box-item.js.map +0 -1
- package/dist/src/components/atoms/combo-box/combo-box-list.d.ts +0 -9
- package/dist/src/components/atoms/combo-box/combo-box-list.js +0 -67
- package/dist/src/components/atoms/combo-box/combo-box-list.js.map +0 -1
- package/dist/src/components/atoms/combo-box/combo-box.atom.d.ts +0 -23
- package/dist/src/components/atoms/combo-box/combo-box.atom.js +0 -199
- package/dist/src/components/atoms/combo-box/combo-box.atom.js.map +0 -1
- package/dist/src/components/atoms/combo-box/combo-box.stories.d.ts +0 -9
- package/dist/src/components/atoms/combo-box/combo-box.stories.js +0 -86
- package/dist/src/components/atoms/combo-box/combo-box.stories.js.map +0 -1
- package/dist/src/components/atoms/command-empty/command-empty.atom.d.ts +0 -9
- package/dist/src/components/atoms/command-empty/command-empty.atom.js +0 -53
- package/dist/src/components/atoms/command-empty/command-empty.atom.js.map +0 -1
- package/dist/src/components/atoms/command-group/command-group.atom.d.ts +0 -10
- package/dist/src/components/atoms/command-group/command-group.atom.js +0 -70
- package/dist/src/components/atoms/command-group/command-group.atom.js.map +0 -1
- package/dist/src/components/atoms/command-item/command-item.atom.d.ts +0 -12
- package/dist/src/components/atoms/command-item/command-item.atom.js +0 -78
- package/dist/src/components/atoms/command-item/command-item.atom.js.map +0 -1
- package/dist/src/components/atoms/command-list/command-list.atom.d.ts +0 -6
- package/dist/src/components/atoms/command-list/command-list.atom.js +0 -35
- package/dist/src/components/atoms/command-list/command-list.atom.js.map +0 -1
- package/dist/src/components/atoms/command-separator/command-separator.atom.d.ts +0 -9
- package/dist/src/components/atoms/command-separator/command-separator.atom.js +0 -51
- package/dist/src/components/atoms/command-separator/command-separator.atom.js.map +0 -1
- package/dist/src/components/atoms/dialog/dialog-close.d.ts +0 -7
- package/dist/src/components/atoms/dialog/dialog-close.js +0 -46
- package/dist/src/components/atoms/dialog/dialog-close.js.map +0 -1
- package/dist/src/components/atoms/dialog/dialog-content.d.ts +0 -8
- package/dist/src/components/atoms/dialog/dialog-content.js +0 -72
- package/dist/src/components/atoms/dialog/dialog-content.js.map +0 -1
- package/dist/src/components/atoms/dialog/dialog-footer.d.ts +0 -5
- package/dist/src/components/atoms/dialog/dialog-footer.js +0 -22
- package/dist/src/components/atoms/dialog/dialog-footer.js.map +0 -1
- package/dist/src/components/atoms/dialog/dialog-header.d.ts +0 -7
- package/dist/src/components/atoms/dialog/dialog-header.js +0 -40
- package/dist/src/components/atoms/dialog/dialog-header.js.map +0 -1
- package/dist/src/components/atoms/dialog/dialog-overly.d.ts +0 -5
- package/dist/src/components/atoms/dialog/dialog-overly.js +0 -20
- package/dist/src/components/atoms/dialog/dialog-overly.js.map +0 -1
- package/dist/src/components/atoms/dialog/dialog-trigger.d.ts +0 -8
- package/dist/src/components/atoms/dialog/dialog-trigger.js +0 -53
- package/dist/src/components/atoms/dialog/dialog-trigger.js.map +0 -1
- package/dist/src/components/atoms/dialog/dialog.atom.d.ts +0 -8
- package/dist/src/components/atoms/dialog/dialog.atom.js +0 -78
- package/dist/src/components/atoms/dialog/dialog.atom.js.map +0 -1
- package/dist/src/components/atoms/dialog/dialog.stories.d.ts +0 -16
- package/dist/src/components/atoms/dialog/dialog.stories.js +0 -88
- package/dist/src/components/atoms/dialog/dialog.stories.js.map +0 -1
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-checkbox-Item.d.ts +0 -15
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-checkbox-Item.js +0 -115
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-checkbox-Item.js.map +0 -1
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-content.d.ts +0 -13
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-content.js +0 -80
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-content.js.map +0 -1
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-group.d.ts +0 -10
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-group.js +0 -70
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-group.js.map +0 -1
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-item.d.ts +0 -12
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-item.js +0 -78
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-item.js.map +0 -1
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-radio-item.d.ts +0 -15
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-radio-item.js +0 -116
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-radio-item.js.map +0 -1
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-seperator.d.ts +0 -9
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-seperator.js +0 -51
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-seperator.js.map +0 -1
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-shortcut.d.ts +0 -5
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-shortcut.js +0 -20
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu-shortcut.js.map +0 -1
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu.atom.d.ts +0 -14
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu.atom.js +0 -77
- package/dist/src/components/atoms/dropdownMenu/dropdown-menu.atom.js.map +0 -1
- package/dist/src/components/atoms/dropdownMenu/dropdownMenu.stories.d.ts +0 -15
- package/dist/src/components/atoms/dropdownMenu/dropdownMenu.stories.js +0 -211
- package/dist/src/components/atoms/dropdownMenu/dropdownMenu.stories.js.map +0 -1
- package/dist/src/components/atoms/dropdownMenu/dropdownMenu.style.d.ts +0 -2
- package/dist/src/components/atoms/dropdownMenu/dropdownMenu.style.js +0 -4
- package/dist/src/components/atoms/dropdownMenu/dropdownMenu.style.js.map +0 -1
- package/dist/src/components/atoms/index.d.ts +0 -13
- package/dist/src/components/atoms/index.js +0 -14
- package/dist/src/components/atoms/index.js.map +0 -1
- package/dist/src/components/atoms/input/input.atom.d.ts +0 -21
- package/dist/src/components/atoms/input/input.atom.js +0 -93
- package/dist/src/components/atoms/input/input.atom.js.map +0 -1
- package/dist/src/components/atoms/input/input.stories.d.ts +0 -8
- package/dist/src/components/atoms/input/input.stories.js +0 -382
- package/dist/src/components/atoms/input/input.stories.js.map +0 -1
- package/dist/src/components/atoms/input/input.styles.d.ts +0 -1
- package/dist/src/components/atoms/input/input.styles.js +0 -2
- package/dist/src/components/atoms/input/input.styles.js.map +0 -1
- package/dist/src/components/atoms/input/input.type.d.ts +0 -21
- package/dist/src/components/atoms/input/input.type.js +0 -2
- package/dist/src/components/atoms/input/input.type.js.map +0 -1
- package/dist/src/components/atoms/label/label.atom.d.ts +0 -11
- package/dist/src/components/atoms/label/label.atom.js +0 -67
- package/dist/src/components/atoms/label/label.atom.js.map +0 -1
- package/dist/src/components/atoms/label/label.stories.d.ts +0 -6
- package/dist/src/components/atoms/label/label.stories.js +0 -85
- package/dist/src/components/atoms/label/label.stories.js.map +0 -1
- package/dist/src/components/atoms/label/label.style.d.ts +0 -1
- package/dist/src/components/atoms/label/label.style.js +0 -3
- package/dist/src/components/atoms/label/label.style.js.map +0 -1
- package/dist/src/components/atoms/popover/popover-content.d.ts +0 -11
- package/dist/src/components/atoms/popover/popover-content.js +0 -62
- package/dist/src/components/atoms/popover/popover-content.js.map +0 -1
- package/dist/src/components/atoms/popover/popover-trigger.d.ts +0 -9
- package/dist/src/components/atoms/popover/popover-trigger.js +0 -50
- package/dist/src/components/atoms/popover/popover-trigger.js.map +0 -1
- package/dist/src/components/atoms/popover/popover.atom.d.ts +0 -8
- package/dist/src/components/atoms/popover/popover.atom.js +0 -40
- package/dist/src/components/atoms/popover/popover.atom.js.map +0 -1
- package/dist/src/components/atoms/popover/popover.stories.d.ts +0 -10
- package/dist/src/components/atoms/popover/popover.stories.js +0 -69
- package/dist/src/components/atoms/popover/popover.stories.js.map +0 -1
- package/dist/src/components/atoms/popover/popover.style.d.ts +0 -5
- package/dist/src/components/atoms/popover/popover.style.js +0 -21
- package/dist/src/components/atoms/popover/popover.style.js.map +0 -1
- package/dist/src/components/atoms/popover/popover.types.d.ts +0 -2
- package/dist/src/components/atoms/popover/popover.types.js +0 -4
- package/dist/src/components/atoms/popover/popover.types.js.map +0 -1
- package/dist/src/components/atoms/toggle/defs.d.ts +0 -27
- package/dist/src/components/atoms/toggle/defs.js +0 -30
- package/dist/src/components/atoms/toggle/defs.js.map +0 -1
- package/dist/src/components/atoms/toggle/toggle.atom.d.ts +0 -19
- package/dist/src/components/atoms/toggle/toggle.atom.js +0 -72
- package/dist/src/components/atoms/toggle/toggle.atom.js.map +0 -1
- package/dist/src/components/atoms/toggle/toggle.stories.d.ts +0 -6
- package/dist/src/components/atoms/toggle/toggle.stories.js +0 -189
- package/dist/src/components/atoms/toggle/toggle.stories.js.map +0 -1
- package/dist/src/components/atoms/toggle/toggle.style.d.ts +0 -4
- package/dist/src/components/atoms/toggle/toggle.style.js +0 -19
- package/dist/src/components/atoms/toggle/toggle.style.js.map +0 -1
- package/dist/src/components/command/command.d.ts +0 -56
- package/dist/src/components/command/command.js +0 -402
- package/dist/src/components/command/command.js.map +0 -1
- package/dist/src/components/command/command.stories.d.ts +0 -5
- package/dist/src/components/command/command.stories.js +0 -153
- package/dist/src/components/command/command.stories.js.map +0 -1
- package/dist/src/components/index.d.ts +0 -2
- package/dist/src/components/index.js +0 -3
- package/dist/src/components/index.js.map +0 -1
- package/dist/src/components/molecules/command/command.molecules.d.ts +0 -6
- package/dist/src/components/molecules/command/command.molecules.js +0 -27
- package/dist/src/components/molecules/command/command.molecules.js.map +0 -1
- package/dist/src/components/molecules/command-input/command-input.atom.d.ts +0 -10
- package/dist/src/components/molecules/command-input/command-input.atom.js +0 -125
- package/dist/src/components/molecules/command-input/command-input.atom.js.map +0 -1
- package/dist/src/components/molecules/dropdownMenu/dropdownMenu.molecules.d.ts +0 -0
- package/dist/src/components/molecules/dropdownMenu/dropdownMenu.molecules.js +0 -2
- package/dist/src/components/molecules/dropdownMenu/dropdownMenu.molecules.js.map +0 -1
- package/dist/src/components/molecules/index.d.ts +0 -1
- package/dist/src/components/molecules/index.js +0 -2
- package/dist/src/components/molecules/index.js.map +0 -1
- package/dist/src/helpers/base-element.d.ts +0 -10
- package/dist/src/helpers/base-element.js +0 -62
- package/dist/src/helpers/base-element.js.map +0 -1
- package/dist/src/helpers/index.d.ts +0 -3
- package/dist/src/helpers/index.js +0 -4
- package/dist/src/helpers/index.js.map +0 -1
- package/dist/src/helpers/mouse-conroller.helper.d.ts +0 -14
- package/dist/src/helpers/mouse-conroller.helper.js +0 -33
- package/dist/src/helpers/mouse-conroller.helper.js.map +0 -1
- package/dist/src/helpers/style.helpers.d.ts +0 -2
- package/dist/src/helpers/style.helpers.js +0 -6
- package/dist/src/helpers/style.helpers.js.map +0 -1
- package/dist/src/index.d.ts +0 -4
- package/dist/src/index.js +0 -5
- package/dist/src/index.js.map +0 -1
- package/dist/src/interfaces/actionable.interface.d.ts +0 -5
- package/dist/src/interfaces/actionable.interface.js +0 -2
- package/dist/src/interfaces/actionable.interface.js.map +0 -1
- package/dist/src/interfaces/atomic.interface.d.ts +0 -6
- package/dist/src/interfaces/atomic.interface.js +0 -2
- package/dist/src/interfaces/atomic.interface.js.map +0 -1
- package/dist/src/interfaces/changeable.interface.d.ts +0 -7
- package/dist/src/interfaces/changeable.interface.js +0 -2
- package/dist/src/interfaces/changeable.interface.js.map +0 -1
- package/dist/src/interfaces/child-support-atomic.interface.d.ts +0 -4
- package/dist/src/interfaces/child-support-atomic.interface.js +0 -2
- package/dist/src/interfaces/child-support-atomic.interface.js.map +0 -1
- package/dist/src/interfaces/index.d.ts +0 -6
- package/dist/src/interfaces/index.js +0 -7
- package/dist/src/interfaces/index.js.map +0 -1
- package/dist/src/interfaces/intractable.interface.d.ts +0 -6
- package/dist/src/interfaces/intractable.interface.js +0 -2
- package/dist/src/interfaces/intractable.interface.js.map +0 -1
- package/dist/src/interfaces/variant.interface.d.ts +0 -3
- package/dist/src/interfaces/variant.interface.js +0 -2
- package/dist/src/interfaces/variant.interface.js.map +0 -1
- package/dist/src/lib/index.d.ts +0 -0
- package/dist/src/lib/index.js +0 -2
- package/dist/src/lib/index.js.map +0 -1
- package/dist/src/lib/next/next.lib.d.ts +0 -0
- package/dist/src/lib/next/next.lib.js +0 -2
- package/dist/src/lib/next/next.lib.js.map +0 -1
- package/dist/src/lib/react/react.lib.d.ts +0 -5
- package/dist/src/lib/react/react.lib.js +0 -16
- package/dist/src/lib/react/react.lib.js.map +0 -1
- package/dist/src/lib/tw-styles.d.ts +0 -1
- package/dist/src/lib/tw-styles.js +0 -1956
- package/dist/src/lib/tw-styles.js.map +0 -1
- package/dist/src/styles/index.d.ts +0 -1
- package/dist/src/styles/index.js +0 -2
- package/dist/src/styles/index.js.map +0 -1
- package/dist/src/styles/tw.styles.d.ts +0 -1
- package/dist/src/styles/tw.styles.js +0 -2218
- package/dist/src/styles/tw.styles.js.map +0 -1
- package/dist/src/wc-ui-app.d.ts +0 -6
- package/dist/src/wc-ui-app.js +0 -88
- package/dist/src/wc-ui-app.js.map +0 -1
- package/dist/test/wc-ui-app.test.d.ts +0 -0
- package/dist/test/wc-ui-app.test.js +0 -18
- package/dist/test/wc-ui-app.test.js.map +0 -1
- package/dist/vite.config.d.ts +0 -2
- package/dist/vite.config.js +0 -29
- package/dist/vite.config.js.map +0 -1
@@ -1,136 +0,0 @@
|
|
1
|
-
import { html } from 'lit';
|
2
|
-
import { expect, within, waitFor } from '@storybook/test';
|
3
|
-
import './card.atom';
|
4
|
-
export default {
|
5
|
-
component: 'components/card',
|
6
|
-
tags: ['autodocs'],
|
7
|
-
};
|
8
|
-
const testCardBehavior = async (args, canvasElement) => {
|
9
|
-
const canvas = within(canvasElement);
|
10
|
-
const card = await waitFor(() => canvas.getByTestId('card-id'));
|
11
|
-
const cardHeader = await waitFor(() => canvas.getByTestId('card-header-id'));
|
12
|
-
const cardTitle = await waitFor(() => canvas.getByTestId('card-title-id'));
|
13
|
-
const cardDescription = await waitFor(() => canvas.getByTestId('card-description-id'));
|
14
|
-
const cardContent = await waitFor(() => canvas.getByTestId('card-content-id'));
|
15
|
-
const cardFooter = await waitFor(() => canvas.getByTestId('card-footer-id'));
|
16
|
-
expect(card).toBeVisible();
|
17
|
-
expect(cardHeader).toBeVisible();
|
18
|
-
expect(cardTitle).toBeVisible();
|
19
|
-
expect(cardDescription).toBeVisible();
|
20
|
-
expect(cardContent).toBeVisible();
|
21
|
-
expect(cardFooter).toBeVisible();
|
22
|
-
if (card.shadowRoot) {
|
23
|
-
const cardItem = await card.shadowRoot.getElementById('rtg-card-id');
|
24
|
-
expect(cardItem).toHaveClass('rounded-lg border bg-card text-card-foreground shadow-sm p-6');
|
25
|
-
}
|
26
|
-
if (cardTitle) {
|
27
|
-
expect(cardTitle.textContent).toContain('Create project');
|
28
|
-
expect(cardTitle.tagName.toLowerCase()).toEqual('cardtitle');
|
29
|
-
}
|
30
|
-
if (cardDescription) {
|
31
|
-
expect(cardDescription.textContent).toContain('Deploy your new project in one-click.');
|
32
|
-
expect(cardDescription.tagName.toLowerCase()).toEqual('carddescription');
|
33
|
-
}
|
34
|
-
};
|
35
|
-
export const Cards = {
|
36
|
-
name: 'Cards',
|
37
|
-
render: () => html `
|
38
|
-
<rtg-card data-testid="card-id">
|
39
|
-
<CardHeader data-testid="card-header-id">
|
40
|
-
<CardTitle data-testid="card-title-id">
|
41
|
-
<h3>Create project</h3>
|
42
|
-
</CardTitle>
|
43
|
-
<CardDescription data-testid="card-description-id">
|
44
|
-
<p class="text-sm text-muted-foreground">
|
45
|
-
Deploy your new project in one-click.
|
46
|
-
</p>
|
47
|
-
</CardDescription>
|
48
|
-
</CardHeader>
|
49
|
-
<CardContent data-testid="card-content-id">
|
50
|
-
<form class="pt-4">
|
51
|
-
<div class="grid w-full items-center gap-4">
|
52
|
-
<div class="flex flex-col space-y-1.5">
|
53
|
-
<label
|
54
|
-
class="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
55
|
-
for="name"
|
56
|
-
>Name</label
|
57
|
-
><input
|
58
|
-
class="flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"
|
59
|
-
id="name"
|
60
|
-
placeholder="Name of your project"
|
61
|
-
/>
|
62
|
-
</div>
|
63
|
-
<div class="flex flex-col space-y-1.5">
|
64
|
-
<label
|
65
|
-
class="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
66
|
-
for="framework"
|
67
|
-
>Framework</label
|
68
|
-
><button
|
69
|
-
type="button"
|
70
|
-
role="combobox"
|
71
|
-
aria-controls="radix-:r2b:"
|
72
|
-
aria-expanded="false"
|
73
|
-
aria-autocomplete="none"
|
74
|
-
dir="ltr"
|
75
|
-
data-state="closed"
|
76
|
-
data-placeholder=""
|
77
|
-
class="flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1"
|
78
|
-
id="framework"
|
79
|
-
>
|
80
|
-
<span style="pointer-events: none;">Select</span
|
81
|
-
><svg
|
82
|
-
xmlns="http://www.w3.org/2000/svg"
|
83
|
-
width="24"
|
84
|
-
height="24"
|
85
|
-
viewBox="0 0 24 24"
|
86
|
-
fill="none"
|
87
|
-
stroke="currentColor"
|
88
|
-
stroke-width="2"
|
89
|
-
stroke-linecap="round"
|
90
|
-
stroke-linejoin="round"
|
91
|
-
class="lucide lucide-chevron-down h-4 w-4 opacity-50"
|
92
|
-
aria-hidden="true"
|
93
|
-
>
|
94
|
-
<path d="m6 9 6 6 6-6"></path>
|
95
|
-
</svg></button
|
96
|
-
><select
|
97
|
-
aria-hidden="true"
|
98
|
-
tabindex="-1"
|
99
|
-
style="position: absolute; border: 0px; width: 1px; height: 1px; padding: 0px; margin: -1px; overflow: hidden; clip: rect(0px, 0px, 0px, 0px); white-space: nowrap; overflow-wrap: normal;"
|
100
|
-
>
|
101
|
-
<option value=""></option>
|
102
|
-
<option value="next">Next.js</option>
|
103
|
-
<option value="sveltekit">SvelteKit</option>
|
104
|
-
<option value="astro">Astro</option>
|
105
|
-
<option value="nuxt">Nuxt.js</option>
|
106
|
-
</select>
|
107
|
-
</div>
|
108
|
-
</div>
|
109
|
-
</form>
|
110
|
-
</CardContent>
|
111
|
-
<CardFooter data-testid="card-footer-id">
|
112
|
-
<div class="items-center pt-4 flex justify-between">
|
113
|
-
<button
|
114
|
-
class="inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 border border-input bg-background hover:bg-accent hover:text-accent-foreground h-10 px-4 py-2"
|
115
|
-
>
|
116
|
-
Cancel
|
117
|
-
</button>
|
118
|
-
<button
|
119
|
-
class="inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 bg-primary text-primary-foreground hover:bg-primary/90 h-10 px-4 py-2"
|
120
|
-
>
|
121
|
-
Deploy
|
122
|
-
</button>
|
123
|
-
</div>
|
124
|
-
</CardFooter>
|
125
|
-
</rtg-card>
|
126
|
-
`,
|
127
|
-
play: async ({ args, canvasElement }) => {
|
128
|
-
try {
|
129
|
-
await testCardBehavior(args, canvasElement);
|
130
|
-
}
|
131
|
-
catch (error) {
|
132
|
-
console.error('An error occurred during the play function:', error);
|
133
|
-
}
|
134
|
-
},
|
135
|
-
};
|
136
|
-
//# sourceMappingURL=card.stories.js.map
|
@@ -1 +0,0 @@
|
|
1
|
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AC9C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,6CAA6C,EAAE,KAAK,CAAC,CAAC;QACtE,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import { html } from 'lit';\nimport type { Meta, StoryFn, StoryObj } from '@storybook/web-components';\nimport { expect, within, fn, waitFor, userEvent } from '@storybook/test';\nimport './card.atom';\n\nexport default {\n component: 'components/card',\n tags: ['autodocs'],\n} as Meta;\n\ntype Story = StoryObj;\n\nconst testCardBehavior = async (args: any, canvasElement: HTMLElement) => {\n const canvas = within(canvasElement);\n const card = await waitFor(() => canvas.getByTestId('card-id'));\n const cardHeader = await waitFor(() => canvas.getByTestId('card-header-id'));\n const cardTitle = await waitFor(() => canvas.getByTestId('card-title-id'));\n const cardDescription = await waitFor(() =>\n canvas.getByTestId('card-description-id')\n );\n const cardContent = await waitFor(() =>\n canvas.getByTestId('card-content-id')\n );\n const cardFooter = await waitFor(() => canvas.getByTestId('card-footer-id'));\n expect(card).toBeVisible();\n expect(cardHeader).toBeVisible();\n expect(cardTitle).toBeVisible();\n expect(cardDescription).toBeVisible();\n expect(cardContent).toBeVisible();\n expect(cardFooter).toBeVisible();\n\n if (card.shadowRoot) {\n const cardItem = await card.shadowRoot.getElementById('rtg-card-id');\n expect(cardItem).toHaveClass(\n 'rounded-lg border bg-card text-card-foreground shadow-sm p-6'\n );\n }\n if (cardTitle) {\n expect(cardTitle.textContent).toContain('Create project');\n expect(cardTitle.tagName.toLowerCase()).toEqual('cardtitle');\n }\n if (cardDescription) {\n expect(cardDescription.textContent).toContain(\n 'Deploy your new project in one-click.'\n );\n expect(cardDescription.tagName.toLowerCase()).toEqual('carddescription');\n }\n};\n\nexport const Cards: Story = {\n name: 'Cards',\n render: () => html`\n <rtg-card data-testid=\"card-id\">\n <CardHeader data-testid=\"card-header-id\">\n <CardTitle data-testid=\"card-title-id\">\n <h3>Create project</h3>\n </CardTitle>\n <CardDescription data-testid=\"card-description-id\">\n <p class=\"text-sm text-muted-foreground\">\n Deploy your new project in one-click.\n </p>\n </CardDescription>\n </CardHeader>\n <CardContent data-testid=\"card-content-id\">\n <form class=\"pt-4\">\n <div class=\"grid w-full items-center gap-4\">\n <div class=\"flex flex-col space-y-1.5\">\n <label\n class=\"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n for=\"name\"\n >Name</label\n ><input\n class=\"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\"\n id=\"name\"\n placeholder=\"Name of your project\"\n />\n </div>\n <div class=\"flex flex-col space-y-1.5\">\n <label\n class=\"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n for=\"framework\"\n >Framework</label\n ><button\n type=\"button\"\n role=\"combobox\"\n aria-controls=\"radix-:r2b:\"\n aria-expanded=\"false\"\n aria-autocomplete=\"none\"\n dir=\"ltr\"\n data-state=\"closed\"\n data-placeholder=\"\"\n class=\"flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1\"\n id=\"framework\"\n >\n <span style=\"pointer-events: none;\">Select</span\n ><svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"lucide lucide-chevron-down h-4 w-4 opacity-50\"\n aria-hidden=\"true\"\n >\n <path d=\"m6 9 6 6 6-6\"></path>\n </svg></button\n ><select\n aria-hidden=\"true\"\n tabindex=\"-1\"\n style=\"position: absolute; border: 0px; width: 1px; height: 1px; padding: 0px; margin: -1px; overflow: hidden; clip: rect(0px, 0px, 0px, 0px); white-space: nowrap; overflow-wrap: normal;\"\n >\n <option value=\"\"></option>\n <option value=\"next\">Next.js</option>\n <option value=\"sveltekit\">SvelteKit</option>\n <option value=\"astro\">Astro</option>\n <option value=\"nuxt\">Nuxt.js</option>\n </select>\n </div>\n </div>\n </form>\n </CardContent>\n <CardFooter data-testid=\"card-footer-id\">\n <div class=\"items-center pt-4 flex justify-between\">\n <button\n class=\"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 border border-input bg-background hover:bg-accent hover:text-accent-foreground h-10 px-4 py-2\"\n >\n Cancel\n </button>\n <button\n class=\"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 bg-primary text-primary-foreground hover:bg-primary/90 h-10 px-4 py-2\"\n >\n Deploy\n </button>\n </div>\n </CardFooter>\n </rtg-card>\n `,\n play: async ({ args, canvasElement }) => {\n try {\n await testCardBehavior(args, canvasElement);\n } catch (error) {\n console.error('An error occurred during the play function:', error);\n }\n },\n};\n"]}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import { LitElement } from 'lit';
|
2
|
-
import { CheckboxProperties } from './checkbox.type';
|
3
|
-
export declare class Checkbox extends LitElement implements CheckboxProperties {
|
4
|
-
disabled: boolean;
|
5
|
-
checked: boolean;
|
6
|
-
type: string;
|
7
|
-
value: string;
|
8
|
-
required: boolean;
|
9
|
-
static styles: import("lit").CSSResult[];
|
10
|
-
private _onClick;
|
11
|
-
click(): void;
|
12
|
-
render(): import("lit-html").TemplateResult<1>;
|
13
|
-
}
|
@@ -1,87 +0,0 @@
|
|
1
|
-
import { __decorate } from "tslib";
|
2
|
-
import { LitElement, html, css, nothing } from 'lit';
|
3
|
-
import { property, customElement } from 'lit/decorators.js';
|
4
|
-
import { cn } from '../../../helpers';
|
5
|
-
import { TWStyles } from '../../../styles';
|
6
|
-
import { checkboxStyles, iconStyles } from './checkbox.style';
|
7
|
-
let Checkbox = class Checkbox extends LitElement {
|
8
|
-
constructor() {
|
9
|
-
super(...arguments);
|
10
|
-
this.disabled = false;
|
11
|
-
this.checked = false;
|
12
|
-
this.type = 'text';
|
13
|
-
this.value = '';
|
14
|
-
this.required = false;
|
15
|
-
}
|
16
|
-
_onClick(e) {
|
17
|
-
if (e.defaultPrevented)
|
18
|
-
return;
|
19
|
-
this.checked = !this.checked;
|
20
|
-
this.required = !this.required;
|
21
|
-
// Dispatch a custom change event when the state changes
|
22
|
-
this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
|
23
|
-
}
|
24
|
-
click() {
|
25
|
-
this.checked = !this.checked;
|
26
|
-
this.required = !this.required;
|
27
|
-
}
|
28
|
-
render() {
|
29
|
-
const additionalProps = { ...this.dataset }; // Example of additional props
|
30
|
-
return html `
|
31
|
-
<button
|
32
|
-
data-testid="checkbox-atom"
|
33
|
-
type="button"
|
34
|
-
role="checkbox"
|
35
|
-
aria-checked="${this.checked || this.value === 'on'}"
|
36
|
-
data-state="${this.checked || this.value === 'on'
|
37
|
-
? 'checked'
|
38
|
-
: 'unchecked'}"
|
39
|
-
value="${this.value}"
|
40
|
-
?required=${this.required}
|
41
|
-
?disabled=${this.disabled}
|
42
|
-
@click="${this._onClick}"
|
43
|
-
class="${cn(checkboxStyles, this.className)}"
|
44
|
-
${Object.entries(additionalProps).map(([key, value]) => html ` ${key}="${value}" `)}
|
45
|
-
>
|
46
|
-
${this.checked || this.value === 'on'
|
47
|
-
? html `<span data-state="checked" class="${iconStyles}"
|
48
|
-
><svg
|
49
|
-
xmlns="http://www.w3.org/2000/svg"
|
50
|
-
width="24"
|
51
|
-
height="24"
|
52
|
-
viewBox="0 0 24 24"
|
53
|
-
fill="none"
|
54
|
-
stroke="currentColor"
|
55
|
-
stroke-width="3"
|
56
|
-
stroke-linecap="round"
|
57
|
-
stroke-linejoin="round"
|
58
|
-
class="h-4 w-4"
|
59
|
-
>
|
60
|
-
<polyline points="20 6 9 17 4 12"></polyline></svg
|
61
|
-
></span>`
|
62
|
-
: nothing}
|
63
|
-
</button>
|
64
|
-
`;
|
65
|
-
}
|
66
|
-
};
|
67
|
-
Checkbox.styles = [css ``, TWStyles];
|
68
|
-
__decorate([
|
69
|
-
property({ type: Boolean })
|
70
|
-
], Checkbox.prototype, "disabled", void 0);
|
71
|
-
__decorate([
|
72
|
-
property({ type: Boolean })
|
73
|
-
], Checkbox.prototype, "checked", void 0);
|
74
|
-
__decorate([
|
75
|
-
property({ type: String })
|
76
|
-
], Checkbox.prototype, "type", void 0);
|
77
|
-
__decorate([
|
78
|
-
property({ type: String })
|
79
|
-
], Checkbox.prototype, "value", void 0);
|
80
|
-
__decorate([
|
81
|
-
property({ type: Boolean })
|
82
|
-
], Checkbox.prototype, "required", void 0);
|
83
|
-
Checkbox = __decorate([
|
84
|
-
customElement('rtg-checkbox')
|
85
|
-
], Checkbox);
|
86
|
-
export { Checkbox };
|
87
|
-
//# sourceMappingURL=checkbox.atom.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"checkbox.atom.js","sourceRoot":"","sources":["../../../../../src/components/atoms/checkbox/checkbox.atom.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAA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AAC,OAAO,CAAC,eAAe,CAAC,CAAC,GAAG,CACnC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,IAAI,CAAA,IAAI,GAAG,KAAK,KAAK,IAAI,CAC5C;;UAEC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI;YACnC,CAAC,CAAC,IAAI,CAAA,qCAAqC,UAAU;;;;;;;;;;;;;;qBAc1C;YACX,CAAC,CAAC,OAAO;;KAEd,CAAC;IACJ,CAAC;;AAvDM,eAAM,GAAG,CAAC,GAAG,CAAA,EAAE,EAAE,QAAQ,CAAC,AAApB,CAAqB;AAVL;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0CAAkB;AAEjB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;yCAAiB;AAEjB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sCAAe;AAEd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCAAY;AAEV;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0CAAkB;AATnC,QAAQ;IADpB,aAAa,CAAC,cAAc,CAAC;GACjB,QAAQ,CAmEpB","sourcesContent":["import { LitElement, html, css, nothing } from 'lit';\nimport { property, customElement } from 'lit/decorators.js';\nimport { cn } from '../../../helpers';\nimport { TWStyles } from '../../../styles';\nimport { checkboxStyles, iconStyles } from './checkbox.style';\nimport { CheckboxProperties } from './checkbox.type';\n\n@customElement('rtg-checkbox')\nexport class Checkbox extends LitElement implements CheckboxProperties {\n @property({ type: Boolean }) disabled = false;\n\n @property({ type: Boolean }) checked = false;\n\n @property({ type: String }) type = 'text';\n\n @property({ type: String }) value = '';\n\n @property({ type: Boolean }) required = false;\n\n static styles = [css``, TWStyles];\n\n private _onClick(e: Event) {\n if (e.defaultPrevented) return;\n this.checked = !this.checked;\n this.required = !this.required;\n\n // Dispatch a custom change event when the state changes\n this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));\n }\n\n public click() {\n this.checked = !this.checked;\n this.required = !this.required;\n }\n\n render() {\n const additionalProps = { ...this.dataset }; // Example of additional props\n return html`\n <button\n data-testid=\"checkbox-atom\"\n type=\"button\"\n role=\"checkbox\"\n aria-checked=\"${this.checked || this.value === 'on'}\"\n data-state=\"${this.checked || this.value === 'on'\n ? 'checked'\n : 'unchecked'}\"\n value=\"${this.value}\"\n ?required=${this.required}\n ?disabled=${this.disabled}\n @click=\"${this._onClick}\"\n class=\"${cn(checkboxStyles, this.className)}\"\n ${Object.entries(additionalProps).map(\n ([key, value]) => html` ${key}=\"${value}\" `\n )}\n >\n ${this.checked || this.value === 'on'\n ? html`<span data-state=\"checked\" class=\"${iconStyles}\"\n ><svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"3\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"h-4 w-4\"\n >\n <polyline points=\"20 6 9 17 4 12\"></polyline></svg\n ></span>`\n : nothing}\n </button>\n `;\n }\n}\n"]}
|
@@ -1,8 +0,0 @@
|
|
1
|
-
import type { Meta, StoryFn } from '@storybook/web-components';
|
2
|
-
import './checkbox.atom';
|
3
|
-
import '../button/button.atom';
|
4
|
-
declare const _default: Meta;
|
5
|
-
export default _default;
|
6
|
-
export declare const CheckboxWithReuired: StoryFn;
|
7
|
-
export declare const Checkbox: StoryFn;
|
8
|
-
export declare const CheckboxWithValue: StoryFn;
|
@@ -1,244 +0,0 @@
|
|
1
|
-
import { html } from 'lit';
|
2
|
-
import './checkbox.atom';
|
3
|
-
import { expect, within, waitFor, fn } from '@storybook/test';
|
4
|
-
import '../button/button.atom';
|
5
|
-
const allowedTypes = ['checkbox'];
|
6
|
-
export default {
|
7
|
-
component: 'components/checkbox',
|
8
|
-
tags: ['autodocs'],
|
9
|
-
};
|
10
|
-
const mockOnClickHandler = fn(event => {
|
11
|
-
alert('submit data!');
|
12
|
-
});
|
13
|
-
const testCheckboxBehavior = async (args, canvasElement) => {
|
14
|
-
const canvas = within(canvasElement);
|
15
|
-
const checkbox = await waitFor(() => canvas.getByTestId('checkbox-id'));
|
16
|
-
if (checkbox.shadowRoot) {
|
17
|
-
const innerCheckbox = checkbox.shadowRoot.querySelector('[data-testid="checkbox-atom"]');
|
18
|
-
// 1. Test: Checkbox should have correct Role attribute
|
19
|
-
expect(innerCheckbox).toHaveRole('checkbox');
|
20
|
-
// 2. Test: Checkbox should have the correct `checked` state based on args
|
21
|
-
if (args.checked) {
|
22
|
-
expect(innerCheckbox).toBeChecked();
|
23
|
-
}
|
24
|
-
else {
|
25
|
-
expect(innerCheckbox).not.toBeChecked();
|
26
|
-
}
|
27
|
-
// 3. Test: Checkbox should be disabled when the `disabled` prop is true
|
28
|
-
if (args.disabled) {
|
29
|
-
expect(innerCheckbox).toBeDisabled();
|
30
|
-
}
|
31
|
-
else {
|
32
|
-
expect(innerCheckbox).not.toBeDisabled();
|
33
|
-
}
|
34
|
-
// 4. Test: Label should have correct `for` attribute linking to the checkbox
|
35
|
-
const label = await waitFor(() => canvas.getByText(args.label));
|
36
|
-
expect(label).toBeInTheDocument();
|
37
|
-
expect(label).toHaveAttribute('for', checkbox.getAttribute('id'));
|
38
|
-
}
|
39
|
-
};
|
40
|
-
const testCheckboxWithRequiredBehavior = async (args, canvasElement) => {
|
41
|
-
const canvas = within(canvasElement);
|
42
|
-
const checkbox = await waitFor(() => canvas.getByTestId('checkbox-id'));
|
43
|
-
const button = await waitFor(() => canvas.getByTestId('btn-id'));
|
44
|
-
if (checkbox.shadowRoot) {
|
45
|
-
const innerCheckbox = checkbox.shadowRoot.querySelector('[data-testid="checkbox-atom"]');
|
46
|
-
// Test: Checkbox should have the correct required attribute
|
47
|
-
if (args.required) {
|
48
|
-
expect(innerCheckbox).toHaveAttribute('required');
|
49
|
-
}
|
50
|
-
else {
|
51
|
-
expect(innerCheckbox).not.toHaveAttribute('required');
|
52
|
-
}
|
53
|
-
// Test: Button should be disabled when checkbox is unchecked and required is true
|
54
|
-
if (args.required && !args.checked) {
|
55
|
-
expect(button).toBeDisabled();
|
56
|
-
}
|
57
|
-
else if (args.required && args.checked) {
|
58
|
-
expect(button).not.toBeDisabled();
|
59
|
-
}
|
60
|
-
// Additional tests for the checked state
|
61
|
-
if (args.checked) {
|
62
|
-
expect(innerCheckbox).toBeChecked();
|
63
|
-
}
|
64
|
-
else {
|
65
|
-
expect(innerCheckbox).not.toBeChecked();
|
66
|
-
}
|
67
|
-
// Additional tests for the disabled state
|
68
|
-
if (args.disabled) {
|
69
|
-
expect(innerCheckbox).toBeDisabled();
|
70
|
-
}
|
71
|
-
else {
|
72
|
-
expect(innerCheckbox).not.toBeDisabled();
|
73
|
-
}
|
74
|
-
}
|
75
|
-
};
|
76
|
-
const testCheckboxWithValueBehavior = async (args, canvasElement) => {
|
77
|
-
const canvas = within(canvasElement);
|
78
|
-
const checkbox = await waitFor(() => canvas.getByTestId('checkbox-id'));
|
79
|
-
if (checkbox.shadowRoot) {
|
80
|
-
const innerCheckbox = checkbox.shadowRoot.querySelector('[data-testid="checkbox-atom"]');
|
81
|
-
// Test: Checkbox should have the correct value attribute
|
82
|
-
expect(innerCheckbox).toHaveAttribute('value', args.value);
|
83
|
-
// Additional tests for disabled state if needed
|
84
|
-
if (args.disabled) {
|
85
|
-
expect(innerCheckbox).toBeDisabled();
|
86
|
-
}
|
87
|
-
else {
|
88
|
-
expect(innerCheckbox).not.toBeDisabled();
|
89
|
-
}
|
90
|
-
}
|
91
|
-
};
|
92
|
-
const TemplatewithChecked = ({ disabled, checked, label }) => html `
|
93
|
-
<div style="display:flex">
|
94
|
-
<rtg-checkbox
|
95
|
-
id="terms"
|
96
|
-
data-testid="checkbox-id"
|
97
|
-
?disabled=${disabled}
|
98
|
-
?checked=${checked}
|
99
|
-
></rtg-checkbox>
|
100
|
-
<rtg-label style="margin:2px 0px 0px 4px" for="terms">${label}</rtg-label>
|
101
|
-
</div>
|
102
|
-
`;
|
103
|
-
const TemplatewithRequired = ({ disabled, checked, label, required, }) => html `
|
104
|
-
<div style="display: flex; flex-direction: column;">
|
105
|
-
<div style="display:flex">
|
106
|
-
<rtg-checkbox
|
107
|
-
id="terms"
|
108
|
-
data-testid="checkbox-id"
|
109
|
-
?disabled=${disabled}
|
110
|
-
?checked=${checked}
|
111
|
-
?required=${required}
|
112
|
-
@click=${(e) => {
|
113
|
-
const checkbox = e.target;
|
114
|
-
const button = document.querySelector('rtg-button');
|
115
|
-
if (button) {
|
116
|
-
button.disabled = required ? !checkbox.checked : false;
|
117
|
-
}
|
118
|
-
}}
|
119
|
-
></rtg-checkbox>
|
120
|
-
<rtg-label style="margin:2px 0px 0px 4px" for="terms"
|
121
|
-
>${label}</rtg-label
|
122
|
-
>
|
123
|
-
</div>
|
124
|
-
<div style="margin-top:16px">
|
125
|
-
<rtg-button
|
126
|
-
variant="default"
|
127
|
-
size="default"
|
128
|
-
data-testid="btn-id"
|
129
|
-
?disabled=${required ? !checked : false}
|
130
|
-
.click=${mockOnClickHandler}
|
131
|
-
>Submit</rtg-button
|
132
|
-
>
|
133
|
-
</div>
|
134
|
-
</div>
|
135
|
-
`;
|
136
|
-
const TemplateWithVlaue = ({ disabled, label, value }) => html `
|
137
|
-
<div style="display:flex">
|
138
|
-
<rtg-checkbox
|
139
|
-
id="terms"
|
140
|
-
data-testid="checkbox-id"
|
141
|
-
value=${value}
|
142
|
-
?disabled=${disabled}
|
143
|
-
></rtg-checkbox>
|
144
|
-
<rtg-label style="margin:2px 0px 0px 4px" for="terms">${label}</rtg-label>
|
145
|
-
</div>
|
146
|
-
`;
|
147
|
-
export const CheckboxWithReuired = TemplatewithRequired.bind({});
|
148
|
-
CheckboxWithReuired.args = {
|
149
|
-
disabled: false,
|
150
|
-
checked: false,
|
151
|
-
required: false,
|
152
|
-
label: 'Accept terms and conditions',
|
153
|
-
};
|
154
|
-
CheckboxWithReuired.parameters = {
|
155
|
-
docs: {
|
156
|
-
source: {
|
157
|
-
transform: (code, storyContext) => {
|
158
|
-
const args = storyContext.args;
|
159
|
-
// Handling boolean attributes: if true, render without value, if false, omit the attribute
|
160
|
-
const updatedCode = code
|
161
|
-
.replace(/disabled=""/g, 'disabled=true')
|
162
|
-
.replace(/checked=""/g, 'checked=true')
|
163
|
-
.replace(/required=""/g, 'required=true')
|
164
|
-
.replace(/disabled="false"/g, '')
|
165
|
-
.replace(/checked="false"/g, '')
|
166
|
-
.replace(/required="false"/g, '');
|
167
|
-
return updatedCode;
|
168
|
-
},
|
169
|
-
},
|
170
|
-
},
|
171
|
-
};
|
172
|
-
CheckboxWithReuired.argTypes = {
|
173
|
-
disabled: {
|
174
|
-
control: 'boolean',
|
175
|
-
description: 'Determines whether the checkbox is disabled (unclickable).',
|
176
|
-
table: {
|
177
|
-
defaultValue: { summary: 'false' },
|
178
|
-
},
|
179
|
-
docs: {
|
180
|
-
source: {
|
181
|
-
code: (args) => (args.disabled ? true : ''),
|
182
|
-
},
|
183
|
-
},
|
184
|
-
},
|
185
|
-
checked: {
|
186
|
-
control: 'boolean',
|
187
|
-
description: 'Specifies whether the checkbox is checked by default.',
|
188
|
-
table: {
|
189
|
-
defaultValue: { summary: 'false' },
|
190
|
-
},
|
191
|
-
},
|
192
|
-
required: {
|
193
|
-
control: 'boolean',
|
194
|
-
description: 'Marks the checkbox as a required field. When true, the checkbox must be checked for form submission, and related actions such as enabling a submit button are dependent on this state.',
|
195
|
-
table: {
|
196
|
-
defaultValue: { summary: 'false' },
|
197
|
-
},
|
198
|
-
},
|
199
|
-
label: {
|
200
|
-
control: 'text',
|
201
|
-
description: 'The text displayed next to the checkbox, describing its purpose.',
|
202
|
-
},
|
203
|
-
};
|
204
|
-
CheckboxWithReuired.play = async ({ args, canvasElement }) => {
|
205
|
-
await testCheckboxWithRequiredBehavior(args, canvasElement);
|
206
|
-
};
|
207
|
-
export const Checkbox = TemplatewithChecked.bind({});
|
208
|
-
Checkbox.args = {
|
209
|
-
disabled: false,
|
210
|
-
checked: false,
|
211
|
-
label: 'Accept terms and conditions',
|
212
|
-
};
|
213
|
-
Checkbox.argTypes = {
|
214
|
-
disabled: {
|
215
|
-
control: 'boolean',
|
216
|
-
},
|
217
|
-
checked: {
|
218
|
-
control: 'boolean',
|
219
|
-
},
|
220
|
-
label: {
|
221
|
-
control: 'text',
|
222
|
-
},
|
223
|
-
};
|
224
|
-
Checkbox.play = async ({ args, canvasElement }) => {
|
225
|
-
await testCheckboxBehavior(args, canvasElement);
|
226
|
-
};
|
227
|
-
export const CheckboxWithValue = TemplateWithVlaue.bind({});
|
228
|
-
CheckboxWithValue.args = {
|
229
|
-
disabled: false,
|
230
|
-
value: 'off',
|
231
|
-
label: 'Accept terms and conditions',
|
232
|
-
};
|
233
|
-
CheckboxWithValue.argTypes = {
|
234
|
-
disabled: { control: 'boolean' },
|
235
|
-
value: {
|
236
|
-
control: { type: 'select' },
|
237
|
-
options: ['on', 'off'],
|
238
|
-
},
|
239
|
-
label: { control: 'text' },
|
240
|
-
};
|
241
|
-
CheckboxWithValue.play = async ({ args, canvasElement }) => {
|
242
|
-
await testCheckboxWithValueBehavior(args, canvasElement);
|
243
|
-
};
|
244
|
-
//# sourceMappingURL=checkbox.stories.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"checkbox.stories.js","sourceRoot":"","sources":["../../../../../src/components/atoms/checkbox/checkbox.stories.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,iBAAiB,CAAC;AACzB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAa,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAMzE,OAAO,uBAAuB,CAAC;AAE/B,MAAM,YAAY,GAAG,CAAC,UAAU,CAAC,CAAC;AAElC,eAA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'lit';\nimport './checkbox.atom';\nimport { expect, within, userEvent, waitFor, fn } from '@storybook/test';\nimport {\n CheckboxArgs,\n CheckboxWithRequiredArgs,\n CheckboxWithValueArgs,\n} from './checkbox.type';\nimport '../button/button.atom';\n\nconst allowedTypes = ['checkbox'];\n\nexport default {\n component: 'components/checkbox',\n tags: ['autodocs'],\n} as Meta;\n\nconst mockOnClickHandler = fn(event => {\n alert('submit data!');\n});\n\nconst testCheckboxBehavior = async (\n args: CheckboxArgs,\n canvasElement: HTMLElement\n) => {\n const canvas = within(canvasElement);\n const checkbox = await waitFor(() => canvas.getByTestId('checkbox-id'));\n\n if (checkbox.shadowRoot) {\n const innerCheckbox = checkbox.shadowRoot.querySelector(\n '[data-testid=\"checkbox-atom\"]'\n );\n\n // 1. Test: Checkbox should have correct Role attribute\n expect(innerCheckbox).toHaveRole('checkbox');\n\n // 2. Test: Checkbox should have the correct `checked` state based on args\n if (args.checked) {\n expect(innerCheckbox).toBeChecked();\n } else {\n expect(innerCheckbox).not.toBeChecked();\n }\n\n // 3. Test: Checkbox should be disabled when the `disabled` prop is true\n if (args.disabled) {\n expect(innerCheckbox).toBeDisabled();\n } else {\n expect(innerCheckbox).not.toBeDisabled();\n }\n\n // 4. Test: Label should have correct `for` attribute linking to the checkbox\n const label = await waitFor(() => canvas.getByText(args.label));\n expect(label).toBeInTheDocument();\n expect(label).toHaveAttribute('for', checkbox.getAttribute('id'));\n }\n};\n\nconst testCheckboxWithRequiredBehavior = async (\n args: CheckboxWithRequiredArgs,\n canvasElement: HTMLElement\n) => {\n const canvas = within(canvasElement);\n const checkbox = await waitFor(() => canvas.getByTestId('checkbox-id'));\n const button = await waitFor(() => canvas.getByTestId('btn-id'));\n\n if (checkbox.shadowRoot) {\n const innerCheckbox = checkbox.shadowRoot.querySelector(\n '[data-testid=\"checkbox-atom\"]'\n );\n\n // Test: Checkbox should have the correct required attribute\n if (args.required) {\n expect(innerCheckbox).toHaveAttribute('required');\n } else {\n expect(innerCheckbox).not.toHaveAttribute('required');\n }\n\n // Test: Button should be disabled when checkbox is unchecked and required is true\n if (args.required && !args.checked) {\n expect(button).toBeDisabled();\n } else if (args.required && args.checked) {\n expect(button).not.toBeDisabled();\n }\n\n // Additional tests for the checked state\n if (args.checked) {\n expect(innerCheckbox).toBeChecked();\n } else {\n expect(innerCheckbox).not.toBeChecked();\n }\n\n // Additional tests for the disabled state\n if (args.disabled) {\n expect(innerCheckbox).toBeDisabled();\n } else {\n expect(innerCheckbox).not.toBeDisabled();\n }\n }\n};\n\nconst testCheckboxWithValueBehavior = async (\n args: CheckboxWithValueArgs,\n canvasElement: HTMLElement\n) => {\n const canvas = within(canvasElement);\n const checkbox = await waitFor(() => canvas.getByTestId('checkbox-id'));\n\n if (checkbox.shadowRoot) {\n const innerCheckbox = checkbox.shadowRoot.querySelector(\n '[data-testid=\"checkbox-atom\"]'\n );\n\n // Test: Checkbox should have the correct value attribute\n expect(innerCheckbox).toHaveAttribute('value', args.value);\n\n // Additional tests for disabled state if needed\n if (args.disabled) {\n expect(innerCheckbox).toBeDisabled();\n } else {\n expect(innerCheckbox).not.toBeDisabled();\n }\n }\n};\n\nconst TemplatewithChecked: StoryFn = ({ disabled, checked, label }) =>\n html`\n <div style=\"display:flex\">\n <rtg-checkbox\n id=\"terms\"\n data-testid=\"checkbox-id\"\n ?disabled=${disabled}\n ?checked=${checked}\n ></rtg-checkbox>\n <rtg-label style=\"margin:2px 0px 0px 4px\" for=\"terms\">${label}</rtg-label>\n </div>\n `;\n\nconst TemplatewithRequired: StoryFn = ({\n disabled,\n checked,\n label,\n required,\n}) =>\n html`\n <div style=\"display: flex; flex-direction: column;\">\n <div style=\"display:flex\">\n <rtg-checkbox\n id=\"terms\"\n data-testid=\"checkbox-id\"\n ?disabled=${disabled}\n ?checked=${checked}\n ?required=${required}\n @click=${(e: Event) => {\n const checkbox = e.target as HTMLInputElement;\n const button = document.querySelector(\n 'rtg-button'\n ) as unknown as HTMLButtonElement;\n if (button) {\n button.disabled = required ? !checkbox.checked : false;\n }\n }}\n ></rtg-checkbox>\n <rtg-label style=\"margin:2px 0px 0px 4px\" for=\"terms\"\n >${label}</rtg-label\n >\n </div>\n <div style=\"margin-top:16px\">\n <rtg-button\n variant=\"default\"\n size=\"default\"\n data-testid=\"btn-id\"\n ?disabled=${required ? !checked : false}\n .click=${mockOnClickHandler}\n >Submit</rtg-button\n >\n </div>\n </div>\n `;\n\nconst TemplateWithVlaue: StoryFn = ({ disabled, label, value }) =>\n html`\n <div style=\"display:flex\">\n <rtg-checkbox\n id=\"terms\"\n data-testid=\"checkbox-id\"\n value=${value}\n ?disabled=${disabled}\n ></rtg-checkbox>\n <rtg-label style=\"margin:2px 0px 0px 4px\" for=\"terms\">${label}</rtg-label>\n </div>\n `;\n\nexport const CheckboxWithReuired = TemplatewithRequired.bind({});\nCheckboxWithReuired.args = {\n disabled: false,\n checked: false,\n required: false,\n label: 'Accept terms and conditions',\n};\n\nCheckboxWithReuired.parameters = {\n docs: {\n source: {\n transform: (code: string, storyContext: StoryContext) => {\n const args = storyContext.args;\n\n // Handling boolean attributes: if true, render without value, if false, omit the attribute\n const updatedCode = code\n .replace(/disabled=\"\"/g, 'disabled=true')\n .replace(/checked=\"\"/g, 'checked=true')\n .replace(/required=\"\"/g, 'required=true')\n .replace(/disabled=\"false\"/g, '')\n .replace(/checked=\"false\"/g, '')\n .replace(/required=\"false\"/g, '');\n\n return updatedCode;\n },\n },\n },\n};\n\nCheckboxWithReuired.argTypes = {\n disabled: {\n control: 'boolean',\n description: 'Determines whether the checkbox is disabled (unclickable).',\n table: {\n defaultValue: { summary: 'false' },\n },\n docs: {\n source: {\n code: (args: { disabled: boolean }) => (args.disabled ? true : ''),\n },\n },\n },\n checked: {\n control: 'boolean',\n description: 'Specifies whether the checkbox is checked by default.',\n table: {\n defaultValue: { summary: 'false' },\n },\n },\n required: {\n control: 'boolean',\n description:\n 'Marks the checkbox as a required field. When true, the checkbox must be checked for form submission, and related actions such as enabling a submit button are dependent on this state.',\n table: {\n defaultValue: { summary: 'false' },\n },\n },\n label: {\n control: 'text',\n description:\n 'The text displayed next to the checkbox, describing its purpose.',\n },\n};\n\nCheckboxWithReuired.play = async ({ args, canvasElement }) => {\n await testCheckboxWithRequiredBehavior(\n args as CheckboxWithRequiredArgs,\n canvasElement\n );\n};\n\nexport const Checkbox = TemplatewithChecked.bind({});\nCheckbox.args = {\n disabled: false,\n checked: false,\n label: 'Accept terms and conditions',\n};\n\nCheckbox.argTypes = {\n disabled: {\n control: 'boolean',\n },\n checked: {\n control: 'boolean',\n },\n label: {\n control: 'text',\n },\n};\n\nCheckbox.play = async ({ args, canvasElement }) => {\n await testCheckboxBehavior(args as CheckboxArgs, canvasElement);\n};\n\nexport const CheckboxWithValue = TemplateWithVlaue.bind({});\nCheckboxWithValue.args = {\n disabled: false,\n value: 'off',\n label: 'Accept terms and conditions',\n};\n\nCheckboxWithValue.argTypes = {\n disabled: { control: 'boolean' },\n value: {\n control: { type: 'select' },\n options: ['on', 'off'],\n },\n label: { control: 'text' },\n};\n\nCheckboxWithValue.play = async ({ args, canvasElement }) => {\n await testCheckboxWithValueBehavior(\n args as CheckboxWithValueArgs,\n canvasElement\n );\n};\n"]}
|
@@ -1,2 +0,0 @@
|
|
1
|
-
export declare const checkboxStyles = "peer h-4 w-4 align-middle shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground";
|
2
|
-
export declare const iconStyles = "flex items-center justify-center text-current pointer-events-none";
|
@@ -1,3 +0,0 @@
|
|
1
|
-
export const checkboxStyles = 'peer h-4 w-4 align-middle shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground';
|
2
|
-
export const iconStyles = 'flex items-center justify-center text-current pointer-events-none';
|
3
|
-
//# sourceMappingURL=checkbox.style.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"checkbox.style.js","sourceRoot":"","sources":["../../../../../src/components/atoms/checkbox/checkbox.style.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GACzB,iSAAiS,CAAC;AAEpS,MAAM,CAAC,MAAM,UAAU,GACrB,mEAAmE,CAAC","sourcesContent":["export const checkboxStyles =\n 'peer h-4 w-4 align-middle shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground';\n\nexport const iconStyles =\n 'flex items-center justify-center text-current pointer-events-none';\n"]}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
export type CheckboxProperties = {
|
2
|
-
disabled: boolean;
|
3
|
-
checked: boolean;
|
4
|
-
};
|
5
|
-
export type CheckboxArgs = {
|
6
|
-
disabled: boolean;
|
7
|
-
checked: boolean;
|
8
|
-
label: string;
|
9
|
-
};
|
10
|
-
export type CheckboxWithRequiredArgs = {
|
11
|
-
disabled: boolean;
|
12
|
-
checked: boolean;
|
13
|
-
required: boolean;
|
14
|
-
label: string;
|
15
|
-
value?: string;
|
16
|
-
};
|
17
|
-
export type CheckboxWithValueArgs = {
|
18
|
-
disabled: boolean;
|
19
|
-
value: string;
|
20
|
-
label: string;
|
21
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"checkbox.type.js","sourceRoot":"","sources":["../../../../../src/components/atoms/checkbox/checkbox.type.ts"],"names":[],"mappings":"","sourcesContent":["export type CheckboxProperties = {\n disabled: boolean;\n checked: boolean;\n};\n\nexport type CheckboxArgs = {\n disabled: boolean;\n checked: boolean;\n label: string;\n};\n\nexport type CheckboxWithRequiredArgs = {\n disabled: boolean;\n checked: boolean;\n required: boolean;\n label: string;\n value?: string;\n};\n\nexport type CheckboxWithValueArgs = {\n disabled: boolean;\n value: string;\n label: string;\n};\n"]}
|