@qasa/qds-ui 0.33.0 → 0.35.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/dist/index.d.ts CHANGED
@@ -1,12 +1,10 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import * as _emotion_react from '@emotion/react';
3
2
  import { EmotionCache, CSSObject } from '@emotion/react';
4
3
  import * as react from 'react';
5
4
  import { ElementType, ComponentPropsWithoutRef, ReactNode, SVGAttributes, ReactElement, useLayoutEffect } from 'react';
6
5
  import * as class_variance_authority_types from 'class-variance-authority/types';
7
6
  import { VariantProps as VariantProps$1 } from 'class-variance-authority';
8
7
  import { Checkbox as Checkbox$1, DropdownMenu as DropdownMenu$1, RadioGroup as RadioGroup$1, Switch as Switch$1, Toast as Toast$1 } from 'radix-ui';
9
- import * as _emotion_styled from '@emotion/styled';
10
8
  import { LucideIcon } from 'lucide-react';
11
9
 
12
10
  /**
@@ -881,15 +879,15 @@ type BreakpointsConfig$1<T> = PartialRecord<keyof Theme['breakpoints'], T> & {
881
879
  };
882
880
  type ResponsiveProp<T> = T | BreakpointsConfig$1<T>;
883
881
 
884
- declare const SIZE_MAP: {
885
- xs: number;
886
- sm: number;
887
- md: number;
888
- lg: number;
889
- xl: number;
890
- '2xl': number;
882
+ declare const SIZE_CLASSES$4: {
883
+ xs: string;
884
+ sm: string;
885
+ md: string;
886
+ lg: string;
887
+ xl: string;
888
+ '2xl': string;
891
889
  };
892
- type AvatarSize = keyof typeof SIZE_MAP;
890
+ type AvatarSize = keyof typeof SIZE_CLASSES$4;
893
891
  interface AvatarOptions {
894
892
  /**
895
893
  * Source url of the image to display. If not passed
@@ -956,8 +954,20 @@ interface ForwardRefComponent<IntrinsicElementString, OwnProps = {}> extends For
956
954
  */
957
955
  type PropsOf<E> = E extends react.ComponentType<infer P> ? P : never;
958
956
 
957
+ declare const ICON_COLOR_CLASSES: {
958
+ readonly default: "text-[color:var(--stroke-default)]";
959
+ readonly strong: "text-[color:var(--stroke-strong)]";
960
+ readonly subtle: "text-[color:var(--stroke-subtle)]";
961
+ readonly disabled: "text-[color:var(--stroke-disabled)]";
962
+ readonly negative: "text-[color:var(--stroke-negative)]";
963
+ readonly warning: "text-[color:var(--stroke-warning)]";
964
+ readonly positive: "text-[color:var(--stroke-positive)]";
965
+ readonly onBrandPrimary: "text-[color:var(--stroke-onBrandPrimary)]";
966
+ readonly onBrandSecondary: "text-[color:var(--stroke-onBrandSecondary)]";
967
+ readonly onBrandTertiary: "text-[color:var(--stroke-onBrandTertiary)]";
968
+ };
959
969
  type IconSize = 12 | 16 | 20 | 24 | 32;
