diff --git a/changelog.txt b/changelog.txt index f0bb6ea7..32e30e00 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,7 +1,11 @@ -Version 1.4.2 - 4th March, 2025 +Version 1.4.2 - 6th March, 2025 +- New - Added new size 'xs' to the Switch component. - Improvement - Adjusted the ring width and padding of the Radio Button component. - Improvement - Added shadow to the disabled switch component for better visual consistency. - Improvement - Add box-shadow to the Button component. +- Improvement - Update destructive button ring color. +- Fixed - Undefined JSX error when @wordpress/scripts version is above 28. +- Fixed - Tree shaking not working. Version 1.4.1 - 10th February, 2025 - Improvement - Show active preset with background color in the DatePicker component. diff --git a/package.json b/package.json index 2863dab2..f5610754 100644 --- a/package.json +++ b/package.json @@ -2,20 +2,24 @@ "name": "@bsf/force-ui", "version": "1.4.2", "description": "Library of components for the BSF project", - "main": "./dist/force-ui.js", - "module": "./dist/force-ui.js", + "main": "./dist/force-ui.cjs.js", + "module": "./dist/force-ui.es.js", + "types": "./dist/force-ui.d.ts", "type": "module", + "sideEffects": false, "exports": { "./package.json": "./package.json", ".": { - "import": "./dist/force-ui.js", - "types": "./dist/force-ui.d.ts" + "types": "./dist/force-ui.d.ts", + "import": "./dist/force-ui.es.js", + "require": "./dist/force-ui.cjs.js" }, "./withTW": { - "import": "./dist/withTW.js", "types": "./dist/withTW.d.ts", - "require": "./dist/withTW.cjs" - } + "import": "./dist/withTW.es.js", + "require": "./dist/withTW.cjs.js" + }, + "./dist/*": "./dist/*" }, "scripts": { "build": "cross-env tsc -b && vite build", diff --git a/src/components/button/button.tsx b/src/components/button/button.tsx index 729edca4..34b82136 100644 --- a/src/components/button/button.tsx +++ b/src/components/button/button.tsx @@ -76,6 +76,7 @@ const Button: React.FunctionComponent = forwardRef( const commonClass = 'outline outline-1 border-none cursor-pointer transition-colors duration-300 ease-in-out text-xs font-semibold focus:ring-2 focus:ring-toggle-on focus:ring-offset-2 disabled:text-text-disabled'; + const commonDestructiveClassName = destructive && 'focus:ring-focus-error'; const loadingClass = loading ? 'opacity-50 disabled:cursor-not-allowed' @@ -136,6 +137,7 @@ const Button: React.FunctionComponent = forwardRef( sizeClassNames, variantClassNames, destructiveClassNames, + commonDestructiveClassName, loadingClass, { 'cursor-default': disabled, diff --git a/src/components/switch/switch.tsx b/src/components/switch/switch.tsx index d0e73ca4..f83031e8 100644 --- a/src/components/switch/switch.tsx +++ b/src/components/switch/switch.tsx @@ -24,10 +24,10 @@ export interface SwitchProps { defaultValue?: boolean; /** - * Defines the size of the switch (e.g., 'sm', 'md'). + * Defines the size of the switch (e.g., 'xs', 'sm', 'md'). * @default 'sm' */ - size?: 'sm' | 'md'; + size?: 'xs' | 'sm' | 'md'; /** Disables the switch if true. */ disabled?: boolean; @@ -59,17 +59,20 @@ export const SwitchLabel = ( { switchId: string; disabled?: boolean; children: ReactNode; - size: 'sm' | 'md'; + size: SwitchProps['size']; } ) => { const headingClasses = { + xs: 'text-xs leading-4 font-medium', sm: 'text-sm leading-5 font-medium', md: 'text-base leading-6 font-medium', }; const descriptionClasses = { + xs: 'text-xs leading-4 font-normal', sm: 'text-sm leading-5 font-normal', md: 'text-sm leading-5 font-normal', }; const gapClassNames = { + xs: 'space-y-0.5', sm: 'space-y-0.5', md: 'space-y-1', }; @@ -87,11 +90,11 @@ export const SwitchLabel = ( { const renderLabel = () => { const { heading = '', description = '' } = label || {}; return ( -
+
{ heading && (