@activecollab/components 2.0.119 → 2.0.121
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/components/Card/Card.js +7 -4
- package/dist/cjs/components/Card/Card.js.map +1 -1
- package/dist/cjs/components/Card/Styles.js +7 -3
- package/dist/cjs/components/Card/Styles.js.map +1 -1
- package/dist/cjs/components/Entity/EntityCard.js +1 -1
- package/dist/cjs/components/Entity/EntityCard.js.map +1 -1
- package/dist/cjs/components/EntityCard/EntityCard.js +1 -1
- package/dist/cjs/components/EntityCard/EntityCard.js.map +1 -1
- package/dist/cjs/components/Paper/Paper.js.map +1 -1
- package/dist/cjs/components/Paper/Styles.js +4 -2
- package/dist/cjs/components/Paper/Styles.js.map +1 -1
- package/dist/cjs/utils/index.js +0 -7
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/timeUtils.js +1 -70
- package/dist/cjs/utils/timeUtils.js.map +1 -1
- package/dist/esm/components/Card/Card.d.ts +1 -1
- package/dist/esm/components/Card/Card.d.ts.map +1 -1
- package/dist/esm/components/Card/Card.js +5 -2
- package/dist/esm/components/Card/Card.js.map +1 -1
- package/dist/esm/components/Card/Styles.d.ts +5 -1
- package/dist/esm/components/Card/Styles.d.ts.map +1 -1
- package/dist/esm/components/Card/Styles.js +7 -2
- package/dist/esm/components/Card/Styles.js.map +1 -1
- package/dist/esm/components/Entity/EntityCard.js +1 -1
- package/dist/esm/components/Entity/EntityCard.js.map +1 -1
- package/dist/esm/components/EntityCard/EntityCard.js +1 -1
- package/dist/esm/components/EntityCard/EntityCard.js.map +1 -1
- package/dist/esm/components/Paper/Paper.d.ts +1 -1
- package/dist/esm/components/Paper/Paper.d.ts.map +1 -1
- package/dist/esm/components/Paper/Paper.js.map +1 -1
- package/dist/esm/components/Paper/Styles.d.ts.map +1 -1
- package/dist/esm/components/Paper/Styles.js +1 -1
- package/dist/esm/components/Paper/Styles.js.map +1 -1
- package/dist/esm/utils/index.d.ts +1 -1
- package/dist/esm/utils/index.d.ts.map +1 -1
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/timeUtils.d.ts +0 -18
- package/dist/esm/utils/timeUtils.d.ts.map +1 -1
- package/dist/esm/utils/timeUtils.js +0 -68
- package/dist/esm/utils/timeUtils.js.map +1 -1
- package/dist/index.js +17 -79
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ exports.Card = void 0;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
9
|
var _Styles = require("./Styles");
|
|
10
|
-
var _excluded = ["children", "className", "hoverable", "
|
|
10
|
+
var _excluded = ["children", "className", "hoverable", "variant", "onClick"];
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
13
13
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -19,13 +19,16 @@ var Card = exports.Card = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, re
|
|
|
19
19
|
className = _ref.className,
|
|
20
20
|
_ref$hoverable = _ref.hoverable,
|
|
21
21
|
hoverable = _ref$hoverable === void 0 ? false : _ref$hoverable,
|
|
22
|
-
_ref$
|
|
23
|
-
|
|
22
|
+
_ref$variant = _ref.variant,
|
|
23
|
+
variant = _ref$variant === void 0 ? "paper-2" : _ref$variant,
|
|
24
|
+
onClick = _ref.onClick,
|
|
24
25
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
25
26
|
return /*#__PURE__*/_react.default.createElement(_Styles.StyledCard, _extends({}, rest, {
|
|
26
|
-
type:
|
|
27
|
+
type: variant,
|
|
27
28
|
className: (0, _classnames.default)("c-card", className),
|
|
28
29
|
hover: hoverable,
|
|
30
|
+
$pointer: typeof onClick === "function",
|
|
31
|
+
onClick: onClick,
|
|
29
32
|
useOptimizedShadow: true,
|
|
30
33
|
ref: ref
|
|
31
34
|
}), children);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.js","names":["_react","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_Styles","_excluded","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_extends","assign","bind","target","arguments","length","source","key","apply","_objectWithoutProperties","excluded","_objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","indexOf","propertyIsEnumerable","sourceKeys","keys","Card","exports","forwardRef","_ref","ref","children","className","_ref$hoverable","hoverable","_ref$
|
|
1
|
+
{"version":3,"file":"Card.js","names":["_react","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_Styles","_excluded","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_extends","assign","bind","target","arguments","length","source","key","apply","_objectWithoutProperties","excluded","_objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","indexOf","propertyIsEnumerable","sourceKeys","keys","Card","exports","forwardRef","_ref","ref","children","className","_ref$hoverable","hoverable","_ref$variant","variant","onClick","rest","createElement","StyledCard","type","classnames","hover","$pointer","useOptimizedShadow","displayName"],"sources":["../../../../src/components/Card/Card.tsx"],"sourcesContent":["import React, { Ref, HTMLAttributes, forwardRef } from \"react\";\n\nimport classnames from \"classnames\";\n\nimport { StyledCard } from \"./Styles\";\n\nexport interface ICardProps {\n /** Choose if card should be hoverable or not */\n hoverable?: boolean;\n /** Set the type of the Paper */\n variant?: \"paper-1\" | \"paper-2\" | \"tile-1\" | \"tile-2\";\n /** Ref element */\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const Card = forwardRef(\n (\n {\n children,\n className,\n hoverable = false,\n variant = \"paper-2\",\n onClick,\n ...rest\n }: HTMLAttributes<HTMLDivElement> & ICardProps,\n ref: Ref<HTMLDivElement> | null | undefined\n ) => {\n return (\n <StyledCard\n {...rest}\n type={variant}\n className={classnames(\"c-card\", className)}\n hover={hoverable}\n $pointer={typeof onClick === \"function\"}\n onClick={onClick}\n useOptimizedShadow\n ref={ref}\n >\n {children}\n </StyledCard>\n );\n }\n);\n\nCard.displayName = \"Card\";\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAH,OAAA;AAAsC,IAAAI,SAAA;AAAA,SAAAF,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAV,wBAAAU,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAH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,IAAA,CACjBO,OAAO;IAAPA,OAAO,GAAAD,YAAA,cAAG,SAAS,GAAAA,YAAA;IACnBE,OAAO,GAAAR,IAAA,CAAPQ,OAAO;IACJC,IAAI,GAAArB,wBAAA,CAAAY,IAAA,EAAA5C,SAAA;EAIT,oBACEN,MAAA,CAAAS,OAAA,CAAAmD,aAAA,CAACvD,OAAA,CAAAwD,UAAU,EAAAhC,QAAA,KACL8B,IAAI;IACRG,IAAI,EAAEL,OAAQ;IACdJ,SAAS,EAAE,IAAAU,mBAAU,EAAC,QAAQ,EAAEV,SAAS,CAAE;IAC3CW,KAAK,EAAET,SAAU;IACjBU,QAAQ,EAAE,OAAOP,OAAO,KAAK,UAAW;IACxCA,OAAO,EAAEA,OAAQ;IACjBQ,kBAAkB;IAClBf,GAAG,EAAEA;EAAI,IAERC,QACS,CAAC;AAEjB,CACF,CAAC;AAEDL,IAAI,CAACoB,WAAW,GAAG,MAAM"}
|
|
@@ -4,14 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.StyledCard = void 0;
|
|
7
|
-
var _styledComponents =
|
|
7
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
8
8
|
var _Paper = require("../Paper");
|
|
9
|
-
function
|
|
9
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
10
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
11
|
var StyledCard = exports.StyledCard = (0, _styledComponents.default)(_Paper.Paper).withConfig({
|
|
11
12
|
displayName: "Styles__StyledCard",
|
|
12
13
|
componentId: "sc-hllbj1-0"
|
|
13
|
-
})(["", ""], {
|
|
14
|
+
})(["", " ", ""], {
|
|
14
15
|
"color": "var(--color-theme-900)"
|
|
16
|
+
}, function (_ref) {
|
|
17
|
+
var $pointer = _ref.$pointer;
|
|
18
|
+
return $pointer && (0, _styledComponents.css)(["cursor:pointer;"]);
|
|
15
19
|
});
|
|
16
20
|
StyledCard.displayName = "StyledCard";
|
|
17
21
|
//# sourceMappingURL=Styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Styles.js","names":["_styledComponents","
|
|
1
|
+
{"version":3,"file":"Styles.js","names":["_styledComponents","_interopRequireWildcard","require","_Paper","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","StyledCard","exports","styled","Paper","withConfig","displayName","componentId","_ref","$pointer","css"],"sources":["../../../../src/components/Card/Styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\nimport tw from \"twin.macro\";\n\nimport { Paper } from \"../Paper\";\n\ninterface StyledCardProps {\n $pointer?: boolean;\n}\n\nexport const StyledCard = styled(Paper)<StyledCardProps>`\n ${tw`tw-text-theme-900`}\n\n ${({ $pointer }) =>\n $pointer &&\n css`\n cursor: pointer;\n `}\n`;\n\nStyledCard.displayName = \"StyledCard\";\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAD,OAAA;AAAiC,SAAAE,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,C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,sBAEF;AAAA,EACJ;AAEDT,UAAU,CAACK,WAAW,GAAG,YAAY"}
|
|
@@ -32,7 +32,7 @@ var EntityCard = exports.EntityCard = /*#__PURE__*/(0, _react.forwardRef)(functi
|
|
|
32
32
|
as: Component,
|
|
33
33
|
$renderAs: renderAs,
|
|
34
34
|
$background: background,
|
|
35
|
-
|
|
35
|
+
variant: paperType,
|
|
36
36
|
className: (0, _classnames.default)("c-entity-card", classSuffix, className),
|
|
37
37
|
$isCollection: isCollection
|
|
38
38
|
}, rest, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityCard.js","names":["_react","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_EntityGroup","_Styles","_Card","_excluded","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_extends","assign","bind","target","arguments","length","source","key","apply","_objectWithoutProperties","excluded","_objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","indexOf","propertyIsEnumerable","sourceKeys","keys","EntityCard","exports","forwardRef","_ref","ref","children","isCollection","background","className","as","rest","_useContext","useContext","EntityGroupContext","renderAs","classSuffix","concat","paperType","Component","Card","createElement","StyledEntityCard","$renderAs","$background","classNames","$isCollection","displayName"],"sources":["../../../../src/components/Entity/EntityCard.tsx"],"sourcesContent":["import React, {\n BaseHTMLAttributes,\n CSSProperties,\n forwardRef,\n ReactElement,\n ReactNode,\n useContext,\n} from \"react\";\n\nimport classNames from \"classnames\";\n\nimport { EntityGroupContext } from \"./EntityGroup\";\nimport { StyledEntityCard } from \"./Styles\";\nimport {\n PolymorphicComponentPropsWithRef,\n PolymorphicRef,\n} from \"../../utils/types\";\nimport { Card, ICardProps } from \"../Card\";\n\nexport interface IEntityCardProps\n extends ICardProps,\n BaseHTMLAttributes<HTMLElement> {\n /** ClassName to add on Card */\n className?: string;\n /** Show as group of Cards on grid */\n isCollection?: boolean;\n /** Background color to override for Card */\n background?: string;\n /** CSSProperties to override for Card */\n style?: CSSProperties;\n}\n\nexport type EntityCardProps<C extends React.ElementType> =\n PolymorphicComponentPropsWithRef<C, IEntityCardProps>;\n\nexport type EntityComponent = <C extends React.ElementType = typeof Card>(\n props: EntityCardProps<C>\n) => ReactElement | ReactNode | null;\n\nexport const EntityCard: EntityComponent & { displayName?: string } =\n forwardRef(\n <C extends React.ElementType = typeof Card>(\n {\n children,\n isCollection,\n background,\n className,\n as,\n ...rest\n }: EntityCardProps<C>,\n ref?: PolymorphicRef<C>\n ) => {\n const { renderAs } = useContext(EntityGroupContext);\n const classSuffix = `c-entity-card-${renderAs}`;\n const paperType = renderAs === \"grid\" ? \"paper-1\" : \"paper-2\";\n const Component = as || Card;\n return (\n <StyledEntityCard\n as={Component}\n $renderAs={renderAs}\n $background={background}\n
|
|
1
|
+
{"version":3,"file":"EntityCard.js","names":["_react","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_EntityGroup","_Styles","_Card","_excluded","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_extends","assign","bind","target","arguments","length","source","key","apply","_objectWithoutProperties","excluded","_objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","indexOf","propertyIsEnumerable","sourceKeys","keys","EntityCard","exports","forwardRef","_ref","ref","children","isCollection","background","className","as","rest","_useContext","useContext","EntityGroupContext","renderAs","classSuffix","concat","paperType","Component","Card","createElement","StyledEntityCard","$renderAs","$background","variant","classNames","$isCollection","displayName"],"sources":["../../../../src/components/Entity/EntityCard.tsx"],"sourcesContent":["import React, {\n BaseHTMLAttributes,\n CSSProperties,\n forwardRef,\n ReactElement,\n ReactNode,\n useContext,\n} from \"react\";\n\nimport classNames from \"classnames\";\n\nimport { EntityGroupContext } from \"./EntityGroup\";\nimport { StyledEntityCard } from \"./Styles\";\nimport {\n PolymorphicComponentPropsWithRef,\n PolymorphicRef,\n} from \"../../utils/types\";\nimport { Card, ICardProps } from \"../Card\";\n\nexport interface IEntityCardProps\n extends ICardProps,\n BaseHTMLAttributes<HTMLElement> {\n /** ClassName to add on Card */\n className?: string;\n /** Show as group of Cards on grid */\n isCollection?: boolean;\n /** Background color to override for Card */\n background?: string;\n /** CSSProperties to override for Card */\n style?: CSSProperties;\n}\n\nexport type EntityCardProps<C extends React.ElementType> =\n PolymorphicComponentPropsWithRef<C, IEntityCardProps>;\n\nexport type EntityComponent = <C extends React.ElementType = typeof Card>(\n props: EntityCardProps<C>\n) => ReactElement | ReactNode | null;\n\nexport const EntityCard: EntityComponent & { displayName?: string } =\n forwardRef(\n <C extends React.ElementType = typeof Card>(\n {\n children,\n isCollection,\n background,\n className,\n as,\n ...rest\n }: EntityCardProps<C>,\n ref?: PolymorphicRef<C>\n ) => {\n const { renderAs } = useContext(EntityGroupContext);\n const classSuffix = `c-entity-card-${renderAs}`;\n const paperType = renderAs === \"grid\" ? \"paper-1\" : \"paper-2\";\n const Component = as || Card;\n return (\n <StyledEntityCard\n as={Component}\n $renderAs={renderAs}\n $background={background}\n variant={paperType}\n className={classNames(\"c-entity-card\", classSuffix, className)}\n $isCollection={isCollection}\n {...rest}\n ref={ref}\n >\n {children}\n </StyledEntityCard>\n );\n }\n );\n\nEntityCard.displayName = \"EntityCard\";\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AASA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAKA,IAAAK,KAAA,GAAAL,OAAA;AAA2C,IAAAM,SAAA;AAAA,SAAAJ,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAAAC,OAA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AU,EACR,UAAAC,IAAA,EASEC,GAAuB,EACpB;EAAA,IARDC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,YAAY,GAAAH,IAAA,CAAZG,YAAY;IACZC,UAAU,GAAAJ,IAAA,CAAVI,UAAU;IACVC,SAAS,GAAAL,IAAA,CAATK,SAAS;IACTC,EAAE,GAAAN,IAAA,CAAFM,EAAE;IACCC,IAAI,GAAAnB,wBAAA,CAAAY,IAAA,EAAA5C,SAAA;EAIT,IAAAoD,WAAA,GAAqB,IAAAC,iBAAU,EAACC,+BAAkB,CAAC;IAA3CC,QAAQ,GAAAH,WAAA,CAARG,QAAQ;EAChB,IAAMC,WAAW,oBAAAC,MAAA,CAAoBF,QAAQ,CAAE;EAC/C,IAAMG,SAAS,GAAGH,QAAQ,KAAK,MAAM,GAAG,SAAS,GAAG,SAAS;EAC7D,IAAMI,SAAS,GAAGT,EAAE,IAAIU,UAAI;EAC5B,oBACEpE,MAAA,CAAAW,OAAA,CAAA0D,aAAA,CAAC/D,OAAA,CAAAgE,gBAAgB,EAAAvC,QAAA;IACf2B,EAAE,EAAES,SAAU;IACdI,SAAS,EAAER,QAAS;IACpBS,WAAW,EAAEhB,UAAW;IACxBiB,OAAO,EAAEP,SAAU;IACnBT,SAAS,EAAE,IAAAiB,mBAAU,EAAC,eAAe,EAAEV,WAAW,EAAEP,SAAS,CAAE;IAC/DkB,aAAa,EAAEpB;EAAa,GACxBI,IAAI;IACRN,GAAG,EAAEA;EAAI,IAERC,QACe,CAAC;AAEvB,CACF,CAAC;AAEHL,UAAU,CAAC2B,WAAW,GAAG,YAAY"}
|
|
@@ -62,7 +62,7 @@ var EntityCard = exports.EntityCard = /*#__PURE__*/(0, _react.forwardRef)(functi
|
|
|
62
62
|
"grid-item": renderAs === "grid-item",
|
|
63
63
|
"list-item": renderAs === "list-item"
|
|
64
64
|
}, className),
|
|
65
|
-
|
|
65
|
+
variant: renderAs === "grid-item" ? "paper-1" : "paper-2",
|
|
66
66
|
$renderAs: renderAs
|
|
67
67
|
}, renderAs === "list-item" ? renderAsListItem(properties) : null, renderAs === "grid-item" ? renderAsGridItem(properties) : null);
|
|
68
68
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityCard.js","names":["_react","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_Styles","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","EntityCard","exports","forwardRef","_ref","ref","_ref$renderAs","renderAs","properties","className","renderAsListItem","useCallback","filter","p","showInList","map","createElement","key","name","concat","render","renderAsGridItem","headerSection","cardSection","bodySection","footerSection","renderProperty","Fragment","StyledEntityCard","hoverable","classnames","
|
|
1
|
+
{"version":3,"file":"EntityCard.js","names":["_react","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_Styles","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","EntityCard","exports","forwardRef","_ref","ref","_ref$renderAs","renderAs","properties","className","renderAsListItem","useCallback","filter","p","showInList","map","createElement","key","name","concat","render","renderAsGridItem","headerSection","cardSection","bodySection","footerSection","renderProperty","Fragment","StyledEntityCard","hoverable","classnames","variant","$renderAs","displayName"],"sources":["../../../../src/components/EntityCard/EntityCard.tsx"],"sourcesContent":["import React, {\n Ref,\n HTMLAttributes,\n forwardRef,\n ReactNode,\n useCallback,\n} from \"react\";\n\nimport classnames from \"classnames\";\n\nimport { StyledEntityCard } from \"./Styles\";\n\nexport type cardSection = \"header\" | \"body\" | \"footer\";\n\nexport interface IEntityProperties {\n name: string;\n render: () => ReactNode;\n showInList?: boolean;\n cardSection: cardSection;\n className?: string;\n}\n\nexport interface IEntityCardProps {\n renderAs?: \"list-item\" | \"grid-item\";\n properties: IEntityProperties[];\n ref?: Ref<HTMLDivElement>;\n link?: string;\n className?: string;\n}\n\nexport const EntityCard = forwardRef(\n (\n {\n renderAs = \"list-item\",\n properties,\n className,\n }: HTMLAttributes<HTMLDivElement> & IEntityCardProps,\n ref: Ref<HTMLDivElement> | null | undefined\n ) => {\n const renderAsListItem = useCallback((properties: IEntityProperties[]) => {\n return properties\n .filter((p) => p.showInList)\n .map((p) => {\n return (\n <div key={p.name} className={`entity-property-${p.name}`}>\n {p.render()}\n </div>\n );\n });\n }, []);\n\n const renderAsGridItem = useCallback((properties: IEntityProperties[]) => {\n const headerSection = properties.filter(\n (p: IEntityProperties) => p.cardSection === \"header\"\n );\n const bodySection = properties.filter(\n (p: IEntityProperties) => p.cardSection === \"body\"\n );\n const footerSection = properties.filter(\n (p) => p.cardSection === \"footer\"\n );\n const renderProperty = (p: IEntityProperties): ReactNode => (\n <div key={p.name} className={`entity-property-${p.name}`}>\n {p.render()}\n </div>\n );\n return (\n <>\n <div className=\"card-header\">\n {headerSection.map((p) => renderProperty(p))}\n </div>\n <div className=\"card-body\">\n {bodySection.map((p) => renderProperty(p))}\n </div>\n <div className=\"card-footer\">\n {footerSection.map((p) => renderProperty(p))}\n </div>\n </>\n );\n }, []);\n\n return (\n <StyledEntityCard\n ref={ref}\n hoverable\n className={classnames(\n \"entity-card-wrapper\",\n {\n \"grid-item\": renderAs === \"grid-item\",\n \"list-item\": renderAs === \"list-item\",\n },\n className\n )}\n variant={renderAs === \"grid-item\" ? \"paper-1\" : \"paper-2\"}\n $renderAs={renderAs}\n >\n {renderAs === \"list-item\" ? renderAsListItem(properties) : null}\n {renderAs === \"grid-item\" ? renderAsGridItem(properties) : null}\n </StyledEntityCard>\n );\n }\n);\n\nEntityCard.displayName = \"EntityCard\";\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAQA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAH,OAAA;AAA4C,SAAAE,uBAAAE,GAAA,WAAAA,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BAAgB,CAACb,UAAU,CAAC,GAAG,IAC3C,CAAC;AAEvB,CACF,CAAC;AAEDP,UAAU,CAACgC,WAAW,GAAG,YAAY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Paper.js","names":["_react","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_Styles","_excluded","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_extends","assign","bind","target","arguments","length","source","key","apply","_objectWithoutProperties","excluded","_objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","indexOf","propertyIsEnumerable","sourceKeys","keys","Paper","exports","forwardRef","_ref","innerRef","children","className","_ref$type","type","_ref$hover","hover","_ref$useOptimizedShad","useOptimizedShadow","rest","createElement","StyledPaper","classNames","ref","displayName"],"sources":["../../../../src/components/Paper/Paper.tsx"],"sourcesContent":["import React, {\n forwardRef,\n HTMLAttributes,\n ReactNode,\n Ref,\n RefObject,\n} from \"react\";\n\nimport classNames from \"classnames\";\n\nimport { StyledPaper } from \"./Styles\";\n\nexport interface IPaperProps {\n /** Children type of node or string */\n children: ReactNode;\n /** CSS classes */\n className?: string;\n /** Ref object. */\n innerRef?: RefObject<HTMLDivElement>;\n /** Define custom style */\n style?: object;\n /** Type of paper to be used */\n type?: \"paper-1\" | \"paper-2\" | \"paper-3\";\n /** Paper has hover or not */\n hover?: boolean;\n /** Use optimized shadow */\n useOptimizedShadow?: boolean;\n}\n\n/**\n * This is a component description and should sit directly above your component\n */\nexport const Paper = forwardRef(\n (\n {\n children,\n className,\n type = \"paper-1\",\n hover = false,\n useOptimizedShadow = false,\n ...rest\n }: HTMLAttributes<HTMLDivElement> & IPaperProps,\n innerRef: Ref<HTMLDivElement> | null | undefined\n ) => {\n return (\n <StyledPaper\n className={classNames(className, {\n \"ac-shadow--raised--lg\":\n !useOptimizedShadow && hover && type === \"paper-1\",\n \"ac-shadow-optimized--lg\":\n useOptimizedShadow && hover && type === \"paper-1\",\n \"ac-shadow--lg\": !hover && type === \"paper-1\",\n \"ac-shadow--raised--sm\":\n (!useOptimizedShadow && hover && type === \"paper-2\") ||\n (!useOptimizedShadow && hover && type === \"paper-3\"),\n \"ac-shadow-optimized--sm\":\n (useOptimizedShadow && hover && type === \"paper-2\") ||\n (useOptimizedShadow && hover && type === \"paper-3\"),\n \"ac-shadow--sm\":\n (!hover && type === \"paper-2\") || (!hover && type === \"paper-3\"),\n })}\n ref={innerRef}\n type={type}\n {...rest}\n >\n {children}\n </StyledPaper>\n );\n }\n);\n\nPaper.displayName = \"Paper\";\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAQA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAH,OAAA;AAAuC,IAAAI,SAAA;AAAA,SAAAF,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAV,wBAAAU,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAH,UAAA,SAAAG,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAF,OAAA,EAAAE,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAC,GAAA,CAAAJ,CAAA,UAAAG,CAAA,CAAAE,GAAA,CAAAL,CAAA,OAAAM,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CA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AAoD,aAAA,CAACxD,OAAA,CAAAyD,WAAW,EAAAjC,QAAA;IACVwB,SAAS,EAAE,IAAAU,mBAAU,EAACV,SAAS,EAAE;MAC/B,uBAAuB,EACrB,CAACM,kBAAkB,IAAIF,KAAK,IAAIF,IAAI,KAAK,SAAS;MACpD,yBAAyB,EACvBI,kBAAkB,IAAIF,KAAK,IAAIF,IAAI,KAAK,SAAS;MACnD,eAAe,EAAE,CAACE,KAAK,IAAIF,IAAI,KAAK,SAAS;MAC7C,uBAAuB,EACpB,CAACI,kBAAkB,IAAIF,KAAK,IAAIF,IAAI,KAAK,SAAS,IAClD,CAACI,kBAAkB,IAAIF,KAAK,IAAIF,IAAI,KAAK,SAAU;MACtD,yBAAyB,EACtBI,kBAAkB,IAAIF,KAAK,IAAIF,IAAI,KAAK,SAAS,IACjDI,kBAAkB,IAAIF,KAAK,IAAIF,IAAI,KAAK,SAAU;MACrD,eAAe,EACZ,CAACE,KAAK,IAAIF,IAAI,KAAK,SAAS,IAAM,CAACE,KAAK,IAAIF,IAAI,KAAK;IAC1D,CAAC,CAAE;IACHS,GAAG,EAAEb,QAAS;IACdI,IAAI,EAAEA;EAAK,GACPK,IAAI,GAEPR,QACU,CAAC;AAElB,CACF,CAAC;AAEDL,KAAK,CAACkB,WAAW,GAAG,OAAO"}
|
|
1
|
+
{"version":3,"file":"Paper.js","names":["_react","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_Styles","_excluded","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_extends","assign","bind","target","arguments","length","source","key","apply","_objectWithoutProperties","excluded","_objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","indexOf","propertyIsEnumerable","sourceKeys","keys","Paper","exports","forwardRef","_ref","innerRef","children","className","_ref$type","type","_ref$hover","hover","_ref$useOptimizedShad","useOptimizedShadow","rest","createElement","StyledPaper","classNames","ref","displayName"],"sources":["../../../../src/components/Paper/Paper.tsx"],"sourcesContent":["import React, {\n forwardRef,\n HTMLAttributes,\n ReactNode,\n Ref,\n RefObject,\n} from \"react\";\n\nimport classNames from \"classnames\";\n\nimport { StyledPaper } from \"./Styles\";\n\nexport interface IPaperProps {\n /** Children type of node or string */\n children: ReactNode;\n /** CSS classes */\n className?: string;\n /** Ref object. */\n innerRef?: RefObject<HTMLDivElement>;\n /** Define custom style */\n style?: object;\n /** Type of paper to be used */\n type?: \"paper-1\" | \"paper-2\" | \"paper-3\" | \"tile-1\" | \"tile-2\";\n /** Paper has hover or not */\n hover?: boolean;\n /** Use optimized shadow */\n useOptimizedShadow?: boolean;\n}\n\n/**\n * This is a component description and should sit directly above your component\n */\nexport const Paper = forwardRef(\n (\n {\n children,\n className,\n type = \"paper-1\",\n hover = false,\n useOptimizedShadow = false,\n ...rest\n }: HTMLAttributes<HTMLDivElement> & IPaperProps,\n innerRef: Ref<HTMLDivElement> | null | undefined\n ) => {\n return (\n <StyledPaper\n className={classNames(className, {\n \"ac-shadow--raised--lg\":\n !useOptimizedShadow && hover && type === \"paper-1\",\n \"ac-shadow-optimized--lg\":\n useOptimizedShadow && hover && type === \"paper-1\",\n \"ac-shadow--lg\": !hover && type === \"paper-1\",\n \"ac-shadow--raised--sm\":\n (!useOptimizedShadow && hover && type === \"paper-2\") ||\n (!useOptimizedShadow && hover && type === \"paper-3\"),\n \"ac-shadow-optimized--sm\":\n (useOptimizedShadow && hover && type === \"paper-2\") ||\n (useOptimizedShadow && hover && type === \"paper-3\"),\n \"ac-shadow--sm\":\n (!hover && type === \"paper-2\") || (!hover && type === \"paper-3\"),\n })}\n ref={innerRef}\n type={type}\n {...rest}\n >\n {children}\n </StyledPaper>\n );\n }\n);\n\nPaper.displayName = \"Paper\";\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAQA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA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AIF,KAAK,IAAIF,IAAI,KAAK,SAAU;MACrD,eAAe,EACZ,CAACE,KAAK,IAAIF,IAAI,KAAK,SAAS,IAAM,CAACE,KAAK,IAAIF,IAAI,KAAK;IAC1D,CAAC,CAAE;IACHS,GAAG,EAAEb,QAAS;IACdI,IAAI,EAAEA;EAAK,GACPK,IAAI,GAEPR,QACU,CAAC;AAElB,CACF,CAAC;AAEDL,KAAK,CAACkB,WAAW,GAAG,OAAO"}
|
|
@@ -15,8 +15,10 @@ var PaperStyles = exports.PaperStyles = (0, _styledComponents.css)(["", " border
|
|
|
15
15
|
var StyledPaper = exports.StyledPaper = _styledComponents.default.div.withConfig({
|
|
16
16
|
displayName: "Styles__StyledPaper",
|
|
17
17
|
componentId: "sc-1ld1e2o-0"
|
|
18
|
-
})(["", " ", ""], PaperStyles, function (props) {
|
|
19
|
-
return props.type === "paper-3" && (0, _styledComponents.css)(["border:solid 1px var(--border-primary);"]);
|
|
18
|
+
})(["", " ", " ", ""], PaperStyles, function (props) {
|
|
19
|
+
return (props.type === "paper-3" || props.type === "tile-1") && (0, _styledComponents.css)(["border:solid 1px var(--border-primary);"]);
|
|
20
|
+
}, function (props) {
|
|
21
|
+
return (props.type === "tile-1" || props.type === "tile-2") && (0, _styledComponents.css)(["&:hover{background-color:var(--color-theme-200);}"]);
|
|
20
22
|
});
|
|
21
23
|
StyledPaper.displayName = "StyledPaper";
|
|
22
24
|
//# sourceMappingURL=Styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Styles.js","names":["_styledComponents","_interopRequireWildcard","require","_BoxSizingStyle","_FontStyle","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","PaperStyles","exports","css","FontStyle","BoxSizingStyle","StyledPaper","styled","div","withConfig","displayName","componentId","props","type"],"sources":["../../../../src/components/Paper/Styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\nimport tw from \"twin.macro\";\n\nimport { IPaperProps } from \"./Paper\";\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\nimport { FontStyle } from \"../FontStyle\";\n\nexport const PaperStyles = css`\n ${tw`tw-bg-page-paper-main`}\n border-radius: var(--ac-br-8);\n\n ${FontStyle}\n ${BoxSizingStyle}\n`;\nexport const StyledPaper = styled.div<IPaperProps>`\n ${PaperStyles}\n\n ${(props) =>\n props.type === \"paper-3\" &&\n css`\n border: solid 1px var(--border-primary);\n `}\n`;\n\nStyledPaper.displayName = \"StyledPaper\";\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,uBAAA,CAAAC,OAAA;AAIA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAAyC,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAC,GAAA,IAAAR,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAI,CAAA,IAAAV,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAgB,GAAA,CAAAnB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAElC,IAAMY,WAAW,GAAAC,OAAA,CAAAD,WAAA,OAAGE,qBAAG,mDACxB;EAAA;AAAsB,CAAC,EAGzBC,oBAAS,EACTC,8BAAc,CACjB;AACM,IAAMC,WAAW,GAAAJ,OAAA,CAAAI,WAAA,GAAGC,yBAAM,CAACC,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"Styles.js","names":["_styledComponents","_interopRequireWildcard","require","_BoxSizingStyle","_FontStyle","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","PaperStyles","exports","css","FontStyle","BoxSizingStyle","StyledPaper","styled","div","withConfig","displayName","componentId","props","type"],"sources":["../../../../src/components/Paper/Styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\nimport tw from \"twin.macro\";\n\nimport { IPaperProps } from \"./Paper\";\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\nimport { FontStyle } from \"../FontStyle\";\n\nexport const PaperStyles = css`\n ${tw`tw-bg-page-paper-main`}\n border-radius: var(--ac-br-8);\n\n ${FontStyle}\n ${BoxSizingStyle}\n`;\nexport const StyledPaper = styled.div<IPaperProps>`\n ${PaperStyles}\n\n ${(props) =>\n (props.type === \"paper-3\" || props.type === \"tile-1\") &&\n css`\n border: solid 1px var(--border-primary);\n `}\n\n ${(props) =>\n (props.type === \"tile-1\" || props.type === \"tile-2\") &&\n css`\n &:hover {\n background-color: var(--color-theme-200);\n }\n `}\n`;\n\nStyledPaper.displayName = \"StyledPaper\";\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,uBAAA,CAAAC,OAAA;AAIA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAAyC,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAC,GAAA,IAAAR,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAI,CAAA,IAAAV,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAgB,GAAA,CAAAnB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAElC,IAAMY,WAAW,GAAAC,OAAA,CAAAD,WAAA,OAAGE,qBAAG,mDACxB;EAAA;AAAsB,CAAC,EAGzBC,oBAAS,EACTC,8BAAc,CACjB;AACM,IAAMC,WAAW,GAAAJ,OAAA,CAAAI,WAAA,GAAGC,yBAAM,CAACC,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,uBACjCV,WAAW,EAEX,UAACW,KAAK;EAAA,OACN,CAACA,KAAK,CAACC,IAAI,KAAK,SAAS,IAAID,KAAK,CAACC,IAAI,KAAK,QAAQ,SACpDV,qBAAG,8CAEF;AAAA,GAEG,UAACS,KAAK;EAAA,OACV,CAACA,KAAK,CAACC,IAAI,KAAK,QAAQ,IAAID,KAAK,CAACC,IAAI,KAAK,QAAQ,SACnDV,qBAAG,wDAIF;AAAA,EACJ;AAEDG,WAAW,CAACI,WAAW,GAAG,aAAa"}
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -6,19 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
var _exportNames = {
|
|
7
7
|
useForkRef: true,
|
|
8
8
|
useResizeObserver: true,
|
|
9
|
-
decimalToHours: true,
|
|
10
9
|
formatHours: true,
|
|
11
10
|
formatNumber: true,
|
|
12
11
|
formatCurrency: true,
|
|
13
12
|
numberWithSeparator: true,
|
|
14
13
|
getNumberFromString: true
|
|
15
14
|
};
|
|
16
|
-
Object.defineProperty(exports, "decimalToHours", {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function get() {
|
|
19
|
-
return _timeUtils.decimalToHours;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
15
|
Object.defineProperty(exports, "formatCurrency", {
|
|
23
16
|
enumerable: true,
|
|
24
17
|
get: function get() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_layers","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_colors","_validation","_useForkRef","_interopRequireDefault","_useResizeObserver","_timeUtils","_currencyUtils","obj","__esModule","default"],"sources":["../../../src/utils/index.ts"],"sourcesContent":["export * from \"./layers\";\nexport * from \"./colors\";\nexport * from \"./validation\";\nexport { default as useForkRef } from \"./useForkRef\";\nexport { default as useResizeObserver } from \"./useResizeObserver\";\nexport {
|
|
1
|
+
{"version":3,"file":"index.js","names":["_layers","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_colors","_validation","_useForkRef","_interopRequireDefault","_useResizeObserver","_timeUtils","_currencyUtils","obj","__esModule","default"],"sources":["../../../src/utils/index.ts"],"sourcesContent":["export * from \"./layers\";\nexport * from \"./colors\";\nexport * from \"./validation\";\nexport { default as useForkRef } from \"./useForkRef\";\nexport { default as useResizeObserver } from \"./useResizeObserver\";\nexport { formatHours } from \"./timeUtils\";\nexport {\n formatNumber,\n formatCurrency,\n numberWithSeparator,\n getNumberFromString,\n} from \"./currencyUtils\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,OAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,OAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAA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
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.withLeadingZero = exports.isDecimal = exports.formatHours =
|
|
6
|
+
exports.withLeadingZero = exports.isDecimal = exports.formatHours = void 0;
|
|
7
7
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
8
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
9
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -76,75 +76,6 @@ var formatHours = exports.formatHours = function formatHours(num) {
|
|
|
76
76
|
var minutes_formatted = Math.round(parseInt(minutes, 10) / 100 * 60);
|
|
77
77
|
return "".concat(hours, ":").concat(withLeadingZero(minutes_formatted));
|
|
78
78
|
};
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* @function decimalToHours
|
|
82
|
-
* @deprecated
|
|
83
|
-
* @description
|
|
84
|
-
* Converts a decimal number representing hours into a formatted string (HH:MM).
|
|
85
|
-
* The input can be a number, string, or undefined. The function handles various formats
|
|
86
|
-
* and can optionally add a leading zero to the hours component.
|
|
87
|
-
*
|
|
88
|
-
* @param {number | string | undefined} num - The input representing the hours, which can be in decimal format, a time string, or undefined.
|
|
89
|
-
* @param {boolean} [withLeadingZeroHours=false] - Whether to add a leading zero to the hours part of the output.
|
|
90
|
-
*
|
|
91
|
-
* @returns {string} - A formatted time string in HH:MM format.
|
|
92
|
-
*
|
|
93
|
-
* @example
|
|
94
|
-
* decimalToHours(1.5) // "1:30"
|
|
95
|
-
* decimalToHours("3.5", true) // "03:30"
|
|
96
|
-
*/
|
|
97
|
-
var decimalToHours = exports.decimalToHours = function decimalToHours(num) {
|
|
98
|
-
var withLeadingZeroHours = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
99
|
-
console.warn("Deprecated. Please use formatHours from @activecollab/components.");
|
|
100
|
-
if (!num) {
|
|
101
|
-
return "";
|
|
102
|
-
}
|
|
103
|
-
if (typeof num === "string" && !num) {
|
|
104
|
-
return withLeadingZeroHours ? "00:00" : "0:00";
|
|
105
|
-
}
|
|
106
|
-
if (typeof num === "string" && num.indexOf(":") >= 0) {
|
|
107
|
-
//eslint-disable-next-line
|
|
108
|
-
var _num$split3 = num.split(":"),
|
|
109
|
-
_num$split4 = _slicedToArray(_num$split3, 2),
|
|
110
|
-
_hours = _num$split4[0],
|
|
111
|
-
_minutes = _num$split4[1];
|
|
112
|
-
if (_minutes && _minutes.length === 1 && Number(_minutes) < 10) {
|
|
113
|
-
_minutes = "".concat(Number(_minutes), "0");
|
|
114
|
-
}
|
|
115
|
-
if (_hours && _minutes) {
|
|
116
|
-
if (withLeadingZeroHours) {
|
|
117
|
-
return "".concat(withLeadingZero(_hours), ":").concat(_minutes);
|
|
118
|
-
}
|
|
119
|
-
return "".concat(_hours, ":").concat(_minutes);
|
|
120
|
-
} else if (!_hours && _minutes) {
|
|
121
|
-
return withLeadingZeroHours ? "00:".concat(_minutes) : "0:".concat(_minutes);
|
|
122
|
-
} else if (!_minutes && _hours) {
|
|
123
|
-
return withLeadingZeroHours ? "".concat(withLeadingZero(_hours), ":00") : "".concat(_hours, ":00");
|
|
124
|
-
} else {
|
|
125
|
-
return withLeadingZeroHours ? "00:00" : "0:00";
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
if (typeof num === "string" && num.indexOf(",") >= 0) {
|
|
129
|
-
num = num.replace(",", ".");
|
|
130
|
-
}
|
|
131
|
-
var input = typeof num === "string" ? parseFloat(num) : num;
|
|
132
|
-
if (!isDecimal(input)) {
|
|
133
|
-
if (withLeadingZeroHours) {
|
|
134
|
-
return "".concat(withLeadingZero(input), ":00");
|
|
135
|
-
}
|
|
136
|
-
return "".concat(input, ":00");
|
|
137
|
-
}
|
|
138
|
-
var decimal = input.toFixed(2);
|
|
139
|
-
var time = decimal.toString().split(".");
|
|
140
|
-
var hours = time[0];
|
|
141
|
-
if (withLeadingZeroHours) {
|
|
142
|
-
hours = withLeadingZero(hours);
|
|
143
|
-
}
|
|
144
|
-
var minutes = time[1];
|
|
145
|
-
var minutes_formatted = Math.round(parseInt(minutes, 10) / 100 * 60);
|
|
146
|
-
return "".concat(hours, ":").concat(withLeadingZero(minutes_formatted));
|
|
147
|
-
};
|
|
148
79
|
var withLeadingZero = exports.withLeadingZero = function withLeadingZero(num) {
|
|
149
80
|
var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
150
81
|
var s = "".concat(num);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeUtils.js","names":["formatHours","exports","num","withLeadingZeroHours","arguments","length","undefined","indexOf","_num$split","split","_num$split2","_slicedToArray","_hours","_minutes","Number","concat","withLeadingZero","replace","input","parseFloat","isDecimal","decimal","toFixed","time","toString","hours","minutes","minutes_formatted","Math","round","parseInt","decimalToHours","console","warn","_num$split3","_num$split4","size","s","isInteger"],"sources":["../../../src/utils/timeUtils.ts"],"sourcesContent":["/**\n * @function formatHours\n * @description\n * Formats a decimal number representing hours into a formatted string (HH:MM).\n * The input can be a number, string, or undefined. The function handles various formats\n * and can optionally add a leading zero to the hours component.\n *\n * @param {number | string | undefined} num - The input representing the hours, which can be in decimal format, a time string, or undefined.\n * @param {boolean} [withLeadingZeroHours=false] - Whether to add a leading zero to the hours part of the output.\n *\n * @returns {string} - A formatted time string in HH:MM format.\n *\n * @example\n * formatHours(1.5) // \"1:30\"\n * formatHours(\"3.5\", true) // \"03:30\"\n */\nexport const formatHours = (\n num: number | string | undefined,\n withLeadingZeroHours = false\n): string => {\n if (!num) {\n return \"\";\n }\n if (typeof num === \"string\" && !num) {\n return withLeadingZeroHours ? `00:00` : \"0:00\";\n }\n if (typeof num === \"string\" && num.indexOf(\":\") >= 0) {\n //eslint-disable-next-line\n let [_hours, _minutes] = num.split(\":\");\n if (_minutes && _minutes.length === 1 && Number(_minutes) < 10) {\n _minutes = `${Number(_minutes)}0`;\n }\n if (_hours && _minutes) {\n if (withLeadingZeroHours) {\n return `${withLeadingZero(_hours)}:${_minutes}`;\n }\n return `${_hours}:${_minutes}`;\n } else if (!_hours && _minutes) {\n return withLeadingZeroHours ? `00:${_minutes}` : `0:${_minutes}`;\n } else if (!_minutes && _hours) {\n return withLeadingZeroHours\n ? `${withLeadingZero(_hours)}:00`\n : `${_hours}:00`;\n } else {\n return withLeadingZeroHours ? `00:00` : \"0:00\";\n }\n }\n if (typeof num === \"string\" && num.indexOf(\",\") >= 0) {\n num = num.replace(\",\", \".\");\n }\n const input = typeof num === \"string\" ? parseFloat(num) : num;\n\n if (!isDecimal(input)) {\n if (withLeadingZeroHours) {\n return `${withLeadingZero(input)}:00`;\n }\n return `${input}:00`;\n }\n\n const decimal = input.toFixed(2);\n const time = decimal.toString().split(\".\");\n let hours: string = time[0];\n if (withLeadingZeroHours) {\n hours = withLeadingZero(hours);\n }\n const minutes: string = time[1];\n const minutes_formatted = Math.round((parseInt(minutes, 10) / 100) * 60);\n\n return `${hours}:${withLeadingZero(minutes_formatted)}`;\n};\n\n/**\n * @function decimalToHours\n * @deprecated\n * @description\n * Converts a decimal number representing hours into a formatted string (HH:MM).\n * The input can be a number, string, or undefined. The function handles various formats\n * and can optionally add a leading zero to the hours component.\n *\n * @param {number | string | undefined} num - The input representing the hours, which can be in decimal format, a time string, or undefined.\n * @param {boolean} [withLeadingZeroHours=false] - Whether to add a leading zero to the hours part of the output.\n *\n * @returns {string} - A formatted time string in HH:MM format.\n *\n * @example\n * decimalToHours(1.5) // \"1:30\"\n * decimalToHours(\"3.5\", true) // \"03:30\"\n */\nexport const decimalToHours = (\n num: number | string | undefined,\n withLeadingZeroHours = false\n): string => {\n console.warn(\n \"Deprecated. Please use formatHours from @activecollab/components.\"\n );\n if (!num) {\n return \"\";\n }\n if (typeof num === \"string\" && !num) {\n return withLeadingZeroHours ? `00:00` : \"0:00\";\n }\n if (typeof num === \"string\" && num.indexOf(\":\") >= 0) {\n //eslint-disable-next-line\n let [_hours, _minutes] = num.split(\":\");\n if (_minutes && _minutes.length === 1 && Number(_minutes) < 10) {\n _minutes = `${Number(_minutes)}0`;\n }\n if (_hours && _minutes) {\n if (withLeadingZeroHours) {\n return `${withLeadingZero(_hours)}:${_minutes}`;\n }\n return `${_hours}:${_minutes}`;\n } else if (!_hours && _minutes) {\n return withLeadingZeroHours ? `00:${_minutes}` : `0:${_minutes}`;\n } else if (!_minutes && _hours) {\n return withLeadingZeroHours\n ? `${withLeadingZero(_hours)}:00`\n : `${_hours}:00`;\n } else {\n return withLeadingZeroHours ? `00:00` : \"0:00\";\n }\n }\n if (typeof num === \"string\" && num.indexOf(\",\") >= 0) {\n num = num.replace(\",\", \".\");\n }\n const input = typeof num === \"string\" ? parseFloat(num) : num;\n\n if (!isDecimal(input)) {\n if (withLeadingZeroHours) {\n return `${withLeadingZero(input)}:00`;\n }\n return `${input}:00`;\n }\n\n const decimal = input.toFixed(2);\n const time = decimal.toString().split(\".\");\n let hours: string = time[0];\n if (withLeadingZeroHours) {\n hours = withLeadingZero(hours);\n }\n const minutes: string = time[1];\n const minutes_formatted = Math.round((parseInt(minutes, 10) / 100) * 60);\n\n return `${hours}:${withLeadingZero(minutes_formatted)}`;\n};\n\nexport const withLeadingZero = (num: string | number, size = 2) => {\n let s = `${num}`;\n while (s.length < size) s = `0` + s;\n return s;\n};\n\nexport const isDecimal = (num: number): boolean => {\n return !Number.isInteger(num);\n};\n"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;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AA,GAAG,SAAlBA,eAAeA,CAAId,GAAoB,EAAe;EAAA,IAAbkC,IAAI,GAAAhC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EAC5D,IAAIiC,CAAC,MAAAtB,MAAA,CAAMb,GAAG,CAAE;EAChB,OAAOmC,CAAC,CAAChC,MAAM,GAAG+B,IAAI,EAAEC,CAAC,GAAG,MAAMA,CAAC;EACnC,OAAOA,CAAC;AACV,CAAC;AAEM,IAAMjB,SAAS,GAAAnB,OAAA,CAAAmB,SAAA,GAAG,SAAZA,SAASA,CAAIlB,GAAW,EAAc;EACjD,OAAO,CAACY,MAAM,CAACwB,SAAS,CAACpC,GAAG,CAAC;AAC/B,CAAC"}
|
|
1
|
+
{"version":3,"file":"timeUtils.js","names":["formatHours","exports","num","withLeadingZeroHours","arguments","length","undefined","indexOf","_num$split","split","_num$split2","_slicedToArray","_hours","_minutes","Number","concat","withLeadingZero","replace","input","parseFloat","isDecimal","decimal","toFixed","time","toString","hours","minutes","minutes_formatted","Math","round","parseInt","size","s","isInteger"],"sources":["../../../src/utils/timeUtils.ts"],"sourcesContent":["/**\n * @function formatHours\n * @description\n * Formats a decimal number representing hours into a formatted string (HH:MM).\n * The input can be a number, string, or undefined. The function handles various formats\n * and can optionally add a leading zero to the hours component.\n *\n * @param {number | string | undefined} num - The input representing the hours, which can be in decimal format, a time string, or undefined.\n * @param {boolean} [withLeadingZeroHours=false] - Whether to add a leading zero to the hours part of the output.\n *\n * @returns {string} - A formatted time string in HH:MM format.\n *\n * @example\n * formatHours(1.5) // \"1:30\"\n * formatHours(\"3.5\", true) // \"03:30\"\n */\nexport const formatHours = (\n num: number | string | undefined,\n withLeadingZeroHours = false\n): string => {\n if (!num) {\n return \"\";\n }\n if (typeof num === \"string\" && !num) {\n return withLeadingZeroHours ? `00:00` : \"0:00\";\n }\n if (typeof num === \"string\" && num.indexOf(\":\") >= 0) {\n //eslint-disable-next-line\n let [_hours, _minutes] = num.split(\":\");\n if (_minutes && _minutes.length === 1 && Number(_minutes) < 10) {\n _minutes = `${Number(_minutes)}0`;\n }\n if (_hours && _minutes) {\n if (withLeadingZeroHours) {\n return `${withLeadingZero(_hours)}:${_minutes}`;\n }\n return `${_hours}:${_minutes}`;\n } else if (!_hours && _minutes) {\n return withLeadingZeroHours ? `00:${_minutes}` : `0:${_minutes}`;\n } else if (!_minutes && _hours) {\n return withLeadingZeroHours\n ? `${withLeadingZero(_hours)}:00`\n : `${_hours}:00`;\n } else {\n return withLeadingZeroHours ? `00:00` : \"0:00\";\n }\n }\n if (typeof num === \"string\" && num.indexOf(\",\") >= 0) {\n num = num.replace(\",\", \".\");\n }\n const input = typeof num === \"string\" ? parseFloat(num) : num;\n\n if (!isDecimal(input)) {\n if (withLeadingZeroHours) {\n return `${withLeadingZero(input)}:00`;\n }\n return `${input}:00`;\n }\n\n const decimal = input.toFixed(2);\n const time = decimal.toString().split(\".\");\n let hours: string = time[0];\n if (withLeadingZeroHours) {\n hours = withLeadingZero(hours);\n }\n const minutes: string = time[1];\n const minutes_formatted = Math.round((parseInt(minutes, 10) / 100) * 60);\n\n return `${hours}:${withLeadingZero(minutes_formatted)}`;\n};\n\nexport const withLeadingZero = (num: string | number, size = 2) => {\n let s = `${num}`;\n while (s.length < size) s = `0` + s;\n return s;\n};\n\nexport const isDecimal = (num: number): boolean => {\n return !Number.isInteger(num);\n};\n"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMA,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,SAAdA,WAAWA,CACtBE,GAAgC,EAErB;EAAA,IADXC,oBAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,KAAK;EAE5B,IAAI,CAACF,GAAG,EAAE;IACR,OAAO,EAAE;EACX;EACA,IAAI,OA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,SAAS,GAAAnB,OAAA,CAAAmB,SAAA,GAAG,SAAZA,SAASA,CAAIlB,GAAW,EAAc;EACjD,OAAO,CAACY,MAAM,CAACmB,SAAS,CAAC/B,GAAG,CAAC;AAC/B,CAAC"}
|
|
@@ -3,7 +3,7 @@ export interface ICardProps {
|
|
|
3
3
|
/** Choose if card should be hoverable or not */
|
|
4
4
|
hoverable?: boolean;
|
|
5
5
|
/** Set the type of the Paper */
|
|
6
|
-
|
|
6
|
+
variant?: "paper-1" | "paper-2" | "tile-1" | "tile-2";
|
|
7
7
|
/** Ref element */
|
|
8
8
|
ref?: Ref<HTMLDivElement>;
|
|
9
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/Card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,GAAG,EAA8B,MAAM,OAAO,CAAC;AAM/D,MAAM,WAAW,UAAU;IACzB,gDAAgD;IAChD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gCAAgC;IAChC,
|
|
1
|
+
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/Card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,GAAG,EAA8B,MAAM,OAAO,CAAC;AAM/D,MAAM,WAAW,UAAU;IACzB,gDAAgD;IAChD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gCAAgC;IAChC,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACtD,kBAAkB;IAClB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,IAAI,uIA2BhB,CAAC"}
|
|
@@ -7,13 +7,16 @@ export const Card = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
7
7
|
children,
|
|
8
8
|
className,
|
|
9
9
|
hoverable = false,
|
|
10
|
-
|
|
10
|
+
variant = "paper-2",
|
|
11
|
+
onClick,
|
|
11
12
|
...rest
|
|
12
13
|
} = _ref;
|
|
13
14
|
return /*#__PURE__*/React.createElement(StyledCard, _extends({}, rest, {
|
|
14
|
-
type:
|
|
15
|
+
type: variant,
|
|
15
16
|
className: classnames("c-card", className),
|
|
16
17
|
hover: hoverable,
|
|
18
|
+
$pointer: typeof onClick === "function",
|
|
19
|
+
onClick: onClick,
|
|
17
20
|
useOptimizedShadow: true,
|
|
18
21
|
ref: ref
|
|
19
22
|
}), children);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.js","names":["React","forwardRef","classnames","StyledCard","Card","_ref","ref","children","className","hoverable","
|
|
1
|
+
{"version":3,"file":"Card.js","names":["React","forwardRef","classnames","StyledCard","Card","_ref","ref","children","className","hoverable","variant","onClick","rest","createElement","_extends","type","hover","$pointer","useOptimizedShadow","displayName"],"sources":["../../../../src/components/Card/Card.tsx"],"sourcesContent":["import React, { Ref, HTMLAttributes, forwardRef } from \"react\";\n\nimport classnames from \"classnames\";\n\nimport { StyledCard } from \"./Styles\";\n\nexport interface ICardProps {\n /** Choose if card should be hoverable or not */\n hoverable?: boolean;\n /** Set the type of the Paper */\n variant?: \"paper-1\" | \"paper-2\" | \"tile-1\" | \"tile-2\";\n /** Ref element */\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const Card = forwardRef(\n (\n {\n children,\n className,\n hoverable = false,\n variant = \"paper-2\",\n onClick,\n ...rest\n }: HTMLAttributes<HTMLDivElement> & ICardProps,\n ref: Ref<HTMLDivElement> | null | undefined\n ) => {\n return (\n <StyledCard\n {...rest}\n type={variant}\n className={classnames(\"c-card\", className)}\n hover={hoverable}\n $pointer={typeof onClick === \"function\"}\n onClick={onClick}\n useOptimizedShadow\n ref={ref}\n >\n {children}\n </StyledCard>\n );\n }\n);\n\nCard.displayName = \"Card\";\n"],"mappings":";AAAA,OAAOA,KAAK,IAAyBC,UAAU,QAAQ,OAAO;AAE9D,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,UAAU,QAAQ,UAAU;AAWrC,OAAO,MAAMC,IAAI,gBAAGH,UAAU,CAC5B,CAAAI,IAAA,EASEC,GAA2C,KACxC;EAAA,IATH;IACEC,QAAQ;IACRC,SAAS;IACTC,SAAS,GAAG,KAAK;IACjBC,OAAO,GAAG,SAAS;IACnBC,OAAO;IACP,GAAGC;EACwC,CAAC,GAAAP,IAAA;EAG9C,oBACEL,KAAA,CAAAa,aAAA,CAACV,UAAU,EAAAW,QAAA,KACLF,IAAI;IACRG,IAAI,EAAEL,OAAQ;IACdF,SAAS,EAAEN,UAAU,CAAC,QAAQ,EAAEM,SAAS,CAAE;IAC3CQ,KAAK,EAAEP,SAAU;IACjBQ,QAAQ,EAAE,OAAON,OAAO,KAAK,UAAW;IACxCA,OAAO,EAAEA,OAAQ;IACjBO,kBAAkB;IAClBZ,GAAG,EAAEA;EAAI,IAERC,QACS,CAAC;AAEjB,CACF,CAAC;AAEDH,IAAI,CAACe,WAAW,GAAG,MAAM"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
interface StyledCardProps {
|
|
3
|
+
$pointer?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare const StyledCard: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("react").HTMLAttributes<HTMLDivElement> & import("../Paper").IPaperProps & import("react").RefAttributes<HTMLDivElement>>, any, StyledCardProps, never>;
|
|
6
|
+
export {};
|
|
3
7
|
//# sourceMappingURL=Styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/Styles.ts"],"names":[],"mappings":";AAKA,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/Styles.ts"],"names":[],"mappings":";AAKA,UAAU,eAAe;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,UAAU,sPAQtB,CAAC"}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
2
|
import { Paper } from "../Paper";
|
|
3
3
|
export const StyledCard = styled(Paper).withConfig({
|
|
4
4
|
displayName: "Styles__StyledCard",
|
|
5
5
|
componentId: "sc-hllbj1-0"
|
|
6
|
-
})(["", ""], {
|
|
6
|
+
})(["", " ", ""], {
|
|
7
7
|
"color": "var(--color-theme-900)"
|
|
8
|
+
}, _ref => {
|
|
9
|
+
let {
|
|
10
|
+
$pointer
|
|
11
|
+
} = _ref;
|
|
12
|
+
return $pointer && css(["cursor:pointer;"]);
|
|
8
13
|
});
|
|
9
14
|
StyledCard.displayName = "StyledCard";
|
|
10
15
|
//# sourceMappingURL=Styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Styles.js","names":["styled","Paper","StyledCard","withConfig","displayName","componentId"],"sources":["../../../../src/components/Card/Styles.ts"],"sourcesContent":["import styled from \"styled-components\";\nimport tw from \"twin.macro\";\n\nimport { Paper } from \"../Paper\";\n\nexport const StyledCard = styled(Paper)
|
|
1
|
+
{"version":3,"file":"Styles.js","names":["styled","css","Paper","StyledCard","withConfig","displayName","componentId","_ref","$pointer"],"sources":["../../../../src/components/Card/Styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\nimport tw from \"twin.macro\";\n\nimport { Paper } from \"../Paper\";\n\ninterface StyledCardProps {\n $pointer?: boolean;\n}\n\nexport const StyledCard = styled(Paper)<StyledCardProps>`\n ${tw`tw-text-theme-900`}\n\n ${({ $pointer }) =>\n $pointer &&\n css`\n cursor: pointer;\n `}\n`;\n\nStyledCard.displayName = \"StyledCard\";\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAG/C,SAASC,KAAK,QAAQ,UAAU;AAMhC,OAAO,MAAMC,UAAU,GAAGH,MAAM,CAACE,KAAK,CAAC,CAAAE,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,kBACjC;EAAA;AAAkB,CAAC,EAErBC,IAAA;EAAA,IAAC;IAAEC;EAAS,CAAC,GAAAD,IAAA;EAAA,OACbC,QAAQ,IACRP,GAAG,qBAEF;AAAA,EACJ;AAEDE,UAAU,CAACE,WAAW,GAAG,YAAY"}
|
|
@@ -23,7 +23,7 @@ export const EntityCard = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
23
23
|
as: Component,
|
|
24
24
|
$renderAs: renderAs,
|
|
25
25
|
$background: background,
|
|
26
|
-
|
|
26
|
+
variant: paperType,
|
|
27
27
|
className: classNames("c-entity-card", classSuffix, className),
|
|
28
28
|
$isCollection: isCollection
|
|
29
29
|
}, rest, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityCard.js","names":["React","forwardRef","useContext","classNames","EntityGroupContext","StyledEntityCard","Card","EntityCard","_ref","ref","children","isCollection","background","className","as","rest","renderAs","classSuffix","paperType","Component","createElement","_extends","$renderAs","$background","$isCollection","displayName"],"sources":["../../../../src/components/Entity/EntityCard.tsx"],"sourcesContent":["import React, {\n BaseHTMLAttributes,\n CSSProperties,\n forwardRef,\n ReactElement,\n ReactNode,\n useContext,\n} from \"react\";\n\nimport classNames from \"classnames\";\n\nimport { EntityGroupContext } from \"./EntityGroup\";\nimport { StyledEntityCard } from \"./Styles\";\nimport {\n PolymorphicComponentPropsWithRef,\n PolymorphicRef,\n} from \"../../utils/types\";\nimport { Card, ICardProps } from \"../Card\";\n\nexport interface IEntityCardProps\n extends ICardProps,\n BaseHTMLAttributes<HTMLElement> {\n /** ClassName to add on Card */\n className?: string;\n /** Show as group of Cards on grid */\n isCollection?: boolean;\n /** Background color to override for Card */\n background?: string;\n /** CSSProperties to override for Card */\n style?: CSSProperties;\n}\n\nexport type EntityCardProps<C extends React.ElementType> =\n PolymorphicComponentPropsWithRef<C, IEntityCardProps>;\n\nexport type EntityComponent = <C extends React.ElementType = typeof Card>(\n props: EntityCardProps<C>\n) => ReactElement | ReactNode | null;\n\nexport const EntityCard: EntityComponent & { displayName?: string } =\n forwardRef(\n <C extends React.ElementType = typeof Card>(\n {\n children,\n isCollection,\n background,\n className,\n as,\n ...rest\n }: EntityCardProps<C>,\n ref?: PolymorphicRef<C>\n ) => {\n const { renderAs } = useContext(EntityGroupContext);\n const classSuffix = `c-entity-card-${renderAs}`;\n const paperType = renderAs === \"grid\" ? \"paper-1\" : \"paper-2\";\n const Component = as || Card;\n return (\n <StyledEntityCard\n as={Component}\n $renderAs={renderAs}\n $background={background}\n
|
|
1
|
+
{"version":3,"file":"EntityCard.js","names":["React","forwardRef","useContext","classNames","EntityGroupContext","StyledEntityCard","Card","EntityCard","_ref","ref","children","isCollection","background","className","as","rest","renderAs","classSuffix","paperType","Component","createElement","_extends","$renderAs","$background","variant","$isCollection","displayName"],"sources":["../../../../src/components/Entity/EntityCard.tsx"],"sourcesContent":["import React, {\n BaseHTMLAttributes,\n CSSProperties,\n forwardRef,\n ReactElement,\n ReactNode,\n useContext,\n} from \"react\";\n\nimport classNames from \"classnames\";\n\nimport { EntityGroupContext } from \"./EntityGroup\";\nimport { StyledEntityCard } from \"./Styles\";\nimport {\n PolymorphicComponentPropsWithRef,\n PolymorphicRef,\n} from \"../../utils/types\";\nimport { Card, ICardProps } from \"../Card\";\n\nexport interface IEntityCardProps\n extends ICardProps,\n BaseHTMLAttributes<HTMLElement> {\n /** ClassName to add on Card */\n className?: string;\n /** Show as group of Cards on grid */\n isCollection?: boolean;\n /** Background color to override for Card */\n background?: string;\n /** CSSProperties to override for Card */\n style?: CSSProperties;\n}\n\nexport type EntityCardProps<C extends React.ElementType> =\n PolymorphicComponentPropsWithRef<C, IEntityCardProps>;\n\nexport type EntityComponent = <C extends React.ElementType = typeof Card>(\n props: EntityCardProps<C>\n) => ReactElement | ReactNode | null;\n\nexport const EntityCard: EntityComponent & { displayName?: string } =\n forwardRef(\n <C extends React.ElementType = typeof Card>(\n {\n children,\n isCollection,\n background,\n className,\n as,\n ...rest\n }: EntityCardProps<C>,\n ref?: PolymorphicRef<C>\n ) => {\n const { renderAs } = useContext(EntityGroupContext);\n const classSuffix = `c-entity-card-${renderAs}`;\n const paperType = renderAs === \"grid\" ? \"paper-1\" : \"paper-2\";\n const Component = as || Card;\n return (\n <StyledEntityCard\n as={Component}\n $renderAs={renderAs}\n $background={background}\n variant={paperType}\n className={classNames(\"c-entity-card\", classSuffix, className)}\n $isCollection={isCollection}\n {...rest}\n ref={ref}\n >\n {children}\n </StyledEntityCard>\n );\n }\n );\n\nEntityCard.displayName = \"EntityCard\";\n"],"mappings":";AAAA,OAAOA,KAAK,IAGVC,UAAU,EAGVC,UAAU,QACL,OAAO;AAEd,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,kBAAkB,QAAQ,eAAe;AAClD,SAASC,gBAAgB,QAAQ,UAAU;AAK3C,SAASC,IAAI,QAAoB,SAAS;AAsB1C,OAAO,MAAMC,UAAsD,gBACjEN,UAAU,CACR,CAAAO,IAAA,EASEC,GAAuB,KACpB;EAAA,IATH;IACEC,QAAQ;IACRC,YAAY;IACZC,UAAU;IACVC,SAAS;IACTC,EAAE;IACF,GAAGC;EACe,CAAC,GAAAP,IAAA;EAGrB,MAAM;IAAEQ;EAAS,CAAC,GAAGd,UAAU,CAACE,kBAAkB,CAAC;EACnD,MAAMa,WAAW,sBAAoBD,QAAU;EAC/C,MAAME,SAAS,GAAGF,QAAQ,KAAK,MAAM,GAAG,SAAS,GAAG,SAAS;EAC7D,MAAMG,SAAS,GAAGL,EAAE,IAAIR,IAAI;EAC5B,oBACEN,KAAA,CAAAoB,aAAA,CAACf,gBAAgB,EAAAgB,QAAA;IACfP,EAAE,EAAEK,SAAU;IACdG,SAAS,EAAEN,QAAS;IACpBO,WAAW,EAAEX,UAAW;IACxBY,OAAO,EAAEN,SAAU;IACnBL,SAAS,EAAEV,UAAU,CAAC,eAAe,EAAEc,WAAW,EAAEJ,SAAS,CAAE;IAC/DY,aAAa,EAAEd;EAAa,GACxBI,IAAI;IACRN,GAAG,EAAEA;EAAI,IAERC,QACe,CAAC;AAEvB,CACF,CAAC;AAEHH,UAAU,CAACmB,WAAW,GAAG,YAAY"}
|
|
@@ -38,7 +38,7 @@ export const EntityCard = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
38
38
|
"grid-item": renderAs === "grid-item",
|
|
39
39
|
"list-item": renderAs === "list-item"
|
|
40
40
|
}, className),
|
|
41
|
-
|
|
41
|
+
variant: renderAs === "grid-item" ? "paper-1" : "paper-2",
|
|
42
42
|
$renderAs: renderAs
|
|
43
43
|
}, renderAs === "list-item" ? renderAsListItem(properties) : null, renderAs === "grid-item" ? renderAsGridItem(properties) : null);
|
|
44
44
|
});
|