@strapi/admin 5.36.1 → 5.37.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.
- package/dist/admin/admin/src/components/Layouts/ActionLayout.js +41 -8
- package/dist/admin/admin/src/components/Layouts/ActionLayout.js.map +1 -1
- package/dist/admin/admin/src/components/Layouts/ActionLayout.mjs +41 -8
- package/dist/admin/admin/src/components/Layouts/ActionLayout.mjs.map +1 -1
- package/dist/admin/admin/src/components/Layouts/Layout.js +4 -1
- package/dist/admin/admin/src/components/Layouts/Layout.js.map +1 -1
- package/dist/admin/admin/src/components/Layouts/Layout.mjs +4 -1
- package/dist/admin/admin/src/components/Layouts/Layout.mjs.map +1 -1
- package/dist/admin/admin/src/components/SearchInput.js +18 -5
- package/dist/admin/admin/src/components/SearchInput.js.map +1 -1
- package/dist/admin/admin/src/components/SearchInput.mjs +19 -6
- package/dist/admin/admin/src/components/SearchInput.mjs.map +1 -1
- package/dist/admin/admin/src/components/SubNav.js +6 -8
- package/dist/admin/admin/src/components/SubNav.js.map +1 -1
- package/dist/admin/admin/src/components/SubNav.mjs +7 -9
- package/dist/admin/admin/src/components/SubNav.mjs.map +1 -1
- package/dist/admin/admin/src/layouts/AuthenticatedLayout.js +3 -1
- package/dist/admin/admin/src/layouts/AuthenticatedLayout.js.map +1 -1
- package/dist/admin/admin/src/layouts/AuthenticatedLayout.mjs +3 -1
- package/dist/admin/admin/src/layouts/AuthenticatedLayout.mjs.map +1 -1
- package/dist/admin/src/components/Layouts/ActionLayout.d.ts +2 -1
- package/dist/admin/src/components/Layouts/Layout.d.ts +1 -1
- package/dist/server/server/src/services/permission/permissions-manager/sanitize.js +44 -30
- package/dist/server/server/src/services/permission/permissions-manager/sanitize.js.map +1 -1
- package/dist/server/server/src/services/permission/permissions-manager/sanitize.mjs +45 -31
- package/dist/server/server/src/services/permission/permissions-manager/sanitize.mjs.map +1 -1
- package/dist/server/server/src/services/permission/permissions-manager/validate.js +37 -16
- package/dist/server/server/src/services/permission/permissions-manager/validate.js.map +1 -1
- package/dist/server/server/src/services/permission/permissions-manager/validate.mjs +38 -17
- package/dist/server/server/src/services/permission/permissions-manager/validate.mjs.map +1 -1
- package/dist/server/src/services/permission/permissions-manager/sanitize.d.ts.map +1 -1
- package/dist/server/src/services/permission/permissions-manager/validate.d.ts.map +1 -1
- package/package.json +8 -8
|
@@ -3,36 +3,69 @@
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
require('react');
|
|
5
5
|
var designSystem = require('@strapi/design-system');
|
|
6
|
+
var styled = require('styled-components');
|
|
6
7
|
var theme = require('../../constants/theme.js');
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
/** On mobile: first item stays left, rest stick to the right (margin-right: auto on first child). */ const EndActionsFlex = styled.styled(designSystem.Flex)`
|
|
10
|
+
width: 100%;
|
|
11
|
+
& > *:first-child {
|
|
12
|
+
margin-right: auto;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
${({ theme })=>theme.breakpoints.medium} {
|
|
16
|
+
width: auto;
|
|
17
|
+
& > *:first-child {
|
|
18
|
+
margin-right: 0;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
22
|
+
const ActionLayout = ({ startActions, endActions, bottomActions })=>{
|
|
9
23
|
if (!startActions && !endActions) {
|
|
10
24
|
return null;
|
|
11
25
|
}
|
|
12
26
|
return /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
|
|
13
|
-
|
|
27
|
+
direction: {
|
|
28
|
+
initial: 'column',
|
|
29
|
+
medium: 'row'
|
|
30
|
+
},
|
|
31
|
+
gap: {
|
|
32
|
+
initial: 4,
|
|
33
|
+
medium: 3
|
|
34
|
+
},
|
|
14
35
|
alignItems: "flex-start",
|
|
15
36
|
paddingBottom: {
|
|
16
37
|
initial: 2,
|
|
17
38
|
medium: 4
|
|
18
39
|
},
|
|
19
|
-
paddingTop:
|
|
20
|
-
initial: 4,
|
|
21
|
-
medium: 0
|
|
22
|
-
},
|
|
40
|
+
paddingTop: 0,
|
|
23
41
|
paddingLeft: theme.RESPONSIVE_DEFAULT_SPACING,
|
|
24
42
|
paddingRight: theme.RESPONSIVE_DEFAULT_SPACING,
|
|
43
|
+
wrap: {
|
|
44
|
+
initial: 'nowrap',
|
|
45
|
+
medium: 'wrap'
|
|
46
|
+
},
|
|
25
47
|
children: [
|
|
26
48
|
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Flex, {
|
|
27
49
|
gap: 2,
|
|
28
50
|
wrap: "wrap",
|
|
51
|
+
flex: 1,
|
|
52
|
+
width: "100%",
|
|
29
53
|
children: startActions
|
|
30
54
|
}),
|
|
31
|
-
/*#__PURE__*/ jsxRuntime.jsx(
|
|
32
|
-
gap:
|
|
55
|
+
/*#__PURE__*/ jsxRuntime.jsx(EndActionsFlex, {
|
|
56
|
+
gap: {
|
|
57
|
+
initial: 3,
|
|
58
|
+
medium: 2
|
|
59
|
+
},
|
|
33
60
|
shrink: 0,
|
|
34
61
|
wrap: "wrap",
|
|
35
62
|
children: endActions
|
|
63
|
+
}),
|
|
64
|
+
bottomActions && /*#__PURE__*/ jsxRuntime.jsx(designSystem.Flex, {
|
|
65
|
+
gap: 2,
|
|
66
|
+
wrap: "wrap",
|
|
67
|
+
width: "100%",
|
|
68
|
+
children: bottomActions
|
|
36
69
|
})
|
|
37
70
|
]
|
|
38
71
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionLayout.js","sources":["../../../../../../admin/src/components/Layouts/ActionLayout.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Flex } from '@strapi/design-system';\n\nimport { RESPONSIVE_DEFAULT_SPACING } from '../../constants/theme';\n\ninterface ActionLayoutProps {\n endActions?: React.ReactNode;\n startActions?: React.ReactNode;\n}\n\nconst ActionLayout = ({ startActions, endActions }: ActionLayoutProps) => {\n if (!startActions && !endActions) {\n return null;\n }\n\n return (\n <Flex\n
|
|
1
|
+
{"version":3,"file":"ActionLayout.js","sources":["../../../../../../admin/src/components/Layouts/ActionLayout.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Flex } from '@strapi/design-system';\nimport { styled } from 'styled-components';\n\nimport { RESPONSIVE_DEFAULT_SPACING } from '../../constants/theme';\n\n/** On mobile: first item stays left, rest stick to the right (margin-right: auto on first child). */\nconst EndActionsFlex = styled(Flex)`\n width: 100%;\n & > *:first-child {\n margin-right: auto;\n }\n\n ${({ theme }) => theme.breakpoints.medium} {\n width: auto;\n & > *:first-child {\n margin-right: 0;\n }\n }\n`;\n\ninterface ActionLayoutProps {\n endActions?: React.ReactNode;\n startActions?: React.ReactNode;\n bottomActions?: React.ReactNode;\n}\n\nconst ActionLayout = ({ startActions, endActions, bottomActions }: ActionLayoutProps) => {\n if (!startActions && !endActions) {\n return null;\n }\n\n return (\n <Flex\n direction={{ initial: 'column', medium: 'row' }}\n gap={{ initial: 4, medium: 3 }}\n alignItems=\"flex-start\"\n paddingBottom={{ initial: 2, medium: 4 }}\n paddingTop={0}\n paddingLeft={RESPONSIVE_DEFAULT_SPACING}\n paddingRight={RESPONSIVE_DEFAULT_SPACING}\n wrap={{ initial: 'nowrap', medium: 'wrap' }}\n >\n <Flex gap={2} wrap=\"wrap\" flex={1} width=\"100%\">\n {startActions}\n </Flex>\n <EndActionsFlex gap={{ initial: 3, medium: 2 }} shrink={0} wrap=\"wrap\">\n {endActions}\n </EndActionsFlex>\n {bottomActions && (\n <Flex gap={2} wrap=\"wrap\" width=\"100%\">\n {bottomActions}\n </Flex>\n )}\n </Flex>\n );\n};\n\nexport { ActionLayout, type ActionLayoutProps };\n"],"names":["EndActionsFlex","styled","Flex","theme","breakpoints","medium","ActionLayout","startActions","endActions","bottomActions","_jsxs","direction","initial","gap","alignItems","paddingBottom","paddingTop","paddingLeft","RESPONSIVE_DEFAULT_SPACING","paddingRight","wrap","_jsx","flex","width","shrink"],"mappings":";;;;;;;;AAOA,sGACA,MAAMA,cAAiBC,G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AAGO,IAAK,EAAA,MAAA;gBAAOG,KAAM,EAAA,MAAA;AAC7Bd,gBAAAA,QAAAA,EAAAA;;;;AAKX;;;;"}
|
|
@@ -1,36 +1,69 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import 'react';
|
|
3
3
|
import { Flex } from '@strapi/design-system';
|
|
4
|
+
import { styled } from 'styled-components';
|
|
4
5
|
import { RESPONSIVE_DEFAULT_SPACING } from '../../constants/theme.mjs';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
/** On mobile: first item stays left, rest stick to the right (margin-right: auto on first child). */ const EndActionsFlex = styled(Flex)`
|
|
8
|
+
width: 100%;
|
|
9
|
+
& > *:first-child {
|
|
10
|
+
margin-right: auto;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
${({ theme })=>theme.breakpoints.medium} {
|
|
14
|
+
width: auto;
|
|
15
|
+
& > *:first-child {
|
|
16
|
+
margin-right: 0;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
const ActionLayout = ({ startActions, endActions, bottomActions })=>{
|
|
7
21
|
if (!startActions && !endActions) {
|
|
8
22
|
return null;
|
|
9
23
|
}
|
|
10
24
|
return /*#__PURE__*/ jsxs(Flex, {
|
|
11
|
-
|
|
25
|
+
direction: {
|
|
26
|
+
initial: 'column',
|
|
27
|
+
medium: 'row'
|
|
28
|
+
},
|
|
29
|
+
gap: {
|
|
30
|
+
initial: 4,
|
|
31
|
+
medium: 3
|
|
32
|
+
},
|
|
12
33
|
alignItems: "flex-start",
|
|
13
34
|
paddingBottom: {
|
|
14
35
|
initial: 2,
|
|
15
36
|
medium: 4
|
|
16
37
|
},
|
|
17
|
-
paddingTop:
|
|
18
|
-
initial: 4,
|
|
19
|
-
medium: 0
|
|
20
|
-
},
|
|
38
|
+
paddingTop: 0,
|
|
21
39
|
paddingLeft: RESPONSIVE_DEFAULT_SPACING,
|
|
22
40
|
paddingRight: RESPONSIVE_DEFAULT_SPACING,
|
|
41
|
+
wrap: {
|
|
42
|
+
initial: 'nowrap',
|
|
43
|
+
medium: 'wrap'
|
|
44
|
+
},
|
|
23
45
|
children: [
|
|
24
46
|
/*#__PURE__*/ jsx(Flex, {
|
|
25
47
|
gap: 2,
|
|
26
48
|
wrap: "wrap",
|
|
49
|
+
flex: 1,
|
|
50
|
+
width: "100%",
|
|
27
51
|
children: startActions
|
|
28
52
|
}),
|
|
29
|
-
/*#__PURE__*/ jsx(
|
|
30
|
-
gap:
|
|
53
|
+
/*#__PURE__*/ jsx(EndActionsFlex, {
|
|
54
|
+
gap: {
|
|
55
|
+
initial: 3,
|
|
56
|
+
medium: 2
|
|
57
|
+
},
|
|
31
58
|
shrink: 0,
|
|
32
59
|
wrap: "wrap",
|
|
33
60
|
children: endActions
|
|
61
|
+
}),
|
|
62
|
+
bottomActions && /*#__PURE__*/ jsx(Flex, {
|
|
63
|
+
gap: 2,
|
|
64
|
+
wrap: "wrap",
|
|
65
|
+
width: "100%",
|
|
66
|
+
children: bottomActions
|
|
34
67
|
})
|
|
35
68
|
]
|
|
36
69
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionLayout.mjs","sources":["../../../../../../admin/src/components/Layouts/ActionLayout.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Flex } from '@strapi/design-system';\n\nimport { RESPONSIVE_DEFAULT_SPACING } from '../../constants/theme';\n\ninterface ActionLayoutProps {\n endActions?: React.ReactNode;\n startActions?: React.ReactNode;\n}\n\nconst ActionLayout = ({ startActions, endActions }: ActionLayoutProps) => {\n if (!startActions && !endActions) {\n return null;\n }\n\n return (\n <Flex\n
|
|
1
|
+
{"version":3,"file":"ActionLayout.mjs","sources":["../../../../../../admin/src/components/Layouts/ActionLayout.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Flex } from '@strapi/design-system';\nimport { styled } from 'styled-components';\n\nimport { RESPONSIVE_DEFAULT_SPACING } from '../../constants/theme';\n\n/** On mobile: first item stays left, rest stick to the right (margin-right: auto on first child). */\nconst EndActionsFlex = styled(Flex)`\n width: 100%;\n & > *:first-child {\n margin-right: auto;\n }\n\n ${({ theme }) => theme.breakpoints.medium} {\n width: auto;\n & > *:first-child {\n margin-right: 0;\n }\n }\n`;\n\ninterface ActionLayoutProps {\n endActions?: React.ReactNode;\n startActions?: React.ReactNode;\n bottomActions?: React.ReactNode;\n}\n\nconst ActionLayout = ({ startActions, endActions, bottomActions }: ActionLayoutProps) => {\n if (!startActions && !endActions) {\n return null;\n }\n\n return (\n <Flex\n direction={{ initial: 'column', medium: 'row' }}\n gap={{ initial: 4, medium: 3 }}\n alignItems=\"flex-start\"\n paddingBottom={{ initial: 2, medium: 4 }}\n paddingTop={0}\n paddingLeft={RESPONSIVE_DEFAULT_SPACING}\n paddingRight={RESPONSIVE_DEFAULT_SPACING}\n wrap={{ initial: 'nowrap', medium: 'wrap' }}\n >\n <Flex gap={2} wrap=\"wrap\" flex={1} width=\"100%\">\n {startActions}\n </Flex>\n <EndActionsFlex gap={{ initial: 3, medium: 2 }} shrink={0} wrap=\"wrap\">\n {endActions}\n </EndActionsFlex>\n {bottomActions && (\n <Flex gap={2} wrap=\"wrap\" width=\"100%\">\n {bottomActions}\n </Flex>\n )}\n </Flex>\n );\n};\n\nexport { ActionLayout, type ActionLayoutProps };\n"],"names":["EndActionsFlex","styled","Flex","theme","breakpoints","medium","ActionLayout","startActions","endActions","bottomActions","_jsxs","direction","initial","gap","alignItems","paddingBottom","paddingTop","paddingLeft","RESPONSIVE_DEFAULT_SPACING","paddingRight","wrap","_jsx","flex","width","shrink"],"mappings":";;;;;;AAOA,sGACA,MAAMA,cAAiBC,GAAAA,MAAAA,CAAOC,KAAK;;;;;;EAMjC,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAKA,KAAMC,CAAAA,WAAW,CAACC,MAAM,CAAC;;;;;;AAM5C,CAAC;AAQKC,MAAAA,YAAAA,GAAe,CAAC,EAAEC,YAAY,E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|
|
12
12
|
|
|
13
13
|
const GridContainer = styled.styled(designSystem.Box)`
|
|
14
|
-
|
|
14
|
+
width: 100%;
|
|
15
|
+
flex: 1;
|
|
15
16
|
display: grid;
|
|
16
17
|
grid-template-columns: 1fr;
|
|
17
18
|
padding: 0;
|
|
18
19
|
|
|
19
20
|
${({ theme })=>theme.breakpoints.medium} {
|
|
21
|
+
overflow: hidden;
|
|
20
22
|
grid-template-columns: ${({ $hasSideNav })=>$hasSideNav ? `auto 1fr` : '1fr'};
|
|
21
23
|
}
|
|
22
24
|
`;
|
|
23
25
|
const SideNavContainer = styled.styled(designSystem.Flex)`
|
|
26
|
+
overflow: hidden;
|
|
24
27
|
display: none;
|
|
25
28
|
background: ${({ theme })=>theme.colors.neutral0};
|
|
26
29
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layout.js","sources":["../../../../../../admin/src/components/Layouts/Layout.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Box, BoxProps, Flex } from '@strapi/design-system';\nimport { styled } from 'styled-components';\n\nimport { RESPONSIVE_DEFAULT_SPACING } from '../../constants/theme';\n\nimport { ActionLayout } from './ActionLayout';\nimport { ContentLayout } from './ContentLayout';\nimport { GridLayout, GridLayoutProps } from './GridLayout';\nimport { HeaderLayout, BaseHeaderLayout } from './HeaderLayout';\n\ninterface LayoutProps extends BoxProps {\n children: React.ReactNode;\n sideNav?: React.ReactNode;\n}\n\nconst GridContainer = styled(Box)<{ $hasSideNav: boolean }>`\n
|
|
1
|
+
{"version":3,"file":"Layout.js","sources":["../../../../../../admin/src/components/Layouts/Layout.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Box, BoxProps, Flex } from '@strapi/design-system';\nimport { styled } from 'styled-components';\n\nimport { RESPONSIVE_DEFAULT_SPACING } from '../../constants/theme';\n\nimport { ActionLayout } from './ActionLayout';\nimport { ContentLayout } from './ContentLayout';\nimport { GridLayout, GridLayoutProps } from './GridLayout';\nimport { HeaderLayout, BaseHeaderLayout } from './HeaderLayout';\n\ninterface LayoutProps extends BoxProps {\n children: React.ReactNode;\n sideNav?: React.ReactNode;\n}\n\nconst GridContainer = styled(Box)<{ $hasSideNav: boolean }>`\n width: 100%;\n flex: 1;\n display: grid;\n grid-template-columns: 1fr;\n padding: 0;\n\n ${({ theme }) => theme.breakpoints.medium} {\n overflow: hidden;\n grid-template-columns: ${({ $hasSideNav }) => ($hasSideNav ? `auto 1fr` : '1fr')};\n }\n`;\n\nconst SideNavContainer = styled(Flex)`\n overflow: hidden;\n display: none;\n background: ${({ theme }) => theme.colors.neutral0};\n\n ${({ theme }) => theme.breakpoints.medium} {\n display: block;\n box-shadow: none;\n transform: none;\n }\n`;\n\nconst OverflowingItem = styled(Box)`\n overflow-x: hidden;\n\n ${({ theme }) => theme.breakpoints.medium} {\n transform: none;\n width: auto;\n }\n`;\n\nconst RootLayout = ({ sideNav, children, ...restProps }: LayoutProps) => (\n <GridContainer $hasSideNav={Boolean(sideNav)} {...restProps}>\n {sideNav && <SideNavContainer>{sideNav}</SideNavContainer>}\n <OverflowingItem paddingBottom={RESPONSIVE_DEFAULT_SPACING} data-strapi-main-content>\n {children}\n </OverflowingItem>\n </GridContainer>\n);\n\nconst Layouts = {\n Root: RootLayout,\n Header: HeaderLayout,\n BaseHeader: BaseHeaderLayout,\n Grid: GridLayout,\n Action: ActionLayout,\n Content: ContentLayout,\n};\n\nexport { Layouts, type LayoutProps, type GridLayoutProps };\n"],"names":["GridContainer","styled","Box","theme","breakpoints","medium","$hasSideNav","SideNavContainer","Flex","colors","neutral0","OverflowingItem","RootLayout","sideNav","children","restProps","_jsxs","Boolean","_jsx","paddingBottom","RESPONSIVE_DEFAULT_SPACING","data-strapi-main-content","Layouts","Root","Header","HeaderLayout","BaseHeader","BaseHeaderLayout","Grid","GridLayout","Action","ActionLayout","Content","ContentLayout"],"mappings":";;;;;;;;;;;;AAiBA,MAAMA,aAAAA,GAAgBC,aAAOC,CAAAA,gBAAAA,CAA8B;;;;;;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}
|
|
@@ -9,16 +9,19 @@ import { GridLayout } from './GridLayout.mjs';
|
|
|
9
9
|
import { HeaderLayout, BaseHeaderLayout } from './HeaderLayout.mjs';
|
|
10
10
|
|
|
11
11
|
const GridContainer = styled(Box)`
|
|
12
|
-
|
|
12
|
+
width: 100%;
|
|
13
|
+
flex: 1;
|
|
13
14
|
display: grid;
|
|
14
15
|
grid-template-columns: 1fr;
|
|
15
16
|
padding: 0;
|
|
16
17
|
|
|
17
18
|
${({ theme })=>theme.breakpoints.medium} {
|
|
19
|
+
overflow: hidden;
|
|
18
20
|
grid-template-columns: ${({ $hasSideNav })=>$hasSideNav ? `auto 1fr` : '1fr'};
|
|
19
21
|
}
|
|
20
22
|
`;
|
|
21
23
|
const SideNavContainer = styled(Flex)`
|
|
24
|
+
overflow: hidden;
|
|
22
25
|
display: none;
|
|
23
26
|
background: ${({ theme })=>theme.colors.neutral0};
|
|
24
27
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layout.mjs","sources":["../../../../../../admin/src/components/Layouts/Layout.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Box, BoxProps, Flex } from '@strapi/design-system';\nimport { styled } from 'styled-components';\n\nimport { RESPONSIVE_DEFAULT_SPACING } from '../../constants/theme';\n\nimport { ActionLayout } from './ActionLayout';\nimport { ContentLayout } from './ContentLayout';\nimport { GridLayout, GridLayoutProps } from './GridLayout';\nimport { HeaderLayout, BaseHeaderLayout } from './HeaderLayout';\n\ninterface LayoutProps extends BoxProps {\n children: React.ReactNode;\n sideNav?: React.ReactNode;\n}\n\nconst GridContainer = styled(Box)<{ $hasSideNav: boolean }>`\n
|
|
1
|
+
{"version":3,"file":"Layout.mjs","sources":["../../../../../../admin/src/components/Layouts/Layout.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Box, BoxProps, Flex } from '@strapi/design-system';\nimport { styled } from 'styled-components';\n\nimport { RESPONSIVE_DEFAULT_SPACING } from '../../constants/theme';\n\nimport { ActionLayout } from './ActionLayout';\nimport { ContentLayout } from './ContentLayout';\nimport { GridLayout, GridLayoutProps } from './GridLayout';\nimport { HeaderLayout, BaseHeaderLayout } from './HeaderLayout';\n\ninterface LayoutProps extends BoxProps {\n children: React.ReactNode;\n sideNav?: React.ReactNode;\n}\n\nconst GridContainer = styled(Box)<{ $hasSideNav: boolean }>`\n width: 100%;\n flex: 1;\n display: grid;\n grid-template-columns: 1fr;\n padding: 0;\n\n ${({ theme }) => theme.breakpoints.medium} {\n overflow: hidden;\n grid-template-columns: ${({ $hasSideNav }) => ($hasSideNav ? `auto 1fr` : '1fr')};\n }\n`;\n\nconst SideNavContainer = styled(Flex)`\n overflow: hidden;\n display: none;\n background: ${({ theme }) => theme.colors.neutral0};\n\n ${({ theme }) => theme.breakpoints.medium} {\n display: block;\n box-shadow: none;\n transform: none;\n }\n`;\n\nconst OverflowingItem = styled(Box)`\n overflow-x: hidden;\n\n ${({ theme }) => theme.breakpoints.medium} {\n transform: none;\n width: auto;\n }\n`;\n\nconst RootLayout = ({ sideNav, children, ...restProps }: LayoutProps) => (\n <GridContainer $hasSideNav={Boolean(sideNav)} {...restProps}>\n {sideNav && <SideNavContainer>{sideNav}</SideNavContainer>}\n <OverflowingItem paddingBottom={RESPONSIVE_DEFAULT_SPACING} data-strapi-main-content>\n {children}\n </OverflowingItem>\n </GridContainer>\n);\n\nconst Layouts = {\n Root: RootLayout,\n Header: HeaderLayout,\n BaseHeader: BaseHeaderLayout,\n Grid: GridLayout,\n Action: ActionLayout,\n Content: ContentLayout,\n};\n\nexport { Layouts, type LayoutProps, type GridLayoutProps };\n"],"names":["GridContainer","styled","Box","theme","breakpoints","medium","$hasSideNav","SideNavContainer","Flex","colors","neutral0","OverflowingItem","RootLayout","sideNav","children","restProps","_jsxs","Boolean","_jsx","paddingBottom","RESPONSIVE_DEFAULT_SPACING","data-strapi-main-content","Layouts","Root","Header","HeaderLayout","BaseHeader","BaseHeaderLayout","Grid","GridLayout","Action","ActionLayout","Content","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;IACZC,IAAMC,EAAAA,UAAAA;IACNC,MAAQC,EAAAA,YAAAA;IACRC,OAASC,EAAAA;AACX;;;;"}
|
|
@@ -6,6 +6,7 @@ var designSystem = require('@strapi/design-system');
|
|
|
6
6
|
var icons = require('@strapi/icons');
|
|
7
7
|
var reactIntl = require('react-intl');
|
|
8
8
|
var Tracking = require('../features/Tracking.js');
|
|
9
|
+
var useMediaQuery = require('../hooks/useMediaQuery.js');
|
|
9
10
|
var useQueryParams = require('../hooks/useQueryParams.js');
|
|
10
11
|
|
|
11
12
|
function _interopNamespaceDefault(e) {
|
|
@@ -35,6 +36,7 @@ const SearchInput = ({ disabled, label, placeholder, trackedEvent, trackedEventD
|
|
|
35
36
|
const [isOpen, setIsOpen] = React__namespace.useState(!!value);
|
|
36
37
|
const { formatMessage } = reactIntl.useIntl();
|
|
37
38
|
const { trackUsage } = Tracking.useTracking();
|
|
39
|
+
const isMobile = useMediaQuery.useIsMobile();
|
|
38
40
|
const handleToggle = ()=>setIsOpen((prev)=>!prev);
|
|
39
41
|
React__namespace.useLayoutEffect(()=>{
|
|
40
42
|
if (isOpen && inputRef.current) {
|
|
@@ -67,8 +69,7 @@ const SearchInput = ({ disabled, label, placeholder, trackedEvent, trackedEventD
|
|
|
67
69
|
}, 'remove');
|
|
68
70
|
}
|
|
69
71
|
};
|
|
70
|
-
|
|
71
|
-
return /*#__PURE__*/ jsxRuntime.jsx(designSystem.SearchForm, {
|
|
72
|
+
const renderSearchForm = (opts)=>/*#__PURE__*/ jsxRuntime.jsx(designSystem.SearchForm, {
|
|
72
73
|
onSubmit: handleSubmit,
|
|
73
74
|
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Searchbar, {
|
|
74
75
|
ref: inputRef,
|
|
@@ -80,15 +81,27 @@ const SearchInput = ({ disabled, label, placeholder, trackedEvent, trackedEventD
|
|
|
80
81
|
defaultMessage: 'Clear'
|
|
81
82
|
}),
|
|
82
83
|
onClear: handleClear,
|
|
83
|
-
placeholder: placeholder,
|
|
84
|
-
|
|
84
|
+
placeholder: isMobile ? undefined : placeholder,
|
|
85
|
+
disabled: disabled,
|
|
86
|
+
onBlur: opts?.enableBlurClose ? (e)=>{
|
|
85
87
|
if (!e.currentTarget.contains(e.relatedTarget) && e.currentTarget.value === '') {
|
|
86
88
|
setIsOpen(false);
|
|
87
89
|
}
|
|
88
|
-
},
|
|
90
|
+
} : undefined,
|
|
89
91
|
children: label
|
|
90
92
|
})
|
|
91
93
|
});
|
|
94
|
+
if (isMobile) {
|
|
95
|
+
// Add wrapper so that the Searchbar takes up the rest of the available space.
|
|
96
|
+
return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
|
|
97
|
+
width: "100%",
|
|
98
|
+
children: renderSearchForm()
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
if (isOpen) {
|
|
102
|
+
return renderSearchForm({
|
|
103
|
+
enableBlurClose: true
|
|
104
|
+
});
|
|
92
105
|
}
|
|
93
106
|
return /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
|
|
94
107
|
ref: iconButtonRef,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchInput.js","sources":["../../../../../admin/src/components/SearchInput.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { IconButton, Searchbar, SearchForm } from '@strapi/design-system';\nimport { Search as SearchIcon } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\n\nimport { TrackingEvent, useTracking } from '../features/Tracking';\nimport { useQueryParams } from '../hooks/useQueryParams';\n\ninterface SearchInputProps {\n disabled?: boolean;\n label: string;\n placeholder?: string;\n trackedEvent?: TrackingEvent['name'] | null;\n trackedEventDetails?: TrackingEvent['properties'];\n}\n\nconst SearchInput = ({\n disabled,\n label,\n placeholder,\n trackedEvent,\n trackedEventDetails,\n}: SearchInputProps) => {\n const inputRef = React.useRef<HTMLInputElement>(null);\n const iconButtonRef = React.useRef<HTMLButtonElement>(null);\n\n const [{ query }, setQuery] = useQueryParams<{ _q: string; page?: number }>();\n\n const [value, setValue] = React.useState(query?._q || '');\n const [isOpen, setIsOpen] = React.useState(!!value);\n\n const { formatMessage } = useIntl();\n const { trackUsage } = useTracking();\n\n const handleToggle = () => setIsOpen((prev) => !prev);\n\n React.useLayoutEffect(() => {\n if (isOpen && inputRef.current) {\n inputRef.current.focus();\n }\n }, [isOpen]);\n\n const handleClear = () => {\n setValue('');\n setQuery({ _q: '' }, 'remove');\n };\n\n const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {\n e.preventDefault();\n\n // Ensure value is a string\n if (value) {\n if (trackedEvent) {\n trackUsage(trackedEvent, trackedEventDetails);\n }\n setQuery({ _q: encodeURIComponent(value), page: 1 });\n } else {\n handleToggle();\n setQuery({ _q: '' }, 'remove');\n }\n };\n\n
|
|
1
|
+
{"version":3,"file":"SearchInput.js","sources":["../../../../../admin/src/components/SearchInput.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Box, IconButton, Searchbar, SearchForm } from '@strapi/design-system';\nimport { Search as SearchIcon } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\n\nimport { TrackingEvent, useTracking } from '../features/Tracking';\nimport { useIsMobile } from '../hooks/useMediaQuery';\nimport { useQueryParams } from '../hooks/useQueryParams';\n\ninterface SearchInputProps {\n disabled?: boolean;\n label: string;\n placeholder?: string;\n trackedEvent?: TrackingEvent['name'] | null;\n trackedEventDetails?: TrackingEvent['properties'];\n}\n\nconst SearchInput = ({\n disabled,\n label,\n placeholder,\n trackedEvent,\n trackedEventDetails,\n}: SearchInputProps) => {\n const inputRef = React.useRef<HTMLInputElement>(null);\n const iconButtonRef = React.useRef<HTMLButtonElement>(null);\n\n const [{ query }, setQuery] = useQueryParams<{ _q: string; page?: number }>();\n\n const [value, setValue] = React.useState(query?._q || '');\n const [isOpen, setIsOpen] = React.useState(!!value);\n\n const { formatMessage } = useIntl();\n const { trackUsage } = useTracking();\n const isMobile = useIsMobile();\n\n const handleToggle = () => setIsOpen((prev) => !prev);\n\n React.useLayoutEffect(() => {\n if (isOpen && inputRef.current) {\n inputRef.current.focus();\n }\n }, [isOpen]);\n\n const handleClear = () => {\n setValue('');\n setQuery({ _q: '' }, 'remove');\n };\n\n const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {\n e.preventDefault();\n\n // Ensure value is a string\n if (value) {\n if (trackedEvent) {\n trackUsage(trackedEvent, trackedEventDetails);\n }\n setQuery({ _q: encodeURIComponent(value), page: 1 });\n } else {\n handleToggle();\n setQuery({ _q: '' }, 'remove');\n }\n };\n\n const renderSearchForm = (opts?: { enableBlurClose?: boolean }) => (\n <SearchForm onSubmit={handleSubmit}>\n <Searchbar\n ref={inputRef}\n name=\"search\"\n onChange={(e) => setValue(e.target.value)}\n value={value}\n clearLabel={formatMessage({ id: 'clearLabel', defaultMessage: 'Clear' })}\n onClear={handleClear}\n placeholder={isMobile ? undefined : placeholder}\n disabled={disabled}\n onBlur={\n opts?.enableBlurClose\n ? (e) => {\n if (!e.currentTarget.contains(e.relatedTarget) && e.currentTarget.value === '') {\n setIsOpen(false);\n }\n }\n : undefined\n }\n >\n {label}\n </Searchbar>\n </SearchForm>\n );\n\n if (isMobile) {\n // Add wrapper so that the Searchbar takes up the rest of the available space.\n return <Box width=\"100%\">{renderSearchForm()}</Box>;\n }\n\n if (isOpen) {\n return renderSearchForm({ enableBlurClose: true });\n }\n\n return (\n <IconButton\n ref={iconButtonRef}\n disabled={disabled}\n label={formatMessage({ id: 'global.search', defaultMessage: 'Search' })}\n onClick={handleToggle}\n >\n <SearchIcon />\n </IconButton>\n );\n};\n\nexport { SearchInput };\nexport type { SearchInputProps };\n"],"names":["SearchInput","disabled","label","placeholder","trackedEvent","trackedEventDetails","inputRef","React","useRef","iconButtonRef","query","setQuery","useQueryParams","value","setValue","useState","_q","isOpen","setIsOpen","formatMessage","useIntl","trackUsage","useTracking","isMobile","useIsMobile","handleToggle","prev","useLayoutEffect","current","focus","handleClear","handleSubmit","e","preventDefault","encodeURIComponent","page","renderSearchForm","opts","_jsx","SearchForm","onSubmit","Searchbar","ref","name","onChange","target","clearLabel","id","defaultMessage","onClear","undefined","onBlur","enableBlurClose","currentTarget","contains","relatedTarget","Box","width","IconButton","onClick","SearchIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAMA,WAAc,GAAA,CAAC,EACnBC,QAAQ,EACRC,KAAK,EACLC,WAAW,EACXC,YAAY,EACZC,mBAAmB,EACF,GAAA;IACjB,MAAMC,QAAAA,GAAWC,gBAAMC,CAAAA,MAAM,CAAmB,IAAA,CAAA;IAChD,MAAMC,aAAAA,GAAgBF,gBAAMC,CAAAA,MAAM,CAAoB,IAAA,CAAA;AAEtD,IAAA,MAAM,CAAC,EAAEE,KAAK,EAAE,EAAEC,SAAS,GAAGC,6BAAAA,EAAAA;IAE9B,MAAM,CAACC,OAAOC,QAAS,CAAA,GAAGP,iBAAMQ,QAAQ,CAACL,OAAOM,EAAM,IAAA,EAAA,CAAA;IACtD,MAAM,CAACC,QAAQC,SAAU,CAAA,GAAGX,iBAAMQ,QAAQ,CAAC,CAAC,CAACF,KAAAA,CAAAA;IAE7C,MAAM,EAAEM,aAAa,EAAE,GAAGC,iBAAAA,EAAAA;IAC1B,MAAM,EAAEC,UAAU,EAAE,GAAGC,oBAAAA,EAAAA;AACvB,IAAA,MAAMC,QAAWC,GAAAA,yBAAAA,EAAAA;AAEjB,IAAA,MAAMC,YAAe,GAAA,IAAMP,SAAU,CAAA,CAACQ,OAAS,CAACA,IAAAA,CAAAA;AAEhDnB,IAAAA,gBAAAA,CAAMoB,eAAe,CAAC,IAAA;QACpB,IAAIV,MAAAA,IAAUX,QAASsB,CAAAA,OAAO,EAAE;YAC9BtB,QAASsB,CAAAA,OAAO,CAACC,KAAK,EAAA;AACxB;KACC,EAAA;AAACZ,QAAAA;AAAO,KAAA,CAAA;AAEX,IAAA,MAAMa,WAAc,GAAA,IAAA;QAClBhB,QAAS,CAAA,EAAA,CAAA;QACTH,QAAS,C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AAQ,CAACtB,CAAAA,CAAEuB,aAAa,CAAA,IAAKvB,CAAEqB,CAAAA,aAAa,CAACxC,KAAK,KAAK,EAAI,EAAA;wBAC9EK,SAAU,CAAA,KAAA,CAAA;AACZ;iBAEFgC,GAAAA,SAAAA;AAGLhD,gBAAAA,QAAAA,EAAAA;;;AAKP,IAAA,IAAIqB,QAAU,EAAA;;AAEZ,QAAA,qBAAOe,cAACkB,CAAAA,gBAAAA,EAAAA;YAAIC,KAAM,EAAA,MAAA;AAAQrB,YAAAA,QAAAA,EAAAA,gBAAAA;;AAC5B;AAEA,IAAA,IAAInB,MAAQ,EAAA;AACV,QAAA,OAAOmB,gBAAiB,CAAA;YAAEgB,eAAiB,EAAA;AAAK,SAAA,CAAA;AAClD;AAEA,IAAA,qBACEd,cAACoB,CAAAA,uBAAAA,EAAAA;QACChB,GAAKjC,EAAAA,aAAAA;QACLR,QAAUA,EAAAA,QAAAA;AACVC,QAAAA,KAAAA,EAAOiB,aAAc,CAAA;YAAE4B,EAAI,EAAA,eAAA;YAAiBC,cAAgB,EAAA;AAAS,SAAA,CAAA;QACrEW,OAASlC,EAAAA,YAAAA;AAET,QAAA,QAAA,gBAAAa,cAACsB,CAAAA,YAAAA,EAAAA,EAAAA;;AAGP;;;;"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { SearchForm, Searchbar
|
|
3
|
+
import { Box, IconButton, SearchForm, Searchbar } from '@strapi/design-system';
|
|
4
4
|
import { Search } from '@strapi/icons';
|
|
5
5
|
import { useIntl } from 'react-intl';
|
|
6
6
|
import { useTracking } from '../features/Tracking.mjs';
|
|
7
|
+
import { useIsMobile } from '../hooks/useMediaQuery.mjs';
|
|
7
8
|
import { useQueryParams } from '../hooks/useQueryParams.mjs';
|
|
8
9
|
|
|
9
10
|
const SearchInput = ({ disabled, label, placeholder, trackedEvent, trackedEventDetails })=>{
|
|
@@ -14,6 +15,7 @@ const SearchInput = ({ disabled, label, placeholder, trackedEvent, trackedEventD
|
|
|
14
15
|
const [isOpen, setIsOpen] = React.useState(!!value);
|
|
15
16
|
const { formatMessage } = useIntl();
|
|
16
17
|
const { trackUsage } = useTracking();
|
|
18
|
+
const isMobile = useIsMobile();
|
|
17
19
|
const handleToggle = ()=>setIsOpen((prev)=>!prev);
|
|
18
20
|
React.useLayoutEffect(()=>{
|
|
19
21
|
if (isOpen && inputRef.current) {
|
|
@@ -46,8 +48,7 @@ const SearchInput = ({ disabled, label, placeholder, trackedEvent, trackedEventD
|
|
|
46
48
|
}, 'remove');
|
|
47
49
|
}
|
|
48
50
|
};
|
|
49
|
-
|
|
50
|
-
return /*#__PURE__*/ jsx(SearchForm, {
|
|
51
|
+
const renderSearchForm = (opts)=>/*#__PURE__*/ jsx(SearchForm, {
|
|
51
52
|
onSubmit: handleSubmit,
|
|
52
53
|
children: /*#__PURE__*/ jsx(Searchbar, {
|
|
53
54
|
ref: inputRef,
|
|
@@ -59,15 +60,27 @@ const SearchInput = ({ disabled, label, placeholder, trackedEvent, trackedEventD
|
|
|
59
60
|
defaultMessage: 'Clear'
|
|
60
61
|
}),
|
|
61
62
|
onClear: handleClear,
|
|
62
|
-
placeholder: placeholder,
|
|
63
|
-
|
|
63
|
+
placeholder: isMobile ? undefined : placeholder,
|
|
64
|
+
disabled: disabled,
|
|
65
|
+
onBlur: opts?.enableBlurClose ? (e)=>{
|
|
64
66
|
if (!e.currentTarget.contains(e.relatedTarget) && e.currentTarget.value === '') {
|
|
65
67
|
setIsOpen(false);
|
|
66
68
|
}
|
|
67
|
-
},
|
|
69
|
+
} : undefined,
|
|
68
70
|
children: label
|
|
69
71
|
})
|
|
70
72
|
});
|
|
73
|
+
if (isMobile) {
|
|
74
|
+
// Add wrapper so that the Searchbar takes up the rest of the available space.
|
|
75
|
+
return /*#__PURE__*/ jsx(Box, {
|
|
76
|
+
width: "100%",
|
|
77
|
+
children: renderSearchForm()
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
if (isOpen) {
|
|
81
|
+
return renderSearchForm({
|
|
82
|
+
enableBlurClose: true
|
|
83
|
+
});
|
|
71
84
|
}
|
|
72
85
|
return /*#__PURE__*/ jsx(IconButton, {
|
|
73
86
|
ref: iconButtonRef,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchInput.mjs","sources":["../../../../../admin/src/components/SearchInput.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { IconButton, Searchbar, SearchForm } from '@strapi/design-system';\nimport { Search as SearchIcon } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\n\nimport { TrackingEvent, useTracking } from '../features/Tracking';\nimport { useQueryParams } from '../hooks/useQueryParams';\n\ninterface SearchInputProps {\n disabled?: boolean;\n label: string;\n placeholder?: string;\n trackedEvent?: TrackingEvent['name'] | null;\n trackedEventDetails?: TrackingEvent['properties'];\n}\n\nconst SearchInput = ({\n disabled,\n label,\n placeholder,\n trackedEvent,\n trackedEventDetails,\n}: SearchInputProps) => {\n const inputRef = React.useRef<HTMLInputElement>(null);\n const iconButtonRef = React.useRef<HTMLButtonElement>(null);\n\n const [{ query }, setQuery] = useQueryParams<{ _q: string; page?: number }>();\n\n const [value, setValue] = React.useState(query?._q || '');\n const [isOpen, setIsOpen] = React.useState(!!value);\n\n const { formatMessage } = useIntl();\n const { trackUsage } = useTracking();\n\n const handleToggle = () => setIsOpen((prev) => !prev);\n\n React.useLayoutEffect(() => {\n if (isOpen && inputRef.current) {\n inputRef.current.focus();\n }\n }, [isOpen]);\n\n const handleClear = () => {\n setValue('');\n setQuery({ _q: '' }, 'remove');\n };\n\n const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {\n e.preventDefault();\n\n // Ensure value is a string\n if (value) {\n if (trackedEvent) {\n trackUsage(trackedEvent, trackedEventDetails);\n }\n setQuery({ _q: encodeURIComponent(value), page: 1 });\n } else {\n handleToggle();\n setQuery({ _q: '' }, 'remove');\n }\n };\n\n
|
|
1
|
+
{"version":3,"file":"SearchInput.mjs","sources":["../../../../../admin/src/components/SearchInput.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Box, IconButton, Searchbar, SearchForm } from '@strapi/design-system';\nimport { Search as SearchIcon } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\n\nimport { TrackingEvent, useTracking } from '../features/Tracking';\nimport { useIsMobile } from '../hooks/useMediaQuery';\nimport { useQueryParams } from '../hooks/useQueryParams';\n\ninterface SearchInputProps {\n disabled?: boolean;\n label: string;\n placeholder?: string;\n trackedEvent?: TrackingEvent['name'] | null;\n trackedEventDetails?: TrackingEvent['properties'];\n}\n\nconst SearchInput = ({\n disabled,\n label,\n placeholder,\n trackedEvent,\n trackedEventDetails,\n}: SearchInputProps) => {\n const inputRef = React.useRef<HTMLInputElement>(null);\n const iconButtonRef = React.useRef<HTMLButtonElement>(null);\n\n const [{ query }, setQuery] = useQueryParams<{ _q: string; page?: number }>();\n\n const [value, setValue] = React.useState(query?._q || '');\n const [isOpen, setIsOpen] = React.useState(!!value);\n\n const { formatMessage } = useIntl();\n const { trackUsage } = useTracking();\n const isMobile = useIsMobile();\n\n const handleToggle = () => setIsOpen((prev) => !prev);\n\n React.useLayoutEffect(() => {\n if (isOpen && inputRef.current) {\n inputRef.current.focus();\n }\n }, [isOpen]);\n\n const handleClear = () => {\n setValue('');\n setQuery({ _q: '' }, 'remove');\n };\n\n const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {\n e.preventDefault();\n\n // Ensure value is a string\n if (value) {\n if (trackedEvent) {\n trackUsage(trackedEvent, trackedEventDetails);\n }\n setQuery({ _q: encodeURIComponent(value), page: 1 });\n } else {\n handleToggle();\n setQuery({ _q: '' }, 'remove');\n }\n };\n\n const renderSearchForm = (opts?: { enableBlurClose?: boolean }) => (\n <SearchForm onSubmit={handleSubmit}>\n <Searchbar\n ref={inputRef}\n name=\"search\"\n onChange={(e) => setValue(e.target.value)}\n value={value}\n clearLabel={formatMessage({ id: 'clearLabel', defaultMessage: 'Clear' })}\n onClear={handleClear}\n placeholder={isMobile ? undefined : placeholder}\n disabled={disabled}\n onBlur={\n opts?.enableBlurClose\n ? (e) => {\n if (!e.currentTarget.contains(e.relatedTarget) && e.currentTarget.value === '') {\n setIsOpen(false);\n }\n }\n : undefined\n }\n >\n {label}\n </Searchbar>\n </SearchForm>\n );\n\n if (isMobile) {\n // Add wrapper so that the Searchbar takes up the rest of the available space.\n return <Box width=\"100%\">{renderSearchForm()}</Box>;\n }\n\n if (isOpen) {\n return renderSearchForm({ enableBlurClose: true });\n }\n\n return (\n <IconButton\n ref={iconButtonRef}\n disabled={disabled}\n label={formatMessage({ id: 'global.search', defaultMessage: 'Search' })}\n onClick={handleToggle}\n >\n <SearchIcon />\n </IconButton>\n );\n};\n\nexport { SearchInput };\nexport type { SearchInputProps };\n"],"names":["SearchInput","disabled","label","placeholder","trackedEvent","trackedEventDetails","inputRef","React","useRef","iconButtonRef","query","setQuery","useQueryParams","value","setValue","useState","_q","isOpen","setIsOpen","formatMessage","useIntl","trackUsage","useTracking","isMobile","useIsMobile","handleToggle","prev","useLayoutEffect","current","focus","handleClear","handleSubmit","e","preventDefault","encodeURIComponent","page","renderSearchForm","opts","_jsx","SearchForm","onSubmit","Searchbar","ref","name","onChange","target","clearLabel","id","defaultMessage","onClear","undefined","onBlur","enableBlurClose","currentTarget","contains","relatedTarget","Box","width","IconButton","onClick","SearchIcon"],"mappings":";;;;;;;;;AAkBA,MAAMA,WAAc,GAAA,CAAC,EACnBC,QAAQ,EACRC,KAAK,EACLC,WAAW,EACXC,YAAY,EACZC,mBAAmB,EACF,GAAA;IACjB,MAAMC,QAAAA,GAAWC,KAAMC,CAAAA,MAAM,CAAmB,IAAA,CAAA;IAChD,MAAMC,aAAAA,GAAgBF,KAAMC,CAAAA,MAAM,CAAoB,IAAA,CAAA;AAEtD,IAAA,MAAM,CAAC,EAAEE,KAAK,EAAE,EAAEC,SAAS,GAAGC,cAAAA,EAAAA;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QACChB,GAAKjC,EAAAA,aAAAA;QACLR,QAAUA,EAAAA,QAAAA;AACVC,QAAAA,KAAAA,EAAOiB,aAAc,CAAA;YAAE4B,EAAI,EAAA,eAAA;YAAiBC,cAAgB,EAAA;AAAS,SAAA,CAAA;QACrEW,OAASlC,EAAAA,YAAAA;AAET,QAAA,QAAA,gBAAAa,GAACsB,CAAAA,MAAAA,EAAAA,EAAAA;;AAGP;;;;"}
|
|
@@ -11,17 +11,14 @@ var Tours = require('./GuidedTour/Tours.js');
|
|
|
11
11
|
|
|
12
12
|
const MainSubNav = styled.styled(designSystem.SubNav)`
|
|
13
13
|
width: 100%;
|
|
14
|
-
height:
|
|
14
|
+
height: 100%;
|
|
15
15
|
overflow: hidden;
|
|
16
16
|
background-color: ${({ theme })=>theme.colors.neutral0};
|
|
17
17
|
display: flex;
|
|
18
18
|
flex-direction: column;
|
|
19
19
|
border-right: 0;
|
|
20
20
|
box-shadow: none;
|
|
21
|
-
position:
|
|
22
|
-
top: calc(${theme.HEIGHT_TOP_NAVIGATION} + 1px);
|
|
23
|
-
left: 0;
|
|
24
|
-
z-index: 2;
|
|
21
|
+
position: relative;
|
|
25
22
|
|
|
26
23
|
${({ theme })=>theme.breakpoints.medium} {
|
|
27
24
|
width: ${theme.WIDTH_SIDE_NAVIGATION};
|
|
@@ -30,9 +27,6 @@ const MainSubNav = styled.styled(designSystem.SubNav)`
|
|
|
30
27
|
border-right: 1px solid ${({ theme })=>theme.colors.neutral150};
|
|
31
28
|
overscroll-behavior: contain;
|
|
32
29
|
}
|
|
33
|
-
${({ theme })=>theme.breakpoints.large} {
|
|
34
|
-
height: 100dvh;
|
|
35
|
-
}
|
|
36
30
|
`;
|
|
37
31
|
const Main = ({ children, ...props })=>/*#__PURE__*/ jsxRuntime.jsx(MainSubNav, {
|
|
38
32
|
...props,
|
|
@@ -376,12 +370,16 @@ const SubSection = ({ label, children })=>{
|
|
|
376
370
|
});
|
|
377
371
|
};
|
|
378
372
|
const PageWrapper = styled.styled(designSystem.Box)`
|
|
373
|
+
width: 100%;
|
|
374
|
+
|
|
379
375
|
${MainSubNav} {
|
|
380
376
|
background-color: transparent;
|
|
381
377
|
border-right: none;
|
|
382
378
|
}
|
|
383
379
|
|
|
384
380
|
${({ theme })=>theme.breakpoints.medium} {
|
|
381
|
+
overflow: hidden;
|
|
382
|
+
|
|
385
383
|
${MainSubNav} {
|
|
386
384
|
top: 0;
|
|
387
385
|
}
|