@aurora-ds/components 0.24.0 → 0.24.2

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.
@@ -1,7 +1,7 @@
1
- import { ThemeContract } from '@/interfaces';
1
+ import { StatusColor, ThemeContract } from '@/interfaces';
2
2
  import { StatusStyleParams } from '@components/data-display/status/Status.props.ts';
3
3
  export declare const getStatusColorStyles: (theme: ThemeContract, color: StatusStyleParams["color"], variant: StatusStyleParams["variant"], disabled: StatusStyleParams["disabled"]) => {
4
4
  backgroundColor: string;
5
- color: string;
6
5
  borderColor: string;
7
6
  };
7
+ export declare const getStatusTextColor: (color: StatusColor, disabled: boolean) => keyof ThemeContract["colors"];
package/dist/esm/index.js CHANGED
@@ -250,12 +250,10 @@ const getStatusColorStyles = (theme, color, variant, disabled) => {
250
250
  return {
251
251
  filled: {
252
252
  backgroundColor: theme.colors.disabled,
253
- color: theme.colors.disabledText,
254
253
  borderColor: 'transparent',
255
254
  },
256
255
  outlined: {
257
256
  backgroundColor: 'transparent',
258
- color: theme.colors.disabledText,
259
257
  borderColor: theme.colors.disabled,
260
258
  },
261
259
  }[variant];
@@ -264,138 +262,123 @@ const getStatusColorStyles = (theme, color, variant, disabled) => {
264
262
  default: {
265
263
  filled: {
266
264
  backgroundColor: theme.colors.defaultSubtle,
267
- color: theme.colors.default,
268
265
  borderColor: 'transparent',
269
266
  },
270
267
  outlined: {
271
268
  backgroundColor: theme.colors.defaultSubtle,
272
- color: theme.colors.default,
273
269
  borderColor: theme.colors.default,
274
270
  },
275
271
  },
276
272
  primary: {
277
273
  filled: {
278
274
  backgroundColor: theme.colors.primarySubtle,
279
- color: theme.colors.primary,
280
275
  borderColor: 'transparent',
281
276
  },
282
277
  outlined: {
283
278
  backgroundColor: theme.colors.primarySubtle,
284
- color: theme.colors.primary,
285
279
  borderColor: theme.colors.primary,
286
280
  },
287
281
  },
288
282
  success: {
289
283
  filled: {
290
284
  backgroundColor: theme.colors.successSubtle,
291
- color: theme.colors.success,
292
285
  borderColor: 'transparent',
293
286
  },
294
287
  outlined: {
295
288
  backgroundColor: theme.colors.successSubtle,
296
- color: theme.colors.success,
297
289
  borderColor: theme.colors.success,
298
290
  },
299
291
  },
300
292
  warning: {
301
293
  filled: {
302
294
  backgroundColor: theme.colors.warningSubtle,
303
- color: theme.colors.warning,
304
295
  borderColor: 'transparent',
305
296
  },
306
297
  outlined: {
307
298
  backgroundColor: theme.colors.warningSubtle,
308
- color: theme.colors.warning,
309
299
  borderColor: theme.colors.warning,
310
300
  },
311
301
  },
312
302
  error: {
313
303
  filled: {
314
304
  backgroundColor: theme.colors.errorSubtle,
315
- color: theme.colors.error,
316
305
  borderColor: 'transparent',
317
306
  },
318
307
  outlined: {
319
308
  backgroundColor: theme.colors.errorSubtle,
320
- color: theme.colors.error,
321
309
  borderColor: theme.colors.error,
322
310
  },
323
311
  },
324
312
  info: {
325
313
  filled: {
326
314
  backgroundColor: theme.colors.infoSubtle,
327
- color: theme.colors.info,
328
315
  borderColor: 'transparent',
329
316
  },
330
317
  outlined: {
331
318
  backgroundColor: theme.colors.infoSubtle,
332
- color: theme.colors.info,
333
319
  borderColor: theme.colors.info,
334
320
  },
335
321
  },
336
322
  highlight: {
337
323
  filled: {
338
324
  backgroundColor: theme.colors.highlightSubtle,
339
- color: theme.colors.highlight,
340
325
  borderColor: 'transparent',
341
326
  },
342
327
  outlined: {
343
328
  backgroundColor: theme.colors.highlightSubtle,
344
- color: theme.colors.highlight,
345
329
  borderColor: theme.colors.highlight,
346
330
  },
347
331
  },
348
332
  accent: {
349
333
  filled: {
350
334
  backgroundColor: theme.colors.accentSubtle,
351
- color: theme.colors.accent,
352
335
  borderColor: 'transparent',
353
336
  },
354
337
  outlined: {
355
338
  backgroundColor: theme.colors.accentSubtle,
356
- color: theme.colors.accent,
357
339
  borderColor: theme.colors.accent,
358
340
  },
359
341
  },
360
342
  new: {
361
343
  filled: {
362
344
  backgroundColor: theme.colors.newSubtle,
363
- color: theme.colors.new,
364
345
  borderColor: 'transparent',
365
346
  },
366
347
  outlined: {
367
348
  backgroundColor: theme.colors.newSubtle,
368
- color: theme.colors.new,
369
349
  borderColor: theme.colors.new,
370
350
  },
371
351
  },
372
352
  rose: {
373
353
  filled: {
374
354
  backgroundColor: theme.colors.roseSubtle,
375
- color: theme.colors.rose,
376
355
  borderColor: 'transparent',
377
356
  },
378
357
  outlined: {
379
358
  backgroundColor: theme.colors.roseSubtle,
380
- color: theme.colors.rose,
381
359
  borderColor: theme.colors.rose,
382
360
  },
383
361
  },
384
362
  yellow: {
385
363
  filled: {
386
364
  backgroundColor: theme.colors.yellowSubtle,
387
- color: theme.colors.yellow,
388
365
  borderColor: 'transparent',
389
366
  },
390
367
  outlined: {
391
368
  backgroundColor: theme.colors.yellowSubtle,
392
- color: theme.colors.yellow,
393
369
  borderColor: theme.colors.yellow,
394
370
  },
395
371
  },
396
372
  };
397
373
  return colorMap[color][variant];
398
374
  };
