@agility/plenum-ui 2.0.0-rc2 → 2.0.0-rc21

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.
Files changed (99) hide show
  1. package/README.md +41 -11
  2. package/build.js +30 -25
  3. package/dist/index.d.ts +279 -93
  4. package/dist/index.js +1 -5935
  5. package/dist/index.js.map +4 -4
  6. package/dist/tailwind.css +63516 -0
  7. package/dist/types/stories/atoms/buttons/Button/Alternative/Alternative.stories.d.ts +1 -0
  8. package/dist/types/stories/atoms/buttons/Button/Button.d.ts +7 -9
  9. package/dist/types/stories/atoms/buttons/Button/Danger/Danger.stories.d.ts +1 -0
  10. package/dist/types/stories/atoms/buttons/Button/Primary/Primary.stories.d.ts +1 -0
  11. package/dist/types/stories/atoms/buttons/Button/Secondary/Secondary.stories.d.ts +1 -0
  12. package/dist/types/stories/atoms/buttons/Capsule/Capsule.d.ts +1 -1
  13. package/dist/types/stories/atoms/icons/DynamicIcon.d.ts +1 -1
  14. package/dist/types/stories/atoms/icons/TablerIcon.d.ts +1 -1
  15. package/dist/types/stories/index.d.ts +4 -4
  16. package/dist/types/stories/molecules/index.d.ts +3 -3
  17. package/dist/types/stories/molecules/inputs/InputCounter/InputCounter.d.ts +10 -0
  18. package/dist/types/stories/molecules/inputs/InputCounter/index.d.ts +2 -0
  19. package/dist/types/stories/molecules/inputs/InputField/InputField.d.ts +8 -4
  20. package/dist/types/stories/molecules/inputs/TextInput/TextInput.d.ts +39 -0
  21. package/dist/types/stories/molecules/inputs/TextInput/index.d.ts +4 -0
  22. package/dist/types/stories/molecules/inputs/index.d.ts +5 -4
  23. package/dist/types/stories/molecules/inputs/select/Select.d.ts +2 -2
  24. package/dist/types/stories/molecules/inputs/textArea/TextArea.d.ts +34 -21
  25. package/dist/types/stories/molecules/inputs/textArea/TextArea.stories.d.ts +4 -4
  26. package/dist/types/stories/molecules/inputs/textArea/index.d.ts +3 -3
  27. package/dist/types/stories/molecules/inputs/toggleSwitch/ToggleSwitch.d.ts +9 -7
  28. package/dist/types/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.d.ts +3 -5
  29. package/dist/types/stories/organisms/AnimatedLabelInput/index.d.ts +1 -1
  30. package/dist/types/stories/organisms/AnimatedLabelTextArea/AnimatedLabelTextArea.d.ts +12 -0
  31. package/dist/types/stories/organisms/AnimatedLabelTextArea/index.d.ts +3 -0
  32. package/dist/types/stories/organisms/DropdownComponent/DropdownComponent.d.ts +18 -15
  33. package/dist/types/stories/organisms/DropdownComponent/index.d.ts +2 -2
  34. package/dist/types/stories/organisms/EmptySectionPlaceholder/index.d.ts +1 -1
  35. package/dist/types/stories/organisms/TextInputSelect/InputSelect.d.ts +16 -0
  36. package/dist/types/stories/organisms/TextInputSelect/TextInputSelect.d.ts +48 -0
  37. package/dist/types/stories/organisms/TextInputSelect/index.d.ts +3 -0
  38. package/dist/types/stories/organisms/index.d.ts +5 -3
  39. package/local.sh +100 -0
  40. package/package.json +35 -18
  41. package/rollup.config.mjs +42 -0
  42. package/stories/Introduction.mdx +1 -1
  43. package/stories/atoms/buttons/Button/Alternative/Alternative.stories.ts +7 -0
  44. package/stories/atoms/buttons/Button/Button.tsx +45 -17
  45. package/stories/atoms/buttons/Button/Danger/Danger.stories.ts +7 -0
  46. package/stories/atoms/buttons/Button/Primary/Primary.stories.ts +7 -0
  47. package/stories/atoms/buttons/Button/Secondary/Secondary.stories.ts +7 -0
  48. package/stories/atoms/buttons/Capsule/Capsule.tsx +2 -1
  49. package/stories/atoms/icons/DynamicIcon.tsx +3 -2
  50. package/stories/atoms/icons/TablerIcon.tsx +1 -1
  51. package/stories/atoms/loaders/Loader.tsx +12 -6
  52. package/stories/index.ts +22 -10
  53. package/stories/molecules/index.ts +22 -6
  54. package/stories/molecules/inputs/InputCounter/InputCounter.stories.tsx +18 -0
  55. package/stories/molecules/inputs/InputCounter/InputCounter.tsx +24 -0
  56. package/stories/molecules/inputs/InputCounter/index.tsx +3 -0
  57. package/stories/molecules/inputs/InputField/InputField.tsx +13 -7
  58. package/stories/molecules/inputs/TextInput/TextInput.stories.tsx +32 -0
  59. package/stories/molecules/inputs/TextInput/TextInput.tsx +165 -0
  60. package/stories/molecules/inputs/TextInput/index.tsx +5 -0
  61. package/stories/molecules/inputs/checkbox/Checkbox.tsx +1 -1
  62. package/stories/molecules/inputs/index.ts +18 -4
  63. package/stories/molecules/inputs/select/Select.tsx +1 -1
  64. package/stories/molecules/inputs/textArea/TextArea.stories.ts +7 -5
  65. package/stories/molecules/inputs/textArea/TextArea.tsx +139 -48
  66. package/stories/molecules/inputs/textArea/index.ts +3 -3
  67. package/stories/molecules/inputs/toggleSwitch/ToggleSwitch.tsx +61 -57
  68. package/stories/molecules/tabs/index.tsx +2 -3
  69. package/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.stories.tsx +10 -1
  70. package/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.tsx +43 -37
  71. package/stories/organisms/AnimatedLabelInput/index.tsx +1 -1
  72. package/stories/organisms/AnimatedLabelTextArea/AnimatedLabelTextArea.stories.tsx +26 -0
  73. package/stories/organisms/AnimatedLabelTextArea/AnimatedLabelTextArea.tsx +61 -0
  74. package/stories/organisms/AnimatedLabelTextArea/index.tsx +3 -0
  75. package/stories/organisms/ButtonDropdown/ButtonDropdown.stories.tsx +59 -58
  76. package/stories/organisms/ButtonDropdown/ButtonDropdown.tsx +13 -16
  77. package/stories/organisms/DropdownComponent/Dropdown.stories.tsx +1 -1
  78. package/stories/organisms/DropdownComponent/DropdownComponent.tsx +155 -131
  79. package/stories/organisms/DropdownComponent/dropdownItems.ts +32 -8
  80. package/stories/organisms/DropdownComponent/index.ts +2 -2
  81. package/stories/organisms/EmptySectionPlaceholder/index.tsx +2 -1
  82. package/stories/organisms/FormInputWithAddons/FormInputWithAddons.tsx +7 -2
  83. package/stories/organisms/TextInputSelect/InputSelect.tsx +59 -0
  84. package/stories/organisms/TextInputSelect/TextInputSelect.stories.tsx +33 -0
  85. package/stories/organisms/TextInputSelect/TextInputSelect.tsx +186 -0
  86. package/stories/organisms/TextInputSelect/index.tsx +3 -0
  87. package/stories/organisms/index.ts +15 -4
  88. package/tsconfig.lib.json +13 -6
  89. package/watch.js +50 -0
  90. package/.yarnrc.yml +0 -1
  91. package/dist/types/stories/layouts/index.d.ts +0 -0
  92. package/stories/layouts/CardLayout/CardLayout.stories.tsx +0 -18
  93. package/stories/layouts/CardLayout/CardLayout.tsx +0 -22
  94. package/stories/layouts/CardLayout/index.tsx +0 -3
  95. package/stories/layouts/ModalLayout/ModalLayout.stories.tsx +0 -18
  96. package/stories/layouts/ModalLayout/ModalLayout.tsx +0 -22
  97. package/stories/layouts/ModalLayout/index.tsx +0 -3
  98. package/stories/layouts/index.ts +0 -0
  99. package/stories/organisms/DropdownComponent/Dropdown.test.tsx +0 -0
