@elliemae/ds-card-v3-poc 3.80.0-next.72 → 3.80.0-next.76
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/cjs/CardV3.js +16 -7
- package/dist/cjs/CardV3.js.map +2 -2
- package/dist/cjs/react-desc-prop-types.js.map +1 -1
- package/dist/cjs/styled.js +9 -4
- package/dist/cjs/styled.js.map +2 -2
- package/dist/esm/CardV3.js +25 -9
- package/dist/esm/CardV3.js.map +2 -2
- package/dist/esm/styled.js +10 -5
- package/dist/esm/styled.js.map +2 -2
- package/dist/types/react-desc-prop-types.d.ts +2 -0
- package/dist/types/styled.d.ts +11 -0
- package/package.json +6 -6
package/dist/cjs/CardV3.js
CHANGED
|
@@ -45,19 +45,25 @@ const defaultProps = {
|
|
|
45
45
|
};
|
|
46
46
|
const Card = (props) => {
|
|
47
47
|
const propsWithDefault = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(props, defaultProps);
|
|
48
|
-
const { children, hasError, disabled, isOverlay, onClick, isSelected, isMultiSelect } = propsWithDefault;
|
|
48
|
+
const { children, hasError, disabled, applyAriaDisabled, isOverlay, onClick, isSelected, isMultiSelect } = propsWithDefault;
|
|
49
|
+
const isSoftLocked = Boolean(applyAriaDisabled) && !disabled;
|
|
49
50
|
const StyledCardContainer = (0, import_react.useMemo)(() => {
|
|
50
|
-
if (onClick && !disabled) {
|
|
51
|
-
return import_styled.StyledButtonCard;
|
|
52
|
-
}
|
|
53
51
|
if (disabled) {
|
|
54
52
|
return import_styled.StyledCardDisabled;
|
|
55
53
|
}
|
|
54
|
+
if (isSoftLocked) {
|
|
55
|
+
return import_styled.StyledCardSoftLocked;
|
|
56
|
+
}
|
|
57
|
+
if (onClick) {
|
|
58
|
+
return import_styled.StyledButtonCard;
|
|
59
|
+
}
|
|
56
60
|
return import_styled.StyledCard;
|
|
57
|
-
}, [disabled, onClick]);
|
|
61
|
+
}, [disabled, isSoftLocked, onClick]);
|
|
58
62
|
const globalsAttrs = (0, import_ds_props_helpers.useGetGlobalAttributes)(propsWithDefault);
|
|
63
|
+
const globalsAttrsWithoutLock = (0, import_ds_props_helpers.omitLockAttributes)(globalsAttrs);
|
|
59
64
|
const xstyledProps = (0, import_ds_props_helpers.useGetXstyledProps)(propsWithDefault);
|
|
60
65
|
const getOwnerProps = (0, import_react.useCallback)(() => propsWithDefault, [propsWithDefault]);
|
|
66
|
+
const isCardDisabled = (0, import_ds_props_helpers.isLocked)({ disabled, applyAriaDisabled });
|
|
61
67
|
const ctx = (0, import_react.useMemo)(
|
|
62
68
|
() => ({
|
|
63
69
|
isMultiSelect,
|
|
@@ -73,19 +79,22 @@ const Card = (props) => {
|
|
|
73
79
|
border: "solid 1px neutral-100",
|
|
74
80
|
boxShadow: "xs",
|
|
75
81
|
isOverlay,
|
|
76
|
-
|
|
82
|
+
$disabled: Boolean(disabled),
|
|
83
|
+
$applyAriaDisabled: isSoftLocked,
|
|
84
|
+
...(0, import_ds_props_helpers.omitLockedHandlers)(globalsAttrsWithoutLock, isCardDisabled),
|
|
77
85
|
...xstyledProps,
|
|
78
86
|
"data-disabled": disabled,
|
|
87
|
+
"data-apply-aria-disabled": isSoftLocked || void 0,
|
|
79
88
|
"data-selected": isSelected,
|
|
80
89
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_parts.FocusRing, { target: `[data-testid=${import_CardV3Definitions.DSCardV3DataTestIds.ACTION_AREA}]`, hasError, children: [
|
|
81
90
|
onClick ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
82
91
|
import_styled.CardActionArea,
|
|
83
92
|
{
|
|
84
93
|
disabled,
|
|
94
|
+
"aria-disabled": isSoftLocked ? true : void 0,
|
|
85
95
|
"data-testid": import_CardV3Definitions.DSCardV3DataTestIds.ACTION_AREA,
|
|
86
96
|
"aria-selected": isSelected,
|
|
87
97
|
"aria-multiselectable": isMultiSelect,
|
|
88
|
-
"aria-disabled": disabled,
|
|
89
98
|
"aria-invalid": hasError,
|
|
90
99
|
getOwnerProps
|
|
91
100
|
}
|
package/dist/cjs/CardV3.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/CardV3.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\n\n/* eslint-disable react/display-name */\nimport type { DSGridT } from '@elliemae/ds-grid';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\n\n/* eslint-disable react/display-name */\nimport type { DSGridT } from '@elliemae/ds-grid';\nimport {\n isLocked,\n omitLockedHandlers,\n omitLockAttributes,\n useGetGlobalAttributes,\n useGetXstyledProps,\n useMemoMergePropsWithDefault,\n} from '@elliemae/ds-props-helpers';\nimport React, { useCallback, useMemo } from 'react';\nimport { DSCardV3DataTestIds } from './CardV3Definitions.js';\nimport { CardContext } from './parts/CardContext.js';\nimport { FocusRing } from './parts/index.js';\nimport type { CardT } from './react-desc-prop-types.js';\nimport { CardActionArea, StyledButtonCard, StyledCard, StyledCardDisabled, StyledCardSoftLocked } from './styled.js';\n\nexport const defaultProps: CardT.DefaultProps = {\n hasError: false,\n};\n\n// create acontext\n\nexport const Card: React.ComponentType<CardT.InternalProps> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault<CardT.Props>(props, defaultProps);\n const { children, hasError, disabled, applyAriaDisabled, isOverlay, onClick, isSelected, isMultiSelect } =\n propsWithDefault;\n // disabled is the hard lock (out of the keyboard flow, no hover); applyAriaDisabled is the soft lock (reachable, ignores every action)\n const isSoftLocked = Boolean(applyAriaDisabled) && !disabled;\n\n const StyledCardContainer = useMemo(() => {\n if (disabled) {\n return StyledCardDisabled;\n }\n if (isSoftLocked) {\n return StyledCardSoftLocked;\n }\n if (onClick) {\n return StyledButtonCard;\n }\n return StyledCard;\n }, [disabled, isSoftLocked, onClick]);\n\n const globalsAttrs = useGetGlobalAttributes<CardT.InternalProps, HTMLDivElement, DSGridT.Props>(propsWithDefault);\n // disabled and readOnly are global attributes too: the container is a div, so they are not spread onto it\n // (isCardDisabled gates the consumer handlers)\n const globalsAttrsWithoutLock = omitLockAttributes(globalsAttrs);\n const xstyledProps = useGetXstyledProps(propsWithDefault);\n const getOwnerProps = useCallback(() => propsWithDefault, [propsWithDefault]);\n\n // a locked card blocks the container's consumer actions: the card body is not a native control, so nothing else guards it\n const isCardDisabled = isLocked({ disabled, applyAriaDisabled });\n\n const ctx = useMemo(\n () => ({\n isMultiSelect,\n disabled,\n isSelected,\n onClick,\n }),\n [isMultiSelect, disabled, isSelected, onClick],\n );\n\n return (\n <CardContext.Provider value={ctx}>\n <StyledCardContainer\n border=\"solid 1px neutral-100\"\n boxShadow=\"xs\"\n isOverlay={isOverlay}\n $disabled={Boolean(disabled)}\n $applyAriaDisabled={isSoftLocked}\n {...omitLockedHandlers(globalsAttrsWithoutLock, isCardDisabled)}\n {...xstyledProps}\n data-disabled={disabled}\n data-apply-aria-disabled={isSoftLocked || undefined}\n data-selected={isSelected}\n >\n <FocusRing target={`[data-testid=${DSCardV3DataTestIds.ACTION_AREA}]`} hasError={hasError}>\n {onClick ? (\n <CardActionArea\n disabled={disabled}\n aria-disabled={isSoftLocked ? true : undefined}\n data-testid={DSCardV3DataTestIds.ACTION_AREA}\n aria-selected={isSelected}\n aria-multiselectable={isMultiSelect}\n aria-invalid={hasError}\n getOwnerProps={getOwnerProps}\n />\n ) : null}\n {children}\n </FocusRing>\n </StyledCardContainer>\n </CardContext.Provider>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD+Ef;AA3ER,8BA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gBAAgB,6CAAoB,WAAW,KAAK,UACpE;AAAA,kBACC;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA,iBAAe,eAAe,OAAO;AAAA,YACrC,eAAa,6CAAoB;AAAA,YACjC,iBAAe;AAAA,YACf,wBAAsB;AAAA,YACtB,gBAAc;AAAA,YACd;AAAA;AAAA,QACF,IACE;AAAA,QACH;AAAA,SACH;AAAA;AAAA,EACF,GACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/react-desc-prop-types.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { type GlobalAttributesT } from '@elliemae/ds-props-helpers';\nimport { type DSGridT } from '@elliemae/ds-grid';\n\nexport declare namespace CardT {\n export interface RequiredProps {\n children: React.ReactNode;\n }\n\n export interface OptinalProps {\n isSelected?: boolean;\n isMultiSelect?: boolean;\n isOverlay?: boolean;\n onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n }\n\n export interface DefaultProps {\n hasError: boolean;\n }\n\n export interface Props\n extends\n RequiredProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof RequiredProps>,\n OptinalProps,\n DefaultProps {}\n export interface InternalProps\n extends\n RequiredProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof RequiredProps>,\n OptinalProps,\n Partial<DefaultProps> {}\n\n export interface CardSelectIndicatorProps {\n isSelected?: boolean;\n isMultiSelect?: boolean;\n }\n\n export interface FocusRingProps {\n target: string;\n children: React.ReactNode;\n hasError?: boolean;\n }\n\n export interface CardElementsProps extends Partial<DSGridT.InternalProps> {\n children: React.ReactNode;\n }\n}\n\nexport interface CardContextProps {\n onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n isSelected?: boolean;\n isMultiSelect?: boolean;\n disabled?: boolean;\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
4
|
+
"sourcesContent": ["import { type GlobalAttributesT } from '@elliemae/ds-props-helpers';\nimport { type DSGridT } from '@elliemae/ds-grid';\n\nexport declare namespace CardT {\n export interface RequiredProps {\n children: React.ReactNode;\n }\n\n export interface OptinalProps {\n isSelected?: boolean;\n isMultiSelect?: boolean;\n isOverlay?: boolean;\n /** soft lock: the action button stays focusable and announced as disabled, every action is ignored */\n applyAriaDisabled?: boolean;\n onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n }\n\n export interface DefaultProps {\n hasError: boolean;\n }\n\n export interface Props\n extends\n RequiredProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof RequiredProps>,\n OptinalProps,\n DefaultProps {}\n export interface InternalProps\n extends\n RequiredProps,\n Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof RequiredProps>,\n OptinalProps,\n Partial<DefaultProps> {}\n\n export interface CardSelectIndicatorProps {\n isSelected?: boolean;\n isMultiSelect?: boolean;\n }\n\n export interface FocusRingProps {\n target: string;\n children: React.ReactNode;\n hasError?: boolean;\n }\n\n export interface CardElementsProps extends Partial<DSGridT.InternalProps> {\n children: React.ReactNode;\n }\n}\n\nexport interface CardContextProps {\n onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n isSelected?: boolean;\n isMultiSelect?: boolean;\n disabled?: boolean;\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/styled.js
CHANGED
|
@@ -34,6 +34,7 @@ __export(styled_exports, {
|
|
|
34
34
|
StyledCardDisabled: () => StyledCardDisabled,
|
|
35
35
|
StyledCardError: () => StyledCardError,
|
|
36
36
|
StyledCardSingleIndicator: () => StyledCardSingleIndicator,
|
|
37
|
+
StyledCardSoftLocked: () => StyledCardSoftLocked,
|
|
37
38
|
StyledFocusRing: () => StyledFocusRing
|
|
38
39
|
});
|
|
39
40
|
module.exports = __toCommonJS(styled_exports);
|
|
@@ -99,16 +100,20 @@ const StyledFocusRing = (0, import_ds_system.styled)(import_ds_grid.Grid)`
|
|
|
99
100
|
return "none";
|
|
100
101
|
}};
|
|
101
102
|
`;
|
|
103
|
+
const StyledCardSoftLocked = (0, import_ds_system.styled)(StyledCard)`
|
|
104
|
+
background-color: ${({ theme }) => theme.colors.neutral["080"]};
|
|
105
|
+
* {
|
|
106
|
+
color: ${({ theme }) => theme.colors.neutral["500"]};
|
|
107
|
+
}
|
|
108
|
+
${import_ds_system.lockedStateInteractionCss}
|
|
109
|
+
`;
|
|
102
110
|
const StyledCardDisabled = (0, import_ds_system.styled)(StyledCard)`
|
|
103
|
-
cursor: not-allowed;
|
|
104
111
|
user-select: none;
|
|
105
112
|
opacity: 0.5;
|
|
106
113
|
${StyledCardSingleIndicator} {
|
|
107
114
|
background-color: ${({ theme, isSelected }) => isSelected ? theme.colors.neutral["800"] : theme.colors.neutral["080"]};
|
|
108
115
|
}
|
|
109
116
|
|
|
110
|
-
${
|
|
111
|
-
pointer-events: none;
|
|
112
|
-
}
|
|
117
|
+
${import_ds_system.lockedStateInteractionCss}
|
|
113
118
|
`;
|
|
114
119
|
//# sourceMappingURL=styled.js.map
|
package/dist/cjs/styled.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/styled.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { styled, xStyledCommonProps } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSCardV3Name, DSCardV3Slots } from './CardV3Definitions.js';\nexport const CardActionArea = styled('button', {\n name: DSCardV3Name,\n slot: DSCardV3Slots.ACTION_AREA,\n})`\n border: none;\n background-color: transparent;\n width: 0px;\n height: 0px;\n padding: 0;\n &:focus {\n outline: none;\n }\n text-align: unset;\n`;\n\n// START style cards variants\nexport const StyledCard = styled(Grid)<{\n isOverlay?: boolean;\n onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;\n}>`\n min-width: 240px;\n min-height: 56px;\n background-color: ${({ theme, isOverlay }) => (isOverlay ? theme.colors.neutral['080'] : 'white')};\n outline-offset: -2px;\n * {\n color: ${({ theme, isOverlay }) => (isOverlay ? theme.colors.neutral['500'] : 'inherit')};\n }\n\n ${xStyledCommonProps}\n`;\n\nexport const StyledButtonCard = styled(StyledCard)<{ isOverlay?: boolean }>`\n cursor: pointer;\n`;\n\nexport const StyledCardError = styled(StyledCard)`\n outline: ${({ theme }) => `2px solid ${theme.colors.danger[900]}`};\n`;\n\nexport const StyledCardSingleIndicator = styled(Grid)<{ isSelected?: boolean }>`\n width: ${({ isSelected }) => (isSelected ? '6px' : '4px')};\n align-self: normal;\n background-color: ${({ theme, isSelected }) => {\n if (isSelected) return theme.colors.brand['700'];\n return theme.colors.brand['300'];\n }};\n transition: all 0.1s ease-in-out;\n\n ${StyledCard}:not([data-disabled='true']):not([data-selected='true']):hover & {\n background-color: ${({ theme }) => theme.colors.brand['500']};\n }\n`;\n\nexport const StyledFocusRing = styled(Grid)<{ showFocusRing: boolean; hasError?: boolean }>`\n width: 100%;\n height: 100%;\n outline-offset: -1px;\n outline: ${({ showFocusRing, hasError, theme }) => {\n if (showFocusRing) {\n return `2px solid ${theme.colors.brand[700]}`;\n }\n if (hasError) {\n return `2px solid ${theme.colors.danger[900]}`;\n }\n return 'none';\n }};\n`;\n\nexport const
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,
|
|
4
|
+
"sourcesContent": ["import { styled, xStyledCommonProps, lockedStateInteractionCss } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSCardV3Name, DSCardV3Slots } from './CardV3Definitions.js';\nexport const CardActionArea = styled('button', {\n name: DSCardV3Name,\n slot: DSCardV3Slots.ACTION_AREA,\n})`\n border: none;\n background-color: transparent;\n width: 0px;\n height: 0px;\n padding: 0;\n &:focus {\n outline: none;\n }\n text-align: unset;\n`;\n\n// START style cards variants\nexport const StyledCard = styled(Grid)<{\n isOverlay?: boolean;\n $disabled?: boolean;\n $applyAriaDisabled?: boolean;\n onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;\n}>`\n min-width: 240px;\n min-height: 56px;\n background-color: ${({ theme, isOverlay }) => (isOverlay ? theme.colors.neutral['080'] : 'white')};\n outline-offset: -2px;\n * {\n color: ${({ theme, isOverlay }) => (isOverlay ? theme.colors.neutral['500'] : 'inherit')};\n }\n\n ${xStyledCommonProps}\n`;\n\nexport const StyledButtonCard = styled(StyledCard)<{ isOverlay?: boolean }>`\n cursor: pointer;\n`;\n\nexport const StyledCardError = styled(StyledCard)`\n outline: ${({ theme }) => `2px solid ${theme.colors.danger[900]}`};\n`;\n\nexport const StyledCardSingleIndicator = styled(Grid)<{ isSelected?: boolean }>`\n width: ${({ isSelected }) => (isSelected ? '6px' : '4px')};\n align-self: normal;\n background-color: ${({ theme, isSelected }) => {\n if (isSelected) return theme.colors.brand['700'];\n return theme.colors.brand['300'];\n }};\n transition: all 0.1s ease-in-out;\n\n ${StyledCard}:not([data-disabled='true']):not([data-selected='true']):hover & {\n background-color: ${({ theme }) => theme.colors.brand['500']};\n }\n`;\n\nexport const StyledFocusRing = styled(Grid)<{ showFocusRing: boolean; hasError?: boolean }>`\n width: 100%;\n height: 100%;\n outline-offset: -1px;\n outline: ${({ showFocusRing, hasError, theme }) => {\n if (showFocusRing) {\n return `2px solid ${theme.colors.brand[700]}`;\n }\n if (hasError) {\n return `2px solid ${theme.colors.danger[900]}`;\n }\n return 'none';\n }};\n`;\n\n// soft lock: the card keeps hover and keyboard focus (its focus ring is not dimmed), only the look and the cursor say\n// \"unavailable\". The card is not faded with opacity because that would also fade the focus ring.\nexport const StyledCardSoftLocked: React.FC = styled(StyledCard)<{ $applyAriaDisabled?: boolean }>`\n background-color: ${({ theme }) => theme.colors.neutral['080']};\n * {\n color: ${({ theme }) => theme.colors.neutral['500']};\n }\n ${lockedStateInteractionCss}\n`;\n\nexport const StyledCardDisabled: React.FC = styled(StyledCard)<{ isSelected?: boolean; $disabled?: boolean }>`\n user-select: none;\n opacity: 0.5;\n ${StyledCardSingleIndicator} {\n background-color: ${({ theme, isSelected }) =>\n isSelected ? theme.colors.neutral['800'] : theme.colors.neutral['080']};\n }\n\n ${lockedStateInteractionCss}\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAsE;AACtE,qBAAqB;AACrB,+BAA4C;AACrC,MAAM,qBAAiB,yBAAO,UAAU;AAAA,EAC7C,MAAM;AAAA,EACN,MAAM,uCAAc;AACtB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaM,MAAM,iBAAa,yBAAO,mBAAI;AAAA;AAAA;AAAA,sBAQf,CAAC,EAAE,OAAO,UAAU,MAAO,YAAY,MAAM,OAAO,QAAQ,KAAK,IAAI,OAAQ;AAAA;AAAA;AAAA,aAGtF,CAAC,EAAE,OAAO,UAAU,MAAO,YAAY,MAAM,OAAO,QAAQ,KAAK,IAAI,SAAU;AAAA;AAAA;AAAA,IAGxF,mCAAkB;AAAA;AAGf,MAAM,uBAAmB,yBAAO,UAAU;AAAA;AAAA;AAI1C,MAAM,sBAAkB,yBAAO,UAAU;AAAA,aACnC,CAAC,EAAE,MAAM,MAAM,aAAa,MAAM,OAAO,OAAO,G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-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
isLocked,
|
|
5
|
+
omitLockedHandlers,
|
|
6
|
+
omitLockAttributes,
|
|
7
|
+
useGetGlobalAttributes,
|
|
8
|
+
useGetXstyledProps,
|
|
9
|
+
useMemoMergePropsWithDefault
|
|
10
|
+
} from "@elliemae/ds-props-helpers";
|
|
4
11
|
import { useCallback, useMemo } from "react";
|
|
5
12
|
import { DSCardV3DataTestIds } from "./CardV3Definitions.js";
|
|
6
13
|
import { CardContext } from "./parts/CardContext.js";
|
|
7
14
|
import { FocusRing } from "./parts/index.js";
|
|
8
|
-
import { CardActionArea, StyledButtonCard, StyledCard, StyledCardDisabled } from "./styled.js";
|
|
15
|
+
import { CardActionArea, StyledButtonCard, StyledCard, StyledCardDisabled, StyledCardSoftLocked } from "./styled.js";
|
|
9
16
|
const defaultProps = {
|
|
10
17
|
hasError: false
|
|
11
18
|
};
|
|
12
19
|
const Card = (props) => {
|
|
13
20
|
const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
|
|
14
|
-
const { children, hasError, disabled, isOverlay, onClick, isSelected, isMultiSelect } = propsWithDefault;
|
|
21
|
+
const { children, hasError, disabled, applyAriaDisabled, isOverlay, onClick, isSelected, isMultiSelect } = propsWithDefault;
|
|
22
|
+
const isSoftLocked = Boolean(applyAriaDisabled) && !disabled;
|
|
15
23
|
const StyledCardContainer = useMemo(() => {
|
|
16
|
-
if (onClick && !disabled) {
|
|
17
|
-
return StyledButtonCard;
|
|
18
|
-
}
|
|
19
24
|
if (disabled) {
|
|
20
25
|
return StyledCardDisabled;
|
|
21
26
|
}
|
|
27
|
+
if (isSoftLocked) {
|
|
28
|
+
return StyledCardSoftLocked;
|
|
29
|
+
}
|
|
30
|
+
if (onClick) {
|
|
31
|
+
return StyledButtonCard;
|
|
32
|
+
}
|
|
22
33
|
return StyledCard;
|
|
23
|
-
}, [disabled, onClick]);
|
|
34
|
+
}, [disabled, isSoftLocked, onClick]);
|
|
24
35
|
const globalsAttrs = useGetGlobalAttributes(propsWithDefault);
|
|
36
|
+
const globalsAttrsWithoutLock = omitLockAttributes(globalsAttrs);
|
|
25
37
|
const xstyledProps = useGetXstyledProps(propsWithDefault);
|
|
26
38
|
const getOwnerProps = useCallback(() => propsWithDefault, [propsWithDefault]);
|
|
39
|
+
const isCardDisabled = isLocked({ disabled, applyAriaDisabled });
|
|
27
40
|
const ctx = useMemo(
|
|
28
41
|
() => ({
|
|
29
42
|
isMultiSelect,
|
|
@@ -39,19 +52,22 @@ const Card = (props) => {
|
|
|
39
52
|
border: "solid 1px neutral-100",
|
|
40
53
|
boxShadow: "xs",
|
|
41
54
|
isOverlay,
|
|
42
|
-
|
|
55
|
+
$disabled: Boolean(disabled),
|
|
56
|
+
$applyAriaDisabled: isSoftLocked,
|
|
57
|
+
...omitLockedHandlers(globalsAttrsWithoutLock, isCardDisabled),
|
|
43
58
|
...xstyledProps,
|
|
44
59
|
"data-disabled": disabled,
|
|
60
|
+
"data-apply-aria-disabled": isSoftLocked || void 0,
|
|
45
61
|
"data-selected": isSelected,
|
|
46
62
|
children: /* @__PURE__ */ jsxs(FocusRing, { target: `[data-testid=${DSCardV3DataTestIds.ACTION_AREA}]`, hasError, children: [
|
|
47
63
|
onClick ? /* @__PURE__ */ jsx(
|
|
48
64
|
CardActionArea,
|
|
49
65
|
{
|
|
50
66
|
disabled,
|
|
67
|
+
"aria-disabled": isSoftLocked ? true : void 0,
|
|
51
68
|
"data-testid": DSCardV3DataTestIds.ACTION_AREA,
|
|
52
69
|
"aria-selected": isSelected,
|
|
53
70
|
"aria-multiselectable": isMultiSelect,
|
|
54
|
-
"aria-disabled": disabled,
|
|
55
71
|
"aria-invalid": hasError,
|
|
56
72
|
getOwnerProps
|
|
57
73
|
}
|
package/dist/esm/CardV3.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/CardV3.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n\n/* eslint-disable react/display-name */\nimport type { DSGridT } from '@elliemae/ds-grid';\nimport {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n\n/* eslint-disable react/display-name */\nimport type { DSGridT } from '@elliemae/ds-grid';\nimport {\n isLocked,\n omitLockedHandlers,\n omitLockAttributes,\n useGetGlobalAttributes,\n useGetXstyledProps,\n useMemoMergePropsWithDefault,\n} from '@elliemae/ds-props-helpers';\nimport React, { useCallback, useMemo } from 'react';\nimport { DSCardV3DataTestIds } from './CardV3Definitions.js';\nimport { CardContext } from './parts/CardContext.js';\nimport { FocusRing } from './parts/index.js';\nimport type { CardT } from './react-desc-prop-types.js';\nimport { CardActionArea, StyledButtonCard, StyledCard, StyledCardDisabled, StyledCardSoftLocked } from './styled.js';\n\nexport const defaultProps: CardT.DefaultProps = {\n hasError: false,\n};\n\n// create acontext\n\nexport const Card: React.ComponentType<CardT.InternalProps> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault<CardT.Props>(props, defaultProps);\n const { children, hasError, disabled, applyAriaDisabled, isOverlay, onClick, isSelected, isMultiSelect } =\n propsWithDefault;\n // disabled is the hard lock (out of the keyboard flow, no hover); applyAriaDisabled is the soft lock (reachable, ignores every action)\n const isSoftLocked = Boolean(applyAriaDisabled) && !disabled;\n\n const StyledCardContainer = useMemo(() => {\n if (disabled) {\n return StyledCardDisabled;\n }\n if (isSoftLocked) {\n return StyledCardSoftLocked;\n }\n if (onClick) {\n return StyledButtonCard;\n }\n return StyledCard;\n }, [disabled, isSoftLocked, onClick]);\n\n const globalsAttrs = useGetGlobalAttributes<CardT.InternalProps, HTMLDivElement, DSGridT.Props>(propsWithDefault);\n // disabled and readOnly are global attributes too: the container is a div, so they are not spread onto it\n // (isCardDisabled gates the consumer handlers)\n const globalsAttrsWithoutLock = omitLockAttributes(globalsAttrs);\n const xstyledProps = useGetXstyledProps(propsWithDefault);\n const getOwnerProps = useCallback(() => propsWithDefault, [propsWithDefault]);\n\n // a locked card blocks the container's consumer actions: the card body is not a native control, so nothing else guards it\n const isCardDisabled = isLocked({ disabled, applyAriaDisabled });\n\n const ctx = useMemo(\n () => ({\n isMultiSelect,\n disabled,\n isSelected,\n onClick,\n }),\n [isMultiSelect, disabled, isSelected, onClick],\n );\n\n return (\n <CardContext.Provider value={ctx}>\n <StyledCardContainer\n border=\"solid 1px neutral-100\"\n boxShadow=\"xs\"\n isOverlay={isOverlay}\n $disabled={Boolean(disabled)}\n $applyAriaDisabled={isSoftLocked}\n {...omitLockedHandlers(globalsAttrsWithoutLock, isCardDisabled)}\n {...xstyledProps}\n data-disabled={disabled}\n data-apply-aria-disabled={isSoftLocked || undefined}\n data-selected={isSelected}\n >\n <FocusRing target={`[data-testid=${DSCardV3DataTestIds.ACTION_AREA}]`} hasError={hasError}>\n {onClick ? (\n <CardActionArea\n disabled={disabled}\n aria-disabled={isSoftLocked ? true : undefined}\n data-testid={DSCardV3DataTestIds.ACTION_AREA}\n aria-selected={isSelected}\n aria-multiselectable={isMultiSelect}\n aria-invalid={hasError}\n getOwnerProps={getOwnerProps}\n />\n ) : null}\n {children}\n </FocusRing>\n </StyledCardContainer>\n </CardContext.Provider>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;AC+Ef,SAEI,KAFJ;AA3ER;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAgB,aAAa,eAAe;AAC5C,SAAS,2BAA2B;AACpC,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAE1B,SAAS,gBAAgB,kBAAkB,YAAY,oBAAoB,4BAA4B;AAEhG,MAAM,eAAmC;AAAA,EAC9C,UAAU;AACZ;AAIO,MAAM,OAAiD,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AAAA,YACf,wBAAsB;AAAA,YACtB,gBAAc;AAAA,YACd;AAAA;AAAA,QACF,IACE;AAAA,QACH;AAAA,SACH;AAAA;AAAA,EACF,GACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/styled.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { styled, xStyledCommonProps } from "@elliemae/ds-system";
|
|
2
|
+
import { styled, xStyledCommonProps, lockedStateInteractionCss } from "@elliemae/ds-system";
|
|
3
3
|
import { Grid } from "@elliemae/ds-grid";
|
|
4
4
|
import { DSCardV3Name, DSCardV3Slots } from "./CardV3Definitions.js";
|
|
5
5
|
const CardActionArea = styled("button", {
|
|
@@ -60,17 +60,21 @@ const StyledFocusRing = styled(Grid)`
|
|
|
60
60
|
return "none";
|
|
61
61
|
}};
|
|
62
62
|
`;
|
|
63
|
+
const StyledCardSoftLocked = styled(StyledCard)`
|
|
64
|
+
background-color: ${({ theme }) => theme.colors.neutral["080"]};
|
|
65
|
+
* {
|
|
66
|
+
color: ${({ theme }) => theme.colors.neutral["500"]};
|
|
67
|
+
}
|
|
68
|
+
${lockedStateInteractionCss}
|
|
69
|
+
`;
|
|
63
70
|
const StyledCardDisabled = styled(StyledCard)`
|
|
64
|
-
cursor: not-allowed;
|
|
65
71
|
user-select: none;
|
|
66
72
|
opacity: 0.5;
|
|
67
73
|
${StyledCardSingleIndicator} {
|
|
68
74
|
background-color: ${({ theme, isSelected }) => isSelected ? theme.colors.neutral["800"] : theme.colors.neutral["080"]};
|
|
69
75
|
}
|
|
70
76
|
|
|
71
|
-
${
|
|
72
|
-
pointer-events: none;
|
|
73
|
-
}
|
|
77
|
+
${lockedStateInteractionCss}
|
|
74
78
|
`;
|
|
75
79
|
export {
|
|
76
80
|
CardActionArea,
|
|
@@ -79,6 +83,7 @@ export {
|
|
|
79
83
|
StyledCardDisabled,
|
|
80
84
|
StyledCardError,
|
|
81
85
|
StyledCardSingleIndicator,
|
|
86
|
+
StyledCardSoftLocked,
|
|
82
87
|
StyledFocusRing
|
|
83
88
|
};
|
|
84
89
|
//# sourceMappingURL=styled.js.map
|
package/dist/esm/styled.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/styled.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled, xStyledCommonProps } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSCardV3Name, DSCardV3Slots } from './CardV3Definitions.js';\nexport const CardActionArea = styled('button', {\n name: DSCardV3Name,\n slot: DSCardV3Slots.ACTION_AREA,\n})`\n border: none;\n background-color: transparent;\n width: 0px;\n height: 0px;\n padding: 0;\n &:focus {\n outline: none;\n }\n text-align: unset;\n`;\n\n// START style cards variants\nexport const StyledCard = styled(Grid)<{\n isOverlay?: boolean;\n onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;\n}>`\n min-width: 240px;\n min-height: 56px;\n background-color: ${({ theme, isOverlay }) => (isOverlay ? theme.colors.neutral['080'] : 'white')};\n outline-offset: -2px;\n * {\n color: ${({ theme, isOverlay }) => (isOverlay ? theme.colors.neutral['500'] : 'inherit')};\n }\n\n ${xStyledCommonProps}\n`;\n\nexport const StyledButtonCard = styled(StyledCard)<{ isOverlay?: boolean }>`\n cursor: pointer;\n`;\n\nexport const StyledCardError = styled(StyledCard)`\n outline: ${({ theme }) => `2px solid ${theme.colors.danger[900]}`};\n`;\n\nexport const StyledCardSingleIndicator = styled(Grid)<{ isSelected?: boolean }>`\n width: ${({ isSelected }) => (isSelected ? '6px' : '4px')};\n align-self: normal;\n background-color: ${({ theme, isSelected }) => {\n if (isSelected) return theme.colors.brand['700'];\n return theme.colors.brand['300'];\n }};\n transition: all 0.1s ease-in-out;\n\n ${StyledCard}:not([data-disabled='true']):not([data-selected='true']):hover & {\n background-color: ${({ theme }) => theme.colors.brand['500']};\n }\n`;\n\nexport const StyledFocusRing = styled(Grid)<{ showFocusRing: boolean; hasError?: boolean }>`\n width: 100%;\n height: 100%;\n outline-offset: -1px;\n outline: ${({ showFocusRing, hasError, theme }) => {\n if (showFocusRing) {\n return `2px solid ${theme.colors.brand[700]}`;\n }\n if (hasError) {\n return `2px solid ${theme.colors.danger[900]}`;\n }\n return 'none';\n }};\n`;\n\nexport const
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,QAAQ,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled, xStyledCommonProps, lockedStateInteractionCss } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSCardV3Name, DSCardV3Slots } from './CardV3Definitions.js';\nexport const CardActionArea = styled('button', {\n name: DSCardV3Name,\n slot: DSCardV3Slots.ACTION_AREA,\n})`\n border: none;\n background-color: transparent;\n width: 0px;\n height: 0px;\n padding: 0;\n &:focus {\n outline: none;\n }\n text-align: unset;\n`;\n\n// START style cards variants\nexport const StyledCard = styled(Grid)<{\n isOverlay?: boolean;\n $disabled?: boolean;\n $applyAriaDisabled?: boolean;\n onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;\n}>`\n min-width: 240px;\n min-height: 56px;\n background-color: ${({ theme, isOverlay }) => (isOverlay ? theme.colors.neutral['080'] : 'white')};\n outline-offset: -2px;\n * {\n color: ${({ theme, isOverlay }) => (isOverlay ? theme.colors.neutral['500'] : 'inherit')};\n }\n\n ${xStyledCommonProps}\n`;\n\nexport const StyledButtonCard = styled(StyledCard)<{ isOverlay?: boolean }>`\n cursor: pointer;\n`;\n\nexport const StyledCardError = styled(StyledCard)`\n outline: ${({ theme }) => `2px solid ${theme.colors.danger[900]}`};\n`;\n\nexport const StyledCardSingleIndicator = styled(Grid)<{ isSelected?: boolean }>`\n width: ${({ isSelected }) => (isSelected ? '6px' : '4px')};\n align-self: normal;\n background-color: ${({ theme, isSelected }) => {\n if (isSelected) return theme.colors.brand['700'];\n return theme.colors.brand['300'];\n }};\n transition: all 0.1s ease-in-out;\n\n ${StyledCard}:not([data-disabled='true']):not([data-selected='true']):hover & {\n background-color: ${({ theme }) => theme.colors.brand['500']};\n }\n`;\n\nexport const StyledFocusRing = styled(Grid)<{ showFocusRing: boolean; hasError?: boolean }>`\n width: 100%;\n height: 100%;\n outline-offset: -1px;\n outline: ${({ showFocusRing, hasError, theme }) => {\n if (showFocusRing) {\n return `2px solid ${theme.colors.brand[700]}`;\n }\n if (hasError) {\n return `2px solid ${theme.colors.danger[900]}`;\n }\n return 'none';\n }};\n`;\n\n// soft lock: the card keeps hover and keyboard focus (its focus ring is not dimmed), only the look and the cursor say\n// \"unavailable\". The card is not faded with opacity because that would also fade the focus ring.\nexport const StyledCardSoftLocked: React.FC = styled(StyledCard)<{ $applyAriaDisabled?: boolean }>`\n background-color: ${({ theme }) => theme.colors.neutral['080']};\n * {\n color: ${({ theme }) => theme.colors.neutral['500']};\n }\n ${lockedStateInteractionCss}\n`;\n\nexport const StyledCardDisabled: React.FC = styled(StyledCard)<{ isSelected?: boolean; $disabled?: boolean }>`\n user-select: none;\n opacity: 0.5;\n ${StyledCardSingleIndicator} {\n background-color: ${({ theme, isSelected }) =>\n isSelected ? theme.colors.neutral['800'] : theme.colors.neutral['080']};\n }\n\n ${lockedStateInteractionCss}\n`;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,QAAQ,oBAAoB,iCAAiC;AACtE,SAAS,YAAY;AACrB,SAAS,cAAc,qBAAqB;AACrC,MAAM,iBAAiB,OAAO,UAAU;AAAA,EAC7C,MAAM;AAAA,EACN,MAAM,cAAc;AACtB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaM,MAAM,aAAa,OAAO,IAAI;AAAA;AAAA;AAAA,sBAQf,CAAC,EAAE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,UAAU;AAAA;AAAA;AAAA,IAGzD,yBAAyB;AAAA,wBACL,CAAC,EAAE,OAAO,WAAW,MACvC,aAAa,MAAM,OAAO,QAAQ,KAAK,IAAI,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA;AAAA;AAAA,IAGxE,yBAAyB;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -8,6 +8,8 @@ export declare namespace CardT {
|
|
|
8
8
|
isSelected?: boolean;
|
|
9
9
|
isMultiSelect?: boolean;
|
|
10
10
|
isOverlay?: boolean;
|
|
11
|
+
/** soft lock: the action button stays focusable and announced as disabled, every action is ignored */
|
|
12
|
+
applyAriaDisabled?: boolean;
|
|
11
13
|
onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
12
14
|
}
|
|
13
15
|
interface DefaultProps {
|
package/dist/types/styled.d.ts
CHANGED
|
@@ -1,22 +1,32 @@
|
|
|
1
1
|
export declare const CardActionArea: import("styled-components").StyledComponent<"button", import("@elliemae/ds-system").Theme, object & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"button">, never>;
|
|
2
2
|
export declare const StyledCard: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>, import("@elliemae/ds-system").Theme, {
|
|
3
3
|
isOverlay?: boolean;
|
|
4
|
+
$disabled?: boolean;
|
|
5
|
+
$applyAriaDisabled?: boolean;
|
|
4
6
|
onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
5
7
|
} & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>>, never>;
|
|
6
8
|
export declare const StyledButtonCard: import("styled-components").StyledComponent<import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>, import("@elliemae/ds-system").Theme, {
|
|
7
9
|
isOverlay?: boolean;
|
|
10
|
+
$disabled?: boolean;
|
|
11
|
+
$applyAriaDisabled?: boolean;
|
|
8
12
|
onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
9
13
|
} & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>>, never>, import("@elliemae/ds-system").Theme, {
|
|
10
14
|
isOverlay?: boolean;
|
|
11
15
|
} & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>, import("@elliemae/ds-system").Theme, {
|
|
12
16
|
isOverlay?: boolean;
|
|
17
|
+
$disabled?: boolean;
|
|
18
|
+
$applyAriaDisabled?: boolean;
|
|
13
19
|
onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
14
20
|
} & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>>, never>>, never>;
|
|
15
21
|
export declare const StyledCardError: import("styled-components").StyledComponent<import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>, import("@elliemae/ds-system").Theme, {
|
|
16
22
|
isOverlay?: boolean;
|
|
23
|
+
$disabled?: boolean;
|
|
24
|
+
$applyAriaDisabled?: boolean;
|
|
17
25
|
onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
18
26
|
} & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>>, never>, import("@elliemae/ds-system").Theme, object & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>, import("@elliemae/ds-system").Theme, {
|
|
19
27
|
isOverlay?: boolean;
|
|
28
|
+
$disabled?: boolean;
|
|
29
|
+
$applyAriaDisabled?: boolean;
|
|
20
30
|
onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
21
31
|
} & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>>, never>>, never>;
|
|
22
32
|
export declare const StyledCardSingleIndicator: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>, import("@elliemae/ds-system").Theme, {
|
|
@@ -26,4 +36,5 @@ export declare const StyledFocusRing: import("styled-components").StyledComponen
|
|
|
26
36
|
showFocusRing: boolean;
|
|
27
37
|
hasError?: boolean;
|
|
28
38
|
} & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>>, never>;
|
|
39
|
+
export declare const StyledCardSoftLocked: React.FC;
|
|
29
40
|
export declare const StyledCardDisabled: React.FC;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-card-v3-poc",
|
|
3
|
-
"version": "3.80.0-next.
|
|
3
|
+
"version": "3.80.0-next.76",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Card V3",
|
|
6
6
|
"files": [
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
"indent": 4
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@elliemae/ds-form-radio": "3.80.0-next.
|
|
40
|
-
"@elliemae/ds-grid": "3.80.0-next.
|
|
41
|
-
"@elliemae/ds-props-helpers": "3.80.0-next.
|
|
42
|
-
"@elliemae/ds-system": "3.80.0-next.
|
|
39
|
+
"@elliemae/ds-form-radio": "3.80.0-next.76",
|
|
40
|
+
"@elliemae/ds-grid": "3.80.0-next.76",
|
|
41
|
+
"@elliemae/ds-props-helpers": "3.80.0-next.76",
|
|
42
|
+
"@elliemae/ds-system": "3.80.0-next.76"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@elliemae/ds-monorepo-devops": "3.80.0-next.
|
|
45
|
+
"@elliemae/ds-monorepo-devops": "3.80.0-next.76",
|
|
46
46
|
"@elliemae/pui-theme": "~2.13.0",
|
|
47
47
|
"jest": "^30.0.0",
|
|
48
48
|
"styled-components": "~5.3.11",
|