@agility/plenum-ui 2.0.0-rc3 → 2.0.0-rc30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +104 -31
- package/build.js +30 -25
- package/dist/index.d.ts +274 -89
- package/dist/index.js +1 -5976
- package/dist/index.js.map +4 -4
- package/dist/tailwind.css +63516 -0
- package/dist/types/stories/atoms/buttons/Button/Button.d.ts +3 -7
- package/dist/types/stories/atoms/buttons/Capsule/Capsule.d.ts +1 -1
- package/dist/types/stories/atoms/icons/DynamicIcon.d.ts +2 -2
- package/dist/types/stories/atoms/icons/TablerIcon.d.ts +1 -1
- package/dist/types/stories/index.d.ts +4 -4
- package/dist/types/stories/molecules/index.d.ts +3 -3
- package/dist/types/stories/molecules/inputs/InputCounter/InputCounter.d.ts +10 -0
- package/dist/types/stories/molecules/inputs/InputCounter/index.d.ts +2 -0
- package/dist/types/stories/molecules/inputs/InputField/InputField.d.ts +8 -4
- package/dist/types/stories/molecules/inputs/TextInput/TextInput.d.ts +39 -0
- package/dist/types/stories/molecules/inputs/TextInput/index.d.ts +4 -0
- package/dist/types/stories/molecules/inputs/index.d.ts +5 -4
- package/dist/types/stories/molecules/inputs/select/Select.d.ts +2 -2
- package/dist/types/stories/molecules/inputs/textArea/TextArea.d.ts +34 -21
- package/dist/types/stories/molecules/inputs/textArea/TextArea.stories.d.ts +4 -4
- package/dist/types/stories/molecules/inputs/textArea/index.d.ts +3 -3
- package/dist/types/stories/molecules/inputs/toggleSwitch/ToggleSwitch.d.ts +9 -7
- package/dist/types/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.d.ts +3 -5
- package/dist/types/stories/organisms/AnimatedLabelInput/index.d.ts +1 -1
- package/dist/types/stories/organisms/AnimatedLabelTextArea/AnimatedLabelTextArea.d.ts +12 -0
- package/dist/types/stories/organisms/AnimatedLabelTextArea/index.d.ts +3 -0
- package/dist/types/stories/organisms/DropdownComponent/DropdownComponent.d.ts +20 -12
- package/dist/types/stories/organisms/DropdownComponent/index.d.ts +2 -2
- package/dist/types/stories/organisms/EmptySectionPlaceholder/index.d.ts +1 -1
- package/dist/types/stories/organisms/TextInputSelect/InputSelect.d.ts +16 -0
- package/dist/types/stories/organisms/TextInputSelect/TextInputSelect.d.ts +48 -0
- package/dist/types/stories/organisms/TextInputSelect/index.d.ts +3 -0
- package/dist/types/stories/organisms/index.d.ts +5 -3
- package/local.sh +100 -0
- package/package.json +36 -19
- package/rollup.config.mjs +42 -0
- package/stories/Introduction.mdx +1 -1
- package/stories/atoms/badges/Badge.tsx +1 -1
- package/stories/atoms/buttons/Button/Button.tsx +23 -18
- package/stories/atoms/buttons/Button/Danger/Danger.stories.ts +2 -2
- package/stories/atoms/buttons/Button/Primary/Primary.stories.ts +2 -2
- package/stories/atoms/buttons/Button/Secondary/Secondary.stories.ts +1 -1
- package/stories/atoms/buttons/Button/defaultArgs.ts +1 -1
- package/stories/atoms/buttons/Capsule/Capsule.tsx +2 -1
- package/stories/atoms/icons/DynamicIcon.stories.ts +1 -1
- package/stories/atoms/icons/DynamicIcon.tsx +7 -7
- package/stories/atoms/icons/IconWithShadow.stories.ts +3 -3
- package/stories/atoms/icons/TablerIcon.tsx +1 -1
- package/stories/atoms/loaders/Loader.tsx +12 -6
- package/stories/index.ts +22 -10
- package/stories/molecules/index.ts +22 -6
- package/stories/molecules/inputs/InputCounter/InputCounter.stories.tsx +18 -0
- package/stories/molecules/inputs/InputCounter/InputCounter.tsx +24 -0
- package/stories/molecules/inputs/InputCounter/index.tsx +3 -0
- package/stories/molecules/inputs/InputField/InputField.tsx +13 -7
- package/stories/molecules/inputs/TextInput/TextInput.stories.tsx +32 -0
- package/stories/molecules/inputs/TextInput/TextInput.tsx +165 -0
- package/stories/molecules/inputs/TextInput/index.tsx +5 -0
- package/stories/molecules/inputs/checkbox/Checkbox.tsx +1 -1
- package/stories/molecules/inputs/combobox/ComboBox.tsx +126 -135
- package/stories/molecules/inputs/index.ts +18 -4
- package/stories/molecules/inputs/select/Select.tsx +1 -1
- package/stories/molecules/inputs/textArea/TextArea.stories.ts +7 -5
- package/stories/molecules/inputs/textArea/TextArea.tsx +139 -48
- package/stories/molecules/inputs/textArea/index.ts +3 -3
- package/stories/molecules/inputs/toggleSwitch/ToggleSwitch.tsx +61 -57
- package/stories/molecules/tabs/index.tsx +2 -3
- package/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.stories.tsx +10 -1
- package/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.tsx +43 -37
- package/stories/organisms/AnimatedLabelInput/index.tsx +1 -1
- package/stories/organisms/AnimatedLabelTextArea/AnimatedLabelTextArea.stories.tsx +26 -0
- package/stories/organisms/AnimatedLabelTextArea/AnimatedLabelTextArea.tsx +61 -0
- package/stories/organisms/AnimatedLabelTextArea/index.tsx +3 -0
- package/stories/organisms/ButtonDropdown/ButtonDropdown.stories.tsx +60 -58
- package/stories/organisms/ButtonDropdown/ButtonDropdown.tsx +13 -17
- package/stories/organisms/DropdownComponent/Dropdown.stories.tsx +2 -2
- package/stories/organisms/DropdownComponent/DropdownComponent.tsx +89 -70
- package/stories/organisms/DropdownComponent/dropdownItems.ts +27 -3
- package/stories/organisms/DropdownComponent/index.ts +2 -2
- package/stories/organisms/EmptySectionPlaceholder/EmptySectionPlaceholder.stories.tsx +3 -3
- package/stories/organisms/EmptySectionPlaceholder/index.tsx +2 -1
- package/stories/organisms/FormInputWithAddons/FormInputWithAddons.stories.tsx +1 -1
- package/stories/organisms/FormInputWithAddons/FormInputWithAddons.tsx +7 -2
- package/stories/organisms/TextInputSelect/InputSelect.tsx +59 -0
- package/stories/organisms/TextInputSelect/TextInputSelect.stories.tsx +33 -0
- package/stories/organisms/TextInputSelect/TextInputSelect.tsx +186 -0
- package/stories/organisms/TextInputSelect/index.tsx +3 -0
- package/stories/organisms/index.ts +15 -4
- package/tsconfig.lib.json +13 -6
- package/watch.js +50 -0
- package/.yarnrc.yml +0 -1
- package/dist/types/stories/layouts/index.d.ts +0 -0
- package/stories/layouts/CardLayout/CardLayout.stories.tsx +0 -18
- package/stories/layouts/CardLayout/CardLayout.tsx +0 -22
- package/stories/layouts/CardLayout/index.tsx +0 -3
- package/stories/layouts/ModalLayout/ModalLayout.stories.tsx +0 -18
- package/stories/layouts/ModalLayout/ModalLayout.tsx +0 -22
- package/stories/layouts/ModalLayout/index.tsx +0 -3
- package/stories/layouts/index.ts +0 -0
- package/stories/organisms/DropdownComponent/Dropdown.test.tsx +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agility/plenum-ui",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-rc30",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -17,19 +17,35 @@
|
|
|
17
17
|
"storybook:tw": "tailwindcss -o ./lib/tailwind.css -w ",
|
|
18
18
|
"storybook": "npm-run-all -p \"storybook:*\" ",
|
|
19
19
|
"dev": "yarn storybook",
|
|
20
|
-
"build:tw": "tailwindcss -o ./
|
|
20
|
+
"build:tw": "tailwindcss -o ./dist/tailwind.css",
|
|
21
21
|
"build:tsc": "yarn node build.js",
|
|
22
22
|
"prepare": "yarn build",
|
|
23
|
-
"build": "
|
|
23
|
+
"build": "yarn clean && npm-run-all -s \"build:*\" ",
|
|
24
24
|
"clean": "rimraf dist",
|
|
25
|
-
"create-component": "node scripts/create-component.js"
|
|
25
|
+
"create-component": "node scripts/create-component.js",
|
|
26
|
+
"start:local": "bash ./local.sh",
|
|
27
|
+
"start:watch": "yarn node watch.js"
|
|
26
28
|
},
|
|
27
|
-
"
|
|
29
|
+
"dependencies": {
|
|
28
30
|
"@floating-ui/react": "^0.25.0",
|
|
29
31
|
"@headlessui/react": "^1.7.10",
|
|
30
32
|
"@headlessui/tailwindcss": "^0.1.2",
|
|
31
33
|
"@heroicons/react": "^1.0.5",
|
|
32
34
|
"@next/font": "^13.4.12",
|
|
35
|
+
"@tabler/icons": "^2.26.0",
|
|
36
|
+
"@tabler/icons-react": "^2.27.0",
|
|
37
|
+
"@tailwindcss/forms": "^0.5.3",
|
|
38
|
+
"@tailwindcss/typography": "^0.5.9",
|
|
39
|
+
"classnames": "^2.3.2",
|
|
40
|
+
"concurrently": "^7.6.0",
|
|
41
|
+
"next": "13.1.6",
|
|
42
|
+
"npm-dts": "^1.3.12",
|
|
43
|
+
"npm-run-all": "^4.1.5",
|
|
44
|
+
"postcss": "^8.4.21",
|
|
45
|
+
"tailwindcss": "^3.2.4",
|
|
46
|
+
"typescript": "^5.1.6"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
33
49
|
"@storybook/addon-designs": "^7.0.1",
|
|
34
50
|
"@storybook/addon-essentials": "^7.1.1",
|
|
35
51
|
"@storybook/addon-interactions": "^7.1.1",
|
|
@@ -40,27 +56,28 @@
|
|
|
40
56
|
"@storybook/react": "^7.1.1",
|
|
41
57
|
"@storybook/testing-library": "^0.2.0",
|
|
42
58
|
"@storybook/theming": "^7.1.1",
|
|
43
|
-
"@tabler/icons": "^2.26.0",
|
|
44
|
-
"@tabler/icons-react": "^2.27.0",
|
|
45
|
-
"@tailwindcss/forms": "^0.5.3",
|
|
46
|
-
"@tailwindcss/typography": "^0.5.9",
|
|
47
59
|
"@types/node": "18.11.18",
|
|
48
60
|
"autoprefixer": "^10.4.13",
|
|
49
|
-
"classnames": "^2.3.2",
|
|
50
|
-
"concurrently": "^7.6.0",
|
|
51
61
|
"esbuild": "^0.18.19",
|
|
52
62
|
"eslint": "8.32.0",
|
|
53
63
|
"eslint-config-next": "13.1.6",
|
|
54
64
|
"eslint-plugin-storybook": "^0.6.13",
|
|
55
|
-
"next": "13.1.6",
|
|
56
|
-
"npm-dts": "^1.3.12",
|
|
57
|
-
"npm-run-all": "^4.1.5",
|
|
58
|
-
"postcss": "^8.4.21",
|
|
59
65
|
"react": "18.2.0",
|
|
60
66
|
"react-dom": "18.2.0",
|
|
61
67
|
"react-icons": "^4.10.1",
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
|
|
68
|
+
"rimraf": "^5.0.1",
|
|
69
|
+
"storybook": "^7.1.1"
|
|
70
|
+
},
|
|
71
|
+
"peerDependencies": {
|
|
72
|
+
"@floating-ui/react": "^0.25.0",
|
|
73
|
+
"@headlessui/react": "^1.7.10",
|
|
74
|
+
"@headlessui/tailwindcss": "^0.1.2",
|
|
75
|
+
"@heroicons/react": "^1.0.5",
|
|
76
|
+
"@tabler/icons": "^2.26.0",
|
|
77
|
+
"@tabler/icons-react": "^2.27.0",
|
|
78
|
+
"classnames": "^2.3.2",
|
|
79
|
+
"react": "18.2.0",
|
|
80
|
+
"react-dom": "18.2.0",
|
|
81
|
+
"react-icons": "^4.10.1"
|
|
65
82
|
}
|
|
66
|
-
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
|
|
2
|
+
import resolve from '@rollup/plugin-node-resolve';
|
|
3
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
4
|
+
import typescript from '@rollup/plugin-typescript';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
const config = [
|
|
8
|
+
{
|
|
9
|
+
|
|
10
|
+
input: 'stories/index.ts',
|
|
11
|
+
|
|
12
|
+
output: [
|
|
13
|
+
{
|
|
14
|
+
file: "lib/index.js",
|
|
15
|
+
format: 'cjs',
|
|
16
|
+
sourcemap: true
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
file: "lib/index.esm.js",
|
|
20
|
+
format: 'esm',
|
|
21
|
+
sourcemap: true
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
external: ["react", "react-dom"],
|
|
25
|
+
plugins: [
|
|
26
|
+
peerDepsExternal(),
|
|
27
|
+
resolve(),
|
|
28
|
+
commonjs(),
|
|
29
|
+
typescript({
|
|
30
|
+
tsconfig: "./tsconfig.lib.json",
|
|
31
|
+
})
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
input: "lib/esm/types/index.d.ts",
|
|
36
|
+
output: [{ file: "dist/index.d.ts", format: "esm" }],
|
|
37
|
+
plugins: [dts()],
|
|
38
|
+
external: ["react", "react-dom"],
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
export default config;
|
package/stories/Introduction.mdx
CHANGED
|
@@ -143,7 +143,7 @@ In your app entry point (i.e. \`_app.tsx\`), import the \`globals.css\` file fro
|
|
|
143
143
|
|
|
144
144
|
```jsx
|
|
145
145
|
import "<RELATIVE_PATH>/globals.css";
|
|
146
|
-
import "@agility/plenum-ui/lib/tailwind.css";
|
|
146
|
+
import "@agility/plenum-ui/dist/lib/tailwind.css";
|
|
147
147
|
```
|
|
148
148
|
|
|
149
149
|
Make sure to add any additional styles before these two import statements to prevent overwriting the Plenum styling.
|
|
@@ -117,7 +117,7 @@ const Badge: React.FC<IBadgeProps> = ({
|
|
|
117
117
|
className: `${removeButton?.className || ""} group outline-0 `
|
|
118
118
|
}}
|
|
119
119
|
>
|
|
120
|
-
<DynamicIcon {...{ icon: "
|
|
120
|
+
<DynamicIcon {...{ icon: "IconX", className: removeButtonStyles }} />
|
|
121
121
|
</button>
|
|
122
122
|
)}
|
|
123
123
|
</div>
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import Loader from "stories/atoms/loaders/Loader"
|
|
2
2
|
import { default as cn } from "classnames"
|
|
3
|
-
import { HTMLAttributeAnchorTarget } from "react"
|
|
3
|
+
import React, { HTMLAttributeAnchorTarget, forwardRef } from "react"
|
|
4
4
|
import { DynamicIcon, UnifiedIconName, IDynamicIconProps } from "../../icons"
|
|
5
5
|
|
|
6
6
|
// import Loader from "../loaders/loader/Loader"
|
|
7
7
|
|
|
8
8
|
export type BTNActionType = "primary" | "secondary" | "alternative" | "danger"
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
export interface IButtonProps
|
|
11
|
+
extends Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> {
|
|
10
12
|
/** Is the button a Primary CTA, alternative or danger button? */
|
|
11
13
|
actionType?: BTNActionType
|
|
12
14
|
/** How lg should the button be? - Defaults to 'base'. */
|
|
@@ -31,26 +33,27 @@ export interface IButtonProps extends React.ComponentPropsWithoutRef<"button"> {
|
|
|
31
33
|
isLoading?: boolean
|
|
32
34
|
className?: string
|
|
33
35
|
iconObj?: React.ReactNode
|
|
34
|
-
ref?: React.LegacyRef<HTMLButtonElement>
|
|
35
36
|
}
|
|
36
37
|
/**
|
|
37
38
|
* Primary UI component for user interaction
|
|
38
39
|
*/
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}: IButtonProps
|
|
40
|
+
const _Button = (
|
|
41
|
+
{
|
|
42
|
+
actionType = "primary",
|
|
43
|
+
size = "sm",
|
|
44
|
+
label,
|
|
45
|
+
icon,
|
|
46
|
+
iconObj,
|
|
47
|
+
CustomSVGIcon,
|
|
48
|
+
fullWidth = false,
|
|
49
|
+
iconPosition = "leading",
|
|
50
|
+
asLink,
|
|
51
|
+
isLoading = false,
|
|
52
|
+
className,
|
|
53
|
+
...props
|
|
54
|
+
}: IButtonProps,
|
|
55
|
+
ref: React.LegacyRef<HTMLButtonElement>
|
|
56
|
+
) => {
|
|
54
57
|
const iconStyles = cn(
|
|
55
58
|
{ "text-white h-5 w-5": actionType === "primary" || actionType === "danger" },
|
|
56
59
|
{ "text-purple-700 h-5 w-5 ": actionType === "secondary" },
|
|
@@ -143,4 +146,6 @@ const Button = ({
|
|
|
143
146
|
)
|
|
144
147
|
}
|
|
145
148
|
|
|
149
|
+
const Button = forwardRef<HTMLButtonElement, IButtonProps>(_Button)
|
|
150
|
+
|
|
146
151
|
export default Button
|
|
@@ -27,7 +27,7 @@ export const DangerTrailingIcon: Story = {
|
|
|
27
27
|
...Danger.args,
|
|
28
28
|
icon: {
|
|
29
29
|
...defaultIcon,
|
|
30
|
-
icon: "
|
|
30
|
+
icon: "IconTrash"
|
|
31
31
|
},
|
|
32
32
|
iconPosition: "trailing"
|
|
33
33
|
}
|
|
@@ -41,7 +41,7 @@ export const DangerLeadingIcon: Story = {
|
|
|
41
41
|
export const DangerSimpleIconName: Story = {
|
|
42
42
|
args: {
|
|
43
43
|
...Danger.args,
|
|
44
|
-
icon: "
|
|
44
|
+
icon: "IconTrash",
|
|
45
45
|
iconPosition: "leading"
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -33,7 +33,7 @@ export const PrimaryLeadingIcon: Story = {
|
|
|
33
33
|
...Primary.args,
|
|
34
34
|
icon: {
|
|
35
35
|
...defaultIcon,
|
|
36
|
-
icon: "
|
|
36
|
+
icon: "IconCheck",
|
|
37
37
|
outline: false
|
|
38
38
|
},
|
|
39
39
|
iconPosition: "leading"
|
|
@@ -42,7 +42,7 @@ export const PrimaryLeadingIcon: Story = {
|
|
|
42
42
|
export const PrimarySimpleIconName: Story = {
|
|
43
43
|
args: {
|
|
44
44
|
...Primary.args,
|
|
45
|
-
icon: "
|
|
45
|
+
icon: "IconCheck",
|
|
46
46
|
iconPosition: "leading"
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -6,7 +6,8 @@ import { UnifiedIconName } from "../../icons/DynamicIcon"
|
|
|
6
6
|
/**
|
|
7
7
|
* Capsule Style Button
|
|
8
8
|
*/
|
|
9
|
-
export interface ICapsuleProps
|
|
9
|
+
export interface ICapsuleProps
|
|
10
|
+
extends React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement> {
|
|
10
11
|
/** Is the button a Primary CTA, alternative or danger button? */
|
|
11
12
|
actionType: BTNActionType
|
|
12
13
|
/** How lg should the button be? - Defaults to 'base'. */
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import React from "react"
|
|
2
|
-
// TODO: Fix heroicons support
|
|
2
|
+
// TODO: Fix heroicons support
|
|
3
3
|
import * as SolidIcons from "@heroicons/react/solid"
|
|
4
4
|
import * as OutlineIcons from "@heroicons/react/outline"
|
|
5
|
-
import * as TablerIconComponents from "@tabler/icons-react"
|
|
6
5
|
import * as FA from "react-icons/fa"
|
|
7
6
|
import { tablerIconNames, TablerIconName } from "./tablerIconNames"
|
|
8
7
|
import { default as cn } from "classnames"
|
|
9
8
|
|
|
10
|
-
import TablerIcon from "./TablerIcon"
|
|
11
9
|
import { ClassNameWithAutocomplete } from "@/utils/types"
|
|
10
|
+
import TablerIcon from "./TablerIcon"
|
|
12
11
|
|
|
13
12
|
export type IconName = keyof typeof SolidIcons | keyof typeof OutlineIcons
|
|
14
|
-
|
|
15
13
|
export type FAIconName = keyof typeof FA
|
|
16
14
|
|
|
17
|
-
export type UnifiedIconName =
|
|
15
|
+
export type UnifiedIconName = TablerIconName | IconName | FAIconName
|
|
18
16
|
|
|
19
17
|
export function isHeroIcon(name: UnifiedIconName): name is keyof typeof SolidIcons | keyof typeof OutlineIcons {
|
|
20
18
|
return name in SolidIcons || name in OutlineIcons
|
|
@@ -27,11 +25,12 @@ export function isTablerIcon(name: UnifiedIconName): name is TablerIconName {
|
|
|
27
25
|
export function isFAIcon(name: UnifiedIconName): name is keyof typeof FA {
|
|
28
26
|
return name in FA
|
|
29
27
|
}
|
|
28
|
+
|
|
30
29
|
export function isUnifiedIconName(name: UnifiedIconName): name is UnifiedIconName {
|
|
31
|
-
return isTablerIcon(name) || isFAIcon(name)
|
|
30
|
+
return isTablerIcon(name) // || isHeroIcon(name) || isFAIcon(name)
|
|
32
31
|
}
|
|
33
32
|
|
|
34
|
-
export interface IDynamicIconProps extends React.
|
|
33
|
+
export interface IDynamicIconProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> {
|
|
35
34
|
icon: UnifiedIconName
|
|
36
35
|
className?: ClassNameWithAutocomplete
|
|
37
36
|
outline?: boolean
|
|
@@ -62,6 +61,7 @@ export const DynamicIcon = ({
|
|
|
62
61
|
/>
|
|
63
62
|
)
|
|
64
63
|
}
|
|
64
|
+
|
|
65
65
|
if (isFAIcon(icon)) {
|
|
66
66
|
const Icon = FA[icon]
|
|
67
67
|
return (
|
|
@@ -11,13 +11,13 @@ type Story = StoryObj<typeof IconWithShadow>
|
|
|
11
11
|
|
|
12
12
|
export const HeroIconSolid: Story = {
|
|
13
13
|
args: {
|
|
14
|
-
icon: "
|
|
14
|
+
icon: "IconCube",
|
|
15
15
|
outline: false
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
export const HeroIconOutline: Story = {
|
|
19
19
|
args: {
|
|
20
|
-
icon: "
|
|
20
|
+
icon: "IconCube",
|
|
21
21
|
outline: true
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -35,7 +35,7 @@ export const TablerIconOutline: Story = {
|
|
|
35
35
|
}
|
|
36
36
|
export const FAIcon: Story = {
|
|
37
37
|
args: {
|
|
38
|
-
icon: "
|
|
38
|
+
icon: "IconBrandGithub",
|
|
39
39
|
outline: true
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -3,7 +3,7 @@ import { TablerIconName } from "./tablerIconNames"
|
|
|
3
3
|
import * as TablerIcons from "@tabler/icons-react"
|
|
4
4
|
import { ClassNameWithAutocomplete } from "@/utils/types"
|
|
5
5
|
|
|
6
|
-
export interface ITablerIconProps extends React.
|
|
6
|
+
export interface ITablerIconProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> {
|
|
7
7
|
icon: TablerIconName
|
|
8
8
|
className?: ClassNameWithAutocomplete
|
|
9
9
|
}
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import React from "react"
|
|
2
|
-
import
|
|
2
|
+
import { default as cn } from "classnames"
|
|
3
3
|
|
|
4
4
|
export interface ILoaderProps {
|
|
5
5
|
className?: string
|
|
6
6
|
}
|
|
7
7
|
const Loader: React.FC<ILoaderProps> = ({ className }) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
return (
|
|
9
|
+
<>
|
|
10
|
+
<i
|
|
11
|
+
className={cn(
|
|
12
|
+
"rounded-full w-16 h-16 inline-block border-8 animate-spin m-auto",
|
|
13
|
+
className ? className : "border-purple-700 border-r-gray-200"
|
|
14
|
+
)}
|
|
15
|
+
role="status"
|
|
16
|
+
/>
|
|
17
|
+
</>
|
|
18
|
+
)
|
|
13
19
|
}
|
|
14
20
|
|
|
15
21
|
export default Loader
|
package/stories/index.ts
CHANGED
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
INestedInputButtonProps,
|
|
35
35
|
IRadioProps,
|
|
36
36
|
ISelectProps,
|
|
37
|
-
|
|
37
|
+
ITextareaProps,
|
|
38
38
|
IToggleSwitchProps,
|
|
39
39
|
AcceptedInputTypes,
|
|
40
40
|
Checkbox,
|
|
@@ -44,14 +44,18 @@ import {
|
|
|
44
44
|
NestedInputButton,
|
|
45
45
|
Radio,
|
|
46
46
|
Select,
|
|
47
|
-
|
|
48
|
-
ToggleSwitch
|
|
47
|
+
Textarea,
|
|
48
|
+
ToggleSwitch,
|
|
49
|
+
TextInput,
|
|
50
|
+
ITextInputProps,
|
|
51
|
+
ISimpleSelectOptions
|
|
49
52
|
} from "./molecules"
|
|
50
53
|
// Organism Components, props, and type gaurds.
|
|
51
54
|
import {
|
|
52
55
|
IAnimatedLabelInputProps,
|
|
56
|
+
AnimatedLabelTextArea,
|
|
57
|
+
IAnimatedLabelTextAreaProps,
|
|
53
58
|
IButtonDropdownProps,
|
|
54
|
-
IDropdownClassnames,
|
|
55
59
|
IDropdownProps,
|
|
56
60
|
IEmptySectionPlaceholderProps,
|
|
57
61
|
IItemProp,
|
|
@@ -60,7 +64,9 @@ import {
|
|
|
60
64
|
ButtonDropdown,
|
|
61
65
|
Dropdown,
|
|
62
66
|
EmptySectionPlaceholder,
|
|
63
|
-
FormInputWithAddons
|
|
67
|
+
FormInputWithAddons,
|
|
68
|
+
TextInputSelect,
|
|
69
|
+
ITextInputSelectProps
|
|
64
70
|
} from "./organisms"
|
|
65
71
|
|
|
66
72
|
export type {
|
|
@@ -68,6 +74,7 @@ export type {
|
|
|
68
74
|
IBadgeProps,
|
|
69
75
|
IButtonProps,
|
|
70
76
|
ICapsuleProps,
|
|
77
|
+
ITextInputSelectProps,
|
|
71
78
|
IDynamicIconProps,
|
|
72
79
|
IIconWithShadowProps,
|
|
73
80
|
ILoaderProps,
|
|
@@ -79,12 +86,12 @@ export type {
|
|
|
79
86
|
INestedInputButtonProps,
|
|
80
87
|
IRadioProps,
|
|
81
88
|
ISelectProps,
|
|
82
|
-
|
|
89
|
+
ITextareaProps,
|
|
83
90
|
IToggleSwitchProps,
|
|
84
91
|
AcceptedInputTypes,
|
|
85
92
|
IAnimatedLabelInputProps,
|
|
93
|
+
IAnimatedLabelTextAreaProps,
|
|
86
94
|
IButtonDropdownProps,
|
|
87
|
-
IDropdownClassnames,
|
|
88
95
|
IDropdownProps,
|
|
89
96
|
IEmptySectionPlaceholderProps,
|
|
90
97
|
IItemProp,
|
|
@@ -92,7 +99,9 @@ export type {
|
|
|
92
99
|
UnifiedIconName,
|
|
93
100
|
IconName,
|
|
94
101
|
FAIconName,
|
|
95
|
-
BTNActionType
|
|
102
|
+
BTNActionType,
|
|
103
|
+
ITextInputProps,
|
|
104
|
+
ISimpleSelectOptions
|
|
96
105
|
}
|
|
97
106
|
export {
|
|
98
107
|
Avatar,
|
|
@@ -103,9 +112,10 @@ export {
|
|
|
103
112
|
NestedInputButton,
|
|
104
113
|
Radio,
|
|
105
114
|
Select,
|
|
106
|
-
|
|
115
|
+
Textarea,
|
|
107
116
|
ToggleSwitch,
|
|
108
117
|
AnimatedLabelInput,
|
|
118
|
+
AnimatedLabelTextArea,
|
|
109
119
|
ButtonDropdown,
|
|
110
120
|
Dropdown,
|
|
111
121
|
EmptySectionPlaceholder,
|
|
@@ -120,5 +130,7 @@ export {
|
|
|
120
130
|
isFAIcon,
|
|
121
131
|
isHeroIcon,
|
|
122
132
|
isTablerIcon,
|
|
123
|
-
isUnifiedIconName
|
|
133
|
+
isUnifiedIconName,
|
|
134
|
+
TextInput,
|
|
135
|
+
TextInputSelect
|
|
124
136
|
}
|
|
@@ -6,7 +6,8 @@ import {
|
|
|
6
6
|
INestedInputButtonProps,
|
|
7
7
|
IRadioProps,
|
|
8
8
|
ISelectProps,
|
|
9
|
-
|
|
9
|
+
ISimpleSelectOptions,
|
|
10
|
+
ITextareaProps,
|
|
10
11
|
IToggleSwitchProps,
|
|
11
12
|
AcceptedInputTypes,
|
|
12
13
|
Checkbox,
|
|
@@ -16,8 +17,10 @@ import {
|
|
|
16
17
|
NestedInputButton,
|
|
17
18
|
Radio,
|
|
18
19
|
Select,
|
|
19
|
-
|
|
20
|
-
ToggleSwitch
|
|
20
|
+
Textarea,
|
|
21
|
+
ToggleSwitch,
|
|
22
|
+
ITextInputProps,
|
|
23
|
+
TextInput
|
|
21
24
|
} from "./inputs"
|
|
22
25
|
|
|
23
26
|
export type {
|
|
@@ -28,8 +31,21 @@ export type {
|
|
|
28
31
|
INestedInputButtonProps,
|
|
29
32
|
IRadioProps,
|
|
30
33
|
ISelectProps,
|
|
31
|
-
|
|
34
|
+
ISimpleSelectOptions,
|
|
35
|
+
ITextareaProps,
|
|
32
36
|
IToggleSwitchProps,
|
|
33
|
-
AcceptedInputTypes
|
|
37
|
+
AcceptedInputTypes,
|
|
38
|
+
ITextInputProps
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
Checkbox,
|
|
42
|
+
Combobox,
|
|
43
|
+
InputField,
|
|
44
|
+
InputLabel,
|
|
45
|
+
NestedInputButton,
|
|
46
|
+
Radio,
|
|
47
|
+
Select,
|
|
48
|
+
Textarea,
|
|
49
|
+
ToggleSwitch,
|
|
50
|
+
TextInput
|
|
34
51
|
}
|
|
35
|
-
export { Checkbox, Combobox, InputField, InputLabel, NestedInputButton, Radio, Select, TextAreaField, ToggleSwitch }
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
import InputCounter, { IInputCounterProps } from "./InputCounter"
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof InputCounter> = {
|
|
5
|
+
title: "Design System/molecules/inputs/InputCounter",
|
|
6
|
+
component: InputCounter,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
argTypes: {}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default meta
|
|
12
|
+
type Story = StoryObj<typeof InputCounter>
|
|
13
|
+
export const DefaultInputCounterStory: Story = {
|
|
14
|
+
args: {
|
|
15
|
+
limit: 100,
|
|
16
|
+
current: 0
|
|
17
|
+
} as IInputCounterProps
|
|
18
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React, { FC } from "react"
|
|
2
|
+
|
|
3
|
+
export interface IInputCounterProps {
|
|
4
|
+
/** Counter limit */
|
|
5
|
+
limit: number | undefined
|
|
6
|
+
/** Counter current number */
|
|
7
|
+
current: number
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** Primary UI component for user interaction */
|
|
11
|
+
const InputCounter: FC<IInputCounterProps> = ({ current = 0, limit }) => {
|
|
12
|
+
return (
|
|
13
|
+
<div className="mt-1 text-center text-sm text-gray-500 flex gap-1">
|
|
14
|
+
<div className="currentCount">{current}</div>
|
|
15
|
+
{(limit || 0) > 0 && (
|
|
16
|
+
<>
|
|
17
|
+
<div>/</div>
|
|
18
|
+
<div className="limitCount">{limit}</div>
|
|
19
|
+
</>
|
|
20
|
+
)}
|
|
21
|
+
</div>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
export default InputCounter
|
|
@@ -13,14 +13,15 @@ export type AcceptedInputTypes =
|
|
|
13
13
|
| "tel"
|
|
14
14
|
| "text"
|
|
15
15
|
| "url"
|
|
16
|
+
| "currency"
|
|
16
17
|
|
|
17
|
-
export interface IInputFieldProps extends React.
|
|
18
|
+
export interface IInputFieldProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange"> {
|
|
18
19
|
/** Callback on change */
|
|
19
20
|
handleChange: (value: string) => void
|
|
20
21
|
/** Input ID*/
|
|
21
|
-
id
|
|
22
|
+
id?: string
|
|
22
23
|
/** Input Name */
|
|
23
|
-
name
|
|
24
|
+
name?: string
|
|
24
25
|
/** Force the focus state on the input */
|
|
25
26
|
isFocused?: boolean
|
|
26
27
|
/** Error condition */
|
|
@@ -37,7 +38,10 @@ export interface IInputFieldProps extends React.ComponentPropsWithoutRef<"input"
|
|
|
37
38
|
required?: boolean
|
|
38
39
|
/** use input psuedo classes for :valid and :invalid styles. on by default */
|
|
39
40
|
clientSideCheck?: boolean
|
|
40
|
-
/**
|
|
41
|
+
/** Placeholder text */
|
|
42
|
+
placeholder?: string
|
|
43
|
+
/**ref for input */
|
|
44
|
+
ref?: React.Ref<HTMLInputElement>
|
|
41
45
|
}
|
|
42
46
|
|
|
43
47
|
const InputField: React.FC<IInputFieldProps> = ({
|
|
@@ -52,24 +56,26 @@ const InputField: React.FC<IInputFieldProps> = ({
|
|
|
52
56
|
handleChange,
|
|
53
57
|
required,
|
|
54
58
|
clientSideCheck = true,
|
|
55
|
-
placeholder,
|
|
56
59
|
className,
|
|
60
|
+
placeholder,
|
|
61
|
+
ref,
|
|
57
62
|
...rest
|
|
58
63
|
}) => {
|
|
59
64
|
return (
|
|
60
65
|
<input
|
|
61
66
|
{...{
|
|
67
|
+
ref,
|
|
62
68
|
type,
|
|
63
69
|
id,
|
|
64
70
|
name,
|
|
65
71
|
value,
|
|
66
72
|
onChange: (e) => {
|
|
67
|
-
handleChange(e.target.value)
|
|
73
|
+
if (handleChange) handleChange(e.target.value)
|
|
68
74
|
},
|
|
69
75
|
autoFocus: isFocused,
|
|
70
76
|
readOnly: isReadonly,
|
|
71
77
|
disabled: isDisabled,
|
|
72
|
-
placeholder: placeholder ||
|
|
78
|
+
placeholder: placeholder || undefined,
|
|
73
79
|
required,
|
|
74
80
|
"aria-invalid": isError,
|
|
75
81
|
"aria-disabled": isDisabled,
|