@@ -218,7 +218,7 @@ const DatePicker = ( {
width="w-auto"
numberOfMonths={ 2 }
footer={
-
+
);
@@ -287,16 +291,18 @@ export const Tab = forwardRef
[(
};
return (
-
{ activeItem === slug && variant === 'underline' && (
) }
@@ -314,7 +320,7 @@ export const Tab = forwardRef][(
) }
{ badge && isValidElement( badge ) && badge }
- ]
+
);
}
);
From 03cebf3975aabffd39a21193a28df037f2eda298 Mon Sep 17 00:00:00 2001
From: Jaied Al Sabid <87969327+jaieds@users.noreply.github.com>
Date: Tue, 17 Dec 2024 12:53:40 +0600
Subject: [PATCH 10/15] chore: Lint
---
src/components/datepicker/datepicker-component.tsx | 11 ++++++++---
src/components/menu-item/menu-item.tsx | 4 +++-
src/components/switch/switch.tsx | 6 ++++--
3 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/src/components/datepicker/datepicker-component.tsx b/src/components/datepicker/datepicker-component.tsx
index 2b45c9e3..4c45f865 100644
--- a/src/components/datepicker/datepicker-component.tsx
+++ b/src/components/datepicker/datepicker-component.tsx
@@ -204,7 +204,9 @@ const DatePickerComponent = ( {
onClick={ handlePrevButtonClick }
className="bg-background-primary border-none cursor-pointer"
aria-label="Previous Button"
- icon={ }
+ icon={
+
+ }
/>
}
+ icon={
+
+ }
/>
@@ -289,7 +293,8 @@ const DatePickerComponent = ( {
new Date().getFullYear() &&
'bg-background-brand text-text-on-color hover:bg-background-brand hover:text-black',
monthIndex === new Date().getMonth() &&
- new Date().getFullYear() === selectedYear &&
+ new Date().getFullYear() ===
+ selectedYear &&
'font-semibold'
) }
>
diff --git a/src/components/menu-item/menu-item.tsx b/src/components/menu-item/menu-item.tsx
index ca99586b..b43570ec 100644
--- a/src/components/menu-item/menu-item.tsx
+++ b/src/components/menu-item/menu-item.tsx
@@ -140,7 +140,9 @@ export const MenuList = ( {
animate={ isOpen ? 'open' : 'closed' }
transition={ { duration: 0.15 } }
>
-
+
) }
diff --git a/src/components/switch/switch.tsx b/src/components/switch/switch.tsx
index 9dec578c..b1d813fd 100644
--- a/src/components/switch/switch.tsx
+++ b/src/components/switch/switch.tsx
@@ -176,11 +176,13 @@ export const SwitchComponent = (
const sizeClassNames = {
md: {
container: 'w-11 h-6',
- toggleDial: 'size-4 peer-checked:translate-x-5 group-hover/switch:size-5 group-focus-within/switch:size-5 group-focus-within/switch:left-0.5 group-hover/switch:left-0.5',
+ toggleDial:
+ 'size-4 peer-checked:translate-x-5 group-hover/switch:size-5 group-focus-within/switch:size-5 group-focus-within/switch:left-0.5 group-hover/switch:left-0.5',
},
sm: {
container: 'w-10 h-5',
- toggleDial: 'size-3 peer-checked:translate-x-5 group-hover/switch:size-4 group-focus-within/switch:size-4 group-focus-within/switch:left-0.5 group-hover/switch:left-0.5',
+ toggleDial:
+ 'size-3 peer-checked:translate-x-5 group-hover/switch:size-4 group-focus-within/switch:size-4 group-focus-within/switch:left-0.5 group-hover/switch:left-0.5',
},
};
From 7f57a08eede1185d1741fabf99be48b8c13c8b95 Mon Sep 17 00:00:00 2001
From: Jaied Al Sabid <87969327+jaieds@users.noreply.github.com>
Date: Tue, 17 Dec 2024 13:05:18 +0600
Subject: [PATCH 11/15] fix: Switch component label and description
font styles
---
src/components/switch/switch.tsx | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/components/switch/switch.tsx b/src/components/switch/switch.tsx
index b1d813fd..8261c3e7 100644
--- a/src/components/switch/switch.tsx
+++ b/src/components/switch/switch.tsx
@@ -61,8 +61,12 @@ export const SwitchLabel = ( {
size: 'sm' | 'md';
} ) => {
const headingClasses = {
- sm: 'text-sm leading-4 font-medium',
- md: 'text-base leading-5 font-medium',
+ sm: 'text-sm leading-5 font-medium',
+ md: 'text-base leading-6 font-medium',
+ };
+ const descriptionClasses = {
+ sm: 'text-xs leading-4 font-normal',
+ md: 'text-sm leading-5 font-normal',
};
const isLabelAComponent = isValidElement( label );
if ( isLabelAComponent ) {
@@ -78,11 +82,11 @@ export const SwitchLabel = ( {
const renderLabel = () => {
const { heading = '', description = '' } = label || {};
return (
-
+
{ heading && (
{ description }
From d14d267e96cc3fc6cd9fbd8b1462ec31950eb54f Mon Sep 17 00:00:00 2001
From: Jaied Al Sabid <87969327+jaieds@users.noreply.github.com>
Date: Tue, 17 Dec 2024 13:10:36 +0600
Subject: [PATCH 12/15] Removed backdrop blur
---
src/components/dialog/dialog.tsx | 2 +-
src/components/drawer/drawer-backdrop.tsx | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/components/dialog/dialog.tsx b/src/components/dialog/dialog.tsx
index d16ec404..5a193e3b 100644
--- a/src/components/dialog/dialog.tsx
+++ b/src/components/dialog/dialog.tsx
@@ -261,7 +261,7 @@ export const DialogBackdrop = ( {
{ open && (
{
{ open && (
Date: Tue, 17 Dec 2024 13:22:14 +0600
Subject: [PATCH 13/15] fix: Error
---
.../admin-settings-Spectra.stories.jsx | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/templates/admin-settings-Spectra/admin-settings-Spectra.stories.jsx b/src/templates/admin-settings-Spectra/admin-settings-Spectra.stories.jsx
index 19f4f61a..b9d628f5 100644
--- a/src/templates/admin-settings-Spectra/admin-settings-Spectra.stories.jsx
+++ b/src/templates/admin-settings-Spectra/admin-settings-Spectra.stories.jsx
@@ -452,7 +452,7 @@ const Template = ( args ) => {
@@ -485,7 +485,7 @@ const Template = ( args ) => {
@@ -518,7 +518,7 @@ const Template = ( args ) => {
@@ -552,7 +552,7 @@ const Template = ( args ) => {
@@ -585,7 +585,7 @@ const Template = ( args ) => {
From e8ba99a659cd8188b54acede913df915ab477753 Mon Sep 17 00:00:00 2001
From: Jaied Al Sabid <87969327+jaieds@users.noreply.github.com>
Date: Tue, 17 Dec 2024 13:40:21 +0600
Subject: [PATCH 14/15] Added backward compatibility support
---
src/components/switch/switch.tsx | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/components/switch/switch.tsx b/src/components/switch/switch.tsx
index 8261c3e7..98cf1524 100644
--- a/src/components/switch/switch.tsx
+++ b/src/components/switch/switch.tsx
@@ -145,6 +145,9 @@ export const SwitchComponent = (
}: SwitchProps,
ref: React.ForwardedRef
) => {
+ // For backwards compatibility.
+ const normalSize = ( size as 'sm' | 'md' | 'lg' ) === 'lg' ? 'md' : size;
+
const isControlled = useMemo( () => typeof value !== 'undefined', [ value ] );
const switchId = useMemo( () => ( id ? id : `switch-${ nanoid() }` ), [] );
const [ checked, setChecked ] = useState( defaultValue );
@@ -201,12 +204,12 @@ export const SwitchComponent = (
label={ label }
switchId={ switchId }
disabled={ disabled }
- size={ size }
+ size={ normalSize }
>
@@ -229,7 +232,7 @@ export const SwitchComponent = (
htmlFor={ switchId }
className={ cn(
"bg-white border rounded-full absolute cursor-pointer shadow-md before:content[''] before:transition-opacity before:opacity-0 hover:before:opacity-10 before:hidden border-none transition-all duration-300 top-2/4 left-1 -translate-y-2/4 before:w-10 before:h-10 before:rounded-full before:absolute before:top-2/4 before:left-2/4 before:-translate-y-2/4 before:-translate-x-2/4",
- sizeClassNames[ size ].toggleDial,
+ sizeClassNames[ normalSize ].toggleDial,
colorClassNames[ color ].toggleDial,
disabled && disabledClassNames.toggleDial
) }
From 0f574376a820609c6232dbbc4f9aae7d3cbca964 Mon Sep 17 00:00:00 2001
From: Jaied Al Sabid <87969327+jaieds@users.noreply.github.com>
Date: Tue, 17 Dec 2024 14:03:01 +0600
Subject: [PATCH 15/15] Updated gap between switch label and description
---
src/components/switch/switch.tsx | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/components/switch/switch.tsx b/src/components/switch/switch.tsx
index 98cf1524..f969adff 100644
--- a/src/components/switch/switch.tsx
+++ b/src/components/switch/switch.tsx
@@ -68,6 +68,10 @@ export const SwitchLabel = ( {
sm: 'text-xs leading-4 font-normal',
md: 'text-sm leading-5 font-normal',
};
+ const gapClassNames = {
+ sm: 'space-y-0.5',
+ md: 'space-y-1',
+ };
const isLabelAComponent = isValidElement( label );
if ( isLabelAComponent ) {
return (
@@ -82,7 +86,7 @@ export const SwitchLabel = ( {
const renderLabel = () => {
const { heading = '', description = '' } = label || {};
return (
-