@modul/mbui 0.0.13-beta-pv-53036-7c290859 → 0.0.13-beta-pv-53036-7e3c29c2
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/Calendar/Calendar.js +30 -28
- package/dist/Calendar/Calendar.js.map +1 -1
- package/dist/DatePicker/DatePicker.d.ts +9 -0
- package/dist/DatePicker/DatePicker.js +23 -0
- package/dist/DatePicker/DatePicker.js.map +1 -0
- package/dist/DatePicker/index.d.ts +1 -0
- package/dist/DatePicker/index.js +6 -0
- package/dist/DatePicker/index.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/Calendar/Calendar.tsx +40 -38
- package/src/DatePicker/DatePicker.tsx +38 -0
- package/src/DatePicker/index.ts +1 -0
- package/src/Select/Select.tsx +0 -0
- package/src/index.ts +2 -2
- package/src/Datepicker/Datepicker.tsx +0 -41
- package/src/Datepicker/index.ts +0 -1
|
@@ -5,37 +5,39 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const React = (0, tslib_1.__importStar)(require("react"));
|
|
6
6
|
const react_day_picker_1 = require("react-day-picker");
|
|
7
7
|
const utils_1 = require("../@/lib/utils");
|
|
8
|
-
const
|
|
8
|
+
const locale_1 = require("date-fns/locale");
|
|
9
|
+
const daySelectedClasses = 'bg-btn-primary text-btn-primary rounded-sm';
|
|
10
|
+
const dayTodayClasses = 'bg-btn-secondary text-btn-secondary rounded-sm';
|
|
11
|
+
const rangeMiddleClasses = 'date-range-middle aria-selected:bg-btn-primary/50 aria-selected:text-white';
|
|
12
|
+
const btnNavClasses = 'opacity-50 hover:opacity-100 ring-offset-2 focus-visible:opacity-100 focus-visible:outline-primary border-input border rounded-sm shadow-sm';
|
|
9
13
|
function Calendar({ className, classNames, showOutsideDays = true, ...props }) {
|
|
10
|
-
return (React.createElement(react_day_picker_1.DayPicker, { showOutsideDays: showOutsideDays, className: (0, utils_1.cn)('
|
|
11
|
-
months: '
|
|
12
|
-
month: 'space-y-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
? '[&:has(>.day-range-end)]:rounded-r-
|
|
25
|
-
: '[&:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
day_hidden: 'invisible',
|
|
14
|
+
return (React.createElement(react_day_picker_1.DayPicker, { locale: locale_1.ru, showOutsideDays: showOutsideDays, className: (0, utils_1.cn)('inline-flex', className), classNames: {
|
|
15
|
+
months: 'relative',
|
|
16
|
+
month: 'flex flex-col space-y-[16px] items-center',
|
|
17
|
+
month_grid: 'w-full border-collapse',
|
|
18
|
+
month_caption: 'inline m-x-auto',
|
|
19
|
+
caption_label: 'text-sm font-medium capitalize',
|
|
20
|
+
nav: 'flex justify-between absolute start-0 end-0',
|
|
21
|
+
button_previous: btnNavClasses,
|
|
22
|
+
button_next: btnNavClasses,
|
|
23
|
+
weekdays: 'flex',
|
|
24
|
+
weekday: 'text-light w-[32px] font-normal text-[14px]',
|
|
25
|
+
week: 'flex w-full mt-2',
|
|
26
|
+
day_button: 'w-[32px] h-[32px] p-0',
|
|
27
|
+
day: (0, utils_1.cn)('aria-selected:opacity-100 text-[14px] leading-[1]', props.mode === 'range'
|
|
28
|
+
? '[&:(.day-range-middle)]:rounded-0 [&:has(>.day-range-end)]:rounded-r-sm [&:has(>.day-range-start)]:rounded-l-sm first:[&:has([aria-selected])]:rounded-l-sm last:[&:has([aria-selected])]:rounded-r-sm'
|
|
29
|
+
: '[&:([aria-selected])]:rounded-sm'),
|
|
30
|
+
range_start: 'day-range-start',
|
|
31
|
+
range_end: 'day-range-end',
|
|
32
|
+
range_middle: rangeMiddleClasses,
|
|
33
|
+
selected: daySelectedClasses,
|
|
34
|
+
today: dayTodayClasses,
|
|
35
|
+
outside: 'day-outside opacity-50 aria-selected:bg-primary aria-selected:text-[white] aria-selected:opacity-30',
|
|
36
|
+
disabled: 'text-light opacity-50',
|
|
37
|
+
hidden: 'invisible',
|
|
35
38
|
...classNames,
|
|
36
39
|
}, components: {
|
|
37
|
-
//
|
|
38
|
-
// IconRight: ({ ...props }) => <Right className="w-4 h-4" />,
|
|
40
|
+
// Chevron: () => <Left className="w-4 h-4" />,
|
|
39
41
|
}, ...props }));
|
|
40
42
|
}
|
|
41
43
|
exports.Calendar = Calendar;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Calendar.js","sourceRoot":"","sources":["../../src/Calendar/Calendar.tsx"],"names":[],"mappings":";;;;AAAA,0DAA8B;AAC9B,uDAA4C;AAC5C,0CAAmC;AACnC,
|
|
1
|
+
{"version":3,"file":"Calendar.js","sourceRoot":"","sources":["../../src/Calendar/Calendar.tsx"],"names":[],"mappings":";;;;AAAA,0DAA8B;AAC9B,uDAA4C;AAC5C,0CAAmC;AACnC,4CAAoC;AAEpC,MAAM,kBAAkB,GAAG,4CAA4C,CAAA;AACvE,MAAM,eAAe,GAAG,gDAAgD,CAAA;AACxE,MAAM,kBAAkB,GAAG,4EAA4E,CAAA;AACvG,MAAM,aAAa,GAClB,6IAA6I,CAAA;AAG9I,SAAS,QAAQ,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,GAAG,IAAI,EAAE,GAAG,KAAK,EAAiB;IAC3F,OAAO,CACN,oBAAC,4BAAS,IACT,MAAM,EAAE,WAAE,EACV,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,IAAA,UAAE,EAAC,aAAa,EAAE,SAAS,CAAC,EACvC,UAAU,EAAE;YACX,MAAM,EAAE,UAAU;YAClB,KAAK,EAAE,2CAA2C;YAClD,UAAU,EAAE,wBAAwB;YACpC,aAAa,EAAE,iBAAiB;YAChC,aAAa,EAAE,gCAAgC;YAC/C,GAAG,EAAE,6CAA6C;YAClD,eAAe,EAAE,aAAa;YAC9B,WAAW,EAAE,aAAa;YAC1B,QAAQ,EAAE,MAAM;YAChB,OAAO,EAAE,6CAA6C;YACtD,IAAI,EAAE,kBAAkB;YACxB,UAAU,EAAE,uBAAuB;YACnC,GAAG,EAAE,IAAA,UAAE,EACN,mDAAmD,EACnD,KAAK,CAAC,IAAI,KAAK,OAAO;gBACrB,CAAC,CAAC,wMAAwM;gBAC1M,CAAC,CAAC,kCAAkC,CACrC;YACD,WAAW,EAAE,iBAAiB;YAC9B,SAAS,EAAE,eAAe;YAC1B,YAAY,EAAE,kBAAkB;YAChC,QAAQ,EAAE,kBAAkB;YAC5B,KAAK,EAAE,eAAe;YACtB,OAAO,EACN,qGAAqG;YACtG,QAAQ,EAAE,uBAAuB;YACjC,MAAM,EAAE,WAAW;YACnB,GAAG,UAAU;SACb,EACD,UAAU,EACT;QACC,+CAA+C;SAC/C,KAEE,KAAK,GACR,CACF,CAAA;AACF,CAAC;AAIQ,4BAAQ;AAFjB,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DatePicker = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = (0, tslib_1.__importStar)(require("react"));
|
|
6
|
+
const date_fns_1 = require("date-fns");
|
|
7
|
+
const utils_1 = require("../@/lib/utils");
|
|
8
|
+
const Calendar_1 = require("../Calendar");
|
|
9
|
+
const Icon_1 = require("../Icon");
|
|
10
|
+
const Popover_1 = require("../Popover");
|
|
11
|
+
const locale_1 = require("date-fns/locale");
|
|
12
|
+
const trigegrClasses = 'inline-flex items-center border-input border h-[44px] rounded-sm px-[16px]';
|
|
13
|
+
const DatePicker = ({ placeholder, triggerDisabled, date, classTrigger, ...props }) => {
|
|
14
|
+
return (React.createElement(Popover_1.Popover, null,
|
|
15
|
+
React.createElement(Popover_1.Popover.Trigger, { asChild: true },
|
|
16
|
+
React.createElement("button", { className: (0, utils_1.cn)(trigegrClasses, { 'bg-light text-light': triggerDisabled }, classTrigger), disabled: triggerDisabled },
|
|
17
|
+
date ? React.createElement("span", { className: 'truncate' }, (0, date_fns_1.format)(date, 'PPP', { locale: locale_1.ru })) : React.createElement("span", { className: 'text-light truncate' }, placeholder),
|
|
18
|
+
React.createElement(Icon_1.Calendar, { width: 18, height: 18, className: "ml-[8px] text-light shrink-0" }))),
|
|
19
|
+
React.createElement(Popover_1.Popover.Content, { className: "p-0 w-auto", align: "center" },
|
|
20
|
+
React.createElement(Calendar_1.Calendar, { ...props }))));
|
|
21
|
+
};
|
|
22
|
+
exports.DatePicker = DatePicker;
|
|
23
|
+
//# sourceMappingURL=DatePicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePicker.js","sourceRoot":"","sources":["../../src/DatePicker/DatePicker.tsx"],"names":[],"mappings":";;;;AAAA,0DAA8B;AAC9B,uCAAiC;AACjC,0CAAmC;AACnC,0CAAsC;AACtC,kCAAkD;AAClD,wCAAoC;AACpC,4CAAoC;AAEpC,MAAM,cAAc,GAAG,4EAA4E,CAAA;AASnG,MAAM,UAAU,GAAqB,CAAC,EAAC,WAAW,EAAE,eAAe,EAAE,IAAI,EAAE,YAAY,EAAG,GAAG,KAAK,EAAC,EAAE,EAAE;IAEtG,OAAO,CACN,oBAAC,iBAAO;QACP,oBAAC,iBAAO,CAAC,OAAO,IAAC,OAAO;YACvB,gCAAQ,SAAS,EAAE,IAAA,UAAE,EAAC,cAAc,EAAE,EAAC,qBAAqB,EAAC,eAAe,EAAC,EAAE,YAAY,CAAC,EAAE,QAAQ,EAAE,eAAe;gBACrH,IAAI,CAAC,CAAC,CAAC,8BAAM,SAAS,EAAC,UAAU,IAAE,IAAA,iBAAM,EAAC,IAAI,EAAE,KAAK,EAAE,EAAC,MAAM,EAAE,WAAE,EAAC,CAAC,CAAQ,CAAC,CAAC,CAAC,8BAAM,SAAS,EAAC,qBAAqB,IAAE,WAAW,CAAQ;gBAC1I,oBAAC,eAAY,IAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAC,8BAA8B,GAAG,CACxE,CACQ;QAClB,oBAAC,iBAAO,CAAC,OAAO,IACf,SAAS,EAAC,YAAY,EACtB,KAAK,EAAC,QAAQ;YAEd,oBAAC,mBAAQ,OAAK,KAAK,GAAG,CACL,CACT,CACV,CAAA;AACF,CAAC,CAAA;AAEQ,gCAAU"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DatePicker } from './DatePicker';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DatePicker = void 0;
|
|
4
|
+
var DatePicker_1 = require("./DatePicker");
|
|
5
|
+
Object.defineProperty(exports, "DatePicker", { enumerable: true, get: function () { return DatePicker_1.DatePicker; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/DatePicker/index.ts"],"names":[],"mappings":";;;AAAA,2CAAyC;AAAhC,wGAAA,UAAU,OAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -22,4 +22,5 @@ import { Textarea } from './Textarea';
|
|
|
22
22
|
import { SelectAccountCard, SelectAsync } from './Select';
|
|
23
23
|
import { Form, FormLabel, FormField, FormItem, FormControl, FormDescription, FormMessage } from './Form';
|
|
24
24
|
import { Calendar } from './Calendar';
|
|
25
|
-
|
|
25
|
+
import { DatePicker } from './DatePicker';
|
|
26
|
+
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, Calendar, DatePicker, SelectAsync, InputMask, };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InputMask = exports.SelectAsync = exports.Calendar = 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;
|
|
3
|
+
exports.InputMask = exports.SelectAsync = exports.DatePicker = exports.Calendar = 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; } });
|
|
@@ -75,4 +75,6 @@ Object.defineProperty(exports, "FormDescription", { enumerable: true, get: funct
|
|
|
75
75
|
Object.defineProperty(exports, "FormMessage", { enumerable: true, get: function () { return Form_1.FormMessage; } });
|
|
76
76
|
const Calendar_1 = require("./Calendar");
|
|
77
77
|
Object.defineProperty(exports, "Calendar", { enumerable: true, get: function () { return Calendar_1.Calendar; } });
|
|
78
|
+
const DatePicker_1 = require("./DatePicker");
|
|
79
|
+
Object.defineProperty(exports, "DatePicker", { enumerable: true, get: function () { return DatePicker_1.DatePicker; } });
|
|
78
80
|
//# 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;AAsClC,wFAtCQ,iBAAO,OAsCR;AArCR,iCAA6B;AAsC5B,qFAtCQ,WAAI,OAsCR;AArCL,qCAAiC;AAsChC,uFAtCQ,eAAM,OAsCR;AArCP,uCAAmC;AAsClC,wFAtCQ,iBAAO,OAsCR;AArCR,+DAAyB;AAsCxB,eAtCM,cAAI,CAsCN;AArCL,2CAAsF;AAsCrF,yFAtCQ,oBAA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from 'react-day-picker'
|
|
3
3
|
import { cn } from '../@/lib/utils'
|
|
4
|
-
import {
|
|
5
|
-
import { Left, Right } from '../Icon'
|
|
4
|
+
import { ru } from 'date-fns/locale'
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
const daySelectedClasses = 'bg-btn-primary text-btn-primary rounded-sm'
|
|
7
|
+
const dayTodayClasses = 'bg-btn-secondary text-btn-secondary rounded-sm'
|
|
8
|
+
const rangeMiddleClasses = 'date-range-middle aria-selected:bg-btn-primary/50 aria-selected:text-white'
|
|
9
|
+
const btnNavClasses =
|
|
10
|
+
'opacity-50 hover:opacity-100 ring-offset-2 focus-visible:opacity-100 focus-visible:outline-primary border-input border rounded-sm shadow-sm'
|
|
8
11
|
|
|
12
|
+
export type CalendarProps = React.ComponentProps<typeof DayPicker>
|
|
9
13
|
function Calendar({ className, classNames, showOutsideDays = true, ...props }: CalendarProps) {
|
|
10
14
|
return (
|
|
11
15
|
<DayPicker
|
|
16
|
+
locale={ru}
|
|
12
17
|
showOutsideDays={showOutsideDays}
|
|
13
|
-
className={cn('
|
|
18
|
+
className={cn('inline-flex', className)}
|
|
14
19
|
classNames={{
|
|
15
|
-
months: '
|
|
16
|
-
month: 'space-y-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
row: 'flex w-full mt-2',
|
|
30
|
-
cell: cn(
|
|
31
|
-
'relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected].day-range-end)]:rounded-r-md',
|
|
20
|
+
months: 'relative',
|
|
21
|
+
month: 'flex flex-col space-y-[16px] items-center',
|
|
22
|
+
month_grid: 'w-full border-collapse',
|
|
23
|
+
month_caption: 'inline m-x-auto',
|
|
24
|
+
caption_label: 'text-sm font-medium capitalize',
|
|
25
|
+
nav: 'flex justify-between absolute start-0 end-0',
|
|
26
|
+
button_previous: btnNavClasses,
|
|
27
|
+
button_next: btnNavClasses,
|
|
28
|
+
weekdays: 'flex',
|
|
29
|
+
weekday: 'text-light w-[32px] font-normal text-[14px]',
|
|
30
|
+
week: 'flex w-full mt-2',
|
|
31
|
+
day_button: 'w-[32px] h-[32px] p-0',
|
|
32
|
+
day: cn(
|
|
33
|
+
'aria-selected:opacity-100 text-[14px] leading-[1]',
|
|
32
34
|
props.mode === 'range'
|
|
33
|
-
? '[&:has(>.day-range-end)]:rounded-r-
|
|
34
|
-
: '[&:
|
|
35
|
+
? '[&:(.day-range-middle)]:rounded-0 [&:has(>.day-range-end)]:rounded-r-sm [&:has(>.day-range-start)]:rounded-l-sm first:[&:has([aria-selected])]:rounded-l-sm last:[&:has([aria-selected])]:rounded-r-sm'
|
|
36
|
+
: '[&:([aria-selected])]:rounded-sm'
|
|
35
37
|
),
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
day_range_middle: 'aria-selected:bg-accent aria-selected:text-accent-foreground',
|
|
46
|
-
day_hidden: 'invisible',
|
|
38
|
+
range_start: 'day-range-start',
|
|
39
|
+
range_end: 'day-range-end',
|
|
40
|
+
range_middle: rangeMiddleClasses,
|
|
41
|
+
selected: daySelectedClasses,
|
|
42
|
+
today: dayTodayClasses,
|
|
43
|
+
outside:
|
|
44
|
+
'day-outside opacity-50 aria-selected:bg-primary aria-selected:text-[white] aria-selected:opacity-30',
|
|
45
|
+
disabled: 'text-light opacity-50',
|
|
46
|
+
hidden: 'invisible',
|
|
47
47
|
...classNames,
|
|
48
48
|
}}
|
|
49
|
-
components={
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
components={
|
|
50
|
+
{
|
|
51
|
+
// Chevron: () => <Left className="w-4 h-4" />,
|
|
52
|
+
}
|
|
53
|
+
}
|
|
53
54
|
{...props}
|
|
54
55
|
/>
|
|
55
56
|
)
|
|
56
57
|
}
|
|
58
|
+
|
|
57
59
|
Calendar.displayName = 'Calendar'
|
|
58
60
|
|
|
59
61
|
export { Calendar }
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { format } from 'date-fns'
|
|
3
|
+
import { cn } from '../@/lib/utils'
|
|
4
|
+
import { Calendar } from '../Calendar'
|
|
5
|
+
import { Calendar as CalendarIcon } from '../Icon'
|
|
6
|
+
import { Popover } from '../Popover'
|
|
7
|
+
import { ru } from 'date-fns/locale'
|
|
8
|
+
|
|
9
|
+
const trigegrClasses = 'inline-flex items-center border-input border h-[44px] rounded-sm px-[16px]'
|
|
10
|
+
|
|
11
|
+
interface IProps {
|
|
12
|
+
placeholder?: string,
|
|
13
|
+
date: Date,
|
|
14
|
+
classTrigger?: string,
|
|
15
|
+
triggerDisabled: boolean,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const DatePicker: React.FC<IProps> = ({placeholder, triggerDisabled, date, classTrigger, ...props}) => {
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<Popover>
|
|
22
|
+
<Popover.Trigger asChild>
|
|
23
|
+
<button className={cn(trigegrClasses, {'bg-light text-light':triggerDisabled}, classTrigger)} disabled={triggerDisabled}>
|
|
24
|
+
{date ? <span className='truncate'>{format(date ,'PPP', {locale: ru})}</span> : <span className='text-light truncate'>{placeholder}</span>}
|
|
25
|
+
<CalendarIcon width={18} height={18} className="ml-[8px] text-light shrink-0" />
|
|
26
|
+
</button>
|
|
27
|
+
</Popover.Trigger>
|
|
28
|
+
<Popover.Content
|
|
29
|
+
className="p-0 w-auto"
|
|
30
|
+
align="center"
|
|
31
|
+
>
|
|
32
|
+
<Calendar {...props}/>
|
|
33
|
+
</Popover.Content>
|
|
34
|
+
</Popover>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { DatePicker }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DatePicker } from './DatePicker'
|
|
File without changes
|
package/src/index.ts
CHANGED
|
@@ -33,7 +33,7 @@ import { Textarea } from './Textarea'
|
|
|
33
33
|
import { SelectAccountCard, SelectAsync } from './Select'
|
|
34
34
|
import { Form, FormLabel, FormField, FormItem, FormControl, FormDescription, FormMessage } from './Form'
|
|
35
35
|
import { Calendar } from './Calendar'
|
|
36
|
-
|
|
36
|
+
import { DatePicker } from './DatePicker'
|
|
37
37
|
|
|
38
38
|
export {
|
|
39
39
|
Tooltip,
|
|
@@ -83,7 +83,7 @@ export {
|
|
|
83
83
|
FormDescription,
|
|
84
84
|
FormMessage,
|
|
85
85
|
Calendar,
|
|
86
|
-
|
|
86
|
+
DatePicker,
|
|
87
87
|
SelectAsync,
|
|
88
88
|
InputMask,
|
|
89
89
|
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
|
|
5
|
-
import { format } from "date-fns"
|
|
6
|
-
|
|
7
|
-
import { cn } from "../@/lib/utils"
|
|
8
|
-
import { Button } from "../Button"
|
|
9
|
-
import { Calendar } from "../Calendar"
|
|
10
|
-
import {
|
|
11
|
-
Popover,
|
|
12
|
-
} from "../Popover"
|
|
13
|
-
|
|
14
|
-
export function DatePickerDemo() {
|
|
15
|
-
const [date, setDate] = React.useState<Date>()
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<Popover>
|
|
19
|
-
<Popover.Trigger asChild>
|
|
20
|
-
<Button
|
|
21
|
-
variant={"outline"}
|
|
22
|
-
className={cn(
|
|
23
|
-
"w-[240px] justify-start text-left font-normal",
|
|
24
|
-
!date && "text-muted-foreground"
|
|
25
|
-
)}
|
|
26
|
-
>
|
|
27
|
-
{/* <CalendarIcon className="mr-2 w-4 h-4" /> */}
|
|
28
|
-
{date ? format(date, "PPP") : <span>Pick a date</span>}
|
|
29
|
-
</Button>
|
|
30
|
-
</Popover.Trigger>
|
|
31
|
-
<Popover.Content className="p-0 w-auto" align="start">
|
|
32
|
-
<Calendar
|
|
33
|
-
mode="single"
|
|
34
|
-
// selected={date}
|
|
35
|
-
// onSelect={setDate}
|
|
36
|
-
// initialFocus
|
|
37
|
-
/>
|
|
38
|
-
</Popover.Content>
|
|
39
|
-
</Popover>
|
|
40
|
-
)
|
|
41
|
-
}
|
package/src/Datepicker/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Datepicker } from './Datepicker'
|