@looker/embed-components 23.8.1 → 23.12.1-alpha.1674

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/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # Changelog
2
2
 
3
+ ## [23.12.0](https://github.com/looker-open-source/sdk-codegen/compare/embed-components-v23.10.0...embed-components-v23.12.0) (2023-07-17)
4
+
5
+
6
+ ### Miscellaneous Chores
7
+
8
+ * **embed-components:** Synchronize undefined versions
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @looker/embed-services bumped from 23.10.0 to 23.12.0
16
+ * @looker/sdk bumped from 23.10.0 to 23.12.0
17
+ * devDependencies
18
+ * @looker/sdk-node bumped from 23.10.0 to 23.12.0
19
+
20
+ ## [23.10.0](https://github.com/looker-open-source/sdk-codegen/compare/embed-components-v23.8.1...embed-components-v23.10.0) (2023-06-15)
21
+
22
+
23
+ ### Features
24
+
25
+ * change "Cancel" to "Close" in QuickEmbed component ([#1317](https://github.com/looker-open-source/sdk-codegen/issues/1317)) ([6eedf6f](https://github.com/looker-open-source/sdk-codegen/commit/6eedf6ffaf0e3487152bc283d925c86058cd9f59))
26
+ * minor tweaks to embed-components and embed-services ([#1315](https://github.com/looker-open-source/sdk-codegen/issues/1315)) ([f3c5fc4](https://github.com/looker-open-source/sdk-codegen/commit/f3c5fc44a6161c0aab519527a4feb68e1f826bce))
27
+
28
+
29
+ ### Dependencies
30
+
31
+ * The following workspace dependencies were updated
32
+ * dependencies
33
+ * @looker/embed-services bumped from * to 23.10.0
34
+ * @looker/sdk bumped from * to 23.10.0
35
+ * @looker/sdk-rtl bumped from * to 21.6.1
36
+ * devDependencies
37
+ * @looker/sdk-node bumped from * to 23.10.0
38
+
3
39
  ## 23.8.1 (2023-05-11)
4
40
 
5
41
 
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  interface QuickEmbedProps {
3
3
  onClose: () => void;
4
+ onCopy?: () => void;
4
5
  }
5
- export declare const QuickEmbed: ({ onClose }: QuickEmbedProps) => JSX.Element;
6
+ export declare const QuickEmbed: ({ onClose, onCopy }: QuickEmbedProps) => JSX.Element;
6
7
  export {};
@@ -13,7 +13,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
13
13
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
14
  var QuickEmbed = _ref => {
15
15
  var {
16
- onClose
16
+ onClose,
17
+ onCopy
17
18
  } = _ref;
18
19
  var service = new _embedServices.EmbedUrl();
19
20
  var [toggleValue, setToggle] = (0, _react.useState)(false);
@@ -24,6 +25,11 @@ var QuickEmbed = _ref => {
24
25
  var {
25
26
  selectThemeAction
26
27
  } = (0, _Theme.useThemeActions)();
28
+ var handleCopy = () => {
29
+ if (onCopy) {
30
+ onCopy();
31
+ }
32
+ };
27
33
  var handleToggle = () => {
28
34
  var newToggleValue = !toggleValue;
29
35
  if (newToggleValue) {
@@ -51,7 +57,7 @@ var QuickEmbed = _ref => {
51
57
  }, _react.default.createElement(_components.Heading, {
52
58
  as: "h3",
53
59
  fontWeight: "medium"
54
- }, "Get embed url"), _react.default.createElement(_components.SpaceVertical, {
60
+ }, "Get embed URL"), _react.default.createElement(_components.SpaceVertical, {
55
61
  pt: "medium",
56
62
  pb: "medium",
57
63
  gap: "xsmall"
@@ -77,13 +83,16 @@ var QuickEmbed = _ref => {
77
83
  }), "Include current params in URL"), _react.default.createElement(_components.Space, {
78
84
  mt: "large",
79
85
  between: true
86
+ }, _react.default.createElement(_components.Space, {
87
+ onClick: handleCopy,
88
+ width: "fit-content"
80
89
  }, _react.default.createElement(_components.CopyToClipboard, {
81
90
  content: embedUrl
82
91
  }, _react.default.createElement(_components.ButtonOutline, {
83
92
  iconBefore: _react.default.createElement(_materialOutlined.Link, null)
84
- }, "Copy Link")), _react.default.createElement(_components.Button, {
93
+ }, "Copy Link"))), _react.default.createElement(_components.Button, {
85
94
  onClick: onClose
86
- }, "Cancel")));
95
+ }, "Close")));
87
96
  };
88
97
  exports.QuickEmbed = QuickEmbed;
89
98
  //# sourceMappingURL=QuickEmbed.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"QuickEmbed.js","names":["_react","_interopRequireWildcard","require","_components","_materialOutlined","_embedServices","_Theme","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","QuickEmbed","_ref","onClose","service","EmbedUrl","toggleValue","setToggle","useState","embedUrl","setEmbedUrl","selectedTheme","useThemesStoreState","selectThemeAction","useThemeActions","handleToggle","newToggleValue","urlThemeName","searchParams","theme","useEffect","overrides","isThemable","name","newUrl","createElement","Section","padding","Heading","as","fontWeight","SpaceVertical","pt","pb","gap","Fragment","Span","fontSize","contentType","toLocaleLowerCase","SelectTheme","Label","htmlFor","InputText","id","iconBefore","Link","readOnly","value","Space","ToggleSwitch","onChange","on","mt","between","CopyToClipboard","content","ButtonOutline","Button","onClick","exports"],"sources":["../../src/QuickEmbed/QuickEmbed.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport React, { useEffect, useState } from 'react'\nimport {\n InputText,\n CopyToClipboard,\n Space,\n SpaceVertical,\n Button,\n Heading,\n Label,\n Span,\n Section,\n ButtonOutline,\n ToggleSwitch,\n} from '@looker/components'\nimport { Link } from '@styled-icons/material-outlined'\nimport { EmbedUrl } from '@looker/embed-services'\nimport { useThemesStoreState, SelectTheme, useThemeActions } from '../Theme'\n\ninterface QuickEmbedProps {\n onClose: () => void\n}\n\nexport const QuickEmbed = ({ onClose }: QuickEmbedProps) => {\n const service = new EmbedUrl()\n const [toggleValue, setToggle] = useState(false)\n const [embedUrl, setEmbedUrl] = useState<string>(service.embedUrl(false))\n const { selectedTheme } = useThemesStoreState()\n const { selectThemeAction } = useThemeActions()\n\n const handleToggle = () => {\n const newToggleValue = !toggleValue\n if (newToggleValue) {\n // Change the selected theme if there's a theme param in the url\n const urlThemeName = service.searchParams.theme\n if (urlThemeName) {\n selectThemeAction({ key: urlThemeName })\n }\n }\n setToggle(newToggleValue)\n }\n\n useEffect(() => {\n let overrides\n if (service.isThemable) {\n overrides = { theme: selectedTheme.name }\n }\n const newUrl = service.embedUrl(toggleValue, overrides)\n setEmbedUrl(newUrl)\n }, [toggleValue, selectedTheme])\n\n return (\n <Section padding=\"large\">\n <Heading as=\"h3\" fontWeight=\"medium\">\n Get embed url\n </Heading>\n\n <SpaceVertical pt=\"medium\" pb=\"medium\" gap=\"xsmall\">\n {service.isThemable && (\n <>\n <Span fontWeight=\"normal\" fontSize=\"xsmall\">\n Apply theme to {service.contentType.toLocaleLowerCase()} URL\n </Span>\n <SelectTheme />\n </>\n )}\n <>\n <Label htmlFor=\"embed-url\" fontWeight=\"normal\" fontSize=\"xsmall\">\n Embed URL\n </Label>\n <InputText\n id=\"embed-url\"\n iconBefore={<Link />}\n readOnly\n value={embedUrl}\n />\n </>\n </SpaceVertical>\n\n <Space gap=\"xxsmall\" fontWeight=\"normal\" fontSize=\"small\">\n <ToggleSwitch onChange={handleToggle} on={toggleValue} />\n Include current params in URL\n </Space>\n\n <Space mt=\"large\" between>\n <CopyToClipboard content={embedUrl}>\n <ButtonOutline iconBefore={<Link />}>Copy Link</ButtonOutline>\n </CopyToClipboard>\n <Button onClick={onClose}>Cancel</Button>\n </Space>\n </Section>\n )\n}\n"],"mappings":";;;;;;AA0BA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAaA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAA4E,SAAAK,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAP,wBAAAW,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAA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A,CAAAkF,aAAa;IAACZ,UAAU,EAAEzE,MAAA,CAAAc,OAAA,CAAAuC,aAAA,CAACjD,iBAAA,CAAAsE,IAAI;EAAI,GAAC,WAAS,CAAgB,CAC9C,EAClB1E,MAAA,CAAAc,OAAA,CAAAuC,aAAA,CAAClD,WAAA,CAAAmF,MAAM;IAACC,OAAO,EAAExD;EAAQ,GAAC,QAAM,CAAS,CACnC,CACA;AAEd,CAAC;AAAAyD,OAAA,CAAA3D,UAAA,GAAAA,UAAA"}
1
+ {"version":3,"file":"QuickEmbed.js","names":["_react","_interopRequireWildcard","require","_components","_materialOutlined","_embedServices","_Theme","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","QuickEmbed","_ref","onClose","onCopy","service","EmbedUrl","toggleValue","setToggle","useState","embedUrl","setEmbedUrl","selectedTheme","useThemesStoreState","selectThemeAction","useThemeActions","handleCopy","handleToggle","newToggleValue","urlThemeName","searchParams","theme","useEffect","overrides","isThemable","name","newUrl","createElement","Section","padding","Heading","as","fontWeight","SpaceVertical","pt","pb","gap","Fragment","Span","fontSize","contentType","toLocaleLowerCase","SelectTheme","Label","htmlFor","InputText","id","iconBefore","Link","readOnly","value","Space","ToggleSwitch","onChange","on","mt","between","onClick","width","CopyToClipboard","content","ButtonOutline","Button","exports"],"sources":["../../src/QuickEmbed/QuickEmbed.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport React, { useEffect, useState } from 'react'\nimport {\n InputText,\n CopyToClipboard,\n Space,\n SpaceVertical,\n Button,\n Heading,\n Label,\n Span,\n Section,\n ButtonOutline,\n ToggleSwitch,\n} from '@looker/components'\nimport { Link } from '@styled-icons/material-outlined'\nimport { EmbedUrl } from '@looker/embed-services'\nimport { useThemesStoreState, SelectTheme, useThemeActions } from '../Theme'\n\ninterface QuickEmbedProps {\n /** A function triggered when close button is clicked. */\n onClose: () => void\n /**\n * An optional callback triggered when the copy button is clicked.\n * The copy to clipboard action is already handled\n */\n onCopy?: () => void\n}\n\nexport const QuickEmbed = ({ onClose, onCopy }: QuickEmbedProps) => {\n const service = new EmbedUrl()\n const [toggleValue, setToggle] = useState(false)\n const [embedUrl, setEmbedUrl] = useState<string>(service.embedUrl(false))\n const { selectedTheme } = useThemesStoreState()\n const { selectThemeAction } = useThemeActions()\n\n const handleCopy = () => {\n if (onCopy) {\n onCopy()\n }\n }\n\n const handleToggle = () => {\n const newToggleValue = !toggleValue\n if (newToggleValue) {\n // Change the selected theme if there's a theme param in the url\n const urlThemeName = service.searchParams.theme\n if (urlThemeName) {\n selectThemeAction({ key: urlThemeName })\n }\n }\n setToggle(newToggleValue)\n }\n\n useEffect(() => {\n let overrides\n if (service.isThemable) {\n overrides = { theme: selectedTheme.name }\n }\n const newUrl = service.embedUrl(toggleValue, overrides)\n setEmbedUrl(newUrl)\n }, [toggleValue, selectedTheme])\n\n return (\n <Section padding=\"large\">\n <Heading as=\"h3\" fontWeight=\"medium\">\n Get embed URL\n </Heading>\n\n <SpaceVertical pt=\"medium\" pb=\"medium\" gap=\"xsmall\">\n {service.isThemable && (\n <>\n <Span fontWeight=\"normal\" fontSize=\"xsmall\">\n Apply theme to {service.contentType.toLocaleLowerCase()} URL\n </Span>\n <SelectTheme />\n </>\n )}\n <>\n <Label htmlFor=\"embed-url\" fontWeight=\"normal\" fontSize=\"xsmall\">\n Embed URL\n </Label>\n <InputText\n id=\"embed-url\"\n iconBefore={<Link />}\n readOnly\n value={embedUrl}\n />\n </>\n </SpaceVertical>\n\n <Space gap=\"xxsmall\" fontWeight=\"normal\" fontSize=\"small\">\n <ToggleSwitch onChange={handleToggle} on={toggleValue} />\n Include current params in URL\n </Space>\n\n <Space mt=\"large\" between>\n <Space onClick={handleCopy} width=\"fit-content\">\n <CopyToClipboard content={embedUrl}>\n <ButtonOutline iconBefore={<Link />}>Copy Link</ButtonOutline>\n </CopyToClipboard>\n </Space>\n <Button onClick={onClose}>Close</Button>\n </Space>\n </Section>\n )\n}\n"],"mappings":";;;;;;AA0BA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAaA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAA4E,SAAAK,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAP,wBAAAW,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,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AAA4E,KAAK;IAACM,OAAO,EAAEzC,UAAW;IAAC0C,KAAK,EAAC;EAAa,GAC7CtF,MAAA,CAAAc,OAAA,CAAAyC,aAAA,CAACpD,WAAA,CAAAoF,eAAe;IAACC,OAAO,EAAElD;EAAS,GACjCtC,MAAA,CAAAc,OAAA,CAAAyC,aAAA,CAACpD,WAAA,CAAAsF,aAAa;IAACd,UAAU,EAAE3E,MAAA,CAAAc,OAAA,CAAAyC,aAAA,CAACnD,iBAAA,CAAAwE,IAAI;EAAI,GAAC,WAAS,CAAgB,CAC9C,CACZ,EACR5E,MAAA,CAAAc,OAAA,CAAAyC,aAAA,CAACpD,WAAA,CAAAuF,MAAM;IAACL,OAAO,EAAEtD;EAAQ,GAAC,OAAK,CAAS,CAClC,CACA;AAEd,CAAC;AAAA4D,OAAA,CAAA9D,UAAA,GAAAA,UAAA"}
@@ -13,7 +13,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
13
13
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
14
  var QuickEmbed = _ref => {
15
15
  var {
16
- onClose
16
+ onClose,
17
+ onCopy
17
18
  } = _ref;
18
19
  var service = new _embedServices.EmbedUrl();
19
20
  var [toggleValue, setToggle] = (0, _react.useState)(false);
@@ -24,6 +25,11 @@ var QuickEmbed = _ref => {
24
25
  var {
25
26
  selectThemeAction
26
27
  } = (0, _Theme.useThemeActions)();
28
+ var handleCopy = () => {
29
+ if (onCopy) {
30
+ onCopy();
31
+ }
32
+ };
27
33
  var handleToggle = () => {
28
34
  var newToggleValue = !toggleValue;
29
35
  if (newToggleValue) {
@@ -51,7 +57,7 @@ var QuickEmbed = _ref => {
51
57
  }, _react.default.createElement(_components.Heading, {
52
58
  as: "h3",
53
59
  fontWeight: "medium"
54
- }, "Get embed url"), _react.default.createElement(_components.SpaceVertical, {
60
+ }, "Get embed URL"), _react.default.createElement(_components.SpaceVertical, {
55
61
  pt: "medium",
56
62
  pb: "medium",
57
63
  gap: "xsmall"
@@ -77,13 +83,16 @@ var QuickEmbed = _ref => {
77
83
  }), "Include current params in URL"), _react.default.createElement(_components.Space, {
78
84
  mt: "large",
79
85
  between: true
86
+ }, _react.default.createElement(_components.Space, {
87
+ onClick: handleCopy,
88
+ width: "fit-content"
80
89
  }, _react.default.createElement(_components.CopyToClipboard, {
81
90
  content: embedUrl
82
91
  }, _react.default.createElement(_components.ButtonOutline, {
83
92
  iconBefore: _react.default.createElement(_materialOutlined.Link, null)
84
- }, "Copy Link")), _react.default.createElement(_components.Button, {
93
+ }, "Copy Link"))), _react.default.createElement(_components.Button, {
85
94
  onClick: onClose
86
- }, "Cancel")));
95
+ }, "Close")));
87
96
  };
