athameui 0.0.7 → 0.0.9-c
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/components/Avatar/Avatar.tsx +6 -12
- package/components/Block/Block.tsx +22 -0
- package/components/Block/index.ts +1 -0
- package/components/Button/Button.tsx +2 -2
- package/components/DropDown/Dropdown.tsx +61 -0
- package/components/DropDown/index.ts +1 -0
- package/components/{FormElements/FormInput.tsx → FormField/FormField.tsx} +21 -15
- package/components/FormField/index.ts +1 -0
- package/components/{FormElements/FormInputLabel.tsx → FormLabel/FormLabel.tsx} +5 -5
- package/components/FormLabel/index.ts +1 -0
- package/components/FormTextInput/FormTextInput.tsx +93 -0
- package/components/FormTextInput/index.ts +1 -0
- package/components/Layout/Main.tsx +21 -14
- package/components/Modal/Modal.tsx +3 -3
- package/components/Search/Search.tsx +7 -4
- package/components/SlideOut/SlideOut.tsx +71 -0
- package/components/SlideOut/index.ts +1 -0
- package/components/index.ts +6 -1
- package/dist/athameui.cjs +204 -64
- package/dist/athameui.cjs.map +1 -1
- package/dist/athameui.mjs +199 -63
- package/dist/athameui.mjs.map +1 -1
- package/dist/components/Avatar/Avatar.d.ts +1 -1
- package/dist/components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/components/Block/Block.d.ts +13 -0
- package/dist/components/Block/Block.d.ts.map +1 -0
- package/dist/components/Block/index.d.ts +2 -0
- package/dist/components/Block/index.d.ts.map +1 -0
- package/dist/components/DropDown/Dropdown.d.ts +14 -0
- package/dist/components/DropDown/Dropdown.d.ts.map +1 -0
- package/dist/components/DropDown/index.d.ts +2 -0
- package/dist/components/DropDown/index.d.ts.map +1 -0
- package/dist/components/{FormElements/FormInput.d.ts → FormField/FormField.d.ts} +6 -4
- package/dist/components/FormField/FormField.d.ts.map +1 -0
- package/dist/components/FormField/index.d.ts +2 -0
- package/dist/components/FormField/index.d.ts.map +1 -0
- package/dist/components/{FormElements/FormInputLabel.d.ts → FormLabel/FormLabel.d.ts} +3 -3
- package/dist/components/FormLabel/FormLabel.d.ts.map +1 -0
- package/dist/components/FormLabel/index.d.ts +2 -0
- package/dist/components/FormLabel/index.d.ts.map +1 -0
- package/dist/components/FormTextInput/FormTextInput.d.ts +27 -0
- package/dist/components/FormTextInput/FormTextInput.d.ts.map +1 -0
- package/dist/components/FormTextInput/index.d.ts +2 -0
- package/dist/components/FormTextInput/index.d.ts.map +1 -0
- package/dist/components/Layout/Main.d.ts +7 -3
- package/dist/components/Layout/Main.d.ts.map +1 -1
- package/dist/components/Search/Search.d.ts +2 -1
- package/dist/components/Search/Search.d.ts.map +1 -1
- package/dist/components/SlideOut/SlideOut.d.ts +21 -0
- package/dist/components/SlideOut/SlideOut.d.ts.map +1 -0
- package/dist/components/SlideOut/index.d.ts +2 -0
- package/dist/components/SlideOut/index.d.ts.map +1 -0
- package/dist/components/index.d.ts +6 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/styles/breakpoints.d.ts +13 -0
- package/dist/styles/breakpoints.d.ts.map +1 -0
- package/dist/styles/breakpoints.ts +13 -0
- package/dist/styles/components/accordion.css +38 -35
- package/dist/styles/components/avatar.css +25 -4
- package/dist/styles/components/block.css +8 -0
- package/dist/styles/components/button.css +2 -2
- package/dist/styles/components/dropdown.css +18 -0
- package/dist/styles/components/footer.css +0 -1
- package/dist/styles/components/{form-elements.css → form-input.css} +8 -51
- package/dist/styles/components/form-label.css +42 -0
- package/dist/styles/components/main.css +11 -2
- package/dist/styles/components/modals.css +2 -1
- package/dist/styles/components/slide-out.css +69 -0
- package/dist/styles/index.d.ts +1 -1
- package/dist/styles/index.d.ts.map +1 -1
- package/dist/styles/index.ts +1 -1
- package/dist/styles/theme.css +5 -1
- package/dist/styles/tokens.css +45 -25
- package/dist/styles/tokens.d.ts +0 -10
- package/dist/styles/tokens.d.ts.map +1 -1
- package/dist/styles/tokens.ts +16 -26
- package/package.json +1 -1
- package/styles/breakpoints.ts +13 -0
- package/styles/components/accordion.css +38 -35
- package/styles/components/avatar.css +25 -4
- package/styles/components/block.css +8 -0
- package/styles/components/button.css +2 -2
- package/styles/components/dropdown.css +18 -0
- package/styles/components/footer.css +0 -1
- package/styles/components/{form-elements.css → form-input.css} +8 -51
- package/styles/components/form-label.css +42 -0
- package/styles/components/main.css +11 -2
- package/styles/components/modals.css +2 -1
- package/styles/components/slide-out.css +69 -0
- package/styles/index.ts +1 -1
- package/styles/theme.css +5 -1
- package/styles/tokens.css +45 -25
- package/styles/tokens.ts +16 -26
- package/components/FormElements/index.ts +0 -2
- package/dist/components/FormElements/FormInput.d.ts.map +0 -1
- package/dist/components/FormElements/FormInputLabel.d.ts.map +0 -1
- package/dist/components/FormElements/index.d.ts +0 -3
- package/dist/components/FormElements/index.d.ts.map +0 -1
- package/dist/styles/mediaQueries.d.ts +0 -11
- package/dist/styles/mediaQueries.d.ts.map +0 -1
- package/dist/styles/mediaQueries.ts +0 -10
- package/styles/mediaQueries.ts +0 -10
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use client";
|
|
2
1
|
import { CSSObject } from "@emotion/react";
|
|
3
2
|
import { cx } from "../../utils/cx";
|
|
4
3
|
|
|
@@ -10,7 +9,7 @@ type AvatarProps = {
|
|
|
10
9
|
initials?: string;
|
|
11
10
|
// image?: string;
|
|
12
11
|
};
|
|
13
|
-
size?:
|
|
12
|
+
size?: "small" | "medium" | "large" | "profile";
|
|
14
13
|
sx?: {
|
|
15
14
|
avatar?: CSSObject;
|
|
16
15
|
initials?: CSSObject;
|
|
@@ -23,21 +22,16 @@ export const Avatar = ({
|
|
|
23
22
|
className,
|
|
24
23
|
displayName = "Display Name",
|
|
25
24
|
sx,
|
|
26
|
-
size =
|
|
25
|
+
size = "medium",
|
|
27
26
|
}: AvatarProps) => {
|
|
27
|
+
console.log(className?.avatar);
|
|
28
28
|
const initials = displayName.split(" ").map((n) => n[0].toUpperCase());
|
|
29
29
|
const avatarClasses = cx(
|
|
30
|
-
"
|
|
31
|
-
`
|
|
32
|
-
`height-${size}px`,
|
|
33
|
-
`line-height-${size}px`,
|
|
30
|
+
"ath-avatar",
|
|
31
|
+
`ath-avatar-${size}`,
|
|
34
32
|
className?.avatar,
|
|
35
33
|
);
|
|
36
|
-
const initialsClasses = cx(
|
|
37
|
-
".ath-avatar-initials",
|
|
38
|
-
`font-size-${size / 2}px`,
|
|
39
|
-
className?.initials,
|
|
40
|
-
);
|
|
34
|
+
const initialsClasses = cx(`ath-avatar-initials`, className?.initials);
|
|
41
35
|
// const imageClasses = cx(".ath-avatar-image", className?.image);
|
|
42
36
|
|
|
43
37
|
return (
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CSSObject } from "@emotion/react";
|
|
2
|
+
import { cx } from "../../utils/cx";
|
|
3
|
+
|
|
4
|
+
type BlockProps = {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
className?: {
|
|
7
|
+
block?: string | false | null | undefined;
|
|
8
|
+
};
|
|
9
|
+
sx?: {
|
|
10
|
+
block: CSSObject;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const Block = ({ children, className, sx }: BlockProps) => {
|
|
15
|
+
const blockClasses = cx("ath-block", className?.block);
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<div className={blockClasses} data-testid="block" css={sx?.block}>
|
|
19
|
+
{children}
|
|
20
|
+
</div>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Block";
|
|
@@ -55,7 +55,7 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
55
55
|
onClick,
|
|
56
56
|
onFocus,
|
|
57
57
|
onKeyDown,
|
|
58
|
-
...
|
|
58
|
+
...other
|
|
59
59
|
},
|
|
60
60
|
ref,
|
|
61
61
|
) => {
|
|
@@ -105,7 +105,7 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
105
105
|
onKeyDown={onKeyDownHandler}
|
|
106
106
|
onFocus={onFocusHandler}
|
|
107
107
|
onBlur={onBlurHandler}
|
|
108
|
-
{...
|
|
108
|
+
{...other}
|
|
109
109
|
>
|
|
110
110
|
{icon ? (
|
|
111
111
|
<>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
import { CSSObject } from "@emotion/react";
|
|
4
|
+
import { cx } from "../../utils/cx";
|
|
5
|
+
|
|
6
|
+
export type DropdownProps = {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
className?: {
|
|
9
|
+
dropdown?: string | false | null | undefined;
|
|
10
|
+
};
|
|
11
|
+
isOpen: boolean;
|
|
12
|
+
sx?: {
|
|
13
|
+
dropdown?: CSSObject;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
onClose: () => void;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const Dropdown = ({
|
|
20
|
+
children,
|
|
21
|
+
className,
|
|
22
|
+
isOpen,
|
|
23
|
+
sx,
|
|
24
|
+
|
|
25
|
+
onClose,
|
|
26
|
+
}: DropdownProps) => {
|
|
27
|
+
const dropdownRef = useRef<HTMLDivElement>(null);
|
|
28
|
+
const dropdownClasses = cx(
|
|
29
|
+
"ath-dropdown",
|
|
30
|
+
isOpen && "ath-dropdown-open",
|
|
31
|
+
className?.dropdown,
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
const handleOutsideClick = (event: MouseEvent) => {
|
|
36
|
+
if (
|
|
37
|
+
dropdownRef.current &&
|
|
38
|
+
!dropdownRef.current.contains(event.target as Node)
|
|
39
|
+
) {
|
|
40
|
+
onClose();
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
document.addEventListener("mousedown", handleOutsideClick);
|
|
45
|
+
return () => {
|
|
46
|
+
document.removeEventListener("mousedown", handleOutsideClick);
|
|
47
|
+
};
|
|
48
|
+
}, [onClose]);
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<div
|
|
52
|
+
ref={dropdownRef}
|
|
53
|
+
className={dropdownClasses}
|
|
54
|
+
css={sx?.dropdown}
|
|
55
|
+
data-testid="dropdown"
|
|
56
|
+
>
|
|
57
|
+
fdpdsugfpoidsuy
|
|
58
|
+
{children}
|
|
59
|
+
</div>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Dropdown";
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
import React, { ReactNode, useRef, useLayoutEffect } from "react";
|
|
3
3
|
import { CSSObject } from "@emotion/react";
|
|
4
4
|
import { cx } from "../../utils/cx";
|
|
5
|
-
import {
|
|
5
|
+
import { FormLabel } from "../FormLabel";
|
|
6
|
+
import { FormTextInput } from "../FormTextInput";
|
|
7
|
+
import "../FormTextInput";
|
|
6
8
|
|
|
7
|
-
export type
|
|
9
|
+
export type FormFieldProps = {
|
|
8
10
|
autoComplete?: string;
|
|
9
11
|
autoFocus?: boolean;
|
|
10
12
|
autoResize?: boolean;
|
|
@@ -20,11 +22,12 @@ export type FormInputProps = {
|
|
|
20
22
|
disabled?: boolean;
|
|
21
23
|
error?: string;
|
|
22
24
|
helperText?: string | ReactNode;
|
|
25
|
+
id?: string;
|
|
23
26
|
label?: string | ReactNode;
|
|
24
27
|
labelPosition?: "left" | "right" | "above" | "below";
|
|
25
28
|
name?: string;
|
|
26
29
|
placeholder?: string;
|
|
27
|
-
|
|
30
|
+
readOnly?: boolean;
|
|
28
31
|
required?: boolean;
|
|
29
32
|
role?: string;
|
|
30
33
|
size?: "large" | "medium" | "small";
|
|
@@ -59,7 +62,7 @@ export type FormInputProps = {
|
|
|
59
62
|
>;
|
|
60
63
|
};
|
|
61
64
|
|
|
62
|
-
export const
|
|
65
|
+
export const FormField: React.FC<FormFieldProps> = ({
|
|
63
66
|
autoComplete,
|
|
64
67
|
autoFocus = false,
|
|
65
68
|
autoResize = false,
|
|
@@ -68,11 +71,12 @@ export const FormInput: React.FC<FormInputProps> = ({
|
|
|
68
71
|
disabled = false,
|
|
69
72
|
error,
|
|
70
73
|
helperText,
|
|
74
|
+
id,
|
|
71
75
|
label,
|
|
72
76
|
labelPosition = "above",
|
|
73
77
|
name,
|
|
74
78
|
placeholder,
|
|
75
|
-
|
|
79
|
+
readOnly = false,
|
|
76
80
|
required = false,
|
|
77
81
|
size = "medium",
|
|
78
82
|
sx,
|
|
@@ -82,7 +86,7 @@ export const FormInput: React.FC<FormInputProps> = ({
|
|
|
82
86
|
|
|
83
87
|
onChange,
|
|
84
88
|
onKeyDown,
|
|
85
|
-
...
|
|
89
|
+
...other
|
|
86
90
|
}) => {
|
|
87
91
|
const textAreaRef = useRef<HTMLTextAreaElement>(null);
|
|
88
92
|
|
|
@@ -96,7 +100,7 @@ export const FormInput: React.FC<FormInputProps> = ({
|
|
|
96
100
|
const inputSharedClasses = cx(
|
|
97
101
|
`ath-form-input-${size}`,
|
|
98
102
|
disabled && "ath-form-input-shared-disabled",
|
|
99
|
-
|
|
103
|
+
readOnly && "ath-form-input-shared-readonly",
|
|
100
104
|
dark && "ath-form-input-shared-dark",
|
|
101
105
|
className?.input ? className.input : "",
|
|
102
106
|
);
|
|
@@ -151,10 +155,10 @@ export const FormInput: React.FC<FormInputProps> = ({
|
|
|
151
155
|
}, [autoResize, type]);
|
|
152
156
|
|
|
153
157
|
const labelElement = label ? (
|
|
154
|
-
<
|
|
158
|
+
<FormLabel
|
|
155
159
|
label={label}
|
|
156
160
|
required={required}
|
|
157
|
-
htmlFor={
|
|
161
|
+
htmlFor={id}
|
|
158
162
|
className={labelClasses}
|
|
159
163
|
sx={{ label: sx?.label, required: sx?.required }}
|
|
160
164
|
labelPosition={labelPosition}
|
|
@@ -171,31 +175,33 @@ export const FormInput: React.FC<FormInputProps> = ({
|
|
|
171
175
|
name={name}
|
|
172
176
|
onChange={handleTextAreaChange}
|
|
173
177
|
disabled={disabled}
|
|
174
|
-
readOnly={
|
|
178
|
+
readOnly={readOnly}
|
|
175
179
|
onKeyDown={onKeyDown}
|
|
176
180
|
tabIndex={disabled ? -1 : tabIndex}
|
|
177
181
|
className={textAreaClasses}
|
|
178
182
|
css={sx?.input}
|
|
179
183
|
value={value}
|
|
180
184
|
placeholder={placeholder}
|
|
181
|
-
{...
|
|
185
|
+
{...other}
|
|
182
186
|
/>
|
|
183
187
|
) : (
|
|
184
|
-
<
|
|
188
|
+
<FormTextInput
|
|
185
189
|
autoComplete={autoComplete}
|
|
186
190
|
autoFocus={autoFocus}
|
|
187
191
|
name={name}
|
|
188
192
|
type={type}
|
|
189
193
|
onChange={handleInputChange}
|
|
190
194
|
disabled={disabled}
|
|
191
|
-
readOnly={
|
|
195
|
+
readOnly={readOnly}
|
|
192
196
|
onKeyDown={onKeyDown}
|
|
193
197
|
tabIndex={disabled ? -1 : tabIndex}
|
|
194
|
-
className={inputClasses}
|
|
198
|
+
className={{ input: inputClasses }}
|
|
195
199
|
css={sx?.input}
|
|
196
200
|
value={value}
|
|
197
201
|
placeholder={placeholder}
|
|
198
|
-
{
|
|
202
|
+
size={size}
|
|
203
|
+
id={id}
|
|
204
|
+
{...other}
|
|
199
205
|
/>
|
|
200
206
|
);
|
|
201
207
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./FormField";
|
|
@@ -3,7 +3,7 @@ import { ReactNode } from "react";
|
|
|
3
3
|
import { CSSObject } from "@emotion/react";
|
|
4
4
|
import { cx } from "../../utils/cx";
|
|
5
5
|
|
|
6
|
-
type
|
|
6
|
+
type FormLabelProps = React.LabelHTMLAttributes<HTMLLabelElement> & {
|
|
7
7
|
label: string | ReactNode;
|
|
8
8
|
required?: boolean;
|
|
9
9
|
className?: {
|
|
@@ -15,15 +15,15 @@ type LabelProps = React.LabelHTMLAttributes<HTMLLabelElement> & {
|
|
|
15
15
|
sx?: { label?: CSSObject; required?: CSSObject };
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
export const
|
|
18
|
+
export const FormLabel = ({
|
|
19
19
|
label,
|
|
20
20
|
required,
|
|
21
21
|
className,
|
|
22
22
|
labelPosition = "above",
|
|
23
23
|
dark,
|
|
24
24
|
sx,
|
|
25
|
-
...
|
|
26
|
-
}:
|
|
25
|
+
...other
|
|
26
|
+
}: FormLabelProps) => {
|
|
27
27
|
const labelClasses = cx(
|
|
28
28
|
"ath-form-input-label",
|
|
29
29
|
labelPosition ? `ath-form-input-label-${labelPosition}` : "",
|
|
@@ -38,7 +38,7 @@ export const FormInputLabel = ({
|
|
|
38
38
|
);
|
|
39
39
|
|
|
40
40
|
return (
|
|
41
|
-
<label className={labelClasses} css={sx?.label} {...
|
|
41
|
+
<label className={labelClasses} css={sx?.label} {...other}>
|
|
42
42
|
{label}
|
|
43
43
|
{required && (
|
|
44
44
|
<span
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./FormLabel";
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { CSSObject } from "@emotion/react";
|
|
2
|
+
import { cx } from "../../utils/cx";
|
|
3
|
+
|
|
4
|
+
type FormTextInputProps = {
|
|
5
|
+
autoComplete?: string;
|
|
6
|
+
autoFocus?: boolean;
|
|
7
|
+
className?: {
|
|
8
|
+
input?: string | false | null | undefined;
|
|
9
|
+
};
|
|
10
|
+
dark?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
error?: string;
|
|
13
|
+
id?: string;
|
|
14
|
+
name?: string;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
readOnly?: boolean;
|
|
17
|
+
size?: "large" | "medium" | "small";
|
|
18
|
+
sx?: {
|
|
19
|
+
input?: CSSObject;
|
|
20
|
+
};
|
|
21
|
+
tabIndex?: number;
|
|
22
|
+
type?:
|
|
23
|
+
| "text"
|
|
24
|
+
| "email"
|
|
25
|
+
| "password"
|
|
26
|
+
| "tel"
|
|
27
|
+
| "url"
|
|
28
|
+
| "search"
|
|
29
|
+
| "number"
|
|
30
|
+
| "date";
|
|
31
|
+
value?: string | number;
|
|
32
|
+
|
|
33
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
34
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const FormTextInput = ({
|
|
38
|
+
autoComplete,
|
|
39
|
+
autoFocus,
|
|
40
|
+
className,
|
|
41
|
+
dark,
|
|
42
|
+
error,
|
|
43
|
+
disabled,
|
|
44
|
+
id,
|
|
45
|
+
name,
|
|
46
|
+
placeholder,
|
|
47
|
+
readOnly,
|
|
48
|
+
size,
|
|
49
|
+
sx,
|
|
50
|
+
tabIndex,
|
|
51
|
+
type = "text",
|
|
52
|
+
value,
|
|
53
|
+
|
|
54
|
+
onChange,
|
|
55
|
+
onKeyDown,
|
|
56
|
+
...other
|
|
57
|
+
}: FormTextInputProps) => {
|
|
58
|
+
const inputClasses = cx(
|
|
59
|
+
"ath-form-text-input",
|
|
60
|
+
`ath-form-text-input-${size}`,
|
|
61
|
+
dark ? "ath-form-text-input-dark" : "",
|
|
62
|
+
disabled ? "ath-form-text-input-disabled" : "",
|
|
63
|
+
readOnly ? "ath-form-text-input-readonly" : "",
|
|
64
|
+
error ? "ath-form-text-input-error" : "",
|
|
65
|
+
className?.input,
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
const onChangeHandler = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
69
|
+
if (!disabled && !readOnly) {
|
|
70
|
+
onChange(e);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<input
|
|
76
|
+
autoComplete={autoComplete}
|
|
77
|
+
autoFocus={autoFocus}
|
|
78
|
+
className={inputClasses}
|
|
79
|
+
css={sx?.input}
|
|
80
|
+
disabled={disabled}
|
|
81
|
+
name={name}
|
|
82
|
+
placeholder={placeholder}
|
|
83
|
+
readOnly={readOnly}
|
|
84
|
+
tabIndex={disabled ? -1 : tabIndex}
|
|
85
|
+
type={type}
|
|
86
|
+
value={value}
|
|
87
|
+
onChange={onChangeHandler}
|
|
88
|
+
onKeyDown={onKeyDown}
|
|
89
|
+
id={id}
|
|
90
|
+
{...other}
|
|
91
|
+
/>
|
|
92
|
+
);
|
|
93
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./FormTextInput";
|
|
@@ -4,28 +4,35 @@ import { cx } from "../../utils";
|
|
|
4
4
|
|
|
5
5
|
type MainProps = {
|
|
6
6
|
children?: React.ReactNode;
|
|
7
|
-
className?:
|
|
8
|
-
|
|
|
9
|
-
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
className?: {
|
|
8
|
+
main?: string | false | null | undefined;
|
|
9
|
+
mainContent?: string | false | null | undefined;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
sx?: {
|
|
13
|
+
main?: CSSObject;
|
|
14
|
+
mainContent?: CSSObject;
|
|
15
|
+
};
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
export const Main = ({ children, className, sx }: MainProps) => {
|
|
19
|
-
const
|
|
19
|
+
const mainClasses = cx(
|
|
20
20
|
"ath-main",
|
|
21
|
+
typeof className === "object" && className !== null ? className.main : "",
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const mainContentClasses = cx(
|
|
25
|
+
"ath-main-content",
|
|
21
26
|
typeof className === "object" && className !== null
|
|
22
|
-
? className.
|
|
23
|
-
:
|
|
27
|
+
? className.mainContent
|
|
28
|
+
: "",
|
|
24
29
|
);
|
|
25
30
|
|
|
26
31
|
return (
|
|
27
|
-
<main css={sx} className={
|
|
28
|
-
{
|
|
32
|
+
<main css={sx?.main} className={mainClasses}>
|
|
33
|
+
<div css={sx?.mainContent} className={mainContentClasses}>
|
|
34
|
+
{children}
|
|
35
|
+
</div>
|
|
29
36
|
</main>
|
|
30
37
|
);
|
|
31
38
|
};
|
|
@@ -4,7 +4,7 @@ import { CSSObject } from "@emotion/react";
|
|
|
4
4
|
import { HugeiconsIcon } from "@hugeicons/react";
|
|
5
5
|
import { CancelCircleIcon } from "@hugeicons/core-free-icons";
|
|
6
6
|
import { Button } from "../Button/Button";
|
|
7
|
-
import { cx } from "../../
|
|
7
|
+
import { cx } from "../../utils/cx";
|
|
8
8
|
|
|
9
9
|
export type ModalProps = {
|
|
10
10
|
isOpen: boolean;
|
|
@@ -55,7 +55,7 @@ export const Modal: React.FC<ModalProps> = ({
|
|
|
55
55
|
sx,
|
|
56
56
|
|
|
57
57
|
onClose,
|
|
58
|
-
...
|
|
58
|
+
...other
|
|
59
59
|
}) => {
|
|
60
60
|
const [previouslyFocusedElement, setPreviouslyFocusedElement] =
|
|
61
61
|
React.useState<HTMLElement | null>(null);
|
|
@@ -176,7 +176,7 @@ export const Modal: React.FC<ModalProps> = ({
|
|
|
176
176
|
css={sx?.modal}
|
|
177
177
|
className={modalClasses}
|
|
178
178
|
role="dialog"
|
|
179
|
-
{...
|
|
179
|
+
{...other}
|
|
180
180
|
>
|
|
181
181
|
{(title || showCloseButton) && (
|
|
182
182
|
<div css={sx?.header} className={headerClasses}>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { FormField } from "../FormField";
|
|
4
4
|
import { Button } from "../Button";
|
|
5
5
|
import { cx } from "../../utils/cx";
|
|
6
6
|
import { CSSObject } from "@emotion/react";
|
|
@@ -18,6 +18,7 @@ type SearchProps = {
|
|
|
18
18
|
searchButton?: string | CSSObject;
|
|
19
19
|
};
|
|
20
20
|
dark?: boolean;
|
|
21
|
+
id?: string;
|
|
21
22
|
inputSize?: "large" | "medium" | "small";
|
|
22
23
|
label?: string;
|
|
23
24
|
labelPosition?: "left" | "right" | "above" | "below";
|
|
@@ -49,6 +50,7 @@ export const Search = ({
|
|
|
49
50
|
buttonVariant = "primary",
|
|
50
51
|
className,
|
|
51
52
|
dark = false,
|
|
53
|
+
id,
|
|
52
54
|
inputSize,
|
|
53
55
|
label,
|
|
54
56
|
labelPosition = "above",
|
|
@@ -65,7 +67,7 @@ export const Search = ({
|
|
|
65
67
|
onSearch,
|
|
66
68
|
setSearchTerm,
|
|
67
69
|
|
|
68
|
-
...
|
|
70
|
+
...other
|
|
69
71
|
}: SearchProps) => {
|
|
70
72
|
const setSearchTermHandler = (
|
|
71
73
|
e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>,
|
|
@@ -93,7 +95,7 @@ export const Search = ({
|
|
|
93
95
|
)}
|
|
94
96
|
css={sx?.searchForm}
|
|
95
97
|
role={searchRole || "search"}
|
|
96
|
-
{...
|
|
98
|
+
{...other}
|
|
97
99
|
>
|
|
98
100
|
<div
|
|
99
101
|
className={cx(
|
|
@@ -123,8 +125,9 @@ export const Search = ({
|
|
|
123
125
|
)}
|
|
124
126
|
|
|
125
127
|
<div className="ath-search-input-wrapper">
|
|
126
|
-
<
|
|
128
|
+
<FormField
|
|
127
129
|
type="search"
|
|
130
|
+
id={id}
|
|
128
131
|
value={searchTerm || ""}
|
|
129
132
|
name="searchTerm"
|
|
130
133
|
labelPosition={labelPosition}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { CSSObject } from "@emotion/react";
|
|
2
|
+
import { HugeiconsIcon } from "@hugeicons/react";
|
|
3
|
+
import { CancelCircleIcon } from "@hugeicons/core-free-icons";
|
|
4
|
+
import { cx } from "../../utils/cx";
|
|
5
|
+
import { Button } from "../Button/Button";
|
|
6
|
+
|
|
7
|
+
export type SlideOutProps = {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
className?: {
|
|
10
|
+
slideOut?: string | false | null | undefined;
|
|
11
|
+
overlay?: string | false | null | undefined;
|
|
12
|
+
panel?: string | false | null | undefined;
|
|
13
|
+
closeButton?: string | false | null | undefined;
|
|
14
|
+
};
|
|
15
|
+
from?: "left" | "right";
|
|
16
|
+
isOpen?: boolean;
|
|
17
|
+
sx?: {
|
|
18
|
+
slideOut?: CSSObject;
|
|
19
|
+
overlay?: CSSObject;
|
|
20
|
+
panel?: CSSObject;
|
|
21
|
+
closeButton?: CSSObject;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
onClose: () => void;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const SlideOut = ({
|
|
28
|
+
children,
|
|
29
|
+
className,
|
|
30
|
+
from = "right",
|
|
31
|
+
isOpen = false,
|
|
32
|
+
sx,
|
|
33
|
+
|
|
34
|
+
onClose,
|
|
35
|
+
}: SlideOutProps) => {
|
|
36
|
+
const slideOutClasses = cx("ath-slide-out", className?.slideOut);
|
|
37
|
+
const overlayClasses = cx(
|
|
38
|
+
"ath-slide-out-overlay",
|
|
39
|
+
isOpen && "ath-slide-out-overlay-open",
|
|
40
|
+
className?.overlay,
|
|
41
|
+
);
|
|
42
|
+
const panelClasses = cx(
|
|
43
|
+
"ath-slide-out-panel",
|
|
44
|
+
from === "left" ? "ath-slide-out-from-left" : "ath-slide-out-from-right",
|
|
45
|
+
isOpen && "ath-slide-out-panel-open",
|
|
46
|
+
className?.panel,
|
|
47
|
+
);
|
|
48
|
+
const closeButtonClasses = cx(
|
|
49
|
+
"ath-slide-out-close-button",
|
|
50
|
+
className?.closeButton,
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<div className={slideOutClasses} css={sx?.slideOut} data-testid="slide-out">
|
|
55
|
+
<div className={overlayClasses} css={sx?.overlay} onClick={onClose} />
|
|
56
|
+
<div className={panelClasses} css={sx?.panel}>
|
|
57
|
+
<Button
|
|
58
|
+
className={{ button: closeButtonClasses }}
|
|
59
|
+
sx={{ button: sx?.closeButton }}
|
|
60
|
+
onClick={onClose}
|
|
61
|
+
aria-label="Close menu"
|
|
62
|
+
variant="ghost"
|
|
63
|
+
dark
|
|
64
|
+
size="medium"
|
|
65
|
+
icon={<HugeiconsIcon icon={CancelCircleIcon} size={24} />}
|
|
66
|
+
/>
|
|
67
|
+
{children}
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./SlideOut";
|
package/components/index.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
export * from "./Accordion";
|
|
2
2
|
export * from "./Avatar";
|
|
3
|
+
export * from "./Block";
|
|
3
4
|
export * from "./Button";
|
|
4
5
|
export * from "./ButtonGroup";
|
|
6
|
+
export * from "./DropDown";
|
|
5
7
|
export * from "./ContainerScalingText";
|
|
6
|
-
export * from "./
|
|
8
|
+
export * from "./FormField";
|
|
9
|
+
export * from "./FormLabel";
|
|
10
|
+
export * from "./FormTextInput";
|
|
7
11
|
export * from "./Header";
|
|
8
12
|
export * from "./Layout";
|
|
9
13
|
export * from "./List";
|
|
10
14
|
export * from "./Modal";
|
|
11
15
|
export * from "./Search";
|
|
16
|
+
export * from "./SlideOut";
|