@modul/mbui 0.0.13-beta-pv-53036-091041a3 → 0.0.13-beta-pv-53036-91768058
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/dist/Form/Form.d.ts +23 -0
- package/dist/Form/Form.js +73 -0
- package/dist/Form/Form.js.map +1 -0
- package/dist/Form/index.d.ts +1 -0
- package/dist/Form/index.js +13 -0
- package/dist/Form/index.js.map +1 -0
- package/dist/Select/SelectAccountCard.d.ts +1 -3
- package/dist/Select/SelectAccountCard.js +9 -9
- package/dist/Select/SelectAccountCard.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/Form/Form.tsx +1 -1
- package/src/Select/SelectAccountCard.tsx +20 -20
- package/src/index.ts +8 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
3
|
+
import { ControllerProps, FieldValues } from 'react-hook-form';
|
|
4
|
+
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues extends FieldValues = undefined>(props: import("react-hook-form").FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
|
|
5
|
+
declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends import("react-hook-form").Path<TFieldValues> = import("react-hook-form").Path<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => React.JSX.Element;
|
|
6
|
+
declare const useFormField: () => {
|
|
7
|
+
invalid: boolean;
|
|
8
|
+
isDirty: boolean;
|
|
9
|
+
isTouched: boolean;
|
|
10
|
+
isValidating: boolean;
|
|
11
|
+
error?: import("react-hook-form").FieldError;
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
formItemId: string;
|
|
15
|
+
formDescriptionId: string;
|
|
16
|
+
formMessageId: string;
|
|
17
|
+
};
|
|
18
|
+
declare const FormItem: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
declare const FormLabel: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & React.RefAttributes<HTMLLabelElement>>;
|
|
20
|
+
declare const FormControl: React.ForwardRefExoticComponent<Omit<import("@radix-ui/react-slot").SlotProps & React.RefAttributes<HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
21
|
+
declare const FormDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
22
|
+
declare const FormMessage: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
23
|
+
export { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormField = exports.FormMessage = exports.FormDescription = exports.FormControl = exports.FormLabel = exports.FormItem = exports.Form = exports.useFormField = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = (0, tslib_1.__importStar)(require("react"));
|
|
6
|
+
const react_slot_1 = require("@radix-ui/react-slot");
|
|
7
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
8
|
+
const utils_1 = require("../@/lib/utils");
|
|
9
|
+
const Label_1 = require("../Label");
|
|
10
|
+
const Form = react_hook_form_1.FormProvider;
|
|
11
|
+
exports.Form = Form;
|
|
12
|
+
const FormFieldContext = React.createContext({});
|
|
13
|
+
const FormField = ({ ...props }) => {
|
|
14
|
+
return (React.createElement(FormFieldContext.Provider, { value: { name: props.name } },
|
|
15
|
+
React.createElement(react_hook_form_1.Controller, { ...props })));
|
|
16
|
+
};
|
|
17
|
+
exports.FormField = FormField;
|
|
18
|
+
const useFormField = () => {
|
|
19
|
+
const fieldContext = React.useContext(FormFieldContext);
|
|
20
|
+
const itemContext = React.useContext(FormItemContext);
|
|
21
|
+
const { getFieldState, formState } = (0, react_hook_form_1.useFormContext)();
|
|
22
|
+
const fieldState = getFieldState(fieldContext.name, formState);
|
|
23
|
+
if (!fieldContext) {
|
|
24
|
+
throw new Error('useFormField should be used within <FormField>');
|
|
25
|
+
}
|
|
26
|
+
const { id } = itemContext;
|
|
27
|
+
return {
|
|
28
|
+
id,
|
|
29
|
+
name: fieldContext.name,
|
|
30
|
+
formItemId: `${id}-form-item`,
|
|
31
|
+
formDescriptionId: `${id}-form-item-description`,
|
|
32
|
+
formMessageId: `${id}-form-item-message`,
|
|
33
|
+
...fieldState,
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
exports.useFormField = useFormField;
|
|
37
|
+
const FormItemContext = React.createContext({});
|
|
38
|
+
const FormItem = React.forwardRef(({ className, ...props }, ref) => {
|
|
39
|
+
const id = React.useId();
|
|
40
|
+
return (React.createElement(FormItemContext.Provider, { value: { id } },
|
|
41
|
+
React.createElement("div", { ref: ref, className: (0, utils_1.cn)('space-y-2', className), ...props })));
|
|
42
|
+
});
|
|
43
|
+
exports.FormItem = FormItem;
|
|
44
|
+
FormItem.displayName = 'FormItem';
|
|
45
|
+
const FormLabel = React.forwardRef(({ className, ...props }, ref) => {
|
|
46
|
+
const { error, formItemId } = useFormField();
|
|
47
|
+
return (React.createElement(Label_1.Label, { ref: ref, className: (0, utils_1.cn)(error && 'text-destructive', className), htmlFor: formItemId, ...props }));
|
|
48
|
+
});
|
|
49
|
+
exports.FormLabel = FormLabel;
|
|
50
|
+
FormLabel.displayName = 'FormLabel';
|
|
51
|
+
const FormControl = React.forwardRef(({ ...props }, ref) => {
|
|
52
|
+
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
53
|
+
return (React.createElement(react_slot_1.Slot, { ref: ref, id: formItemId, "aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`, "aria-invalid": !!error, ...props }));
|
|
54
|
+
});
|
|
55
|
+
exports.FormControl = FormControl;
|
|
56
|
+
FormControl.displayName = 'FormControl';
|
|
57
|
+
const FormDescription = React.forwardRef(({ className, ...props }, ref) => {
|
|
58
|
+
const { formDescriptionId } = useFormField();
|
|
59
|
+
return (React.createElement("p", { ref: ref, id: formDescriptionId, className: (0, utils_1.cn)('text-[0.8rem] text-light', className), ...props }));
|
|
60
|
+
});
|
|
61
|
+
exports.FormDescription = FormDescription;
|
|
62
|
+
FormDescription.displayName = 'FormDescription';
|
|
63
|
+
const FormMessage = React.forwardRef(({ className, children, ...props }, ref) => {
|
|
64
|
+
const { error, formMessageId } = useFormField();
|
|
65
|
+
const body = error ? String(error?.message) : children;
|
|
66
|
+
if (!body) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
return (React.createElement("p", { ref: ref, id: formMessageId, className: (0, utils_1.cn)('text-[0.8rem] font-medium text-destructive', className), ...props }, body));
|
|
70
|
+
});
|
|
71
|
+
exports.FormMessage = FormMessage;
|
|
72
|
+
FormMessage.displayName = 'FormMessage';
|
|
73
|
+
//# sourceMappingURL=Form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Form.js","sourceRoot":"","sources":["../../src/Form/Form.tsx"],"names":[],"mappings":";;;;AAAA,0DAA8B;AAE9B,qDAA2C;AAC3C,qDAAmH;AAEnH,0CAAmC;AACnC,oCAAgC;AAEhC,MAAM,IAAI,GAAG,8BAAY,CAAA;AA+IF,oBAAI;AAtI3B,MAAM,gBAAgB,GAAG,KAAK,CAAC,aAAa,CAAwB,EAA2B,CAAC,CAAA;AAEhG,MAAM,SAAS,GAAG,CAGhB,EACD,GAAG,KAAK,EAC8B,EAAE,EAAE;IAC1C,OAAO,CACN,oBAAC,gBAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE;QACrD,oB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C,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,iBAAiB,EACrB,SAAS,EAAE,IAAA,UAAE,EAAC,0BAA0B,EAAE,SAAS,CAAC,KAChD,KAAK,GACR,CACF,CAAA;AACF,CAAC,CACD,CAAA;AA0B8D,0CAAe;AAzB9E,eAAe,CAAC,WAAW,GAAG,iBAAiB,CAAA;AAE/C,MAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CACnC,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IAC1C,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,YAAY,EAAE,CAAA;IAC/C,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAA;IAEtD,IAAI,CAAC,IAAI,EAAE;QACV,OAAO,IAAI,CAAA;KACX;IAED,OAAO,CACN,2BACC,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,aAAa,EACjB,SAAS,EAAE,IAAA,UAAE,EAAC,4CAA4C,EAAE,SAAS,CAAC,KAClE,KAAK,IAER,IAAI,CACF,CACJ,CAAA;AACF,CAAC,CACD,CAAA;AAG+E,kCAAW;AAF3F,WAAW,CAAC,WAAW,GAAG,aAAa,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField } from './Form';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormField = exports.FormMessage = exports.FormDescription = exports.FormControl = exports.FormLabel = exports.FormItem = exports.Form = exports.useFormField = void 0;
|
|
4
|
+
var Form_1 = require("./Form");
|
|
5
|
+
Object.defineProperty(exports, "useFormField", { enumerable: true, get: function () { return Form_1.useFormField; } });
|
|
6
|
+
Object.defineProperty(exports, "Form", { enumerable: true, get: function () { return Form_1.Form; } });
|
|
7
|
+
Object.defineProperty(exports, "FormItem", { enumerable: true, get: function () { return Form_1.FormItem; } });
|
|
8
|
+
Object.defineProperty(exports, "FormLabel", { enumerable: true, get: function () { return Form_1.FormLabel; } });
|
|
9
|
+
Object.defineProperty(exports, "FormControl", { enumerable: true, get: function () { return Form_1.FormControl; } });
|
|
10
|
+
Object.defineProperty(exports, "FormDescription", { enumerable: true, get: function () { return Form_1.FormDescription; } });
|
|
11
|
+
Object.defineProperty(exports, "FormMessage", { enumerable: true, get: function () { return Form_1.FormMessage; } });
|
|
12
|
+
Object.defineProperty(exports, "FormField", { enumerable: true, get: function () { return Form_1.FormField; } });
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Form/index.ts"],"names":[],"mappings":";;;AAAA,+BAAsH;AAA7G,oGAAA,YAAY,OAAA;AAAE,4FAAA,IAAI,OAAA;AAAE,gGAAA,QAAQ,OAAA;AAAE,iGAAA,SAAS,OAAA;AAAE,mGAAA,WAAW,OAAA;AAAE,uGAAA,eAAe,OAAA;AAAE,mGAAA,WAAW,OAAA;AAAE,iGAAA,SAAS,OAAA"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import Select from 'react-select';
|
|
3
|
-
declare const SelectAccountCard: React.ForwardRefExoticComponent<
|
|
4
|
-
className?: string;
|
|
5
|
-
} & React.RefAttributes<Select>>;
|
|
3
|
+
declare const SelectAccountCard: React.ForwardRefExoticComponent<React.RefAttributes<Select>>;
|
|
6
4
|
export { SelectAccountCard };
|
|
@@ -6,7 +6,7 @@ const React = (0, tslib_1.__importStar)(require("react"));
|
|
|
6
6
|
const Icon_1 = require("../Icon");
|
|
7
7
|
const react_select_1 = (0, tslib_1.__importStar)(require("react-select"));
|
|
8
8
|
const utils_1 = require("../@/lib/utils");
|
|
9
|
-
const selectTriggerClasses = 'flex items-center bg-gradient-to-r from-[--cl-blue-3] to-primary shadow-[0px_8px_18px_0px_rgba(73,113,208,0.38)] px-[16px] py-[8px] border-none rounded-md min-h-[80px] text-left text-white';
|
|
9
|
+
const selectTriggerClasses = 'flex items-center bg-gradient-to-r from-[--cl-blue-3] to-primary shadow-[0px_8px_18px_0px_rgba(73,113,208,0.38)] px-[16px] py-[8px] border-none rounded-md min-h-[80px] text-left text-white cursor-pointer';
|
|
10
10
|
const colourStyles = {
|
|
11
11
|
control: () => ({}),
|
|
12
12
|
option: () => ({}),
|
|
@@ -19,8 +19,8 @@ const colourStyles = {
|
|
|
19
19
|
valueContainer: () => ({}),
|
|
20
20
|
};
|
|
21
21
|
const Control = ({ children, ...props }) => {
|
|
22
|
-
const
|
|
23
|
-
return (React.createElement(react_select_1.components.Control, { className: selectTriggerClasses, ...props }, children));
|
|
22
|
+
const { isFocused } = props;
|
|
23
|
+
return (React.createElement(react_select_1.components.Control, { className: (0, utils_1.cn)(selectTriggerClasses, { 'outline outline-primary outline-offset-2 outline-2': isFocused }), ...props }, children));
|
|
24
24
|
};
|
|
25
25
|
const optionClasses = 'flex items-center first:rounded-t-md last:rounded-b-md px-[12px] py-[16px] w-full cursor-default select-none outline-none';
|
|
26
26
|
const Option = ({ children, ...props }) => {
|
|
@@ -33,12 +33,12 @@ const Option = ({ children, ...props }) => {
|
|
|
33
33
|
React.createElement("span", null,
|
|
34
34
|
React.createElement("span", null, label),
|
|
35
35
|
React.createElement("br", null),
|
|
36
|
-
React.createElement("span", { className:
|
|
37
|
-
React.createElement("span", { className:
|
|
36
|
+
React.createElement("span", { className: "text-[14px] text-light" }, account)),
|
|
37
|
+
React.createElement("span", { className: "ml-auto shrink-0" },
|
|
38
38
|
balance,
|
|
39
39
|
"\u00A0",
|
|
40
40
|
cur)),
|
|
41
|
-
React.createElement("span", { className:
|
|
41
|
+
React.createElement("span", { className: "ml-[16px] w-[24px] h-[24px] shrink-0" }, isSelected && (React.createElement(Icon_1.CheckSmall, { width: "24", height: "24", className: "text-primary" })))));
|
|
42
42
|
};
|
|
43
43
|
const DropdownIndicator = ({ children, ...props }) => {
|
|
44
44
|
return (React.createElement(react_select_1.components.DropdownIndicator, { className: "shrink-0", ...props },
|
|
@@ -50,7 +50,7 @@ const ValueContainer = ({ children, ...props }) => {
|
|
|
50
50
|
const SingleValue = ({ children, ...props }) => {
|
|
51
51
|
// @ts-ignore
|
|
52
52
|
const { label, account, balance, cur } = props.data;
|
|
53
|
-
return (React.createElement(react_select_1.components.SingleValue, { className:
|
|
53
|
+
return (React.createElement(react_select_1.components.SingleValue, { className: "col-start-1 col-end-3 row-start-1 row-end-2", ...props },
|
|
54
54
|
React.createElement("span", { className: "block max-w-full text-[16px] truncate leading-[1.5]" },
|
|
55
55
|
label,
|
|
56
56
|
" ",
|
|
@@ -61,9 +61,9 @@ const SingleValue = ({ children, ...props }) => {
|
|
|
61
61
|
cur)));
|
|
62
62
|
};
|
|
63
63
|
const Menu = ({ children, ...props }) => {
|
|
64
|
-
return (React.createElement(react_select_1.components.Menu, { className: "bg-page drop-shadow-1 mt-[8px] rounded-md", ...props }, children));
|
|
64
|
+
return (React.createElement(react_select_1.components.Menu, { className: "absolute inset-x-0 bg-page drop-shadow-1 mt-[8px] rounded-md", ...props }, children));
|
|
65
65
|
};
|
|
66
|
-
const SelectAccountCard = React.forwardRef(({
|
|
66
|
+
const SelectAccountCard = React.forwardRef(({ ...props }, ref) => (React.createElement(react_select_1.default, { isSearchable: false, components: {
|
|
67
67
|
Control,
|
|
68
68
|
Option,
|
|
69
69
|
SingleValue,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectAccountCard.js","sourceRoot":"","sources":["../../src/Select/SelectAccountCard.tsx"],"names":[],"mappings":";;;;AAAA,0DAA8B;AAE9B,kCAAsD;AAEtD,0EASqB;AAErB,0CAAmC;AAEnC,MAAM,oBAAoB,GACzB,
|
|
1
|
+
{"version":3,"file":"Sel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AE,QAAQ,EAAE,GAAG,KAAK,EAAoB,EAAE,EAAE;IAChE,aAAa;IACb,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC,IAAI,CAAA;IACnD,OAAO,CACN,oBAAC,yBAAU,CAAC,WAAW,IACtB,SAAS,EAAC,6CAA6C,KACnD,KAAK;QAET,8BAAM,SAAS,EAAC,qDAAqD;YACnE,KAAK;;YAAE,8BAAM,SAAS,EAAC,uCAAuC,IAAE,OAAO,CAAQ,CAC1E;QACP,8BAAM,SAAS,EAAC,wDAAwD;YACtE,OAAO;;YAAG,GAAG,CACR,CACiB,CACzB,CAAA;AACF,CAAC,CAAA;AAED,MAAM,IAAI,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAa,EAAE,EAAE;IAClD,OAAO,CACN,oBAAC,yBAAU,CAAC,IAAI,IACf,SAAS,EAAC,8DAA8D,KACpE,KAAK,IAER,QAAQ,CACQ,CAClB,CAAA;AACF,CAAC,CAAA;AAED,MAAM,iBAAiB,GAAG,KAAK,CAAC,UAAU,CAAS,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CACzE,oBAAC,sBAAM,IACN,YAAY,EAAE,KAAK,EACnB,UAAU,EAAE;QACX,OAAO;QACP,MAAM;QACN,WAAW;QACX,iBAAiB;QACjB,kBAAkB,EAAE,GAAG,EAAE,CAAC,IAAI;QAC9B,IAAI;QACJ,cAAc;KACd,EACD,MAAM,EAAE,YAAY,EACpB,QAAQ,EAAE,IAAI,KACV,KAAK,GACR,CACF,CAAC,CAAA;AAGO,8CAAiB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -20,4 +20,5 @@ import { Switch } from './Switch';
|
|
|
20
20
|
import { Label } from './Label';
|
|
21
21
|
import { Textarea } from './Textarea';
|
|
22
22
|
import { SelectAccountCard } from './Select';
|
|
23
|
-
|
|
23
|
+
import { Form, FormLabel, FormField, FormItem, FormControl, FormDescription, FormMessage } from './Form';
|
|
24
|
+
export { Tooltip, Tabs, Slider, Popover, Logo, InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator, Collapsible, CollapsibleTrigger, CollapsibleContent, AccountCollapsible, AccountCollapsibleHeader, AccountCollapsibleTrigger, AccountCollapsibleContent, AccountCollapsibleContentItem, Button, InputField, InputLabel, Audio, cn, Icon, Drawer, DrawerTrigger, DrawerTitle, DrawerClose, DrawerContent, BottomNavigation, BottomNavigationList, BottomNavigationListItem, BottomNavigationLink, Page, Chip, Alert, Switch, Label, Textarea, SelectAccountCard, Form, FormLabel, FormField, FormItem, FormControl, FormDescription, FormMessage, };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SelectAccountCard = exports.Textarea = exports.Label = exports.Switch = exports.Alert = exports.Chip = exports.Page = exports.BottomNavigationLink = exports.BottomNavigationListItem = exports.BottomNavigationList = exports.BottomNavigation = exports.DrawerContent = exports.DrawerClose = exports.DrawerTitle = exports.DrawerTrigger = exports.Drawer = exports.Icon = exports.cn = exports.Audio = exports.InputLabel = exports.InputField = exports.Button = exports.AccountCollapsibleContentItem = exports.AccountCollapsibleContent = exports.AccountCollapsibleTrigger = exports.AccountCollapsibleHeader = exports.AccountCollapsible = exports.CollapsibleContent = exports.CollapsibleTrigger = exports.Collapsible = exports.InputOTPSeparator = exports.InputOTPSlot = exports.InputOTPGroup = exports.InputOTP = exports.Logo = exports.Popover = exports.Slider = exports.Tabs = exports.Tooltip = void 0;
|
|
3
|
+
exports.FormMessage = exports.FormDescription = exports.FormControl = exports.FormItem = exports.FormField = exports.FormLabel = exports.Form = exports.SelectAccountCard = exports.Textarea = exports.Label = exports.Switch = exports.Alert = exports.Chip = exports.Page = exports.BottomNavigationLink = exports.BottomNavigationListItem = exports.BottomNavigationList = exports.BottomNavigation = exports.DrawerContent = exports.DrawerClose = exports.DrawerTitle = exports.DrawerTrigger = exports.Drawer = exports.Icon = exports.cn = exports.Audio = exports.InputLabel = exports.InputField = exports.Button = exports.AccountCollapsibleContentItem = exports.AccountCollapsibleContent = exports.AccountCollapsibleTrigger = exports.AccountCollapsibleHeader = exports.AccountCollapsible = exports.CollapsibleContent = exports.CollapsibleTrigger = exports.Collapsible = exports.InputOTPSeparator = exports.InputOTPSlot = exports.InputOTPGroup = exports.InputOTP = exports.Logo = exports.Popover = exports.Slider = exports.Tabs = exports.Tooltip = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const Tooltip_1 = require("./Tooltip");
|
|
6
6
|
Object.defineProperty(exports, "Tooltip", { enumerable: true, get: function () { return Tooltip_1.Tooltip; } });
|
|
@@ -63,4 +63,12 @@ const Textarea_1 = require("./Textarea");
|
|
|
63
63
|
Object.defineProperty(exports, "Textarea", { enumerable: true, get: function () { return Textarea_1.Textarea; } });
|
|
64
64
|
const Select_1 = require("./Select");
|
|
65
65
|
Object.defineProperty(exports, "SelectAccountCard", { enumerable: true, get: function () { return Select_1.SelectAccountCard; } });
|
|
66
|
+
const Form_1 = require("./Form");
|
|
67
|
+
Object.defineProperty(exports, "Form", { enumerable: true, get: function () { return Form_1.Form; } });
|
|
68
|
+
Object.defineProperty(exports, "FormLabel", { enumerable: true, get: function () { return Form_1.FormLabel; } });
|
|
69
|
+
Object.defineProperty(exports, "FormField", { enumerable: true, get: function () { return Form_1.FormField; } });
|
|
70
|
+
Object.defineProperty(exports, "FormItem", { enumerable: true, get: function () { return Form_1.FormItem; } });
|
|
71
|
+
Object.defineProperty(exports, "FormControl", { enumerable: true, get: function () { return Form_1.FormControl; } });
|
|
72
|
+
Object.defineProperty(exports, "FormDescription", { enumerable: true, get: function () { return Form_1.FormDescription; } });
|
|
73
|
+
Object.defineProperty(exports, "FormMessage", { enumerable: true, get: function () { return Form_1.FormMessage; } });
|
|
66
74
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,uCAAmC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,uCAAmC;AAoClC,wFApCQ,iBAAO,OAoCR;AAnCR,iCAA6B;AAoC5B,qFApCQ,WAAI,OAoCR;AAnCL,qCAAiC;AAoChC,uFApCQ,eAAM,OAoCR;AAnCP,uCAAmC;AAoClC,wFApCQ,iBAAO,OAoCR;AAnCR,+DAAyB;AAoCxB,eApCM,cAAI,CAoCN;AAnCL,2CAAsF;AAoCrF,yFApCQ,oBAAQ,OAoCR;AACR,8FArCkB,yBAAa,OAqClB;AACb,6FAtCiC,wBAAY,OAsCjC;AACZ,kGAvC+C,6BAAiB,OAuC/C;AAtClB,yDAK2B;AAqD1B,iGAzDA,mCAAgB,OAyDA;AAChB,qGAzDA,uCAAoB,OAyDA;AACpB,yGAzDA,2CAAwB,OAyDA;AACxB,qGAzDA,uCAAoB,OAyDA;AAvDrB,0DAA8B;AA8C7B,oBAAI;AA7CL,+CAAmF;AAgClF,4FAhCQ,yBAAW,OAgCR;AACX,mGAjCqB,gCAAkB,OAiCrB;AAClB,mGAlCyC,gCAAkB,OAkCzC;AAjCnB,+CAMsB;AA4BrB,mGAjCA,gCAAkB,OAiCA;AAClB,yGAjCA,sCAAwB,OAiCA;AACxB,0GAjCA,uCAAyB,OAiCA;AACzB,0GAjCA,uCAAyB,OAiCA;AACzB,8GAjCA,2CAA6B,OAiCA;AA/B9B,qCAAiC;AAgChC,uFAhCQ,eAAM,OAgCR;AA/BP,mCAA+B;AAkC9B,sFAlCQ,aAAK,OAkCR;AAjCN,yCAAkC;AAkCjC,mFAlCQ,UAAE,OAkCR;AAjCH,qCAAyF;AAmCxF,uFAnCQ,eAAM,OAmCR;AACN,8FApCgB,sBAAa,OAoChB;AACb,4FArC+B,oBAAW,OAqC/B;AACX,4FAtC4C,oBAAW,OAsC5C;AACX,8FAvCyD,sBAAa,OAuCzD;AAtCd,iCAA6B;AA2C5B,qFA3CQ,WAAI,OA2CR;AA1CL,iCAA6B;AA2C5B,qFA3CQ,WAAI,OA2CR;AA1CL,mCAAgD;AA2B/C,2FA3BQ,kBAAU,OA2BR;AACV,2FA5BoB,kBAAU,OA4BpB;AA3BX,mCAA+B;AA0C9B,sFA1CQ,aAAK,OA0CR;AAzCN,qCAAiC;AA0ChC,uFA1CQ,eAAM,OA0CR;AAzCP,mCAA+B;AA0C9B,sFA1CQ,aAAK,OA0CR;AAzCN,yCAAqC;AA0CpC,yFA1CQ,mBAAQ,OA0CR;AAzCT,qCAA4C;AA0C3C,kGA1CQ,0BAAiB,OA0CR;AAzClB,iCAAwG;AA0CvG,qFA1CQ,WAAI,OA0CR;AACJ,0FA3Cc,gBAAS,OA2Cd;AACT,0FA5CyB,gBAAS,OA4CzB;AACT,yFA7CoC,eAAQ,OA6CpC;AACR,4FA9C8C,kBAAW,OA8C9C;AACX,gGA/C2D,sBAAe,OA+C3D;AACf,4FAhD4E,kBAAW,OAgD5E"}
|
package/package.json
CHANGED
package/src/Form/Form.tsx
CHANGED
|
@@ -118,7 +118,7 @@ const FormDescription = React.forwardRef<HTMLParagraphElement, React.HTMLAttribu
|
|
|
118
118
|
<p
|
|
119
119
|
ref={ref}
|
|
120
120
|
id={formDescriptionId}
|
|
121
|
-
className={cn('text-[0.8rem] text-
|
|
121
|
+
className={cn('text-[0.8rem] text-light', className)}
|
|
122
122
|
{...props}
|
|
123
123
|
/>
|
|
124
124
|
)
|
|
@@ -16,7 +16,7 @@ import Select, {
|
|
|
16
16
|
import { cn } from '../@/lib/utils'
|
|
17
17
|
|
|
18
18
|
const selectTriggerClasses: string =
|
|
19
|
-
'flex items-center bg-gradient-to-r from-[--cl-blue-3] to-primary shadow-[0px_8px_18px_0px_rgba(73,113,208,0.38)] px-[16px] py-[8px] border-none rounded-md min-h-[80px] text-left text-white'
|
|
19
|
+
'flex items-center bg-gradient-to-r from-[--cl-blue-3] to-primary shadow-[0px_8px_18px_0px_rgba(73,113,208,0.38)] px-[16px] py-[8px] border-none rounded-md min-h-[80px] text-left text-white cursor-pointer'
|
|
20
20
|
|
|
21
21
|
const colourStyles: StylesConfig = {
|
|
22
22
|
control: () => ({}),
|
|
@@ -31,10 +31,13 @@ const colourStyles: StylesConfig = {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
const Control = ({ children, ...props }: ControlProps) => {
|
|
34
|
-
const
|
|
34
|
+
const { isFocused } = props
|
|
35
35
|
return (
|
|
36
36
|
<components.Control
|
|
37
|
-
className={
|
|
37
|
+
className={cn(
|
|
38
|
+
selectTriggerClasses,
|
|
39
|
+
{ 'outline outline-primary outline-offset-2 outline-2': isFocused }
|
|
40
|
+
)}
|
|
38
41
|
{...props}
|
|
39
42
|
>
|
|
40
43
|
{children}
|
|
@@ -51,29 +54,26 @@ const Option = ({ children, ...props }: OptionProps) => {
|
|
|
51
54
|
isFocused,
|
|
52
55
|
isDisabled,
|
|
53
56
|
// @ts-ignore
|
|
54
|
-
data
|
|
57
|
+
data: { label, account, balance, cur },
|
|
55
58
|
} = props
|
|
56
59
|
const style = { cursor: 'pointer' }
|
|
57
60
|
return (
|
|
58
61
|
<components.Option
|
|
59
|
-
className={cn(
|
|
60
|
-
optionClasses,
|
|
61
|
-
{ 'bg-light': isFocused },
|
|
62
|
-
{ 'opacity-50 pointer-events-none': isDisabled }
|
|
63
|
-
)}
|
|
62
|
+
className={cn(optionClasses, { 'bg-light': isFocused }, { 'opacity-50 pointer-events-none': isDisabled })}
|
|
64
63
|
{...props}
|
|
65
64
|
>
|
|
66
65
|
<span className="flex basis-0 grow">
|
|
67
66
|
<span>
|
|
68
|
-
<span>{label}</span
|
|
69
|
-
<
|
|
67
|
+
<span>{label}</span>
|
|
68
|
+
<br />
|
|
69
|
+
<span className="text-[14px] text-light">{account}</span>
|
|
70
70
|
</span>
|
|
71
|
-
<span
|
|
71
|
+
<span className="ml-auto shrink-0">
|
|
72
72
|
{balance} {cur}
|
|
73
73
|
</span>
|
|
74
74
|
</span>
|
|
75
75
|
|
|
76
|
-
<span className=
|
|
76
|
+
<span className="ml-[16px] w-[24px] h-[24px] shrink-0">
|
|
77
77
|
{isSelected && (
|
|
78
78
|
<CheckSmall
|
|
79
79
|
width="24"
|
|
@@ -82,7 +82,6 @@ const Option = ({ children, ...props }: OptionProps) => {
|
|
|
82
82
|
/>
|
|
83
83
|
)}
|
|
84
84
|
</span>
|
|
85
|
-
|
|
86
85
|
</components.Option>
|
|
87
86
|
)
|
|
88
87
|
}
|
|
@@ -117,7 +116,10 @@ const SingleValue = ({ children, ...props }: SingleValueProps) => {
|
|
|
117
116
|
// @ts-ignore
|
|
118
117
|
const { label, account, balance, cur } = props.data
|
|
119
118
|
return (
|
|
120
|
-
<components.SingleValue
|
|
119
|
+
<components.SingleValue
|
|
120
|
+
className="col-start-1 col-end-3 row-start-1 row-end-2"
|
|
121
|
+
{...props}
|
|
122
|
+
>
|
|
121
123
|
<span className="block max-w-full text-[16px] truncate leading-[1.5]">
|
|
122
124
|
{label} <span className="opacity-75 text-[14px] leading-[1.42]">{account}</span>
|
|
123
125
|
</span>
|
|
@@ -131,7 +133,7 @@ const SingleValue = ({ children, ...props }: SingleValueProps) => {
|
|
|
131
133
|
const Menu = ({ children, ...props }: MenuProps) => {
|
|
132
134
|
return (
|
|
133
135
|
<components.Menu
|
|
134
|
-
className="bg-page drop-shadow-1 mt-[8px] rounded-md"
|
|
136
|
+
className="absolute inset-x-0 bg-page drop-shadow-1 mt-[8px] rounded-md"
|
|
135
137
|
{...props}
|
|
136
138
|
>
|
|
137
139
|
{children}
|
|
@@ -139,11 +141,8 @@ const Menu = ({ children, ...props }: MenuProps) => {
|
|
|
139
141
|
)
|
|
140
142
|
}
|
|
141
143
|
|
|
142
|
-
const SelectAccountCard = React.forwardRef<Select
|
|
144
|
+
const SelectAccountCard = React.forwardRef<Select>(({ ...props }, ref) => (
|
|
143
145
|
<Select
|
|
144
|
-
className={className}
|
|
145
|
-
classNamePrefix="super"
|
|
146
|
-
isDisabled={false}
|
|
147
146
|
isSearchable={false}
|
|
148
147
|
components={{
|
|
149
148
|
Control,
|
|
@@ -160,4 +159,5 @@ const SelectAccountCard = React.forwardRef<Select, { className?: string }>(({ cl
|
|
|
160
159
|
/>
|
|
161
160
|
))
|
|
162
161
|
|
|
162
|
+
|
|
163
163
|
export { SelectAccountCard }
|
package/src/index.ts
CHANGED
|
@@ -31,6 +31,7 @@ import { Switch } from './Switch'
|
|
|
31
31
|
import { Label } from './Label'
|
|
32
32
|
import { Textarea } from './Textarea'
|
|
33
33
|
import { SelectAccountCard } from './Select'
|
|
34
|
+
import { Form, FormLabel, FormField, FormItem, FormControl, FormDescription, FormMessage } from './Form'
|
|
34
35
|
|
|
35
36
|
export {
|
|
36
37
|
Tooltip,
|
|
@@ -72,4 +73,11 @@ export {
|
|
|
72
73
|
Label,
|
|
73
74
|
Textarea,
|
|
74
75
|
SelectAccountCard,
|
|
76
|
+
Form,
|
|
77
|
+
FormLabel,
|
|
78
|
+
FormField,
|
|
79
|
+
FormItem,
|
|
80
|
+
FormControl,
|
|
81
|
+
FormDescription,
|
|
82
|
+
FormMessage,
|
|
75
83
|
}
|