package/local.sh ADDED
@@ -0,0 +1,100 @@
1
+ #! /usr/bin/bash
2
+
3
+ # ANSI escape codes for formatting
4
+ GREEN_BOLD='\033[1;32m'
5
+ ORANGE_BOLD='\033[1;33m'
6
+ RED_BOLD='\033[1;31m'
7
+ BLUE_BOLD='\033[1;34m'
8
+ RESET='\033[0m'
9
+ DIR="$PWD"
10
+
11
+ # The required yarn version to use this script
12
+ REQUIRED_YARN_VERSION="1.22.19"
13
+
14
+ # Get the installed Yarn version
15
+ INSTALLED_YARN_VERSION=$(yarn --version 2>/dev/null)
16
+
17
+ unlink_package() {
18
+ local package_name="${1:-@agility/plenum-ui}"
19
+ if [ -z "$1" ]; then
20
+ yarn unlink
21
+ else
22
+ cd "$DIR/node_modules/$package_name"
23
+ yarn unlink
24
+ fi
25
+ unlink_exit_code=$?
26
+ if [ $unlink_exit_code -ne 0 ]; then
27
+ echo -e "${ORANGE_BOLD}agility-cms-manager-app-react:warning${RESET} yarn unlink for '$package_name' encountered an error, but script will continue. \n"
28
+ fi
29
+
30
+ cd "$DIR"
31
+ echo -e "\n"
32
+ }
33
+
34
+ link_package() {
35
+ local package_name="${1:-@agility/plenum-ui}"
36
+ if [ -z "$1" ]; then
37
+ yarn link
38
+ else
39
+ cd "$DIR/node_modules/$package_name"
40
+ yarn link
41
+ fi
42
+ unlink_exit_code=$?
43
+ if [ $unlink_exit_code -ne 0 ]; then
44
+ echo -e "${RED_BOLD}agility-cms-manager-app-react:error${RESET} yarn link for '$package_name' failed. Script cannot continue, exiting script."
45
+ exit 1
46
+ else
47
+ echo -e "${GREEN_BOLD}@agility/plenum-ui:success${RESET} yarn link for '$package_name' successful\n"
48
+ fi
49
+
50
+ cd "$DIR"
51
+ }
52
+
53
+ check_yarn_version() {
54
+ # Check if Yarn is installed and compare the version
55
+ if [ -n "$INSTALLED_YARN_VERSION" ] && [ "$INSTALLED_YARN_VERSION" != "$REQUIRED_YARN_VERSION" ]; then
56
+ echo -e "${RED_BOLD}error${RESET} Yarn version $required_version is required, but found version $INSTALLED_YARN_VERSION."
57
+ exit 1
58
+ fi
59
+
60
+ echo -e "${BLUE_BOLD}info${RESET} Yarn version is $INSTALLED_YARN_VERSION. Proceeding with the script...\n"
61
+ }
62
+
63
+ ### START SCRIPT
64
+
65
+ check_yarn_version
66
+
67
+ echo -e "Starting @agility/plenum-ui local watch script \n"
68
+ echo -e "${BLUE_BOLD}@agility/plenum-ui:info${RESET} unlinking existing symlink"
69
+ yarn unlink
70
+ if [ $? -ne 0 ]; then
71
+ echo "yarn unlink for @agility/plenum-ui encountered an error, but script will continue. \n"
72
+ fi
73
+
74
+ if [ ! -d "node_modules" ] || [ ! -d "node_modules/react" ] || [ ! -d "node_modules/react-dom" ]; then
75
+ echo -e "${ORANGE_BOLD}@agility/plenum-ui:warning${RESET} Could not find node_modules."
76
+ echo -e "${BLUE_BOLD}@agility/plenum-ui:info${RESET} installing dependencies...\n"
77
+
78
+ yarn install
79
+
80
+ if [ $? -eq 0 ]; then
81
+ echo -e "${GREEN_BOLD}@agility/plenum-ui:success${RESET} Finished installing dependencies"
82
+ else
83
+ echo -e "${RED_BOLD}@agility/plenum-ui:error${RESET} Couldn't install dependencies. Exiting script."
84
+ exit 1
85
+ fi
86
+ fi
87
+
88
+ echo -e "${BLUE_BOLD}@agility/plenum-ui:info${RESET} unlinking existing symlinks"
89
+ unlink_package react
90
+ unlink_package react-dom
91
+ unlink_package
92
+
93
+ echo -e "${BLUE_BOLD}@agility/plenum-ui:info${RESET} setting up symlinks...\n"
94
+
95
+ link_package react
96
+ link_package react-dom
97
+ link_package
98
+
99
+ echo -e "${GREEN_BOLD}@agility/plenum-ui:success${RESET} You can now run 'yarn start-cms:local' in agility-cms-manager-app-react\n"
100
+ yarn start:watch
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agility/plenum-ui",
3
- "version": "2.0.0-rc2",
3
+ "version": "2.0.0-rc21",
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 ./lib/tailwind.css",
20
+ "build:tw": "tailwindcss -o ./dist/tailwind.css",
21
21
  "build:tsc": "yarn node build.js",
