@ourtrip/ui 1.0.0
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/components/accordion.js +19 -0
- package/dist/components/alert.js +36 -0
- package/dist/components/badge.js +47 -0
- package/dist/components/breadcrumbs.js +22 -0
- package/dist/components/button.js +155 -0
- package/dist/components/card.js +29 -0
- package/dist/components/checkbox.js +24 -0
- package/dist/components/collapse.js +16 -0
- package/dist/components/divider.js +38 -0
- package/dist/components/input.js +58 -0
- package/dist/components/modal.js +10 -0
- package/dist/components/phone.js +53 -0
- package/dist/components/popover.js +35 -0
- package/dist/components/radio.js +38 -0
- package/dist/components/range.js +19 -0
- package/dist/components/select.js +84 -0
- package/dist/components/sheet.js +82 -0
- package/dist/components/stars.js +10 -0
- package/dist/components/step-marker.js +18 -0
- package/dist/components/switch.js +15 -0
- package/dist/components/tag.js +16 -0
- package/dist/components/tooltip.js +9 -0
- package/dist/index.js +22 -0
- package/dist/types/components/accordion.d.ts +7 -0
- package/dist/types/components/alert.d.ts +10 -0
- package/dist/types/components/badge.d.ts +12 -0
- package/dist/types/components/breadcrumbs.d.ts +11 -0
- package/dist/types/components/button.d.ts +19 -0
- package/dist/types/components/card.d.ts +6 -0
- package/dist/types/components/checkbox.d.ts +11 -0
- package/dist/types/components/collapse.d.ts +15 -0
- package/dist/types/components/divider.d.ts +8 -0
- package/dist/types/components/input.d.ts +14 -0
- package/dist/types/components/modal.d.ts +10 -0
- package/dist/types/components/phone.d.ts +18 -0
- package/dist/types/components/popover.d.ts +6 -0
- package/dist/types/components/radio.d.ts +8 -0
- package/dist/types/components/range.d.ts +10 -0
- package/dist/types/components/select.d.ts +13 -0
- package/dist/types/components/sheet.d.ts +25 -0
- package/dist/types/components/stars.d.ts +6 -0
- package/dist/types/components/step-marker.d.ts +11 -0
- package/dist/types/components/switch.d.ts +9 -0
- package/dist/types/components/tag.d.ts +11 -0
- package/dist/types/components/tooltip.d.ts +8 -0
- package/dist/types/index.d.ts +22 -0
- package/dist/types/utils/classes.d.ts +1 -0
- package/dist/types/utils/validation.d.ts +12 -0
- package/dist/utils/classes.js +7 -0
- package/dist/utils/validation.js +128 -0
- package/ourtrip-ui-1.0.0.tgz +0 -0
- package/package.json +47 -0
- package/src/components/accordion.tsx +52 -0
- package/src/components/alert.tsx +56 -0
- package/src/components/badge.tsx +84 -0
- package/src/components/breadcrumbs.tsx +48 -0
- package/src/components/button.tsx +187 -0
- package/src/components/card.tsx +23 -0
- package/src/components/checkbox.tsx +70 -0
- package/src/components/collapse.tsx +56 -0
- package/src/components/divider.tsx +28 -0
- package/src/components/input.tsx +105 -0
- package/src/components/modal.tsx +40 -0
- package/src/components/phone.tsx +104 -0
- package/src/components/popover.tsx +31 -0
- package/src/components/radio.tsx +44 -0
- package/src/components/range.tsx +54 -0
- package/src/components/select.tsx +160 -0
- package/src/components/sheet.tsx +140 -0
- package/src/components/stars.tsx +30 -0
- package/src/components/step-marker.tsx +49 -0
- package/src/components/switch.tsx +42 -0
- package/src/components/tag.tsx +52 -0
- package/src/components/tooltip.tsx +30 -0
- package/src/index.tsx +22 -0
- package/src/utils/classes.ts +2 -0
- package/src/utils/validation.ts +164 -0
- package/tsconfig.json +19 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
import * as React from 'react';
|
|
25
|
+
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
26
|
+
import { Check, CaretDown, CaretUp } from '@phosphor-icons/react';
|
|
27
|
+
import { cn } from '../utils/classes';
|
|
28
|
+
var Select = SelectPrimitive.Root;
|
|
29
|
+
var SelectGroup = SelectPrimitive.Group;
|
|
30
|
+
var SelectValue = SelectPrimitive.Value;
|
|
31
|
+
var SelectTrigger = React.forwardRef(function (_a, ref) {
|
|
32
|
+
var className = _a.className, children = _a.children, props = __rest(_a, ["className", "children"]);
|
|
33
|
+
return (React.createElement(SelectPrimitive.Trigger, __assign({ ref: ref, className: cn('flex h-[50px] w-full items-center justify-between rounded-button bg-gray-100 px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-hidden disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1', className) }, props),
|
|
34
|
+
children,
|
|
35
|
+
React.createElement(SelectPrimitive.Icon, { asChild: true },
|
|
36
|
+
React.createElement(CaretDown, { className: 'h-4 w-4 opacity-50' }))));
|
|
37
|
+
});
|
|
38
|
+
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
39
|
+
var SelectScrollUpButton = React.forwardRef(function (_a, ref) {
|
|
40
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
41
|
+
return (React.createElement(SelectPrimitive.ScrollUpButton, __assign({ ref: ref, className: cn('flex cursor-default items-center justify-center py-1', className) }, props),
|
|
42
|
+
React.createElement(CaretUp, { className: 'h-4 w-4' })));
|
|
43
|
+
});
|
|
44
|
+
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
45
|
+
var SelectScrollDownButton = React.forwardRef(function (_a, ref) {
|
|
46
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
47
|
+
return (React.createElement(SelectPrimitive.ScrollDownButton, __assign({ ref: ref, className: cn('flex cursor-default items-center justify-center py-1', className) }, props),
|
|
48
|
+
React.createElement(CaretDown, { className: 'h-4 w-4' })));
|
|
49
|
+
});
|
|
50
|
+
SelectScrollDownButton.displayName =
|
|
51
|
+
SelectPrimitive.ScrollDownButton.displayName;
|
|
52
|
+
var SelectContent = React.forwardRef(function (_a, ref) {
|
|
53
|
+
var className = _a.className, children = _a.children, _b = _a.position, position = _b === void 0 ? 'popper' : _b, props = __rest(_a, ["className", "children", "position"]);
|
|
54
|
+
return (React.createElement(SelectPrimitive.Portal, null,
|
|
55
|
+
React.createElement(SelectPrimitive.Content, __assign({ ref: ref, className: cn('relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-button bg-white text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2', position === 'popper'
|
|
56
|
+
? 'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1'
|
|
57
|
+
: '', className), position: position }, props),
|
|
58
|
+
React.createElement(SelectScrollUpButton, null),
|
|
59
|
+
React.createElement(SelectPrimitive.Viewport, { className: cn('p-1', position === 'popper'
|
|
60
|
+
? 'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]'
|
|
61
|
+
: '') }, children),
|
|
62
|
+
React.createElement(SelectScrollDownButton, null))));
|
|
63
|
+
});
|
|
64
|
+
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
65
|
+
var SelectLabel = React.forwardRef(function (_a, ref) {
|
|
66
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
67
|
+
return (React.createElement(SelectPrimitive.Label, __assign({ ref: ref, className: cn('py-1.5 pl-8 pr-2 text-sm font-semibold', className) }, props)));
|
|
68
|
+
});
|
|
69
|
+
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
70
|
+
var SelectItem = React.forwardRef(function (_a, ref) {
|
|
71
|
+
var className = _a.className, children = _a.children, props = __rest(_a, ["className", "children"]);
|
|
72
|
+
return (React.createElement(SelectPrimitive.Item, __assign({ ref: ref, className: cn('relative flex w-full cursor-default select-none items-center rounded-xs py-1.5 pl-8 pr-2 text-sm outline-hidden focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50', className) }, props),
|
|
73
|
+
React.createElement("span", { className: 'absolute left-2 flex h-3.5 w-3.5 items-center justify-center' },
|
|
74
|
+
React.createElement(SelectPrimitive.ItemIndicator, null,
|
|
75
|
+
React.createElement(Check, { className: 'h-4 w-4' }))),
|
|
76
|
+
React.createElement(SelectPrimitive.ItemText, null, children)));
|
|
77
|
+
});
|
|
78
|
+
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
79
|
+
var SelectSeparator = React.forwardRef(function (_a, ref) {
|
|
80
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
81
|
+
return (React.createElement(SelectPrimitive.Separator, __assign({ ref: ref, className: cn('-mx-1 my-1 h-px bg-muted', className) }, props)));
|
|
82
|
+
});
|
|
83
|
+
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
84
|
+
export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, SelectScrollUpButton, SelectScrollDownButton };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
import * as React from 'react';
|
|
25
|
+
import * as SheetPrimitive from '@radix-ui/react-dialog';
|
|
26
|
+
import { cva } from 'class-variance-authority';
|
|
27
|
+
import { X } from '@phosphor-icons/react';
|
|
28
|
+
import cn from 'classnames';
|
|
29
|
+
var Sheet = SheetPrimitive.Root;
|
|
30
|
+
var SheetTrigger = SheetPrimitive.Trigger;
|
|
31
|
+
var SheetClose = SheetPrimitive.Close;
|
|
32
|
+
var SheetPortal = SheetPrimitive.Portal;
|
|
33
|
+
var SheetOverlay = React.forwardRef(function (_a, ref) {
|
|
34
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
35
|
+
return (React.createElement(SheetPrimitive.Overlay, __assign({ className: cn('fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=open]:fade-in-0', className) }, props, { ref: ref })));
|
|
36
|
+
});
|
|
37
|
+
SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;
|
|
38
|
+
var sheetVariants = cva('fixed z-50 gap-4 bg-white p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=open]:duration-500', {
|
|
39
|
+
variants: {
|
|
40
|
+
side: {
|
|
41
|
+
top: 'inset-x-0 top-0 border-b data-[state=open]:slide-in-from-top',
|
|
42
|
+
bottom: 'inset-x-0 bottom-0 border-t data-[state=open]:slide-in-from-bottom',
|
|
43
|
+
left: 'inset-y-0 left-0 h-full w-3/4 border-r data-[state=open]:slide-in-from-left sm:max-w-sm',
|
|
44
|
+
right: 'inset-y-0 right-0 h-full w-3/4 border-l data-[state=open]:slide-in-from-right sm:max-w-sm'
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
defaultVariants: {
|
|
48
|
+
side: 'right'
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
var SheetContent = React.forwardRef(function (_a, ref) {
|
|
52
|
+
var _b = _a.side, side = _b === void 0 ? 'right' : _b, className = _a.className, children = _a.children, props = __rest(_a, ["side", "className", "children"]);
|
|
53
|
+
return (React.createElement(SheetPortal, null,
|
|
54
|
+
React.createElement(SheetOverlay, null),
|
|
55
|
+
React.createElement(SheetPrimitive.Content, __assign({ ref: ref, className: cn(sheetVariants({ side: side }), className) }, props),
|
|
56
|
+
children,
|
|
57
|
+
React.createElement(SheetPrimitive.Close, { className: 'absolute right-4 top-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary' },
|
|
58
|
+
React.createElement(X, { className: 'h-4 w-4' }),
|
|
59
|
+
React.createElement("span", { className: 'sr-only' }, "Close")))));
|
|
60
|
+
});
|
|
61
|
+
SheetContent.displayName = SheetPrimitive.Content.displayName;
|
|
62
|
+
var SheetHeader = function (_a) {
|
|
63
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
64
|
+
return (React.createElement("div", __assign({ className: cn('flex flex-col space-y-2 text-center sm:text-left', className) }, props)));
|
|
65
|
+
};
|
|
66
|
+
SheetHeader.displayName = 'SheetHeader';
|
|
67
|
+
var SheetFooter = function (_a) {
|
|
68
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
69
|
+
return (React.createElement("div", __assign({ className: cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className) }, props)));
|
|
70
|
+
};
|
|
71
|
+
SheetFooter.displayName = 'SheetFooter';
|
|
72
|
+
var SheetTitle = React.forwardRef(function (_a, ref) {
|
|
73
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
74
|
+
return (React.createElement(SheetPrimitive.Title, __assign({ ref: ref, className: cn('text-lg font-semibold text-foreground', className) }, props)));
|
|
75
|
+
});
|
|
76
|
+
SheetTitle.displayName = SheetPrimitive.Title.displayName;
|
|
77
|
+
var SheetDescription = React.forwardRef(function (_a, ref) {
|
|
78
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
79
|
+
return (React.createElement(SheetPrimitive.Description, __assign({ ref: ref, className: cn('text-sm text-muted-foreground', className) }, props)));
|
|
80
|
+
});
|
|
81
|
+
SheetDescription.displayName = SheetPrimitive.Description.displayName;
|
|
82
|
+
export { Sheet, SheetPortal, SheetOverlay, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Star } from '@phosphor-icons/react';
|
|
4
|
+
var Stars = function (_a) {
|
|
5
|
+
var rate = _a.rate;
|
|
6
|
+
return (React.createElement("div", { className: 'flex items-center gap-0.5' },
|
|
7
|
+
Array.from({ length: 5 }).map(function (_, index) { return (React.createElement(Star, { key: "".concat(rate).concat(index), weight: rate > index ? 'fill' : 'light', className: "text-yellow-300 ".concat(rate > index ? 'text-yellow-300' : '', " ").concat(index > 0 ? 'hidden md:block' : ''), size: 12 })); }),
|
|
8
|
+
React.createElement("p", { className: 'text-sm text-primary-900 font-medium block md:hidden' }, rate)));
|
|
9
|
+
};
|
|
10
|
+
export default Stars;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Check } from '@phosphor-icons/react';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
var StepMarker = function (_a) {
|
|
6
|
+
var step = _a.step, title = _a.title, subtitle = _a.subtitle, checked = _a.checked, active = _a.active, onClick = _a.onClick;
|
|
7
|
+
var classes = classNames('w-full md:w-12 h-12 flex-none rounded-default flex justify-center items-center font-medium', {
|
|
8
|
+
'bg-green-500 text-white': checked,
|
|
9
|
+
'bg-white text-gray-500': !checked,
|
|
10
|
+
'border-2 bg-gray-100 border-primary-500': active
|
|
11
|
+
});
|
|
12
|
+
return (React.createElement("div", { className: 'w-full flex flex-col items-center text-center gap-3 md:flex-row md:items-center md:text-left', onClick: onClick },
|
|
13
|
+
React.createElement("div", { className: classes }, checked ? React.createElement(Check, { size: 22 }) : step),
|
|
14
|
+
React.createElement("div", null,
|
|
15
|
+
React.createElement("h3", { className: 'text-sm md:text-base whitespace-nowrap' }, title),
|
|
16
|
+
subtitle && (React.createElement("p", { className: 'text-sm text-gray-500 whitespace-nowrap' }, subtitle)))));
|
|
17
|
+
};
|
|
18
|
+
export default StepMarker;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { motion } from 'framer-motion';
|
|
4
|
+
var spring = {
|
|
5
|
+
type: 'spring',
|
|
6
|
+
stiffness: 700,
|
|
7
|
+
damping: 30
|
|
8
|
+
};
|
|
9
|
+
var Switch = function (_a) {
|
|
10
|
+
var on = _a.on, onChange = _a.onChange, disabled = _a.disabled, label = _a.label;
|
|
11
|
+
return (React.createElement("button", { className: 'flex flex-row items-center cursor-pointer select-none border-none bg-transparent', disabled: disabled, onClick: function () { return onChange === null || onChange === void 0 ? void 0 : onChange(!on); }, "aria-label": label },
|
|
12
|
+
React.createElement("div", { className: "w-[35px] h-[20px] flex flex-row items-center p-[5px] rounded-[50px] transition-colors duration-200 ".concat(on ? 'bg-primary-500 justify-end' : 'bg-gray-200 justify-start') },
|
|
13
|
+
React.createElement(motion.div, { className: "w-[10px] h-[10px] rounded-full ".concat(on ? 'bg-white' : 'bg-gray-500'), transition: spring }))));
|
|
14
|
+
};
|
|
15
|
+
export default Switch;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
var Tag = function (_a) {
|
|
4
|
+
var color = _a.color, children = _a.children, onClick = _a.onClick, iconLeft = _a.iconLeft, iconRight = _a.iconRight;
|
|
5
|
+
var baseClasses = 'rounded-button px-4 py-2 flex items-center justify-between border-0 cursor-pointer transition-all duration-300 ease-in-out font-medium';
|
|
6
|
+
var colorClasses = {
|
|
7
|
+
primary: 'text-primary-900 bg-white hover:bg-gray-200',
|
|
8
|
+
secondary: 'text-secondary-800 bg-secondary-100 hover:text-white hover:bg-secondary-800',
|
|
9
|
+
white: 'text-primary-900 bg-white hover:bg-gray-200'
|
|
10
|
+
};
|
|
11
|
+
return (React.createElement("button", { onClick: function () { return onClick === null || onClick === void 0 ? void 0 : onClick(); }, className: "".concat(baseClasses, " ").concat(colorClasses[color]) },
|
|
12
|
+
iconLeft && (React.createElement("span", { className: 'flex items-center justify-center mr-2' }, iconLeft)),
|
|
13
|
+
children,
|
|
14
|
+
iconRight && (React.createElement("span", { className: 'flex items-center justify-center ml-2' }, iconRight))));
|
|
15
|
+
};
|
|
16
|
+
export default Tag;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
var Tooltip = function (_a) {
|
|
4
|
+
var text = _a.text, active = _a.active, children = _a.children;
|
|
5
|
+
return (React.createElement("div", { className: 'relative flex flex-col justify-center items-center group' },
|
|
6
|
+
React.createElement("div", { className: 'w-full' }, children),
|
|
7
|
+
React.createElement("div", { className: "\n absolute top-[calc(100%+8px)] p-[5px_10px] text-white bg-primary-900\n text-[14px] rounded-[8px] flex-col items-center gap-[5px] transition-all\n ".concat(active ? 'group-hover:flex' : 'hidden', "\n before:content-[''] before:absolute before:w-2 before:h-2 before:bg-primary-900\n before:rotate-45 before:top-[-4px]\n ") }, text)));
|
|
8
|
+
};
|
|
9
|
+
export default Tooltip;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { default as Accordion } from './components/accordion';
|
|
2
|
+
export { default as Alert } from './components/alert';
|
|
3
|
+
export { default as Badge } from './components/badge';
|
|
4
|
+
export { default as Breadcrumbs } from './components/breadcrumbs';
|
|
5
|
+
export { default as Button } from './components/button';
|
|
6
|
+
export { default as Card } from './components/card';
|
|
7
|
+
export { default as Checkbox } from './components/checkbox';
|
|
8
|
+
export { default as Collapse } from './components/collapse';
|
|
9
|
+
export { default as Divider } from './components/divider';
|
|
10
|
+
export { default as Input } from './components/input';
|
|
11
|
+
export { default as Modal } from './components/modal';
|
|
12
|
+
export { default as PhoneInput } from './components/phone';
|
|
13
|
+
export { Popover, PopoverContent, PopoverTrigger } from './components/popover';
|
|
14
|
+
export { default as Radio } from './components/radio';
|
|
15
|
+
export { default as Range } from './components/range';
|
|
16
|
+
export { Select, SelectContent, SelectTrigger } from './components/select';
|
|
17
|
+
export { Sheet, SheetContent, SheetTrigger } from './components/sheet';
|
|
18
|
+
export { default as Stars } from './components/stars';
|
|
19
|
+
export { default as StepMarker } from './components/step-marker';
|
|
20
|
+
export { default as Switch } from './components/switch';
|
|
21
|
+
export { default as Tag } from './components/tag';
|
|
22
|
+
export { default as Tooltip } from './components/tooltip';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
type TAlertType = 'info' | 'success' | 'danger' | 'warning';
|
|
3
|
+
type TAlertVariant = 'fill' | 'outline';
|
|
4
|
+
interface IAlertProps {
|
|
5
|
+
type: TAlertType;
|
|
6
|
+
variant: TAlertVariant;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
declare const Alert: FC<IAlertProps>;
|
|
10
|
+
export default Alert;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
type BadgeSize = 'small' | 'normal' | 'large';
|
|
3
|
+
interface IBadgeProps {
|
|
4
|
+
icon?: ReactNode;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
type: 'success' | 'warning' | 'danger' | 'info' | 'white' | 'primary' | 'secondary';
|
|
7
|
+
size?: BadgeSize;
|
|
8
|
+
mobile?: boolean;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
declare const Badge: FC<IBadgeProps>;
|
|
12
|
+
export default Badge;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type BreadcrumbsItemType = {
|
|
3
|
+
id: string;
|
|
4
|
+
text: string;
|
|
5
|
+
href: string;
|
|
6
|
+
};
|
|
7
|
+
interface IBreadcrumbsProps {
|
|
8
|
+
items: BreadcrumbsItemType[];
|
|
9
|
+
}
|
|
10
|
+
declare const Breadcrumbs: ({ items }: IBreadcrumbsProps) => React.JSX.Element;
|
|
11
|
+
export default Breadcrumbs;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
3
|
+
declare const buttonVariants: (props?: ({
|
|
4
|
+
variant?: "fill" | "outline" | null | undefined;
|
|
5
|
+
color?: "danger" | "white" | "primary" | "secondary" | "gray" | null | undefined;
|
|
6
|
+
size?: "small" | "normal" | "large" | "icon" | null | undefined;
|
|
7
|
+
shape?: "default" | "rounded" | null | undefined;
|
|
8
|
+
fontWeight?: "bold" | "normal" | null | undefined;
|
|
9
|
+
fullWidth?: boolean | null | undefined;
|
|
10
|
+
fullHeight?: boolean | null | undefined;
|
|
11
|
+
disabled?: boolean | null | undefined;
|
|
12
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
13
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
color?: 'primary' | 'secondary' | 'danger' | 'gray' | 'white';
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
}
|
|
18
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
19
|
+
export default Button;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
interface ICheckbox {
|
|
3
|
+
value?: boolean;
|
|
4
|
+
onChange?: (checked: boolean) => void;
|
|
5
|
+
label?: ReactNode;
|
|
6
|
+
trailing?: string | number;
|
|
7
|
+
textColor?: 'primary';
|
|
8
|
+
type?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const _default: React.MemoExoticComponent<({ value, onChange, label, trailing, textColor, type }: ICheckbox) => React.JSX.Element>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
type TToggleType = 'bottom' | 'right';
|
|
3
|
+
type IToggleTextType = {
|
|
4
|
+
open: string;
|
|
5
|
+
close: string;
|
|
6
|
+
};
|
|
7
|
+
interface ICollapseProps {
|
|
8
|
+
title: string;
|
|
9
|
+
content: ReactNode;
|
|
10
|
+
showPreview?: boolean;
|
|
11
|
+
toggleText?: IToggleTextType;
|
|
12
|
+
togglePosition?: TToggleType;
|
|
13
|
+
}
|
|
14
|
+
declare const Collapse: FC<ICollapseProps>;
|
|
15
|
+
export default Collapse;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React, { HTMLAttributes } from 'react';
|
|
2
|
+
interface IDivider extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
orientation?: 'horizontal' | 'vertical';
|
|
4
|
+
fullHeight?: boolean;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
declare const Divider: ({ orientation, fullHeight, className, ...props }: IDivider) => React.JSX.Element;
|
|
8
|
+
export default Divider;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { DetailedHTMLProps, InputHTMLAttributes } from 'react';
|
|
2
|
+
interface IInput extends DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> {
|
|
3
|
+
label?: string;
|
|
4
|
+
dense?: boolean;
|
|
5
|
+
floating?: boolean;
|
|
6
|
+
border?: boolean;
|
|
7
|
+
color?: 'white' | 'gray';
|
|
8
|
+
error?: string;
|
|
9
|
+
focus?: Function;
|
|
10
|
+
mask?: Function;
|
|
11
|
+
hasInitialValue?: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare const Input: React.ForwardRefExoticComponent<Omit<IInput, "ref"> & React.RefAttributes<unknown>>;
|
|
14
|
+
export default Input;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FieldErrors, FieldValues, Path, UseFormSetFocus } from 'react-hook-form';
|
|
3
|
+
interface IPhoneInputProps<T extends FieldValues> {
|
|
4
|
+
t: any;
|
|
5
|
+
DDI?: string;
|
|
6
|
+
phoneDDIKey: Path<T>;
|
|
7
|
+
phoneAreaCodeKey: Path<T>;
|
|
8
|
+
phoneNumberKey: Path<T>;
|
|
9
|
+
registerWithMask: any;
|
|
10
|
+
setFocus: UseFormSetFocus<T>;
|
|
11
|
+
errors: FieldErrors<T>;
|
|
12
|
+
ddiClassName?: string;
|
|
13
|
+
areaCodeClassName?: string;
|
|
14
|
+
phoneClassName?: string;
|
|
15
|
+
requiredMessage?: string;
|
|
16
|
+
}
|
|
17
|
+
declare const PhoneInput: <T extends FieldValues>({ t, DDI, phoneDDIKey, phoneAreaCodeKey, phoneNumberKey, registerWithMask, setFocus, errors, ddiClassName, areaCodeClassName, phoneClassName, requiredMessage }: IPhoneInputProps<T>) => React.JSX.Element;
|
|
18
|
+
export default PhoneInput;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
3
|
+
declare const Popover: React.FC<PopoverPrimitive.PopoverProps>;
|
|
4
|
+
declare const PopoverTrigger: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
declare const PopoverContent: React.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
export { Popover, PopoverTrigger, PopoverContent };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React, { InputHTMLAttributes } from 'react';
|
|
2
|
+
type RadioSize = 'small' | 'normal' | 'large';
|
|
3
|
+
interface IRadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
4
|
+
label: string;
|
|
5
|
+
size?: RadioSize;
|
|
6
|
+
}
|
|
7
|
+
declare const Radio: React.ForwardRefExoticComponent<IRadioProps & React.RefAttributes<unknown>>;
|
|
8
|
+
export default Radio;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface IRange {
|
|
3
|
+
initialValues?: number[];
|
|
4
|
+
min?: number;
|
|
5
|
+
max?: number;
|
|
6
|
+
onChange?: (value: number[]) => void;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: React.MemoExoticComponent<({ min, max, onChange, disabled, initialValues }: IRange) => React.JSX.Element>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
3
|
+
declare const Select: React.FC<SelectPrimitive.SelectProps>;
|
|
4
|
+
declare const SelectGroup: React.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
declare const SelectValue: React.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
|
|
6
|
+
declare const SelectTrigger: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
7
|
+
declare const SelectScrollUpButton: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollUpButtonProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
declare const SelectScrollDownButton: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollDownButtonProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
declare const SelectContent: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
declare const SelectLabel: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectLabelProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
declare const SelectItem: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
declare const SelectSeparator: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, SelectScrollUpButton, SelectScrollDownButton };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as SheetPrimitive from '@radix-ui/react-dialog';
|
|
3
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
4
|
+
declare const Sheet: React.FC<SheetPrimitive.DialogProps>;
|
|
5
|
+
declare const SheetTrigger: React.ForwardRefExoticComponent<SheetPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
declare const SheetClose: React.ForwardRefExoticComponent<SheetPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
7
|
+
declare const SheetPortal: React.FC<SheetPrimitive.DialogPortalProps>;
|
|
8
|
+
declare const SheetOverlay: React.ForwardRefExoticComponent<Omit<SheetPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
declare const sheetVariants: (props?: ({
|
|
10
|
+
side?: "bottom" | "right" | "top" | "left" | null | undefined;
|
|
11
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
12
|
+
interface SheetContentProps extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>, VariantProps<typeof sheetVariants> {
|
|
13
|
+
}
|
|
14
|
+
declare const SheetContent: React.ForwardRefExoticComponent<SheetContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
declare const SheetHeader: {
|
|
16
|
+
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
17
|
+
displayName: string;
|
|
18
|
+
};
|
|
19
|
+
declare const SheetFooter: {
|
|
20
|
+
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
21
|
+
displayName: string;
|
|
22
|
+
};
|
|
23
|
+
declare const SheetTitle: React.ForwardRefExoticComponent<Omit<SheetPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
24
|
+
declare const SheetDescription: React.ForwardRefExoticComponent<Omit<SheetPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
25
|
+
export { Sheet, SheetPortal, SheetOverlay, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
export type TagColor = 'primary' | 'secondary' | 'white';
|
|
3
|
+
interface ITagProps {
|
|
4
|
+
color: TagColor;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
onClick?: () => void;
|
|
7
|
+
iconLeft?: ReactNode;
|
|
8
|
+
iconRight?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
declare const Tag: FC<ITagProps>;
|
|
11
|
+
export default Tag;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { default as Accordion } from './components/accordion';
|
|
2
|
+
export { default as Alert } from './components/alert';
|
|
3
|
+
export { default as Badge } from './components/badge';
|
|
4
|
+
export { default as Breadcrumbs } from './components/breadcrumbs';
|
|
5
|
+
export { default as Button } from './components/button';
|
|
6
|
+
export { default as Card } from './components/card';
|
|
7
|
+
export { default as Checkbox } from './components/checkbox';
|
|
8
|
+
export { default as Collapse } from './components/collapse';
|
|
9
|
+
export { default as Divider } from './components/divider';
|
|
10
|
+
export { default as Input } from './components/input';
|
|
11
|
+
export { default as Modal } from './components/modal';
|
|
12
|
+
export { default as PhoneInput } from './components/phone';
|
|
13
|
+
export { Popover, PopoverContent, PopoverTrigger } from './components/popover';
|
|
14
|
+
export { default as Radio } from './components/radio';
|
|
15
|
+
export { default as Range } from './components/range';
|
|
16
|
+
export { Select, SelectContent, SelectTrigger } from './components/select';
|
|
17
|
+
export { Sheet, SheetContent, SheetTrigger } from './components/sheet';
|
|
18
|
+
export { default as Stars } from './components/stars';
|
|
19
|
+
export { default as StepMarker } from './components/step-marker';
|
|
20
|
+
export { default as Switch } from './components/switch';
|
|
21
|
+
export { default as Tag } from './components/tag';
|
|
22
|
+
export { default as Tooltip } from './components/tooltip';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const cn: (...args: (string | undefined)[]) => string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const isValidCpf: (formatedCpf: string) => boolean;
|
|
2
|
+
export declare const isValidCNPJ: (formatedCnpj: string) => boolean;
|
|
3
|
+
export declare const isCPF: (document: string) => boolean;
|
|
4
|
+
export declare const isCNPJ: (document: string) => boolean;
|
|
5
|
+
export declare const isFullName: (name: string) => boolean;
|
|
6
|
+
export declare const isValidName: (name: string) => boolean;
|
|
7
|
+
export declare const isValidEmail: (email: string) => boolean;
|
|
8
|
+
export declare const isValidPhoneNumber: (number: string) => boolean;
|
|
9
|
+
export declare const isValidNumberCode: (numberCode: string) => boolean;
|
|
10
|
+
export declare const isValidDDD: (areaCode: string) => boolean;
|
|
11
|
+
export declare const isValidChildDate: (date?: string) => true | "Data inválida" | "Idade deve ser entre 1 a 17 anos";
|
|
12
|
+
export declare const isValidAdult: (date?: string) => true | "Data inválida" | "Adulto deve ter mais de 18 anos";
|