@agility/plenum-ui 2.0.0-rc47 → 2.0.0-rc49
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 -6
- package/.prettierrc +13 -13
- package/.storybook/Layout.jsx +12 -12
- package/.storybook/head.tsx +4 -4
- package/.storybook/main.ts +18 -18
- package/.storybook/manager-head.html +1 -1
- package/.storybook/manager.ts +25 -25
- package/.storybook/plenumTheme.ts +8 -8
- package/.storybook/preview-head.html +3 -3
- package/.storybook/preview.tsx +28 -28
- package/.vscode/settings.json +3 -3
- package/README.md +271 -271
- package/app/globals.css +99 -99
- package/app/head.tsx +59 -59
- package/app/layout.tsx +28 -28
- package/app/page.tsx +7 -7
- package/build.js +45 -45
- package/dist/index.d.ts +232 -230
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/types/stories/molecules/inputs/select/Select.d.ts +2 -0
- package/local.sh +100 -100
- package/next.config.js +8 -8
- package/package.json +82 -82
- package/pages/api/hello.ts +13 -13
- package/postcss.config.js +6 -6
- package/rollup.config.mjs +41 -41
- package/scripts/create-component.js +97 -97
- package/stories/Introduction.mdx +314 -314
- package/stories/assets/stackalt.svg +1 -1
- package/stories/atoms/Avatar/Avatar.stories.tsx +96 -96
- package/stories/atoms/Avatar/Avatar.tsx +123 -123
- package/stories/atoms/Avatar/index.ts +3 -3
- package/stories/atoms/badges/Badge.tsx +127 -127
- package/stories/atoms/badges/Pill/Pill.stories.tsx +75 -75
- package/stories/atoms/badges/Rounded/Rounded.stories.tsx +75 -75
- package/stories/atoms/badges/index.ts +3 -3
- package/stories/atoms/buttons/Button/Alternative/Alternative.stories.ts +86 -86
- package/stories/atoms/buttons/Button/Button.tsx +232 -232
- package/stories/atoms/buttons/Button/Danger/Danger.stories.ts +90 -90
- package/stories/atoms/buttons/Button/Primary/Primary.stories.ts +97 -97
- package/stories/atoms/buttons/Button/Secondary/Secondary.stories.ts +93 -93
- package/stories/atoms/buttons/Button/defaultArgs.ts +9 -9
- package/stories/atoms/buttons/Button/index.ts +3 -3
- package/stories/atoms/buttons/Capsule/Alternative/Alternative.stories.ts +27 -27
- package/stories/atoms/buttons/Capsule/Capsule.tsx +88 -88
- package/stories/atoms/buttons/Capsule/Danger/Danger.stories.ts +27 -27
- package/stories/atoms/buttons/Capsule/Primary/Primary.stories.ts +27 -27
- package/stories/atoms/buttons/Capsule/Secondary/Secondary.stories.ts +27 -27
- package/stories/atoms/buttons/Capsule/index.ts +3 -3
- package/stories/atoms/buttons/FloatingActionButton/FloatingActionButton.stories.tsx +15 -15
- package/stories/atoms/buttons/FloatingActionButton/FloatingActionButton.tsx +22 -22
- package/stories/atoms/buttons/FloatingActionButton/index.tsx +3 -3
- package/stories/atoms/buttons/index.ts +4 -4
- package/stories/atoms/crumb/Crumb.stories.tsx +18 -18
- package/stories/atoms/crumb/Crumb.tsx +22 -22
- package/stories/atoms/crumb/index.tsx +3 -3
- package/stories/atoms/icons/DynamicIcon.stories.ts +43 -43
- package/stories/atoms/icons/DynamicIcon.tsx +90 -90
- package/stories/atoms/icons/IconWithShadow.stories.ts +43 -43
- package/stories/atoms/icons/IconWithShadow.tsx +16 -16
- package/stories/atoms/icons/TablerIcon.tsx +22 -22
- package/stories/atoms/icons/index.tsx +14 -14
- package/stories/atoms/icons/tablerIconNames.ts +4336 -4336
- package/stories/atoms/index.ts +46 -46
- package/stories/atoms/loaders/Loader.stories.ts +15 -15
- package/stories/atoms/loaders/Loader.tsx +21 -21
- package/stories/atoms/loaders/NProgress/RadialProgress.stories.tsx +19 -19
- package/stories/atoms/loaders/NProgress/RadialProgress.tsx +74 -74
- package/stories/atoms/loaders/NProgress/index.ts +3 -3
- package/stories/atoms/loaders/index.ts +4 -4
- package/stories/index.ts +136 -136
- package/stories/molecules/index.ts +51 -51
- package/stories/molecules/inputs/InputCounter/InputCounter.stories.tsx +18 -18
- package/stories/molecules/inputs/InputCounter/InputCounter.tsx +24 -24
- package/stories/molecules/inputs/InputCounter/index.tsx +3 -3
- package/stories/molecules/inputs/InputField/InputField.stories.tsx +29 -29
- package/stories/molecules/inputs/InputField/InputField.tsx +96 -96
- package/stories/molecules/inputs/InputField/index.tsx +3 -3
- package/stories/molecules/inputs/InputLabel/InputLabel.stories.tsx +19 -19
- package/stories/molecules/inputs/InputLabel/InputLabel.tsx +45 -45
- package/stories/molecules/inputs/InputLabel/index.tsx +3 -3
- package/stories/molecules/inputs/NestedInputButton/NestedInputButton.stories.tsx +52 -52
- package/stories/molecules/inputs/NestedInputButton/NestedInputButton.tsx +64 -64
- package/stories/molecules/inputs/NestedInputButton/index.tsx +3 -3
- package/stories/molecules/inputs/TextInput/TextInput.stories.tsx +32 -32
- package/stories/molecules/inputs/TextInput/TextInput.tsx +165 -165
- package/stories/molecules/inputs/TextInput/index.tsx +5 -5
- package/stories/molecules/inputs/checkbox/Checkbox.stories.ts +23 -23
- package/stories/molecules/inputs/checkbox/Checkbox.tsx +98 -98
- package/stories/molecules/inputs/checkbox/index.ts +3 -3
- package/stories/molecules/inputs/combobox/ComboBox.stories.ts +41 -41
- package/stories/molecules/inputs/combobox/ComboBox.tsx +185 -185
- package/stories/molecules/inputs/combobox/index.ts +3 -3
- package/stories/molecules/inputs/index.ts +38 -38
- package/stories/molecules/inputs/radio/Radio.stories.ts +27 -27
- package/stories/molecules/inputs/radio/Radio.tsx +92 -92
- package/stories/molecules/inputs/radio/index.ts +3 -3
- package/stories/molecules/inputs/select/Select.stories.ts +23 -23
- package/stories/molecules/inputs/select/Select.tsx +108 -100
- package/stories/molecules/inputs/select/index.ts +3 -3
- package/stories/molecules/inputs/textArea/TextArea.stories.ts +22 -22
- package/stories/molecules/inputs/textArea/TextArea.tsx +158 -158
- package/stories/molecules/inputs/textArea/index.ts +3 -3
- package/stories/molecules/inputs/toggleSwitch/ToggleSwitch.stories.tsx +118 -118
- package/stories/molecules/inputs/toggleSwitch/ToggleSwitch.tsx +81 -81
- package/stories/molecules/inputs/toggleSwitch/index.ts +3 -3
- package/stories/molecules/tabs/Tabs.stories.tsx +18 -18
- package/stories/molecules/tabs/Tabs.tsx +22 -22
- package/stories/molecules/tabs/index.tsx +2 -2
- package/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.stories.tsx +30 -30
- package/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.tsx +66 -66
- package/stories/organisms/AnimatedLabelInput/index.tsx +3 -3
- package/stories/organisms/AnimatedLabelTextArea/AnimatedLabelTextArea.stories.tsx +26 -26
- package/stories/organisms/AnimatedLabelTextArea/AnimatedLabelTextArea.tsx +61 -61
- package/stories/organisms/AnimatedLabelTextArea/index.tsx +3 -3
- package/stories/organisms/ButtonDropdown/ButtonDropdown.stories.tsx +125 -125
- package/stories/organisms/ButtonDropdown/ButtonDropdown.tsx +86 -86
- package/stories/organisms/ButtonDropdown/index.tsx +3 -3
- package/stories/organisms/DropdownComponent/Dropdown.stories.tsx +73 -73
- package/stories/organisms/DropdownComponent/DropdownComponent.tsx +346 -346
- package/stories/organisms/DropdownComponent/dropdownItems.ts +122 -122
- package/stories/organisms/DropdownComponent/index.ts +4 -4
- package/stories/organisms/EmptySectionPlaceholder/EmptySectionPlaceholder.stories.tsx +76 -76
- package/stories/organisms/EmptySectionPlaceholder/EmptySectionPlaceholder.tsx +52 -52
- package/stories/organisms/EmptySectionPlaceholder/index.tsx +4 -4
- package/stories/organisms/FormInputWithAddons/FormInputWithAddons.stories.tsx +29 -29
- package/stories/organisms/FormInputWithAddons/FormInputWithAddons.tsx +145 -145
- package/stories/organisms/FormInputWithAddons/index.tsx +3 -3
- package/stories/organisms/TextInputSelect/InputSelect.tsx +59 -59
- package/stories/organisms/TextInputSelect/TextInputSelect.stories.tsx +33 -33
- package/stories/organisms/TextInputSelect/TextInputSelect.tsx +186 -186
- package/stories/organisms/TextInputSelect/index.tsx +3 -3
- package/stories/organisms/index.ts +27 -27
- package/tailwind.config.js +192 -192
- package/tsconfig.json +29 -29
- package/tsconfig.lib.json +25 -25
- package/utils/types.d.ts +2 -2
- package/utils/types.ts +3 -3
- package/utils/useId.d.ts +1 -1
- package/utils/useId.tsx +16 -16
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
import React, { useEffect, useState } from "react"
|
|
2
|
-
import { default as cn } from "classnames"
|
|
3
|
-
import { Switch } from "@headlessui/react"
|
|
4
|
-
import { DynamicIcon, IDynamicIconProps } from "@/stories/atoms"
|
|
5
|
-
|
|
6
|
-
interface ToggleSwitchLabel {
|
|
7
|
-
text: string | JSX.Element
|
|
8
|
-
className?: string
|
|
9
|
-
xPosition?: "left" | "right"
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface IToggleSwitchProps {
|
|
13
|
-
isChecked: boolean
|
|
14
|
-
onChange: (isChecked: boolean) => void
|
|
15
|
-
label?: ToggleSwitchLabel
|
|
16
|
-
screenReaderLabel?: string
|
|
17
|
-
name: string
|
|
18
|
-
id: string
|
|
19
|
-
variant?: "base" | "short"
|
|
20
|
-
withIcon?: IDynamicIconProps
|
|
21
|
-
disabled?: boolean,
|
|
22
|
-
groupClassName?: string
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const ToggleSwitch: React.FC<IToggleSwitchProps> = ({
|
|
26
|
-
isChecked,
|
|
27
|
-
onChange,
|
|
28
|
-
label,
|
|
29
|
-
screenReaderLabel,
|
|
30
|
-
name,
|
|
31
|
-
id,
|
|
32
|
-
variant = "base",
|
|
33
|
-
withIcon,
|
|
34
|
-
disabled,
|
|
35
|
-
groupClassName,
|
|
36
|
-
}) => {
|
|
37
|
-
const [checked, setChecked] = useState<boolean>(isChecked)
|
|
38
|
-
useEffect(() => setChecked(isChecked), [isChecked])
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<Switch.Group as={"div"} className={cn("flex items-center gap-2", groupClassName)}>
|
|
42
|
-
{label && (label.xPosition === "left" || !label?.xPosition) && (
|
|
43
|
-
<Switch.Label className={label.className}>{label.text}</Switch.Label>
|
|
44
|
-
)}
|
|
45
|
-
<Switch
|
|
46
|
-
name={name}
|
|
47
|
-
id={id}
|
|
48
|
-
checked={checked}
|
|
49
|
-
onChange={(v: boolean) => {
|
|
50
|
-
onChange(v)
|
|
51
|
-
setChecked(v)
|
|
52
|
-
}}
|
|
53
|
-
className={cn(
|
|
54
|
-
{ "w-9 h-4 transition-all": variant === "short", " h-6 w-11": variant === "base" },
|
|
55
|
-
checked && disabled ? "bg-purple-200" : checked ? "bg-purple-600" : "bg-gray-200",
|
|
56
|
-
"relative inline-flex items-center rounded-full focus-visible:ring-2 focus-visible:ring-purple-600 focus-visible:ring-offset-2 focus-within:ring-2 focus-within:ring-purple-600 focus-within:ring-offset-2 focus:ring-2 focus:ring-purple-600 focus:ring-offset-2 active:ring-2 active:ring-purple-600 active:ring-offset-2"
|
|
57
|
-
)}
|
|
58
|
-
disabled={disabled}
|
|
59
|
-
>
|
|
60
|
-
{screenReaderLabel && <span className="sr-only">{screenReaderLabel}</span>}
|
|
61
|
-
<span
|
|
62
|
-
className={cn(
|
|
63
|
-
checked ? "translate-x-[22px]" : "translate-x-[2px]",
|
|
64
|
-
{
|
|
65
|
-
"border border-gray-200 translate-x-0": variant === "short",
|
|
66
|
-
"!translate-x-[22px]": checked && variant === "short"
|
|
67
|
-
},
|
|
68
|
-
" h-5 w-5 transform rounded-full bg-white transition shadow-sm drop-shadow flex items-center justify-center"
|
|
69
|
-
)}
|
|
70
|
-
>
|
|
71
|
-
{withIcon && <DynamicIcon {...withIcon} className={"text-gray-400 m-[2px]"} />}
|
|
72
|
-
</span>
|
|
73
|
-
</Switch>
|
|
74
|
-
{label && label.xPosition === "right" && (
|
|
75
|
-
<Switch.Label className={label.className}>{label.text}</Switch.Label>
|
|
76
|
-
)}
|
|
77
|
-
</Switch.Group>
|
|
78
|
-
)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export default ToggleSwitch
|
|
1
|
+
import React, { useEffect, useState } from "react"
|
|
2
|
+
import { default as cn } from "classnames"
|
|
3
|
+
import { Switch } from "@headlessui/react"
|
|
4
|
+
import { DynamicIcon, IDynamicIconProps } from "@/stories/atoms"
|
|
5
|
+
|
|
6
|
+
interface ToggleSwitchLabel {
|
|
7
|
+
text: string | JSX.Element
|
|
8
|
+
className?: string
|
|
9
|
+
xPosition?: "left" | "right"
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface IToggleSwitchProps {
|
|
13
|
+
isChecked: boolean
|
|
14
|
+
onChange: (isChecked: boolean) => void
|
|
15
|
+
label?: ToggleSwitchLabel
|
|
16
|
+
screenReaderLabel?: string
|
|
17
|
+
name: string
|
|
18
|
+
id: string
|
|
19
|
+
variant?: "base" | "short"
|
|
20
|
+
withIcon?: IDynamicIconProps
|
|
21
|
+
disabled?: boolean,
|
|
22
|
+
groupClassName?: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const ToggleSwitch: React.FC<IToggleSwitchProps> = ({
|
|
26
|
+
isChecked,
|
|
27
|
+
onChange,
|
|
28
|
+
label,
|
|
29
|
+
screenReaderLabel,
|
|
30
|
+
name,
|
|
31
|
+
id,
|
|
32
|
+
variant = "base",
|
|
33
|
+
withIcon,
|
|
34
|
+
disabled,
|
|
35
|
+
groupClassName,
|
|
36
|
+
}) => {
|
|
37
|
+
const [checked, setChecked] = useState<boolean>(isChecked)
|
|
38
|
+
useEffect(() => setChecked(isChecked), [isChecked])
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<Switch.Group as={"div"} className={cn("flex items-center gap-2", groupClassName)}>
|
|
42
|
+
{label && (label.xPosition === "left" || !label?.xPosition) && (
|
|
43
|
+
<Switch.Label className={label.className}>{label.text}</Switch.Label>
|
|
44
|
+
)}
|
|
45
|
+
<Switch
|
|
46
|
+
name={name}
|
|
47
|
+
id={id}
|
|
48
|
+
checked={checked}
|
|
49
|
+
onChange={(v: boolean) => {
|
|
50
|
+
onChange(v)
|
|
51
|
+
setChecked(v)
|
|
52
|
+
}}
|
|
53
|
+
className={cn(
|
|
54
|
+
{ "w-9 h-4 transition-all": variant === "short", " h-6 w-11": variant === "base" },
|
|
55
|
+
checked && disabled ? "bg-purple-200" : checked ? "bg-purple-600" : "bg-gray-200",
|
|
56
|
+
"relative inline-flex items-center rounded-full focus-visible:ring-2 focus-visible:ring-purple-600 focus-visible:ring-offset-2 focus-within:ring-2 focus-within:ring-purple-600 focus-within:ring-offset-2 focus:ring-2 focus:ring-purple-600 focus:ring-offset-2 active:ring-2 active:ring-purple-600 active:ring-offset-2"
|
|
57
|
+
)}
|
|
58
|
+
disabled={disabled}
|
|
59
|
+
>
|
|
60
|
+
{screenReaderLabel && <span className="sr-only">{screenReaderLabel}</span>}
|
|
61
|
+
<span
|
|
62
|
+
className={cn(
|
|
63
|
+
checked ? "translate-x-[22px]" : "translate-x-[2px]",
|
|
64
|
+
{
|
|
65
|
+
"border border-gray-200 translate-x-0": variant === "short",
|
|
66
|
+
"!translate-x-[22px]": checked && variant === "short"
|
|
67
|
+
},
|
|
68
|
+
" h-5 w-5 transform rounded-full bg-white transition shadow-sm drop-shadow flex items-center justify-center"
|
|
69
|
+
)}
|
|
70
|
+
>
|
|
71
|
+
{withIcon && <DynamicIcon {...withIcon} className={"text-gray-400 m-[2px]"} />}
|
|
72
|
+
</span>
|
|
73
|
+
</Switch>
|
|
74
|
+
{label && label.xPosition === "right" && (
|
|
75
|
+
<Switch.Label className={label.className}>{label.text}</Switch.Label>
|
|
76
|
+
)}
|
|
77
|
+
</Switch.Group>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export default ToggleSwitch
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import ToggleSwitch, { IToggleSwitchProps } from "./ToggleSwitch"
|
|
2
|
-
export type { IToggleSwitchProps }
|
|
3
|
-
export default ToggleSwitch
|
|
1
|
+
import ToggleSwitch, { IToggleSwitchProps } from "./ToggleSwitch"
|
|
2
|
+
export type { IToggleSwitchProps }
|
|
3
|
+
export default ToggleSwitch
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
import type { Meta, StoryObj } from "@storybook/react"
|
|
3
|
-
import Tabs, { ITabsProps } from "./Tabs"
|
|
4
|
-
|
|
5
|
-
const meta: Meta<typeof Tabs> = {
|
|
6
|
-
title: "Design System/molecules/Tabs",
|
|
7
|
-
component: Tabs,
|
|
8
|
-
tags: ["autodocs"],
|
|
9
|
-
argTypes: {}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default meta
|
|
13
|
-
type Story = StoryObj<typeof Tabs>
|
|
14
|
-
export const DefaultTabsStory: Story = {
|
|
15
|
-
args: {
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
}
|
|
1
|
+
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
3
|
+
import Tabs, { ITabsProps } from "./Tabs"
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Tabs> = {
|
|
6
|
+
title: "Design System/molecules/Tabs",
|
|
7
|
+
component: Tabs,
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
argTypes: {}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default meta
|
|
13
|
+
type Story = StoryObj<typeof Tabs>
|
|
14
|
+
export const DefaultTabsStory: Story = {
|
|
15
|
+
args: {
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
import React from "react"
|
|
3
|
-
import EmptySectionPlaceholder from "@/stories/organisms/EmptySectionPlaceholder"
|
|
4
|
-
|
|
5
|
-
export interface ITabsProps {}
|
|
6
|
-
|
|
7
|
-
const Tabs: React.FC<ITabsProps> = ({}) => {
|
|
8
|
-
return (
|
|
9
|
-
<EmptySectionPlaceholder
|
|
10
|
-
{...{
|
|
11
|
-
icon: {
|
|
12
|
-
icon: "IconCode"
|
|
13
|
-
},
|
|
14
|
-
mutedText: "Coming Soon! 🚧",
|
|
15
|
-
primaryMessage: "We're working on this component. Be sure to check back soon!",
|
|
16
|
-
actions: []
|
|
17
|
-
}}
|
|
18
|
-
/>
|
|
19
|
-
)
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export default Tabs;
|
|
1
|
+
|
|
2
|
+
import React from "react"
|
|
3
|
+
import EmptySectionPlaceholder from "@/stories/organisms/EmptySectionPlaceholder"
|
|
4
|
+
|
|
5
|
+
export interface ITabsProps {}
|
|
6
|
+
|
|
7
|
+
const Tabs: React.FC<ITabsProps> = ({}) => {
|
|
8
|
+
return (
|
|
9
|
+
<EmptySectionPlaceholder
|
|
10
|
+
{...{
|
|
11
|
+
icon: {
|
|
12
|
+
icon: "IconCode"
|
|
13
|
+
},
|
|
14
|
+
mutedText: "Coming Soon! 🚧",
|
|
15
|
+
primaryMessage: "We're working on this component. Be sure to check back soon!",
|
|
16
|
+
actions: []
|
|
17
|
+
}}
|
|
18
|
+
/>
|
|
19
|
+
)
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default Tabs;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./Tabs"
|
|
2
|
-
export { default } from "./Tabs"
|
|
1
|
+
export * from "./Tabs"
|
|
2
|
+
export { default } from "./Tabs"
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
-
import AnimatedLabelInput, { IAnimatedLabelInputProps } from "./AnimatedLabelInput"
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof AnimatedLabelInput> = {
|
|
5
|
-
title: "Design System/organisms/Animated Label Input",
|
|
6
|
-
component: AnimatedLabelInput,
|
|
7
|
-
tags: ["autodocs"],
|
|
8
|
-
argTypes: {}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export default meta
|
|
12
|
-
type Story = StoryObj<typeof AnimatedLabelInput>
|
|
13
|
-
export const DefaultAnimatedLabelInputsStory: Story = {
|
|
14
|
-
args: {
|
|
15
|
-
id: "test",
|
|
16
|
-
label: {
|
|
17
|
-
display: "Label"
|
|
18
|
-
}
|
|
19
|
-
} as IAnimatedLabelInputProps
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export const DefaultAnimatedLabelInputsStoryWithPlaceHolder: Story = {
|
|
23
|
-
args: {
|
|
24
|
-
id: "test",
|
|
25
|
-
label: {
|
|
26
|
-
display: "Label"
|
|
27
|
-
},
|
|
28
|
-
placeholder: "Placeholder"
|
|
29
|
-
} as IAnimatedLabelInputProps
|
|
30
|
-
}
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
import AnimatedLabelInput, { IAnimatedLabelInputProps } from "./AnimatedLabelInput"
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof AnimatedLabelInput> = {
|
|
5
|
+
title: "Design System/organisms/Animated Label Input",
|
|
6
|
+
component: AnimatedLabelInput,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
argTypes: {}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default meta
|
|
12
|
+
type Story = StoryObj<typeof AnimatedLabelInput>
|
|
13
|
+
export const DefaultAnimatedLabelInputsStory: Story = {
|
|
14
|
+
args: {
|
|
15
|
+
id: "test",
|
|
16
|
+
label: {
|
|
17
|
+
display: "Label"
|
|
18
|
+
}
|
|
19
|
+
} as IAnimatedLabelInputProps
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const DefaultAnimatedLabelInputsStoryWithPlaceHolder: Story = {
|
|
23
|
+
args: {
|
|
24
|
+
id: "test",
|
|
25
|
+
label: {
|
|
26
|
+
display: "Label"
|
|
27
|
+
},
|
|
28
|
+
placeholder: "Placeholder"
|
|
29
|
+
} as IAnimatedLabelInputProps
|
|
30
|
+
}
|
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
import { default as cn } from "classnames"
|
|
3
|
-
import InputField, { IInputFieldProps } from "@/stories/molecules/inputs/InputField"
|
|
4
|
-
|
|
5
|
-
interface ILabelProps extends React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement> {
|
|
6
|
-
display: string
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface IAnimatedLabelInputProps extends Omit<IInputFieldProps, "handleChange"> {
|
|
10
|
-
id: string
|
|
11
|
-
containerStyles?: string
|
|
12
|
-
message?: string
|
|
13
|
-
required?: boolean
|
|
14
|
-
isError?: boolean
|
|
15
|
-
label: ILabelProps
|
|
16
|
-
handleChange: (value: string) => void
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const AnimatedLabelInput: React.FC<IAnimatedLabelInputProps> = (props: IAnimatedLabelInputProps) => {
|
|
20
|
-
const { id, containerStyles, message, required, isError, label, value, handleChange, ...input } = props
|
|
21
|
-
|
|
22
|
-
const [hasValue, setHasValue] = React.useState<boolean>(!!value)
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<>
|
|
26
|
-
<div className={cn("group relative", containerStyles ? containerStyles : "")}>
|
|
27
|
-
<InputField
|
|
28
|
-
id={id}
|
|
29
|
-
isError={isError}
|
|
30
|
-
value={value}
|
|
31
|
-
handleChange={(v) => {
|
|
32
|
-
setHasValue(!!v)
|
|
33
|
-
if (handleChange) handleChange(v)
|
|
34
|
-
}}
|
|
35
|
-
{...input}
|
|
36
|
-
/>
|
|
37
|
-
<label
|
|
38
|
-
className={cn(
|
|
39
|
-
"absolute z-10 ml-[3px] inline-block bg-white text-sm transition-all text-gray-500 left-1 px-1",
|
|
40
|
-
hasValue ? "!-top-[8px] !ml-[.172rem] !text-xs text-gray-600" : "top-[9px]",
|
|
41
|
-
"peer-placeholder-shown:!-top-[8px] peer-placeholder-shown:!ml-[.172rem] peer-placeholder-shown:!text-xs peer-placeholder-shown:text-gray-600",
|
|
42
|
-
"group-focus-within:!-top-[8px] group-focus-within:!ml-[.172rem] group-focus-within:!text-xs group-focus-within:text-gray-600",
|
|
43
|
-
|
|
44
|
-
isError && "!text-red-600"
|
|
45
|
-
)}
|
|
46
|
-
htmlFor={id}
|
|
47
|
-
>
|
|
48
|
-
{label.display}
|
|
49
|
-
{required && <span className="text-red-600 ml-1">*</span>}
|
|
50
|
-
</label>
|
|
51
|
-
|
|
52
|
-
<div className="flex flex-row space-x-3">
|
|
53
|
-
<div className="grow transition-all">
|
|
54
|
-
{message && (
|
|
55
|
-
<span className={cn("mt-1 block text-sm", isError ? "text-red-500" : "text-gray-500")}>
|
|
56
|
-
{message}
|
|
57
|
-
</span>
|
|
58
|
-
)}
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
</div>
|
|
62
|
-
</>
|
|
63
|
-
)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export default AnimatedLabelInput
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { default as cn } from "classnames"
|
|
3
|
+
import InputField, { IInputFieldProps } from "@/stories/molecules/inputs/InputField"
|
|
4
|
+
|
|
5
|
+
interface ILabelProps extends React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement> {
|
|
6
|
+
display: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface IAnimatedLabelInputProps extends Omit<IInputFieldProps, "handleChange"> {
|
|
10
|
+
id: string
|
|
11
|
+
containerStyles?: string
|
|
12
|
+
message?: string
|
|
13
|
+
required?: boolean
|
|
14
|
+
isError?: boolean
|
|
15
|
+
label: ILabelProps
|
|
16
|
+
handleChange: (value: string) => void
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const AnimatedLabelInput: React.FC<IAnimatedLabelInputProps> = (props: IAnimatedLabelInputProps) => {
|
|
20
|
+
const { id, containerStyles, message, required, isError, label, value, handleChange, ...input } = props
|
|
21
|
+
|
|
22
|
+
const [hasValue, setHasValue] = React.useState<boolean>(!!value)
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<>
|
|
26
|
+
<div className={cn("group relative", containerStyles ? containerStyles : "")}>
|
|
27
|
+
<InputField
|
|
28
|
+
id={id}
|
|
29
|
+
isError={isError}
|
|
30
|
+
value={value}
|
|
31
|
+
handleChange={(v) => {
|
|
32
|
+
setHasValue(!!v)
|
|
33
|
+
if (handleChange) handleChange(v)
|
|
34
|
+
}}
|
|
35
|
+
{...input}
|
|
36
|
+
/>
|
|
37
|
+
<label
|
|
38
|
+
className={cn(
|
|
39
|
+
"absolute z-10 ml-[3px] inline-block bg-white text-sm transition-all text-gray-500 left-1 px-1",
|
|
40
|
+
hasValue ? "!-top-[8px] !ml-[.172rem] !text-xs text-gray-600" : "top-[9px]",
|
|
41
|
+
"peer-placeholder-shown:!-top-[8px] peer-placeholder-shown:!ml-[.172rem] peer-placeholder-shown:!text-xs peer-placeholder-shown:text-gray-600",
|
|
42
|
+
"group-focus-within:!-top-[8px] group-focus-within:!ml-[.172rem] group-focus-within:!text-xs group-focus-within:text-gray-600",
|
|
43
|
+
|
|
44
|
+
isError && "!text-red-600"
|
|
45
|
+
)}
|
|
46
|
+
htmlFor={id}
|
|
47
|
+
>
|
|
48
|
+
{label.display}
|
|
49
|
+
{required && <span className="text-red-600 ml-1">*</span>}
|
|
50
|
+
</label>
|
|
51
|
+
|
|
52
|
+
<div className="flex flex-row space-x-3">
|
|
53
|
+
<div className="grow transition-all">
|
|
54
|
+
{message && (
|
|
55
|
+
<span className={cn("mt-1 block text-sm", isError ? "text-red-500" : "text-gray-500")}>
|
|
56
|
+
{message}
|
|
57
|
+
</span>
|
|
58
|
+
)}
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export default AnimatedLabelInput
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import AnimatedLabelInput, { IAnimatedLabelInputProps } from "./AnimatedLabelInput"
|
|
2
|
-
export type { IAnimatedLabelInputProps }
|
|
3
|
-
export default AnimatedLabelInput
|
|
1
|
+
import AnimatedLabelInput, { IAnimatedLabelInputProps } from "./AnimatedLabelInput"
|
|
2
|
+
export type { IAnimatedLabelInputProps }
|
|
3
|
+
export default AnimatedLabelInput
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
-
import AnimatedLabelTextArea, { IAnimatedLabelTextAreaProps } from "./AnimatedLabelTextArea"
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof AnimatedLabelTextArea> = {
|
|
5
|
-
title: "Design System/organisms/Animated Label Text Area",
|
|
6
|
-
component: AnimatedLabelTextArea,
|
|
7
|
-
tags: ["autodocs"],
|
|
8
|
-
argTypes: {}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export default meta
|
|
12
|
-
type Story = StoryObj<typeof AnimatedLabelTextArea>
|
|
13
|
-
export const DefaultAnimatedLabelTextAreasStory: Story = {
|
|
14
|
-
args: {
|
|
15
|
-
id: "test",
|
|
16
|
-
label: "Label"
|
|
17
|
-
} as IAnimatedLabelTextAreaProps
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const DefaultAnimatedLabelTextAreasStoryWithPlaceholder: Story = {
|
|
21
|
-
args: {
|
|
22
|
-
id: "test",
|
|
23
|
-
label: "Label",
|
|
24
|
-
placeholder: "Placeholder"
|
|
25
|
-
} as IAnimatedLabelTextAreaProps
|
|
26
|
-
}
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
import AnimatedLabelTextArea, { IAnimatedLabelTextAreaProps } from "./AnimatedLabelTextArea"
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof AnimatedLabelTextArea> = {
|
|
5
|
+
title: "Design System/organisms/Animated Label Text Area",
|
|
6
|
+
component: AnimatedLabelTextArea,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
argTypes: {}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default meta
|
|
12
|
+
type Story = StoryObj<typeof AnimatedLabelTextArea>
|
|
13
|
+
export const DefaultAnimatedLabelTextAreasStory: Story = {
|
|
14
|
+
args: {
|
|
15
|
+
id: "test",
|
|
16
|
+
label: "Label"
|
|
17
|
+
} as IAnimatedLabelTextAreaProps
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const DefaultAnimatedLabelTextAreasStoryWithPlaceholder: Story = {
|
|
21
|
+
args: {
|
|
22
|
+
id: "test",
|
|
23
|
+
label: "Label",
|
|
24
|
+
placeholder: "Placeholder"
|
|
25
|
+
} as IAnimatedLabelTextAreaProps
|
|
26
|
+
}
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
import { default as cn } from "classnames"
|
|
3
|
-
|
|
4
|
-
import TextArea, { ITextareaProps } from "@/stories/molecules/inputs/textArea"
|
|
5
|
-
|
|
6
|
-
export interface IAnimatedLabelTextAreaProps extends ITextareaProps {
|
|
7
|
-
id: string
|
|
8
|
-
containerStyles?: string
|
|
9
|
-
message?: string
|
|
10
|
-
required?: boolean
|
|
11
|
-
isError?: boolean
|
|
12
|
-
handleChange: (value: string) => void
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const AnimatedLabelTextArea: React.FC<IAnimatedLabelTextAreaProps> = (props: IAnimatedLabelTextAreaProps) => {
|
|
16
|
-
const { id, containerStyles, message, required, isError, label, value, handleChange, onChange, ...input } = props
|
|
17
|
-
|
|
18
|
-
const [hasValue, setHasValue] = React.useState<boolean>(!!value)
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<div className={cn("group relative", containerStyles ? containerStyles : "")}>
|
|
22
|
-
<TextArea
|
|
23
|
-
id={id}
|
|
24
|
-
isError={isError}
|
|
25
|
-
value={value}
|
|
26
|
-
{...input}
|
|
27
|
-
onChange={(v) => {
|
|
28
|
-
setHasValue(!!v)
|
|
29
|
-
if (handleChange) handleChange(v)
|
|
30
|
-
}}
|
|
31
|
-
label={undefined}
|
|
32
|
-
/>
|
|
33
|
-
<label
|
|
34
|
-
className={cn(
|
|
35
|
-
"absolute z-10 ml-[3px] inline-block bg-white text-sm transition-all text-gray-500 left-1 px-1",
|
|
36
|
-
hasValue ? "!-top-[8px] !ml-[.172rem] !text-xs text-gray-600" : "top-[9px]",
|
|
37
|
-
"peer-placeholder-shown:!-top-[8px] peer-placeholder-shown:!ml-[.172rem] peer-placeholder-shown:!text-xs peer-placeholder-shown:text-gray-600",
|
|
38
|
-
"group-focus-within:!-top-[8px] group-focus-within:!ml-[.172rem] group-focus-within:!text-xs group-focus-within:text-gray-600",
|
|
39
|
-
|
|
40
|
-
isError && "!text-red-600"
|
|
41
|
-
)}
|
|
42
|
-
htmlFor={label?.htmlFor || id}
|
|
43
|
-
>
|
|
44
|
-
{label?.display}
|
|
45
|
-
{required && <span className="text-red-600 ml-1">*</span>}
|
|
46
|
-
</label>
|
|
47
|
-
|
|
48
|
-
<div className="flex flex-row space-x-3">
|
|
49
|
-
<div className="grow transition-all">
|
|
50
|
-
{message && (
|
|
51
|
-
<span className={cn("mt-1 block text-sm", isError ? "text-red-500" : "text-gray-500")}>
|
|
52
|
-
{message}
|
|
53
|
-
</span>
|
|
54
|
-
)}
|
|
55
|
-
</div>
|
|
56
|
-
</div>
|
|
57
|
-
</div>
|
|
58
|
-
)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export default AnimatedLabelTextArea
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { default as cn } from "classnames"
|
|
3
|
+
|
|
4
|
+
import TextArea, { ITextareaProps } from "@/stories/molecules/inputs/textArea"
|
|
5
|
+
|
|
6
|
+
export interface IAnimatedLabelTextAreaProps extends ITextareaProps {
|
|
7
|
+
id: string
|
|
8
|
+
containerStyles?: string
|
|
9
|
+
message?: string
|
|
10
|
+
required?: boolean
|
|
11
|
+
isError?: boolean
|
|
12
|
+
handleChange: (value: string) => void
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const AnimatedLabelTextArea: React.FC<IAnimatedLabelTextAreaProps> = (props: IAnimatedLabelTextAreaProps) => {
|
|
16
|
+
const { id, containerStyles, message, required, isError, label, value, handleChange, onChange, ...input } = props
|
|
17
|
+
|
|
18
|
+
const [hasValue, setHasValue] = React.useState<boolean>(!!value)
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<div className={cn("group relative", containerStyles ? containerStyles : "")}>
|
|
22
|
+
<TextArea
|
|
23
|
+
id={id}
|
|
24
|
+
isError={isError}
|
|
25
|
+
value={value}
|
|
26
|
+
{...input}
|
|
27
|
+
onChange={(v) => {
|
|
28
|
+
setHasValue(!!v)
|
|
29
|
+
if (handleChange) handleChange(v)
|
|
30
|
+
}}
|
|
31
|
+
label={undefined}
|
|
32
|
+
/>
|
|
33
|
+
<label
|
|
34
|
+
className={cn(
|
|
35
|
+
"absolute z-10 ml-[3px] inline-block bg-white text-sm transition-all text-gray-500 left-1 px-1",
|
|
36
|
+
hasValue ? "!-top-[8px] !ml-[.172rem] !text-xs text-gray-600" : "top-[9px]",
|
|
37
|
+
"peer-placeholder-shown:!-top-[8px] peer-placeholder-shown:!ml-[.172rem] peer-placeholder-shown:!text-xs peer-placeholder-shown:text-gray-600",
|
|
38
|
+
"group-focus-within:!-top-[8px] group-focus-within:!ml-[.172rem] group-focus-within:!text-xs group-focus-within:text-gray-600",
|
|
39
|
+
|
|
40
|
+
isError && "!text-red-600"
|
|
41
|
+
)}
|
|
42
|
+
htmlFor={label?.htmlFor || id}
|
|
43
|
+
>
|
|
44
|
+
{label?.display}
|
|
45
|
+
{required && <span className="text-red-600 ml-1">*</span>}
|
|
46
|
+
</label>
|
|
47
|
+
|
|
48
|
+
<div className="flex flex-row space-x-3">
|
|
49
|
+
<div className="grow transition-all">
|
|
50
|
+
{message && (
|
|
51
|
+
<span className={cn("mt-1 block text-sm", isError ? "text-red-500" : "text-gray-500")}>
|
|
52
|
+
{message}
|
|
53
|
+
</span>
|
|
54
|
+
)}
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export default AnimatedLabelTextArea
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import AnimatedLabelTextArea, { IAnimatedLabelTextAreaProps } from "./AnimatedLabelTextArea"
|
|
2
|
-
export type { IAnimatedLabelTextAreaProps }
|
|
3
|
-
export default AnimatedLabelTextArea
|
|
1
|
+
import AnimatedLabelTextArea, { IAnimatedLabelTextAreaProps } from "./AnimatedLabelTextArea"
|
|
2
|
+
export type { IAnimatedLabelTextAreaProps }
|
|
3
|
+
export default AnimatedLabelTextArea
|