@agility/plenum-ui 1.3.50 → 2.0.0-rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +6 -0
- package/.prettierrc +12 -12
- package/.storybook/Layout.jsx +9 -6
- package/.storybook/head.tsx +4 -0
- package/.storybook/main.ts +18 -0
- package/.storybook/manager-head.html +1 -0
- package/.storybook/manager.ts +25 -0
- package/.storybook/plenumTheme.ts +8 -0
- package/.storybook/preview-head.html +4 -0
- package/.storybook/preview.tsx +28 -0
- package/.vscode/settings.json +4 -0
- package/.yarnrc.yml +1 -0
- package/README.md +165 -53
- package/app/globals.css +99 -0
- package/app/head.tsx +59 -0
- package/app/layout.tsx +28 -0
- package/app/page.tsx +7 -0
- package/build.js +41 -0
- package/dist/index.d.ts +959 -0
- package/dist/index.js +5936 -0
- package/dist/index.js.map +7 -0
- package/{lib/components → dist/types/stories/atoms}/Avatar/Avatar.d.ts +28 -27
- package/dist/types/stories/atoms/Avatar/index.d.ts +3 -0
- package/dist/types/stories/atoms/badges/Badge.d.ts +21 -0
- package/dist/types/stories/atoms/badges/index.d.ts +3 -0
- package/dist/types/stories/atoms/buttons/Button/Alternative/Alternative.stories.d.ts +13 -0
- package/dist/types/stories/atoms/buttons/Button/Button.d.ts +33 -0
- package/dist/types/stories/atoms/buttons/Button/Danger/Danger.stories.d.ts +13 -0
- package/dist/types/stories/atoms/buttons/Button/Primary/Primary.stories.d.ts +13 -0
- package/dist/types/stories/atoms/buttons/Button/Secondary/Secondary.stories.d.ts +13 -0
- package/dist/types/stories/atoms/buttons/Button/defaultArgs.d.ts +3 -0
- package/dist/types/stories/atoms/buttons/Button/index.d.ts +3 -0
- package/dist/types/stories/atoms/buttons/Capsule/Alternative/Alternative.stories.d.ts +6 -0
- package/dist/types/stories/atoms/buttons/Capsule/Capsule.d.ts +27 -0
- package/dist/types/stories/atoms/buttons/Capsule/Danger/Danger.stories.d.ts +6 -0
- package/dist/types/stories/atoms/buttons/Capsule/Primary/Primary.stories.d.ts +6 -0
- package/dist/types/stories/atoms/buttons/Capsule/Secondary/Secondary.stories.d.ts +6 -0
- package/dist/types/stories/atoms/buttons/Capsule/index.d.ts +3 -0
- package/dist/types/stories/atoms/buttons/index.d.ts +4 -0
- package/{lib/components/DynamicIcons/DynamicIcons.d.ts → dist/types/stories/atoms/icons/DynamicIcon.d.ts} +20 -18
- package/dist/types/stories/atoms/icons/DynamicIcon.stories.d.ts +10 -0
- package/dist/types/stories/atoms/icons/IconWithShadow.d.ts +6 -0
- package/dist/types/stories/atoms/icons/IconWithShadow.stories.d.ts +10 -0
- package/{lib/components/DynamicIcons → dist/types/stories/atoms/icons}/TablerIcon.d.ts +9 -9
- package/dist/types/stories/atoms/icons/index.d.ts +4 -0
- package/dist/types/stories/atoms/icons/tablerIconNames.d.ts +2 -0
- package/dist/types/stories/atoms/index.d.ts +7 -0
- package/dist/types/stories/atoms/loaders/Loader.d.ts +6 -0
- package/dist/types/stories/atoms/loaders/Loader.stories.d.ts +6 -0
- package/dist/types/stories/atoms/loaders/NProgress/RadialProgress.d.ts +11 -0
- package/dist/types/stories/atoms/loaders/NProgress/index.d.ts +3 -0
- package/dist/types/stories/atoms/loaders/index.d.ts +4 -0
- package/dist/types/stories/index.d.ts +5 -0
- package/dist/types/stories/layouts/index.d.ts +0 -0
- package/dist/types/stories/molecules/index.d.ts +3 -0
- package/dist/types/stories/molecules/inputs/InputField/InputField.d.ts +28 -0
- package/dist/types/stories/molecules/inputs/InputField/index.d.ts +3 -0
- package/{lib/components/Forms → dist/types/stories/molecules/inputs}/InputLabel/InputLabel.d.ts +15 -14
- package/dist/types/stories/molecules/inputs/InputLabel/index.d.ts +3 -0
- package/dist/types/stories/molecules/inputs/NestedInputButton/NestedInputButton.d.ts +17 -0
- package/dist/types/stories/molecules/inputs/NestedInputButton/index.d.ts +3 -0
- package/{lib/components/Forms/Checkbox → dist/types/stories/molecules/inputs/checkbox}/Checkbox.d.ts +28 -27
- package/dist/types/stories/molecules/inputs/checkbox/Checkbox.stories.d.ts +6 -0
- package/dist/types/stories/molecules/inputs/checkbox/index.d.ts +3 -0
- package/{lib/components/Combobox/Combobox.d.ts → dist/types/stories/molecules/inputs/combobox/ComboBox.d.ts} +34 -34
- package/dist/types/stories/molecules/inputs/combobox/ComboBox.stories.d.ts +6 -0
- package/dist/types/stories/molecules/inputs/combobox/index.d.ts +3 -0
- package/dist/types/stories/molecules/inputs/index.d.ts +11 -0
- package/{lib/components/Forms/Radio → dist/types/stories/molecules/inputs/radio}/Radio.d.ts +27 -27
- package/dist/types/stories/molecules/inputs/radio/Radio.stories.d.ts +6 -0
- package/dist/types/stories/molecules/inputs/radio/index.d.ts +3 -0
- package/{lib/components/Forms/Select → dist/types/stories/molecules/inputs/select}/Select.d.ts +27 -27
- package/dist/types/stories/molecules/inputs/select/Select.stories.d.ts +6 -0
- package/dist/types/stories/molecules/inputs/select/index.d.ts +3 -0
- package/dist/types/stories/molecules/inputs/textArea/TextArea.d.ts +26 -0
- package/dist/types/stories/molecules/inputs/textArea/TextArea.stories.d.ts +6 -0
- package/dist/types/stories/molecules/inputs/textArea/index.d.ts +3 -0
- package/dist/types/stories/molecules/inputs/toggleSwitch/ToggleSwitch.d.ts +18 -0
- package/dist/types/stories/molecules/inputs/toggleSwitch/index.d.ts +3 -0
- package/dist/types/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.d.ts +18 -0
- package/dist/types/stories/organisms/AnimatedLabelInput/index.d.ts +3 -0
- package/dist/types/stories/organisms/ButtonDropdown/ButtonDropdown.d.ts +14 -0
- package/dist/types/stories/organisms/ButtonDropdown/index.d.ts +3 -0
- package/{lib/components/Dropdown/Dropdown.d.ts → dist/types/stories/organisms/DropdownComponent/DropdownComponent.d.ts} +40 -39
- package/dist/types/stories/organisms/DropdownComponent/dropdownItems.d.ts +3 -0
- package/dist/types/stories/organisms/DropdownComponent/index.d.ts +4 -0
- package/dist/types/stories/organisms/EmptySectionPlaceholder/EmptySectionPlaceholder.d.ts +19 -0
- package/dist/types/stories/organisms/EmptySectionPlaceholder/index.d.ts +3 -0
- package/dist/types/stories/organisms/FormInputWithAddons/FormInputWithAddons.d.ts +21 -0
- package/dist/types/stories/organisms/FormInputWithAddons/index.d.ts +3 -0
- package/dist/types/stories/organisms/index.d.ts +7 -0
- package/dist/types/utils/types.d.ts +2 -0
- package/dist/types/utils/useId.d.ts +1 -0
- package/next.config.js +8 -0
- package/package.json +55 -78
- package/pages/api/hello.ts +13 -0
- package/postcss.config.js +5 -6
- package/public/next.svg +1 -0
- package/public/thirteen.svg +1 -0
- package/public/vercel.svg +1 -0
- package/scripts/create-component.js +97 -0
- package/stories/Introduction.mdx +314 -0
- package/stories/assets/code-brackets.svg +1 -0
- package/stories/assets/colors.svg +1 -0
- package/stories/assets/comments.svg +1 -0
- package/stories/assets/direction.svg +1 -0
- package/stories/assets/flow.svg +1 -0
- package/stories/assets/plugin.svg +1 -0
- package/stories/assets/repo.svg +1 -0
- package/stories/assets/stackalt.svg +1 -0
- package/stories/atoms/Avatar/Avatar.stories.tsx +96 -0
- package/stories/atoms/Avatar/Avatar.tsx +123 -0
- package/stories/atoms/Avatar/index.ts +3 -0
- package/stories/atoms/badges/Badge.tsx +127 -0
- package/stories/atoms/badges/Pill/Pill.stories.tsx +75 -0
- package/stories/atoms/badges/Rounded/Rounded.stories.tsx +75 -0
- package/stories/atoms/badges/index.ts +3 -0
- package/stories/atoms/buttons/Button/Alternative/Alternative.stories.ts +69 -0
- package/stories/atoms/buttons/Button/Button.tsx +123 -0
- package/stories/atoms/buttons/Button/Danger/Danger.stories.ts +71 -0
- package/stories/atoms/buttons/Button/Primary/Primary.stories.ts +78 -0
- package/stories/atoms/buttons/Button/Secondary/Secondary.stories.ts +74 -0
- package/stories/atoms/buttons/Button/defaultArgs.ts +9 -0
- package/stories/atoms/buttons/Button/index.ts +3 -0
- package/stories/atoms/buttons/Capsule/Alternative/Alternative.stories.ts +27 -0
- package/stories/atoms/buttons/Capsule/Capsule.tsx +87 -0
- package/stories/atoms/buttons/Capsule/Danger/Danger.stories.ts +27 -0
- package/stories/atoms/buttons/Capsule/Primary/Primary.stories.ts +27 -0
- package/stories/atoms/buttons/Capsule/Secondary/Secondary.stories.ts +27 -0
- package/stories/atoms/buttons/Capsule/index.ts +3 -0
- package/stories/atoms/buttons/FloatingActionButton/FloatingActionButton.stories.tsx +15 -0
- package/stories/atoms/buttons/FloatingActionButton/FloatingActionButton.tsx +22 -0
- package/stories/atoms/buttons/FloatingActionButton/index.tsx +3 -0
- package/stories/atoms/buttons/index.ts +4 -0
- package/stories/atoms/crumb/Crumb.stories.tsx +18 -0
- package/stories/atoms/crumb/Crumb.tsx +22 -0
- package/stories/atoms/crumb/index.tsx +3 -0
- package/stories/atoms/icons/DynamicIcon.stories.ts +43 -0
- package/stories/atoms/icons/DynamicIcon.tsx +90 -0
- package/stories/atoms/icons/IconWithShadow.stories.ts +43 -0
- package/stories/atoms/icons/IconWithShadow.tsx +16 -0
- package/stories/atoms/icons/TablerIcon.tsx +22 -0
- package/stories/atoms/icons/index.tsx +14 -0
- package/stories/atoms/icons/tablerIconNames.ts +4336 -0
- package/stories/atoms/index.ts +46 -0
- package/stories/atoms/loaders/Loader.stories.ts +15 -0
- package/stories/atoms/loaders/Loader.tsx +15 -0
- package/stories/atoms/loaders/NProgress/RadialProgress.stories.tsx +19 -0
- package/stories/atoms/loaders/NProgress/RadialProgress.tsx +76 -0
- package/stories/atoms/loaders/NProgress/index.ts +3 -0
- package/stories/atoms/loaders/index.ts +4 -0
- package/stories/index.ts +124 -0
- package/stories/layouts/CardLayout/CardLayout.stories.tsx +18 -0
- package/stories/layouts/CardLayout/CardLayout.tsx +22 -0
- package/stories/layouts/CardLayout/index.tsx +3 -0
- package/stories/layouts/ModalLayout/ModalLayout.stories.tsx +18 -0
- package/stories/layouts/ModalLayout/ModalLayout.tsx +22 -0
- package/stories/layouts/ModalLayout/index.tsx +3 -0
- package/stories/layouts/index.ts +0 -0
- package/stories/molecules/index.ts +35 -0
- package/stories/molecules/inputs/InputField/InputField.stories.tsx +29 -0
- package/stories/molecules/inputs/InputField/InputField.tsx +88 -0
- package/stories/molecules/inputs/InputField/index.tsx +3 -0
- package/stories/molecules/inputs/InputLabel/InputLabel.stories.tsx +19 -0
- package/stories/molecules/inputs/InputLabel/InputLabel.tsx +45 -0
- package/stories/molecules/inputs/InputLabel/index.tsx +3 -0
- package/stories/molecules/inputs/NestedInputButton/NestedInputButton.stories.tsx +52 -0
- package/stories/molecules/inputs/NestedInputButton/NestedInputButton.tsx +64 -0
- package/stories/molecules/inputs/NestedInputButton/index.tsx +3 -0
- package/stories/molecules/inputs/checkbox/Checkbox.stories.ts +23 -0
- package/stories/molecules/inputs/checkbox/Checkbox.tsx +99 -0
- package/stories/molecules/inputs/checkbox/index.ts +3 -0
- package/stories/molecules/inputs/combobox/ComboBox.stories.ts +41 -0
- package/stories/molecules/inputs/combobox/ComboBox.tsx +194 -0
- package/stories/molecules/inputs/combobox/index.ts +3 -0
- package/stories/molecules/inputs/index.ts +24 -0
- package/stories/molecules/inputs/radio/Radio.stories.ts +27 -0
- package/stories/molecules/inputs/radio/Radio.tsx +92 -0
- package/stories/molecules/inputs/radio/index.ts +3 -0
- package/stories/molecules/inputs/select/Select.stories.ts +23 -0
- package/stories/molecules/inputs/select/Select.tsx +100 -0
- package/stories/molecules/inputs/select/index.ts +3 -0
- package/stories/molecules/inputs/textArea/TextArea.stories.ts +20 -0
- package/stories/molecules/inputs/textArea/TextArea.tsx +67 -0
- package/stories/molecules/inputs/textArea/index.ts +3 -0
- package/stories/molecules/inputs/toggleSwitch/ToggleSwitch.stories.tsx +119 -0
- package/stories/molecules/inputs/toggleSwitch/ToggleSwitch.tsx +75 -0
- package/stories/molecules/inputs/toggleSwitch/index.ts +3 -0
- package/stories/molecules/tabs/Tabs.stories.tsx +18 -0
- package/stories/molecules/tabs/Tabs.tsx +22 -0
- package/stories/molecules/tabs/index.tsx +3 -0
- package/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.stories.tsx +21 -0
- package/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.tsx +60 -0
- package/stories/organisms/AnimatedLabelInput/index.tsx +3 -0
- package/stories/organisms/ButtonDropdown/ButtonDropdown.stories.tsx +118 -0
- package/stories/organisms/ButtonDropdown/ButtonDropdown.tsx +81 -0
- package/stories/organisms/ButtonDropdown/index.tsx +3 -0
- package/stories/organisms/DropdownComponent/Dropdown.stories.tsx +49 -0
- package/stories/organisms/DropdownComponent/Dropdown.test.tsx +0 -0
- package/stories/organisms/DropdownComponent/DropdownComponent.tsx +269 -0
- package/stories/organisms/DropdownComponent/dropdownItems.ts +101 -0
- package/stories/organisms/DropdownComponent/index.ts +4 -0
- package/stories/organisms/EmptySectionPlaceholder/EmptySectionPlaceholder.stories.tsx +76 -0
- package/stories/organisms/EmptySectionPlaceholder/EmptySectionPlaceholder.tsx +52 -0
- package/stories/organisms/EmptySectionPlaceholder/index.tsx +3 -0
- package/stories/organisms/FormInputWithAddons/FormInputWithAddons.stories.tsx +29 -0
- package/stories/organisms/FormInputWithAddons/FormInputWithAddons.tsx +140 -0
- package/stories/organisms/FormInputWithAddons/index.tsx +3 -0
- package/stories/organisms/index.ts +16 -0
- package/tailwind.config.js +165 -36
- package/tsconfig.json +27 -21
- package/tsconfig.lib.json +19 -0
- package/utils/types.d.ts +2 -0
- package/utils/types.ts +3 -0
- package/utils/useId.d.ts +1 -0
- package/utils/useId.tsx +16 -0
- package/.babelrc +0 -14
- package/.editorconfig +0 -9
- package/.eslintrc +0 -13
- package/.github/workflows/test.yml +0 -27
- package/.storybook/main.js +0 -17
- package/.storybook/manager.js +0 -6
- package/.storybook/plenumTheme.js +0 -8
- package/.storybook/preview.js +0 -44
- package/_templates/component/new/component.ejs.t +0 -18
- package/_templates/component/new/component.stories.ejs.t +0 -21
- package/_templates/component/new/component.test.ejs.t +0 -15
- package/_templates/component/new/index.ejs.t +0 -6
- package/_templates/component/new/prompt.js +0 -7
- package/jest.config.js +0 -8
- package/lib/common/brandCfg.d.ts +0 -3
- package/lib/common/index.d.ts +0 -3
- package/lib/common/storyCfg.d.ts +0 -5
- package/lib/components/Avatar/Avatar.stories.d.ts +0 -6
- package/lib/components/Avatar/Avatar.test.d.ts +0 -1
- package/lib/components/Avatar/index.d.ts +0 -1
- package/lib/components/Button/Button.d.ts +0 -55
- package/lib/components/Button/Button.stories.d.ts +0 -12
- package/lib/components/Button/Button.test.d.ts +0 -1
- package/lib/components/Button/index.d.ts +0 -1
- package/lib/components/ButtonDropdown/ButtonDropdown.d.ts +0 -12
- package/lib/components/ButtonDropdown/ButtonDropdown.stories.d.ts +0 -9
- package/lib/components/ButtonDropdown/index.d.ts +0 -1
- package/lib/components/Combobox/Combobox.stories.d.ts +0 -14
- package/lib/components/Combobox/Combobox.test.d.ts +0 -1
- package/lib/components/Combobox/index.d.ts +0 -1
- package/lib/components/Dropdown/Dropdown.stories.d.ts +0 -8
- package/lib/components/Dropdown/Dropdown.test.d.ts +0 -1
- package/lib/components/Dropdown/data.d.ts +0 -3
- package/lib/components/Dropdown/index.d.ts +0 -1
- package/lib/components/DynamicIcons/DynamicIcons.stories.d.ts +0 -9
- package/lib/components/DynamicIcons/index.d.ts +0 -3
- package/lib/components/DynamicIcons/tablerIconNames.d.ts +0 -2
- package/lib/components/Forms/BaseField/BaseField.d.ts +0 -34
- package/lib/components/Forms/BaseField/BaseField.stories.d.ts +0 -6
- package/lib/components/Forms/BaseField/BaseField.test.d.ts +0 -1
- package/lib/components/Forms/BaseField/index.d.ts +0 -1
- package/lib/components/Forms/Checkbox/Checkbox.stories.d.ts +0 -14
- package/lib/components/Forms/Checkbox/Checkbox.test.d.ts +0 -1
- package/lib/components/Forms/Checkbox/index.d.ts +0 -1
- package/lib/components/Forms/InputCounter/InputCounter.d.ts +0 -9
- package/lib/components/Forms/InputCounter/InputCounter.stories.d.ts +0 -6
- package/lib/components/Forms/InputCounter/InputCounter.test.d.ts +0 -1
- package/lib/components/Forms/InputCounter/index.d.ts +0 -1
- package/lib/components/Forms/InputLabel/InputLabel.stories.d.ts +0 -6
- package/lib/components/Forms/InputLabel/InputLabel.test.d.ts +0 -1
- package/lib/components/Forms/InputLabel/index.d.ts +0 -1
- package/lib/components/Forms/Radio/Radio.stories.d.ts +0 -12
- package/lib/components/Forms/Radio/Radio.test.d.ts +0 -1
- package/lib/components/Forms/Radio/index.d.ts +0 -1
- package/lib/components/Forms/Select/Select.stories.d.ts +0 -11
- package/lib/components/Forms/Select/Select.test.d.ts +0 -1
- package/lib/components/Forms/Select/index.d.ts +0 -1
- package/lib/components/Forms/TextInput/TextInput.d.ts +0 -39
- package/lib/components/Forms/TextInput/TextInput.stories.d.ts +0 -12
- package/lib/components/Forms/TextInput/index.d.ts +0 -1
- package/lib/components/Forms/TextInputAddon/InputCta/InputCta.d.ts +0 -16
- package/lib/components/Forms/TextInputAddon/InputCta/InputCta.stories.d.ts +0 -6
- package/lib/components/Forms/TextInputAddon/InputCta/InputCta.test.d.ts +0 -1
- package/lib/components/Forms/TextInputAddon/InputCta/index.d.ts +0 -1
- package/lib/components/Forms/TextInputAddon/TextInputAddon.d.ts +0 -54
- package/lib/components/Forms/TextInputAddon/TextInputAddon.stories.d.ts +0 -13
- package/lib/components/Forms/TextInputAddon/index.d.ts +0 -1
- package/lib/components/Forms/TextInputSelect/InputSelect/InputSelect.d.ts +0 -13
- package/lib/components/Forms/TextInputSelect/InputSelect/InputSelect.stories.d.ts +0 -6
- package/lib/components/Forms/TextInputSelect/InputSelect/InputSelect.test.d.ts +0 -1
- package/lib/components/Forms/TextInputSelect/InputSelect/index.d.ts +0 -1
- package/lib/components/Forms/TextInputSelect/TextInputSelect.d.ts +0 -48
- package/lib/components/Forms/TextInputSelect/TextInputSelect.stories.d.ts +0 -8
- package/lib/components/Forms/TextInputSelect/index.d.ts +0 -1
- package/lib/components/Forms/Textarea/Textarea.d.ts +0 -32
- package/lib/components/Forms/Textarea/Textarea.stories.d.ts +0 -12
- package/lib/components/Forms/Textarea/Textarea.test.d.ts +0 -1
- package/lib/components/Forms/Textarea/index.d.ts +0 -1
- package/lib/components/ToggleSwitch/ToggleSwitch.d.ts +0 -28
- package/lib/components/ToggleSwitch/ToggleSwitch.stories.d.ts +0 -21
- package/lib/components/ToggleSwitch/ToggleSwitch.test.d.ts +0 -1
- package/lib/components/ToggleSwitch/index.d.ts +0 -1
- package/lib/components/TreeView/TreeView.d.ts +0 -36
- package/lib/components/TreeView/TreeView.stories.d.ts +0 -6
- package/lib/components/TreeView/TreeView.test.d.ts +0 -1
- package/lib/components/TreeView/index.d.ts +0 -1
- package/lib/components/TreeView V1/TreeItem/TreeItem.d.ts +0 -16
- package/lib/components/TreeView V1/TreeItem/TreeItem.stories.d.ts +0 -9
- package/lib/components/TreeView V1/TreeItem/TreeItem.test.d.ts +0 -1
- package/lib/components/TreeView V1/TreeItem/index.d.ts +0 -1
- package/lib/components/TreeView V1/TreeView.d.ts +0 -6
- package/lib/components/TreeView V1/TreeView.stories.d.ts +0 -6
- package/lib/components/TreeView V1/TreeView.test.d.ts +0 -1
- package/lib/components/TreeView V1/context.d.ts +0 -9
- package/lib/components/TreeView V1/index.d.ts +0 -1
- package/lib/components/TreeView V1/sampleData.d.ts +0 -71
- package/lib/components/TreeView V1/types/tree.types.d.ts +0 -21
- package/lib/index.d.ts +0 -13
- package/lib/index.esm.js +0 -105883
- package/lib/index.esm.js.map +0 -1
- package/lib/index.js +0 -105922
- package/lib/index.js.map +0 -1
- package/lib/page/TreeNavigation/CustomNode/CustomNode.d.ts +0 -3
- package/lib/page/TreeNavigation/CustomNode/CustomNode.test.d.ts +0 -1
- package/lib/page/TreeNavigation/CustomNode/index.d.ts +0 -1
- package/lib/page/TreeNavigation/TreeNavigation.d.ts +0 -8
- package/lib/page/TreeNavigation/TreeNavigation.stories.d.ts +0 -6
- package/lib/page/TreeNavigation/hooks/useFetch.d.ts +0 -14
- package/lib/page/TreeNavigation/index.d.ts +0 -1
- package/lib/tailwind.css +0 -2023
- package/lib/util/DynamicIcons.d.ts +0 -10
- package/lib/util/Loader.d.ts +0 -5
- package/lib/util/types.d.ts +0 -2
- package/lib/util/useID.d.ts +0 -1
- package/rollup.config.js +0 -37
- package/setupTests.js +0 -6
- package/styleMock.js +0 -2
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import React, { FC } from "react"
|
|
2
|
+
import { default as cn } from "classnames"
|
|
3
|
+
import Button, { IButtonProps } from "@/stories/atoms/buttons/Button"
|
|
4
|
+
|
|
5
|
+
import { DynamicIcon } from "@/stories/atoms/icons"
|
|
6
|
+
import Dropdown, { IDropdownProps, defaultClassNames } from "../DropdownComponent"
|
|
7
|
+
|
|
8
|
+
export interface IButtonDropdownProps {
|
|
9
|
+
button: IButtonProps
|
|
10
|
+
dropDown: IDropdownProps
|
|
11
|
+
placement?: IDropdownProps["placement"]
|
|
12
|
+
offsetOptions?: IDropdownProps["offsetOptions"]
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Primary UI component for user interaction
|
|
17
|
+
*/
|
|
18
|
+
const ButtonDropdown: FC<IButtonDropdownProps> = ({ button, dropDown, placement, offsetOptions }) => {
|
|
19
|
+
const dropDownClasses: IDropdownProps["classNames"] = {
|
|
20
|
+
...defaultClassNames,
|
|
21
|
+
groupClassname: cn(
|
|
22
|
+
"flex items-center justify-center rounded-l-none border !border-l-0 rounded-r px-2 transition-all hover:!border-l-0",
|
|
23
|
+
button.actionType === "primary"
|
|
24
|
+
? "border-purple-600 bg-purple-600 !text-white hover:border-purple-700 hover:bg-purple-700 active:!border-purple-800 active:!bg-purple-800 fill-white"
|
|
25
|
+
: "",
|
|
26
|
+
button.actionType === "secondary"
|
|
27
|
+
? "border-purple-50 bg-purple-50 !text-purple-700 hover:border-purple-100 hover:bg-purple-100 active:!border-purple-300 active:!bg-purple-300 fill-purple-700"
|
|
28
|
+
: "",
|
|
29
|
+
button.actionType === "alternative"
|
|
30
|
+
? "border-gray-300 bg-white !text-gray-700 fill-gray-700 hover:border-gray-300 hover:bg-gray-50 active:bg-gray-100"
|
|
31
|
+
: ""
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
return (
|
|
35
|
+
<div className="flex items-stretch focus-within:ring-purple-600 focus-within:ring-2 focus-within:ring-offset-white focus-within:ring-offset-2 rounded-[3px]">
|
|
36
|
+
<Button
|
|
37
|
+
{...{
|
|
38
|
+
...button,
|
|
39
|
+
className: cn(
|
|
40
|
+
button.className,
|
|
41
|
+
"!rounded-r-none !border-r-0 hover:!border-r-0 !focus:ring-transparent !focus-visible:ring-transparent !focus-within:ring-transparent !focus:ring-0 !focus-within:ring-0 !focus-visible:ring-0 !focus:ring-offset-0 !focus-visible:ring-offset-0 !focus-within:ring-offset-0 !ring-0 outline-none focus:outline-none focus-visible:outline-none focus-within:outline-none !ring-offset-0"
|
|
42
|
+
)
|
|
43
|
+
}}
|
|
44
|
+
/>
|
|
45
|
+
<div
|
|
46
|
+
className={cn(
|
|
47
|
+
"w-[1px] rt",
|
|
48
|
+
button.actionType === "primary" ? "bg-purple-700" : "",
|
|
49
|
+
button.actionType === "secondary" ? "bg-purple-200" : "",
|
|
50
|
+
button.actionType === "alternative" ? "bg-gray-300" : ""
|
|
51
|
+
)}
|
|
52
|
+
></div>
|
|
53
|
+
<Dropdown
|
|
54
|
+
{...{
|
|
55
|
+
...(dropDown as IDropdownProps),
|
|
56
|
+
CustomDropdownTrigger: (
|
|
57
|
+
<DynamicIcon
|
|
58
|
+
{...{
|
|
59
|
+
icon: "ChevronDownIcon",
|
|
60
|
+
className: cn("h-5 w-5", {
|
|
61
|
+
"text-white": button.actionType === "primary",
|
|
62
|
+
"text-purple-700": button.actionType === "secondary",
|
|
63
|
+
"text-gray-700": button.actionType === "alternative"
|
|
64
|
+
})
|
|
65
|
+
}}
|
|
66
|
+
/>
|
|
67
|
+
),
|
|
68
|
+
classNames: dropDownClasses,
|
|
69
|
+
offsetOptions: offsetOptions ?? {
|
|
70
|
+
crossAxis: 0,
|
|
71
|
+
mainAxis: 5, //up/down
|
|
72
|
+
alignmentAxis: -10 //left/right
|
|
73
|
+
},
|
|
74
|
+
placement
|
|
75
|
+
}}
|
|
76
|
+
/>
|
|
77
|
+
<div className="hidden !bg-purple-100 !text-purple-600 transition-all hover:bg-purple-200 focus:bg-purple-300" />
|
|
78
|
+
</div>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
export default ButtonDropdown
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
|
|
3
|
+
import { DynamicIcon } from "@/stories/atoms/icons"
|
|
4
|
+
import { dropdownDataBase, dropdownDataWithIcons } from "./dropdownItems"
|
|
5
|
+
import Dropdown, { defaultClassNames } from "./DropdownComponent"
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof Dropdown> = {
|
|
8
|
+
title: "Design System/Organisms/Dropdown",
|
|
9
|
+
component: Dropdown,
|
|
10
|
+
tags: ["autodocs"],
|
|
11
|
+
argTypes: {}
|
|
12
|
+
}
|
|
13
|
+
type Story = StoryObj<typeof Dropdown>
|
|
14
|
+
|
|
15
|
+
const IconElement = () => (
|
|
16
|
+
<DynamicIcon className="h-5 w-5 text-gray-400 hover:text-gray-600" icon={"DotsVerticalIcon"} />
|
|
17
|
+
)
|
|
18
|
+
const defaultArgs: Story["args"] = {
|
|
19
|
+
items: [...dropdownDataBase],
|
|
20
|
+
label: "Dropdown",
|
|
21
|
+
classNames: defaultClassNames,
|
|
22
|
+
placement: "bottom-end"
|
|
23
|
+
}
|
|
24
|
+
export const WithLabel: Story = {
|
|
25
|
+
args: {
|
|
26
|
+
...defaultArgs
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const CustomTrigger: Story = {
|
|
31
|
+
args: {
|
|
32
|
+
...defaultArgs,
|
|
33
|
+
CustomDropdownTrigger: <IconElement />
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export const WithLabelAndIcons: Story = {
|
|
37
|
+
args: {
|
|
38
|
+
...defaultArgs,
|
|
39
|
+
items: [...dropdownDataWithIcons]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export const WithIcons: Story = {
|
|
43
|
+
args: {
|
|
44
|
+
...defaultArgs,
|
|
45
|
+
items: [...dropdownDataWithIcons],
|
|
46
|
+
CustomDropdownTrigger: <IconElement />
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export default meta
|
|
File without changes
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import React, { Fragment, HTMLAttributes, useState } from "react"
|
|
2
|
+
import { Transition } from "@headlessui/react"
|
|
3
|
+
import { default as cn } from "classnames"
|
|
4
|
+
import {
|
|
5
|
+
useFloating,
|
|
6
|
+
autoUpdate,
|
|
7
|
+
offset,
|
|
8
|
+
useDismiss,
|
|
9
|
+
useRole,
|
|
10
|
+
useClick,
|
|
11
|
+
useInteractions,
|
|
12
|
+
FloatingFocusManager,
|
|
13
|
+
autoPlacement,
|
|
14
|
+
shift,
|
|
15
|
+
FloatingPortal,
|
|
16
|
+
useTransitionStyles,
|
|
17
|
+
Placement
|
|
18
|
+
} from "@floating-ui/react"
|
|
19
|
+
|
|
20
|
+
import { ClassNameWithAutocomplete } from "utils/types"
|
|
21
|
+
import { DynamicIcon, IDynamicIconProps } from "@/stories/atoms/icons"
|
|
22
|
+
|
|
23
|
+
export interface IItemProp extends HTMLAttributes<HTMLButtonElement> {
|
|
24
|
+
icon?: {
|
|
25
|
+
name: IDynamicIconProps["icon"]
|
|
26
|
+
className?: ClassNameWithAutocomplete
|
|
27
|
+
pos?: "trailing" | "leading"
|
|
28
|
+
outline?: boolean
|
|
29
|
+
}
|
|
30
|
+
label: string
|
|
31
|
+
onClick?(): void
|
|
32
|
+
isEmphasized?: boolean
|
|
33
|
+
key: React.Key
|
|
34
|
+
}
|
|
35
|
+
export interface IDropdownClassnames {
|
|
36
|
+
groupClassname?: ClassNameWithAutocomplete
|
|
37
|
+
itemsClassname?: ClassNameWithAutocomplete
|
|
38
|
+
itemClassname?: ClassNameWithAutocomplete
|
|
39
|
+
activeItemClassname?: ClassNameWithAutocomplete
|
|
40
|
+
buttonClassname?: ClassNameWithAutocomplete
|
|
41
|
+
}
|
|
42
|
+
export interface IDropdownProps extends HTMLAttributes<HTMLDivElement> {
|
|
43
|
+
items: IItemProp[][]
|
|
44
|
+
label: string
|
|
45
|
+
CustomDropdownTrigger?: React.ReactNode
|
|
46
|
+
id: string
|
|
47
|
+
classNames?: IDropdownClassnames
|
|
48
|
+
placement?: Placement
|
|
49
|
+
offsetOptions?: Partial<{
|
|
50
|
+
mainAxis: number
|
|
51
|
+
crossAxis: number
|
|
52
|
+
alignmentAxis: number | null
|
|
53
|
+
}>
|
|
54
|
+
}
|
|
55
|
+
export const defaultClassNames: IDropdownClassnames = {
|
|
56
|
+
groupClassname: "flex inline-block text-left",
|
|
57
|
+
itemsClassname:
|
|
58
|
+
"mt-2 origin-bottom-right rounded bg-white shadow-lg z-20 divide-y divide-gray-100 border border-gray-300 ",
|
|
59
|
+
itemClassname:
|
|
60
|
+
"group flex font-muli cursor-pointer items-center px-4 py-2 text-sm transition-all hover:bg-gray-100 hover:text-gray-900 justify-between gap-4 ",
|
|
61
|
+
activeItemClassname: "block px-4 py-2 text-sm text-gray-700 bg-gray-100 hover:bg-gray-200 hover:text-gray-900",
|
|
62
|
+
buttonClassname:
|
|
63
|
+
"py-[2px] z-20 flex items-center rounded outline-purple-500 transition-all text-gray-400 hover:text-gray-600 "
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Comment */
|
|
67
|
+
const Dropdown: React.FC<IDropdownProps> = ({
|
|
68
|
+
items,
|
|
69
|
+
id,
|
|
70
|
+
label,
|
|
71
|
+
classNames = defaultClassNames,
|
|
72
|
+
CustomDropdownTrigger,
|
|
73
|
+
placement = "bottom-start",
|
|
74
|
+
offsetOptions,
|
|
75
|
+
...props
|
|
76
|
+
}: IDropdownProps): JSX.Element | null => {
|
|
77
|
+
const [isOpen, setIsOpen] = useState(false)
|
|
78
|
+
const [activeItem, setActiveItem] = useState<React.Key | null>(null)
|
|
79
|
+
|
|
80
|
+
// Floating UI logic
|
|
81
|
+
const { refs, floatingStyles, context } = useFloating({
|
|
82
|
+
open: isOpen,
|
|
83
|
+
onOpenChange: setIsOpen,
|
|
84
|
+
placement,
|
|
85
|
+
middleware: [
|
|
86
|
+
offset(offsetOptions ?? 10),
|
|
87
|
+
autoPlacement({
|
|
88
|
+
allowedPlacements: [placement, "bottom-start", "bottom-end", "bottom"]
|
|
89
|
+
}),
|
|
90
|
+
shift({ rootBoundary: "document" })
|
|
91
|
+
],
|
|
92
|
+
whileElementsMounted: autoUpdate
|
|
93
|
+
})
|
|
94
|
+
const click = useClick(context)
|
|
95
|
+
const dismiss = useDismiss(context)
|
|
96
|
+
const role = useRole(context)
|
|
97
|
+
const { getReferenceProps, getFloatingProps } = useInteractions([click, dismiss, role])
|
|
98
|
+
const { isMounted, styles: transitionStyles } = useTransitionStyles(context, {
|
|
99
|
+
duration: {
|
|
100
|
+
open: 200,
|
|
101
|
+
close: 200
|
|
102
|
+
},
|
|
103
|
+
initial: {
|
|
104
|
+
opacity: 0
|
|
105
|
+
},
|
|
106
|
+
open: {
|
|
107
|
+
opacity: 1
|
|
108
|
+
}
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
const { groupClassname, buttonClassname, itemsClassname, itemClassname, activeItemClassname } = classNames
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<div
|
|
115
|
+
{...{
|
|
116
|
+
className: groupClassname,
|
|
117
|
+
role: "combobox",
|
|
118
|
+
"aria-owns": `${id}-list`,
|
|
119
|
+
"aria-expanded": isOpen,
|
|
120
|
+
"aria-haspopup": "listbox",
|
|
121
|
+
...props
|
|
122
|
+
}}
|
|
123
|
+
>
|
|
124
|
+
<button
|
|
125
|
+
{...{
|
|
126
|
+
ref: refs.setReference,
|
|
127
|
+
className: buttonClassname,
|
|
128
|
+
onClick: () => {
|
|
129
|
+
setIsOpen(!isOpen)
|
|
130
|
+
},
|
|
131
|
+
...getReferenceProps()
|
|
132
|
+
}}
|
|
133
|
+
>
|
|
134
|
+
{CustomDropdownTrigger ? (
|
|
135
|
+
<span className="">{CustomDropdownTrigger}</span>
|
|
136
|
+
) : (
|
|
137
|
+
<>
|
|
138
|
+
<span className="pl-1">{label}</span>
|
|
139
|
+
<DynamicIcon icon="ChevronDownIcon" className="ml-1 h-5 w-6 " />
|
|
140
|
+
</>
|
|
141
|
+
)}
|
|
142
|
+
</button>
|
|
143
|
+
|
|
144
|
+
{isMounted && items.length > 0 && isOpen && (
|
|
145
|
+
<FloatingPortal>
|
|
146
|
+
<FloatingFocusManager context={context} modal={true}>
|
|
147
|
+
<Transition
|
|
148
|
+
as={Fragment}
|
|
149
|
+
show={isOpen}
|
|
150
|
+
enter="transition ease-out duration-100"
|
|
151
|
+
enterFrom="transform opacity-0 scale-95"
|
|
152
|
+
enterTo="transform opacity-100 scale-100"
|
|
153
|
+
leave="transition ease-in duration-75"
|
|
154
|
+
leaveFrom="transform opacity-100 scale-100"
|
|
155
|
+
leaveTo="transform opacity-0 scale-95"
|
|
156
|
+
>
|
|
157
|
+
<ul
|
|
158
|
+
{...{
|
|
159
|
+
...getFloatingProps(),
|
|
160
|
+
className: itemsClassname,
|
|
161
|
+
ref: refs.setFloating,
|
|
162
|
+
// style: floatingStyles,
|
|
163
|
+
"aria-labelledby": label,
|
|
164
|
+
id: `${id}-list`,
|
|
165
|
+
role: "listbox",
|
|
166
|
+
style: {
|
|
167
|
+
position: context.strategy,
|
|
168
|
+
top: Math.round(context.y ?? 0),
|
|
169
|
+
left: Math.round(context.x ?? 0),
|
|
170
|
+
width: "max-content",
|
|
171
|
+
maxWidth: "min(calc(100vw - 10px), 25rem)",
|
|
172
|
+
...floatingStyles
|
|
173
|
+
}
|
|
174
|
+
}}
|
|
175
|
+
className={itemsClassname}
|
|
176
|
+
ref={refs.setFloating}
|
|
177
|
+
aria-labelledby={label}
|
|
178
|
+
{...getFloatingProps()}
|
|
179
|
+
>
|
|
180
|
+
{items.map((itemStack, idx) => {
|
|
181
|
+
return (
|
|
182
|
+
<React.Fragment key={`${idx}-list-${id}`}>
|
|
183
|
+
{itemStack.map(({ onClick, label, key, isEmphasized, icon, ...rest }) => {
|
|
184
|
+
const active = activeItem && activeItem === key
|
|
185
|
+
const itemClass = cn(
|
|
186
|
+
itemClassname,
|
|
187
|
+
"group flex cursor-pointer items-center px-4 py-2 text-sm transition-all",
|
|
188
|
+
{
|
|
189
|
+
"text-red-500": isEmphasized
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"text-gray-900": !isEmphasized
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"bg-gray-100 text-gray-900": active
|
|
196
|
+
},
|
|
197
|
+
active ? activeItemClassname : "",
|
|
198
|
+
{
|
|
199
|
+
"bg-gray-100 text-red-500 hover:text-red-500":
|
|
200
|
+
active && isEmphasized
|
|
201
|
+
},
|
|
202
|
+
itemClassname
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
return (
|
|
206
|
+
<li key={key}>
|
|
207
|
+
<button
|
|
208
|
+
{...{
|
|
209
|
+
onClick: () => {
|
|
210
|
+
setActiveItem(key)
|
|
211
|
+
onClick && onClick()
|
|
212
|
+
},
|
|
213
|
+
key,
|
|
214
|
+
className: cn(itemClass, "w-full"),
|
|
215
|
+
...rest
|
|
216
|
+
}}
|
|
217
|
+
>
|
|
218
|
+
<div className="flex items-center gap-x-4">
|
|
219
|
+
{icon &&
|
|
220
|
+
(icon.pos === "leading" ||
|
|
221
|
+
icon?.pos === undefined) && (
|
|
222
|
+
<DynamicIcon
|
|
223
|
+
{...{
|
|
224
|
+
icon: icon.name,
|
|
225
|
+
className: cn(
|
|
226
|
+
icon.className,
|
|
227
|
+
{
|
|
228
|
+
"text-red-500": isEmphasized
|
|
229
|
+
},
|
|
230
|
+
"opacity-60 group-hover:opacity-100"
|
|
231
|
+
),
|
|
232
|
+
outline: icon.outline
|
|
233
|
+
}}
|
|
234
|
+
/>
|
|
235
|
+
)}
|
|
236
|
+
<div className="whitespace-nowrap">{label}</div>
|
|
237
|
+
{icon && icon.pos === "trailing" && (
|
|
238
|
+
<DynamicIcon
|
|
239
|
+
{...{
|
|
240
|
+
icon: icon.name,
|
|
241
|
+
className: cn(
|
|
242
|
+
icon.className,
|
|
243
|
+
{
|
|
244
|
+
"text-red-500": isEmphasized
|
|
245
|
+
},
|
|
246
|
+
"opacity-60 group-"
|
|
247
|
+
),
|
|
248
|
+
outline: icon.outline
|
|
249
|
+
}}
|
|
250
|
+
/>
|
|
251
|
+
)}
|
|
252
|
+
</div>
|
|
253
|
+
</button>
|
|
254
|
+
</li>
|
|
255
|
+
)
|
|
256
|
+
})}
|
|
257
|
+
</React.Fragment>
|
|
258
|
+
)
|
|
259
|
+
})}
|
|
260
|
+
</ul>
|
|
261
|
+
</Transition>
|
|
262
|
+
</FloatingFocusManager>
|
|
263
|
+
</FloatingPortal>
|
|
264
|
+
)}
|
|
265
|
+
</div>
|
|
266
|
+
)
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export default Dropdown
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { IItemProp } from "./DropdownComponent"
|
|
2
|
+
|
|
3
|
+
export const dropdownDataBase: IItemProp[][] = [
|
|
4
|
+
[
|
|
5
|
+
{
|
|
6
|
+
key: "Copy",
|
|
7
|
+
label: "Copy",
|
|
8
|
+
onClick: () => {
|
|
9
|
+
console.log("Copy action")
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
[
|
|
14
|
+
{
|
|
15
|
+
key: "Add to Batch",
|
|
16
|
+
label: "Add to Batch",
|
|
17
|
+
onClick: () => {
|
|
18
|
+
console.log("Add to Batch action")
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
key: "View Batch",
|
|
23
|
+
label: "View Batch",
|
|
24
|
+
onClick: () => {
|
|
25
|
+
console.log("View Batch action")
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
[
|
|
30
|
+
{
|
|
31
|
+
label: "Delete",
|
|
32
|
+
onClick: () => {
|
|
33
|
+
console.log("Delete action")
|
|
34
|
+
},
|
|
35
|
+
isEmphasized: true,
|
|
36
|
+
key: "Delete"
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
export const dropdownDataWithIcons: IItemProp[][] = [
|
|
42
|
+
[
|
|
43
|
+
{
|
|
44
|
+
icon: {
|
|
45
|
+
name: "IconClipboardCopy",
|
|
46
|
+
pos: "leading",
|
|
47
|
+
className: "h-5 w-5",
|
|
48
|
+
outline: false
|
|
49
|
+
},
|
|
50
|
+
key: "Copy",
|
|
51
|
+
label: "Copy",
|
|
52
|
+
onClick: () => {
|
|
53
|
+
console.log("Copy action")
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
[
|
|
58
|
+
{
|
|
59
|
+
icon: {
|
|
60
|
+
name: "IconFolderPlus",
|
|
61
|
+
pos: "leading",
|
|
62
|
+
className: "h-5 w-5",
|
|
63
|
+
outline: false
|
|
64
|
+
},
|
|
65
|
+
key: "Add to Batch",
|
|
66
|
+
label: "Add to Batch",
|
|
67
|
+
onClick: () => {
|
|
68
|
+
console.log("Add to Batch action")
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
icon: {
|
|
73
|
+
name: "IconEye",
|
|
74
|
+
pos: "leading",
|
|
75
|
+
className: "h-5 w-5",
|
|
76
|
+
outline: false
|
|
77
|
+
},
|
|
78
|
+
key: "View Batch",
|
|
79
|
+
label: "View Batch",
|
|
80
|
+
onClick: () => {
|
|
81
|
+
console.log("View Batch action")
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
[
|
|
86
|
+
{
|
|
87
|
+
icon: {
|
|
88
|
+
name: "IconTrash",
|
|
89
|
+
pos: "leading",
|
|
90
|
+
className: "h-5 w-5",
|
|
91
|
+
outline: false
|
|
92
|
+
},
|
|
93
|
+
key: "Delete",
|
|
94
|
+
label: "Delete",
|
|
95
|
+
onClick: () => {
|
|
96
|
+
console.log("Delete action")
|
|
97
|
+
},
|
|
98
|
+
isEmphasized: true
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
]
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
import EmptySectionPlaceholder, { IEmptySectionPlaceholderProps } from "./EmptySectionPlaceholder"
|
|
3
|
+
import { useRef } from "react"
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof EmptySectionPlaceholder> = {
|
|
6
|
+
title: "Design System/Organisms/Empty Section Placeholder",
|
|
7
|
+
component: EmptySectionPlaceholder,
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
argTypes: {}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default meta
|
|
13
|
+
type Story = StoryObj<typeof EmptySectionPlaceholder>
|
|
14
|
+
|
|
15
|
+
const MissingAttachmentCTA = () => {
|
|
16
|
+
const fileInputRef = useRef<HTMLInputElement>(null)
|
|
17
|
+
return (
|
|
18
|
+
<div className="mb-2 block text-sm font-medium text-gray-600">
|
|
19
|
+
<input type="file" className="hidden" ref={fileInputRef} />
|
|
20
|
+
<button
|
|
21
|
+
className="hover:underline hover:text-gray-700 transition-all"
|
|
22
|
+
onClick={() => {
|
|
23
|
+
fileInputRef?.current && fileInputRef.current.click()
|
|
24
|
+
}}
|
|
25
|
+
>
|
|
26
|
+
Upload
|
|
27
|
+
</button>{" "}
|
|
28
|
+
<span>OR drag and drop a file</span>
|
|
29
|
+
</div>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const CallsToAction: Story = {
|
|
34
|
+
args: {
|
|
35
|
+
icon: { icon: "IconPaperclip" },
|
|
36
|
+
mutedText: "No File is attached yet",
|
|
37
|
+
CallToActionComponent: <MissingAttachmentCTA />,
|
|
38
|
+
actions: [
|
|
39
|
+
{
|
|
40
|
+
actionType: "alternative",
|
|
41
|
+
icon: {
|
|
42
|
+
icon: "UploadIcon",
|
|
43
|
+
outline: true
|
|
44
|
+
},
|
|
45
|
+
iconPosition: "leading",
|
|
46
|
+
label: "Upload",
|
|
47
|
+
onClick: () => window.alert("Clicked")
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
actionType: "alternative",
|
|
51
|
+
icon: {
|
|
52
|
+
icon: "ViewGridIcon",
|
|
53
|
+
outline: true
|
|
54
|
+
},
|
|
55
|
+
size: "lg",
|
|
56
|
+
iconPosition: "leading",
|
|
57
|
+
label: "Browse",
|
|
58
|
+
onClick: () => window.alert("Clicked")
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
isWide: true
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
export const NoActions: Story = {
|
|
65
|
+
args: {
|
|
66
|
+
icon: {
|
|
67
|
+
icon: "PencilAltIcon",
|
|
68
|
+
className: "h-5 w-5 text-gray-400 ",
|
|
69
|
+
outline: true
|
|
70
|
+
},
|
|
71
|
+
mutedText: "No Recent Changes",
|
|
72
|
+
primaryMessage: "There haven't been any recent changes\nto the content in this of this instance.",
|
|
73
|
+
actions: [],
|
|
74
|
+
isWide: true
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import Button, { IButtonProps } from "@/stories/atoms/buttons/Button"
|
|
3
|
+
import { IDynamicIconProps } from "@/stories/atoms/icons"
|
|
4
|
+
import IconWithShadow from "@/stories/atoms/icons/IconWithShadow"
|
|
5
|
+
import { default as cn } from "classnames"
|
|
6
|
+
|
|
7
|
+
export interface IEmptySectionPlaceholderProps {
|
|
8
|
+
/** the primary icon to display at top of component */
|
|
9
|
+
icon: IDynamicIconProps
|
|
10
|
+
/** the muted text to display below the icon */
|
|
11
|
+
mutedText?: string
|
|
12
|
+
/** the primary message to display below the muted text */
|
|
13
|
+
primaryMessage: string
|
|
14
|
+
/** the call to action component that if provided will be used instead of primaryMessage */
|
|
15
|
+
CallToActionComponent?: React.ReactNode
|
|
16
|
+
/** the actions to display below the primary call to action or message */
|
|
17
|
+
actions: IButtonProps[]
|
|
18
|
+
/** whether to display the component in a wide or narrow format */
|
|
19
|
+
isWide?: boolean
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const EmptySectionPlaceholder: React.FC<IEmptySectionPlaceholderProps> = ({
|
|
23
|
+
icon,
|
|
24
|
+
mutedText,
|
|
25
|
+
primaryMessage,
|
|
26
|
+
CallToActionComponent,
|
|
27
|
+
actions,
|
|
28
|
+
isWide
|
|
29
|
+
}) => {
|
|
30
|
+
return (
|
|
31
|
+
<div className="flex h-full w-full flex-col items-center justify-center border-2 border-dashed border-gray-300 p-5">
|
|
32
|
+
<IconWithShadow {...icon} />
|
|
33
|
+
{mutedText && <p className="my-2 block text-xs text-gray-500">{mutedText}</p>}
|
|
34
|
+
{CallToActionComponent ? (
|
|
35
|
+
CallToActionComponent
|
|
36
|
+
) : (
|
|
37
|
+
<p className="mb-2 block text-sm font-medium text-gray-600">{primaryMessage}</p>
|
|
38
|
+
)}
|
|
39
|
+
{actions.length > 0 ? (
|
|
40
|
+
<div className={cn("mt-2 flex gap-2", isWide ? "" : "flex-col items-center")}>
|
|
41
|
+
{actions.map((action, index) => (
|
|
42
|
+
<Button {...{ ...action }} key={action.label.replaceAll(" ", "-")} />
|
|
43
|
+
))}
|
|
44
|
+
</div>
|
|
45
|
+
) : (
|
|
46
|
+
<></>
|
|
47
|
+
)}
|
|
48
|
+
</div>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export default EmptySectionPlaceholder
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
import FormInputWithAddons, { IFormInputWithAddonsProps } from "./FormInputWithAddons"
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof FormInputWithAddons> = {
|
|
5
|
+
title: "Design System/organisms/Form Input With Addons",
|
|
6
|
+
component: FormInputWithAddons,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
argTypes: {},
|
|
9
|
+
parameters: {
|
|
10
|
+
design: {
|
|
11
|
+
type: "figma",
|
|
12
|
+
url: "https://www.figma.com/file/Rb5fJ8hD3pwvLnidgCaGgB/Agility-UI?type=design&node-id=85-1269&mode=design"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default meta
|
|
18
|
+
type Story = StoryObj<typeof FormInputWithAddons>
|
|
19
|
+
|
|
20
|
+
export const DefaultFormInputWithAddons: Story = {
|
|
21
|
+
args: {
|
|
22
|
+
id: "appSearch",
|
|
23
|
+
name: "appSearch",
|
|
24
|
+
leadLabel: "Search",
|
|
25
|
+
addonOffset: 60,
|
|
26
|
+
labelClass: "text-gray-900",
|
|
27
|
+
trailIcon: { icon: "SearchIcon" }
|
|
28
|
+
}
|
|
29
|
+
}
|