aplance-ui 1.0.1
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/LICENSE +21 -0
- package/README.md +29 -0
- package/dist/api.d.ts +175 -0
- package/dist/api.js +1954 -0
- package/dist/api.js.map +1 -0
- package/dist/frameworks/astro/astro.config.snippet.md +23 -0
- package/dist/frameworks/astro/postcss.config.mjs.template +20 -0
- package/dist/frameworks/astro/vite-inline.snippet.md +22 -0
- package/dist/frameworks/electron-vite/vite.config.snippet.md +44 -0
- package/dist/frameworks/next/layout-import.snippet.md +19 -0
- package/dist/frameworks/next/next.config.snippet.md +15 -0
- package/dist/frameworks/next/postcss.config.js.template +16 -0
- package/dist/frameworks/tanstack-start/postcss.config.ts.template +17 -0
- package/dist/frameworks/tanstack-start/vite-inline.snippet.md +22 -0
- package/dist/frameworks/vite-react/postcss.config.ts.template +16 -0
- package/dist/frameworks/vite-react/vite-inline.snippet.md +20 -0
- package/dist/frameworks/vite-react/vite.config.ts.template +48 -0
- package/dist/index.js +2047 -0
- package/dist/index.js.map +1 -0
- package/package.json +63 -0
- package/registry/components/primitives/icon/icon.module.css +63 -0
- package/registry/components/primitives/icon/icon.tsx +53 -0
- package/registry/components/primitives/modal/modal-context.ts +19 -0
- package/registry/components/primitives/modal/modal.module.css +415 -0
- package/registry/components/primitives/modal/modal.tsx +550 -0
- package/registry/components/primitives/popover/popover-context.ts +28 -0
- package/registry/components/primitives/popover/popover.module.css +28 -0
- package/registry/components/primitives/popover/popover.tsx +465 -0
- package/registry/components/ui/accordion/accordion.module.css +208 -0
- package/registry/components/ui/accordion/accordion.tsx +327 -0
- package/registry/components/ui/avatar/avatar.module.css +32 -0
- package/registry/components/ui/avatar/avatar.tsx +37 -0
- package/registry/components/ui/badge/badge.module.css +103 -0
- package/registry/components/ui/badge/badge.tsx +29 -0
- package/registry/components/ui/button/button.module.css +216 -0
- package/registry/components/ui/button/button.tsx +133 -0
- package/registry/components/ui/chart/chart.module.css +168 -0
- package/registry/components/ui/chart/chart.tsx +1293 -0
- package/registry/components/ui/chart/types.ts +210 -0
- package/registry/components/ui/chart/utils.ts +59 -0
- package/registry/components/ui/copy-button/copy-button.module.css +21 -0
- package/registry/components/ui/copy-button/copy-button.tsx +123 -0
- package/registry/components/ui/countdown/countdown.module.css +5 -0
- package/registry/components/ui/countdown/countdown.tsx +152 -0
- package/registry/components/ui/data-table/checkbox-column.tsx +59 -0
- package/registry/components/ui/data-table/data-table.module.css +594 -0
- package/registry/components/ui/data-table/data-table.tsx +1109 -0
- package/registry/components/ui/data-table/filter-bar.tsx +33 -0
- package/registry/components/ui/data-table/pagination-bar.tsx +125 -0
- package/registry/components/ui/data-table/types.ts +594 -0
- package/registry/components/ui/data-table/useDataTable.tsx +573 -0
- package/registry/components/ui/data-table/utils.ts +445 -0
- package/registry/components/ui/empty-state/empty-state.module.css +26 -0
- package/registry/components/ui/empty-state/empty-state.tsx +32 -0
- package/registry/components/ui/input-fields/color-picker/color-palette.module.css +102 -0
- package/registry/components/ui/input-fields/color-picker/color-palette.tsx +92 -0
- package/registry/components/ui/input-fields/color-picker/color-picker.module.css +29 -0
- package/registry/components/ui/input-fields/color-picker/color-picker.tsx +168 -0
- package/registry/components/ui/input-fields/common/field-message/field-message.module.css +28 -0
- package/registry/components/ui/input-fields/common/field-message/field-message.tsx +39 -0
- package/registry/components/ui/input-fields/common/input-field-common.module.css +318 -0
- package/registry/components/ui/input-fields/common/input-field-native.module.css +267 -0
- package/registry/components/ui/input-fields/common/picker-popover-common.module.css +40 -0
- package/registry/components/ui/input-fields/common/select-button/select-button.module.css +9 -0
- package/registry/components/ui/input-fields/common/select-button/select-button.tsx +171 -0
- package/registry/components/ui/input-fields/common/types.ts +38 -0
- package/registry/components/ui/input-fields/custom-select/custom-select.module.css +56 -0
- package/registry/components/ui/input-fields/custom-select/custom-select.tsx +403 -0
- package/registry/components/ui/input-fields/date-picker/calendar.module.css +311 -0
- package/registry/components/ui/input-fields/date-picker/calendar.tsx +186 -0
- package/registry/components/ui/input-fields/date-picker/date-picker.module.css +57 -0
- package/registry/components/ui/input-fields/date-picker/date-picker.tsx +945 -0
- package/registry/components/ui/input-fields/date-picker/types.ts +102 -0
- package/registry/components/ui/input-fields/date-picker/utils.ts +236 -0
- package/registry/components/ui/input-fields/emoji-picker/emoji-palette.module.css +90 -0
- package/registry/components/ui/input-fields/emoji-picker/emoji-palette.tsx +168 -0
- package/registry/components/ui/input-fields/emoji-picker/emoji-picker.module.css +8 -0
- package/registry/components/ui/input-fields/emoji-picker/emoji-picker.tsx +102 -0
- package/registry/components/ui/input-fields/emoji-picker/utils.ts +505 -0
- package/registry/components/ui/input-fields/field-group/field-group.module.css +86 -0
- package/registry/components/ui/input-fields/field-group/field-group.tsx +86 -0
- package/registry/components/ui/input-fields/input/input.tsx +319 -0
- package/registry/components/ui/input-fields/media-input/kind-icons.tsx +62 -0
- package/registry/components/ui/input-fields/media-input/media-input.module.css +294 -0
- package/registry/components/ui/input-fields/media-input/media-input.tsx +327 -0
- package/registry/components/ui/input-fields/media-input/media-preview.tsx +101 -0
- package/registry/components/ui/input-fields/media-input/types.ts +129 -0
- package/registry/components/ui/input-fields/media-input/useMediaUpload.tsx +302 -0
- package/registry/components/ui/input-fields/media-input/utils.ts +325 -0
- package/registry/components/ui/input-fields/otp-input/otp-input.module.css +24 -0
- package/registry/components/ui/input-fields/otp-input/otp-input.tsx +291 -0
- package/registry/components/ui/input-fields/select/select.tsx +118 -0
- package/registry/components/ui/input-fields/switch/switch.module.css +70 -0
- package/registry/components/ui/input-fields/switch/switch.tsx +59 -0
- package/registry/components/ui/input-fields/textarea/textarea.tsx +133 -0
- package/registry/components/ui/input-fields/time-picker/time-picker.module.css +57 -0
- package/registry/components/ui/input-fields/time-picker/time-picker.tsx +437 -0
- package/registry/components/ui/loader/loader.module.css +156 -0
- package/registry/components/ui/loader/loader.tsx +102 -0
- package/registry/components/ui/stepper/stepper.module.css +294 -0
- package/registry/components/ui/stepper/stepper.tsx +197 -0
- package/registry/components/ui/tabs/tabs.module.css +150 -0
- package/registry/components/ui/tabs/tabs.tsx +134 -0
- package/registry/components/ui/toast/toast.module.css +159 -0
- package/registry/components/ui/toast/toast.tsx +104 -0
- package/registry/components/ui/tooltip/tooltip.module.css +82 -0
- package/registry/components/ui/tooltip/tooltip.tsx +72 -0
- package/registry/global.d.ts +4 -0
- package/registry/hooks/useFocusOutside.tsx +33 -0
- package/registry/hooks/useResizeObserver.tsx +32 -0
- package/registry/lib/dom.ts +25 -0
- package/registry/lib/string.ts +23 -0
- package/registry/registry.json +719 -0
- package/registry/styles/app.css +240 -0
- package/registry/styles/components.css +78 -0
- package/registry/styles/fonts/geist-regular.woff2 +0 -0
- package/registry/styles/globals.css +7 -0
- package/registry/styles/media.css +25 -0
- package/registry/styles/utilities.css +90 -0
- package/registry/themes/colors/blue.css +37 -0
- package/registry/themes/colors/green.css +37 -0
- package/registry/themes/colors/rose.css +37 -0
- package/registry/themes/colors/slate.css +37 -0
- package/registry/themes/colors/stone.css +37 -0
- package/registry/themes/colors/violet.css +37 -0
- package/registry/themes/colors/zinc.css +37 -0
- package/registry/themes/radius/pill.css +8 -0
- package/registry/themes/radius/rounded.css +8 -0
- package/registry/themes/radius/sharp.css +8 -0
- package/registry/themes/spacing/compact.css +17 -0
- package/registry/themes/spacing/spacious.css +17 -0
- package/registry/tsconfig.json +25 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import type { ChangeEvent, ComponentProps } from "react";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import {
|
|
4
|
+
IconChevronDown,
|
|
5
|
+
IconChevronLeft,
|
|
6
|
+
IconChevronRight,
|
|
7
|
+
} from "@tabler/icons-react";
|
|
8
|
+
import {
|
|
9
|
+
DayPicker,
|
|
10
|
+
getDefaultClassNames,
|
|
11
|
+
type ClassNames,
|
|
12
|
+
type DayPickerProps,
|
|
13
|
+
} from "react-day-picker";
|
|
14
|
+
import { CustomSelect } from "../custom-select/custom-select";
|
|
15
|
+
import sButton from "../../button/button.module.css";
|
|
16
|
+
import s from "./calendar.module.css";
|
|
17
|
+
|
|
18
|
+
export type CalendarProps = DayPickerProps & {
|
|
19
|
+
className?: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
type ChevronOrientation = "up" | "down" | "left" | "right";
|
|
23
|
+
|
|
24
|
+
type CalendarChevronProps = {
|
|
25
|
+
className?: string;
|
|
26
|
+
size?: number;
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
orientation?: ChevronOrientation;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
type CalendarDropdownOption = {
|
|
32
|
+
value: number;
|
|
33
|
+
label: string;
|
|
34
|
+
disabled: boolean;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
type CalendarDropdownProps = Omit<ComponentProps<"select">, "children"> & {
|
|
38
|
+
options?: CalendarDropdownOption[];
|
|
39
|
+
classNames: ClassNames;
|
|
40
|
+
components: unknown;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const renderDropdown = ({
|
|
44
|
+
options,
|
|
45
|
+
value,
|
|
46
|
+
disabled,
|
|
47
|
+
onChange,
|
|
48
|
+
className,
|
|
49
|
+
}: CalendarDropdownProps) => {
|
|
50
|
+
const resolvedValue =
|
|
51
|
+
typeof value === "number" || typeof value === "string"
|
|
52
|
+
? String(value)
|
|
53
|
+
: "";
|
|
54
|
+
|
|
55
|
+
const isYearDropdown = (options?.[0]?.value ?? 0) > 31;
|
|
56
|
+
|
|
57
|
+
const mappedOptions = (options ?? []).map((option) => ({
|
|
58
|
+
value: String(option.value),
|
|
59
|
+
label: option.label,
|
|
60
|
+
optionButtonVariant: "ghost" as const,
|
|
61
|
+
optionClassName: s.dropdown_option,
|
|
62
|
+
disabled: option.disabled,
|
|
63
|
+
}));
|
|
64
|
+
|
|
65
|
+
const orderedOptions = isYearDropdown
|
|
66
|
+
? [...mappedOptions].reverse()
|
|
67
|
+
: mappedOptions;
|
|
68
|
+
|
|
69
|
+
const handleChange = (nextValue: string | string[]) => {
|
|
70
|
+
if (!onChange) return;
|
|
71
|
+
const resolvedNext = Array.isArray(nextValue)
|
|
72
|
+
? (nextValue[0] ?? "")
|
|
73
|
+
: nextValue;
|
|
74
|
+
|
|
75
|
+
const event = {
|
|
76
|
+
target: { value: resolvedNext },
|
|
77
|
+
currentTarget: { value: resolvedNext },
|
|
78
|
+
} as ChangeEvent<HTMLSelectElement>;
|
|
79
|
+
|
|
80
|
+
onChange(event);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<CustomSelect
|
|
85
|
+
className={s.dropdown_field}
|
|
86
|
+
options={orderedOptions}
|
|
87
|
+
value={resolvedValue}
|
|
88
|
+
onChange={handleChange}
|
|
89
|
+
disabled={disabled}
|
|
90
|
+
closeOnPathChange={false}
|
|
91
|
+
searchable={false}
|
|
92
|
+
showDisplayIcon={false}
|
|
93
|
+
selectButton={{
|
|
94
|
+
buttonVariant: "none",
|
|
95
|
+
className: clsx(s.dropdown_select_button, className),
|
|
96
|
+
showChevron: true,
|
|
97
|
+
showClear: false,
|
|
98
|
+
}}
|
|
99
|
+
popover={{
|
|
100
|
+
renderOnPortal: false,
|
|
101
|
+
closeOnPathChange: false,
|
|
102
|
+
closeOnClickOutside: true,
|
|
103
|
+
position: "bottom",
|
|
104
|
+
align: "start",
|
|
105
|
+
offset: 2,
|
|
106
|
+
}}
|
|
107
|
+
popoverMenu={{ className: s.dropdown_menu }}
|
|
108
|
+
optionsContainerClassName={s.dropdown_options}
|
|
109
|
+
/>
|
|
110
|
+
);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const moduleClassNames: Partial<ClassNames> = {
|
|
114
|
+
root: s.root,
|
|
115
|
+
months: s.months,
|
|
116
|
+
month: s.month,
|
|
117
|
+
nav: s.nav,
|
|
118
|
+
button_previous: clsx(sButton.base, sButton.box, sButton.sm, sButton.ghost),
|
|
119
|
+
button_next: clsx(sButton.base, sButton.box, sButton.sm, sButton.ghost),
|
|
120
|
+
month_caption: s.month_caption,
|
|
121
|
+
caption_label: s.caption_label,
|
|
122
|
+
dropdowns: s.dropdowns,
|
|
123
|
+
dropdown_root: s.dropdown_root,
|
|
124
|
+
dropdown: s.dropdown,
|
|
125
|
+
month_grid: s.month_grid,
|
|
126
|
+
weekdays: s.weekdays,
|
|
127
|
+
weekday: s.weekday,
|
|
128
|
+
weeks: s.weeks,
|
|
129
|
+
week: s.week,
|
|
130
|
+
week_number: s.week_number,
|
|
131
|
+
week_number_header: s.week_number_header,
|
|
132
|
+
day: s.day,
|
|
133
|
+
day_button: s.day_button,
|
|
134
|
+
selected: s.selected,
|
|
135
|
+
range_start: s.range_start,
|
|
136
|
+
range_middle: s.range_middle,
|
|
137
|
+
range_end: s.range_end,
|
|
138
|
+
today: s.today,
|
|
139
|
+
outside: s.outside,
|
|
140
|
+
disabled: s.day_disabled,
|
|
141
|
+
hidden: s.hidden,
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const renderChevron = ({
|
|
145
|
+
orientation,
|
|
146
|
+
className,
|
|
147
|
+
...rest
|
|
148
|
+
}: CalendarChevronProps) => {
|
|
149
|
+
if (orientation === "left") {
|
|
150
|
+
return <IconChevronLeft className={clsx(s.chevron, className)} {...rest} />;
|
|
151
|
+
}
|
|
152
|
+
if (orientation === "right") {
|
|
153
|
+
return <IconChevronRight className={clsx(s.chevron, className)} {...rest} />;
|
|
154
|
+
}
|
|
155
|
+
return <IconChevronDown className={clsx(s.chevron, className)} {...rest} />;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const defaultClassNames = getDefaultClassNames();
|
|
159
|
+
|
|
160
|
+
export const Calendar = ({
|
|
161
|
+
className,
|
|
162
|
+
classNames,
|
|
163
|
+
showOutsideDays = true,
|
|
164
|
+
captionLayout = "label",
|
|
165
|
+
components,
|
|
166
|
+
...props
|
|
167
|
+
}: CalendarProps) => {
|
|
168
|
+
return (
|
|
169
|
+
<DayPicker
|
|
170
|
+
showOutsideDays={showOutsideDays}
|
|
171
|
+
captionLayout={captionLayout}
|
|
172
|
+
className={clsx(s.calendar, className)}
|
|
173
|
+
classNames={{
|
|
174
|
+
...defaultClassNames,
|
|
175
|
+
...moduleClassNames,
|
|
176
|
+
...classNames,
|
|
177
|
+
}}
|
|
178
|
+
components={{
|
|
179
|
+
Chevron: renderChevron,
|
|
180
|
+
Dropdown: renderDropdown,
|
|
181
|
+
...components,
|
|
182
|
+
}}
|
|
183
|
+
{...props}
|
|
184
|
+
/>
|
|
185
|
+
);
|
|
186
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/* date-picker.module.css – clean, premium layout with no hacks */
|
|
2
|
+
.popover_menu {
|
|
3
|
+
max-width: calc(100vw - var(--spacing-11)) !important;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.menu_content {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.manual_panel {
|
|
12
|
+
padding: var(--spacing-4);
|
|
13
|
+
border-bottom: var(--border-1) solid var(--color-border);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.manual_grid {
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: row;
|
|
19
|
+
gap: var(--spacing-4);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.calendar_wrap {
|
|
23
|
+
display: flex;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
padding: var(--spacing-4);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.range_calendars {
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: flex-start;
|
|
31
|
+
gap: var(--spacing-4);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@media (width <= 48rem) {
|
|
35
|
+
.range_calendars {
|
|
36
|
+
flex-direction: column;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.calendar {
|
|
41
|
+
width: fit-content;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.time_panel {
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
gap: var(--spacing-3);
|
|
48
|
+
padding: var(--spacing-4);
|
|
49
|
+
border-top: var(--border-1) solid var(--color-border);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.range_time_grid {
|
|
53
|
+
display: grid;
|
|
54
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
55
|
+
gap: var(--spacing-4);
|
|
56
|
+
}
|
|
57
|
+
|