@strapi/admin 5.16.1 → 5.17.0-beta.0

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.
Files changed (33) hide show
  1. package/dist/admin/admin/src/components/Providers.js +5 -10
  2. package/dist/admin/admin/src/components/Providers.js.map +1 -1
  3. package/dist/admin/admin/src/components/Providers.mjs +5 -10
  4. package/dist/admin/admin/src/components/Providers.mjs.map +1 -1
  5. package/dist/admin/admin/src/translations/en.json.js +1 -6
  6. package/dist/admin/admin/src/translations/en.json.js.map +1 -1
  7. package/dist/admin/admin/src/translations/en.json.mjs +1 -6
  8. package/dist/admin/admin/src/translations/en.json.mjs.map +1 -1
  9. package/dist/admin/admin/src/utils/rulesEngine.js +75 -0
  10. package/dist/admin/admin/src/utils/rulesEngine.js.map +1 -0
  11. package/dist/admin/admin/src/utils/rulesEngine.mjs +72 -0
  12. package/dist/admin/admin/src/utils/rulesEngine.mjs.map +1 -0
  13. package/dist/admin/index.js +3 -2
  14. package/dist/admin/index.js.map +1 -1
  15. package/dist/admin/index.mjs +1 -1
  16. package/dist/admin/src/index.d.ts +1 -1
  17. package/dist/admin/src/utils/rulesEngine.d.ts +23 -0
  18. package/package.json +11 -9
  19. package/dist/admin/admin/src/components/UnstableGuidedTour/Context.js +0 -66
  20. package/dist/admin/admin/src/components/UnstableGuidedTour/Context.js.map +0 -1
  21. package/dist/admin/admin/src/components/UnstableGuidedTour/Context.mjs +0 -43
  22. package/dist/admin/admin/src/components/UnstableGuidedTour/Context.mjs.map +0 -1
  23. package/dist/admin/admin/src/components/UnstableGuidedTour/Step.js +0 -137
  24. package/dist/admin/admin/src/components/UnstableGuidedTour/Step.js.map +0 -1
  25. package/dist/admin/admin/src/components/UnstableGuidedTour/Step.mjs +0 -116
  26. package/dist/admin/admin/src/components/UnstableGuidedTour/Step.mjs.map +0 -1
  27. package/dist/admin/admin/src/components/UnstableGuidedTour/Tours.js +0 -116
  28. package/dist/admin/admin/src/components/UnstableGuidedTour/Tours.js.map +0 -1
  29. package/dist/admin/admin/src/components/UnstableGuidedTour/Tours.mjs +0 -94
  30. package/dist/admin/admin/src/components/UnstableGuidedTour/Tours.mjs.map +0 -1
  31. package/dist/admin/src/components/UnstableGuidedTour/Context.d.ts +0 -28
  32. package/dist/admin/src/components/UnstableGuidedTour/Step.d.ts +0 -35
  33. package/dist/admin/src/components/UnstableGuidedTour/Tours.d.ts +0 -24