22
22
  "prepare": "yarn build",
23
- "build": "npm run clean && npm-run-all -s \"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
- "devDependencies": {
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
- "storybook": "^7.1.1",
63
- "tailwindcss": "^3.2.4",
64
- "typescript": "^5.1.6"
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;
@@ -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.
@@ -41,6 +41,13 @@ export const AlternativeExtraSmall: Story = {
41
41
  size: "sm"
42
42
  }
43
43
  }
44
+ export const AlternativeSimpleIconName: Story = {
45
+ args: {
46
+ ...Alternative.args,
47
+ icon: defaultIcon.icon,
48
+ iconPosition: "leading"
49
+ }
50
+ }
44
51
  export const AlternativeSmall: Story = {
45
52
  args: {
46
53
  ...Alternative.args,
@@ -1,20 +1,22 @@
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
- export interface IButtonProps extends React.ComponentPropsWithoutRef<"button"> {
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
- actionType: BTNActionType
13
+ actionType?: BTNActionType
12
14
  /** How lg should the button be? - Defaults to 'base'. */
13
15
  size?: "xs" | "sm" | "md" | "lg" | "xl"
14
16
  /** The Button's text content. */
15
17
  label: string
16
18
  /** The Icon to be displayed inside the button. */
17
- icon?: IDynamicIconProps
19
+ icon?: IDynamicIconProps | UnifiedIconName
18
20
  /** Does the button width grow to fill it's container? */
19
21
  fullWidth?: boolean
20
22
  /** Optionally render as anchor tag */
@@ -30,23 +32,28 @@ export interface IButtonProps extends React.ComponentPropsWithoutRef<"button"> {
30
32
  /** Is the associated content loading? */
31
33
  isLoading?: boolean
32
34
  className?: string
35
+ iconObj?: React.ReactNode
33
36
  }
34
37
  /**
35
38
  * Primary UI component for user interaction
36
39
  */
37
- const Button = ({
38
- actionType = "primary",
39
- size = "sm",
40
- label,
41
- icon,
42
- CustomSVGIcon,
43
- fullWidth = false,
44
- iconPosition = "trailing",
45
- asLink,
46
- isLoading = false,
47
- className,
48
- ...props
49
- }: 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
+ ) => {
50
57
  const iconStyles = cn(
51
58
  { "text-white h-5 w-5": actionType === "primary" || actionType === "danger" },
52
59
  { "text-purple-700 h-5 w-5 ": actionType === "secondary" },
@@ -88,6 +95,7 @@ const Button = ({
88
95
  },
89
96
  className ? className : ""
90
97
  )}
98
+ ref={ref}
91
99
  {...props}
92
100
  >
93
101
  {CustomSVGIcon &&
@@ -96,11 +104,20 @@ const Button = ({
96
104
  ) : (
97
105
  <i>{CustomSVGIcon}</i>
98
106
  ))}
107
+ {iconObj &&
108
+ iconPosition === "leading" &&
109
+ (!isLoading ? (
110
+ <>{iconObj}</>
111
+ ) : (
112
+ <div className={cn("h-4 rounded-full w-4 border-2 m-0 animate-spin", loaderColors, loaderSize)} />
113
+ ))}
99
114
 
100
115
  {icon &&
101
116
  iconPosition === "leading" &&
102
117
  (isLoading ? (
103
118
  <div className={cn("h-4 rounded-full w-4 border-2 m-0 animate-spin", loaderColors, loaderSize)} />
119
+ ) : typeof icon === "string" ? (
120
+ <DynamicIcon {...{ icon: icon, className: iconStyles }} />
104
121
  ) : (
105
122
  <DynamicIcon {...{ ...icon, className: iconStyles }} />
106
123
  ))}
@@ -113,11 +130,22 @@ const Button = ({
113
130
  iconPosition === "trailing" &&
114
131
  (isLoading ? (
115
132
  <div className={cn("h-4 rounded-full w-4 border-2 m-0 animate-spin", loaderColors, loaderSize)} />
133
+ ) : typeof icon === "string" ? (
134
+ <DynamicIcon {...{ icon: icon, className: iconStyles }} />
116
135
  ) : (
117
136
  <DynamicIcon {...{ ...icon, className: iconStyles }} />
118
137
  ))}
138
+ {iconObj &&
139
+ iconPosition === "trailing" &&
140
+ (!isLoading ? (
141
+ <>{iconObj}</>
142
+ ) : (
143
+ <div className={cn("h-4 rounded-full w-4 border-2 m-0 animate-spin", loaderColors, loaderSize)} />
144
+ ))}
119
145
  </button>
120
146
  )
121
147
  }
122
148
 
149
+ const Button = forwardRef<HTMLButtonElement, IButtonProps>(_Button)
150
+
123
151
  export default Button
@@ -38,6 +38,13 @@ export const DangerLeadingIcon: Story = {
38
38
  iconPosition: "leading"
39
39
  }
40
40
  }
41
+ export const DangerSimpleIconName: Story = {
42
+ args: {
43
+ ...Danger.args,
44
+ icon: "TrashIcon",
45
+ iconPosition: "leading"
46
+ }
47
+ }
41
48
  export const DangerExtraSmall: Story = {
42
49
  args: {
43
50
  ...Danger.args,
@@ -39,6 +39,13 @@ export const PrimaryLeadingIcon: Story = {
39
39
  iconPosition: "leading"
40
40
  }
41
41
  }
42
+ export const PrimarySimpleIconName: Story = {
43
+ args: {
44
+ ...Primary.args,
45
+ icon: "CheckIcon",
46
+ iconPosition: "leading"
47
+ }
48
+ }
42
49
  export const PrimaryTrailingIcon: Story = {
43
50
  args: {
44
51
  ...PrimaryLeadingIcon.args,
@@ -41,6 +41,13 @@ export const SecondaryLeadingIcon: Story = {
41
41
  iconPosition: "leading"
42
42
  }
43
43
  }
44
+ export const SecondarySimpleIconName: Story = {
45
+ args: {
46
+ ...Secondary.args,
47
+ icon: "BellIcon",
48
+ iconPosition: "leading"
49
+ }
50
+ }
44
51
  export const SecondaryExtraSmall: Story = {
45
52
  args: {
46
53
  ...Secondary.args,
@@ -6,7 +6,8 @@ import { UnifiedIconName } from "../../icons/DynamicIcon"
6
6
  /**
7
7
  * Capsule Style Button
8
8
  */
9
- export interface ICapsuleProps extends React.ComponentPropsWithoutRef<"button"> {
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,5 +1,5 @@
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
5
  import * as TablerIconComponents from "@tabler/icons-react"
@@ -31,7 +31,8 @@ export function isUnifiedIconName(name: UnifiedIconName): name is UnifiedIconNam
31
31
  return isTablerIcon(name) || isFAIcon(name)
32
32
  }
33
33
 
34
- export interface IDynamicIconProps extends React.ComponentProps<"i"> {
34
+ //export interface IDynamicIconProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> {
35
+ export interface IDynamicIconProps {
35
36
  icon: UnifiedIconName
36
37
  className?: ClassNameWithAutocomplete
37
38
  outline?: boolean
@@ -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.ComponentProps<"i"> {
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 classNames, { default as cn } from "classnames"
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
- const outerLoaderStyles = cn(
9
- "rounded-full w-16 h-16 inline-block border-8 animate-spin m-auto",
10
- className ? className : "border-purple-700 border-r-gray-200"
11
- )
12
- return <i className={outerLoaderStyles} role="status" />
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
- ITextAreaFieldProps,
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
- TextAreaField,
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
- ITextAreaFieldProps,
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
- TextAreaField,
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
- ITextAreaFieldProps,
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
- TextAreaField,
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
- ITextAreaFieldProps,
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
@@ -0,0 +1,3 @@
1
+
2
+ export { default } from './InputCounter';
3
+ export * from './InputCounter';