88
97
  exports.QuickEmbed = QuickEmbed;
89
98
  //# sourceMappingURL=QuickEmbed.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"QuickEmbed.js","names":["_react","_interopRequireWildcard","require","_components","_materialOutlined","_embedServices","_Theme","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","QuickEmbed","_ref","onClose","service","EmbedUrl","toggleValue","setToggle","useState","embedUrl","setEmbedUrl","selectedTheme","useThemesStoreState","selectThemeAction","useThemeActions","handleToggle","newToggleValue","urlThemeName","searchParams","theme","useEffect","overrides","isThemable","name","newUrl","createElement","Section","padding","Heading","as","fontWeight","SpaceVertical","pt","pb","gap","Fragment","Span","fontSize","contentType","toLocaleLowerCase","SelectTheme","Label","htmlFor","InputText","id","iconBefore","Link","readOnly","value","Space","ToggleSwitch","onChange","on","mt","between","CopyToClipboard","content","ButtonOutline","Button","onClick","exports"],"sources":["../../../src/QuickEmbed/QuickEmbed.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport React, { useEffect, useState } from 'react'\nimport {\n InputText,\n CopyToClipboard,\n Space,\n SpaceVertical,\n Button,\n Heading,\n Label,\n Span,\n Section,\n ButtonOutline,\n ToggleSwitch,\n} from '@looker/components'\nimport { Link } from '@styled-icons/material-outlined'\nimport { EmbedUrl } from '@looker/embed-services'\nimport { useThemesStoreState, SelectTheme, useThemeActions } from '../Theme'\n\ninterface QuickEmbedProps {\n onClose: () => void\n}\n\nexport const QuickEmbed = ({ onClose }: QuickEmbedProps) => {\n const service = new EmbedUrl()\n const [toggleValue, setToggle] = useState(false)\n const [embedUrl, setEmbedUrl] = useState<string>(service.embedUrl(false))\n const { selectedTheme } = useThemesStoreState()\n const { selectThemeAction } = useThemeActions()\n\n const handleToggle = () => {\n const newToggleValue = !toggleValue\n if (newToggleValue) {\n // Change the selected theme if there's a theme param in the url\n const urlThemeName = service.searchParams.theme\n if (urlThemeName) {\n selectThemeAction({ key: urlThemeName })\n }\n }\n setToggle(newToggleValue)\n }\n\n useEffect(() => {\n let overrides\n if (service.isThemable) {\n overrides = { theme: selectedTheme.name }\n }\n const newUrl = service.embedUrl(toggleValue, overrides)\n setEmbedUrl(newUrl)\n }, [toggleValue, selectedTheme])\n\n return (\n <Section padding=\"large\">\n <Heading as=\"h3\" fontWeight=\"medium\">\n Get embed url\n </Heading>\n\n <SpaceVertical pt=\"medium\" pb=\"medium\" gap=\"xsmall\">\n {service.isThemable && (\n <>\n <Span fontWeight=\"normal\" fontSize=\"xsmall\">\n Apply theme to {service.contentType.toLocaleLowerCase()} URL\n </Span>\n <SelectTheme />\n </>\n )}\n <>\n <Label htmlFor=\"embed-url\" fontWeight=\"normal\" fontSize=\"xsmall\">\n Embed URL\n </Label>\n <InputText\n id=\"embed-url\"\n iconBefore={<Link />}\n readOnly\n value={embedUrl}\n />\n </>\n </SpaceVertical>\n\n <Space gap=\"xxsmall\" fontWeight=\"normal\" fontSize=\"small\">\n <ToggleSwitch onChange={handleToggle} on={toggleValue} />\n Include current params in URL\n </Space>\n\n <Space mt=\"large\" between>\n <CopyToClipboard content={embedUrl}>\n <ButtonOutline iconBefore={<Link />}>Copy Link</ButtonOutline>\n </CopyToClipboard>\n <Button onClick={onClose}>Cancel</Button>\n </Space>\n </Section>\n )\n}\n"],"mappings":";;;;;;AA0BA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAaA,IAAAE,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uC,aAAA,CAAClD,WAAA,CAAA2E,YAAY;IAACC,QAAQ,EAAEpC,YAAa;IAACqC,EAAE,EAAE9C;EAAY,EAAG,iCAE3D,CAAQ,EAERlC,MAAA,CAAAc,OAAA,CAAAuC,aAAA,CAAClD,WAAA,CAAA0E,KAAK;IAACI,EAAE,EAAC,OAAO;IAACC,OAAO;EAAA,GACvBlF,MAAA,CAAAc,OAAA,CAAAuC,aAAA,CAAClD,WAAA,CAAAgF,eAAe;IAACC,OAAO,EAAE/C;EAAS,GACjCrC,MAAA,CAAAc,OAAA,CAAAuC,aAAA,CAAClD,WAAA,CAAAkF,aAAa;IAACZ,UAAU,EAAEzE,MAAA,CAAAc,OAAA,CAAAuC,aAAA,CAACjD,iBAAA,CAAAsE,IAAI;EAAI,GAAC,WAAS,CAAgB,CAC9C,EAClB1E,MAAA,CAAAc,OAAA,CAAAuC,aAAA,CAAClD,WAAA,CAAAmF,MAAM;IAACC,OAAO,EAAExD;EAAQ,GAAC,QAAM,CAAS,CACnC,CACA;AAEd,CAAC;AAAAyD,OAAA,CAAA3D,UAAA,GAAAA,UAAA"}
