feat: more atoms styles (#22976)

* feat: availability override classnames

* feat: availability time picker styles

* feat: calendar settings headers styles

* feat: destination and connected calendars

* feat: date override title,description,button

* feat: selected calendars list

* example styles

* docs

* chanegest

* refactor: change import path to relative

* fix: make all classnames optional

* docs: time picker docs

---------

Co-authored-by: Somay Chauhan <[email protected]>
This commit is contained in:
Lauris SkraucisandSomay Chauhan authored and GitHub committed 2025-08-12 21:35:06 +09:00
1 parent 6c6cf0433a
commit abe92cd693
13 files changed
+355 -51

No files matched your search

@@ -68,6 +68,12 @@ export type CustomClassNames = {
subtitlesClassName?: string;
scheduleClassNames?: scheduleClassNames;
overridesModalClassNames?: string;
dateOverrideClassNames?: {
container?: string;
title?: string;
description?: string;
button?: string;
};
hiddenSwitchClassname?: {
container?: string;
thumb?: string;
@@ -180,6 +186,7 @@ const DateOverride = ({
travelSchedules,
weekStart,
overridesModalClassNames,
classNames,
handleSubmit,
}: {
workingHours: WorkingHours[];
@@ -187,6 +194,12 @@ const DateOverride = ({
travelSchedules?: RouterOutputs["viewer"]["travelSchedules"]["get"];
weekStart: 0 | 1 | 2 | 3 | 4 | 5 | 6;
overridesModalClassNames?: string;
classNames?: {
container?: string;
title?: string;
description?: string;
button?: string;
};
handleSubmit: (data: AvailabilityFormValues) => Promise<void>;
}) => {
const { append, replace, fields } = useFieldArray<AvailabilityFormValues, "dateOverrides">({
@@ -202,8 +215,8 @@ const DateOverride = ({
};
return (
<div className="p-6">
<h3 className="text-emphasis font-medium leading-6">
<div className={cn("p-6", classNames?.container)}>
<h3 className={cn("text-emphasis font-medium leading-6", classNames?.title)}>
{t("date_overrides")}{" "}
<Tooltip content={t("date_overrides_info")}>
<span className="inline-block align-middle">
@@ -211,7 +224,9 @@ const DateOverride = ({
</span>
</Tooltip>
</h3>
<p className="text-subtle mb-4 text-sm">{t("date_overrides_subtitle")}</p>
<p className={cn("text-subtle mb-4 text-sm", classNames?.description)}>
{t("date_overrides_subtitle")}
</p>
<div className="space-y-2">
<DateOverrideList
excludedDates={excludedDates}
@@ -235,7 +250,11 @@ const DateOverride = ({
userTimeFormat={userTimeFormat}
weekStart={weekStart}
Trigger={
<Button color="secondary" StartIcon="plus" data-testid="add-override">
<Button
className={classNames?.button}
color="secondary"
StartIcon="plus"
data-testid="add-override">
{t("add_an_override")}
</Button>
}
@@ -318,24 +337,27 @@ export const AvailabilitySettings = forwardRef<AvailabilitySettingsFormRef, Avai
const callbacksRef = useRef<{ onSuccess?: () => void; onError?: (error: Error) => void }>({});
const handleFormSubmit = useCallback((customCallbacks?: { onSuccess?: () => void; onError?: (error: Error) => void }) => {
if (customCallbacks) {
callbacksRef.current = customCallbacks;
}
const handleFormSubmit = useCallback(
(customCallbacks?: { onSuccess?: () => void; onError?: (error: Error) => void }) => {
if (customCallbacks) {
callbacksRef.current = customCallbacks;
}
if (saveButtonRef.current) {
saveButtonRef.current.click();
} else {
form.handleSubmit(async (data) => {
try {
await handleSubmit(data);
callbacksRef.current?.onSuccess?.();
} catch (error) {
callbacksRef.current?.onError?.(error as Error);
}
})();
}
}, [form, handleSubmit]);
if (saveButtonRef.current) {
saveButtonRef.current.click();
} else {
form.handleSubmit(async (data) => {
try {
await handleSubmit(data);
callbacksRef.current?.onSuccess?.();
} catch (error) {
callbacksRef.current?.onError?.(error as Error);
}
})();
}
},
[form, handleSubmit]
);
const validateForm = useCallback(async () => {
const isValid = await form.trigger();
@@ -661,6 +683,7 @@ export const AvailabilitySettings = forwardRef<AvailabilitySettingsFormRef, Avai
) as 0 | 1 | 2 | 3 | 4 | 5 | 6
}
overridesModalClassNames={customClassNames?.overridesModalClassNames}
classNames={customClassNames?.dateOverrideClassNames}
/>
)}
</div>
@@ -28,6 +28,13 @@ export type scheduleClassNames = {
timeRangeField?: string;
labelAndSwitchContainer?: string;
scheduleContainer?: string;
timePicker?: {
container?: string;
valueContainer?: string;
value?: string;
input?: string;
dropdown?: string;
};
};
export type AvailabilityFormValidationResult = {