@activecollab/components 2.0.493 → 2.0.494

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.
@@ -4,14 +4,23 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.EmptySlate = void 0;
7
- var _react = _interopRequireDefault(require("react"));
7
+ var _react = _interopRequireWildcard(require("react"));
8
8
  var _EmptySlate = require("./EmptySlate.styles");
9
9
  var _EmptySlateFooter = require("./EmptySlateFooter");
10
10
  var _excluded = ["title", "description", "src", "alt", "children"];
11
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
12
12
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
13
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
14
+ 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."); }
15
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
16
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
17
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
18
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
13
19
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
14
20
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
21
+ var isAlreadyLoaded = function isAlreadyLoaded(image) {
22
+ return !!image && image.complete && image.naturalWidth > 0;
23
+ };
15
24
  var EmptySlate = exports.EmptySlate = function EmptySlate(_ref) {
16
25
  var title = _ref.title,
17
26
  description = _ref.description,
@@ -19,11 +28,27 @@ var EmptySlate = exports.EmptySlate = function EmptySlate(_ref) {
19
28
  alt = _ref.alt,
20
29
  children = _ref.children,
21
30
  rest = _objectWithoutProperties(_ref, _excluded);
31
+ var imageRef = (0, _react.useRef)(null);
32
+ var _useState = (0, _react.useState)(),
33
+ _useState2 = _slicedToArray(_useState, 2),
34
+ loadedSrc = _useState2[0],
35
+ setLoadedSrc = _useState2[1];
36
+ var markLoaded = (0, _react.useCallback)(function () {
37
+ return setLoadedSrc(src);
38
+ }, [src]);
39
+ (0, _react.useLayoutEffect)(function () {
40
+ if (isAlreadyLoaded(imageRef.current)) {
41
+ markLoaded();
42
+ }
43
+ }, [markLoaded]);
22
44
  return /*#__PURE__*/_react.default.createElement(_EmptySlate.Container, _extends({}, rest, {
23
45
  role: "status"
24
46
  }), /*#__PURE__*/_react.default.createElement(_EmptySlate.StyledImg, {
47
+ ref: imageRef,
25
48
  src: src,
26
- alt: alt
49
+ alt: alt,
50
+ onLoad: markLoaded,
51
+ $loaded: loadedSrc === src
27
52
  }), /*#__PURE__*/_react.default.createElement(_EmptySlate.SubContainer, null, /*#__PURE__*/_react.default.createElement(_EmptySlate.Title, {
28
53
  weight: "light",
29
54
  variant: "Title 1"
@@ -1 +1 @@
1
- {"version":3,"file":"EmptySlate.js","names":["_react","_interopRequireDefault","require","_EmptySlate","_EmptySlateFooter","_excluded","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","_objectWithoutProperties","o","i","_objectWithoutPropertiesLoose","getOwnPropertySymbols","indexOf","propertyIsEnumerable","EmptySlate","exports","_ref","title","description","src","alt","children","rest","createElement","Container","role","StyledImg","SubContainer","Title","weight","variant","Description","color","Footer","EmptySlateFooter","displayName"],"sources":["../../../../src/components/EmptySlate/EmptySlate.tsx"],"sourcesContent":["import React, { HTMLAttributes } from \"react\";\n\nimport {\n Container,\n Description,\n SubContainer,\n Title,\n StyledImg,\n} from \"./EmptySlate.styles\";\nimport { EmptySlateFooter } from \"./EmptySlateFooter\";\n\nexport interface EmptySlateProps extends HTMLAttributes<HTMLDivElement> {\n src: string;\n alt: string;\n title: string;\n description?: string;\n}\n\nexport const EmptySlate = ({\n title,\n description,\n src,\n alt,\n children,\n ...rest\n}: EmptySlateProps) => {\n return (\n <Container {...rest} role=\"status\">\n <StyledImg src={src} alt={alt} />\n <SubContainer>\n <Title weight=\"light\" variant=\"Title 1\">\n {title}\n </Title>\n {description && (\n <Description color=\"tertiary\" variant=\"Body 1\">\n {description}\n </Description>\n )}\n\n {children}\n </SubContainer>\n </Container>\n );\n};\n\nEmptySlate.Footer = EmptySlateFooter;\n\nEmptySlate.displayName = \"EmptySlate\";\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAOA,IAAAE,iBAAA,GAAAF,OAAA;AAAsD,IAAAG,SAAA;AAAA,SAAAJ,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,SAAA,WAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,CAAA,aAAAP,CAAA,MAAAA,CAAA,GAAAQ,SAAA,CAAAC,MAAA,EAAAT,CAAA,UAAAU,CAAA,GAAAF,SAAA,CAAAR,CAAA,YAAAW,CAAA,IAAAD,CAAA,OAAAE,cAAA,CAAAC,IAAA,CAAAH,CAAA,EAAAC,CAAA,MAAAJ,CAAA,CAAAI,CAAA,IAAAD,CAAA,CAAAC,CAAA,aAAAJ,CAAA,KAAAJ,QAAA,CAAAW,KAAA,OAAAN,SAAA;AAAA,SAAAO,yBAAAf,CAAA,EAAAU,CAAA,gBAAAV,CAAA,iBAAAgB,CAAA,EAAAL,CAAA,EAAAM,CAAA,GAAAC,6BAAA,CAAAlB,CAAA,EAAAU,CAAA,OAAAN,MAAA,CAAAe,qBAAA,QAAAZ,CAAA,GAAAH,MAAA,CAAAe,qBAAA,CAAAnB,CAAA,QAAAW,CAAA,MAAAA,CAAA,GAAAJ,CAAA,CAAAE,MAAA,EAAAE,CAAA,IAAAK,CAAA,GAA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,EAAC;EAAS,GACpCb,KACI,CAAC,EACPC,WAAW,iBACVhC,MAAA,CAAAQ,OAAA,CAAA6B,aAAA,CAAClC,WAAA,CAAA0C,WAAW;IAACC,KAAK,EAAC,UAAU;IAACF,OAAO,EAAC;EAAQ,GAC3CZ,WACU,CACd,EAEAG,QACW,CACL,CAAC;AAEhB,CAAC;AAEDP,UAAU,CAACmB,MAAM,GAAGC,kCAAgB;AAEpCpB,UAAU,CAACqB,WAAW,GAAG,YAAY","ignoreList":[]}
1
+ {"version":3,"file":"EmptySlate.js","names":["_react","_interopRequireWildcard","require","_EmptySlate","_EmptySlateFooter","_excluded","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","_slicedToArray","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","TypeError","a","_arrayLikeToArray","toString","slice","constructor","name","Array","from","test","l","Symbol","iterator","u","next","done","push","value","return","isArray","_objectWithoutProperties","_objectWithoutPropertiesLoose","getOwnPropertySymbols","indexOf","propertyIsEnumerable","isAlreadyLoaded","image","complete","naturalWidth","EmptySlate","exports","_ref","title","description","src","alt","children","rest","imageRef","useRef","_useState","useState","_useState2","loadedSrc","setLoadedSrc","markLoaded","useCallback","useLayoutEffect","current","createElement","Container","role","StyledImg","ref","onLoad","$loaded","SubContainer","Title","weight","variant","Description","color","Footer","EmptySlateFooter","displayName"],"sources":["../../../../src/components/EmptySlate/EmptySlate.tsx"],"sourcesContent":["import React, {\n HTMLAttributes,\n useCallback,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\n\nimport {\n Container,\n Description,\n SubContainer,\n Title,\n StyledImg,\n} from \"./EmptySlate.styles\";\nimport { EmptySlateFooter } from \"./EmptySlateFooter\";\n\nexport interface EmptySlateProps extends HTMLAttributes<HTMLDivElement> {\n src: string;\n alt: string;\n title: string;\n description?: string;\n}\n\nconst isAlreadyLoaded = (image: HTMLImageElement | null) =>\n !!image && image.complete && image.naturalWidth > 0;\n\nexport const EmptySlate = ({\n title,\n description,\n src,\n alt,\n children,\n ...rest\n}: EmptySlateProps) => {\n const imageRef = useRef<HTMLImageElement>(null);\n const [loadedSrc, setLoadedSrc] = useState<string>();\n\n const markLoaded = useCallback(() => setLoadedSrc(src), [src]);\n\n useLayoutEffect(() => {\n if (isAlreadyLoaded(imageRef.current)) {\n markLoaded();\n }\n }, [markLoaded]);\n\n return (\n <Container {...rest} role=\"status\">\n <StyledImg\n ref={imageRef}\n src={src}\n alt={alt}\n onLoad={markLoaded}\n $loaded={loadedSrc === src}\n />\n <SubContainer>\n <Title weight=\"light\" variant=\"Title 1\">\n {title}\n </Title>\n {description && (\n <Description color=\"tertiary\" variant=\"Body 1\">\n {description}\n </Description>\n )}\n\n {children}\n </SubContainer>\n </Container>\n );\n};\n\nEmptySlate.Footer = EmptySlateFooter;\n\nEmptySlate.displayName = \"EmptySlate\";\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAQA,IAAAC,WAAA,GAAAD,OAAA;AAOA,IAAAE,iBAAA,GAAAF,OAAA;AAAsD,IAAAG,SAAA;AAAA,SAAAJ,wBAAAK,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAP,uBAAA,YAAAA,wBAAAK,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,C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AA,CAAA0F,YAAY,qBACX7F,MAAA,CAAAgB,OAAA,CAAAsE,aAAA,CAACnF,WAAA,CAAA2F,KAAK;IAACC,MAAM,EAAC,OAAO;IAACC,OAAO,EAAC;EAAS,GACpC3B,KACI,CAAC,EACPC,WAAW,iBACVtE,MAAA,CAAAgB,OAAA,CAAAsE,aAAA,CAACnF,WAAA,CAAA8F,WAAW;IAACC,KAAK,EAAC,UAAU;IAACF,OAAO,EAAC;EAAQ,GAC3C1B,WACU,CACd,EAEAG,QACW,CACL,CAAC;AAEhB,CAAC;AAEDP,UAAU,CAACiC,MAAM,GAAGC,kCAAgB;AAEpClC,UAAU,CAACmC,WAAW,GAAG,YAAY","ignoreList":[]}
@@ -19,7 +19,10 @@ var SubContainer = exports.SubContainer = _styledComponents.default.div.withConf
19
19
  var StyledImg = exports.StyledImg = _styledComponents.default.img.withConfig({
20
20
  displayName: "EmptySlatestyles__StyledImg",
21
21
  componentId: "sc-jfbqky-2"
22
- })(["width:280px;height:280px;"]);
22
+ })(["width:280px;height:280px;visibility:", ";"], function (_ref) {
23
+ var $loaded = _ref.$loaded;
24
+ return $loaded ? "visible" : "hidden";
25
+ });
23
26
  var Title = exports.Title = (0, _styledComponents.default)(_Typography.Typography).withConfig({
24
27
  displayName: "EmptySlatestyles__Title",
25
28
  componentId: "sc-jfbqky-3"
@@ -1 +1 @@
1
- {"version":3,"file":"EmptySlate.styles.js","names":["_styledComponents","_interopRequireDefault","require","_BreakPoints","_Typography","e","__esModule","default","Container","exports","styled","div","withConfig","displayName","componentId","screen","lg","SubContainer","StyledImg","img","Title","Typography","Description","FooterContainer"],"sources":["../../../../src/components/EmptySlate/EmptySlate.styles.ts"],"sourcesContent":["import styled from \"styled-components\";\n\nimport { screen } from \"../BreakPoints\";\nimport { Typography } from \"../Typography/Typography\";\n\nexport const Container = styled.div`\n display: flex;\n align-items: center;\n flex-direction: column;\n justify-content: center;\n text-align: center;\n gap: 24px;\n\n ${screen.lg} {\n flex-direction: row;\n }\n`;\n\nexport const SubContainer = styled.div`\n display: flex;\n align-items: center;\n flex-direction: column;\n justify-content: center;\n max-width: 400px;\n padding-left: 20px;\n padding-right: 20px;\n\n ${screen.lg} {\n align-items: flex-start;\n }\n`;\n\nexport const StyledImg = styled.img`\n width: 280px;\n height: 280px;\n`;\n\nexport const Title = styled(Typography)`\n margin-block-end: 8px;\n text-align: center;\n\n ${screen.lg} {\n text-align: start;\n }\n`;\n\nexport const Description = styled(Typography)`\n text-align: center;\n\n ${screen.lg} {\n text-align: start;\n }\n`;\n\nexport const FooterContainer = styled.div`\n margin-block-start: 24px;\n display: flex;\n flex-direction: column;\n gap: 12px;\n align-items: center;\n\n ${screen.lg} {\n flex-direction: row;\n }\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAAsD,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE/C,IAAMG,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAGE,yBAAM,CAACC,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,0IAQ/BC,mBAAM,CAACC,EAAE,CAGZ;AAEM,IAAMC,YAAY,GAAAR,OAAA,CAAAQ,YAAA,GAAGP,yBAAM,CAACC,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,wKASlCC,mBAAM,CAACC,EAAE,CAGZ;AAEM,IAAME,SAAS,GAAAT,OAAA,CAAAS,SAAA,GAAGR,yBAAM,CAACS,GAAG,CAAAP,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,iCAGlC;AAEM,IAAMM,KAAK,GAAAX,OAAA,CAAAW,KAAA,GAAG,IAAAV,yBAAM,EAACW,sBAAU,CAAC,CAAAT,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,uEAInCC,mBAAM,CAACC,EAAE,CAGZ;AAEM,IAAMM,WAAW,GAAAb,OAAA,CAAAa,WAAA,GAAG,IAAAZ,yBAAM,EAACW,sBAAU,CAAC,CAAAT,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,kDAGzCC,mBAAM,CAACC,EAAE,CAGZ;AAEM,IAAMO,eAAe,GAAAd,OAAA,CAAAc,eAAA,GAAGb,yBAAM,CAACC,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,yHAOrCC,mBAAM,CAACC,EAAE,CAGZ","ignoreList":[]}
1
+ {"version":3,"file":"EmptySlate.styles.js","names":["_styledComponents","_interopRequireDefault","require","_BreakPoints","_Typography","e","__esModule","default","Container","exports","styled","div","withConfig","displayName","componentId","screen","lg","SubContainer","StyledImg","img","_ref","$loaded","Title","Typography","Description","FooterContainer"],"sources":["../../../../src/components/EmptySlate/EmptySlate.styles.ts"],"sourcesContent":["import styled from \"styled-components\";\n\nimport { screen } from \"../BreakPoints\";\nimport { Typography } from \"../Typography/Typography\";\n\nexport const Container = styled.div`\n display: flex;\n align-items: center;\n flex-direction: column;\n justify-content: center;\n text-align: center;\n gap: 24px;\n\n ${screen.lg} {\n flex-direction: row;\n }\n`;\n\nexport const SubContainer = styled.div`\n display: flex;\n align-items: center;\n flex-direction: column;\n justify-content: center;\n max-width: 400px;\n padding-left: 20px;\n padding-right: 20px;\n\n ${screen.lg} {\n align-items: flex-start;\n }\n`;\n\nexport const StyledImg = styled.img<{ $loaded: boolean }>`\n width: 280px;\n height: 280px;\n visibility: ${({ $loaded }) => ($loaded ? \"visible\" : \"hidden\")};\n`;\n\nexport const Title = styled(Typography)`\n margin-block-end: 8px;\n text-align: center;\n\n ${screen.lg} {\n text-align: start;\n }\n`;\n\nexport const Description = styled(Typography)`\n text-align: center;\n\n ${screen.lg} {\n text-align: start;\n }\n`;\n\nexport const FooterContainer = styled.div`\n margin-block-start: 24px;\n display: fl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AA,CAAAgB,eAAA,GAAGf,yBAAM,CAACC,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,yHAOrCC,mBAAM,CAACC,EAAE,CAGZ","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"EmptySlate.d.ts","sourceRoot":"","sources":["../../../../src/components/EmptySlate/EmptySlate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAW9C,MAAM,WAAW,eAAgB,SAAQ,cAAc,CAAC,cAAc,CAAC;IACrE,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,UAAU;0DAOpB,eAAe;;;;;;;;;CAkBjB,CAAC"}
1
+ {"version":3,"file":"EmptySlate.d.ts","sourceRoot":"","sources":["../../../../src/components/EmptySlate/EmptySlate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,cAAc,EAKf,MAAM,OAAO,CAAC;AAWf,MAAM,WAAW,eAAgB,SAAQ,cAAc,CAAC,cAAc,CAAC;IACrE,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAKD,eAAO,MAAM,UAAU;0DAOpB,eAAe;;;;;;;;;CAmCjB,CAAC"}
@@ -1,9 +1,10 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["title", "description", "src", "alt", "children"];
4
- import React from "react";
4
+ import React, { useCallback, useLayoutEffect, useRef, useState } from "react";
5
5
  import { Container, Description, SubContainer, Title, StyledImg } from "./EmptySlate.styles";
6
6
  import { EmptySlateFooter } from "./EmptySlateFooter";
7
+ const isAlreadyLoaded = image => !!image && image.complete && image.naturalWidth > 0;
7
8
  export const EmptySlate = _ref => {
8
9
  let title = _ref.title,
9
10
  description = _ref.description,
@@ -11,11 +12,24 @@ export const EmptySlate = _ref => {
11
12
  alt = _ref.alt,
12
13
  children = _ref.children,
13
14
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
15
+ const imageRef = useRef(null);
16
+ const _useState = useState(),
17
+ loadedSrc = _useState[0],
18
+ setLoadedSrc = _useState[1];
19
+ const markLoaded = useCallback(() => setLoadedSrc(src), [src]);
20
+ useLayoutEffect(() => {
21
+ if (isAlreadyLoaded(imageRef.current)) {
22
+ markLoaded();
23
+ }
24
+ }, [markLoaded]);
14
25
  return /*#__PURE__*/React.createElement(Container, _extends({}, rest, {
15
26
  role: "status"
16
27
  }), /*#__PURE__*/React.createElement(StyledImg, {
28
+ ref: imageRef,
17
29
  src: src,
18
- alt: alt
30
+ alt: alt,
31
+ onLoad: markLoaded,
32
+ $loaded: loadedSrc === src
19
33
  }), /*#__PURE__*/React.createElement(SubContainer, null, /*#__PURE__*/React.createElement(Title, {
20
34
  weight: "light",
21
35
  variant: "Title 1"
@@ -1 +1 @@
1
- {"version":3,"file":"EmptySlate.js","names":["React","Container","Description","SubContainer","Title","StyledImg","EmptySlateFooter","EmptySlate","_ref","title","description","src","alt","children","rest","_objectWithoutPropertiesLoose","_excluded","createElement","_extends","role","weight","variant","color","Footer","displayName"],"sources":["../../../../src/components/EmptySlate/EmptySlate.tsx"],"sourcesContent":["import React, { HTMLAttributes } from \"react\";\n\nimport {\n Container,\n Description,\n SubContainer,\n Title,\n StyledImg,\n} from \"./EmptySlate.styles\";\nimport { EmptySlateFooter } from \"./EmptySlateFooter\";\n\nexport interface EmptySlateProps extends HTMLAttributes<HTMLDivElement> {\n src: string;\n alt: string;\n title: string;\n description?: string;\n}\n\nexport const EmptySlate = ({\n title,\n description,\n src,\n alt,\n children,\n ...rest\n}: EmptySlateProps) => {\n return (\n <Container {...rest} role=\"status\">\n <StyledImg src={src} alt={alt} />\n <SubContainer>\n <Title weight=\"light\" variant=\"Title 1\">\n {title}\n </Title>\n {description && (\n <Description color=\"tertiary\" variant=\"Body 1\">\n {description}\n </Description>\n )}\n\n {children}\n </SubContainer>\n </Container>\n );\n};\n\nEmptySlate.Footer = EmptySlateFooter;\n\nEmptySlate.displayName = \"EmptySlate\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAA0B,OAAO;AAE7C,SACEC,SAAS,EACTC,WAAW,EACXC,YAAY,EACZC,KAAK,EACLC,SAAS,QACJ,qBAAqB;AAC5B,SAASC,gBAAgB,QAAQ,oBAAoB;AASrD,OAAO,MAAMC,UAAU,GAAGC,IAAA,IAOH;EAAA,IANrBC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,WAAW,GAAAF,IAAA,CAAXE,WAAW;IACXC,GAAG,GAAAH,IAAA,CAAHG,GAAG;IACHC,GAAG,GAAAJ,IAAA,CAAHI,GAAG;IACHC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;IACLC,IAAI,GAAAC,6BAAA,CAAAP,IAAA,EAAAQ,SAAA;EAEP,oBACEhB,KAAA,CAAAiB,aAAA,CAAChB,SAAS,EAAAiB,QAAA,KAAKJ,IAAI;IAAEK,IAAI,EAAC;EAAQ,iBAChCnB,KAAA,CAAAiB,aAAA,CAACZ,SAAS;IAACM,GAAG,EAAEA,GAAI;IAACC,GAAG,EAAEA;EAAI,CAAE,CAAC,eACjCZ,KAAA,CAAAiB,aAAA,CAACd,YAAY,qBACXH,KAAA,CAAAiB,aAAA,CAACb,KAAK;IAACgB,MAAM,EAAC,OAAO;IAACC,OAAO,EAAC;EAAS,GACpCZ,KACI,CAAC,EACPC,WAAW,iBACVV,KAAA,CAAAiB,aAAA,CAACf,WAAW;IAACoB,KAAK,EAAC,UAAU;IAACD,OAAO,EAAC;EAAQ,GAC3CX,WACU,CACd,EAEAG,QACW,CACL,CAAC;AAEhB,CAAC;AAEDN,UAAU,CAACgB,MAAM,GAAGjB,gBAAgB;AAEpCC,UAAU,CAACiB,WAAW,GAAG,YAAY","ignoreList":[]}
1
+ {"version":3,"file":"EmptySlate.js","names":["React","useCallback","useLayoutEffect","useRef","useState","Container","Description","SubContainer","Title","StyledImg","EmptySlateFooter","isAlreadyLoaded","image","complete","naturalWidth","EmptySlate","_ref","title","description","src","alt","children","rest","_objectWithoutPropertiesLoose","_excluded","imageRef","_useState","loadedSrc","setLoadedSrc","markLoaded","current","createElement","_extends","role","ref","onLoad","$loaded","weight","variant","color","Footer","displayName"],"sources":["../../../../src/components/EmptySlate/EmptySlate.tsx"],"sourcesContent":["import React, {\n HTMLAttributes,\n useCallback,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\n\nimport {\n Container,\n Description,\n SubContainer,\n Title,\n StyledImg,\n} from \"./EmptySlate.styles\";\nimport { EmptySlateFooter } from \"./EmptySlateFooter\";\n\nexport interface EmptySlateProps extends HTMLAttributes<HTMLDivElement> {\n src: string;\n alt: string;\n title: string;\n description?: string;\n}\n\nconst isAlreadyLoaded = (image: HTMLImageElement | null) =>\n !!image && image.complete && image.naturalWidth > 0;\n\nexport const EmptySlate = ({\n title,\n description,\n src,\n alt,\n children,\n ...rest\n}: EmptySlateProps) => {\n const imageRef = useRef<HTMLImageElement>(null);\n const [loadedSrc, setLoadedSrc] = useState<string>();\n\n const markLoaded = useCallback(() => setLoadedSrc(src), [src]);\n\n useLayoutEffect(() => {\n if (isAlreadyLoaded(imageRef.current)) {\n markLoaded();\n }\n }, [markLoaded]);\n\n return (\n <Container {...rest} role=\"status\">\n <StyledImg\n ref={imageRef}\n src={src}\n alt={alt}\n onLoad={markLoaded}\n $loaded={loadedSrc === src}\n />\n <SubContainer>\n <Title weight=\"light\" variant=\"Title 1\">\n {title}\n </Title>\n {description && (\n <Description color=\"tertiary\" variant=\"Body 1\">\n {description}\n </Description>\n )}\n\n {children}\n </SubContainer>\n </Container>\n );\n};\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AAA+B,aAAA,CAACtB,SAAS;IACRyB,GAAG,EAAET,QAAS;IACdN,GAAG,EAAEA,GAAI;IACTC,GAAG,EAAEA,GAAI;IACTe,MAAM,EAAEN,UAAW;IACnBO,OAAO,EAAET,SAAS,KAAKR;EAAI,CAC5B,CAAC,eACFnB,KAAA,CAAA+B,aAAA,CAACxB,YAAY,qBACXP,KAAA,CAAA+B,aAAA,CAACvB,KAAK;IAAC6B,MAAM,EAAC,OAAO;IAACC,OAAO,EAAC;EAAS,GACpCrB,KACI,CAAC,EACPC,WAAW,iBACVlB,KAAA,CAAA+B,aAAA,CAACzB,WAAW;IAACiC,KAAK,EAAC,UAAU;IAACD,OAAO,EAAC;EAAQ,GAC3CpB,WACU,CACd,EAEAG,QACW,CACL,CAAC;AAEhB,CAAC;AAEDN,UAAU,CAACyB,MAAM,GAAG9B,gBAAgB;AAEpCK,UAAU,CAAC0B,WAAW,GAAG,YAAY","ignoreList":[]}
@@ -1,6 +1,8 @@
1
1
  export declare const Container: import("styled-components").StyledComponent<"div", any, {}, never>;
2
2
  export declare const SubContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
3
- export declare const StyledImg: import("styled-components").StyledComponent<"img", any, {}, never>;
3
+ export declare const StyledImg: import("styled-components").StyledComponent<"img", any, {
4
+ $loaded: boolean;
5
+ }, never>;
4
6
  export declare const Title: import("styled-components").StyledComponent<import("../Typography/Typography").TypographyComponent & {
5
7
  displayName?: string;
6
8
  }, any, {}, never>;
@@ -1 +1 @@
1
- {"version":3,"file":"EmptySlate.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/EmptySlate/EmptySlate.styles.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,SAAS,oEAWrB,CAAC;AAEF,eAAO,MAAM,YAAY,oEAYxB,CAAC;AAEF,eAAO,MAAM,SAAS,oEAGrB,CAAC;AAEF,eAAO,MAAM,KAAK;;kBAOjB,CAAC;AAEF,eAAO,MAAM,WAAW;;kBAMvB,CAAC;AAEF,eAAO,MAAM,eAAe,oEAU3B,CAAC"}
1
+ {"version":3,"file":"EmptySlate.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/EmptySlate/EmptySlate.styles.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,SAAS,oEAWrB,CAAC;AAEF,eAAO,MAAM,YAAY,oEAYxB,CAAC;AAEF,eAAO,MAAM,SAAS;aAAyB,OAAO;SAIrD,CAAC;AAEF,eAAO,MAAM,KAAK;;kBAOjB,CAAC;AAEF,eAAO,MAAM,WAAW;;kBAMvB,CAAC;AAEF,eAAO,MAAM,eAAe,oEAU3B,CAAC"}
@@ -12,7 +12,10 @@ export const SubContainer = styled.div.withConfig({
12
12
  export const StyledImg = styled.img.withConfig({
13
13
  displayName: "EmptySlatestyles__StyledImg",
14
14
  componentId: "sc-jfbqky-2"
15
- })(["width:280px;height:280px;"]);
15
+ })(["width:280px;height:280px;visibility:", ";"], _ref => {
16
+ let $loaded = _ref.$loaded;
17
+ return $loaded ? "visible" : "hidden";
18
+ });
16
19
  export const Title = styled(Typography).withConfig({
17
20
  displayName: "EmptySlatestyles__Title",
18
21
  componentId: "sc-jfbqky-3"
@@ -1 +1 @@
1
- {"version":3,"file":"EmptySlate.styles.js","names":["styled","screen","Typography","Container","div","withConfig","displayName","componentId","lg","SubContainer","StyledImg","img","Title","Description","FooterContainer"],"sources":["../../../../src/components/EmptySlate/EmptySlate.styles.ts"],"sourcesContent":["import styled from \"styled-components\";\n\nimport { screen } from \"../BreakPoints\";\nimport { Typography } from \"../Typography/Typography\";\n\nexport const Container = styled.div`\n display: flex;\n align-items: center;\n flex-direction: column;\n justify-content: center;\n text-align: center;\n gap: 24px;\n\n ${screen.lg} {\n flex-direction: row;\n }\n`;\n\nexport const SubContainer = styled.div`\n display: flex;\n align-items: center;\n flex-direction: column;\n justify-content: center;\n max-width: 400px;\n padding-left: 20px;\n padding-right: 20px;\n\n ${screen.lg} {\n align-items: flex-start;\n }\n`;\n\nexport const StyledImg = styled.img`\n width: 280px;\n height: 280px;\n`;\n\nexport const Title = styled(Typography)`\n margin-block-end: 8px;\n text-align: center;\n\n ${screen.lg} {\n text-align: start;\n }\n`;\n\nexport const Description = styled(Typography)`\n text-align: center;\n\n ${screen.lg} {\n text-align: start;\n }\n`;\n\nexport const FooterContainer = styled.div`\n margin-block-start: 24px;\n display: flex;\n flex-direction: column;\n gap: 12px;\n align-items: center;\n\n ${screen.lg} {\n flex-direction: row;\n }\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,mBAAmB;AAEtC,SAASC,MAAM,QAAQ,gBAAgB;AACvC,SAASC,UAAU,QAAQ,0BAA0B;AAErD,OAAO,MAAMC,SAAS,GAAGH,MAAM,CAACI,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,0IAQ/BN,MAAM,CAACO,EAAE,CAGZ;AAED,OAAO,MAAMC,YAAY,GAAGT,MAAM,CAACI,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,wKASlCN,MAAM,CAACO,EAAE,CAGZ;AAED,OAAO,MAAME,SAAS,GAAGV,MAAM,CAACW,GAAG,CAAAN,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,iCAGlC;AAED,OAAO,MAAMK,KAAK,GAAGZ,MAAM,CAACE,UAAU,CAAC,CAAAG,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,uEAInCN,MAAM,CAACO,EAAE,CAGZ;AAED,OAAO,MAAMK,WAAW,GAAGb,MAAM,CAACE,UAAU,CAAC,CAAAG,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,kDAGzCN,MAAM,CAACO,EAAE,CAGZ;AAED,OAAO,MAAMM,eAAe,GAAGd,MAAM,CAACI,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,yHAOrCN,MAAM,CAACO,EAAE,CAGZ","ignoreList":[]}
1
+ {"version":3,"file":"EmptySlate.styles.js","names":["styled","screen","Typography","Container","div","withConfig","displayName","componentId","lg","SubContainer","StyledImg","img","_ref","$loaded","Title","Description","FooterContainer"],"sources":["../../../../src/components/EmptySlate/EmptySlate.styles.ts"],"sourcesContent":["import styled from \"styled-components\";\n\nimport { screen } from \"../BreakPoints\";\nimport { Typography } from \"../Typography/Typography\";\n\nexport const Container = styled.div`\n display: flex;\n align-items: center;\n flex-direction: column;\n justify-content: center;\n text-align: center;\n gap: 24px;\n\n ${screen.lg} {\n flex-direction: row;\n }\n`;\n\nexport const SubContainer = styled.div`\n display: flex;\n align-items: center;\n flex-direction: column;\n justify-content: center;\n max-width: 400px;\n padding-left: 20px;\n padding-right: 20px;\n\n ${screen.lg} {\n align-items: flex-start;\n }\n`;\n\nexport const StyledImg = styled.img<{ $loaded: boolean }>`\n width: 280px;\n height: 280px;\n visibility: ${({ $loaded }) => ($loaded ? \"visible\" : \"hidden\")};\n`;\n\nexport const Title = styled(Typography)`\n margin-block-end: 8px;\n text-align: center;\n\n ${screen.lg} {\n text-align: start;\n }\n`;\n\nexport const Description = styled(Typography)`\n text-align: center;\n\n ${screen.lg} {\n text-align: start;\n }\n`;\n\nexport const FooterContainer = styled.div`\n margin-block-start: 24px;\n display: flex;\n flex-direction: column;\n gap: 12px;\n align-items: center;\n\n ${screen.lg} {\n flex-direction: row;\n }\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,mBAAmB;AAEtC,SAASC,MAAM,QAAQ,gBAAgB;AACvC,SAASC,UAAU,QAAQ,0BAA0B;AAErD,OAAO,MAAMC,SAAS,GAAGH,MAAM,CAACI,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,0IAQ/BN,MAAM,CAACO,EAAE,CAGZ;AAED,OAAO,MAAMC,YAAY,GAAGT,MAAM,CAACI,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,wKASlCN,MAAM,CAACO,EAAE,CAGZ;AAED,OAAO,MAAME,SAAS,GAAGV,MAAM,CAACW,GAAG,CAAAN,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,kDAGnBK,IAAA;EAAA,IAAGC,OAAO,GAAAD,IAAA,CAAPC,OAAO;EAAA,OAAQA,OAAO,GAAG,SAAS,GAAG,QAAQ;AAAA,CAAC,CAChE;AAED,OAAO,MAAMC,KAAK,GAAGd,MAAM,CAACE,UAAU,CAAC,CAAAG,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,uEAInCN,MAAM,CAACO,EAAE,CAGZ;AAED,OAAO,MAAMO,WAAW,GAAGf,MAAM,CAACE,UAAU,CAAC,CAAAG,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,kDAGzCN,MAAM,CAACO,EAAE,CAGZ;AAED,OAAO,MAAMQ,eAAe,GAAGhB,MAAM,CAACI,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,yHAOrCN,MAAM,CAACO,EAAE,CAGZ","ignoreList":[]}
package/dist/index.js CHANGED
@@ -31665,7 +31665,10 @@
31665
31665
  var StyledImg = styled__default["default"].img.withConfig({
31666
31666
  displayName: "EmptySlatestyles__StyledImg",
31667
31667
  componentId: "sc-jfbqky-2"
31668
- })(["width:280px;height:280px;"]);
31668
+ })(["width:280px;height:280px;visibility:", ";"], function (_ref) {
31669
+ var $loaded = _ref.$loaded;
31670
+ return $loaded ? "visible" : "hidden";
31671
+ });
31669
31672
  var Title = styled__default["default"](Typography).withConfig({
31670
31673
  displayName: "EmptySlatestyles__Title",
31671
31674
  componentId: "sc-jfbqky-3"
@@ -31691,6 +31694,9 @@
31691
31694
  EmptySlateFooter.displayName = "EmptySlateFooter";
31692
31695
 
31693
31696
  var _excluded$5 = ["title", "description", "src", "alt", "children"];
31697
+ var isAlreadyLoaded = function isAlreadyLoaded(image) {
31698
+ return !!image && image.complete && image.naturalWidth > 0;
31699
+ };
31694
31700
  var EmptySlate = function EmptySlate(_ref) {
31695
31701
  var title = _ref.title,
31696
31702
  description = _ref.description,
@@ -31698,11 +31704,27 @@
31698
31704
  alt = _ref.alt,
31699
31705
  children = _ref.children,
31700
31706
  rest = _objectWithoutProperties(_ref, _excluded$5);
31707
+ var imageRef = React.useRef(null);
31708
+ var _useState = React.useState(),
31709
+ _useState2 = _slicedToArray(_useState, 2),
31710
+ loadedSrc = _useState2[0],
31711
+ setLoadedSrc = _useState2[1];
31712
+ var markLoaded = React.useCallback(function () {
31713
+ return setLoadedSrc(src);
31714
+ }, [src]);
31715
+ React.useLayoutEffect(function () {
31716
+ if (isAlreadyLoaded(imageRef.current)) {
31717
+ markLoaded();
31718
+ }
31719
+ }, [markLoaded]);
31701
31720
  return /*#__PURE__*/React__default["default"].createElement(Container, _extends({}, rest, {
31702
31721
  role: "status"
31703
31722
  }), /*#__PURE__*/React__default["default"].createElement(StyledImg, {
31723
+ ref: imageRef,
31704
31724
  src: src,
31705
- alt: alt
31725
+ alt: alt,
31726
+ onLoad: markLoaded,
31727
+ $loaded: loadedSrc === src
31706
31728
  }), /*#__PURE__*/React__default["default"].createElement(SubContainer, null, /*#__PURE__*/React__default["default"].createElement(Title, {
31707
31729
  weight: "light",
31708
31730
  variant: "Title 1"