@pk-design/react-tailwind 1.4.1 → 1.4.3
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/dist/react-tailwind.cjs.js +35 -27
- package/dist/react-tailwind.cjs.js.map +1 -1
- package/dist/react-tailwind.es.js +35 -27
- package/dist/react-tailwind.es.js.map +1 -1
- package/dist/types/components/Alert/Alert.d.ts +1 -1
- package/dist/types/components/Alert/Alert.types.d.ts +10 -4
- package/dist/types/components/Badge/Badge.types.d.ts +13 -3
- package/dist/types/components/Banner/Banner.types.d.ts +15 -2
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var tailwindMerge = require('tailwind-merge');
|
|
5
4
|
var React = require('react');
|
|
5
|
+
var tailwindMerge = require('tailwind-merge');
|
|
6
6
|
var react = require('@headlessui/react');
|
|
7
7
|
var reactWindow = require('react-window');
|
|
8
8
|
|
|
@@ -151,7 +151,7 @@ const TextContent = React.forwardRef((props, ref) => {
|
|
|
151
151
|
return React.createElement('span', {
|
|
152
152
|
...rest,
|
|
153
153
|
ref,
|
|
154
|
-
className: buildClassName(xsmall && 'text-xs/5', small && 'text-sm/6', strong && 'font-semibold', muted && 'text-gray-500', error && 'text-red-500 dark:text-red-
|
|
154
|
+
className: buildClassName('text-gray-900 dark:text-gray-100', xsmall && 'text-xs/5', small && 'text-sm/6', strong && 'font-semibold', muted && 'text-gray-500 dark:text-gray-400', error && 'text-red-500 dark:text-red-400', className),
|
|
155
155
|
});
|
|
156
156
|
});
|
|
157
157
|
TextContent.displayName = 'TextContent';
|
|
@@ -235,17 +235,18 @@ const AlertTypeIconMap = {
|
|
|
235
235
|
warning: SvgCircleAlert,
|
|
236
236
|
info: SvgInfo,
|
|
237
237
|
};
|
|
238
|
-
const TypeClassMap = {
|
|
238
|
+
const TypeClassMap$1 = {
|
|
239
239
|
success: 'bg-[var(--ui-success-light)] ring-[var(--ui-success-ring-subtle)] text-[var(--ui-success-text)]',
|
|
240
|
-
danger: 'bg-[var(--ui-danger-light)]
|
|
240
|
+
danger: 'bg-[var(--ui-danger-light)] ring-[var(--ui-danger-ring-subtle)] text-[var(--ui-danger-text)]',
|
|
241
241
|
warning: 'bg-[var(--ui-warning-light)] ring-[var(--ui-warning-ring-subtle)] text-[var(--ui-warning-text)]',
|
|
242
|
-
info: 'bg-[var(--ui-info-light)]
|
|
243
|
-
};
|
|
244
|
-
const Alert = (props) => {
|
|
245
|
-
const { type = 'info', className = '', message, children, removable = false, onRemove = () => { }, ...restProps } = props;
|
|
246
|
-
const Icon = AlertTypeIconMap[type] || SvgInfo;
|
|
247
|
-
return (jsxRuntime.jsxs("div", { className: buildClassName(className, 'flex items-center justify-between rounded-md p-3 text-sm ring-1 ring-inset gap-2', TypeClassMap[type]), ...restProps, children: [jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-2", children: [jsxRuntime.jsx(Icon, { className: "size-5", "data-testid": `alert-${type}-icon` }), jsxRuntime.jsx("span", { className: "pr-2 inline-flex items-center", children: message || children })] }), removable && (jsxRuntime.jsx(Button, { iconOnly: true, "aria-label": "Dismiss alert", size: "xs", variant: "plain", theme: "secondary", className: "hover:bg-black/10 dark:hover:bg-white/10", onClick: () => onRemove(), "data-testid": "alert-remove-btn", children: jsxRuntime.jsx(SvgX, { className: "size-4.5", "data-testid": "alert-remove-icon" }) }))] }));
|
|
242
|
+
info: 'bg-[var(--ui-info-light)] ring-[var(--ui-info-ring-subtle)] text-[var(--ui-info-text)]',
|
|
248
243
|
};
|
|
244
|
+
const Alert = React.forwardRef((props, ref) => {
|
|
245
|
+
const { type = 'info', className, message, children, removable = false, onRemove, icon, title, ...restProps } = props;
|
|
246
|
+
const DefaultIcon = AlertTypeIconMap[type] || SvgInfo;
|
|
247
|
+
const iconNode = icon !== undefined ? (icon) : (jsxRuntime.jsx(DefaultIcon, { className: "size-5 shrink-0", "data-testid": `alert-${type}-icon` }));
|
|
248
|
+
return (jsxRuntime.jsxs("div", { ref: ref, className: buildClassName('flex items-center justify-between rounded-md p-3 text-sm ring-1 ring-inset gap-2', TypeClassMap$1[type], className), ...restProps, children: [jsxRuntime.jsxs("span", { className: "inline-flex items-start gap-2 min-w-0", children: [iconNode && jsxRuntime.jsx("span", { className: "shrink-0 inline-flex mt-0.5", children: iconNode }), jsxRuntime.jsxs("span", { className: "inline-flex flex-col gap-0.5 min-w-0", children: [title && jsxRuntime.jsx("span", { className: "font-semibold", children: title }), jsxRuntime.jsx("span", { className: "inline-flex items-center", children: message !== null && message !== void 0 ? message : children })] })] }), removable && (jsxRuntime.jsx(Button, { iconOnly: true, "aria-label": "Dismiss alert", size: "xs", variant: "plain", theme: "secondary", className: "hover:bg-black/10 dark:hover:bg-white/10 shrink-0", onClick: () => onRemove === null || onRemove === void 0 ? void 0 : onRemove(), "data-testid": "alert-remove-btn", children: jsxRuntime.jsx(SvgX, { className: "size-4.5", "data-testid": "alert-remove-icon" }) }))] }));
|
|
249
|
+
});
|
|
249
250
|
Alert.displayName = 'Alert';
|
|
250
251
|
|
|
251
252
|
const ThemeClassMap = {
|
|
@@ -255,14 +256,18 @@ const ThemeClassMap = {
|
|
|
255
256
|
info: 'bg-[var(--ui-info-light)] text-[var(--ui-info-text)] ring-[var(--ui-info-ring-subtle)]',
|
|
256
257
|
secondary: 'bg-gray-50 dark:bg-gray-700 text-gray-700 dark:text-gray-200 ring-[var(--ui-secondary-ring-subtle)]',
|
|
257
258
|
};
|
|
259
|
+
const SIZE_CLASS = {
|
|
260
|
+
sm: 'text-xs py-0.5 px-2',
|
|
261
|
+
md: 'text-xs py-1 px-3',
|
|
262
|
+
};
|
|
258
263
|
const Badge = React.forwardRef((props, ref) => {
|
|
259
|
-
const { theme = 'info', className
|
|
260
|
-
return (jsxRuntime.jsxs(TextContent, { ref: ref, className: buildClassName(
|
|
264
|
+
const { theme = 'info', className, children, removable = false, rounded = false, onRemove, size = 'md', icon, ...restProps } = props;
|
|
265
|
+
return (jsxRuntime.jsxs(TextContent, { ref: ref, className: buildClassName('inline-flex items-center gap-1 font-medium ring-1 ring-inset', SIZE_CLASS[size], ThemeClassMap[theme], rounded ? 'rounded-full' : 'rounded-md', icon ? 'pl-2' : '', removable ? 'pr-1' : '', className), "data-testid": `badge-${theme}`, ...restProps, children: [icon && jsxRuntime.jsx("span", { className: "shrink-0 inline-flex", children: icon }), children, removable && (jsxRuntime.jsx(SvgX, { className: "size-4 shrink-0 hover:bg-black/10 dark:hover:bg-white/10 rounded-sm cursor-pointer", role: "button", tabIndex: 0, "aria-label": "Remove", onClick: () => onRemove === null || onRemove === void 0 ? void 0 : onRemove(), onKeyDown: (e) => {
|
|
261
266
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
262
267
|
e.preventDefault();
|
|
263
|
-
onRemove();
|
|
268
|
+
onRemove === null || onRemove === void 0 ? void 0 : onRemove();
|
|
264
269
|
}
|
|
265
|
-
} }))
|
|
270
|
+
} }))] }));
|
|
266
271
|
});
|
|
267
272
|
Badge.displayName = 'Badge';
|
|
268
273
|
|
|
@@ -321,14 +326,17 @@ const IconMap = {
|
|
|
321
326
|
success: SvgCircleCheck,
|
|
322
327
|
warning: SvgTriangleAlert,
|
|
323
328
|
};
|
|
329
|
+
const TypeClassMap = {
|
|
330
|
+
info: 'bg-[var(--ui-info-light)] ring-[var(--ui-info-ring-subtle)] text-[var(--ui-info-text)]',
|
|
331
|
+
error: 'bg-[var(--ui-danger-light)] ring-[var(--ui-danger-ring-subtle)] text-[var(--ui-danger-text)]',
|
|
332
|
+
success: 'bg-[var(--ui-success-light)] ring-[var(--ui-success-ring-subtle)] text-[var(--ui-success-text)]',
|
|
333
|
+
warning: 'bg-[var(--ui-warning-light)] ring-[var(--ui-warning-ring-subtle)] text-[var(--ui-warning-text)]',
|
|
334
|
+
};
|
|
324
335
|
const Banner = React.forwardRef((props, ref) => {
|
|
325
|
-
const { type = 'info', iconSize = 'sm', children, ...restProps } = props;
|
|
326
|
-
const
|
|
327
|
-
const
|
|
328
|
-
|
|
329
|
-
return (jsxRuntime.jsx(Icon, { "data-testid": `banner-${type}-icon`, className: buildClassName('ml-1 mr-3', sizeMap[iconSize]) }));
|
|
330
|
-
};
|
|
331
|
-
return (jsxRuntime.jsxs("div", { ref: ref, className: className, "data-testid": `banner-${type}`, ...restProps, children: [renderIcon(), jsxRuntime.jsx("div", { className: "flex items-center w-full justify-between", children: children })] }));
|
|
336
|
+
const { type = 'info', iconSize = 'sm', children, icon, removable = false, onRemove, className, ...restProps } = props;
|
|
337
|
+
const DefaultIcon = IconMap[type];
|
|
338
|
+
const iconNode = icon !== undefined ? (icon) : (jsxRuntime.jsx(DefaultIcon, { "data-testid": `banner-${type}-icon`, className: buildClassName('shrink-0', sizeMap[iconSize]) }));
|
|
339
|
+
return (jsxRuntime.jsxs("div", { ref: ref, className: buildClassName('text-sm rounded-md flex w-full p-3 items-center gap-3 ring-1 ring-inset', TypeClassMap[type], className), "data-testid": `banner-${type}`, ...restProps, children: [iconNode, jsxRuntime.jsx("div", { className: "flex items-center w-full justify-between", children: children }), removable && (jsxRuntime.jsx(Button, { iconOnly: true, "aria-label": "Dismiss banner", size: "xs", variant: "plain", theme: "secondary", className: "hover:bg-black/10 dark:hover:bg-white/10 shrink-0", onClick: () => onRemove === null || onRemove === void 0 ? void 0 : onRemove(), "data-testid": "banner-remove-btn", children: jsxRuntime.jsx(SvgX, { className: "size-4.5", "data-testid": "banner-remove-icon" }) }))] }));
|
|
332
340
|
});
|
|
333
341
|
Banner.displayName = 'Banner';
|
|
334
342
|
|
|
@@ -336,7 +344,7 @@ const BodyText = React.forwardRef((props, ref) => {
|
|
|
336
344
|
const { as = 'p', small = false, strong = false, muted = false, error = false, inline = false, className, ...rest } = props;
|
|
337
345
|
return React.createElement(as, {
|
|
338
346
|
ref: ref,
|
|
339
|
-
className: buildClassName(small && 'text-sm/6', strong && 'font-semibold', muted && 'text-gray-500', error && 'text-red-500', inline && 'inline-flex items-center gap-2', className),
|
|
347
|
+
className: buildClassName('text-gray-900 dark:text-gray-100', small && 'text-sm/6', strong && 'font-semibold', muted && 'text-gray-500 dark:text-gray-400', error && 'text-red-500 dark:text-red-400', inline && 'inline-flex items-center gap-2', className),
|
|
340
348
|
...rest,
|
|
341
349
|
});
|
|
342
350
|
});
|
|
@@ -797,11 +805,11 @@ function DataTable({ items, columns, sorting = {}, onSort, loading, pagination,
|
|
|
797
805
|
}
|
|
798
806
|
DataTable.displayName = 'DataTable';
|
|
799
807
|
|
|
800
|
-
const Title = ({ children, className }) => (jsxRuntime.jsx("h1", { className: buildClassName('text-3xl font-bold', className), children: children }));
|
|
801
|
-
const SubTitle = ({ children, className }) => (jsxRuntime.jsx("h2", { className: buildClassName('text-2xl font-semibold', className), children: children }));
|
|
802
|
-
const SubTitle2 = ({ children, className }) => (jsxRuntime.jsx("h3", { className: buildClassName('text-xl font-semibold', className), children: children }));
|
|
803
|
-
const SubTitle3 = ({ children, className }) => (jsxRuntime.jsx("h4", { className: buildClassName('text-lg font-medium', className), children: children }));
|
|
804
|
-
const SubTitle4 = ({ children, className }) => (jsxRuntime.jsx("h5", { className: buildClassName('text-base font-medium', className), children: children }));
|
|
808
|
+
const Title = ({ children, className }) => (jsxRuntime.jsx("h1", { className: buildClassName('text-3xl font-bold text-gray-900 dark:text-white', className), children: children }));
|
|
809
|
+
const SubTitle = ({ children, className }) => (jsxRuntime.jsx("h2", { className: buildClassName('text-2xl font-semibold text-gray-900 dark:text-white', className), children: children }));
|
|
810
|
+
const SubTitle2 = ({ children, className }) => (jsxRuntime.jsx("h3", { className: buildClassName('text-xl font-semibold text-gray-900 dark:text-white', className), children: children }));
|
|
811
|
+
const SubTitle3 = ({ children, className }) => (jsxRuntime.jsx("h4", { className: buildClassName('text-lg font-medium text-gray-900 dark:text-white', className), children: children }));
|
|
812
|
+
const SubTitle4 = ({ children, className }) => (jsxRuntime.jsx("h5", { className: buildClassName('text-base font-medium text-gray-900 dark:text-white', className), children: children }));
|
|
805
813
|
const HeadingText = {
|
|
806
814
|
Title,
|
|
807
815
|
SubTitle,
|