@@ -1,137 +0,0 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var React = require('react');
5
- var designSystem = require('@strapi/design-system');
6
- var reactIntl = require('react-intl');
7
- var styled = require('styled-components');
8
- var Context = require('./Context.js');
9
-
10
- function _interopNamespaceDefault(e) {
11
- var n = Object.create(null);
12
- if (e) {
13
- Object.keys(e).forEach(function (k) {
14
- if (k !== 'default') {
15
- var d = Object.getOwnPropertyDescriptor(e, k);
16
- Object.defineProperty(n, k, d.get ? d : {
17
- enumerable: true,
18
- get: function () { return e[k]; }
19
- });
20
- }
21
- });
22
- }
23
- n.default = e;
24
- return Object.freeze(n);
25
- }
26
-
27
- var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
28
-
29
- const ActionsContainer = styled.styled(designSystem.Flex)`
30
- border-top: ${({ theme })=>`1px solid ${theme.colors.neutral150}`};
31
- `;
32
- const createStepComponents = (tourName)=>({
33
- Root: /*#__PURE__*/ React__namespace.forwardRef((props, ref)=>/*#__PURE__*/ jsxRuntime.jsx(designSystem.Popover.Content, {
34
- ref: ref,
35
- side: "top",
36
- align: "center",
37
- ...props,
38
- children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Flex, {
39
- width: "360px",
40
- direction: "column",
41
- alignItems: "start",
42
- children: props.children
43
- })
44
- })),
45
- Title: (props)=>{
46
- return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
47
- paddingTop: 5,
48
- paddingLeft: 5,
49
- paddingRight: 5,
50
- paddingBottom: 1,
51
- width: "100%",
52
- children: 'children' in props ? props.children : /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
53
- tag: "div",
54
- variant: "omega",
55
- fontWeight: "bold",
56
- children: /*#__PURE__*/ jsxRuntime.jsx(reactIntl.FormattedMessage, {
57
- tagName: "h1",
58
- id: props.id,
59
- defaultMessage: props.defaultMessage
60
- })
61
- })
62
- });
63
- },
64
- Content: (props)=>/*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
65
- paddingBottom: 5,
66
- paddingLeft: 5,
67
- paddingRight: 5,
68
- width: "100%",
69
- children: 'children' in props ? props.children : /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
70
- tag: "div",
71
- variant: "omega",
72
- children: /*#__PURE__*/ jsxRuntime.jsx(reactIntl.FormattedMessage, {
73
- tagName: "p",
74
- id: props.id,
75
- defaultMessage: props.defaultMessage
76
- })
77
- })
78
- }),
79
- Actions: ({ showStepCount = true, showSkip = false, ...props })=>{
80
- const dispatch = Context.unstableUseGuidedTour('GuidedTourPopover', (s)=>s.dispatch);
81
- const state = Context.unstableUseGuidedTour('GuidedTourPopover', (s)=>s.state);
82
- const currentStep = state.tours[tourName].currentStep + 1;
83
- const tourLength = state.tours[tourName].length;
84
- return /*#__PURE__*/ jsxRuntime.jsx(ActionsContainer, {
85
- width: "100%",
86
- padding: 3,
87
- paddingLeft: 5,
88
- children: 'children' in props ? props.children : /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
89
- flex: 1,
90
- justifyContent: showStepCount ? 'space-between' : 'flex-end',
91
- children: [
92
- showStepCount && /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
93
- variant: "omega",
94
- fontSize: "12px",
95
- children: /*#__PURE__*/ jsxRuntime.jsx(reactIntl.FormattedMessage, {
96
- id: "tours.stepCount",
97
- defaultMessage: "Step {currentStep} of {tourLength}",
98
- values: {
99
- currentStep,
100
- tourLength
101
- }
102
- })
103
- }),
104
- /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
105
- gap: 2,
106
- children: [
107
- showSkip && /*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
108
- variant: "tertiary",
109
- onClick: ()=>dispatch({
110
- type: 'skip_tour',
111
- payload: tourName
112
- }),
113
- children: /*#__PURE__*/ jsxRuntime.jsx(reactIntl.FormattedMessage, {
114
- id: "tours.skip",
115
- defaultMessage: "Skip"
116
- })
117
- }),
118
- /*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
119
- onClick: ()=>dispatch({
120
- type: 'next_step',
121
- payload: tourName
122
- }),
123
- children: /*#__PURE__*/ jsxRuntime.jsx(reactIntl.FormattedMessage, {
124
- id: "tours.next",
125
- defaultMessage: "Next"
126
- })
127
- })
128
- ]
129
- })
130
- ]
131
- })
132
- });
133
- }
134
- });
135
-
136
- exports.createStepComponents = createStepComponents;
137
- //# sourceMappingURL=Step.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Step.js","sources":["../../../../../../admin/src/components/UnstableGuidedTour/Step.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Popover, Box, Flex, Button, Typography } from '@strapi/design-system';\nimport { FormattedMessage, type MessageDescriptor } from 'react-intl';\nimport { styled } from 'styled-components';\n\nimport { unstableUseGuidedTour, ValidTourName } from './Context';\n\n/* -------------------------------------------------------------------------------------------------\n * Step factory\n * -----------------------------------------------------------------------------------------------*/\n\ntype WithChildren = {\n children: React.ReactNode;\n id?: never;\n defaultMessage?: never;\n};\n\ntype WithIntl = {\n children?: undefined;\n id: MessageDescriptor['id'];\n defaultMessage: MessageDescriptor['defaultMessage'];\n};\n\ntype WithActionsChildren = {\n children: React.ReactNode;\n showStepCount?: boolean;\n showSkip?: boolean;\n};\n\ntype WithActionsProps = {\n children?: undefined;\n showStepCount?: boolean;\n showSkip?: boolean;\n};\n\ntype StepProps = WithChildren | WithIntl;\ntype ActionsProps = WithActionsChildren | WithActionsProps;\n\ntype Step = {\n Root: React.ForwardRefExoticComponent<React.ComponentProps<typeof Popover.Content>>;\n Title: (props: StepProps) => React.ReactNode;\n Content: (props: StepProps) => React.ReactNode;\n Actions: (props: ActionsProps) => React.ReactNode;\n};\n\nconst ActionsContainer = styled(Flex)`\n border-top: ${({ theme }) => `1px solid ${theme.colors.neutral150}`};\n`;\n\nconst createStepComponents = (tourName: ValidTourName): Step => ({\n Root: React.forwardRef((props, ref) => (\n <Popover.Content ref={ref} side=\"top\" align=\"center\" {...props}>\n <Flex width=\"360px\" direction=\"column\" alignItems=\"start\">\n {props.children}\n </Flex>\n </Popover.Content>\n )),\n\n Title: (props) => {\n return (\n <Box paddingTop={5} paddingLeft={5} paddingRight={5} paddingBottom={1} width=\"100%\">\n {'children' in props ? (\n props.children\n ) : (\n <Typography tag=\"div\" variant=\"omega\" fontWeight=\"bold\">\n <FormattedMessage tagName=\"h1\" id={props.id} defaultMessage={props.defaultMessage} />\n </Typography>\n )}\n </Box>\n );\n },\n\n Content: (props) => (\n <Box paddingBottom={5} paddingLeft={5} paddingRight={5} width=\"100%\">\n {'children' in props ? (\n props.children\n ) : (\n <Typography tag=\"div\" variant=\"omega\">\n <FormattedMessage tagName=\"p\" id={props.id} defaultMessage={props.defaultMessage} />\n </Typography>\n )}\n </Box>\n ),\n\n Actions: ({ showStepCount = true, showSkip = false, ...props }) => {\n const dispatch = unstableUseGuidedTour('GuidedTourPopover', (s) => s.dispatch);\n const state = unstableUseGuidedTour('GuidedTourPopover', (s) => s.state);\n const currentStep = state.tours[tourName].currentStep + 1;\n const tourLength = state.tours[tourName].length;\n\n return (\n <ActionsContainer width=\"100%\" padding={3} paddingLeft={5}>\n {'children' in props ? (\n props.children\n ) : (\n <Flex flex={1} justifyContent={showStepCount ? 'space-between' : 'flex-end'}>\n {showStepCount && (\n <Typography variant=\"omega\" fontSize=\"12px\">\n <FormattedMessage\n id=\"tours.stepCount\"\n defaultMessage=\"Step {currentStep} of {tourLength}\"\n values={{ currentStep, tourLength }}\n />\n </Typography>\n )}\n <Flex gap={2}>\n {showSkip && (\n <Button\n variant=\"tertiary\"\n onClick={() => dispatch({ type: 'skip_tour', payload: tourName })}\n >\n <FormattedMessage id=\"tours.skip\" defaultMessage=\"Skip\" />\n </Button>\n )}\n <Button onClick={() => dispatch({ type: 'next_step', payload: tourName })}>\n <FormattedMessage id=\"tours.next\" defaultMessage=\"Next\" />\n </Button>\n </Flex>\n </Flex>\n )}\n </ActionsContainer>\n );\n },\n});\n\nexport type { Step };\nexport { createStepComponents };\n"],"names":["ActionsContainer","styled","Flex","theme","colors","neutral150","createStepComponents","tourName","Root","React","forwardRef","props","ref","_jsx","Popover","Content","side","align","width","direction","alignItems","children","Title","Box","paddingTop","paddingLeft","paddingRight","paddingBottom","Typography","tag","variant","fontWeight","FormattedMessage","tagName","id","defaultMessage","Actions","showStepCount","showSkip","dispatch","unstableUseGuidedTour","s","state","currentStep","tours","tourLength","length","padding","_jsxs","flex","justifyContent","fontSize","values","gap","Button","onClick","type","payload"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CA,MAAMA,gBAAAA,GAAmBC,aAAOC,CAAAA,iBAAAA,CAAK;AACvB,cAAA,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAK,CAAC,UAAU,EAAEA,KAAAA,CAAMC,MAAM,CAACC,UAAU,CAAC,CAAC,CAAC;AACtE,CAAC;AAEKC,MAAAA,oBAAAA,GAAuB,CAACC,QAAAA,IAAmC;QAC/DC,IAAMC,gBAAAA,gBAAAA,CAAMC,UAAU,CAAC,CAACC,OAAOC,GAC7B,iBAAAC,cAAA,CAACC,qBAAQC,OAAO,EAAA;gBAACH,GAAKA,EAAAA,GAAAA;gBAAKI,IAAK,EAAA,KAAA;gBAAMC,KAAM,EAAA,QAAA;AAAU,gBAAA,GAAGN,KAAK;AAC5D,gBAAA,QAAA,gBAAAE,cAACX,CAAAA,iBAAAA,EAAAA;oBAAKgB,KAAM,EAAA,OAAA;oBAAQC,SAAU,EAAA,QAAA;oBAASC,UAAW,EAAA,OAAA;AAC/CT,oBAAAA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,CAAA;4CAAEiB,IAAM,EAAA,WAAA;4CAAaC,OAASlD,EAAAA;AAAS,yCAAA,CAAA;AAE/D,oCAAA,QAAA,gBAAAM,cAACmB,CAAAA,0BAAAA,EAAAA;wCAAiBE,EAAG,EAAA,YAAA;wCAAaC,cAAe,EAAA;;;8CAGrDtB,cAACyC,CAAAA,mBAAAA,EAAAA;AAAOC,oCAAAA,OAAAA,EAAS,IAAMhB,QAAS,CAAA;4CAAEiB,IAAM,EAAA,WAAA;4CAAaC,OAASlD,EAAAA;AAAS,yCAAA,CAAA;AACrE,oCAAA,QAAA,gBAAAM,cAACmB,CAAAA,0BAAAA,EAAAA;wCAAiBE,EAAG,EAAA,YAAA;wCAAaC,cAAe,EAAA;;;;;;;;AAO/D;KACF;;;;"}
@@ -1,116 +0,0 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import * as React from 'react';
3
- import { Flex, Popover, Box, Typography, Button } from '@strapi/design-system';
4
- import { FormattedMessage } from 'react-intl';
5
- import { styled } from 'styled-components';
6
- import { unstableUseGuidedTour } from './Context.mjs';
7
-
8
- const ActionsContainer = styled(Flex)`
9
- border-top: ${({ theme })=>`1px solid ${theme.colors.neutral150}`};
10
- `;
11
- const createStepComponents = (tourName)=>({
12
- Root: /*#__PURE__*/ React.forwardRef((props, ref)=>/*#__PURE__*/ jsx(Popover.Content, {
13
- ref: ref,
14
- side: "top",
15
- align: "center",
16
- ...props,
17
- children: /*#__PURE__*/ jsx(Flex, {
18
- width: "360px",
19
- direction: "column",
20
- alignItems: "start",
21
- children: props.children
22
- })
23
- })),
24
- Title: (props)=>{
25
- return /*#__PURE__*/ jsx(Box, {
26
- paddingTop: 5,
27
- paddingLeft: 5,
28
- paddingRight: 5,
29
- paddingBottom: 1,
30
- width: "100%",
31
- children: 'children' in props ? props.children : /*#__PURE__*/ jsx(Typography, {
32
- tag: "div",
33
- variant: "omega",
34
- fontWeight: "bold",
35
- children: /*#__PURE__*/ jsx(FormattedMessage, {
36
- tagName: "h1",
37
- id: props.id,
38
- defaultMessage: props.defaultMessage
39
- })
40
- })
41
- });
42
- },
43
- Content: (props)=>/*#__PURE__*/ jsx(Box, {
44
- paddingBottom: 5,
45
- paddingLeft: 5,
46
- paddingRight: 5,
47
- width: "100%",
48
- children: 'children' in props ? props.children : /*#__PURE__*/ jsx(Typography, {
49
- tag: "div",
50
- variant: "omega",
51
- children: /*#__PURE__*/ jsx(FormattedMessage, {
52
- tagName: "p",
53
- id: props.id,
54
- defaultMessage: props.defaultMessage
55
- })
56
- })
57
- }),
58
- Actions: ({ showStepCount = true, showSkip = false, ...props })=>{
59
- const dispatch = unstableUseGuidedTour('GuidedTourPopover', (s)=>s.dispatch);
60
- const state = unstableUseGuidedTour('GuidedTourPopover', (s)=>s.state);
61
- const currentStep = state.tours[tourName].currentStep + 1;
62
- const tourLength = state.tours[tourName].length;
63
- return /*#__PURE__*/ jsx(ActionsContainer, {
64
- width: "100%",
65
- padding: 3,
66
- paddingLeft: 5,
67
- children: 'children' in props ? props.children : /*#__PURE__*/ jsxs(Flex, {
68
- flex: 1,
69
- justifyContent: showStepCount ? 'space-between' : 'flex-end',
70
- children: [
71
- showStepCount && /*#__PURE__*/ jsx(Typography, {
72
- variant: "omega",
73
- fontSize: "12px",
74
- children: /*#__PURE__*/ jsx(FormattedMessage, {
75
- id: "tours.stepCount",
76
- defaultMessage: "Step {currentStep} of {tourLength}",
77
- values: {
78
- currentStep,
79
- tourLength
80
- }
81
- })
82
- }),
83
- /*#__PURE__*/ jsxs(Flex, {
84
- gap: 2,
85
- children: [
86
- showSkip && /*#__PURE__*/ jsx(Button, {
87
- variant: "tertiary",
88
- onClick: ()=>dispatch({
89
- type: 'skip_tour',
90
- payload: tourName
91
- }),
92
- children: /*#__PURE__*/ jsx(FormattedMessage, {
93
- id: "tours.skip",
94
- defaultMessage: "Skip"
95
- })
96
- }),
97
- /*#__PURE__*/ jsx(Button, {
98
- onClick: ()=>dispatch({
99
- type: 'next_step',
100
- payload: tourName
101
- }),
102
- children: /*#__PURE__*/ jsx(FormattedMessage, {
103
- id: "tours.next",
104
- defaultMessage: "Next"
105
- })
106
- })
107
- ]
108
- })
109
- ]
110
- })
111
- });
112
- }
113
- });
114
-
115
- export { createStepComponents };
116
- //# sourceMappingURL=Step.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Step.mjs","sources":["../../../../../../admin/src/components/UnstableGuidedTour/Step.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Popover, Box, Flex, Button, Typography } from '@strapi/design-system';\nimport { FormattedMessage, type MessageDescriptor } from 'react-intl';\nimport { styled } from 'styled-components';\n\nimport { unstableUseGuidedTour, ValidTourName } from './Context';\n\n/* -------------------------------------------------------------------------------------------------\n * Step factory\n * -----------------------------------------------------------------------------------------------*/\n\ntype WithChildren = {\n children: React.ReactNode;\n id?: never;\n defaultMessage?: never;\n};\n\ntype WithIntl = {\n children?: undefined;\n id: MessageDescriptor['id'];\n defaultMessage: MessageDescriptor['defaultMessage'];\n};\n\ntype WithActionsChildren = {\n children: React.ReactNode;\n showStepCount?: boolean;\n showSkip?: boolean;\n};\n\ntype WithActionsProps = {\n children?: undefined;\n showStepCount?: boolean;\n showSkip?: boolean;\n};\n\ntype StepProps = WithChildren | WithIntl;\ntype ActionsProps = WithActionsChildren | WithActionsProps;\n\ntype Step = {\n Root: React.ForwardRefExoticComponent<React.ComponentProps<typeof Popover.Content>>;\n Title: (props: StepProps) => React.ReactNode;\n Content: (props: StepProps) => React.ReactNode;\n Actions: (props: ActionsProps) => React.ReactNode;\n};\n\nconst ActionsContainer = styled(Flex)`\n border-top: ${({ theme }) => `1px solid ${theme.colors.neutral150}`};\n`;\n\nconst createStepComponents = (tourName: ValidTourName): Step => ({\n Root: React.forwardRef((props, ref) => (\n <Popover.Content ref={ref} side=\"top\" align=\"center\" {...props}>\n <Flex width=\"360px\" direction=\"column\" alignItems=\"start\">\n {props.children}\n </Flex>\n </Popover.Content>\n )),\n\n Title: (props) => {\n return (\n <Box paddingTop={5} paddingLeft={5} paddingRight={5} paddingBottom={1} width=\"100%\">\n {'children' in props ? (\n props.children\n ) : (\n <Typography tag=\"div\" variant=\"omega\" fontWeight=\"bold\">\n <FormattedMessage tagName=\"h1\" id={props.id} defaultMessage={props.defaultMessage} />\n </Typography>\n )}\n </Box>\n );\n },\n\n Content: (props) => (\n <Box paddingBottom={5} paddingLeft={5} paddingRight={5} width=\"100%\">\n {'children' in props ? (\n props.children\n ) : (\n <Typography tag=\"div\" variant=\"omega\">\n <FormattedMessage tagName=\"p\" id={props.id} defaultMessage={props.defaultMessage} />\n </Typography>\n )}\n </Box>\n ),\n\n Actions: ({ showStepCount = true, showSkip = false, ...props }) => {\n const dispatch = unstableUseGuidedTour('GuidedTourPopover', (s) => s.dispatch);\n const state = unstableUseGuidedTour('GuidedTourPopover', (s) => s.state);\n const currentStep = state.tours[tourName].currentStep + 1;\n const tourLength = state.tours[tourName].length;\n\n return (\n <ActionsContainer width=\"100%\" padding={3} paddingLeft={5}>\n {'children' in props ? (\n props.children\n ) : (\n <Flex flex={1} justifyContent={showStepCount ? 'space-between' : 'flex-end'}>\n {showStepCount && (\n <Typography variant=\"omega\" fontSize=\"12px\">\n <FormattedMessage\n id=\"tours.stepCount\"\n defaultMessage=\"Step {currentStep} of {tourLength}\"\n values={{ currentStep, tourLength }}\n />\n </Typography>\n )}\n <Flex gap={2}>\n {showSkip && (\n <Button\n variant=\"tertiary\"\n onClick={() => dispatch({ type: 'skip_tour', payload: tourName })}\n >\n <FormattedMessage id=\"tours.skip\" defaultMessage=\"Skip\" />\n </Button>\n )}\n <Button onClick={() => dispatch({ type: 'next_step', payload: tourName })}>\n <FormattedMessage id=\"tours.next\" defaultMessage=\"Next\" />\n </Button>\n </Flex>\n </Flex>\n )}\n </ActionsContainer>\n );\n },\n});\n\nexport type { Step };\nexport { createStepComponents };\n"],"names":["ActionsContainer","styled","Flex","theme","colors","neutral150","createStepComponents","tourName","Root","React","forwardRef","props","ref","_jsx","Popover","Content","side","align","width","direction","alignItems","children","Title","Box","paddingTop","paddingLeft","paddingRight","paddingBottom","Typography","tag","variant","fontWeight","FormattedMessage","tagName","id","defaultMessage","Actions","showStepCount","showSkip","dispatch","unstableUseGuidedTour","s","state","currentStep","tours","tourLength","length","padding","_jsxs","flex","justifyContent","fontSize","values","gap","Button","onClick","type","payload"],"mappings":";;;;;;;AA8CA,MAAMA,gBAAAA,GAAmBC,MAAOC,CAAAA,IAAAA,CAAK;AACvB,cAAA,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAK,CAAC,UAAU,EAAEA,KAAAA,CAAMC,MAAM,CAACC,UAAU,CAAC,CAAC,CAAC;AACtE,CAAC;AAEKC,MAAAA,oBAAAA,GAAuB,CAACC,QAAAA,IAAmC;QAC/DC,IAAMC,gBAAAA,KAAAA,CAAMC,UAAU,CAAC,CAACC,OAAOC,GAC7B,iBAAAC,GAAA,CAACC,QAAQC,OAAO,EAAA;gBAACH,GAAKA,EAAAA,GAAAA;gBAAKI,IAAK,EAAA,KAAA;gBAAMC,KAAM,EAAA,QAAA;AAAU,gBAAA,GAAGN,KAAK;AAC5D,gBAAA,QAAA,gBAAAE,GAACX,CAAAA,IAAAA,EAAAA;oBAAKgB,KAAM,EAAA,OAAA;oBAAQC,SAAU,EAAA,QAAA;oBAASC,UAAW,EAAA,OAAA;AAC/CT,oBAAAA,QAAAA,EAAAA,KAAAA,CAAMU;;;AAKbC,QAAAA,KAAAA,EAAO,CAACX,KAAAA,GAAAA;AACN,YAAA,qBACEE,GAACU,CAAAA,GAAAA,EAAAA;gBAAIC,UAAY,EAAA,CAAA;gBAAGC,WAAa,EAAA,CAAA;gBAAGC,YAAc,EAAA,CAAA;gBAAGC,aAAe,EAAA,CAAA;gBAAGT,KAAM,EAAA,MAAA;AAC1E,gBAAA,QAAA,EAAA,UAAA,IAAcP,KACbA,GAAAA,KAAAA,CAAMU,QAAQ,iBAEdR,GAACe,CAAAA,UAAAA,EAAAA;oBAAWC,GAAI,EAA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AAAA;wCAAiBE,EAAG,EAAA,YAAA;wCAAaC,cAAe,EAAA;;;;;;;;AAO/D;KACF;;;;"}
@@ -1,116 +0,0 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var React = require('react');
5
- var designSystem = require('@strapi/design-system');
6
- var styled = require('styled-components');
7
- var Context = require('./Context.js');
8
- var Step = require('./Step.js');
9
-
10
- function _interopNamespaceDefault(e) {
11
- var n = Object.create(null);
12
- if (e) {
13
- Object.keys(e).forEach(function (k) {
14
- if (k !== 'default') {
15
- var d = Object.getOwnPropertyDescriptor(e, k);
16
- Object.defineProperty(n, k, d.get ? d : {
17
- enumerable: true,
18
- get: function () { return e[k]; }
19
- });
20
- }
21
- });
22
- }
23
- n.default = e;
24
- return Object.freeze(n);
25
- }
26
-
27
- var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
28
-
29
- /* -------------------------------------------------------------------------------------------------
30
- * Tours
31
- * -----------------------------------------------------------------------------------------------*/ const tours = {
32
- contentManager: createTour('contentManager', [
33
- {
34
- name: 'Introduction',
35
- content: (Step)=>/*#__PURE__*/ jsxRuntime.jsxs(Step.Root, {
36
- sideOffset: -36,
37
- children: [
38
- /*#__PURE__*/ jsxRuntime.jsx(Step.Title, {
39
- id: "tours.contentManager.Introduction.title",
40
- defaultMessage: "Content manager"
41
- }),
42
- /*#__PURE__*/ jsxRuntime.jsx(Step.Content, {
43
- id: "tours.contentManager.Introduction.content",
44
- defaultMessage: "Create and manage content from your collection types and single types."
45
- }),
46
- /*#__PURE__*/ jsxRuntime.jsx(Step.Actions, {
47
- showSkip: true
48
- })
49
- ]
50
- })
51
- }
52
- ])
53
- };
54
- const GuidedTourOverlay = styled.styled(designSystem.Box)`
55
- position: fixed;
56
- inset: 0;
57
- background-color: rgba(50, 50, 77, 0.2);
58
- z-index: 10;
59
- pointer-events: none;
60
- `;
61
- const UnstableGuidedTourTooltip = ({ children, content, tourName, step })=>{
62
- const state = Context.unstableUseGuidedTour('UnstableGuidedTourTooltip', (s)=>s.state);
63
- const dispatch = Context.unstableUseGuidedTour('UnstableGuidedTourTooltip', (s)=>s.dispatch);
64
- const Step$1 = React__namespace.useMemo(()=>Step.createStepComponents(tourName), [
65
- tourName
66
- ]);
67
- const isCurrentStep = state.tours[tourName].currentStep === step;
68
- const isPopoverOpen = isCurrentStep && !state.tours[tourName].isCompleted;
69
- // Lock the scroll
70
- React__namespace.useEffect(()=>{
71
- if (!isPopoverOpen) return;
72
- const originalStyle = window.getComputedStyle(document.body).overflow;
73
- document.body.style.overflow = 'hidden';
74
- return ()=>{
75
- document.body.style.overflow = originalStyle;
76
- };
77
- }, [
78
- isPopoverOpen
79
- ]);
80
- return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
81
- children: [
82
- isPopoverOpen && /*#__PURE__*/ jsxRuntime.jsx(GuidedTourOverlay, {}),
83
- /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Popover.Root, {
84
- open: isPopoverOpen,
85
- children: [
86
- /*#__PURE__*/ jsxRuntime.jsx(designSystem.Popover.Anchor, {
87
- children: children
88
- }),
89
- content(Step$1, {
90
- state,
91
- dispatch
92
- })
93
- ]
94
- })
95
- ]
96
- });
97
- };
98
- function createTour(tourName, steps) {
99
- const tour = steps.reduce((acc, step, index)=>{
100
- if (step.name in acc) {
101
- throw Error(`The tour: ${tourName} with step: ${step.name} has already been registered`);
102
- }
103
- acc[step.name] = ({ children })=>/*#__PURE__*/ jsxRuntime.jsx(UnstableGuidedTourTooltip, {
104
- tourName: tourName,
105
- step: index,
106
- content: step.content,
107
- children: children
108
- });
109
- return acc;
110
- }, {});
111
- return tour;
112
- }
113
-
114
- exports.GuidedTourOverlay = GuidedTourOverlay;
115
- exports.tours = tours;
116
- //# sourceMappingURL=Tours.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Tours.js","sources":["../../../../../../admin/src/components/UnstableGuidedTour/Tours.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Box, Popover } from '@strapi/design-system';\nimport { styled } from 'styled-components';\n\nimport { useAuth } from '../../features/Auth';\n\nimport { type State, type Action, unstableUseGuidedTour, ValidTourName } from './Context';\nimport { Step, createStepComponents } from './Step';\n\n/* -------------------------------------------------------------------------------------------------\n * Tours\n * -----------------------------------------------------------------------------------------------*/\n\nconst tours = {\n contentManager: createTour('contentManager', [\n {\n name: 'Introduction',\n content: (Step) => (\n <Step.Root sideOffset={-36}>\n <Step.Title\n id=\"tours.contentManager.Introduction.title\"\n defaultMessage=\"Content manager\"\n />\n <Step.Content\n id=\"tours.contentManager.Introduction.content\"\n defaultMessage=\"Create and manage content from your collection types and single types.\"\n />\n <Step.Actions showSkip />\n </Step.Root>\n ),\n },\n ]),\n} as const;\n\ntype Tours = typeof tours;\n\n/* -------------------------------------------------------------------------------------------------\n * GuidedTourTooltip\n * -----------------------------------------------------------------------------------------------*/\n\ntype Content = (\n Step: Step,\n {\n state,\n dispatch,\n }: {\n state: State;\n dispatch: React.Dispatch<Action>;\n }\n) => React.ReactNode;\n\nexport const GuidedTourOverlay = styled(Box)`\n position: fixed;\n inset: 0;\n background-color: rgba(50, 50, 77, 0.2);\n z-index: 10;\n pointer-events: none;\n`;\n\nconst UnstableGuidedTourTooltip = ({\n children,\n content,\n tourName,\n step,\n}: {\n children: React.ReactNode;\n content: Content;\n tourName: ValidTourName;\n step: number;\n}) => {\n const state = unstableUseGuidedTour('UnstableGuidedTourTooltip', (s) => s.state);\n const dispatch = unstableUseGuidedTour('UnstableGuidedTourTooltip', (s) => s.dispatch);\n const Step = React.useMemo(() => createStepComponents(tourName), [tourName]);\n\n const isCurrentStep = state.tours[tourName].currentStep === step;\n const isPopoverOpen = isCurrentStep && !state.tours[tourName].isCompleted;\n\n // Lock the scroll\n React.useEffect(() => {\n if (!isPopoverOpen) return;\n\n const originalStyle = window.getComputedStyle(document.body).overflow;\n document.body.style.overflow = 'hidden';\n\n return () => {\n document.body.style.overflow = originalStyle;\n };\n }, [isPopoverOpen]);\n\n return (\n <>\n {isPopoverOpen && <GuidedTourOverlay />}\n <Popover.Root open={isPopoverOpen}>\n <Popover.Anchor>{children}</Popover.Anchor>\n {content(Step, { state, dispatch })}\n </Popover.Root>\n </>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Tour factory\n * -----------------------------------------------------------------------------------------------*/\n\ntype TourStep<P extends string> = {\n name: P;\n content: Content;\n};\n\nfunction createTour<const T extends ReadonlyArray<TourStep<string>>>(tourName: string, steps: T) {\n type Components = {\n [K in T[number]['name']]: React.ComponentType<{ children: React.ReactNode }>;\n };\n\n const tour = steps.reduce((acc, step, index) => {\n if (step.name in acc) {\n throw Error(`The tour: ${tourName} with step: ${step.name} has already been registered`);\n }\n\n acc[step.name as keyof Components] = ({ children }: { children: React.ReactNode }) => (\n <UnstableGuidedTourTooltip\n tourName={tourName as ValidTourName}\n step={index}\n content={step.content}\n >\n {children}\n </UnstableGuidedTourTooltip>\n );\n\n return acc;\n }, {} as Components);\n\n return tour;\n}\n\nexport type { Content, Tours };\nexport { tours };\n"],"names":["tours","contentManager","createTour","name","content","Step","_jsxs","Root","sideOffset","_jsx","Title","id","defaultMessage","Content","Actions","showSkip","GuidedTourOverlay","styled","Box","UnstableGuidedTourTooltip","children","tourName","step","state","unstableUseGuidedTour","s","dispatch","React","useMemo","createStepComponents","isCurrentStep","currentStep","isPopoverOpen","isCompleted","useEffect","originalStyle","window","getComputedStyle","document","body","overflow","style","_Fragment","Popover","open","Anchor","steps","tour","reduce","acc","index","Error"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA;;AAEkG,2GAE5FA,KAAQ,GAAA;AACZC,IAAAA,cAAAA,EAAgBC,WAAW,gBAAkB,EAAA;AAC3C,QAAA;YACEC,IAAM,EAAA,cAAA;AACNC,YAAAA,OAAAA,EAAS,CAACC,IAAAA,iBACRC,eAACD,CAAAA,IAAAA,CAAKE,IAAI,EAAA;AAACC,oBAAAA,UAAAA,EAAY,CAAC,EAAA;;AAC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1
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import * as React from 'react';
3
- import { Box, Popover } from '@strapi/design-system';
4
- import { styled } from 'styled-components';
5
- import { unstableUseGuidedTour } from './Context.mjs';
6
- import { createStepComponents } from './Step.mjs';
7
-
8
- /* -------------------------------------------------------------------------------------------------
9
- * Tours
10
- * -----------------------------------------------------------------------------------------------*/ const tours = {
11
- contentManager: createTour('contentManager', [
12
- {
13
- name: 'Introduction',
14
- content: (Step)=>/*#__PURE__*/ jsxs(Step.Root, {
15
- sideOffset: -36,
16
- children: [
17
- /*#__PURE__*/ jsx(Step.Title, {
18
- id: "tours.contentManager.Introduction.title",
19
- defaultMessage: "Content manager"
20
- }),
21
- /*#__PURE__*/ jsx(Step.Content, {
22
- id: "tours.contentManager.Introduction.content",
23
- defaultMessage: "Create and manage content from your collection types and single types."
24
- }),
25
- /*#__PURE__*/ jsx(Step.Actions, {
26
- showSkip: true
27
- })
28
- ]
29
- })
30
- }
31
- ])
32
- };
33
- const GuidedTourOverlay = styled(Box)`
34
- position: fixed;
35
- inset: 0;
36
- background-color: rgba(50, 50, 77, 0.2);
37
- z-index: 10;
38
- pointer-events: none;
39
- `;
40
- const UnstableGuidedTourTooltip = ({ children, content, tourName, step })=>{
41
- const state = unstableUseGuidedTour('UnstableGuidedTourTooltip', (s)=>s.state);
42
- const dispatch = unstableUseGuidedTour('UnstableGuidedTourTooltip', (s)=>s.dispatch);
43
- const Step = React.useMemo(()=>createStepComponents(tourName), [
44
- tourName
45
- ]);
46
- const isCurrentStep = state.tours[tourName].currentStep === step;
47
- const isPopoverOpen = isCurrentStep && !state.tours[tourName].isCompleted;
48
- // Lock the scroll
49
- React.useEffect(()=>{
50
- if (!isPopoverOpen) return;
51
- const originalStyle = window.getComputedStyle(document.body).overflow;
52
- document.body.style.overflow = 'hidden';
53
- return ()=>{
54
- document.body.style.overflow = originalStyle;
55
- };
56
- }, [
57
- isPopoverOpen
58
- ]);
59
- return /*#__PURE__*/ jsxs(Fragment, {
60
- children: [
61
- isPopoverOpen && /*#__PURE__*/ jsx(GuidedTourOverlay, {}),
62
- /*#__PURE__*/ jsxs(Popover.Root, {
63
- open: isPopoverOpen,
64
- children: [
65
- /*#__PURE__*/ jsx(Popover.Anchor, {
66
- children: children
67
- }),
68
- content(Step, {
69
- state,
70
- dispatch
71
- })
72
- ]
73
- })
74
- ]
75
- });
76
- };
77
- function createTour(tourName, steps) {
78
- const tour = steps.reduce((acc, step, index)=>{
79
- if (step.name in acc) {
80
- throw Error(`The tour: ${tourName} with step: ${step.name} has already been registered`);
81
- }
82
- acc[step.name] = ({ children })=>/*#__PURE__*/ jsx(UnstableGuidedTourTooltip, {
83
- tourName: tourName,
84
- step: index,
85
- content: step.content,
86
- children: children
87
- });
88
- return acc;
89
- }, {});
90
- return tour;
91
- }
92
-
93
- export { GuidedTourOverlay, tours };
94
- //# sourceMappingURL=Tours.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Tours.mjs","sources":["../../../../../../admin/src/components/UnstableGuidedTour/Tours.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Box, Popover } from '@strapi/design-system';\nimport { styled } from 'styled-components';\n\nimport { useAuth } from '../../features/Auth';\n\nimport { type State, type Action, unstableUseGuidedTour, ValidTourName } from './Context';\nimport { Step, createStepComponents } from './Step';\n\n/* -------------------------------------------------------------------------------------------------\n * Tours\n * -----------------------------------------------------------------------------------------------*/\n\nconst tours = {\n contentManager: createTour('contentManager', [\n {\n name: 'Introduction',\n content: (Step) => (\n <Step.Root sideOffset={-36}>\n <Step.Title\n id=\"tours.contentManager.Introduction.title\"\n defaultMessage=\"Content manager\"\n />\n <Step.Content\n id=\"tours.contentManager.Introduction.content\"\n defaultMessage=\"Create and manage content from your collection types and single types.\"\n />\n <Step.Actions showSkip />\n </Step.Root>\n ),\n },\n ]),\n} as const;\n\ntype Tours = typeof tours;\n\n/* -------------------------------------------------------------------------------------------------\n * GuidedTourTooltip\n * -----------------------------------------------------------------------------------------------*/\n\ntype Content = (\n Step: Step,\n {\n state,\n dispatch,\n }: {\n state: State;\n dispatch: React.Dispatch<Action>;\n }\n) => React.ReactNode;\n\nexport const GuidedTourOverlay = styled(Box)`\n position: fixed;\n inset: 0;\n background-color: rgba(50, 50, 77, 0.2);\n z-index: 10;\n pointer-events: none;\n`;\n\nconst UnstableGuidedTourTooltip = ({\n children,\n content,\n tourName,\n step,\n}: {\n children: React.ReactNode;\n content: Content;\n tourName: ValidTourName;\n step: number;\n}) => {\n const state = unstableUseGuidedTour('UnstableGuidedTourTooltip', (s) => s.state);\n const dispatch = unstableUseGuidedTour('UnstableGuidedTourTooltip', (s) => s.dispatch);\n const Step = React.useMemo(() => createStepComponents(tourName), [tourName]);\n\n const isCurrentStep = state.tours[tourName].currentStep === step;\n const isPopoverOpen = isCurrentStep && !state.tours[tourName].isCompleted;\n\n // Lock the scroll\n React.useEffect(() => {\n if (!isPopoverOpen) return;\n\n const originalStyle = window.getComputedStyle(document.body).overflow;\n document.body.style.overflow = 'hidden';\n\n return () => {\n document.body.style.overflow = originalStyle;\n };\n }, [isPopoverOpen]);\n\n return (\n <>\n {isPopoverOpen && <GuidedTourOverlay />}\n <Popover.Root open={isPopoverOpen}>\n <Popover.Anchor>{children}</Popover.Anchor>\n {content(Step, { state, dispatch })}\n </Popover.Root>\n </>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Tour factory\n * -----------------------------------------------------------------------------------------------*/\n\ntype TourStep<P extends string> = {\n name: P;\n content: Content;\n};\n\nfunction createTour<const T extends ReadonlyArray<TourStep<string>>>(tourName: string, steps: T) {\n type Components = {\n [K in T[number]['name']]: React.ComponentType<{ children: React.ReactNode }>;\n };\n\n const tour = steps.reduce((acc, step, index) => {\n if (step.name in acc) {\n throw Error(`The tour: ${tourName} with step: ${step.name} has already been registered`);\n }\n\n acc[step.name as keyof Components] = ({ children }: { children: React.ReactNode }) => (\n <UnstableGuidedTourTooltip\n tourName={tourName as ValidTourName}\n step={index}\n content={step.content}\n >\n {children}\n </UnstableGuidedTourTooltip>\n );\n\n return acc;\n }, {} as Components);\n\n return tour;\n}\n\nexport type { Content, Tours };\nexport { tours };\n"],"names":["tours","contentManager","createTour","name","content","Step","_jsxs","Root","sideOffset","_jsx","Title","id","defaultMessage","Content","Actions","showSkip","GuidedTourOverlay","styled","Box","UnstableGuidedTourTooltip","children","tourName","step","state","unstableUseGuidedTour","s","dispatch","React","useMemo","createStepComponents","isCurrentStep","currentStep","isPopoverOpen","isCompleted","useEffect","originalStyle","window","getComputedStyle","document","body","overflow","style","_Fragment","Popover","open","Anchor","steps","tour","reduce","acc","index","Error"],"mappings":";;;;;;;AAUA;;AAEkG,2GAE5FA,KAAQ,GAAA;AACZC,IAAAA,cAAAA,EAAgBC,WAAW,gBAAkB,EAAA;AAC3C,QAAA;YACEC,IAAM,EAAA,cAAA;AACNC,YAAAA,OAAAA,EAAS,CAACC,IAAAA,iBACRC,IAACD,CAAAA,IAAAA,CAAKE,IAAI,EAAA;AAACC,oBAAAA,UAAAA,EAAY,CAAC,EAAA;;AACtB,sCAAAC,GAAA,CAACJ,KAAKK,KAAK,EAAA;4BACTC,EAAG,EAAA,yCAAA;4BACHC,cAAe,EAAA;;AAEjB,sCAAAH,GAAA,CAACJ,KAAKQ,OAAO,EAAA;4BACXF,EAAG,EAAA,2CAAA;4BACHC,cAAe,EAAA;;AAEjB,sCAAAH,GAAA,CAACJ,KAAKS,OAAO,EAAA;4BAACC,QAAQ,EAAA;;;;AAG5B;AACD,KAAA;AACH;AAmBaC,MAAAA,iBAAAA,GAAoBC,MAAOC,CAAAA,GAAAA,CAAI;;;;;;AAM5C;AAEA,MAAMC,yBAAAA,GAA4B,CAAC,EACjCC,QAAQ,EACRhB,OAAO,EACPiB,QAAQ,EACRC,IAAI,EAML,GAAA;AACC,IAAA,MAAMC,QAAQC,qBAAsB,CAAA,2BAAA,EAA6B,CAACC,CAAAA,GAAMA,EAAEF,KAAK,CAAA;AAC/E,IAAA,MAAMG,W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EAAA;AAK7F,IAAA,MAAMC,OAAOD,KAAME,CAAAA,MAAM,CAAC,CAACC,KAAK3B,IAAM4B,EAAAA,KAAAA,GAAAA;QACpC,IAAI5B,IAAAA,CAAKnB,IAAI,IAAI8C,GAAK,EAAA;YACpB,MAAME,KAAAA,CAAM,CAAC,UAAU,EAAE9B,QAAAA,CAAS,YAAY,EAAEC,IAAKnB,CAAAA,IAAI,CAAC,4BAA4B,CAAC,CAAA;AACzF;QAEA8C,GAAG,CAAC3B,IAAKnB,CAAAA,IAAI,CAAqB,GAAG,CAAC,EAAEiB,QAAQ,EAAiC,iBAC/EX,GAACU,CAAAA,yBAAAA,EAAAA;gBACCE,QAAUA,EAAAA,QAAAA;gBACVC,IAAM4B,EAAAA,KAAAA;AACN9C,gBAAAA,OAAAA,EAASkB,KAAKlB,OAAO;AAEpBgB,gBAAAA,QAAAA,EAAAA;;QAIL,OAAO6B,GAAAA;AACT,KAAA,EAAG,EAAC,CAAA;IAEJ,OAAOF,IAAAA;AACT;;;;"}
@@ -1,28 +0,0 @@
1
- import * as React from 'react';
2
- import type { Tours } from './Tours';
3
- type ValidTourName = keyof Tours;
4
- type Action = {
5
- type: 'next_step';
6
- payload: ValidTourName;
7
- } | {
8
- type: 'skip_tour';
9
- payload: ValidTourName;
10
- };
11
- type State = {
12
- tours: Record<ValidTourName, {
13
- currentStep: number;
14
- length: number;
15
- isCompleted: boolean;
16
- }>;
17
- };
18
- declare const unstableUseGuidedTour: <Selected, ShouldThrow extends boolean = true>(consumerName: string, selector: (value: {
19
- state: State;
20
- dispatch: React.Dispatch<Action>;
21
- }) => Selected, shouldThrowOnMissingContext?: ShouldThrow | undefined) => ShouldThrow extends true ? Selected : Selected | undefined;
22
- declare function reducer(state: State, action: Action): State;
23
- declare const UnstableGuidedTourContext: ({ children, tours: registeredTours, }: {
24
- children: React.ReactNode;
25
- tours: Tours;
26
- }) => import("react/jsx-runtime").JSX.Element;
27
- export type { Action, State, ValidTourName };
28
- export { UnstableGuidedTourContext, unstableUseGuidedTour, reducer };
@@ -1,35 +0,0 @@
1
- import * as React from 'react';
2
- import { Popover } from '@strapi/design-system';
3
- import { type MessageDescriptor } from 'react-intl';
4
- import { ValidTourName } from './Context';
5
- type WithChildren = {
6
- children: React.ReactNode;
7
- id?: never;
8
- defaultMessage?: never;
9
- };
10
- type WithIntl = {
11
- children?: undefined;
12
- id: MessageDescriptor['id'];
13
- defaultMessage: MessageDescriptor['defaultMessage'];
14
- };
15
- type WithActionsChildren = {
16
- children: React.ReactNode;
17
- showStepCount?: boolean;
18
- showSkip?: boolean;
19
- };
20
- type WithActionsProps = {
21
- children?: undefined;
22
- showStepCount?: boolean;
23
- showSkip?: boolean;
24
- };
25
- type StepProps = WithChildren | WithIntl;
26
- type ActionsProps = WithActionsChildren | WithActionsProps;
27
- type Step = {
28
- Root: React.ForwardRefExoticComponent<React.ComponentProps<typeof Popover.Content>>;
29
- Title: (props: StepProps) => React.ReactNode;
30
- Content: (props: StepProps) => React.ReactNode;
31
- Actions: (props: ActionsProps) => React.ReactNode;
32
- };
33
- declare const createStepComponents: (tourName: ValidTourName) => Step;
34
- export type { Step };
35
- export { createStepComponents };
@@ -1,24 +0,0 @@
1
- import * as React from 'react';
2
- import { type State, type Action } from './Context';
3
- import { Step } from './Step';
4
- declare const tours: {
5
- readonly contentManager: {
6
- Introduction: React.ComponentType<{
7
- children: React.ReactNode;
8
- }>;
9
- };
10
- };
11
- type Tours = typeof tours;
12
- type Content = (Step: Step, { state, dispatch, }: {
13
- state: State;
14
- dispatch: React.Dispatch<Action>;
15
- }) => React.ReactNode;
16
- export declare const GuidedTourOverlay: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<Omit<import("@strapi/design-system").TransientBoxProps & {
17
- children?: React.ReactNode;
18
- } & import("@strapi/design-system/dist/types").AsProp<React.ElementType<any, keyof React.JSX.IntrinsicElements>> & Omit<Omit<any, "ref">, "children" | keyof import("@strapi/design-system/dist/types").AsProp<C> | keyof import("@strapi/design-system").TransientBoxProps> & {
19
- ref?: any;
20
- }, "ref"> & {
21
- ref?: any;
22
- }, never>> & Omit<import("@strapi/design-system").BoxComponent<"div">, keyof React.Component<any, {}, any>>;
23
- export type { Content, Tours };
24
- export { tours };