@g4rcez/components 0.0.44 → 0.0.46
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/index.css +1 -1
- package/dist/index.js +16 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +585 -501
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +31 -31
- package/dist/index.umd.js.map +1 -1
- package/dist/preset/preset.tailwind.d.ts +2 -2
- package/dist/preset/preset.tailwind.d.ts.map +1 -1
- package/dist/preset/preset.tailwind.js +5 -5
- package/dist/preset/src/styles/dark.d.ts.map +1 -1
- package/dist/preset/src/styles/dark.js +37 -0
- package/dist/preset/src/styles/light.d.ts.map +1 -1
- package/dist/preset/src/styles/light.js +37 -0
- package/dist/preset/src/styles/theme.types.d.ts +5 -0
- package/dist/preset/src/styles/theme.types.d.ts.map +1 -1
- package/dist/preset.tailwind.d.ts +2 -2
- package/dist/preset.tailwind.d.ts.map +1 -1
- package/dist/preset.tailwind.js +6 -6
- package/dist/src/components/core/button.d.ts.map +1 -1
- package/dist/src/components/core/button.js +10 -13
- package/dist/src/components/core/polymorph.js +2 -4
- package/dist/src/components/core/tag.js +2 -5
- package/dist/src/components/display/alert.d.ts +4 -3
- package/dist/src/components/display/alert.d.ts.map +1 -1
- package/dist/src/components/display/alert.js +12 -12
- package/dist/src/components/display/calendar.js +20 -26
- package/dist/src/components/display/card.js +1 -5
- package/dist/src/components/display/list.js +2 -2
- package/dist/src/components/display/notifications.js +3 -4
- package/dist/src/components/display/step.js +2 -2
- package/dist/src/components/display/timeline.js +2 -6
- package/dist/src/components/floating/dropdown.js +3 -4
- package/dist/src/components/floating/expand.js +1 -1
- package/dist/src/components/floating/menu.js +28 -29
- package/dist/src/components/floating/modal.js +4 -6
- package/dist/src/components/floating/tooltip.js +2 -4
- package/dist/src/components/form/autocomplete.js +46 -47
- package/dist/src/components/form/checkbox.js +1 -5
- package/dist/src/components/form/date-picker.js +5 -8
- package/dist/src/components/form/file-upload.js +5 -10
- package/dist/src/components/form/form.js +2 -3
- package/dist/src/components/form/input-field.js +2 -2
- package/dist/src/components/form/input.js +3 -6
- package/dist/src/components/form/radiobox.js +1 -5
- package/dist/src/components/form/select.js +4 -10
- package/dist/src/components/form/switch.js +6 -10
- package/dist/src/components/form/task-list.js +1 -1
- package/dist/src/components/form/transfer-list.js +2 -2
- package/dist/src/components/table/filter.js +7 -8
- package/dist/src/components/table/group.js +3 -5
- package/dist/src/components/table/index.js +27 -45
- package/dist/src/components/table/metadata.js +5 -1
- package/dist/src/components/table/pagination.js +3 -4
- package/dist/src/components/table/sort.js +2 -2
- package/dist/src/components/table/table-lib.js +13 -16
- package/dist/src/components/table/thead.js +2 -3
- package/dist/src/hooks/use-form.js +48 -20
- package/dist/src/hooks/use-translate-context.js +1 -1
- package/dist/src/lib/dom.js +1 -1
- package/dist/src/styles/dark.d.ts.map +1 -1
- package/dist/src/styles/dark.js +37 -0
- package/dist/src/styles/design-tokens.js +5 -2
- package/dist/src/styles/light.d.ts.map +1 -1
- package/dist/src/styles/light.js +37 -0
- package/dist/src/styles/theme.types.d.ts +5 -0
- package/dist/src/styles/theme.types.d.ts.map +1 -1
- package/package.json +12 -6
- package/dist/components/core/button.d.ts +0 -16
- package/dist/components/core/button.d.ts.map +0 -1
- package/dist/components/core/button.js +0 -43
- package/dist/components/core/polymorph.d.ts +0 -10
- package/dist/components/core/polymorph.d.ts.map +0 -1
- package/dist/components/core/polymorph.js +0 -8
- package/dist/components/core/resizable.d.ts +0 -3
- package/dist/components/core/resizable.d.ts.map +0 -1
- package/dist/components/core/resizable.js +0 -50
- package/dist/components/core/tag.d.ts +0 -19
- package/dist/components/core/tag.d.ts.map +0 -1
- package/dist/components/core/tag.js +0 -45
- package/dist/components/display/alert.d.ts +0 -19
- package/dist/components/display/alert.d.ts.map +0 -1
- package/dist/components/display/alert.js +0 -34
- package/dist/components/display/calendar.d.ts +0 -42
- package/dist/components/display/calendar.d.ts.map +0 -1
- package/dist/components/display/calendar.js +0 -215
- package/dist/components/display/card.d.ts +0 -10
- package/dist/components/display/card.d.ts.map +0 -1
- package/dist/components/display/card.js +0 -8
- package/dist/components/display/list.d.ts +0 -16
- package/dist/components/display/list.d.ts.map +0 -1
- package/dist/components/display/list.js +0 -31
- package/dist/components/display/notifications.d.ts +0 -25
- package/dist/components/display/notifications.d.ts.map +0 -1
- package/dist/components/display/notifications.js +0 -70
- package/dist/components/display/stats.d.ts +0 -10
- package/dist/components/display/stats.d.ts.map +0 -1
- package/dist/components/display/stats.js +0 -5
- package/dist/components/display/tabs.d.ts +0 -20
- package/dist/components/display/tabs.d.ts.map +0 -1
- package/dist/components/display/tabs.js +0 -67
- package/dist/components/display/timeline.d.ts +0 -32
- package/dist/components/display/timeline.d.ts.map +0 -1
- package/dist/components/display/timeline.js +0 -21
- package/dist/components/floating/dropdown.d.ts +0 -14
- package/dist/components/floating/dropdown.d.ts.map +0 -1
- package/dist/components/floating/dropdown.js +0 -39
- package/dist/components/floating/expand.d.ts +0 -9
- package/dist/components/floating/expand.d.ts.map +0 -1
- package/dist/components/floating/expand.js +0 -25
- package/dist/components/floating/menu.d.ts +0 -52
- package/dist/components/floating/menu.d.ts.map +0 -1
- package/dist/components/floating/menu.js +0 -126
- package/dist/components/floating/modal.d.ts +0 -19
- package/dist/components/floating/modal.d.ts.map +0 -1
- package/dist/components/floating/modal.js +0 -102
- package/dist/components/floating/toolbar.d.ts +0 -6
- package/dist/components/floating/toolbar.d.ts.map +0 -1
- package/dist/components/floating/toolbar.js +0 -4
- package/dist/components/floating/tooltip.d.ts +0 -12
- package/dist/components/floating/tooltip.d.ts.map +0 -1
- package/dist/components/floating/tooltip.js +0 -28
- package/dist/components/form/autocomplete.d.ts +0 -17
- package/dist/components/form/autocomplete.d.ts.map +0 -1
- package/dist/components/form/autocomplete.js +0 -152
- package/dist/components/form/checkbox.d.ts +0 -11
- package/dist/components/form/checkbox.d.ts.map +0 -1
- package/dist/components/form/checkbox.js +0 -8
- package/dist/components/form/date-picker.d.ts +0 -61
- package/dist/components/form/date-picker.d.ts.map +0 -1
- package/dist/components/form/date-picker.js +0 -78
- package/dist/components/form/file-upload.d.ts +0 -12
- package/dist/components/form/file-upload.d.ts.map +0 -1
- package/dist/components/form/file-upload.js +0 -62
- package/dist/components/form/form.d.ts +0 -4
- package/dist/components/form/form.d.ts.map +0 -1
- package/dist/components/form/form.js +0 -28
- package/dist/components/form/input-field.d.ts +0 -30
- package/dist/components/form/input-field.d.ts.map +0 -1
- package/dist/components/form/input-field.js +0 -14
- package/dist/components/form/input.d.ts +0 -9
- package/dist/components/form/input.d.ts.map +0 -1
- package/dist/components/form/input.js +0 -38
- package/dist/components/form/radiobox.d.ts +0 -7
- package/dist/components/form/radiobox.d.ts.map +0 -1
- package/dist/components/form/radiobox.js +0 -7
- package/dist/components/form/select.d.ts +0 -13
- package/dist/components/form/select.d.ts.map +0 -1
- package/dist/components/form/select.js +0 -33
- package/dist/components/form/switch.d.ts +0 -8
- package/dist/components/form/switch.d.ts.map +0 -1
- package/dist/components/form/switch.js +0 -39
- package/dist/components/form/task-list.d.ts +0 -3
- package/dist/components/form/task-list.d.ts.map +0 -1
- package/dist/components/form/task-list.js +0 -26
- package/dist/components/form/transfer-list.d.ts +0 -14
- package/dist/components/form/transfer-list.d.ts.map +0 -1
- package/dist/components/form/transfer-list.js +0 -21
- package/dist/components/index.d.ts +0 -30
- package/dist/components/index.d.ts.map +0 -1
- package/dist/components/index.js +0 -29
- package/dist/components/table/filter.d.ts +0 -41
- package/dist/components/table/filter.d.ts.map +0 -1
- package/dist/components/table/filter.js +0 -91
- package/dist/components/table/group.d.ts +0 -17
- package/dist/components/table/group.d.ts.map +0 -1
- package/dist/components/table/group.js +0 -43
- package/dist/components/table/index.d.ts +0 -38
- package/dist/components/table/index.d.ts.map +0 -1
- package/dist/components/table/index.js +0 -145
- package/dist/components/table/metadata.d.ts +0 -3
- package/dist/components/table/metadata.d.ts.map +0 -1
- package/dist/components/table/metadata.js +0 -10
- package/dist/components/table/pagination.d.ts +0 -3
- package/dist/components/table/pagination.d.ts.map +0 -1
- package/dist/components/table/pagination.js +0 -43
- package/dist/components/table/sort.d.ts +0 -28
- package/dist/components/table/sort.d.ts.map +0 -1
- package/dist/components/table/sort.js +0 -79
- package/dist/components/table/table-lib.d.ts +0 -122
- package/dist/components/table/table-lib.d.ts.map +0 -1
- package/dist/components/table/table-lib.js +0 -51
- package/dist/components/table/thead.d.ts +0 -8
- package/dist/components/table/thead.d.ts.map +0 -1
- package/dist/components/table/thead.js +0 -29
- package/dist/constants.d.ts +0 -3
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -2
- package/dist/hooks/use-callback-ref.d.ts +0 -3
- package/dist/hooks/use-callback-ref.d.ts.map +0 -1
- package/dist/hooks/use-callback-ref.js +0 -8
- package/dist/hooks/use-click-outside.d.ts +0 -3
- package/dist/hooks/use-click-outside.d.ts.map +0 -1
- package/dist/hooks/use-click-outside.js +0 -17
- package/dist/hooks/use-debounce.d.ts +0 -4
- package/dist/hooks/use-debounce.d.ts.map +0 -1
- package/dist/hooks/use-debounce.js +0 -12
- package/dist/hooks/use-form.d.ts +0 -41
- package/dist/hooks/use-form.d.ts.map +0 -1
- package/dist/hooks/use-form.js +0 -169
- package/dist/hooks/use-hover.d.ts +0 -3
- package/dist/hooks/use-hover.d.ts.map +0 -1
- package/dist/hooks/use-hover.js +0 -18
- package/dist/hooks/use-media-query.d.ts +0 -2
- package/dist/hooks/use-media-query.d.ts.map +0 -1
- package/dist/hooks/use-media-query.js +0 -25
- package/dist/hooks/use-mutable-state.d.ts +0 -2
- package/dist/hooks/use-mutable-state.d.ts.map +0 -1
- package/dist/hooks/use-mutable-state.js +0 -8
- package/dist/hooks/use-on-event.d.ts +0 -4
- package/dist/hooks/use-on-event.d.ts.map +0 -1
- package/dist/hooks/use-on-event.js +0 -7
- package/dist/hooks/use-parent.d.ts +0 -3
- package/dist/hooks/use-parent.d.ts.map +0 -1
- package/dist/hooks/use-parent.js +0 -21
- package/dist/hooks/use-previous.d.ts +0 -2
- package/dist/hooks/use-previous.d.ts.map +0 -1
- package/dist/hooks/use-previous.js +0 -8
- package/dist/hooks/use-reactive.d.ts +0 -2
- package/dist/hooks/use-reactive.d.ts.map +0 -1
- package/dist/hooks/use-reactive.js +0 -8
- package/dist/hooks/use-stable-ref.d.ts +0 -2
- package/dist/hooks/use-stable-ref.d.ts.map +0 -1
- package/dist/hooks/use-stable-ref.js +0 -8
- package/dist/hooks/use-translate-context.d.ts +0 -99
- package/dist/hooks/use-translate-context.d.ts.map +0 -1
- package/dist/hooks/use-translate-context.js +0 -53
- package/dist/index.d.ts +0 -12
- package/dist/index.d.ts.map +0 -1
- package/dist/lib/dom.d.ts +0 -9
- package/dist/lib/dom.d.ts.map +0 -1
- package/dist/lib/dom.js +0 -34
- package/dist/lib/fns.d.ts +0 -7
- package/dist/lib/fns.d.ts.map +0 -1
- package/dist/lib/fns.js +0 -26
- package/dist/styles/design-tokens.d.ts +0 -19
- package/dist/styles/design-tokens.d.ts.map +0 -1
- package/dist/styles/design-tokens.js +0 -52
- package/dist/styles/theme.d.ts +0 -4
- package/dist/styles/theme.d.ts.map +0 -1
- package/dist/styles/theme.js +0 -294
- package/dist/styles/theme.types.d.ts +0 -101
- package/dist/styles/theme.types.d.ts.map +0 -1
- package/dist/styles/theme.types.js +0 -1
- package/dist/types.d.ts +0 -10
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -1
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Locales } from "the-mask-input";
|
|
3
|
-
type Range = {
|
|
4
|
-
from?: Date;
|
|
5
|
-
to?: Date;
|
|
6
|
-
};
|
|
7
|
-
type OnChangeDate = (d: Date | undefined) => void;
|
|
8
|
-
type OnChangeRange = (d: Range | undefined) => void;
|
|
9
|
-
export type CalendarProps<T extends "date" | "range" | undefined = undefined> = Partial<{
|
|
10
|
-
locale: Locales;
|
|
11
|
-
markToday: boolean;
|
|
12
|
-
rangeMode: boolean;
|
|
13
|
-
changeOnlyOnClick: boolean;
|
|
14
|
-
onChangeMonth: (d: Date) => void;
|
|
15
|
-
onChangeYear: (d: Date) => void;
|
|
16
|
-
RenderOnDay: React.FC<{
|
|
17
|
-
date: Date;
|
|
18
|
-
}>;
|
|
19
|
-
disabledDate: (date: Date) => boolean;
|
|
20
|
-
styles: Partial<{
|
|
21
|
-
day: string;
|
|
22
|
-
week: string;
|
|
23
|
-
weekDay: string;
|
|
24
|
-
dayFrame: string;
|
|
25
|
-
calendar: string;
|
|
26
|
-
}>;
|
|
27
|
-
} & (T extends "date" ? {
|
|
28
|
-
date: Date;
|
|
29
|
-
onChange: OnChangeDate;
|
|
30
|
-
} : T extends "range" ? {
|
|
31
|
-
range: Range;
|
|
32
|
-
onChange: OnChangeRange;
|
|
33
|
-
} : {}) & ({
|
|
34
|
-
date: Date;
|
|
35
|
-
onChange: OnChangeDate;
|
|
36
|
-
} | {
|
|
37
|
-
range: Range;
|
|
38
|
-
onChange: OnChangeRange;
|
|
39
|
-
})>;
|
|
40
|
-
export declare const Calendar: ({ RenderOnDay, changeOnlyOnClick, disabledDate, locale, markToday, onChangeMonth, onChangeYear, rangeMode, onChange, styles, ...props }: CalendarProps) => import("react/jsx-runtime").JSX.Element;
|
|
41
|
-
export {};
|
|
42
|
-
//# sourceMappingURL=calendar.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../../src/components/display/calendar.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAE5D,OAAqB,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAqBvD,KAAK,KAAK,GAAG;IAAE,IAAI,CAAC,EAAE,IAAI,CAAC;IAAC,EAAE,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC;AAExC,KAAK,YAAY,GAAG,CAAC,CAAC,EAAE,IAAI,GAAG,SAAS,KAAK,IAAI,CAAC;AAElD,KAAK,aAAa,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,SAAS,KAAK,IAAI,CAAC;AAEpD,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,IAAI,OAAO,CACnF;IACI,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,aAAa,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,IAAI,CAAC;IACjC,YAAY,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,IAAI,CAAC;IAChC,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC,CAAC;IACtC,YAAY,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC;IACtC,MAAM,EAAE,OAAO,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;KACpB,CAAC,CAAC;CACN,GAAG,CAAC,CAAC,SAAS,MAAM,GAAG;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,YAAY,CAAA;CAAE,GAAG,CAAC,SAAS,OAAO,GAAG;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,aAAa,CAAA;CAAE,GAAG,EAAE,CAAC,GAChI,CAAC;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,YAAY,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,aAAa,CAAA;CAAE,CAAC,CAC3F,CAAC;AAoDF,eAAO,MAAM,QAAQ,4IAYlB,aAAa,4CAgRf,CAAC"}
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { __rest } from "tslib";
|
|
3
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { addDays, addMonths, addWeeks, addYears, eachDayOfInterval, endOfWeek, isAfter, isBefore, isSameMonth, isToday, startOfDay, startOfMonth, startOfWeek, subDays, subMonths, subWeeks, subYears, } from "date-fns";
|
|
5
|
-
import { AnimatePresence, motion, MotionConfig } from "framer-motion";
|
|
6
|
-
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
7
|
-
import { useEffect, useRef } from "react";
|
|
8
|
-
import { Is } from "sidekicker";
|
|
9
|
-
import TheMaskInput from "the-mask-input";
|
|
10
|
-
import { useReducer } from "use-typed-reducer";
|
|
11
|
-
import { useDebounce } from "../../hooks/use-debounce";
|
|
12
|
-
import { useTranslations } from "../../hooks/use-translate-context";
|
|
13
|
-
import { css } from "../../lib/dom";
|
|
14
|
-
import { splitInto } from "../../lib/fns";
|
|
15
|
-
const transition = { type: "spring", bounce: 0.3, duration: 0.6 };
|
|
16
|
-
const dir = (mod) => (n = 1) => ({ x: `${100 * mod * n}%`, opacity: 0.25 });
|
|
17
|
-
const variants = {
|
|
18
|
-
middle: { x: "0%", opacity: 1 },
|
|
19
|
-
enter: dir(1),
|
|
20
|
-
exit: dir(-1),
|
|
21
|
-
};
|
|
22
|
-
const removeImmediately = { exit: { visibility: "hidden" } };
|
|
23
|
-
const createDays = (month) => {
|
|
24
|
-
const start = startOfWeek(startOfMonth(month));
|
|
25
|
-
return eachDayOfInterval({ start, end: addDays(start, 41) });
|
|
26
|
-
};
|
|
27
|
-
const formatMonth = (d, locale) => d.toLocaleDateString(locale, { month: "long" });
|
|
28
|
-
const getOptionsMonth = (date, locale) => Array.from({ length: 12 }).map((_, i) => {
|
|
29
|
-
const month = startOfMonth(new Date(date).setMonth(i));
|
|
30
|
-
const label = formatMonth(month, locale);
|
|
31
|
-
return (_jsx("option", { value: label, "data-index": i, children: label }, label));
|
|
32
|
-
});
|
|
33
|
-
const onChangeUsingKeyboard = {
|
|
34
|
-
ArrowLeft: (date, duration) => (duration === "days" ? subDays(date, 1) : subMonths(date, 1)),
|
|
35
|
-
ArrowRight: (date, duration) => (duration === "days" ? addDays(date, 1) : addMonths(date, 1)),
|
|
36
|
-
ArrowUp: (date, duration) => (duration === "days" ? subWeeks(date, 1) : subYears(date, 1)),
|
|
37
|
-
ArrowDown: (date, duration) => (duration === "days" ? addWeeks(date, 1) : addYears(date, 1)),
|
|
38
|
-
};
|
|
39
|
-
const focusDate = (origin, root, next, delay = 0) => {
|
|
40
|
-
const d = next.toISOString();
|
|
41
|
-
const select = () => {
|
|
42
|
-
var _a;
|
|
43
|
-
if (!!(origin === null || origin === void 0 ? void 0 : origin.dataset.focustrap)) {
|
|
44
|
-
const el = (_a = root.current) === null || _a === void 0 ? void 0 : _a.querySelector(`button[data-focustrap="${origin === null || origin === void 0 ? void 0 : origin.dataset.focustrap}"]`);
|
|
45
|
-
return setTimeout(() => el === null || el === void 0 ? void 0 : el.focus({ preventScroll: false }), delay);
|
|
46
|
-
}
|
|
47
|
-
if (root.current) {
|
|
48
|
-
const element = root.current.querySelector(`button[data-date="${d}"]`);
|
|
49
|
-
if (element)
|
|
50
|
-
return element.focus({ preventScroll: false });
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
if (delay === 0)
|
|
54
|
-
select();
|
|
55
|
-
setTimeout(select, delay);
|
|
56
|
-
};
|
|
57
|
-
const formatYear = (now) => now.getFullYear().toString().padStart(4, "0");
|
|
58
|
-
const inRange = (start, middle, end) => {
|
|
59
|
-
if (start === undefined || end === undefined)
|
|
60
|
-
return false;
|
|
61
|
-
return isAfter(middle, start) && isBefore(middle, end);
|
|
62
|
-
};
|
|
63
|
-
export const Calendar = (_a) => {
|
|
64
|
-
var { RenderOnDay, changeOnlyOnClick = false, disabledDate, locale, markToday = true, onChangeMonth, onChangeYear, rangeMode = false, onChange, styles } = _a, props = __rest(_a, ["RenderOnDay", "changeOnlyOnClick", "disabledDate", "locale", "markToday", "onChangeMonth", "onChangeYear", "rangeMode", "onChange", "styles"]);
|
|
65
|
-
const translate = useTranslations();
|
|
66
|
-
const root = useRef(null);
|
|
67
|
-
const { date, range } = props;
|
|
68
|
-
const now = date || new Date();
|
|
69
|
-
const monthClicked = useRef(null);
|
|
70
|
-
const [state, dispatch] = useReducer({
|
|
71
|
-
date: now,
|
|
72
|
-
isAnimating: false,
|
|
73
|
-
year: formatYear(now),
|
|
74
|
-
months: getOptionsMonth(now, locale),
|
|
75
|
-
direction: undefined,
|
|
76
|
-
range: { from: range === null || range === void 0 ? void 0 : range.from, to: range === null || range === void 0 ? void 0 : range.to },
|
|
77
|
-
selectMode: (rangeMode ? "from" : undefined),
|
|
78
|
-
week: eachDayOfInterval({ start: startOfWeek(now), end: endOfWeek(now) }),
|
|
79
|
-
}, (get) => ({
|
|
80
|
-
onChangeYear: (year) => ({ year }),
|
|
81
|
-
setToday: () => ({ date: startOfDay(new Date()) }),
|
|
82
|
-
onExitComplete: () => {
|
|
83
|
-
focusDate(monthClicked.current || null, root, get.state().date, 200);
|
|
84
|
-
monthClicked.current = null;
|
|
85
|
-
return { isAnimating: false };
|
|
86
|
-
},
|
|
87
|
-
date: (callback) => {
|
|
88
|
-
const newDate = callback(get.state().date);
|
|
89
|
-
return { date: newDate, year: formatYear(newDate) };
|
|
90
|
-
},
|
|
91
|
-
nextMonth: (e) => {
|
|
92
|
-
monthClicked.current = e.currentTarget;
|
|
93
|
-
const state = get.state();
|
|
94
|
-
if (state.isAnimating)
|
|
95
|
-
return state;
|
|
96
|
-
const date = addMonths(state.date, 1);
|
|
97
|
-
return { date, isAnimating: true, direction: 1, year: formatYear(date) };
|
|
98
|
-
},
|
|
99
|
-
previousMonth: (e) => {
|
|
100
|
-
monthClicked.current = e.currentTarget;
|
|
101
|
-
const state = get.state();
|
|
102
|
-
if (state.isAnimating)
|
|
103
|
-
return state;
|
|
104
|
-
const date = subMonths(state.date, 1);
|
|
105
|
-
return { date, isAnimating: true, direction: -1, year: formatYear(date) };
|
|
106
|
-
},
|
|
107
|
-
onSelectDate: (e) => {
|
|
108
|
-
const state = get.state();
|
|
109
|
-
const isRangeMode = e.currentTarget.dataset.range === "true";
|
|
110
|
-
const d = e.currentTarget.dataset.date || "";
|
|
111
|
-
const date = new Date(d);
|
|
112
|
-
return {
|
|
113
|
-
date,
|
|
114
|
-
year: formatYear(date),
|
|
115
|
-
selectMode: state.selectMode === undefined ? undefined : state.selectMode === "from" ? "to" : "from",
|
|
116
|
-
range: !isRangeMode
|
|
117
|
-
? state.range
|
|
118
|
-
: {
|
|
119
|
-
from: state.selectMode === "from" ? date : state.range.from,
|
|
120
|
-
to: state.selectMode === "to" ? date : state.range.to,
|
|
121
|
-
},
|
|
122
|
-
};
|
|
123
|
-
},
|
|
124
|
-
onChangeMonth: (e) => {
|
|
125
|
-
const value = e.target.value;
|
|
126
|
-
const array = Array.from(e.target.options);
|
|
127
|
-
const month = array.find((x) => x.value === value);
|
|
128
|
-
const state = get.state();
|
|
129
|
-
if (month) {
|
|
130
|
-
const i = month.dataset.index || "";
|
|
131
|
-
const d = new Date(get.state().date);
|
|
132
|
-
d.setMonth(+i);
|
|
133
|
-
return Object.assign(Object.assign({}, state), { date: d, year: formatYear(d) });
|
|
134
|
-
}
|
|
135
|
-
return state;
|
|
136
|
-
},
|
|
137
|
-
onKeyDown: (e) => {
|
|
138
|
-
const key = e.key;
|
|
139
|
-
const state = get.state();
|
|
140
|
-
if (key in onChangeUsingKeyboard) {
|
|
141
|
-
if (key === "ArrowUp" || key === "ArrowDown")
|
|
142
|
-
e.preventDefault();
|
|
143
|
-
const prev = get.state().date;
|
|
144
|
-
const date = Is.keyof(onChangeUsingKeyboard, key) ? onChangeUsingKeyboard[key](prev, e.shiftKey ? "month" : "days") : null;
|
|
145
|
-
if (date !== null) {
|
|
146
|
-
focusDate(e.target, root, date);
|
|
147
|
-
return Object.assign(Object.assign({}, state), { date, year: formatYear(date) });
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
return get.state();
|
|
151
|
-
},
|
|
152
|
-
}), {
|
|
153
|
-
props: { onChangeMonth, onChangeYear },
|
|
154
|
-
postMiddleware: [
|
|
155
|
-
(state, _, args) => {
|
|
156
|
-
var _a, _b;
|
|
157
|
-
const isValidMethod = args.method === "onChangeMonth" || args.method === "previousMonth" || args.method === "nextMonth";
|
|
158
|
-
if (isValidMethod)
|
|
159
|
-
(_b = (_a = args.props).onChangeMonth) === null || _b === void 0 ? void 0 : _b.call(_a, state.date);
|
|
160
|
-
return state;
|
|
161
|
-
},
|
|
162
|
-
(state, _, args) => {
|
|
163
|
-
var _a, _b;
|
|
164
|
-
const isValidMethod = args.method === "onChangeYear";
|
|
165
|
-
if (isValidMethod)
|
|
166
|
-
(_b = (_a = args.props).onChangeYear) === null || _b === void 0 ? void 0 : _b.call(_a, state.date);
|
|
167
|
-
return state;
|
|
168
|
-
},
|
|
169
|
-
(state, _, args) => {
|
|
170
|
-
const isValidMethod = args.method === "onSelectDate" || args.method === "setToday" || args.method === "onKeyDown";
|
|
171
|
-
if (rangeMode && isValidMethod && changeOnlyOnClick) {
|
|
172
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(state.range);
|
|
173
|
-
return state;
|
|
174
|
-
}
|
|
175
|
-
if (isValidMethod && changeOnlyOnClick)
|
|
176
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(state.date);
|
|
177
|
-
return state;
|
|
178
|
-
},
|
|
179
|
-
],
|
|
180
|
-
});
|
|
181
|
-
const zip = splitInto(createDays(state.date), 7);
|
|
182
|
-
const currentAsString = state.date.toISOString();
|
|
183
|
-
const monthString = formatMonth(state.date, locale);
|
|
184
|
-
useEffect(() => {
|
|
185
|
-
if (!changeOnlyOnClick)
|
|
186
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(state.date);
|
|
187
|
-
}, [currentAsString]);
|
|
188
|
-
const defer = useDebounce((y) => {
|
|
189
|
-
dispatch.date((prev) => {
|
|
190
|
-
const d = new Date(prev);
|
|
191
|
-
d.setFullYear(+y);
|
|
192
|
-
return d;
|
|
193
|
-
});
|
|
194
|
-
}, 1200);
|
|
195
|
-
const internalOnChangeYear = (e) => {
|
|
196
|
-
const value = e.currentTarget.value;
|
|
197
|
-
dispatch.onChangeYear(value);
|
|
198
|
-
onChangeYear === null || onChangeYear === void 0 ? void 0 : onChangeYear(new Date(value));
|
|
199
|
-
defer(value);
|
|
200
|
-
};
|
|
201
|
-
return (_jsx(MotionConfig, { transition: transition, children: _jsxs("div", { ref: root, className: css("relative overflow-hidden", styles === null || styles === void 0 ? void 0 : styles.calendar), children: [_jsx("div", { className: "flex flex-col justify-center rounded text-center", children: _jsx(AnimatePresence, { initial: false, mode: "popLayout", custom: state.direction, onExitComplete: dispatch.onExitComplete, children: _jsxs(motion.div, { initial: "enter", animate: "middle", exit: "exit", children: [_jsxs("header", { className: "relative flex justify-between", children: [_jsx(motion.button, { layout: true, "data-focustrap": "prev", variants: removeImmediately, onClick: dispatch.previousMonth, className: "z-calendar rounded-full p-1.5 hover:bg-primary", children: _jsx(ChevronLeftIcon, { className: "h-4 w-4" }) }), _jsx(motion.span, { layout: true, variants: variants, custom: state.direction, className: "absolute inset-0 isolate z-normal flex items-center justify-center font-semibold", children: _jsxs("span", { className: "flex w-fit items-center justify-center gap-0.5 py-1", children: [_jsx("select", { style: { width: `${monthString.length}ch` }, value: monthString, onChange: dispatch.onChangeMonth, className: "w-fit cursor-pointer appearance-none bg-transparent capitalize proportional-nums hover:text-primary", children: state.months }), _jsx(TheMaskInput, { mask: "int", value: state.year, maxLength: 4, placeholder: "YYYY", onChange: internalOnChangeYear, style: { width: `${state.year.length}ch` }, className: "w-16 cursor-pointer appearance-none bg-transparent hover:text-primary" })] }) }), _jsx(motion.button, { layout: true, "data-focustrap": "next", variants: removeImmediately, className: "z-calendar rounded-full p-1.5 hover:bg-primary", onClick: dispatch.nextMonth, children: _jsx(ChevronRightIcon, { className: "h-4 w-4" }) }), _jsx("div", { className: "absolute inset-0", style: {
|
|
202
|
-
backgroundImage: "linear-gradient(to right, hsla(var(--card-background)) 15%, transparent 30%, transparent 70%, hsla(var(--card-background)) 85%)",
|
|
203
|
-
} })] }), _jsxs(motion.table, { className: "mt-2 table min-w-full table-auto border-0", children: [_jsx("thead", { children: _jsx("tr", { children: state.week.map((dayOfWeek) => (_jsx("th", { className: css("py-2 text-sm font-medium capitalize", styles === null || styles === void 0 ? void 0 : styles.weekDay), children: dayOfWeek.toLocaleDateString(locale, { weekday: "short" }) }, dayOfWeek.toString()))) }) }), _jsx(motion.tbody, { layout: true, variants: variants, custom: state.direction, onKeyDown: dispatch.onKeyDown, className: css(styles === null || styles === void 0 ? void 0 : styles.week), children: zip.map((week, index) => (_jsx("tr", { className: styles === null || styles === void 0 ? void 0 : styles.week, children: week.map((day) => {
|
|
204
|
-
var _a, _b, _c, _d;
|
|
205
|
-
const key = day.toISOString();
|
|
206
|
-
const isSelected = rangeMode
|
|
207
|
-
? key === ((_a = range === null || range === void 0 ? void 0 : range.to) === null || _a === void 0 ? void 0 : _a.toISOString()) || key === ((_b = range === null || range === void 0 ? void 0 : range.from) === null || _b === void 0 ? void 0 : _b.toISOString())
|
|
208
|
-
: key === (date === null || date === void 0 ? void 0 : date.toISOString());
|
|
209
|
-
const today = isToday(day) && markToday;
|
|
210
|
-
const disabledByFn = (disabledDate === null || disabledDate === void 0 ? void 0 : disabledDate(day)) || false;
|
|
211
|
-
const disableDate = !isSameMonth(day, state.date) || disabledByFn;
|
|
212
|
-
const isInRange = rangeMode ? inRange(range === null || range === void 0 ? void 0 : range.from, day, range === null || range === void 0 ? void 0 : range.to) : false;
|
|
213
|
-
return (_jsxs("td", { align: "center", className: css("relative", styles === null || styles === void 0 ? void 0 : styles.dayFrame), children: [_jsxs("button", { type: "button", "data-date": key, disabled: disabledByFn, "data-range": rangeMode, onClick: dispatch.onSelectDate, "data-view": state.date.getMonth().toString(), className: css(`flex size-10 items-center justify-center rounded-full font-semibold proportional-nums disabled:cursor-not-allowed ${today ? "text-primary" : ""} ${disableDate ? "text-disabled" : ""} ${isSelected ? "bg-primary text-primary-foreground" : ""}`, styles === null || styles === void 0 ? void 0 : styles.day, isInRange ? "size-10 border border-dashed border-card-border" : ""), children: [day.getDate(), isSelected && ((_c = state.range.from) === null || _c === void 0 ? void 0 : _c.toISOString()) === key ? (_jsx("span", { className: "absolute -top-2 left-0 h-full w-full", children: _jsx("span", { className: "text-xs", children: translate.calendarFromDate }) })) : null, isSelected && ((_d = state.range.to) === null || _d === void 0 ? void 0 : _d.toISOString()) === key ? (_jsx("span", { className: "absolute -top-2 left-0 h-full w-full", children: _jsx("span", { className: "text-xs", children: translate.calendarToDate }) })) : null] }), RenderOnDay ? _jsx(RenderOnDay, { date: day }) : null] }, key));
|
|
214
|
-
}) }, `week-${week.length}-${index}`))) })] })] }, monthString) }) }), _jsx("footer", { className: "mt-2 text-center text-primary", children: _jsx("button", { className: "duration-300 transition-transform hover:scale-105", type: "button", onClick: dispatch.setToday, children: "Today" }) })] }) }));
|
|
215
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React, { PropsWithChildren } from "react";
|
|
2
|
-
import { Label, Override } from "../../types";
|
|
3
|
-
import { PolymorphicProps } from "../core/polymorph";
|
|
4
|
-
export type CardProps = PolymorphicProps<Override<React.ComponentProps<"div">, {
|
|
5
|
-
title?: Label;
|
|
6
|
-
container?: string;
|
|
7
|
-
header?: React.ReactElement | null;
|
|
8
|
-
}>, "div">;
|
|
9
|
-
export declare const Card: ({ children, title, as, container, header, className, ...props }: PropsWithChildren<CardProps>) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
//# sourceMappingURL=card.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../../src/components/display/card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAa,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAEhE,MAAM,MAAM,SAAS,GAAG,gBAAgB,CACpC,QAAQ,CACJ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAC3B;IACI,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC;CACtC,CACJ,EACD,KAAK,CACR,CAAC;AAEF,eAAO,MAAM,IAAI,oEAA8F,iBAAiB,CAAC,SAAS,CAAC,4CAS1I,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { __rest } from "tslib";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { css } from "../../lib/dom";
|
|
4
|
-
import { Polymorph } from "../core/polymorph";
|
|
5
|
-
export const Card = (_a) => {
|
|
6
|
-
var { children, title, as = "div", container = "", header = null, className = "" } = _a, props = __rest(_a, ["children", "title", "as", "container", "header", "className"]);
|
|
7
|
-
return (_jsxs(Polymorph, Object.assign({}, props, { as: as, className: css("flex flex-col gap-4 rounded-card border border-card-border bg-card-background py-4 pb-8 shadow", container), children: [title ? _jsx("header", { className: "mb-2 w-full border-b border-card-border px-8 pb-4 text-xl font-medium", children: title }) : header, _jsx("div", { className: css("min-w-full px-8", className), children: children })] })));
|
|
8
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React, { PropsWithChildren } from "react";
|
|
2
|
-
import { Label } from "../../types";
|
|
3
|
-
type AnimatedItemProps = {
|
|
4
|
-
title: Label;
|
|
5
|
-
description: Label;
|
|
6
|
-
children: Label;
|
|
7
|
-
avatar?: Label;
|
|
8
|
-
leading?: React.FC<{
|
|
9
|
-
open: () => void;
|
|
10
|
-
}>;
|
|
11
|
-
};
|
|
12
|
-
type AnimatedListProps = {};
|
|
13
|
-
export declare const AnimatedList: (props: PropsWithChildren<AnimatedListProps>) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
export declare const AnimatedListItem: (props: PropsWithChildren<AnimatedItemProps>) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
export {};
|
|
16
|
-
//# sourceMappingURL=list.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/components/display/list.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,EAAY,iBAAiB,EAAgC,MAAM,OAAO,CAAC;AACzF,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,KAAK,iBAAiB,GAAG;IACrB,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,EAAE,KAAK,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC;IAChB,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,OAAO,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;QAAE,IAAI,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC,CAAC;CAC5C,CAAC;AAIF,KAAK,iBAAiB,GAAG,EAAE,CAAC;AA2D5B,eAAO,MAAM,YAAY,UAAW,iBAAiB,CAAC,iBAAiB,CAAC,4CAoEvE,CAAC;AAEF,eAAO,MAAM,gBAAgB,UAAW,iBAAiB,CAAC,iBAAiB,CAAC,4CAA0C,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { FloatingFocusManager, FloatingOverlay, FloatingPortal, useClick, useDismiss, useFloating, useInteractions, useRole, } from "@floating-ui/react";
|
|
3
|
-
import { AnimatePresence, motion, MotionConfig } from "framer-motion";
|
|
4
|
-
import { XIcon } from "lucide-react";
|
|
5
|
-
import React, { Fragment, useCallback, useId, useState } from "react";
|
|
6
|
-
const FloatItem = ({ item, context, setter, get, refs }) => (_jsx(FloatingPortal, { children: _jsx(MotionConfig, { reducedMotion: "user", transition: { type: "tween", stiffness: 25, duration: 0.2 }, children: _jsxs(AnimatePresence, { presenceAffectsLayout: true, children: [_jsx(AnimatePresence, { children: item ? (_jsx(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, className: "pointer-events-none fixed inset-0 top-0 z-floating h-screen w-screen bg-floating-overlay/70" })) : null }), _jsx(AnimatePresence, { children: item ? (_jsx(FloatingOverlay, { lockScroll: true, className: "absolute inset-0 z-tooltip flex items-center justify-center", children: _jsx(FloatingFocusManager, { visuallyHiddenDismiss: true, modal: true, closeOnFocusOut: true, context: context, children: _jsxs(motion.div, Object.assign({ layout: true, layoutId: `item-${item.id}`, className: "relative flex h-min w-min min-w-xs flex-col gap-4 rounded-card border border-card-border bg-card-background p-6 py-4 pb-8 shadow", ref: refs.setFloating }, get(), { children: [_jsx("nav", { className: "absolute right-4 top-1 lg:right-2", children: _jsx("button", { type: "button", onClick: setter, className: "p-1 opacity-70 transition-colors hover:text-danger hover:opacity-100 focus:text-danger", children: _jsx(XIcon, {}) }) }), _jsxs("header", { className: "flex w-full flex-wrap items-center justify-between gap-2", children: [_jsx("h3", { className: "min-w-full text-balance text-2xl font-medium", children: item.title }), _jsx("p", { className: "text-sm leading-snug text-secondary", children: item.description })] }), item.children] })) }) })) : null })] }) }) }));
|
|
7
|
-
export const AnimatedList = (props) => {
|
|
8
|
-
const [selected, setSelected] = useState(null);
|
|
9
|
-
const id = useId();
|
|
10
|
-
const { context, refs } = useFloating({
|
|
11
|
-
open: selected !== null,
|
|
12
|
-
transform: true,
|
|
13
|
-
onOpenChange: (open) => (open ? undefined : setSelected(null)),
|
|
14
|
-
});
|
|
15
|
-
const click = useClick(context);
|
|
16
|
-
const role = useRole(context);
|
|
17
|
-
const dismiss = useDismiss(context, { escapeKey: true, referencePress: true, outsidePress: true });
|
|
18
|
-
const { getFloatingProps } = useInteractions([click, role, dismiss]);
|
|
19
|
-
const clear = useCallback(() => {
|
|
20
|
-
setSelected(null);
|
|
21
|
-
}, []);
|
|
22
|
-
const items = React.Children.toArray(props.children);
|
|
23
|
-
return (_jsxs(Fragment, { children: [_jsx(FloatItem, { refs: refs, context: context, get: getFloatingProps, item: selected, setter: clear }), _jsx("ul", { role: "list", children: items.map((x, index) => {
|
|
24
|
-
const item = x.props;
|
|
25
|
-
const innerId = `${id}-${index}`;
|
|
26
|
-
const setter = () => setSelected(Object.assign(Object.assign({}, item), { id: innerId }));
|
|
27
|
-
const Leading = item.leading;
|
|
28
|
-
return (_jsx(motion.li, { layout: true, layoutId: `item-${innerId}`, className: `border-b border-card-border py-2 last:border-transparent`, children: _jsx(motion.div, { layoutId: `toast-${innerId}`, className: "relative", children: _jsx("div", { className: "relative flex items-start space-x-3", children: _jsxs(Fragment, { children: [item.avatar ? (_jsx("div", { children: _jsx("div", { className: "relative px-1", children: _jsx("button", { onClick: setter, className: "flex size-10 items-center justify-center ring-primary", children: item.avatar }) }) })) : null, _jsx("div", { className: "min-w-0 flex-1 py-1 text-foreground", children: _jsxs("div", { className: "flex flex-row flex-nowrap justify-between gap-4", children: [_jsxs("button", { onClick: setter, className: "ease-out cursor-pointer text-left transition-all hover:scale-105 hover:text-primary", children: [_jsx("h3", { children: item.title }), _jsx("p", { className: "text-sm leading-snug text-secondary", children: item.description })] }), Leading ? _jsx(Leading, { open: setter }) : null] }) })] }) }) }) }, innerId));
|
|
29
|
-
}) })] }));
|
|
30
|
-
};
|
|
31
|
-
export const AnimatedListItem = (props) => _jsx(Fragment, { children: props.children });
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { type VariantProps } from "class-variance-authority";
|
|
2
|
-
import { type PropsWithChildren } from "react";
|
|
3
|
-
import { Label } from "../../types";
|
|
4
|
-
declare const variants: (props?: ({
|
|
5
|
-
theme?: "default" | "danger" | "info" | "success" | "warn" | null | undefined;
|
|
6
|
-
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
7
|
-
type NotificationOptions = Partial<{
|
|
8
|
-
title: Label;
|
|
9
|
-
duration: number;
|
|
10
|
-
closable: boolean;
|
|
11
|
-
theme: VariantProps<typeof variants>["theme"];
|
|
12
|
-
}>;
|
|
13
|
-
type NotificationSubscriber = {
|
|
14
|
-
close: () => void;
|
|
15
|
-
clear: () => void;
|
|
16
|
-
};
|
|
17
|
-
type ContextFunction = (text: Label, args?: NotificationOptions) => NotificationSubscriber;
|
|
18
|
-
export declare const useNotification: () => ContextFunction;
|
|
19
|
-
export type NotificationProps = Partial<{
|
|
20
|
-
max: number;
|
|
21
|
-
duration: number;
|
|
22
|
-
}>;
|
|
23
|
-
export declare function Notifications({ children, max, duration }: PropsWithChildren<NotificationProps>): import("react/jsx-runtime").JSX.Element;
|
|
24
|
-
export {};
|
|
25
|
-
//# sourceMappingURL=notifications.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../../src/components/display/notifications.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAA8C,KAAK,iBAAiB,EAAwD,MAAM,OAAO,CAAC;AAEjJ,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,QAAA,MAAM,QAAQ;;mFAcb,CAAC;AAEF,KAAK,mBAAmB,GAAG,OAAO,CAAC;IAC/B,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,YAAY,CAAC,OAAO,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC;CACjD,CAAC,CAAC;AAEH,KAAK,sBAAsB,GAAG;IAAE,KAAK,EAAE,MAAM,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,IAAI,CAAA;CAAE,CAAC;AAEvE,KAAK,eAAe,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,mBAAmB,KAAK,sBAAsB,CAAC;AAM3F,eAAO,MAAM,eAAe,uBAAwC,CAAC;AAkErE,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE3E,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,GAAO,EAAE,QAAe,EAAE,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,2CAuDzG"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { createElement as _createElement } from "react";
|
|
3
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
-
import * as RadixToast from "@radix-ui/react-toast";
|
|
5
|
-
import { cva } from "class-variance-authority";
|
|
6
|
-
import { AnimatePresence, motion } from "framer-motion";
|
|
7
|
-
import { XIcon } from "lucide-react";
|
|
8
|
-
import { createContext, forwardRef, useCallback, useContext, useEffect, useRef, useState } from "react";
|
|
9
|
-
import { useHover } from "../../hooks/use-hover";
|
|
10
|
-
const variants = cva("relative isolate z-tooltip flex justify-between overflow-hidden whitespace-nowrap rounded-lg border text-sm shadow-sm supports-[backdrop-filter]:backdrop-blur-xl", {
|
|
11
|
-
variants: {
|
|
12
|
-
theme: {
|
|
13
|
-
warn: "bg-warn-notification/90 text-warn-hover border-warn/50",
|
|
14
|
-
info: "bg-info-notification supports-[backdrop-filter]:bg-info-notification/50 supports-[backdrop-filter]:bg-info/20 text-info border-info/50",
|
|
15
|
-
danger: "bg-danger-notification supports-[backdrop-filter]:bg-danger-notification/60 text-danger border-danger/50",
|
|
16
|
-
success: "bg-success-notification supports-[backdrop-filter]:bg-success-notification/50 text-success border-success/50",
|
|
17
|
-
default: "border-card-border bg-card-background text-foreground",
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
defaultVariants: { theme: "default" },
|
|
21
|
-
});
|
|
22
|
-
const NotificationContext = createContext(() => {
|
|
23
|
-
throw new Error("Not implemented");
|
|
24
|
-
});
|
|
25
|
-
export const useNotification = () => useContext(NotificationContext);
|
|
26
|
-
const animatedIndex = {
|
|
27
|
-
0: { opacity: 1, y: [10, 15], scale: [1, 0.98] },
|
|
28
|
-
1: { opacity: 1, y: [15, 20], scale: [1, 0.97] },
|
|
29
|
-
2: { opacity: 1, y: [20, 25], scale: [1, 0.96] },
|
|
30
|
-
default: { opacity: 1, y: [25, 30], scale: [1, 0.95] },
|
|
31
|
-
};
|
|
32
|
-
const Notification = forwardRef(function Toast(props, forwardedRef) {
|
|
33
|
-
var _a;
|
|
34
|
-
const closable = (_a = props.closable) !== null && _a !== void 0 ? _a : true;
|
|
35
|
-
const duration = props.duration;
|
|
36
|
-
const variant = props.hover ? "hover" : props.isLast ? "isLast" : "other";
|
|
37
|
-
const className = variants({ theme: props.theme || "default" });
|
|
38
|
-
return (_jsx(RadixToast.Root, { ref: forwardedRef, asChild: true, forceMount: true, onOpenChange: props.onClose, duration: duration, children: _jsx(motion.li, { layout: true, layoutScroll: true, animate: variant, "data-index": props.index, initial: { y: -100, zIndex: -1 }, className: "text-select pointer-events-auto absolute right-0 top-0 w-80", variants: {
|
|
39
|
-
isLast: { y: 10, scale: 1, animationDuration: "300ms", opacity: 1 },
|
|
40
|
-
hover: { y: 0, position: "static", scale: 1, opacity: 1 },
|
|
41
|
-
other: animatedIndex[props.reversedIndex] || animatedIndex.default,
|
|
42
|
-
}, transition: { type: "spring", mass: 1.2, damping: 30, stiffness: 200 }, exit: { opacity: [0.9, 0], transition: { opacity: { bounce: 0.25, duration: 0.3 } } }, children: _jsxs("div", { className: className, children: [_jsxs("div", { className: "flex flex-col p-4", children: [props.title ? (_jsx(RadixToast.Title, { className: "select-text truncate text-lg font-medium leading-relaxed", children: "Title" })) : null, _jsxs(RadixToast.Description, { className: "select-text truncate", children: [props.text, props.index] })] }), closable ? (_jsx(RadixToast.Close, { className: "absolute right-2 top-2 rounded-full p-1 text-foreground transition hover:bg-danger/10 hover:text-danger-hover", children: _jsx(XIcon, { className: "h-5 w-5" }) })) : null] }) }) }));
|
|
43
|
-
});
|
|
44
|
-
export function Notifications({ children, max = 5, duration = 5000 }) {
|
|
45
|
-
const ref = useRef(null);
|
|
46
|
-
const hover = useHover(ref);
|
|
47
|
-
const [messages, setMessages] = useState([]);
|
|
48
|
-
const clear = useCallback(() => setMessages([]), []);
|
|
49
|
-
useEffect(() => {
|
|
50
|
-
return () => clear();
|
|
51
|
-
}, [clear]);
|
|
52
|
-
const notify = useCallback((text, args) => {
|
|
53
|
-
const id = window.crypto.randomUUID();
|
|
54
|
-
setMessages((prev) => {
|
|
55
|
-
const newItems = [...prev, Object.assign(Object.assign({}, args), { id, text })];
|
|
56
|
-
if (newItems.length > max)
|
|
57
|
-
return newItems.slice(newItems.length - max, newItems.length + 1);
|
|
58
|
-
return newItems;
|
|
59
|
-
});
|
|
60
|
-
const close = () => setMessages((prev) => prev.filter((x) => x.id !== id));
|
|
61
|
-
return { clear, close };
|
|
62
|
-
}, [max]);
|
|
63
|
-
return (_jsxs(RadixToast.Provider, { duration: duration, swipeThreshold: 150, children: [_jsx(NotificationContext.Provider, { value: notify, children: children }), _jsx(AnimatePresence, { presenceAffectsLayout: true, mode: "popLayout", children: messages.map((toast, index, list) => {
|
|
64
|
-
const close = () => setMessages((prev) => prev.filter((t) => t.id !== toast.id));
|
|
65
|
-
return (_createElement(Notification, Object.assign({}, toast, { key: toast.id, hover: hover, index: index, onClose: close, isLast: list.length - 1 === index, reversedIndex: list.length - (index + 1) })));
|
|
66
|
-
}) }), _jsx(RadixToast.Viewport, { ref: ref, "data-items": messages.length, style: {
|
|
67
|
-
justifyContent: "start",
|
|
68
|
-
height: `${(hover ? messages.length : Math.min(1, messages.length)) * 7}rem`,
|
|
69
|
-
}, className: "fixed right-4 top-10 flex w-80 list-none flex-col-reverse items-end gap-4 overflow-y-clip overflow-x-visible data-[items=true]:pb-8 max-sm:top-20" })] }));
|
|
70
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Label } from "../../types";
|
|
3
|
-
export type StatsProps = {
|
|
4
|
-
title: Label;
|
|
5
|
-
Icon: React.FC<any>;
|
|
6
|
-
iconContainer?: string;
|
|
7
|
-
footer?: React.ReactElement;
|
|
8
|
-
};
|
|
9
|
-
export declare const Stats: (props: React.PropsWithChildren<StatsProps>) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
//# sourceMappingURL=stats.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../../src/components/display/stats.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,MAAM,MAAM,UAAU,GAAG;IACrB,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,KAAK,UAAW,KAAK,CAAC,iBAAiB,CAAC,UAAU,CAAC,4CAmB/D,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { css } from "../../lib/dom";
|
|
3
|
-
export const Stats = (props) => {
|
|
4
|
-
return (_jsxs("div", { className: "divide-y divide-card-border bg-card-background shadow border border-card-border rounded-card", children: [_jsxs("header", { className: "p-6 items-start flex gap-4", children: [_jsx("div", { className: css("size-10 p-8 rounded-card flex items-center justify-center aspect-square bg-primary", props.iconContainer), children: _jsx("div", { children: _jsx(props.Icon, { className: "size-10 aspect-square text-primary-foreground" }) }) }), _jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("header", { children: _jsx("h3", { className: "text-base leading-none", children: props.title }) }), _jsx("p", { className: "text-4xl font-semibold", children: props.children })] })] }), props.footer ? _jsx("footer", { className: "px-6 py-2", children: props.footer }) : null] }));
|
|
5
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren } from "react";
|
|
2
|
-
import { Label } from "../../types";
|
|
3
|
-
export type TabsProps = {
|
|
4
|
-
active: string;
|
|
5
|
-
useHash?: boolean;
|
|
6
|
-
className?: string;
|
|
7
|
-
onChange?: (id: string) => void;
|
|
8
|
-
};
|
|
9
|
-
export declare const Tabs: (props: PropsWithChildren<TabsProps>) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export type TabProps = {
|
|
11
|
-
id: string;
|
|
12
|
-
title: string;
|
|
13
|
-
label?: undefined;
|
|
14
|
-
} | {
|
|
15
|
-
id: string;
|
|
16
|
-
title: Omit<Label, string>;
|
|
17
|
-
label: string;
|
|
18
|
-
};
|
|
19
|
-
export declare const Tab: (props: PropsWithChildren<TabProps>) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
-
//# sourceMappingURL=tabs.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../src/components/display/tabs.tsx"],"names":[],"mappings":"AAEA,OAAc,EAA2B,iBAAiB,EAAkD,MAAM,OAAO,CAAC;AAG1H,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC,MAAM,MAAM,SAAS,GAAG;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC,CAAC;AAIF,eAAO,MAAM,IAAI,UAAW,iBAAiB,CAAC,SAAS,CAAC,4CA2FvD,CAAC;AAIF,MAAM,MAAM,QAAQ,GACd;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,GAChD;IACI,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAER,eAAO,MAAM,GAAG,UAAW,iBAAiB,CAAC,QAAQ,CAAC,4CAGrD,CAAC"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useMotionValue } from "framer-motion";
|
|
4
|
-
import React, { createContext, Fragment, useContext, useEffect, useLayoutEffect, useRef } from "react";
|
|
5
|
-
import { useReactive } from "../../hooks/use-reactive";
|
|
6
|
-
import { useStableRef } from "../../hooks/use-stable-ref";
|
|
7
|
-
import { Card } from "./card";
|
|
8
|
-
const Context = createContext("");
|
|
9
|
-
export const Tabs = (props) => {
|
|
10
|
-
const [active, setActive] = useReactive(props.active);
|
|
11
|
-
const left = useMotionValue(0);
|
|
12
|
-
const width = useMotionValue(0);
|
|
13
|
-
const ref = useRef(null);
|
|
14
|
-
const Render = props.useHash ? "a" : "button";
|
|
15
|
-
useLayoutEffect(() => {
|
|
16
|
-
const header = ref.current;
|
|
17
|
-
if (header === null)
|
|
18
|
-
return;
|
|
19
|
-
const resize = (element) => {
|
|
20
|
-
if (!element)
|
|
21
|
-
return;
|
|
22
|
-
const rect = element.getBoundingClientRect();
|
|
23
|
-
width.set(rect.width);
|
|
24
|
-
left.set(element.offsetLeft);
|
|
25
|
-
};
|
|
26
|
-
const listener = () => {
|
|
27
|
-
const element = header.querySelector(`li[data-active=true]`);
|
|
28
|
-
return void resize(element);
|
|
29
|
-
};
|
|
30
|
-
window.addEventListener("resize", listener);
|
|
31
|
-
let first = header.querySelector(`li[data-active=true]`);
|
|
32
|
-
const hash = window.location.hash.replace(/^#/, "");
|
|
33
|
-
if (props.active === "" && hash !== "") {
|
|
34
|
-
first = header.querySelector(`li[data-id=${hash}]`);
|
|
35
|
-
setActive(hash);
|
|
36
|
-
}
|
|
37
|
-
if (first === null) {
|
|
38
|
-
first = header.querySelector(`li[data-id]`);
|
|
39
|
-
const id = first.getAttribute("data-id") || "";
|
|
40
|
-
setActive(id);
|
|
41
|
-
}
|
|
42
|
-
resize(first);
|
|
43
|
-
return () => window.removeEventListener("resize", listener);
|
|
44
|
-
}, []);
|
|
45
|
-
const onChangeRef = useStableRef(props.onChange);
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
if (onChangeRef.current)
|
|
48
|
-
onChangeRef.current(active);
|
|
49
|
-
}, [onChangeRef, active]);
|
|
50
|
-
const items = React.Children.toArray(props.children);
|
|
51
|
-
const onClick = (e) => {
|
|
52
|
-
const anchor = e.currentTarget;
|
|
53
|
-
const rect = anchor.getBoundingClientRect();
|
|
54
|
-
width.set(rect.width);
|
|
55
|
-
left.set(anchor.offsetLeft);
|
|
56
|
-
setActive(anchor.dataset.id || "");
|
|
57
|
-
};
|
|
58
|
-
return (_jsx(Context.Provider, { value: active, children: _jsx(Card, { className: props.className, container: "pt-0 max-w-full w-full min-w-0", header: _jsx("header", { ref: ref, className: "relative mb-2 overflow-x-auto border-b border-card-border", children: _jsx("nav", { className: "min-w-0", children: _jsx("ul", { className: "flex w-0 min-w-full flex-1 justify-start overflow-x-auto", children: items.map((x) => {
|
|
59
|
-
const inner = x.props;
|
|
60
|
-
return (_jsx("li", { "data-id": inner.id, "data-active": active === inner.id, className: "w-full border-b-2 border-card-border data-[active=true]:border-primary data-[active=true]:font-bold data-[active=true]:text-primary", children: _jsx(Render, { "data-id": inner.id, onClick: onClick, "aria-current": "page", href: props.useHash ? `#${inner.id}` : undefined, className: "block w-full whitespace-nowrap px-10 py-4", children: inner.title }) }, `tab-header-${inner.id}`));
|
|
61
|
-
}) }) }) }), children: props.children }) }));
|
|
62
|
-
};
|
|
63
|
-
const useTabs = () => useContext(Context);
|
|
64
|
-
export const Tab = (props) => {
|
|
65
|
-
const active = useTabs();
|
|
66
|
-
return _jsx(Fragment, { children: props.id === active ? props.children : null });
|
|
67
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
declare const typeMap: {
|
|
3
|
-
tag: () => null;
|
|
4
|
-
custom: () => null;
|
|
5
|
-
record: ({ item }: {
|
|
6
|
-
item: TimelineItemProps;
|
|
7
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
};
|
|
9
|
-
export type TimelineItemType = keyof typeof typeMap;
|
|
10
|
-
export type TimelineItemProps = {
|
|
11
|
-
id: string | number;
|
|
12
|
-
date: Date;
|
|
13
|
-
type: TimelineItemType;
|
|
14
|
-
avatar?: {
|
|
15
|
-
img?: string;
|
|
16
|
-
name: string;
|
|
17
|
-
profile?: string;
|
|
18
|
-
};
|
|
19
|
-
text?: string;
|
|
20
|
-
custom?: React.FC<{
|
|
21
|
-
item: TimelineItemProps;
|
|
22
|
-
}>;
|
|
23
|
-
};
|
|
24
|
-
export type TimelineProps = {
|
|
25
|
-
items: TimelineItemProps[];
|
|
26
|
-
Custom?: React.FC<{
|
|
27
|
-
item: TimelineItemProps;
|
|
28
|
-
}>;
|
|
29
|
-
};
|
|
30
|
-
export declare const Timeline: (props: TimelineProps) => import("react/jsx-runtime").JSX.Element;
|
|
31
|
-
export {};
|
|
32
|
-
//# sourceMappingURL=timeline.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"timeline.d.ts","sourceRoot":"","sources":["../../../src/components/display/timeline.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,QAAA,MAAM,OAAO;;;;cA4B+B,iBAAiB;;CAAI,CAAC;AAElE,MAAM,MAAM,gBAAgB,GAAG,MAAM,OAAO,OAAO,CAAC;AAEpD,MAAM,MAAM,iBAAiB,GAAG;IAC5B,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,EAAE,gBAAgB,CAAC;IACvB,MAAM,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;QAAE,IAAI,EAAE,iBAAiB,CAAA;KAAE,CAAC,CAAC;CAClD,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAAC,MAAM,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;QAAE,IAAI,EAAE,iBAAiB,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC;AAE3G,eAAO,MAAM,QAAQ,UAAW,aAAa,4CAyB5C,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { MessagesSquareIcon } from "lucide-react";
|
|
3
|
-
import { Fragment } from "react";
|
|
4
|
-
const typeMap = {
|
|
5
|
-
tag: () => null,
|
|
6
|
-
custom: () => null,
|
|
7
|
-
record: ({ item }) => {
|
|
8
|
-
var _a, _b, _c, _d;
|
|
9
|
-
return (_jsxs(Fragment, { children: [_jsxs("div", { className: "relative", children: [_jsx("img", { src: (_a = item.avatar) === null || _a === void 0 ? void 0 : _a.img, alt: (_b = item.avatar) === null || _b === void 0 ? void 0 : _b.name, className: "flex aspect-square size-12 items-center justify-center rounded-full bg-primary-hover" }), _jsx("span", { className: "absolute -bottom-0.5 -right-1 rounded-full rounded-tl bg-card-background px-0.5 py-px", children: _jsx(MessagesSquareIcon, { "aria-hidden": "true", className: "aspect-square size-5" }) })] }), _jsxs("div", { className: "min-w-0 flex-1 text-foreground", children: [_jsxs("div", { children: [_jsx("a", { href: (_c = item.avatar) === null || _c === void 0 ? void 0 : _c.profile, className: "text-base font-medium text-primary", children: (_d = item.avatar) === null || _d === void 0 ? void 0 : _d.name }), _jsxs("p", { className: "mt-0.5 text-sm", children: ["Commented ", item.date.toISOString()] })] }), _jsx("div", { className: "mt-2 text-wrap text-sm", children: _jsx("p", { children: item.text }) })] })] }));
|
|
10
|
-
},
|
|
11
|
-
};
|
|
12
|
-
export const Timeline = (props) => {
|
|
13
|
-
return (_jsx("div", { className: "flow-root", children: _jsx("ul", { role: "list", className: "-mb-8", children: props.items.map((item, index) => {
|
|
14
|
-
var _a;
|
|
15
|
-
const Render = (_a = typeMap[item.type]) !== null && _a !== void 0 ? _a : null;
|
|
16
|
-
if (Render === null && props.Custom) {
|
|
17
|
-
return _jsx(props.Custom, { item: item });
|
|
18
|
-
}
|
|
19
|
-
return (_jsx("li", { children: _jsxs("div", { className: "relative pb-8", children: [index !== props.items.length - 1 ? (_jsx("span", { "aria-hidden": "true", className: "absolute left-5 top-5 -ml-px h-full w-0.5 bg-card-border" })) : null, _jsx("div", { className: "relative flex items-start space-x-3", children: _jsx(Render, { item: item }) })] }) }, item.id));
|
|
20
|
-
}) }) }));
|
|
21
|
-
};
|