@cdx-ui/components 0.0.1-beta.43 → 0.0.1-beta.45
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/lib/commonjs/components/AlertDialog/index.js +1 -1
- package/lib/commonjs/components/AlertDialog/index.js.map +1 -1
- package/lib/commonjs/components/Button/index.js +12 -1
- package/lib/commonjs/components/Button/index.js.map +1 -1
- package/lib/commonjs/components/Button/styles.js +25 -25
- package/lib/commonjs/components/Button/styles.js.map +1 -1
- package/lib/commonjs/components/Chip/styles.js +1 -1
- package/lib/commonjs/components/Chip/styles.js.map +1 -1
- package/lib/commonjs/components/Link/index.js +22 -3
- package/lib/commonjs/components/Link/index.js.map +1 -1
- package/lib/commonjs/components/Link/styles.js +56 -6
- package/lib/commonjs/components/Link/styles.js.map +1 -1
- package/lib/commonjs/components/ProgressSegmented/index.js +2 -0
- package/lib/commonjs/components/ProgressSegmented/index.js.map +1 -1
- package/lib/commonjs/figma/Button.figma.js +1 -5
- package/lib/commonjs/figma/Button.figma.js.map +1 -1
- package/lib/commonjs/figma/Link.figma.js +30 -0
- package/lib/commonjs/figma/Link.figma.js.map +1 -0
- package/lib/module/components/AlertDialog/index.js +1 -1
- package/lib/module/components/AlertDialog/index.js.map +1 -1
- package/lib/module/components/Button/index.js +13 -2
- package/lib/module/components/Button/index.js.map +1 -1
- package/lib/module/components/Button/styles.js +25 -25
- package/lib/module/components/Button/styles.js.map +1 -1
- package/lib/module/components/Chip/styles.js +1 -1
- package/lib/module/components/Chip/styles.js.map +1 -1
- package/lib/module/components/Link/index.js +25 -6
- package/lib/module/components/Link/index.js.map +1 -1
- package/lib/module/components/Link/styles.js +55 -6
- package/lib/module/components/Link/styles.js.map +1 -1
- package/lib/module/components/ProgressSegmented/index.js +2 -0
- package/lib/module/components/ProgressSegmented/index.js.map +1 -1
- package/lib/module/figma/Button.figma.js +1 -5
- package/lib/module/figma/Button.figma.js.map +1 -1
- package/lib/module/figma/Link.figma.js +24 -0
- package/lib/module/figma/Link.figma.js.map +1 -0
- package/lib/typescript/components/Button/index.d.ts +13 -1
- package/lib/typescript/components/Button/index.d.ts.map +1 -1
- package/lib/typescript/components/Button/styles.d.ts +3 -3
- package/lib/typescript/components/IconButton/styles.d.ts +2 -2
- package/lib/typescript/components/Link/index.d.ts +2 -2
- package/lib/typescript/components/Link/index.d.ts.map +1 -1
- package/lib/typescript/components/Link/styles.d.ts +9 -2
- package/lib/typescript/components/Link/styles.d.ts.map +1 -1
- package/lib/typescript/components/ProgressSegmented/index.d.ts.map +1 -1
- package/lib/typescript/figma/Button.figma.d.ts.map +1 -1
- package/lib/typescript/figma/Link.figma.d.ts +8 -0
- package/lib/typescript/figma/Link.figma.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/components/AlertDialog/index.tsx +1 -1
- package/src/components/Button/index.tsx +37 -3
- package/src/components/Button/styles.ts +25 -25
- package/src/components/Chip/styles.ts +1 -1
- package/src/components/Link/index.tsx +22 -9
- package/src/components/Link/styles.ts +49 -9
- package/src/components/ProgressSegmented/index.tsx +1 -0
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { type VariantProps } from 'class-variance-authority';
|
|
2
2
|
export declare const buttonRootVariants: (props?: ({
|
|
3
|
-
variant?: "
|
|
3
|
+
variant?: "solid" | "outline" | "ghost" | null | undefined;
|
|
4
4
|
color?: "action" | "danger" | "warning" | "success" | "info" | null | undefined;
|
|
5
5
|
size?: "small" | "default" | null | undefined;
|
|
6
6
|
fullWidth?: boolean | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
8
|
export declare const buttonTextVariants: (props?: ({
|
|
9
|
-
variant?: "
|
|
9
|
+
variant?: "solid" | "outline" | "ghost" | null | undefined;
|
|
10
10
|
color?: "action" | "danger" | "warning" | "success" | "info" | null | undefined;
|
|
11
11
|
size?: "small" | "default" | null | undefined;
|
|
12
12
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
13
13
|
export declare const buttonSpinnerVariants: (props?: ({
|
|
14
|
-
variant?: "
|
|
14
|
+
variant?: "solid" | "outline" | "ghost" | null | undefined;
|
|
15
15
|
color?: "action" | "danger" | "warning" | "success" | "info" | null | undefined;
|
|
16
16
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
17
17
|
export declare const buttonGroupVariants: (props?: ({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type VariantProps } from 'class-variance-authority';
|
|
2
2
|
export declare const iconButtonRootVariants: (props?: ({
|
|
3
|
-
variant?: "
|
|
3
|
+
variant?: "solid" | "ghost" | "tint" | null | undefined;
|
|
4
4
|
color?: "action" | "danger" | "neutral" | null | undefined;
|
|
5
5
|
size?: "small" | "default" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -8,7 +8,7 @@ export declare const iconButtonGlyphVariants: (props?: ({
|
|
|
8
8
|
size?: "small" | "default" | null | undefined;
|
|
9
9
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
10
10
|
export declare const iconButtonIconColorVariants: (props?: ({
|
|
11
|
-
variant?: "
|
|
11
|
+
variant?: "solid" | "ghost" | "tint" | null | undefined;
|
|
12
12
|
color?: "action" | "danger" | "neutral" | null | undefined;
|
|
13
13
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
14
14
|
export type IconButtonVariantProps = VariantProps<typeof iconButtonRootVariants>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
import { Text
|
|
2
|
+
import { Text, View, type TextProps } from 'react-native';
|
|
3
3
|
import { type ILinkProps } from '@cdx-ui/primitives';
|
|
4
4
|
import { type IconProps } from '../Icon';
|
|
5
5
|
export { LinkProvider, type LinkConfig, type LinkAction } from '@cdx-ui/primitives';
|
|
@@ -11,7 +11,7 @@ export interface LinkLabelProps extends TextProps {
|
|
|
11
11
|
className?: string;
|
|
12
12
|
children?: ReactNode;
|
|
13
13
|
}
|
|
14
|
-
declare const LinkLabel: import("react").ForwardRefExoticComponent<LinkLabelProps & import("react").RefAttributes<
|
|
14
|
+
declare const LinkLabel: import("react").ForwardRefExoticComponent<LinkLabelProps & import("react").RefAttributes<Text>>;
|
|
15
15
|
export interface LinkIconProps extends Omit<IconProps, 'children'> {
|
|
16
16
|
}
|
|
17
17
|
declare const LinkIcon: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Link/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Link/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAuB,IAAI,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,EAAyC,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE5F,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAQ/C,OAAO,EAAE,YAAY,EAAE,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAUpF,MAAM,WAAW,SAAU,SAAQ,UAAU;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,QAAQ,4FAQZ,CAAC;AAQH,MAAM,WAAW,cAAe,SAAQ,SAAS;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,QAAA,MAAM,SAAS,iGAiBd,CAAC;AAQF,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;CAAG;AAErE,QAAA,MAAM,QAAQ;yCAAwC,aAAa;;CAKlE,CAAC;AAQF,KAAK,qBAAqB,GAAG,OAAO,QAAQ,GAAG;IAC7C,KAAK,EAAE,OAAO,SAAS,CAAC;IACxB,IAAI,EAAE,OAAO,QAAQ,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,IAAI,EAGX,qBAAqB,CAAC"}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { type VariantProps } from 'class-variance-authority';
|
|
2
2
|
export declare const linkRootVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
3
|
-
export declare const linkLabelVariants: (props?:
|
|
4
|
-
|
|
3
|
+
export declare const linkLabelVariants: (props?: ({
|
|
4
|
+
visited?: boolean | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
+
export declare const linkNativeUnderlineVariants: (props?: ({
|
|
7
|
+
visited?: boolean | null | undefined;
|
|
8
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
|
+
export declare const linkIconVariants: (props?: ({
|
|
10
|
+
visited?: boolean | null | undefined;
|
|
11
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
5
12
|
export type LinkVariantProps = VariantProps<typeof linkLabelVariants>;
|
|
6
13
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/components/Link/styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/components/Link/styles.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,eAAO,MAAM,gBAAgB,oFAc3B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;8EAe7B,CAAC;AAEF,eAAO,MAAM,2BAA2B;;8EAQtC,CAAC;AAEH,eAAO,MAAM,gBAAgB;;8EAW5B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,YAAY,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ProgressSegmented/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EAGL,KAAK,yBAAyB,EAC/B,MAAM,UAAU,CAAC;AAIlB,MAAM,WAAW,sBAAuB,SAAQ,SAAS,EAAE,yBAAyB;IAClF,0DAA0D;IAC1D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,wFAAwF;IACxF,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,CAC9B,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,OAAO,KACpB,MAAM,CAAC;IACZ,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ProgressSegmented/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EAGL,KAAK,yBAAyB,EAC/B,MAAM,UAAU,CAAC;AAIlB,MAAM,WAAW,sBAAuB,SAAQ,SAAS,EAAE,yBAAyB;IAClF,0DAA0D;IAC1D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,wFAAwF;IACxF,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,CAC9B,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,OAAO,KACpB,MAAM,CAAC;IACZ,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,eAAO,MAAM,iBAAiB,yGA0E7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.figma.d.ts","sourceRoot":"","sources":["../../../src/figma/Button.figma.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;
|
|
1
|
+
{"version":3,"file":"Button.figma.d.ts","sourceRoot":"","sources":["../../../src/figma/Button.figma.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;AAkD1B,wBASE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Link.figma.d.ts","sourceRoot":"","sources":["../../../src/figma/Link.figma.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;AAa1B,wBAOE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cdx-ui/components",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.45",
|
|
4
4
|
"main": "lib/commonjs/index.js",
|
|
5
5
|
"module": "lib/module/index.js",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -67,9 +67,9 @@
|
|
|
67
67
|
"@gorhom/bottom-sheet": "^5.2.6",
|
|
68
68
|
"class-variance-authority": "^0.7.1",
|
|
69
69
|
"uniwind": "1.6.1",
|
|
70
|
-
"@cdx-ui/
|
|
71
|
-
"@cdx-ui/utils": "0.0.1-beta.
|
|
72
|
-
"@cdx-ui/
|
|
70
|
+
"@cdx-ui/primitives": "0.0.1-beta.45",
|
|
71
|
+
"@cdx-ui/utils": "0.0.1-beta.45",
|
|
72
|
+
"@cdx-ui/icons": "0.0.1-beta.45"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@types/react": "*",
|
|
@@ -54,7 +54,7 @@ const AlertDialogAction = forwardRef<View, AlertDialogActionProps>(
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
return (
|
|
57
|
-
<Button ref={ref} variant="
|
|
57
|
+
<Button ref={ref} variant="solid" color={color} className={className} {...props}>
|
|
58
58
|
<Button.Label>{children}</Button.Label>
|
|
59
59
|
</Button>
|
|
60
60
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { forwardRef, type ReactElement, type ReactNode } from 'react';
|
|
1
|
+
import { forwardRef, useEffect, type ReactElement, type ReactNode } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
ActivityIndicator,
|
|
4
4
|
Pressable,
|
|
@@ -40,7 +40,25 @@ const ButtonPrimitive = createButton({
|
|
|
40
40
|
// STYLED ROOT COMPONENT
|
|
41
41
|
// =============================================================================
|
|
42
42
|
|
|
43
|
-
export
|
|
43
|
+
export type ButtonVariant = 'solid' | 'outline' | 'ghost';
|
|
44
|
+
|
|
45
|
+
/** @deprecated Use {@link ButtonVariant} (`'solid'`) instead. */
|
|
46
|
+
export type ButtonVariantStrong = 'strong';
|
|
47
|
+
|
|
48
|
+
let hasWarnedStrongButtonVariant = false;
|
|
49
|
+
|
|
50
|
+
export interface ButtonProps
|
|
51
|
+
extends PressableProps, IButtonProps, Omit<ButtonVariantProps, 'variant'> {
|
|
52
|
+
/**
|
|
53
|
+
* Visual style variant.
|
|
54
|
+
* @default 'solid'
|
|
55
|
+
*/
|
|
56
|
+
variant?:
|
|
57
|
+
| ButtonVariant
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated Use `'solid'` instead.
|
|
60
|
+
*/
|
|
61
|
+
| 'strong';
|
|
44
62
|
className?: string;
|
|
45
63
|
children?: ReactNode;
|
|
46
64
|
}
|
|
@@ -48,7 +66,7 @@ export interface ButtonProps extends PressableProps, IButtonProps, ButtonVariant
|
|
|
48
66
|
const ButtonRoot = forwardRef<View, ButtonProps>(
|
|
49
67
|
(
|
|
50
68
|
{
|
|
51
|
-
variant = '
|
|
69
|
+
variant: variantProp = 'solid',
|
|
52
70
|
color = 'action',
|
|
53
71
|
size = 'default',
|
|
54
72
|
fullWidth = false,
|
|
@@ -59,6 +77,22 @@ const ButtonRoot = forwardRef<View, ButtonProps>(
|
|
|
59
77
|
},
|
|
60
78
|
ref,
|
|
61
79
|
) => {
|
|
80
|
+
// TODO: Remove this once the `strong` variant is removed.
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
if (
|
|
83
|
+
typeof process !== 'undefined' &&
|
|
84
|
+
process.env.NODE_ENV !== 'production' &&
|
|
85
|
+
variantProp === 'strong' &&
|
|
86
|
+
!hasWarnedStrongButtonVariant
|
|
87
|
+
) {
|
|
88
|
+
hasWarnedStrongButtonVariant = true;
|
|
89
|
+
console.warn(
|
|
90
|
+
'[Button] The `strong` variant is deprecated and will be removed in a future major release. Use `solid` instead.',
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
}, [variantProp]);
|
|
94
|
+
|
|
95
|
+
const variant = variantProp === 'strong' ? 'solid' : variantProp;
|
|
62
96
|
const computedClassName = cn(
|
|
63
97
|
buttonRootVariants({ variant, color, size, fullWidth }),
|
|
64
98
|
className,
|
|
@@ -12,12 +12,12 @@ export const buttonRootVariants = cva(
|
|
|
12
12
|
TRANSITION_COLORS,
|
|
13
13
|
'data-[disabled=true]:opacity-[var(--opacity-disabled)]',
|
|
14
14
|
DISABLED_CURSOR,
|
|
15
|
-
'web:data-[focus-visible=true]:ring-2 web:data-[focus-visible=true]:ring-
|
|
15
|
+
'web:data-[focus-visible=true]:ring-2 web:data-[focus-visible=true]:ring-stroke-focus web:data-[focus-visible=true]:ring-offset-2',
|
|
16
16
|
],
|
|
17
17
|
{
|
|
18
18
|
variants: {
|
|
19
19
|
variant: {
|
|
20
|
-
|
|
20
|
+
solid: ['border-b-1 border-black/75'], // TODO: Replace with token
|
|
21
21
|
outline: ['bg-transparent', 'border border-stroke-primary'],
|
|
22
22
|
ghost: ['bg-transparent'],
|
|
23
23
|
},
|
|
@@ -38,9 +38,9 @@ export const buttonRootVariants = cva(
|
|
|
38
38
|
},
|
|
39
39
|
},
|
|
40
40
|
compoundVariants: [
|
|
41
|
-
// ──
|
|
41
|
+
// ── solid × color (filled surface) ──────────────────────────────
|
|
42
42
|
{
|
|
43
|
-
variant: '
|
|
43
|
+
variant: 'solid',
|
|
44
44
|
color: 'action',
|
|
45
45
|
className: [
|
|
46
46
|
'bg-surface-action-strong',
|
|
@@ -51,7 +51,7 @@ export const buttonRootVariants = cva(
|
|
|
51
51
|
],
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
|
-
variant: '
|
|
54
|
+
variant: 'solid',
|
|
55
55
|
color: 'danger',
|
|
56
56
|
className: [
|
|
57
57
|
'bg-surface-danger-strong',
|
|
@@ -62,7 +62,7 @@ export const buttonRootVariants = cva(
|
|
|
62
62
|
],
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
|
-
variant: '
|
|
65
|
+
variant: 'solid',
|
|
66
66
|
color: 'warning',
|
|
67
67
|
className: [
|
|
68
68
|
'bg-surface-warning-strong',
|
|
@@ -73,7 +73,7 @@ export const buttonRootVariants = cva(
|
|
|
73
73
|
],
|
|
74
74
|
},
|
|
75
75
|
{
|
|
76
|
-
variant: '
|
|
76
|
+
variant: 'solid',
|
|
77
77
|
color: 'success',
|
|
78
78
|
className: [
|
|
79
79
|
'bg-surface-success-strong',
|
|
@@ -84,7 +84,7 @@ export const buttonRootVariants = cva(
|
|
|
84
84
|
],
|
|
85
85
|
},
|
|
86
86
|
{
|
|
87
|
-
variant: '
|
|
87
|
+
variant: 'solid',
|
|
88
88
|
color: 'info',
|
|
89
89
|
className: [
|
|
90
90
|
'bg-surface-info-strong',
|
|
@@ -205,7 +205,7 @@ export const buttonRootVariants = cva(
|
|
|
205
205
|
},
|
|
206
206
|
],
|
|
207
207
|
defaultVariants: {
|
|
208
|
-
variant: '
|
|
208
|
+
variant: 'solid',
|
|
209
209
|
color: 'action',
|
|
210
210
|
size: 'default',
|
|
211
211
|
fullWidth: false,
|
|
@@ -216,7 +216,7 @@ export const buttonRootVariants = cva(
|
|
|
216
216
|
export const buttonTextVariants = cva(['font-medium', 'text-center'], {
|
|
217
217
|
variants: {
|
|
218
218
|
variant: {
|
|
219
|
-
|
|
219
|
+
solid: [],
|
|
220
220
|
outline: [],
|
|
221
221
|
ghost: [],
|
|
222
222
|
},
|
|
@@ -233,12 +233,12 @@ export const buttonTextVariants = cva(['font-medium', 'text-center'], {
|
|
|
233
233
|
},
|
|
234
234
|
},
|
|
235
235
|
compoundVariants: [
|
|
236
|
-
// ──
|
|
237
|
-
{ variant: '
|
|
238
|
-
{ variant: '
|
|
239
|
-
{ variant: '
|
|
240
|
-
{ variant: '
|
|
241
|
-
{ variant: '
|
|
236
|
+
// ── solid × color (filled foreground text) ──────────────────────
|
|
237
|
+
{ variant: 'solid', color: 'action', className: 'text-content-action-on-strong' },
|
|
238
|
+
{ variant: 'solid', color: 'danger', className: 'text-content-danger-on-strong' },
|
|
239
|
+
{ variant: 'solid', color: 'warning', className: 'text-content-warning-on-strong' },
|
|
240
|
+
{ variant: 'solid', color: 'success', className: 'text-content-success-on-strong' },
|
|
241
|
+
{ variant: 'solid', color: 'info', className: 'text-content-info-on-strong' },
|
|
242
242
|
|
|
243
243
|
// ── outline/ghost × color (transparent foreground text) ──────────
|
|
244
244
|
{ variant: ['outline', 'ghost'], color: 'action', className: 'text-content-action' },
|
|
@@ -248,7 +248,7 @@ export const buttonTextVariants = cva(['font-medium', 'text-center'], {
|
|
|
248
248
|
{ variant: ['outline', 'ghost'], color: 'info', className: 'text-content-info' },
|
|
249
249
|
],
|
|
250
250
|
defaultVariants: {
|
|
251
|
-
variant: '
|
|
251
|
+
variant: 'solid',
|
|
252
252
|
color: 'action',
|
|
253
253
|
size: 'default',
|
|
254
254
|
},
|
|
@@ -257,7 +257,7 @@ export const buttonTextVariants = cva(['font-medium', 'text-center'], {
|
|
|
257
257
|
export const buttonSpinnerVariants = cva([], {
|
|
258
258
|
variants: {
|
|
259
259
|
variant: {
|
|
260
|
-
|
|
260
|
+
solid: [],
|
|
261
261
|
outline: [],
|
|
262
262
|
ghost: [],
|
|
263
263
|
},
|
|
@@ -270,29 +270,29 @@ export const buttonSpinnerVariants = cva([], {
|
|
|
270
270
|
},
|
|
271
271
|
},
|
|
272
272
|
compoundVariants: [
|
|
273
|
-
// ──
|
|
273
|
+
// ── solid × color ───────────────────────────────────────────────
|
|
274
274
|
{
|
|
275
|
-
variant: '
|
|
275
|
+
variant: 'solid',
|
|
276
276
|
color: 'action',
|
|
277
277
|
className: 'accent-[var(--color-content-action-on-strong)]',
|
|
278
278
|
},
|
|
279
279
|
{
|
|
280
|
-
variant: '
|
|
280
|
+
variant: 'solid',
|
|
281
281
|
color: 'danger',
|
|
282
282
|
className: 'accent-[var(--color-content-danger-on-strong)]',
|
|
283
283
|
},
|
|
284
284
|
{
|
|
285
|
-
variant: '
|
|
285
|
+
variant: 'solid',
|
|
286
286
|
color: 'warning',
|
|
287
287
|
className: 'accent-[var(--color-content-warning-on-strong)]',
|
|
288
288
|
},
|
|
289
289
|
{
|
|
290
|
-
variant: '
|
|
290
|
+
variant: 'solid',
|
|
291
291
|
color: 'success',
|
|
292
292
|
className: 'accent-[var(--color-content-success-on-strong)]',
|
|
293
293
|
},
|
|
294
294
|
{
|
|
295
|
-
variant: '
|
|
295
|
+
variant: 'solid',
|
|
296
296
|
color: 'info',
|
|
297
297
|
className: 'accent-[var(--color-content-info-on-strong)]',
|
|
298
298
|
},
|
|
@@ -325,7 +325,7 @@ export const buttonSpinnerVariants = cva([], {
|
|
|
325
325
|
},
|
|
326
326
|
],
|
|
327
327
|
defaultVariants: {
|
|
328
|
-
variant: '
|
|
328
|
+
variant: 'solid',
|
|
329
329
|
color: 'action',
|
|
330
330
|
},
|
|
331
331
|
});
|
|
@@ -9,7 +9,7 @@ const chipInteractiveRoot = [
|
|
|
9
9
|
Platform.select({
|
|
10
10
|
web: [
|
|
11
11
|
'outline-none',
|
|
12
|
-
'web:data-[focus-visible=true]:ring-2 web:data-[focus-visible=true]:ring-
|
|
12
|
+
'web:data-[focus-visible=true]:ring-2 web:data-[focus-visible=true]:ring-stroke-focus web:data-[focus-visible=true]:ring-offset-2',
|
|
13
13
|
].join(' '),
|
|
14
14
|
default: '',
|
|
15
15
|
}),
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { forwardRef, type ReactNode } from 'react';
|
|
2
|
-
import { Pressable, Text
|
|
3
|
-
import { createLink, type ILinkProps } from '@cdx-ui/primitives';
|
|
2
|
+
import { Platform, Pressable, Text, View, type TextProps } from 'react-native';
|
|
3
|
+
import { createLink, useLinkInteractionContext, type ILinkProps } from '@cdx-ui/primitives';
|
|
4
4
|
import { cn } from '@cdx-ui/utils';
|
|
5
5
|
import { Icon, type IconProps } from '../Icon';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
linkIconVariants,
|
|
8
|
+
linkLabelVariants,
|
|
9
|
+
linkNativeUnderlineVariants,
|
|
10
|
+
linkRootVariants,
|
|
11
|
+
} from './styles';
|
|
7
12
|
|
|
8
13
|
export { LinkProvider, type LinkConfig, type LinkAction } from '@cdx-ui/primitives';
|
|
9
14
|
|
|
@@ -40,15 +45,22 @@ export interface LinkLabelProps extends TextProps {
|
|
|
40
45
|
children?: ReactNode;
|
|
41
46
|
}
|
|
42
47
|
|
|
43
|
-
const LinkLabel = forwardRef<
|
|
48
|
+
const LinkLabel = forwardRef<Text, LinkLabelProps>(
|
|
44
49
|
({ className, children, style, ...props }, ref) => {
|
|
45
|
-
const
|
|
50
|
+
const { visited } = useLinkInteractionContext();
|
|
51
|
+
const computedClassName = cn(linkLabelVariants({ visited }), className);
|
|
46
52
|
|
|
47
|
-
|
|
48
|
-
<
|
|
53
|
+
const textElement = (
|
|
54
|
+
<Text ref={ref} className={computedClassName} style={style} {...props}>
|
|
49
55
|
{children}
|
|
50
|
-
</
|
|
56
|
+
</Text>
|
|
51
57
|
);
|
|
58
|
+
|
|
59
|
+
if (Platform.OS === 'web') {
|
|
60
|
+
return textElement;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return <View className={cn(linkNativeUnderlineVariants({ visited }))}>{textElement}</View>;
|
|
52
64
|
},
|
|
53
65
|
);
|
|
54
66
|
|
|
@@ -61,7 +73,8 @@ LinkLabel.displayName = 'Link.Label';
|
|
|
61
73
|
export interface LinkIconProps extends Omit<IconProps, 'children'> {}
|
|
62
74
|
|
|
63
75
|
const LinkIcon = ({ className, style, as, ...props }: LinkIconProps) => {
|
|
64
|
-
const
|
|
76
|
+
const { visited } = useLinkInteractionContext();
|
|
77
|
+
const computedClassName = cn(linkIconVariants({ visited }), className);
|
|
65
78
|
|
|
66
79
|
return <Icon as={as} className={computedClassName} style={style} {...props} />;
|
|
67
80
|
};
|
|
@@ -1,21 +1,61 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
1
2
|
import { cva, type VariantProps } from 'class-variance-authority';
|
|
2
3
|
import { TRANSITION_COLORS } from '../../styles/primitives';
|
|
3
4
|
|
|
4
|
-
// TODO: Handle visited state
|
|
5
|
-
|
|
6
5
|
export const linkRootVariants = cva([
|
|
7
6
|
'flex-row items-center gap-1',
|
|
8
|
-
|
|
7
|
+
Platform.select({ web: 'web:inline-flex web:self-start', default: '' }),
|
|
9
8
|
TRANSITION_COLORS,
|
|
9
|
+
'web:outline-none web:focus:outline-none web:focus-visible:outline-none',
|
|
10
|
+
'web:data-[focus-visible=true]:rounded-[2px]',
|
|
10
11
|
'web:data-[focus-visible=true]:ring-2 web:data-[focus-visible=true]:ring-stroke-focus web:data-[focus-visible=true]:ring-offset-2',
|
|
12
|
+
// Web: set color on the anchor so Label/Icon can text-inherit (incl. browser :visited).
|
|
13
|
+
'web:text-content-link',
|
|
14
|
+
'web:visited:text-content-link-visited',
|
|
15
|
+
'web:hover:text-content-primary',
|
|
16
|
+
'web:visited:hover:text-content-primary',
|
|
17
|
+
'data-[visited=true]:text-content-link-visited',
|
|
18
|
+
'web:data-[hover=true]:text-content-primary',
|
|
11
19
|
]);
|
|
12
20
|
|
|
13
|
-
export const linkLabelVariants = cva(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
21
|
+
export const linkLabelVariants = cva(
|
|
22
|
+
[
|
|
23
|
+
'body-md',
|
|
24
|
+
Platform.select({ web: 'underline underline-offset-4', default: '' }),
|
|
25
|
+
Platform.select({ web: 'text-inherit', default: 'text-content-link' }),
|
|
26
|
+
],
|
|
27
|
+
{
|
|
28
|
+
variants: {
|
|
29
|
+
visited: {
|
|
30
|
+
true: Platform.select({ web: '', default: 'text-content-link-visited' }),
|
|
31
|
+
false: '',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
defaultVariants: { visited: false },
|
|
35
|
+
},
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
export const linkNativeUnderlineVariants = cva(['border-b border-content-link pb-0.5'], {
|
|
39
|
+
variants: {
|
|
40
|
+
visited: {
|
|
41
|
+
true: 'border-content-link-visited',
|
|
42
|
+
false: '',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
defaultVariants: { visited: false },
|
|
46
|
+
});
|
|
18
47
|
|
|
19
|
-
export const linkIconVariants = cva(
|
|
48
|
+
export const linkIconVariants = cva(
|
|
49
|
+
['size-4', Platform.select({ web: 'text-inherit', default: 'text-content-link' })],
|
|
50
|
+
{
|
|
51
|
+
variants: {
|
|
52
|
+
visited: {
|
|
53
|
+
true: Platform.select({ web: '', default: 'text-content-link-visited' }),
|
|
54
|
+
false: '',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
defaultVariants: { visited: false },
|
|
58
|
+
},
|
|
59
|
+
);
|
|
20
60
|
|
|
21
61
|
export type LinkVariantProps = VariantProps<typeof linkLabelVariants>;
|