@strapi/admin 5.18.0 → 5.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/admin/src/components/GuidedTour/Provider.js +2 -1
- package/dist/admin/admin/src/components/GuidedTour/Provider.js.map +1 -1
- package/dist/admin/admin/src/components/GuidedTour/Provider.mjs +2 -1
- package/dist/admin/admin/src/components/GuidedTour/Provider.mjs.map +1 -1
- package/dist/admin/admin/src/components/UnstableGuidedTour/Overview.js +24 -9
- package/dist/admin/admin/src/components/UnstableGuidedTour/Overview.js.map +1 -1
- package/dist/admin/admin/src/components/UnstableGuidedTour/Overview.mjs +25 -10
- package/dist/admin/admin/src/components/UnstableGuidedTour/Overview.mjs.map +1 -1
- package/dist/admin/admin/src/components/UnstableGuidedTour/Step.js +57 -27
- package/dist/admin/admin/src/components/UnstableGuidedTour/Step.js.map +1 -1
- package/dist/admin/admin/src/components/UnstableGuidedTour/Step.mjs +59 -30
- package/dist/admin/admin/src/components/UnstableGuidedTour/Step.mjs.map +1 -1
- package/dist/admin/admin/src/components/UnstableGuidedTour/Tours.js +62 -47
- package/dist/admin/admin/src/components/UnstableGuidedTour/Tours.js.map +1 -1
- package/dist/admin/admin/src/components/UnstableGuidedTour/Tours.mjs +62 -47
- package/dist/admin/admin/src/components/UnstableGuidedTour/Tours.mjs.map +1 -1
- package/dist/admin/admin/src/pages/Home/HomePage.js +1 -0
- package/dist/admin/admin/src/pages/Home/HomePage.js.map +1 -1
- package/dist/admin/admin/src/pages/Home/HomePage.mjs +1 -0
- package/dist/admin/admin/src/pages/Home/HomePage.mjs.map +1 -1
- package/dist/admin/admin/src/translations/en.json.js +10 -1
- package/dist/admin/admin/src/translations/en.json.js.map +1 -1
- package/dist/admin/admin/src/translations/en.json.mjs +10 -1
- package/dist/admin/admin/src/translations/en.json.mjs.map +1 -1
- package/dist/admin/admin/src/translations/es.json.js +2 -1
- package/dist/admin/admin/src/translations/es.json.js.map +1 -1
- package/dist/admin/admin/src/translations/es.json.mjs +2 -1
- package/dist/admin/admin/src/translations/es.json.mjs.map +1 -1
- package/dist/admin/src/components/UnstableGuidedTour/Step.d.ts +9 -3
- package/package.json +9 -9
|
@@ -30,8 +30,34 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
30
30
|
const ActionsContainer = styled.styled(designSystem.Flex)`
|
|
31
31
|
border-top: ${({ theme })=>`1px solid ${theme.colors.neutral150}`};
|
|
32
32
|
`;
|
|
33
|
+
/**
|
|
34
|
+
* TODO:
|
|
35
|
+
* We should probably move all arrow styles + svg to the DS
|
|
36
|
+
*/ const PopoverArrow = styled.styled(designSystem.Popover.Arrow)`
|
|
37
|
+
fill: ${({ theme })=>theme.colors.neutral0};
|
|
38
|
+
transform: translateY(-16px) rotate(-90deg);
|
|
39
|
+
`;
|
|
40
|
+
const StepCount = ({ tourName })=>{
|
|
41
|
+
const state = Context.unstableUseGuidedTour('GuidedTourPopover', (s)=>s.state);
|
|
42
|
+
const currentStep = state.tours[tourName].currentStep + 1;
|
|
43
|
+
// TODO: Currently all tours do not count their last step, but we should find a way to make this more smart
|
|
44
|
+
const displayedLength = state.tours[tourName].length - 1;
|
|
45
|
+
return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
|
46
|
+
variant: "omega",
|
|
47
|
+
fontSize: "12px",
|
|
48
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(reactIntl.FormattedMessage, {
|
|
49
|
+
id: "tours.stepCount",
|
|
50
|
+
defaultMessage: "Step {currentStep} of {tourLength}",
|
|
51
|
+
values: {
|
|
52
|
+
currentStep,
|
|
53
|
+
tourLength: displayedLength
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
};
|
|
33
58
|
const createStepComponents = (tourName)=>({
|
|
34
|
-
Root: /*#__PURE__*/ React__namespace.forwardRef((props, ref)
|
|
59
|
+
Root: /*#__PURE__*/ React__namespace.forwardRef(({ withArrow = true, ...props }, ref)=>{
|
|
60
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Popover.Content, {
|
|
35
61
|
ref: ref,
|
|
36
62
|
side: "top",
|
|
37
63
|
align: "center",
|
|
@@ -39,13 +65,29 @@ const createStepComponents = (tourName)=>({
|
|
|
39
65
|
border: 'none'
|
|
40
66
|
},
|
|
41
67
|
...props,
|
|
42
|
-
children:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
68
|
+
children: [
|
|
69
|
+
withArrow && /*#__PURE__*/ jsxRuntime.jsx(PopoverArrow, {
|
|
70
|
+
asChild: true,
|
|
71
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
|
|
72
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
73
|
+
width: "23",
|
|
74
|
+
height: "25",
|
|
75
|
+
viewBox: "0 0 23 25",
|
|
76
|
+
fill: "none",
|
|
77
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
78
|
+
d: "M11 24.5L1.82843 15.3284C0.266332 13.7663 0.26633 11.2337 1.82843 9.67157L11 0.5L23 12.5L11 24.5Z"
|
|
79
|
+
})
|
|
80
|
+
})
|
|
81
|
+
}),
|
|
82
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Flex, {
|
|
83
|
+
width: "360px",
|
|
84
|
+
direction: "column",
|
|
85
|
+
alignItems: "start",
|
|
86
|
+
children: props.children
|
|
87
|
+
})
|
|
88
|
+
]
|
|
89
|
+
});
|
|
90
|
+
}),
|
|
49
91
|
Title: (props)=>{
|
|
50
92
|
return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
|
|
51
93
|
paddingTop: 5,
|
|
@@ -80,31 +122,18 @@ const createStepComponents = (tourName)=>({
|
|
|
80
122
|
})
|
|
81
123
|
})
|
|
82
124
|
}),
|
|
83
|
-
Actions: ({ showStepCount = true, showSkip = false, to, ...
|
|
125
|
+
Actions: ({ showStepCount = true, showSkip = false, to, children, ...flexProps })=>{
|
|
84
126
|
const dispatch = Context.unstableUseGuidedTour('GuidedTourPopover', (s)=>s.dispatch);
|
|
85
|
-
const state = Context.unstableUseGuidedTour('GuidedTourPopover', (s)=>s.state);
|
|
86
|
-
const currentStep = state.tours[tourName].currentStep + 1;
|
|
87
|
-
// TODO: Currently all tours do not count their last step, but we should find a way to make this more smart
|
|
88
|
-
const displayedLength = state.tours[tourName].length - 1;
|
|
89
127
|
return /*#__PURE__*/ jsxRuntime.jsx(ActionsContainer, {
|
|
90
128
|
width: "100%",
|
|
91
129
|
padding: 3,
|
|
92
130
|
paddingLeft: 5,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
131
|
+
justifyContent: showStepCount ? 'space-between' : 'flex-end',
|
|
132
|
+
...flexProps,
|
|
133
|
+
children: children ? children : /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
96
134
|
children: [
|
|
97
|
-
showStepCount && /*#__PURE__*/ jsxRuntime.jsx(
|
|
98
|
-
|
|
99
|
-
fontSize: "12px",
|
|
100
|
-
children: /*#__PURE__*/ jsxRuntime.jsx(reactIntl.FormattedMessage, {
|
|
101
|
-
id: "tours.stepCount",
|
|
102
|
-
defaultMessage: "Step {currentStep} of {tourLength}",
|
|
103
|
-
values: {
|
|
104
|
-
currentStep,
|
|
105
|
-
tourLength: displayedLength
|
|
106
|
-
}
|
|
107
|
-
})
|
|
135
|
+
showStepCount && /*#__PURE__*/ jsxRuntime.jsx(StepCount, {
|
|
136
|
+
tourName: tourName
|
|
108
137
|
}),
|
|
109
138
|
/*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
|
|
110
139
|
gap: 2,
|
|
@@ -149,5 +178,6 @@ const createStepComponents = (tourName)=>({
|
|
|
149
178
|
}
|
|
150
179
|
});
|
|
151
180
|
|
|
181
|
+
exports.StepCount = StepCount;
|
|
152
182
|
exports.createStepComponents = createStepComponents;
|
|
153
183
|
//# sourceMappingURL=Step.js.map
|
|
@@ -1 +1 @@
|
|
|
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, LinkButton } from '@strapi/design-system';\nimport { FormattedMessage, type MessageDescriptor } from 'react-intl';\nimport { NavLink } from 'react-router-dom';\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 & { to?: string }) => 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\" style={{ border: 'none' }} {...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, to, ...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 // TODO: Currently all tours do not count their last step, but we should find a way to make this more smart\n const displayedLength = state.tours[tourName].length - 1;\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: displayedLength }}\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 {to ? (\n <LinkButton\n tag={NavLink}\n to={to}\n onClick={() => dispatch({ type: 'next_step', payload: tourName })}\n >\n <FormattedMessage id=\"tours.next\" defaultMessage=\"Next\" />\n </LinkButton>\n ) : (\n <Button onClick={() => dispatch({ type: 'next_step', payload: tourName })}>\n <FormattedMessage id=\"tours.next\" defaultMessage=\"Next\" />\n </Button>\n )}\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","style","border","width","direction","alignItems","children","Title","Box","paddingTop","paddingLeft","paddingRight","paddingBottom","Typography","tag","variant","fontWeight","FormattedMessage","tagName","id","defaultMessage","Actions","showStepCount","showSkip","to","dispatch","unstableUseGuidedTour","s","state","currentStep","tours","displayedLength","length","padding","_jsxs","flex","justifyContent","fontSize","values","tourLength","gap","Button","onClick","type","payload","LinkButton","NavLink"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,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;gBAASC,KAAO,EAAA;oBAAEC,MAAQ,EAAA;AAAO,iBAAA;AAAI,gBAAA,GAAGR,KAAK;AACvF,gBAAA,QAAA,gBAAAE,cAACX,CAAAA,iBAAAA,EAAAA;oBAAKkB,KAAM,EAAA,OAAA;oBAAQC,SAAU,EAAA,QAAA;oBAASC,UAAW,EAAA,OAAA;AAC/CX,oBAAAA,QAAAA,EAAAA,KAAAA,CAAMY;;;AAKbC,QAAAA,KAAAA,EAAO,CAACb,KAAAA,GAAAA;AACN,YAAA,qBACEE,cAACY,CAAAA,gBAAAA,EAAAA;gBAAIC,UAAY,EAAA,CAAA;gBAAGC,WAAa,EAAA,CAAA;gB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BE,EAAG,EAAA,YAAA;wCAAaC,cAAe,EAAA;;;AAGpDI,gCAAAA,EAAAA,iBACC5B,cAACiD,CAAAA,uBAAAA,EAAAA;oCACC/B,GAAKgC,EAAAA,sBAAAA;oCACLtB,EAAIA,EAAAA,EAAAA;AACJkB,oCAAAA,OAAAA,EAAS,IAAMjB,QAAS,CAAA;4CAAEkB,IAAM,EAAA,WAAA;4CAAaC,OAAStD,EAAAA;AAAS,yCAAA,CAAA;AAE/D,oCAAA,QAAA,gBAAAM,cAACqB,CAAAA,0BAAAA,EAAAA;wCAAiBE,EAAG,EAAA,YAAA;wCAAaC,cAAe,EAAA;;mDAGnDxB,cAAC6C,CAAAA,mBAAAA,EAAAA;AAAOC,oCAAAA,OAAAA,EAAS,IAAMjB,QAAS,CAAA;4CAAEkB,IAAM,EAAA,WAAA;4CAAaC,OAAStD,EAAAA;AAAS,yCAAA,CAAA;AACrE,oCAAA,QAAA,gBAAAM,cAACqB,CAAAA,0BAAAA,EAAAA;wCAAiBE,EAAG,EAAA,YAAA;wCAAaC,cAAe,EAAA;;;;;;;;AAQjE;KACF;;;;"}
|
|
1
|
+
{"version":3,"file":"Step.js","sources":["../../../../../../admin/src/components/UnstableGuidedTour/Step.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n Popover,\n Box,\n Flex,\n Button,\n Typography,\n LinkButton,\n FlexProps,\n} from '@strapi/design-system';\nimport { FormattedMessage, type MessageDescriptor } from 'react-intl';\nimport { NavLink } from 'react-router-dom';\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 withArrow?: boolean;\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<\n React.ComponentProps<typeof Popover.Content> & { withArrow?: boolean }\n >;\n Title: (props: StepProps) => React.ReactNode;\n Content: (props: StepProps) => React.ReactNode;\n Actions: (props: ActionsProps & { to?: string } & FlexProps) => React.ReactNode;\n};\n\nconst ActionsContainer = styled(Flex)`\n border-top: ${({ theme }) => `1px solid ${theme.colors.neutral150}`};\n`;\n\n/**\n * TODO:\n * We should probably move all arrow styles + svg to the DS\n */\nconst PopoverArrow = styled(Popover.Arrow)`\n fill: ${({ theme }) => theme.colors.neutral0};\n transform: translateY(-16px) rotate(-90deg);\n`;\n\nexport const StepCount = ({ tourName }: { tourName: ValidTourName }) => {\n const state = unstableUseGuidedTour('GuidedTourPopover', (s) => s.state);\n const currentStep = state.tours[tourName].currentStep + 1;\n // TODO: Currently all tours do not count their last step, but we should find a way to make this more smart\n const displayedLength = state.tours[tourName].length - 1;\n\n return (\n <Typography variant=\"omega\" fontSize=\"12px\">\n <FormattedMessage\n id=\"tours.stepCount\"\n defaultMessage=\"Step {currentStep} of {tourLength}\"\n values={{ currentStep, tourLength: displayedLength }}\n />\n </Typography>\n );\n};\n\nconst createStepComponents = (tourName: ValidTourName): Step => ({\n Root: React.forwardRef(({ withArrow = true, ...props }, ref) => {\n return (\n <Popover.Content ref={ref} side=\"top\" align=\"center\" style={{ border: 'none' }} {...props}>\n {withArrow && (\n <PopoverArrow asChild>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"23\"\n height=\"25\"\n viewBox=\"0 0 23 25\"\n fill=\"none\"\n >\n <path d=\"M11 24.5L1.82843 15.3284C0.266332 13.7663 0.26633 11.2337 1.82843 9.67157L11 0.5L23 12.5L11 24.5Z\" />\n </svg>\n </PopoverArrow>\n )}\n <Flex width=\"360px\" direction=\"column\" alignItems=\"start\">\n {props.children}\n </Flex>\n </Popover.Content>\n );\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, to, children, ...flexProps }) => {\n const dispatch = unstableUseGuidedTour('GuidedTourPopover', (s) => s.dispatch);\n\n return (\n <ActionsContainer\n width=\"100%\"\n padding={3}\n paddingLeft={5}\n justifyContent={showStepCount ? 'space-between' : 'flex-end'}\n {...flexProps}\n >\n {children ? (\n children\n ) : (\n <>\n {showStepCount && <StepCount tourName={tourName} />}\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 {to ? (\n <LinkButton\n tag={NavLink}\n to={to}\n onClick={() => dispatch({ type: 'next_step', payload: tourName })}\n >\n <FormattedMessage id=\"tours.next\" defaultMessage=\"Next\" />\n </LinkButton>\n ) : (\n <Button onClick={() => dispatch({ type: 'next_step', payload: tourName })}>\n <FormattedMessage id=\"tours.next\" defaultMessage=\"Next\" />\n </Button>\n )}\n </Flex>\n </>\n )}\n </ActionsContainer>\n );\n },\n});\n\nexport type { Step };\nexport { createStepComponents };\n"],"names":["ActionsContainer","styled","Flex","theme","colors","neutral150","PopoverArrow","Popover","Arrow","neutral0","StepCount","tourName","state","unstableUseGuidedTour","s","currentStep","tours","displayedLength","length","_jsx","Typography","variant","fontSize","FormattedMessage","id","defaultMessage","values","tourLength","createStepComponents","Root","React","forwardRef","withArrow","props","ref","_jsxs","Content","side","align","style","border","asChild","svg","xmlns","width","height","viewBox","fill","path","d","direction","alignItems","children","Title","Box","paddingTop","paddingLeft","paddingRight","paddingBottom","tag","fontWeight","tagName","Actions","showStepCount","showSkip","to","flexProps","dispatch","padding","justifyContent","_Fragment","gap","Button","onClick","type","payload","LinkButton","NavLink"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA,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;AAED;;;AAGC,IACD,MAAMC,YAAeL,GAAAA,aAAAA,CAAOM,oBAAQC,CAAAA,KAAK,CAAC;QAClC,EAAE,CAAC,EAAEL,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACK,QAAQ,CAAC;;AAE/C,CAAC;AAEYC,MAAAA,SAAAA,GAAY,CAAC,EAAEC,QAAQ,EAA+B,GAAA;AACjE,IAAA,MAAMC,QAAQC,6BAAsB,CAAA,mBAAA,EAAqB,CAACC,CAAAA,GAAMA,EAAEF,KAAK,CAAA;AACvE,IAAA,MAAMG,cAAcH,KAAMI,CAAAA,KAAK,CAACL,QAAS,CAAA,CAACI,WAAW,GAAG,CAAA;;AAExD,IAAA,MAAME,kBAAkBL,KAAMI,CAAAA,KAAK,CAACL,QAAS,CAAA,CAACO,MAAM,GAAG,CAAA;AAEvD,IAAA,qBACEC,cAACC,CAAAA,uBAAAA,EAAAA;QAAWC,OAAQ,EAAA,OAAA;QAAQC,QAAS,EAAA,MAAA;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,QAAS,CAAA;4CAAEO,IAAM,EAAA,WAAA;4CAAaC,OAAShE,EAAAA;AAAS,yCAAA,CAAA;AACrE,oCAAA,QAAA,gBAAAQ,cAACI,CAAAA,0BAAAA,EAAAA;wCAAiBC,EAAG,EAAA,YAAA;wCAAaC,cAAe,EAAA;;;;;;;;AAQjE;KACF;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { Flex, Popover,
|
|
3
|
+
import { Flex, Popover, Typography, Box, Button, LinkButton } from '@strapi/design-system';
|
|
4
4
|
import { FormattedMessage } from 'react-intl';
|
|
5
5
|
import { NavLink } from 'react-router-dom';
|
|
6
6
|
import { styled } from 'styled-components';
|
|
@@ -9,8 +9,34 @@ import { unstableUseGuidedTour } from './Context.mjs';
|
|
|
9
9
|
const ActionsContainer = styled(Flex)`
|
|
10
10
|
border-top: ${({ theme })=>`1px solid ${theme.colors.neutral150}`};
|
|
11
11
|
`;
|
|
12
|
+
/**
|
|
13
|
+
* TODO:
|
|
14
|
+
* We should probably move all arrow styles + svg to the DS
|
|
15
|
+
*/ const PopoverArrow = styled(Popover.Arrow)`
|
|
16
|
+
fill: ${({ theme })=>theme.colors.neutral0};
|
|
17
|
+
transform: translateY(-16px) rotate(-90deg);
|
|
18
|
+
`;
|
|
19
|
+
const StepCount = ({ tourName })=>{
|
|
20
|
+
const state = unstableUseGuidedTour('GuidedTourPopover', (s)=>s.state);
|
|
21
|
+
const currentStep = state.tours[tourName].currentStep + 1;
|
|
22
|
+
// TODO: Currently all tours do not count their last step, but we should find a way to make this more smart
|
|
23
|
+
const displayedLength = state.tours[tourName].length - 1;
|
|
24
|
+
return /*#__PURE__*/ jsx(Typography, {
|
|
25
|
+
variant: "omega",
|
|
26
|
+
fontSize: "12px",
|
|
27
|
+
children: /*#__PURE__*/ jsx(FormattedMessage, {
|
|
28
|
+
id: "tours.stepCount",
|
|
29
|
+
defaultMessage: "Step {currentStep} of {tourLength}",
|
|
30
|
+
values: {
|
|
31
|
+
currentStep,
|
|
32
|
+
tourLength: displayedLength
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
});
|
|
36
|
+
};
|
|
12
37
|
const createStepComponents = (tourName)=>({
|
|
13
|
-
Root: /*#__PURE__*/ React.forwardRef((props, ref)
|
|
38
|
+
Root: /*#__PURE__*/ React.forwardRef(({ withArrow = true, ...props }, ref)=>{
|
|
39
|
+
return /*#__PURE__*/ jsxs(Popover.Content, {
|
|
14
40
|
ref: ref,
|
|
15
41
|
side: "top",
|
|
16
42
|
align: "center",
|
|
@@ -18,13 +44,29 @@ const createStepComponents = (tourName)=>({
|
|
|
18
44
|
border: 'none'
|
|
19
45
|
},
|
|
20
46
|
...props,
|
|
21
|
-
children:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
47
|
+
children: [
|
|
48
|
+
withArrow && /*#__PURE__*/ jsx(PopoverArrow, {
|
|
49
|
+
asChild: true,
|
|
50
|
+
children: /*#__PURE__*/ jsx("svg", {
|
|
51
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
52
|
+
width: "23",
|
|
53
|
+
height: "25",
|
|
54
|
+
viewBox: "0 0 23 25",
|
|
55
|
+
fill: "none",
|
|
56
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
57
|
+
d: "M11 24.5L1.82843 15.3284C0.266332 13.7663 0.26633 11.2337 1.82843 9.67157L11 0.5L23 12.5L11 24.5Z"
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
}),
|
|
61
|
+
/*#__PURE__*/ jsx(Flex, {
|
|
62
|
+
width: "360px",
|
|
63
|
+
direction: "column",
|
|
64
|
+
alignItems: "start",
|
|
65
|
+
children: props.children
|
|
66
|
+
})
|
|
67
|
+
]
|
|
68
|
+
});
|
|
69
|
+
}),
|
|
28
70
|
Title: (props)=>{
|
|
29
71
|
return /*#__PURE__*/ jsx(Box, {
|
|
30
72
|
paddingTop: 5,
|
|
@@ -59,31 +101,18 @@ const createStepComponents = (tourName)=>({
|
|
|
59
101
|
})
|
|
60
102
|
})
|
|
61
103
|
}),
|
|
62
|
-
Actions: ({ showStepCount = true, showSkip = false, to, ...
|
|
104
|
+
Actions: ({ showStepCount = true, showSkip = false, to, children, ...flexProps })=>{
|
|
63
105
|
const dispatch = unstableUseGuidedTour('GuidedTourPopover', (s)=>s.dispatch);
|
|
64
|
-
const state = unstableUseGuidedTour('GuidedTourPopover', (s)=>s.state);
|
|
65
|
-
const currentStep = state.tours[tourName].currentStep + 1;
|
|
66
|
-
// TODO: Currently all tours do not count their last step, but we should find a way to make this more smart
|
|
67
|
-
const displayedLength = state.tours[tourName].length - 1;
|
|
68
106
|
return /*#__PURE__*/ jsx(ActionsContainer, {
|
|
69
107
|
width: "100%",
|
|
70
108
|
padding: 3,
|
|
71
109
|
paddingLeft: 5,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
110
|
+
justifyContent: showStepCount ? 'space-between' : 'flex-end',
|
|
111
|
+
...flexProps,
|
|
112
|
+
children: children ? children : /*#__PURE__*/ jsxs(Fragment, {
|
|
75
113
|
children: [
|
|
76
|
-
showStepCount && /*#__PURE__*/ jsx(
|
|
77
|
-
|
|
78
|
-
fontSize: "12px",
|
|
79
|
-
children: /*#__PURE__*/ jsx(FormattedMessage, {
|
|
80
|
-
id: "tours.stepCount",
|
|
81
|
-
defaultMessage: "Step {currentStep} of {tourLength}",
|
|
82
|
-
values: {
|
|
83
|
-
currentStep,
|
|
84
|
-
tourLength: displayedLength
|
|
85
|
-
}
|
|
86
|
-
})
|
|
114
|
+
showStepCount && /*#__PURE__*/ jsx(StepCount, {
|
|
115
|
+
tourName: tourName
|
|
87
116
|
}),
|
|
88
117
|
/*#__PURE__*/ jsxs(Flex, {
|
|
89
118
|
gap: 2,
|
|
@@ -128,5 +157,5 @@ const createStepComponents = (tourName)=>({
|
|
|
128
157
|
}
|
|
129
158
|
});
|
|
130
159
|
|
|
131
|
-
export { createStepComponents };
|
|
160
|
+
export { StepCount, createStepComponents };
|
|
132
161
|
//# sourceMappingURL=Step.mjs.map
|
|
@@ -1 +1 @@
|
|
|
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, LinkButton } from '@strapi/design-system';\nimport { FormattedMessage, type MessageDescriptor } from 'react-intl';\nimport { NavLink } from 'react-router-dom';\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 & { to?: string }) => 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\" style={{ border: 'none' }} {...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, to, ...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 // TODO: Currently all tours do not count their last step, but we should find a way to make this more smart\n const displayedLength = state.tours[tourName].length - 1;\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: displayedLength }}\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 {to ? (\n <LinkButton\n tag={NavLink}\n to={to}\n onClick={() => dispatch({ type: 'next_step', payload: tourName })}\n >\n <FormattedMessage id=\"tours.next\" defaultMessage=\"Next\" />\n </LinkButton>\n ) : (\n <Button onClick={() => dispatch({ type: 'next_step', payload: tourName })}>\n <FormattedMessage id=\"tours.next\" defaultMessage=\"Next\" />\n </Button>\n )}\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","style","border","width","direction","alignItems","children","Title","Box","paddingTop","paddingLeft","paddingRight","paddingBottom","Typography","tag","variant","fontWeight","FormattedMessage","tagName","id","defaultMessage","Actions","showStepCount","showSkip","to","dispatch","unstableUseGuidedTour","s","state","currentStep","tours","displayedLength","length","padding","_jsxs","flex","justifyContent","fontSize","values","tourLength","gap","Button","onClick","type","payload","LinkButton","NavLink"],"mappings":";;;;;;;;AA+CA,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;gBAASC,KAAO,EAAA;oBAAEC,MAAQ,EAAA;AAAO,iBAAA;AAAI,gBAAA,GAAGR,KAAK;AACvF,gBAAA,QAAA,gBAAAE,GAACX,CAAAA,IAAAA,EAAAA;oBAAKkB,KAAM,EAAA,OAAA;oBAAQC,SAAU,EAAA,QAAA;oBAASC,UAAW,EAAA,OAAA;AAC/CX,oBAAAA,QAAAA,EAAAA,KAAAA,CAAMY;;;AAKbC,QAAAA,KA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AAM,EAAA,WAAA;4CAAaC,OAAStD,EAAAA;AAAS,yCAAA,CAAA;AAE/D,oCAAA,QAAA,gBAAAM,GAACqB,CAAAA,gBAAAA,EAAAA;wCAAiBE,EAAG,EAAA,YAAA;wCAAaC,cAAe,EAAA;;;AAGpDI,gCAAAA,EAAAA,iBACC5B,GAACiD,CAAAA,UAAAA,EAAAA;oCACC/B,GAAKgC,EAAAA,OAAAA;oCACLtB,EAAIA,EAAAA,EAAAA;AACJkB,oCAAAA,OAAAA,EAAS,IAAMjB,QAAS,CAAA;4CAAEkB,IAAM,EAAA,WAAA;4CAAaC,OAAStD,EAAAA;AAAS,yCAAA,CAAA;AAE/D,oCAAA,QAAA,gBAAAM,GAACqB,CAAAA,gBAAAA,EAAAA;wCAAiBE,EAAG,EAAA,YAAA;wCAAaC,cAAe,EAAA;;mDAGnDxB,GAAC6C,CAAAA,MAAAA,EAAAA;AAAOC,oCAAAA,OAAAA,EAAS,IAAMjB,QAAS,CAAA;4CAAEkB,IAAM,EAAA,WAAA;4CAAaC,OAAStD,EAAAA;AAAS,yCAAA,CAAA;AACrE,oCAAA,QAAA,gBAAAM,GAACqB,CAAAA,gBAAAA,EAAAA;wCAAiBE,EAAG,EAAA,YAAA;wCAAaC,cAAe,EAAA;;;;;;;;AAQjE;KACF;;;;"}
|
|
1
|
+
{"version":3,"file":"Step.mjs","sources":["../../../../../../admin/src/components/UnstableGuidedTour/Step.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n Popover,\n Box,\n Flex,\n Button,\n Typography,\n LinkButton,\n FlexProps,\n} from '@strapi/design-system';\nimport { FormattedMessage, type MessageDescriptor } from 'react-intl';\nimport { NavLink } from 'react-router-dom';\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 withArrow?: boolean;\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<\n React.ComponentProps<typeof Popover.Content> & { withArrow?: boolean }\n >;\n Title: (props: StepProps) => React.ReactNode;\n Content: (props: StepProps) => React.ReactNode;\n Actions: (props: ActionsProps & { to?: string } & FlexProps) => React.ReactNode;\n};\n\nconst ActionsContainer = styled(Flex)`\n border-top: ${({ theme }) => `1px solid ${theme.colors.neutral150}`};\n`;\n\n/**\n * TODO:\n * We should probably move all arrow styles + svg to the DS\n */\nconst PopoverArrow = styled(Popover.Arrow)`\n fill: ${({ theme }) => theme.colors.neutral0};\n transform: translateY(-16px) rotate(-90deg);\n`;\n\nexport const StepCount = ({ tourName }: { tourName: ValidTourName }) => {\n const state = unstableUseGuidedTour('GuidedTourPopover', (s) => s.state);\n const currentStep = state.tours[tourName].currentStep + 1;\n // TODO: Currently all tours do not count their last step, but we should find a way to make this more smart\n const displayedLength = state.tours[tourName].length - 1;\n\n return (\n <Typography variant=\"omega\" fontSize=\"12px\">\n <FormattedMessage\n id=\"tours.stepCount\"\n defaultMessage=\"Step {currentStep} of {tourLength}\"\n values={{ currentStep, tourLength: displayedLength }}\n />\n </Typography>\n );\n};\n\nconst createStepComponents = (tourName: ValidTourName): Step => ({\n Root: React.forwardRef(({ withArrow = true, ...props }, ref) => {\n return (\n <Popover.Content ref={ref} side=\"top\" align=\"center\" style={{ border: 'none' }} {...props}>\n {withArrow && (\n <PopoverArrow asChild>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"23\"\n height=\"25\"\n viewBox=\"0 0 23 25\"\n fill=\"none\"\n >\n <path d=\"M11 24.5L1.82843 15.3284C0.266332 13.7663 0.26633 11.2337 1.82843 9.67157L11 0.5L23 12.5L11 24.5Z\" />\n </svg>\n </PopoverArrow>\n )}\n <Flex width=\"360px\" direction=\"column\" alignItems=\"start\">\n {props.children}\n </Flex>\n </Popover.Content>\n );\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, to, children, ...flexProps }) => {\n const dispatch = unstableUseGuidedTour('GuidedTourPopover', (s) => s.dispatch);\n\n return (\n <ActionsContainer\n width=\"100%\"\n padding={3}\n paddingLeft={5}\n justifyContent={showStepCount ? 'space-between' : 'flex-end'}\n {...flexProps}\n >\n {children ? (\n children\n ) : (\n <>\n {showStepCount && <StepCount tourName={tourName} />}\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 {to ? (\n <LinkButton\n tag={NavLink}\n to={to}\n onClick={() => dispatch({ type: 'next_step', payload: tourName })}\n >\n <FormattedMessage id=\"tours.next\" defaultMessage=\"Next\" />\n </LinkButton>\n ) : (\n <Button onClick={() => dispatch({ type: 'next_step', payload: tourName })}>\n <FormattedMessage id=\"tours.next\" defaultMessage=\"Next\" />\n </Button>\n )}\n </Flex>\n </>\n )}\n </ActionsContainer>\n );\n },\n});\n\nexport type { Step };\nexport { createStepComponents };\n"],"names":["ActionsContainer","styled","Flex","theme","colors","neutral150","PopoverArrow","Popover","Arrow","neutral0","StepCount","tourName","state","unstableUseGuidedTour","s","currentStep","tours","displayedLength","length","_jsx","Typography","variant","fontSize","FormattedMessage","id","defaultMessage","values","tourLength","createStepComponents","Root","React","forwardRef","withArrow","props","ref","_jsxs","Content","side","align","style","border","asChild","svg","xmlns","width","height","viewBox","fill","path","d","direction","alignItems","children","Title","Box","paddingTop","paddingLeft","paddingRight","paddingBottom","tag","fontWeight","tagName","Actions","showStepCount","showSkip","to","flexProps","dispatch","padding","justifyContent","_Fragment","gap","Button","onClick","type","payload","LinkButton","NavLink"],"mappings":";;;;;;;;AA0DA,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;AAED;;;AAGC,IACD,MAAMC,YAAeL,GAAAA,MAAAA,CAAOM,OAAQC,CAAAA,KAAK,CAAC;QAClC,EAAE,CAAC,EAAEL,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACK,QAAQ,CAAC;;AAE/C,CAAC;AAEYC,MAAAA,SAAAA,GAAY,CAAC,EAAEC,QAAQ,EAA+B,GAAA;AACjE,IAAA,MAAMC,QAAQC,qBAAsB,CAAA,mBAAA,EAAqB,CAACC,CAAAA,GAAMA,EAAEF,KAAK,CAAA;AACvE,IAAA,MAAMG,cAAcH,KAAMI,CAAAA,KAAK,CAACL,QAAS,CAAA,CAACI,WAAW,GAAG,CAAA;;AAExD,IAAA,MAAME,kBAAkBL,KAAMI,CAAAA,KAAK,CAACL,QAAS,CAAA,CAACO,MAAM,GAAG,CAAA;AAEvD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AA;;mDAGnDN,GAACqD,CAAAA,MAAAA,EAAAA;AAAOC,oCAAAA,OAAAA,EAAS,IAAMN,QAAS,CAAA;4CAAEO,IAAM,EAAA,WAAA;4CAAaC,OAAShE,EAAAA;AAAS,yCAAA,CAAA;AACrE,oCAAA,QAAA,gBAAAQ,GAACI,CAAAA,gBAAAA,EAAAA;wCAAiBC,EAAG,EAAA,YAAA;wCAAaC,cAAe,EAAA;;;;;;;;AAQjE;KACF;;;;"}
|
|
@@ -4,7 +4,6 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var designSystem = require('@strapi/design-system');
|
|
6
6
|
var reactIntl = require('react-intl');
|
|
7
|
-
var reactRouterDom = require('react-router-dom');
|
|
8
7
|
var styled = require('styled-components');
|
|
9
8
|
var admin = require('../../services/admin.js');
|
|
10
9
|
var Context = require('./Context.js');
|
|
@@ -31,12 +30,22 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
31
30
|
|
|
32
31
|
/* -------------------------------------------------------------------------------------------------
|
|
33
32
|
* Tours
|
|
34
|
-
* -----------------------------------------------------------------------------------------------*/ const
|
|
33
|
+
* -----------------------------------------------------------------------------------------------*/ const GotItAction = ({ onClick })=>{
|
|
34
|
+
return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
|
|
35
|
+
onClick: onClick,
|
|
36
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(reactIntl.FormattedMessage, {
|
|
37
|
+
id: "tours.gotIt",
|
|
38
|
+
defaultMessage: "Got it"
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
const tours = {
|
|
35
43
|
contentTypeBuilder: createTour('contentTypeBuilder', [
|
|
36
44
|
{
|
|
37
45
|
name: 'Introduction',
|
|
38
46
|
content: (Step)=>/*#__PURE__*/ jsxRuntime.jsxs(Step.Root, {
|
|
39
47
|
side: "bottom",
|
|
48
|
+
withArrow: false,
|
|
40
49
|
children: [
|
|
41
50
|
/*#__PURE__*/ jsxRuntime.jsx(Step.Title, {
|
|
42
51
|
id: "tours.contentTypeBuilder.Introduction.title",
|
|
@@ -56,7 +65,7 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
56
65
|
name: 'CollectionTypes',
|
|
57
66
|
content: (Step)=>/*#__PURE__*/ jsxRuntime.jsxs(Step.Root, {
|
|
58
67
|
side: "right",
|
|
59
|
-
sideOffset:
|
|
68
|
+
sideOffset: 16,
|
|
60
69
|
children: [
|
|
61
70
|
/*#__PURE__*/ jsxRuntime.jsx(Step.Title, {
|
|
62
71
|
id: "tours.contentTypeBuilder.CollectionTypes.title",
|
|
@@ -64,7 +73,7 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
64
73
|
}),
|
|
65
74
|
/*#__PURE__*/ jsxRuntime.jsx(Step.Content, {
|
|
66
75
|
id: "tours.contentTypeBuilder.CollectionTypes.content",
|
|
67
|
-
defaultMessage: "
|
|
76
|
+
defaultMessage: "A content structure that can manage multiple entries, such as articles or products."
|
|
68
77
|
}),
|
|
69
78
|
/*#__PURE__*/ jsxRuntime.jsx(Step.Actions, {})
|
|
70
79
|
]
|
|
@@ -74,7 +83,7 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
74
83
|
name: 'SingleTypes',
|
|
75
84
|
content: (Step)=>/*#__PURE__*/ jsxRuntime.jsxs(Step.Root, {
|
|
76
85
|
side: "right",
|
|
77
|
-
sideOffset:
|
|
86
|
+
sideOffset: 16,
|
|
78
87
|
children: [
|
|
79
88
|
/*#__PURE__*/ jsxRuntime.jsx(Step.Title, {
|
|
80
89
|
id: "tours.contentTypeBuilder.SingleTypes.title",
|
|
@@ -90,9 +99,9 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
90
99
|
},
|
|
91
100
|
{
|
|
92
101
|
name: 'Components',
|
|
93
|
-
content: (Step)=>/*#__PURE__*/ jsxRuntime.jsxs(Step.Root, {
|
|
102
|
+
content: (Step, { dispatch })=>/*#__PURE__*/ jsxRuntime.jsxs(Step.Root, {
|
|
94
103
|
side: "right",
|
|
95
|
-
sideOffset:
|
|
104
|
+
sideOffset: 16,
|
|
96
105
|
children: [
|
|
97
106
|
/*#__PURE__*/ jsxRuntime.jsx(Step.Title, {
|
|
98
107
|
id: "tours.contentTypeBuilder.Components.title",
|
|
@@ -102,7 +111,15 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
102
111
|
id: "tours.contentTypeBuilder.Components.content",
|
|
103
112
|
defaultMessage: "A reusable content structure that can be used across multiple content types, such as buttons, sliders or cards."
|
|
104
113
|
}),
|
|
105
|
-
/*#__PURE__*/ jsxRuntime.jsx(Step.Actions, {
|
|
114
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Actions, {
|
|
115
|
+
justifyContent: "flex-end",
|
|
116
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(GotItAction, {
|
|
117
|
+
onClick: ()=>dispatch({
|
|
118
|
+
type: 'next_step',
|
|
119
|
+
payload: 'contentTypeBuilder'
|
|
120
|
+
})
|
|
121
|
+
})
|
|
122
|
+
})
|
|
106
123
|
]
|
|
107
124
|
})
|
|
108
125
|
},
|
|
@@ -110,7 +127,6 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
110
127
|
name: 'Finish',
|
|
111
128
|
content: (Step)=>/*#__PURE__*/ jsxRuntime.jsxs(Step.Root, {
|
|
112
129
|
side: "right",
|
|
113
|
-
sideOffset: 32,
|
|
114
130
|
children: [
|
|
115
131
|
/*#__PURE__*/ jsxRuntime.jsx(Step.Title, {
|
|
116
132
|
id: "tours.contentTypeBuilder.Finish.title",
|
|
@@ -132,8 +148,10 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
132
148
|
contentManager: createTour('contentManager', [
|
|
133
149
|
{
|
|
134
150
|
name: 'Introduction',
|
|
151
|
+
when: (completedActions)=>completedActions.includes('didCreateContentTypeSchema') && !completedActions.includes('didCreateContent'),
|
|
135
152
|
content: (Step)=>/*#__PURE__*/ jsxRuntime.jsxs(Step.Root, {
|
|
136
153
|
side: "top",
|
|
154
|
+
withArrow: false,
|
|
137
155
|
children: [
|
|
138
156
|
/*#__PURE__*/ jsxRuntime.jsx(Step.Title, {
|
|
139
157
|
id: "tours.contentManager.Introduction.title",
|
|
@@ -152,9 +170,7 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
152
170
|
{
|
|
153
171
|
name: 'Fields',
|
|
154
172
|
content: (Step)=>/*#__PURE__*/ jsxRuntime.jsxs(Step.Root, {
|
|
155
|
-
|
|
156
|
-
align: "start",
|
|
157
|
-
sideOffset: -36,
|
|
173
|
+
sideOffset: -12,
|
|
158
174
|
children: [
|
|
159
175
|
/*#__PURE__*/ jsxRuntime.jsx(Step.Title, {
|
|
160
176
|
id: "tours.contentManager.Fields.title",
|
|
@@ -170,10 +186,9 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
170
186
|
},
|
|
171
187
|
{
|
|
172
188
|
name: 'Publish',
|
|
173
|
-
content: (Step)=>/*#__PURE__*/ jsxRuntime.jsxs(Step.Root, {
|
|
189
|
+
content: (Step, { dispatch })=>/*#__PURE__*/ jsxRuntime.jsxs(Step.Root, {
|
|
174
190
|
side: "left",
|
|
175
191
|
align: "center",
|
|
176
|
-
sideOffset: 20,
|
|
177
192
|
children: [
|
|
178
193
|
/*#__PURE__*/ jsxRuntime.jsx(Step.Title, {
|
|
179
194
|
id: "tours.contentManager.Publish.title",
|
|
@@ -183,7 +198,15 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
183
198
|
id: "tours.contentManager.Publish.content",
|
|
184
199
|
defaultMessage: "Publish entries to make their content available through the Document Service API."
|
|
185
200
|
}),
|
|
186
|
-
/*#__PURE__*/ jsxRuntime.jsx(Step.Actions, {
|
|
201
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.Actions, {
|
|
202
|
+
justifyContent: "flex-end",
|
|
203
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(GotItAction, {
|
|
204
|
+
onClick: ()=>dispatch({
|
|
205
|
+
type: 'next_step',
|
|
206
|
+
payload: 'contentManager'
|
|
207
|
+
})
|
|
208
|
+
})
|
|
209
|
+
})
|
|
187
210
|
]
|
|
188
211
|
})
|
|
189
212
|
},
|
|
@@ -191,7 +214,6 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
191
214
|
name: 'Finish',
|
|
192
215
|
content: (Step)=>/*#__PURE__*/ jsxRuntime.jsxs(Step.Root, {
|
|
193
216
|
side: "right",
|
|
194
|
-
sideOffset: 32,
|
|
195
217
|
children: [
|
|
196
218
|
/*#__PURE__*/ jsxRuntime.jsx(Step.Title, {
|
|
197
219
|
id: "tours.contentManager.FinalStep.title",
|
|
@@ -213,8 +235,10 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
213
235
|
apiTokens: createTour('apiTokens', [
|
|
214
236
|
{
|
|
215
237
|
name: 'Introduction',
|
|
238
|
+
when: (completedActions)=>!completedActions.includes('didCreateApiToken'),
|
|
216
239
|
content: (Step)=>/*#__PURE__*/ jsxRuntime.jsxs(Step.Root, {
|
|
217
240
|
sideOffset: -36,
|
|
241
|
+
withArrow: false,
|
|
218
242
|
children: [
|
|
219
243
|
/*#__PURE__*/ jsxRuntime.jsx(Step.Title, {
|
|
220
244
|
id: "tours.apiTokens.Introduction.title",
|
|
@@ -228,15 +252,14 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
228
252
|
showSkip: true
|
|
229
253
|
})
|
|
230
254
|
]
|
|
231
|
-
})
|
|
232
|
-
when: (completedActions)=>!completedActions.includes('didCreateApiToken')
|
|
255
|
+
})
|
|
233
256
|
},
|
|
234
257
|
{
|
|
235
258
|
name: 'CreateAnAPIToken',
|
|
236
259
|
content: (Step)=>/*#__PURE__*/ jsxRuntime.jsxs(Step.Root, {
|
|
237
260
|
side: "bottom",
|
|
238
|
-
sideOffset: 20,
|
|
239
261
|
align: "end",
|
|
262
|
+
sideOffset: -10,
|
|
240
263
|
children: [
|
|
241
264
|
/*#__PURE__*/ jsxRuntime.jsx(Step.Title, {
|
|
242
265
|
id: "tours.apiTokens.CreateAnAPIToken.title",
|
|
@@ -252,31 +275,41 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
252
275
|
},
|
|
253
276
|
{
|
|
254
277
|
name: 'CopyAPIToken',
|
|
255
|
-
content: (Step)=>/*#__PURE__*/ jsxRuntime.jsxs(Step.Root, {
|
|
278
|
+
content: (Step$1, { dispatch })=>/*#__PURE__*/ jsxRuntime.jsxs(Step$1.Root, {
|
|
256
279
|
side: "bottom",
|
|
257
280
|
align: "start",
|
|
281
|
+
sideOffset: -5,
|
|
258
282
|
children: [
|
|
259
|
-
/*#__PURE__*/ jsxRuntime.jsx(Step.Title, {
|
|
283
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step$1.Title, {
|
|
260
284
|
id: "tours.apiTokens.CopyAPIToken.title",
|
|
261
285
|
defaultMessage: "Copy your new API token"
|
|
262
286
|
}),
|
|
263
|
-
/*#__PURE__*/ jsxRuntime.jsx(Step.Content, {
|
|
287
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step$1.Content, {
|
|
264
288
|
id: "tours.apiTokens.CopyAPIToken.content",
|
|
265
289
|
defaultMessage: "Make sure to do it now, you won’t be able to see it again. You’ll need to generate a new one if you lose it."
|
|
266
290
|
}),
|
|
267
|
-
/*#__PURE__*/ jsxRuntime.
|
|
291
|
+
/*#__PURE__*/ jsxRuntime.jsxs(Step$1.Actions, {
|
|
292
|
+
children: [
|
|
293
|
+
/*#__PURE__*/ jsxRuntime.jsx(Step.StepCount, {
|
|
294
|
+
tourName: "apiTokens"
|
|
295
|
+
}),
|
|
296
|
+
/*#__PURE__*/ jsxRuntime.jsx(GotItAction, {
|
|
297
|
+
onClick: ()=>dispatch({
|
|
298
|
+
type: 'next_step',
|
|
299
|
+
payload: 'apiTokens'
|
|
300
|
+
})
|
|
301
|
+
})
|
|
302
|
+
]
|
|
303
|
+
})
|
|
268
304
|
]
|
|
269
305
|
}),
|
|
270
306
|
when: (completedActions)=>completedActions.includes('didCreateApiToken')
|
|
271
307
|
},
|
|
272
308
|
{
|
|
273
309
|
name: 'Finish',
|
|
274
|
-
content: (Step)
|
|
275
|
-
const dispatch = Context.unstableUseGuidedTour('GuidedTourPopover', (s)=>s.dispatch);
|
|
276
|
-
return /*#__PURE__*/ jsxRuntime.jsxs(Step.Root, {
|
|
310
|
+
content: (Step)=>/*#__PURE__*/ jsxRuntime.jsxs(Step.Root, {
|
|
277
311
|
side: "right",
|
|
278
312
|
align: "start",
|
|
279
|
-
sideOffset: 32,
|
|
280
313
|
children: [
|
|
281
314
|
/*#__PURE__*/ jsxRuntime.jsx(Step.Title, {
|
|
282
315
|
id: "tours.apiTokens.FinalStep.title",
|
|
@@ -288,28 +321,10 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
288
321
|
}),
|
|
289
322
|
/*#__PURE__*/ jsxRuntime.jsx(Step.Actions, {
|
|
290
323
|
showStepCount: false,
|
|
291
|
-
|
|
292
|
-
justifyContent: "end",
|
|
293
|
-
width: '100%',
|
|
294
|
-
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.LinkButton, {
|
|
295
|
-
onClick: ()=>{
|
|
296
|
-
dispatch({
|
|
297
|
-
type: 'next_step',
|
|
298
|
-
payload: 'apiTokens'
|
|
299
|
-
});
|
|
300
|
-
},
|
|
301
|
-
tag: reactRouterDom.NavLink,
|
|
302
|
-
to: "/",
|
|
303
|
-
children: /*#__PURE__*/ jsxRuntime.jsx(reactIntl.FormattedMessage, {
|
|
304
|
-
id: "tours.gotIt",
|
|
305
|
-
defaultMessage: "Got it"
|
|
306
|
-
})
|
|
307
|
-
})
|
|
308
|
-
})
|
|
324
|
+
to: "/"
|
|
309
325
|
})
|
|
310
326
|
]
|
|
311
|
-
})
|
|
312
|
-
},
|
|
327
|
+
}),
|
|
313
328
|
when: (completedActions)=>completedActions.includes('didCopyApiToken')
|
|
314
329
|
}
|
|
315
330
|
]),
|