Skip to content

Commit 08b78c2

Browse files
committed
Reapply changes on top of current master
1 parent c8e6b4a commit 08b78c2

File tree

11 files changed

+47
-28
lines changed

11 files changed

+47
-28
lines changed

src/components/Calendar/Week.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const Week = () => {
3737
}, [startWeekOn]);
3838

3939
return (
40-
<div className="grid grid-cols-7 border-b border-gray-300 dark:border-gray-700 py-2">
40+
<div className="grid grid-cols-7 border-b border-zinc-300 dark:border-zinc-700 py-2">
4141
{DAYS.map(item => (
4242
<div key={item} className="tracking-wide text-gray-500 text-center">
4343
{ucFirst(

src/components/Calendar/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ const Calendar = (props: Props) => {
240240

241241
return (
242242
<div className="w-full md:w-[296px] md:min-w-[296px]">
243-
<div className="flex items-center space-x-1.5 border border-gray-300 dark:border-gray-700 rounded-md px-2 py-1.5">
243+
<div className="flex items-center space-x-1.5 border border-zinc-300 dark:border-zinc-700 rounded-md px-2 py-1.5">
244244
{!showMonths && !showYears && (
245245
<div className="flex-none">
246246
<RoundedButton roundedFull={true} onClick={onClickPrevious}>

src/components/Datepicker.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
START_WEEK
1515
} from "../constants";
1616
import DatepickerContext from "../contexts/DatepickerContext";
17+
import { classNames as cn } from "../helpers";
1718
import useOnClickOutside from "../hooks";
1819
import {
1920
dateFormat,
@@ -47,6 +48,7 @@ const Datepicker = (props: DatepickerType) => {
4748
displayFormat = DATE_FORMAT,
4849

4950
i18n = LANGUAGE,
51+
inline = false,
5052
inputClassName = null,
5153
inputId,
5254
inputName,
@@ -56,7 +58,7 @@ const Datepicker = (props: DatepickerType) => {
5658

5759
onChange,
5860

59-
placeholder = null,
61+
placeholder = undefined,
6062
popupClassName = null,
6163
popoverDirection = undefined,
6264
primaryColor = DEFAULT_COLOR,
@@ -98,7 +100,7 @@ const Datepicker = (props: DatepickerType) => {
98100
// Custom Hooks use
99101
useOnClickOutside(containerRef.current, () => {
100102
const container = containerRef.current;
101-
if (container) {
103+
if (container && !inline) {
102104
hideDatepicker();
103105
}
104106
});
@@ -399,24 +401,26 @@ const Datepicker = (props: DatepickerType) => {
399401
}, [containerClassName]);
400402

401403
const popupClassNameOverload = useMemo(() => {
402-
const defaultPopupClassName =
403-
"transition-all ease-out duration-300 absolute z-10 mt-[1px] text-sm lg:text-xs 2xl:text-sm translate-y-4 opacity-0 hidden";
404+
const defaultPopupClassName = cn(
405+
"transition-all ease-out duration-300 mt-[1px] text-sm lg:text-xs 2xl:text-sm",
406+
!inline && "absolute z-10 translate-y-4 opacity-0 hidden"
407+
);
404408
return typeof popupClassName === "function"
405409
? popupClassName(defaultPopupClassName)
406410
: typeof popupClassName === "string" && popupClassName !== ""
407411
? popupClassName
408412
: defaultPopupClassName;
409-
}, [popupClassName]);
413+
}, [popupClassName, inline]);
410414

411415
return (
412416
<DatepickerContext.Provider value={contextValues}>
413417
<div className={containerClassNameOverload} ref={containerRef}>
414-
<Input />
418+
{!inline && <Input />}
415419

416420
<div className={popupClassNameOverload} ref={calendarContainerRef}>
417-
<Arrow ref={arrowRef} />
421+
{!inline && <Arrow ref={arrowRef} />}
418422

419-
<div className="mt-2.5 shadow-sm border border-gray-300 px-1 py-0.5 bg-white dark:bg-slate-800 dark:text-white dark:border-slate-600 rounded-lg">
423+
<div className="mt-2.5 shadow-sm border border-zinc-300 px-1 py-0.5 bg-white dark:bg-slate-800 dark:text-white dark:border-slate-600 rounded-lg">
420424
<div className="flex flex-col lg:flex-row py-2">
421425
{showShortcuts && <Shortcuts />}
422426

src/components/Footer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const Footer = () => {
1616
return classNames.footer();
1717
}
1818

19-
return "flex items-center justify-end pb-2.5 pt-3 border-t border-gray-300 dark:border-gray-700";
19+
return "flex items-center justify-end pb-2.5 pt-3 border-t border-zinc-300 dark:border-zinc-700";
2020
}, [classNames]);
2121

2222
return (

src/components/Input.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const Input = () => {
5454
const ring =
5555
RING_COLOR["second-focus"][primaryColor as keyof (typeof RING_COLOR)["second-focus"]];
5656

57-
const defaultInputClassName = `relative transition-all duration-300 py-2.5 pl-4 pr-14 w-full border-gray-300 dark:bg-slate-800 dark:text-white/80 dark:border-slate-600 rounded-lg tracking-wide font-light text-sm placeholder-gray-400 bg-white focus:ring disabled:opacity-40 disabled:cursor-not-allowed ${border} ${ring}`;
57+
const defaultInputClassName = `relative transition-all duration-300 py-2.5 pl-4 pr-14 w-full border-zinc-300 dark:bg-slate-800 dark:text-white/80 dark:border-slate-600 rounded-lg tracking-wide font-light text-sm placeholder-gray-400 bg-white focus:ring disabled:opacity-40 disabled:cursor-not-allowed ${border} ${ring}`;
5858

5959
return typeof inputClassName === "function"
6060
? inputClassName(defaultInputClassName)

src/components/SecondaryButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const SecondaryButton = (props: ButtonProps) => {
1313
// Functions
1414
const getClassName: () => string = useCallback(() => {
1515
const ringColor = RING_COLOR.focus[primaryColor as keyof typeof RING_COLOR.focus];
16-
return `w-full transition-all duration-300 bg-white dark:text-gray-700 font-medium border border-gray-300 px-4 py-2 text-sm rounded-md focus:ring-2 focus:ring-offset-2 hover:bg-gray-50 ${ringColor}`;
16+
return `w-full transition-all duration-300 bg-white dark:text-gray-700 font-medium border border-zinc-300 px-4 py-2 text-sm rounded-md focus:ring-2 focus:ring-offset-2 hover:bg-gray-50 ${ringColor}`;
1717
}, [primaryColor]);
1818

1919
return (

src/components/Shortcuts.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ const Shortcuts = () => {
136136
}, []);
137137

138138
return shortcutOptions?.length ? (
139-
<div className="md:border-b mb-3 lg:mb-0 lg:border-r lg:border-b-0 border-gray-300 dark:border-gray-700 pr-1">
139+
<div className="md:border-b mb-3 lg:mb-0 lg:border-r lg:border-b-0 border-zinc-300 dark:border-zinc-700 pr-1">
140140
<ul className="w-full tracking-wide flex flex-wrap lg:flex-col pb-1 lg:pb-0">
141141
{shortcutOptions.map(([key, item], index) =>
142142
Array.isArray(item) ? (

src/components/icons/Arrow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const Arrow = forwardRef<HTMLDivElement, Props>((props, ref) => {
99
<div
1010
{...props}
1111
ref={ref}
12-
className="absolute z-20 h-4 w-4 rotate-45 mt-0.5 ml-[1.2rem] border-l border-t border-gray-300 bg-white dark:bg-slate-800 dark:border-slate-600"
12+
className="absolute z-20 h-4 w-4 rotate-45 mt-0.5 ml-[1.2rem] border-l border-t border-zinc-300 bg-white dark:bg-slate-800 dark:border-slate-600"
1313
/>
1414
);
1515
});

src/constants/index.ts

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ export const COLORS = [
1818
"purple",
1919
"fuchsia",
2020
"pink",
21-
"rose"
21+
"rose",
22+
"zinc"
2223
] as const;
2324

2425
export const DEFAULT_COLOR: ColorKeys = "blue";
@@ -59,7 +60,8 @@ export const BG_COLOR: Colors = {
5960
violet: "bg-violet-100",
6061
fuchsia: "bg-fuchsia-100",
6162
pink: "bg-pink-100",
62-
rose: "bg-rose-100"
63+
rose: "bg-rose-100",
64+
zinc: "bg-zinc-100"
6365
},
6466
200: {
6567
blue: "bg-blue-200",
@@ -78,7 +80,8 @@ export const BG_COLOR: Colors = {
7880
violet: "bg-violet-200",
7981
fuchsia: "bg-fuchsia-200",
8082
pink: "bg-pink-200",
81-
rose: "bg-rose-200"
83+
rose: "bg-rose-200",
84+
zinc: "bg-zinc-200"
8285
},
8386
500: {
8487
blue: "bg-blue-500",
@@ -97,7 +100,8 @@ export const BG_COLOR: Colors = {
97100
violet: "bg-violet-500",
98101
fuchsia: "bg-fuchsia-500",
99102
pink: "bg-pink-500",
100-
rose: "bg-rose-500"
103+
rose: "bg-rose-500",
104+
zinc: "bg-zinc-500"
101105
},
102106
hover: {
103107
blue: "hover:bg-blue-600",
@@ -116,7 +120,8 @@ export const BG_COLOR: Colors = {
116120
violet: "hover:bg-violet-600",
117121
fuchsia: "hover:bg-fuchsia-600",
118122
pink: "hover:bg-pink-600",
119-
rose: "hover:bg-rose-600"
123+
rose: "hover:bg-rose-600",
124+
zinc: "hover:bg-zinc-600"
120125
}
121126
};
122127

@@ -138,7 +143,8 @@ export const TEXT_COLOR: Colors = {
138143
violet: "text-violet-500",
139144
fuchsia: "text-fuchsia-500",
140145
pink: "text-pink-500",
141-
rose: "text-rose-500"
146+
rose: "text-rose-500",
147+
zinc: "text-zinc-500"
142148
},
143149
600: {
144150
blue: "text-blue-600 dark:text-blue-400 dark:hover:text-blue-400",
@@ -157,7 +163,8 @@ export const TEXT_COLOR: Colors = {
157163
violet: "text-violet-600 dark:text-violet-400 dark:hover:text-violet-400",
158164
fuchsia: "text-fuchsia-600 dark:text-fuchsia-400 dark:hover:text-fuchsia-400",
159165
pink: "text-pink-600 dark:text-pink-400 dark:hover:text-pink-400",
160-
rose: "text-rose-600 dark:text-rose-400 dark:hover:text-rose-400"
166+
rose: "text-rose-600 dark:text-rose-400 dark:hover:text-rose-400",
167+
zinc: "text-zinc-600 dark:text-zinc-400 dark:hover:text-zinc-400"
161168
},
162169
hover: {
163170
blue: "hover:text-blue-700",
@@ -176,7 +183,8 @@ export const TEXT_COLOR: Colors = {
176183
violet: "hover:text-violet-700",
177184
fuchsia: "hover:text-fuchsia-700",
178185
pink: "hover:text-pink-700",
179-
rose: "hover:text-rose-700"
186+
rose: "hover:text-rose-700",
187+
zinc: "hover:text-zinc-700"
180188
}
181189
};
182190

@@ -198,7 +206,8 @@ export const BORDER_COLOR: Colors = {
198206
violet: "border-violet-500",
199207
fuchsia: "border-fuchsia-500",
200208
pink: "border-pink-500",
201-
rose: "border-rose-500"
209+
rose: "border-rose-500",
210+
zinc: "border-zinc-500"
202211
},
203212
focus: {
204213
blue: "focus:border-blue-500",
@@ -217,7 +226,8 @@ export const BORDER_COLOR: Colors = {
217226
violet: "focus:border-violet-500",
218227
fuchsia: "focus:border-fuchsia-500",
219228
pink: "focus:border-pink-500",
220-
rose: "focus:border-rose-500"
229+
rose: "focus:border-rose-500",
230+
zinc: "focus:border-zinc-500"
221231
}
222232
};
223233

@@ -239,7 +249,8 @@ export const RING_COLOR: Colors = {
239249
violet: "focus:ring-violet-500",
240250
fuchsia: "focus:ring-fuchsia-500",
241251
pink: "focus:ring-pink-500",
242-
rose: "focus:ring-rose-500"
252+
rose: "focus:ring-rose-500",
253+
zinc: "focus:ring-zinc-500"
243254
},
244255
"second-focus": {
245256
blue: "focus:ring-blue-500/20",
@@ -258,7 +269,8 @@ export const RING_COLOR: Colors = {
258269
violet: "focus:ring-violet-500/20",
259270
fuchsia: "focus:ring-fuchsia-500/20",
260271
pink: "focus:ring-pink-500/20",
261-
rose: "focus:ring-rose-500/20"
272+
rose: "focus:ring-rose-500/20",
273+
zinc: "focus:ring-zinc-500/20"
262274
}
263275
};
264276

@@ -280,6 +292,7 @@ export const BUTTON_COLOR: Colors = {
280292
violet: "focus:ring-violet-500/50 focus:bg-violet-100/50",
281293
fuchsia: "focus:ring-fuchsia-500/50 focus:bg-fuchsia-100/50",
282294
pink: "focus:ring-pink-500/50 focus:bg-pink-100/50",
283-
rose: "focus:ring-rose-500/50 focus:bg-rose-100/50"
295+
rose: "focus:ring-rose-500/50 focus:bg-rose-100/50",
296+
zinc: "focus:ring-zinc-500/50 focus:bg-zinc-100/50"
284297
}
285298
};

src/types/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ export interface DatepickerType {
9292
startWeekOn?: WeekStringType;
9393
popoverDirection?: PopoverDirectionType;
9494
required?: boolean;
95+
inline?: boolean;
9596
}
9697

9798
export type ColorKeys = (typeof COLORS)[number]; // "blue" | "orange"

0 commit comments

Comments
 (0)