1
+ {"version":3,"file":"QuickEmbed.js","names":["_react","_interopRequireWildcard","require","_components","_materialOutlined","_embedServices","_Theme","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","QuickEmbed","_ref","onClose","onCopy","service","EmbedUrl","toggleValue","setToggle","useState","embedUrl","setEmbedUrl","selectedTheme","useThemesStoreState","selectThemeAction","useThemeActions","handleCopy","handleToggle","newToggleValue","urlThemeName","searchParams","theme","useEffect","overrides","isThemable","name","newUrl","createElement","Section","padding","Heading","as","fontWeight","SpaceVertical","pt","pb","gap","Fragment","Span","fontSize","contentType","toLocaleLowerCase","SelectTheme","Label","htmlFor","InputText","id","iconBefore","Link","readOnly","value","Space","ToggleSwitch","onChange","on","mt","between","onClick","width","CopyToClipboard","content","ButtonOutline","Button","exports"],"sources":["../../../src/QuickEmbed/QuickEmbed.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport React, { useEffect, useState } from 'react'\nimport {\n InputText,\n CopyToClipboard,\n Space,\n SpaceVertical,\n Button,\n Heading,\n Label,\n Span,\n Section,\n ButtonOutline,\n ToggleSwitch,\n} from '@looker/components'\nimport { Link } from '@styled-icons/material-outlined'\nimport { EmbedUrl } from '@looker/embed-services'\nimport { useThemesStoreState, SelectTheme, useThemeActions } from '../Theme'\n\ninterface QuickEmbedProps {\n /** A function triggered when close button is clicked. */\n onClose: () => void\n /**\n * An optional callback triggered when the copy button is clicked.\n * The copy to clipboard action is already handled\n */\n onCopy?: () => void\n}\n\nexport const QuickEmbed = ({ onClose, onCopy }: QuickEmbedProps) => {\n const service = new EmbedUrl()\n const [toggleValue, setToggle] = useState(false)\n const [embedUrl, setEmbedUrl] = useState<string>(service.embedUrl(false))\n const { selectedTheme } = useThemesStoreState()\n const { selectThemeAction } = useThemeActions()\n\n const handleCopy = () => {\n if (onCopy) {\n onCopy()\n }\n }\n\n const handleToggle = () => {\n const newToggleValue = !toggleValue\n if (newToggleValue) {\n // Change the selected theme if there's a theme param in the url\n const urlThemeName = service.searchParams.theme\n if (urlThemeName) {\n selectThemeAction({ key: urlThemeName })\n }\n }\n setToggle(newToggleValue)\n }\n\n useEffect(() => {\n let overrides\n if (service.isThemable) {\n overrides = { theme: selectedTheme.name }\n }\n const newUrl = service.embedUrl(toggleValue, overrides)\n setEmbedUrl(newUrl)\n }, [toggleValue, selectedTheme])\n\n return (\n <Section padding=\"large\">\n <Heading as=\"h3\" fontWeight=\"medium\">\n Get embed URL\n </Heading>\n\n <SpaceVertical pt=\"medium\" pb=\"medium\" gap=\"xsmall\">\n {service.isThemable && (\n <>\n <Span fontWeight=\"normal\" fontSize=\"xsmall\">\n Apply theme to {service.contentType.toLocaleLowerCase()} URL\n </Span>\n <SelectTheme />\n </>\n )}\n <>\n <Label htmlFor=\"embed-url\" fontWeight=\"normal\" fontSize=\"xsmall\">\n Embed URL\n </Label>\n <InputText\n id=\"embed-url\"\n iconBefore={<Link />}\n readOnly\n value={embedUrl}\n />\n </>\n </SpaceVertical>\n\n <Space gap=\"xxsmall\" fontWeight=\"normal\" fontSize=\"small\">\n <ToggleSwitch onChange={handleToggle} on={toggleValue} />\n Include current params in URL\n </Space>\n\n <Space mt=\"large\" between>\n <Space onClick={handleCopy} width=\"fit-content\">\n <CopyToClipboard content={embedUrl}>\n <ButtonOutline iconBefore={<Link />}>Copy Link</ButtonOutline>\n </CopyToClipboard>\n </Space>\n <Button onClick={onClose}>Close</Button>\n </Space>\n </Section>\n )\n}\n"],"mappings":";;;;;;AA0BA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAaA,IAAAE,iBAAA,GAAAF,OAAA;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AC,SAAS;IAACJ,UAAU,EAAC,QAAQ;IAACO,QAAQ,EAAC;EAAO,GACvDnE,MAAA,CAAAc,OAAA,CAAAyC,aAAA,CAACpD,WAAA,CAAA6E,YAAY;IAACC,QAAQ,EAAEpC,YAAa;IAACqC,EAAE,EAAE/C;EAAY,EAAG,iCAE3D,CAAQ,EAERnC,MAAA,CAAAc,OAAA,CAAAyC,aAAA,CAACpD,WAAA,CAAA4E,KAAK;IAACI,EAAE,EAAC,OAAO;IAACC,OAAO;EAAA,GACvBpF,MAAA,CAAAc,OAAA,CAAAyC,aAAA,CAACpD,WAAA,CAAA4E,KAAK;IAACM,OAAO,EAAEzC,UAAW;IAAC0C,KAAK,EAAC;EAAa,GAC7CtF,MAAA,CAAAc,OAAA,CAAAyC,aAAA,CAACpD,WAAA,CAAAoF,eAAe;IAACC,OAAO,EAAElD;EAAS,GACjCtC,MAAA,CAAAc,OAAA,CAAAyC,aAAA,CAACpD,WAAA,CAAAsF,aAAa;IAACd,UAAU,EAAE3E,MAAA,CAAAc,OAAA,CAAAyC,aAAA,CAACnD,iBAAA,CAAAwE,IAAI;EAAI,GAAC,WAAS,CAAgB,CAC9C,CACZ,EACR5E,MAAA,CAAAc,OAAA,CAAAyC,aAAA,CAACpD,WAAA,CAAAuF,MAAM;IAACL,OAAO,EAAEtD;EAAQ,GAAC,OAAK,CAAS,CAClC,CACA;AAEd,CAAC;AAAA4D,OAAA,CAAA9D,UAAA,GAAAA,UAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@looker/embed-components",
3
- "version": "23.8.1",
3
+ "version": "23.12.1-alpha.1674+b528e389",
4
4
  "description": "Looker Embed Components",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/esm/index.js",
@@ -35,7 +35,7 @@
35
35
  "homepage": "https://github.com/looker-open-source/sdk-codegen/tree/master/packages/embed-components",
36
36
  "devDependencies": {
37
37
  "@looker/components-test-utils": "^1.5.27",
38
- "@looker/sdk-node": "^23.8.1",
38
+ "@looker/sdk-node": "^23.12.1-alpha.1674+b528e389",
39
39
  "@testing-library/react": "^11.2.7",
40
40
  "@testing-library/user-event": "^14.4.3",
41
41
  "@types/react-redux": "^7.1.25",
@@ -44,9 +44,10 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@looker/components": "^4.1.3",
47
- "@looker/embed-services": "23.8.1",
47
+ "@looker/embed-services": "^23.12.1-alpha.1674+b528e389",
48
48
  "@looker/redux": "^0.0.1",
49
- "@looker/sdk": "^23.8.1",
49
+ "@looker/sdk": "^0.3.0-alpha.849+b528e389",
50
+ "@looker/sdk-rtl": "^21.6.1",
50
51
  "@reduxjs/toolkit": "^1.9.3",
51
52
  "@styled-icons/material-outlined": "^10.47.0",
52
53
  "react": "16.14.0",
@@ -59,5 +60,5 @@
59
60
  "Embed",
60
61
  "Embed Components"
61
62
  ],
62
- "gitHead": "82ff8cf5a2ef34ab98526dbeca2330fa65d8ca88"
63
+ "gitHead": "b528e3895fc4b5c7b864627fcfb9d421233f12a1"
63
64
  }