960
- type IconColor = keyof Theme['colors']['icon'] | 'currentColor';
970
+ type IconColor = keyof typeof ICON_COLOR_CLASSES | 'currentColor';
961
971
  interface IconOptions {
962
972
  /**
963
973
  * The size of the icon.
@@ -1062,7 +1072,7 @@ declare const UserIcon: react.ForwardRefExoticComponent<IconProps & react.RefAtt
1062
1072
  declare const XCircleIcon: react.ForwardRefExoticComponent<IconProps & react.RefAttributes<SVGSVGElement>>;
1063
1073
  declare const XIcon: react.ForwardRefExoticComponent<IconProps & react.RefAttributes<SVGSVGElement>>;
1064
1074
 
1065
- declare const SIZE_CLASSES: {
1075
+ declare const SIZE_CLASSES$3: {
1066
1076
  xs: string;
1067
1077
  sm: string;
1068
1078
  md: string;
@@ -1070,9 +1080,9 @@ declare const SIZE_CLASSES: {
1070
1080
  xl: string;
1071
1081
  };
1072
1082
  declare const buttonVariants: (props?: ({
1073
- variant?: "primary" | "secondary" | "tertiary" | null | undefined;
1083
+ variant?: "primary" | "secondary" | "tertiary" | "danger" | null | undefined;
1074
1084
  } & class_variance_authority_types.ClassProp) | undefined) => string;
1075
- type ButtonSize = keyof typeof SIZE_CLASSES;
1085
+ type ButtonSize = keyof typeof SIZE_CLASSES$3;
1076
1086
  type ButtonVariant = NonNullable<VariantProps$1<typeof buttonVariants>['variant']>;
1077
1087
  interface ButtonOptions {
1078
1088
  /**
@@ -1393,172 +1403,26 @@ type HeadingProps = PropsOf<HeadingComponent>;
1393
1403
  */
1394
1404
  declare const Heading: HeadingComponent;
1395
1405
 
1396
- type HintBoxTitleProps = HTMLQdsProps<'span'>;
1406
+ type HintBoxTitleProps = HTMLQdsProps<'p'>;
1397
1407
  type HintBoxProps = HTMLQdsProps<'aside'>;
1398
1408
  declare const HintBox: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & react.RefAttributes<HTMLElement>> & {
1399
- Title: _emotion_styled.StyledComponent<{
1400
- theme?: _emotion_react.Theme;
1401
- as?: React.ElementType;
1402
- }, react.DetailedHTMLProps<react.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, {}>;
1409
+ Title: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & react.RefAttributes<HTMLParagraphElement>>;
1403
1410
  };
1404
1411
 
1405
- type NamedStyles = Record<string, CSSObject>;
1406
- type StyleInterpolation<T> = (theme: Theme) => T;
1407
- /**
1408
- * Creates a collection of named style rules.
1409
- */
1410
- declare function createStyleVariants<T extends NamedStyles>(styles: StyleInterpolation<T>): (theme: Theme) => T;
1411
- /**
1412
- * Create a style object. Useful for creating styles that depend on the theme.
1413
- */
1414
- declare function createStyle<T extends CSSObject>(styles: StyleInterpolation<T>): (theme: Theme) => T;
1415
- type VariantProps<T extends ReturnType<typeof createStyle | typeof createStyleVariants>> = keyof ReturnType<T>;
1416
- /**
1417
- * Converts css `px` unit to `rem`.
1418
- * Assumes the root font size is 16px.
1419
- */
1420
- declare const pxToRem: (px: number) => string;
1421
-
1422
- declare const getFormFieldBaseStyles: (theme: Theme) => {
1423
- '&::placeholder': {
1424
- color: string;
1425
- };
1426
- '&:hover': {
1427
- borderColor: string;
1428
- };
1429
- '&:focus': {
1430
- outline: number;
1431
- borderColor: string;
1432
- boxShadow: `0 0 0 1px ${string}`;
1433
- };
1434
- '&[aria-invalid="true"]': {
1435
- borderColor: string;
1436
- '&:focus': {
1437
- boxShadow: `0 0 0 1px ${string}`;
1438
- };
1439
- };
1440
- '&[disabled], &:disabled, &[data-disabled]': {
1441
- opacity: number;
1442
- borderColor: string;
1443
- };
1444
- transitionProperty: "opacity, border-color, box-shadow";
1445
- transitionDuration: "120ms";
1446
- transitionTimingFunction: "ease";
1447
- fontFamily: string;
1448
- fontWeight: string;
1449
- fontSize: string;
1450
- lineHeight: string;
1451
- letterSpacing: string;
1452
- width: string;
1453
- minWidth: number;
1454
- appearance: "none";
1455
- paddingLeft: string;
1456
- paddingRight: string;
1457
- border: string;
1458
- borderRadius: string;
1459
- backgroundColor: string;
1460
- color: string;
1461
- WebkitTouchCallout: "none";
1462
- WebkitTapHighlightColor: "transparent";
1463
- '&::-webkit-date-and-time-value': {
1464
- textAlign: "left";
1465
- };
1466
- alignItems: "center";
1467
- };
1468
-
1469
- declare const getSizeStyles$3: (theme: Theme) => {
1470
- xs: {
1471
- width: string;
1472
- height: string;
1473
- };
1474
- sm: {
1475
- width: string;
1476
- height: string;
1477
- };
1478
- md: {
1479
- width: string;
1480
- height: string;
1481
- };
1482
- };
1483
- declare const getVariantStyles$1: (theme: Theme) => {
1484
- primary: {
1485
- background: string;
1486
- color: string;
1487
- ":not([disabled])": {
1488
- '@media(hover: hover)': {
1489
- ':hover': {
1490
- background: string;
1491
- };
1492
- };
1493
- ':active': {
1494
- background: string;
1495
- };
1496
- };
1497
- };
1498
- secondary: {
1499
- background: string;
1500
- color: string;
1501
- ":not([disabled])": {
1502
- '@media(hover: hover)': {
1503
- ':hover': {
1504
- background: string;
1505
- };
1506
- };
1507
- ':active': {
1508
- background: string;
1509
- };
1510
- };
1511
- };
1512
- tertiary: {
1513
- background: string;
1514
- color: string;
1515
- ":not([disabled])": {
1516
- '@media(hover: hover)': {
1517
- ':hover': {
1518
- background: string;
1519
- };
1520
- };
1521
- ':active': {
1522
- background: string;
1523
- };
1524
- };
1525
- };
1526
- ghost: {
1527
- color: string;
1528
- ":not([disabled])": {
1529
- '@media(hover: hover)': {
1530
- ':hover': {
1531
- background: string;
1532
- };
1533
- };
1534
- ':active': {
1535
- background: string;
1536
- };
1537
- };
1538
- };
1539
- white: {
1540
- background: string;
1541
- color: string;
1542
- ":not([disabled])": {
1543
- '@media(hover: hover)': {
1544
- ':hover': {
1545
- background: string;
1546
- };
1547
- };
1548
- ':active': {
1549
- background: string;
1550
- };
1551
- };
1552
- };
1412
+ declare const SIZE_CLASSES$2: {
1413
+ xs: string;
1414
+ sm: string;
1415
+ md: string;
1553
1416
  };
1554
-
1555
- type IconButtonSize = VariantProps<typeof getSizeStyles$3>;
1556
- type IconButtonVariant = VariantProps<typeof getVariantStyles$1>;
1417
+ declare const iconButtonVariants: (props?: ({
1418
+ variant?: "white" | "primary" | "secondary" | "tertiary" | "danger" | "ghost" | null | undefined;
1419
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
1420
+ type IconButtonSize = keyof typeof SIZE_CLASSES$2;
1421
+ type IconButtonVariant = NonNullable<VariantProps$1<typeof iconButtonVariants>['variant']>;
1557
1422
  interface IconButtonOptions {
1558
1423
  icon: ElementType<IconProps>;
1559
1424
  /**
1560
1425
  * A visually hidden label read by screen readers.
1561
- *
1562
1426
  */
1563
1427
  label: string;
1564
1428
  /**
@@ -1626,24 +1490,24 @@ interface TextFieldProps extends Omit<HTMLQdsProps<'input'>, OmittedProps$7>, Te
1626
1490
  }
1627
1491
  declare const TextField: react.ForwardRefExoticComponent<TextFieldProps & react.RefAttributes<HTMLInputElement>>;
1628
1492
 
1629
- declare const getSizeStyles$2: (theme: Theme) => {
1630
- sm: {
1631
- fontFamily: string;
1632
- fontWeight: string;
1633
- fontSize: string;
1634
- lineHeight: string;
1635
- letterSpacing: string;
1636
- };
1637
- md: {
1638
- fontFamily: string;
1639
- fontWeight: string;
1640
- fontSize: string;
1641
- lineHeight: string;
1642
- letterSpacing: string;
1643
- };
1493
+ declare const SIZE_CLASSES$1: {
1494
+ sm: string;
1495
+ md: string;
1644
1496
  };
1645
- type LabelSize = VariantProps<typeof getSizeStyles$2>;
1646
- type LabelColor = keyof Theme['colors']['text'];
1497
+ declare const COLOR_CLASSES: {
1498
+ readonly strong: "text-strong";
1499
+ readonly default: "text-default";
1500
+ readonly subtle: "text-subtle";
1501
+ readonly disabled: "text-disabled";
1502
+ readonly negative: "text-negative";
1503
+ readonly warning: "text-warning";
1504
+ readonly positive: "text-positive";
1505
+ readonly onBrandPrimary: "text-onBrandPrimary";
1506
+ readonly onBrandSecondary: "text-onBrandSecondary";
1507
+ readonly onBrandTertiary: "text-onBrandTertiary";
1508
+ };
1509
+ type LabelSize = keyof typeof SIZE_CLASSES$1;
1510
+ type LabelColor = keyof typeof COLOR_CLASSES;
1647
1511
  interface LabelOptions {
1648
1512
  /**
1649
1513
  * Size of the label
@@ -1673,15 +1537,11 @@ type LinkComponent = ForwardRefComponent<'a', LinkOptions>;
1673
1537
  type LinkProps = PropsOf<LinkComponent>;
1674
1538
  declare const Link: LinkComponent;
1675
1539
 
1676
- declare const getSizeStyles$1: (theme: Theme) => {
1677
- sm: {
1678
- fontSize: string;
1679
- };
1680
- md: {
1681
- fontSize: string;
1682
- };
1540
+ declare const SIZE_CLASSES: {
1541
+ sm: string;
1542
+ md: string;
1683
1543
  };
1684
- type LoadingDotsSize = VariantProps<typeof getSizeStyles$1>;
1544
+ type LoadingDotsSize = keyof typeof SIZE_CLASSES;
1685
1545
  interface LoadingDotsOptions {
1686
1546
  size?: ResponsiveProp<LoadingDotsSize>;
1687
1547
  }
@@ -1689,6 +1549,70 @@ interface LoadingDotsProps extends HTMLQdsProps<'span'>, LoadingDotsOptions {
1689
1549
  }
1690
1550
  declare const LoadingDots: react.ForwardRefExoticComponent<LoadingDotsProps & react.RefAttributes<HTMLSpanElement>>;
1691
1551
 
1552
+ type NamedStyles = Record<string, CSSObject>;
1553
+ type StyleInterpolation<T> = (theme: Theme) => T;
1554
+ /**
1555
+ * Creates a collection of named style rules.
1556
+ */
1557
+ declare function createStyleVariants<T extends NamedStyles>(styles: StyleInterpolation<T>): (theme: Theme) => T;
1558
+ /**
1559
+ * Create a style object. Useful for creating styles that depend on the theme.
1560
+ */
1561
+ declare function createStyle<T extends CSSObject>(styles: StyleInterpolation<T>): (theme: Theme) => T;
1562
+ type VariantProps<T extends ReturnType<typeof createStyle | typeof createStyleVariants>> = keyof ReturnType<T>;
1563
+ /**
1564
+ * Converts css `px` unit to `rem`.
1565
+ * Assumes the root font size is 16px.
1566
+ */
1567
+ declare const pxToRem: (px: number) => string;
1568
+
1569
+ declare const getFormFieldBaseStyles: (theme: Theme) => {
1570
+ '&::placeholder': {
1571
+ color: string;
1572
+ };
1573
+ '&:hover': {
1574
+ borderColor: string;
1575
+ };
1576
+ '&:focus': {
1577
+ outline: number;
1578
+ borderColor: string;
1579
+ boxShadow: `0 0 0 1px ${string}`;
1580
+ };
1581
+ '&[aria-invalid="true"]': {
1582
+ borderColor: string;
1583
+ '&:focus': {
1584
+ boxShadow: `0 0 0 1px ${string}`;
1585
+ };
1586
+ };
1587
+ '&[disabled], &:disabled, &[data-disabled]': {
1588
+ opacity: number;
1589
+ borderColor: string;
1590
+ };
1591
+ transitionProperty: "opacity, border-color, box-shadow";
1592
+ transitionDuration: "120ms";
1593
+ transitionTimingFunction: "ease";
1594
+ fontFamily: string;
1595
+ fontWeight: string;
1596
+ fontSize: string;
1597
+ lineHeight: string;
1598
+ letterSpacing: string;
1599
+ width: string;
1600
+ minWidth: number;
1601
+ appearance: "none";
1602
+ paddingLeft: string;
1603
+ paddingRight: string;
1604
+ border: string;
1605
+ borderRadius: string;
1606
+ backgroundColor: string;
1607
+ color: string;
1608
+ WebkitTouchCallout: "none";
1609
+ WebkitTapHighlightColor: "transparent";
1610
+ '&::-webkit-date-and-time-value': {
1611
+ textAlign: "left";
1612
+ };
1613
+ alignItems: "center";
1614
+ };
1615
+
1692
1616
  declare const getSizeStyles: (theme: Theme) => {
1693
1617
  xs: {
1694
1618
  fontFamily: string;
@@ -2067,20 +1991,27 @@ interface TextareaProps extends Omit<HTMLQdsProps<'textarea'>, OmittedProps$2>,
2067
1991
  }
2068
1992
  declare const Textarea: react.ForwardRefExoticComponent<TextareaProps & react.RefAttributes<HTMLTextAreaElement>>;
2069
1993
 
2070
- declare const getVariantStyles: (theme: Theme) => {
2071
- neutral: {
2072
- background: string;
2073
- color: string;
2074
- };
2075
- error: {
2076
- background: string;
2077
- color: string;
2078
- };
1994
+ declare const VARIANT_CLASSES: {
1995
+ readonly neutral: "bg-black text-white";
1996
+ readonly error: "bg-negative text-white";
2079
1997
  };
2080
- type ToastVariant = VariantProps<typeof getVariantStyles>;
1998
+ type ToastVariant = keyof typeof VARIANT_CLASSES;
1999
+ interface ToastOptions$1 {
2000
+ text: string;
2001
+ variant?: ToastVariant;
2002
+ }
2003
+ type OmittedProps$1 = 'children';
2004
+ interface ToastProps extends Omit<HTMLQdsProps<'div'>, OmittedProps$1>, ToastOptions$1 {
2005
+ }
2006
+ /**
2007
+ * We style a separate div as a child for Radix Toast.Root in order to meet the QDS accessibility requirements & animate it
2008
+ * Radix uses <ol> and <li> elements for Toast elements in combination with role="status", which is not allowed according to a11y standards
2009
+ * @see https://github.com/radix-ui/primitives/issues/1750
2010
+ */
2011
+ declare function Toast(props: ToastProps & Toast$1.ToastProps): react_jsx_runtime.JSX.Element;
2081
2012
 
2082
2013
  type Id = number | string;
2083
- interface ToastOptions$1 {
2014
+ interface ToastOptions {
2084
2015
  /**
2085
2016
  * Unique identifier for the toast (can be used for removing it prematurely). If a toast with this
2086
2017
  * identifier already exists it will be removed before the new toast is added.
@@ -2088,21 +2019,12 @@ interface ToastOptions$1 {
2088
2019
  */
2089
2020
  id?: Id;
2090
2021
  }
2091
- declare const toast: ((text: string, options?: ToastOptions$1) => Id) & {
2092
- error: (text: string, options?: ToastOptions$1) => Id;
2022
+ declare const toast: ((text: string, options?: ToastOptions) => Id) & {
2023
+ error: (text: string, options?: ToastOptions) => Id;
2093
2024
  remove: (id: Id) => void;
2094
2025
  removeAll: () => void;
2095
2026
  };
2096
2027
 
2097
- interface ToastOptions {
2098
- text: string;
2099
- variant?: ToastVariant;
2100
- }
2101
- type OmittedProps$1 = 'children';
2102
- interface ToastProps extends Omit<HTMLQdsProps<'div'>, OmittedProps$1>, ToastOptions {
2103
- }
2104
- declare function Toast(props: ToastProps & Toast$1.ToastProps): react_jsx_runtime.JSX.Element;
2105
-
2106
2028
  interface UseBreakpointOptions {
2107
2029
  /**
2108
2030
  * If `true` the initial value will be `base` instead of the current breakpoint.