375
+ const getStatusTextColor = (color, disabled) => {
376
+ if (disabled) {
377
+ return 'disabledText';
378
+ }
379
+ // Retourne directement la clé de couleur du thème
380
+ return color;
381
+ };
399
382
 
400
383
  /**
401
384
  * Get status size styles based on the theme, size and icon-only state
@@ -483,6 +466,7 @@ const getStatusContentSize = (size) => {
483
466
  */
484
467
  const Status = ({ label, icon, variant = 'filled', color = 'default', size = 'md', gap, radius, disabled = false, ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, }) => {
485
468
  const isIconOnly = Boolean(icon) && !label;
469
+ const textColor = getStatusTextColor(color, disabled);
486
470
  return (jsxs("span", { className: STATUS_STYLES.root({
487
471
  variant,
488
472
  color,
@@ -491,7 +475,7 @@ const Status = ({ label, icon, variant = 'filled', color = 'default', size = 'md
491
475
  disabled,
492
476
  gap,
493
477
  radius,
494
- }), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, children: [icon && (jsx(Icon, { size: getStatusContentSize(size), children: icon })), label && (jsx(Text, { variant: 'label', fontSize: getStatusContentSize(size), children: label }))] }));
478
+ }), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, children: [icon && (jsx(Icon, { size: getStatusContentSize(size), color: textColor, children: icon })), label && (jsx(Text, { variant: 'label', fontSize: getStatusContentSize(size), color: textColor, children: label }))] }));
495
479
  };
496
480
  Status.displayName = 'Status';
497
481
 
@@ -2904,7 +2888,7 @@ const DRAWER_ITEM_STYLES = createStyles((theme) => ({
2904
2888
  * Similar to a text button with selected state support.
2905
2889
  */
2906
2890
  const DrawerItem = ({ label, startIcon, endIcon, selected = false, onClick, disabled, chip, ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, }) => {
2907
- return (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: [jsxs(Stack, { children: [startIcon && (jsx(Icon, { children: startIcon })), jsx(Text, { variant: 'label', maxLines: 1, children: label }), endIcon && (jsx(Icon, { children: endIcon }))] }), chip && !selected && (jsx(Status, { ...chip, size: '2xs', color: chip.color ?? 'info', disabled: disabled }))] }));
2891
+ return (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: [jsxs(Stack, { children: [startIcon && (jsx(Icon, { color: selected ? 'surface' : 'textSecondary', children: startIcon })), jsx(Text, { variant: 'label', maxLines: 1, color: selected ? 'surface' : 'textSecondary', children: label }), endIcon && (jsx(Icon, { color: selected ? 'surface' : 'textSecondary', children: endIcon }))] }), chip && !selected && (jsx(Status, { ...chip, size: '2xs', color: chip.color ?? 'info', disabled: disabled }))] }));
2908
2892
  };
2909
2893
  DrawerItem.displayName = 'DrawerItem';
2910
2894