@aurora-ds/components 0.20.0 → 0.21.0
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/README.md +1 -1
- package/dist/cjs/components/data-display/status/Status.d.ts +16 -0
- package/dist/cjs/components/data-display/status/Status.props.d.ts +40 -0
- package/dist/cjs/components/data-display/status/Status.styles.d.ts +4 -0
- package/dist/cjs/components/data-display/status/index.d.ts +2 -0
- package/dist/cjs/components/index.d.ts +2 -2
- package/dist/cjs/components/navigation/drawer-item/DrawerItem.props.d.ts +2 -2
- package/dist/cjs/index.js +97 -28
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/interfaces/index.d.ts +1 -1
- package/dist/cjs/interfaces/status.types.d.ts +6 -0
- package/dist/cjs/interfaces/theme.contracts.d.ts +6 -0
- package/dist/cjs/utils/ui/components/data-display/status/getStatusColorStyles.utils.d.ts +7 -0
- package/dist/cjs/utils/ui/components/data-display/status/getStatusContentSize.utils.d.ts +8 -0
- package/dist/cjs/utils/ui/components/data-display/status/getStatusSizeStyles.utils.d.ts +12 -0
- package/dist/esm/components/data-display/status/Status.d.ts +16 -0
- package/dist/esm/components/data-display/status/Status.props.d.ts +40 -0
- package/dist/esm/components/data-display/status/Status.styles.d.ts +4 -0
- package/dist/esm/components/data-display/status/index.d.ts +2 -0
- package/dist/esm/components/index.d.ts +2 -2
- package/dist/esm/components/navigation/drawer-item/DrawerItem.props.d.ts +2 -2
- package/dist/esm/index.js +97 -28
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/interfaces/index.d.ts +1 -1
- package/dist/esm/interfaces/status.types.d.ts +6 -0
- package/dist/esm/interfaces/theme.contracts.d.ts +6 -0
- package/dist/esm/utils/ui/components/data-display/status/getStatusColorStyles.utils.d.ts +7 -0
- package/dist/esm/utils/ui/components/data-display/status/getStatusContentSize.utils.d.ts +8 -0
- package/dist/esm/utils/ui/components/data-display/status/getStatusSizeStyles.utils.d.ts +12 -0
- package/dist/index.d.ts +28 -22
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -212,7 +212,7 @@ The `defaultTheme` includes these token categories:
|
|
|
212
212
|
**Layout:** Card, Stack, Grid, Page, PageSection, Separator
|
|
213
213
|
**Typography:** Text
|
|
214
214
|
**Forms:** Input, TextArea, Select, DatePicker, Form
|
|
215
|
-
**Data Display:**
|
|
215
|
+
**Data Display:** Status, Avatar, AvatarGroup, Icon
|
|
216
216
|
**Navigation:** Breadcrumb, Tabs, DrawerItem, Menu, Pagination
|
|
217
217
|
**Feedback:** Alert, Accordion
|
|
218
218
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { StatusProps } from '@components/data-display/status/Status.props';
|
|
3
|
+
/**
|
|
4
|
+
* Status component
|
|
5
|
+
*
|
|
6
|
+
* A compact element for displaying status, tags, or information.
|
|
7
|
+
*
|
|
8
|
+
* **Variants:**
|
|
9
|
+
* - `filled`: Solid background (default)
|
|
10
|
+
* - `outlined`: Border only
|
|
11
|
+
*
|
|
12
|
+
* **Colors:**
|
|
13
|
+
* - `default`, `primary`, `success`, `warning`, `error`, `info`, `highlight`, `accent`, `new`, `rose`, `yellow`
|
|
14
|
+
*/
|
|
15
|
+
declare const Status: FC<StatusProps>;
|
|
16
|
+
export default Status;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ThemeContract } from '@/interfaces';
|
|
3
|
+
import { StatusColor, StatusSize, StatusVariant } from '@interfaces/status.types';
|
|
4
|
+
export type StatusProps = {
|
|
5
|
+
/** Text label to display */
|
|
6
|
+
label?: string;
|
|
7
|
+
/** Icon to display before the label */
|
|
8
|
+
icon?: ReactNode;
|
|
9
|
+
/** Status variant style */
|
|
10
|
+
variant?: StatusVariant;
|
|
11
|
+
/** Status color from theme */
|
|
12
|
+
color?: StatusColor;
|
|
13
|
+
/** Status size */
|
|
14
|
+
size?: StatusSize;
|
|
15
|
+
/** Gap between icon and text (theme spacing key) */
|
|
16
|
+
gap?: keyof ThemeContract['spacing'];
|
|
17
|
+
/** Border radius from theme */
|
|
18
|
+
radius?: keyof ThemeContract['radius'];
|
|
19
|
+
/** Disabled state */
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/** Accessibility label for screen readers */
|
|
22
|
+
ariaLabel?: string;
|
|
23
|
+
/** ID of element that labels this status */
|
|
24
|
+
ariaLabelledBy?: string;
|
|
25
|
+
/** ID of element that describes this status */
|
|
26
|
+
ariaDescribedBy?: string;
|
|
27
|
+
/** ARIA role */
|
|
28
|
+
role?: string;
|
|
29
|
+
/** Tab index for keyboard navigation */
|
|
30
|
+
tabIndex?: number;
|
|
31
|
+
};
|
|
32
|
+
export type StatusStyleParams = {
|
|
33
|
+
variant: StatusVariant;
|
|
34
|
+
color: StatusColor;
|
|
35
|
+
size: StatusSize;
|
|
36
|
+
isIconOnly: boolean;
|
|
37
|
+
disabled: boolean;
|
|
38
|
+
gap?: keyof ThemeContract['spacing'];
|
|
39
|
+
radius?: keyof ThemeContract['radius'];
|
|
40
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from '@components/foundation/icon';
|
|
2
2
|
export * from '@components/foundation/text';
|
|
3
|
-
export * from '@components/data-display/
|
|
3
|
+
export * from '@components/data-display/status';
|
|
4
4
|
export * from '@components/data-display/avatar';
|
|
5
5
|
export * from '@components/data-display/skeleton';
|
|
6
6
|
export * from '@components/actions/button';
|
|
@@ -27,5 +27,5 @@ export * from '@components/navigation/pagination';
|
|
|
27
27
|
export type { AlertVariant, AlertPosition } from '@interfaces/alert.types';
|
|
28
28
|
export type { ButtonVariants, ButtonVariantStyle } from '@interfaces/button.types';
|
|
29
29
|
export type { TextVariants, TextVariantStyle } from '@interfaces/text.types';
|
|
30
|
-
export type {
|
|
30
|
+
export type { StatusVariant, StatusColor, StatusSize } from '@interfaces/status.types';
|
|
31
31
|
export type { SelectOption } from '@interfaces/select.types';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { StatusProps } from '@/components';
|
|
3
3
|
export type DrawerItemProps = {
|
|
4
4
|
/** DrawerItem text label */
|
|
5
5
|
label: string;
|
|
@@ -14,7 +14,7 @@ export type DrawerItemProps = {
|
|
|
14
14
|
/** Disabled state */
|
|
15
15
|
disabled?: boolean;
|
|
16
16
|
/** Optional chip to display */
|
|
17
|
-
chip?: Omit<
|
|
17
|
+
chip?: Omit<StatusProps, 'size' | 'disabled'>;
|
|
18
18
|
/** Accessibility label for screen readers */
|
|
19
19
|
ariaLabel?: string;
|
|
20
20
|
/** ID of element that labels this item */
|
package/dist/cjs/index.js
CHANGED
|
@@ -236,7 +236,7 @@ const Text = ({ children, variant = 'span', color, fontSize, fontFamily, maxLine
|
|
|
236
236
|
};
|
|
237
237
|
Text.displayName = 'Text';
|
|
238
238
|
|
|
239
|
-
const
|
|
239
|
+
const getStatusColorStyles = (theme, color, variant, disabled) => {
|
|
240
240
|
if (disabled) {
|
|
241
241
|
return {
|
|
242
242
|
filled: {
|
|
@@ -254,7 +254,7 @@ const getChipColorStyles = (theme, color, variant, disabled) => {
|
|
|
254
254
|
const colorMap = {
|
|
255
255
|
default: {
|
|
256
256
|
filled: {
|
|
257
|
-
backgroundColor: theme.colors.
|
|
257
|
+
backgroundColor: theme.colors.border,
|
|
258
258
|
color: theme.colors.text,
|
|
259
259
|
borderColor: 'transparent',
|
|
260
260
|
},
|
|
@@ -266,12 +266,12 @@ const getChipColorStyles = (theme, color, variant, disabled) => {
|
|
|
266
266
|
},
|
|
267
267
|
primary: {
|
|
268
268
|
filled: {
|
|
269
|
-
backgroundColor: theme.colors.
|
|
270
|
-
color: theme.colors.
|
|
269
|
+
backgroundColor: theme.colors.primarySubtle,
|
|
270
|
+
color: theme.colors.primary,
|
|
271
271
|
borderColor: 'transparent',
|
|
272
272
|
},
|
|
273
273
|
outlined: {
|
|
274
|
-
backgroundColor:
|
|
274
|
+
backgroundColor: theme.colors.primarySubtle,
|
|
275
275
|
color: theme.colors.primary,
|
|
276
276
|
borderColor: theme.colors.primary,
|
|
277
277
|
},
|
|
@@ -324,17 +324,77 @@ const getChipColorStyles = (theme, color, variant, disabled) => {
|
|
|
324
324
|
borderColor: theme.colors.info,
|
|
325
325
|
},
|
|
326
326
|
},
|
|
327
|
+
highlight: {
|
|
328
|
+
filled: {
|
|
329
|
+
backgroundColor: theme.colors.highlightSubtle,
|
|
330
|
+
color: theme.colors.highlight,
|
|
331
|
+
borderColor: 'transparent',
|
|
332
|
+
},
|
|
333
|
+
outlined: {
|
|
334
|
+
backgroundColor: theme.colors.highlightSubtle,
|
|
335
|
+
color: theme.colors.highlight,
|
|
336
|
+
borderColor: theme.colors.highlight,
|
|
337
|
+
},
|
|
338
|
+
},
|
|
339
|
+
accent: {
|
|
340
|
+
filled: {
|
|
341
|
+
backgroundColor: theme.colors.accentSubtle,
|
|
342
|
+
color: theme.colors.accent,
|
|
343
|
+
borderColor: 'transparent',
|
|
344
|
+
},
|
|
345
|
+
outlined: {
|
|
346
|
+
backgroundColor: theme.colors.accentSubtle,
|
|
347
|
+
color: theme.colors.accent,
|
|
348
|
+
borderColor: theme.colors.accent,
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
|
+
new: {
|
|
352
|
+
filled: {
|
|
353
|
+
backgroundColor: theme.colors.newSubtle,
|
|
354
|
+
color: theme.colors.new,
|
|
355
|
+
borderColor: 'transparent',
|
|
356
|
+
},
|
|
357
|
+
outlined: {
|
|
358
|
+
backgroundColor: theme.colors.newSubtle,
|
|
359
|
+
color: theme.colors.new,
|
|
360
|
+
borderColor: theme.colors.new,
|
|
361
|
+
},
|
|
362
|
+
},
|
|
363
|
+
rose: {
|
|
364
|
+
filled: {
|
|
365
|
+
backgroundColor: theme.colors.roseSubtle,
|
|
366
|
+
color: theme.colors.rose,
|
|
367
|
+
borderColor: 'transparent',
|
|
368
|
+
},
|
|
369
|
+
outlined: {
|
|
370
|
+
backgroundColor: theme.colors.roseSubtle,
|
|
371
|
+
color: theme.colors.rose,
|
|
372
|
+
borderColor: theme.colors.rose,
|
|
373
|
+
},
|
|
374
|
+
},
|
|
375
|
+
yellow: {
|
|
376
|
+
filled: {
|
|
377
|
+
backgroundColor: theme.colors.yellowSubtle,
|
|
378
|
+
color: theme.colors.yellow,
|
|
379
|
+
borderColor: 'transparent',
|
|
380
|
+
},
|
|
381
|
+
outlined: {
|
|
382
|
+
backgroundColor: theme.colors.yellowSubtle,
|
|
383
|
+
color: theme.colors.yellow,
|
|
384
|
+
borderColor: theme.colors.yellow,
|
|
385
|
+
},
|
|
386
|
+
},
|
|
327
387
|
};
|
|
328
388
|
return colorMap[color][variant];
|
|
329
389
|
};
|
|
330
390
|
|
|
331
391
|
/**
|
|
332
|
-
* Get
|
|
392
|
+
* Get status size styles based on the theme, size and icon-only state
|
|
333
393
|
* @param theme - Theme object
|
|
334
|
-
* @param size -
|
|
335
|
-
* @param isIconOnly - Whether the
|
|
394
|
+
* @param size - Status size
|
|
395
|
+
* @param isIconOnly - Whether the status has only an icon (no label)
|
|
336
396
|
*/
|
|
337
|
-
const
|
|
397
|
+
const getStatusSizeStyles = (theme, size, isIconOnly) => {
|
|
338
398
|
const sizeMap = {
|
|
339
399
|
'2xs': {
|
|
340
400
|
iconOnly: { padding: theme.spacing.xs, fontSize: theme.fontSize['2xs'] },
|
|
@@ -360,10 +420,10 @@ const getChipSizeStyles = (theme, size, isIconOnly) => {
|
|
|
360
420
|
return isIconOnly ? sizeMap[size].iconOnly : sizeMap[size].withLabel;
|
|
361
421
|
};
|
|
362
422
|
|
|
363
|
-
const
|
|
423
|
+
const STATUS_STYLES = theme.createStyles((theme) => ({
|
|
364
424
|
root: ({ variant, color, size, isIconOnly, disabled, gap, radius }) => {
|
|
365
|
-
const colorStyles =
|
|
366
|
-
const sizeStyles =
|
|
425
|
+
const colorStyles = getStatusColorStyles(theme, color, variant, disabled);
|
|
426
|
+
const sizeStyles = getStatusSizeStyles(theme, size, isIconOnly);
|
|
367
427
|
return {
|
|
368
428
|
display: 'flex',
|
|
369
429
|
alignItems: 'center',
|
|
@@ -385,11 +445,11 @@ const CHIP_STYLES = theme.createStyles((theme) => ({
|
|
|
385
445
|
}));
|
|
386
446
|
|
|
387
447
|
/**
|
|
388
|
-
* Get
|
|
448
|
+
* Get status content size based on the status size
|
|
389
449
|
* @param size
|
|
390
450
|
* @constructor
|
|
391
451
|
*/
|
|
392
|
-
const
|
|
452
|
+
const getStatusContentSize = (size) => {
|
|
393
453
|
const sizeMap = {
|
|
394
454
|
'2xs': '2xs',
|
|
395
455
|
xs: 'xs',
|
|
@@ -401,20 +461,20 @@ const getChipContentSize = (size) => {
|
|
|
401
461
|
};
|
|
402
462
|
|
|
403
463
|
/**
|
|
404
|
-
*
|
|
464
|
+
* Status component
|
|
405
465
|
*
|
|
406
|
-
* A compact element for displaying
|
|
466
|
+
* A compact element for displaying status, tags, or information.
|
|
407
467
|
*
|
|
408
468
|
* **Variants:**
|
|
409
469
|
* - `filled`: Solid background (default)
|
|
410
470
|
* - `outlined`: Border only
|
|
411
471
|
*
|
|
412
472
|
* **Colors:**
|
|
413
|
-
* - `default`, `primary`, `success`, `warning`, `error`, `info`
|
|
473
|
+
* - `default`, `primary`, `success`, `warning`, `error`, `info`, `highlight`, `accent`, `new`, `rose`, `yellow`
|
|
414
474
|
*/
|
|
415
|
-
const
|
|
475
|
+
const Status = ({ label, icon, variant = 'filled', color = 'default', size = 'md', gap, radius, disabled = false, ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, }) => {
|
|
416
476
|
const isIconOnly = Boolean(icon) && !label;
|
|
417
|
-
return (jsxRuntime.jsxs("span", { className:
|
|
477
|
+
return (jsxRuntime.jsxs("span", { className: STATUS_STYLES.root({
|
|
418
478
|
variant,
|
|
419
479
|
color,
|
|
420
480
|
size,
|
|
@@ -422,9 +482,9 @@ const Chip = ({ label, icon, variant = 'filled', color = 'default', size = 'md',
|
|
|
422
482
|
disabled,
|
|
423
483
|
gap,
|
|
424
484
|
radius,
|
|
425
|
-
}), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, children: [icon && (jsxRuntime.jsx(Icon, { size:
|
|
485
|
+
}), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, children: [icon && (jsxRuntime.jsx(Icon, { size: getStatusContentSize(size), children: icon })), label && (jsxRuntime.jsx(Text, { variant: 'label', fontSize: getStatusContentSize(size), children: label }))] }));
|
|
426
486
|
};
|
|
427
|
-
|
|
487
|
+
Status.displayName = 'Status';
|
|
428
488
|
|
|
429
489
|
const BUTTON_SIZE = 36;
|
|
430
490
|
const ALERT_MAX_WIDTH = 320;
|
|
@@ -2419,7 +2479,7 @@ const DRAWER_ITEM_STYLES = theme.createStyles((theme) => ({
|
|
|
2419
2479
|
* Similar to a text button with selected state support.
|
|
2420
2480
|
*/
|
|
2421
2481
|
const DrawerItem = ({ label, startIcon, endIcon, selected = false, onClick, disabled, chip, ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, }) => {
|
|
2422
|
-
return (jsxRuntime.jsxs("button", { onClick: onClick, disabled: disabled, type: 'button', className: DRAWER_ITEM_STYLES.root({ selected }), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, children: [jsxRuntime.jsxs(Stack, { children: [startIcon && (jsxRuntime.jsx(Icon, { children: startIcon })), jsxRuntime.jsx(Text, { variant: 'label', maxLines: 1, children: label }), endIcon && (jsxRuntime.jsx(Icon, { children: endIcon }))] }), chip && !selected && (jsxRuntime.jsx(
|
|
2482
|
+
return (jsxRuntime.jsxs("button", { onClick: onClick, disabled: disabled, type: 'button', className: DRAWER_ITEM_STYLES.root({ selected }), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, children: [jsxRuntime.jsxs(Stack, { children: [startIcon && (jsxRuntime.jsx(Icon, { children: startIcon })), jsxRuntime.jsx(Text, { variant: 'label', maxLines: 1, children: label }), endIcon && (jsxRuntime.jsx(Icon, { children: endIcon }))] }), chip && !selected && (jsxRuntime.jsx(Status, { ...chip, size: '2xs', color: chip.color ?? 'info', disabled: disabled }))] }));
|
|
2423
2483
|
};
|
|
2424
2484
|
DrawerItem.displayName = 'DrawerItem';
|
|
2425
2485
|
|
|
@@ -3020,24 +3080,33 @@ const themeColors = {
|
|
|
3020
3080
|
disabled: theme.colors.slate[300],
|
|
3021
3081
|
// Semantic colors - Success (Emerald)
|
|
3022
3082
|
success: theme.colors.emerald[600],
|
|
3023
|
-
successSubtle: theme.colors.emerald[
|
|
3083
|
+
successSubtle: theme.colors.emerald[100],
|
|
3024
3084
|
// Semantic colors - Warning (Amber)
|
|
3025
|
-
warning: theme.colors.amber[
|
|
3026
|
-
warningSubtle: theme.colors.amber[
|
|
3085
|
+
warning: theme.colors.amber[600],
|
|
3086
|
+
warningSubtle: theme.colors.amber[100],
|
|
3027
3087
|
// Semantic colors - Error (Red)
|
|
3028
3088
|
error: theme.colors.red[600],
|
|
3029
3089
|
errorHover: theme.colors.red[700],
|
|
3030
|
-
errorSubtle: theme.colors.red[
|
|
3090
|
+
errorSubtle: theme.colors.red[100],
|
|
3031
3091
|
onError: theme.colors.white,
|
|
3032
3092
|
// Semantic colors - Info (Blue)
|
|
3033
3093
|
info: theme.colors.blue[600],
|
|
3034
|
-
infoSubtle: theme.colors.blue[
|
|
3094
|
+
infoSubtle: theme.colors.blue[100],
|
|
3035
3095
|
// Semantic colors - Highlight (Orange)
|
|
3036
3096
|
highlight: theme.colors.orange[500],
|
|
3037
3097
|
highlightSubtle: theme.colors.orange[100],
|
|
3038
3098
|
// Semantic colors - Accent (Purple)
|
|
3039
3099
|
accent: theme.colors.purple[500],
|
|
3040
3100
|
accentSubtle: theme.colors.purple[100],
|
|
3101
|
+
// Status colors - New (Cyan)
|
|
3102
|
+
new: theme.colors.cyan[600],
|
|
3103
|
+
newSubtle: theme.colors.cyan[100],
|
|
3104
|
+
// Status colors - Rose (Pink)
|
|
3105
|
+
rose: theme.colors.rose[500],
|
|
3106
|
+
roseSubtle: theme.colors.rose[100],
|
|
3107
|
+
// Status colors - Yellow
|
|
3108
|
+
yellow: theme.colors.yellow[600],
|
|
3109
|
+
yellowSubtle: theme.colors.yellow[100],
|
|
3041
3110
|
// Link colors (Indigo)
|
|
3042
3111
|
link: theme.colors.indigo[600],
|
|
3043
3112
|
linkHover: theme.colors.indigo[700],
|
|
@@ -3218,7 +3287,6 @@ exports.BreadcrumbPage = BreadcrumbPage;
|
|
|
3218
3287
|
exports.BreadcrumbSeparator = BreadcrumbSeparator;
|
|
3219
3288
|
exports.Button = Button;
|
|
3220
3289
|
exports.Card = Card;
|
|
3221
|
-
exports.Chip = Chip;
|
|
3222
3290
|
exports.DatePicker = DatePicker_default;
|
|
3223
3291
|
exports.DrawerItem = DrawerItem;
|
|
3224
3292
|
exports.Form = Form$1;
|
|
@@ -3237,6 +3305,7 @@ exports.Select = Select;
|
|
|
3237
3305
|
exports.Separator = Separator;
|
|
3238
3306
|
exports.Skeleton = Skeleton;
|
|
3239
3307
|
exports.Stack = Stack;
|
|
3308
|
+
exports.Status = Status;
|
|
3240
3309
|
exports.TabItem = TabItem;
|
|
3241
3310
|
exports.Tabs = Tabs;
|
|
3242
3311
|
exports.Text = Text;
|