@openedx/frontend-base 1.0.0-alpha.14 → 1.0.0-alpha.15
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/runtime/config/index.js +5 -1
- package/dist/runtime/config/index.js.map +1 -1
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +1 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/react/AuthenticatedPageRoute.d.ts +2 -0
- package/dist/runtime/react/AuthenticatedPageRoute.js +2 -0
- package/dist/runtime/react/AuthenticatedPageRoute.js.map +1 -1
- package/dist/runtime/react/NotFoundPage.d.ts +2 -0
- package/dist/runtime/react/NotFoundPage.js +14 -0
- package/dist/runtime/react/NotFoundPage.js.map +1 -0
- package/dist/runtime/react/index.d.ts +1 -0
- package/dist/runtime/react/index.js +1 -0
- package/dist/runtime/react/index.js.map +1 -1
- package/dist/runtime/routing/authenticatedLoader.d.ts +2 -0
- package/dist/runtime/routing/authenticatedLoader.js +27 -0
- package/dist/runtime/routing/authenticatedLoader.js.map +1 -0
- package/dist/runtime/routing/index.d.ts +1 -0
- package/dist/runtime/routing/index.js +1 -0
- package/dist/runtime/routing/index.js.map +1 -1
- package/dist/runtime/routing/utils.js +20 -5
- package/dist/runtime/routing/utils.js.map +1 -1
- package/dist/runtime/slots/widget/hooks.d.ts +3 -3
- package/dist/runtime/slots/widget/hooks.js.map +1 -1
- package/dist/runtime/slots/widget/types.d.ts +8 -0
- package/dist/runtime/slots/widget/types.js.map +1 -1
- package/dist/runtime/slots/widget/utils.d.ts +2 -2
- package/dist/runtime/slots/widget/utils.js +20 -2
- package/dist/runtime/slots/widget/utils.js.map +1 -1
- package/dist/shell/dev/devHome/HomePage.js +3 -3
- package/dist/shell/dev/devHome/HomePage.js.map +1 -1
- package/dist/shell/dev/slotShowcase/HorizontalSlotLayout.js +2 -1
- package/dist/shell/dev/slotShowcase/HorizontalSlotLayout.js.map +1 -1
- package/dist/shell/dev/slotShowcase/LayoutWithOptions.js +2 -2
- package/dist/shell/dev/slotShowcase/LayoutWithOptions.js.map +1 -1
- package/dist/shell/dev/slotShowcase/SlotShowcasePage.d.ts +1 -0
- package/dist/shell/dev/slotShowcase/SlotShowcasePage.js +10 -1
- package/dist/shell/dev/slotShowcase/SlotShowcasePage.js.map +1 -1
- package/dist/shell/dev/slotShowcase/ToggleByRoleLayout.d.ts +1 -0
- package/dist/shell/dev/slotShowcase/ToggleByRoleLayout.js +11 -0
- package/dist/shell/dev/slotShowcase/ToggleByRoleLayout.js.map +1 -0
- package/dist/shell/dev/slotShowcase/WidgetWithOptions.js +1 -1
- package/dist/shell/dev/slotShowcase/WidgetWithOptions.js.map +1 -1
- package/dist/shell/dev/slotShowcase/app.js +76 -40
- package/dist/shell/dev/slotShowcase/app.js.map +1 -1
- package/dist/shell/header/AuthenticatedMenu.js +0 -2
- package/dist/shell/header/AuthenticatedMenu.js.map +1 -1
- package/dist/shell/router/createRouter.js +12 -1
- package/dist/shell/router/createRouter.js.map +1 -1
- package/dist/tools/babel.config.d.ts +2 -0
- package/dist/tools/babel.config.js +3 -0
- package/dist/tools/cli/openedx.js +1 -1
- package/dist/tools/cli/utils/formatter.js +1 -8
- package/dist/tools/eslint/base.eslint.config.js +4 -3
- package/dist/tools/webpack/common-config/dev/getDevServer.js +1 -3
- package/dist/tools/webpack/plugins/html-webpack-new-relic-plugin/HtmlWebpackNewRelicPlugin.d.ts +1 -3
- package/dist/tools/webpack/utils/getPublicPath.js +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HomePage.js","sourceRoot":"","sources":["../../../../shell/dev/devHome/HomePage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,MAAM,CAAC,OAAO,UAAU,QAAQ;IAC9B,MAAM,aAAa,GAAG,iBAAiB,CAAC,
|
|
1
|
+
{"version":3,"file":"HomePage.js","sourceRoot":"","sources":["../../../../shell/dev/devHome/HomePage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,MAAM,CAAC,OAAO,UAAU,QAAQ;IAC9B,MAAM,aAAa,GAAG,iBAAiB,CAAC,sCAAsC,CAAC,CAAC;IAChF,MAAM,YAAY,GAAG,iBAAiB,CAAC,qCAAqC,CAAC,CAAC;IAC9E,MAAM,eAAe,GAAG,iBAAiB,CAAC,wCAAwC,CAAC,CAAC;IACpF,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IAEvB,OAAO,CACL,eAAK,SAAS,EAAC,KAAK,aAClB,sBAAI,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAK,EACjD,yBACG,aAAa,KAAK,IAAI,IAAI,CACzB,uBAAI,KAAC,IAAI,IAAC,EAAE,EAAE,aAAa,sCAA8B,GAAK,CAC/D,EACA,YAAY,KAAK,IAAI,IAAI,CACxB,uBAAI,KAAC,IAAI,IAAC,EAAE,EAAE,YAAY,qCAA6B,GAAK,CAC7D,EACA,eAAe,KAAK,IAAI,IAAI,CAC3B,uBAAI,KAAC,IAAI,IAAC,EAAE,EAAE,eAAe,yCAAiC,GAAK,CACpE,IACE,IACD,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { Link } from 'react-router-dom';\nimport { useIntl } from '../../../runtime';\nimport { getUrlByRouteRole } from '../../../runtime/routing';\nimport messages from './messages';\n\nexport default function HomePage() {\n const coursewareUrl = getUrlByRouteRole('org.openedx.frontend.role.courseware');\n const dashboardUrl = getUrlByRouteRole('org.openedx.frontend.role.dashboard');\n const slotShowcaseUrl = getUrlByRouteRole('org.openedx.frontend.role.slotShowcase');\n const intl = useIntl();\n\n return (\n <div className=\"p-3\">\n <p>{intl.formatMessage(messages.homeContent)}</p>\n <ul>\n {coursewareUrl !== null && (\n <li><Link to={coursewareUrl}>Go to courseware page</Link></li>\n )}\n {dashboardUrl !== null && (\n <li><Link to={dashboardUrl}>Go to dashboard page</Link></li>\n )}\n {slotShowcaseUrl !== null && (\n <li><Link to={slotShowcaseUrl}>Go to slot showcase page</Link></li>\n )}\n </ul>\n </div>\n );\n}\n"]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Stack } from '@openedx/paragon';
|
|
2
3
|
import { useWidgets } from '../../../runtime';
|
|
3
4
|
export default function HorizontalSlotLayout() {
|
|
4
5
|
const widgets = useWidgets();
|
|
5
|
-
return (_jsx(
|
|
6
|
+
return (_jsx(Stack, { direction: "horizontal", gap: 3, children: widgets }));
|
|
6
7
|
}
|
|
7
8
|
//# sourceMappingURL=HorizontalSlotLayout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HorizontalSlotLayout.js","sourceRoot":"","sources":["../../../../shell/dev/slotShowcase/HorizontalSlotLayout.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,CAAC,OAAO,UAAU,oBAAoB;IAC1C,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAE7B,OAAO,CACL,
|
|
1
|
+
{"version":3,"file":"HorizontalSlotLayout.js","sourceRoot":"","sources":["../../../../shell/dev/slotShowcase/HorizontalSlotLayout.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,CAAC,OAAO,UAAU,oBAAoB;IAC1C,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAE7B,OAAO,CACL,KAAC,KAAK,IAAC,SAAS,EAAC,YAAY,EAAC,GAAG,EAAE,CAAC,YACjC,OAAO,GACF,CACT,CAAC;AACJ,CAAC","sourcesContent":["import { Stack } from '@openedx/paragon';\nimport { useWidgets } from '../../../runtime';\n\nexport default function HorizontalSlotLayout() {\n const widgets = useWidgets();\n\n return (\n <Stack direction=\"horizontal\" gap={3}>\n {widgets}\n </Stack>\n );\n}\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useLayoutOptions, useWidgets } from '../../../runtime';
|
|
3
3
|
export default function LayoutWithOptions() {
|
|
4
4
|
const widgets = useWidgets();
|
|
5
5
|
const options = useLayoutOptions();
|
|
6
6
|
const title = typeof options.title === 'string' ? options.title : 'Foo';
|
|
7
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { children: ["Layout Title: ",
|
|
7
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "showcase-layout-title", children: ["Layout Title: ", title] }), _jsx("div", { children: widgets })] }));
|
|
8
8
|
}
|
|
9
9
|
//# sourceMappingURL=LayoutWithOptions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LayoutWithOptions.js","sourceRoot":"","sources":["../../../../shell/dev/slotShowcase/LayoutWithOptions.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEhE,MAAM,CAAC,OAAO,UAAU,iBAAiB;IACvC,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,OAAO,GAAG,gBAAgB,EAAE,CAAC;IAEnC,MAAM,KAAK,GAAG,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;IAExE,OAAO,CACL,8BACE,
|
|
1
|
+
{"version":3,"file":"LayoutWithOptions.js","sourceRoot":"","sources":["../../../../shell/dev/slotShowcase/LayoutWithOptions.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEhE,MAAM,CAAC,OAAO,UAAU,iBAAiB;IACvC,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,OAAO,GAAG,gBAAgB,EAAE,CAAC;IAEnC,MAAM,KAAK,GAAG,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;IAExE,OAAO,CACL,8BACE,eAAK,SAAS,EAAC,uBAAuB,+BAAgB,KAAK,IAAO,EAClE,wBACG,OAAO,GACJ,IACL,CACJ,CAAC;AACJ,CAAC","sourcesContent":["import { useLayoutOptions, useWidgets } from '../../../runtime';\n\nexport default function LayoutWithOptions() {\n const widgets = useWidgets();\n const options = useLayoutOptions();\n\n const title = typeof options.title === 'string' ? options.title : 'Foo';\n\n return (\n <>\n <div className=\"showcase-layout-title\">Layout Title: {title}</div>\n <div>\n {widgets}\n </div>\n </>\n );\n}\n"]}
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Card, Container } from '@openedx/paragon';
|
|
2
3
|
import { Slot } from '../../../runtime';
|
|
3
4
|
import HorizontalSlotLayout from './HorizontalSlotLayout';
|
|
4
5
|
import LayoutWithOptions from './LayoutWithOptions';
|
|
6
|
+
import ToggleByRoleLayout from './ToggleByRoleLayout';
|
|
7
|
+
import './SlotShowcase.scss';
|
|
8
|
+
function SlotContainer({ children }) {
|
|
9
|
+
return (_jsx(Card, { className: "showcase-slot", children: _jsx(Card.Body, { children: children }) }));
|
|
10
|
+
}
|
|
11
|
+
function Section({ title, children }) {
|
|
12
|
+
return (_jsxs("div", { children: [_jsx("h3", { className: "text-primary-500", children: title }), children] }));
|
|
13
|
+
}
|
|
5
14
|
export default function SlotShowcasePage() {
|
|
6
|
-
return (_jsxs("div", { className: "
|
|
15
|
+
return (_jsxs(Container, { size: "xl", className: "showcase-page py-4", children: [_jsxs("div", { className: "showcase-full-width", children: [_jsx("h1", { children: "Slot Showcase" }), _jsxs("p", { children: ["As a best practice, widgets should pass additional props (", _jsx("code", { children: "...props" }), ") to their rendered HTMLElement. This allows custom layouts to add ", _jsx("code", { children: "className" }), " and ", _jsx("code", { children: "style" }), " props as necessary for the layout."] })] }), _jsxs(Section, { title: "Simple slot with default layout", children: [_jsx("p", { children: "This slot has no opinionated layout, it just renders its children." }), _jsx(SlotContainer, { children: _jsx(Slot, { id: "org.openedx.frontend.slot.dev.slotShowcaseSimple" }) })] }), _jsxs(Section, { title: "Simple slot with default content and props", children: [_jsx("p", { children: "This slot has default content, and it exposes a slot prop to widgets." }), _jsx(SlotContainer, { children: _jsx(Slot, { id: "org.openedx.frontend.slot.dev.slotShowcaseSimpleWithDefaultContent", aSlotProp: "hello!", children: _jsx("div", { className: "showcase-widget", children: "Look, I'm default content!" }) }) })] }), _jsx("h2", { className: "showcase-divider", children: "UI Layout Operations" }), _jsxs(Section, { title: "Slot with custom layout (component)", children: [_jsx("p", { children: "This slot uses a horizontal flexbox layout from a component." }), _jsx(SlotContainer, { children: _jsx(Slot, { id: "org.openedx.frontend.slot.dev.slotShowcaseCustom", layout: HorizontalSlotLayout }) })] }), _jsxs(Section, { title: "Slot with custom layout (element)", children: [_jsx("p", { children: "This slot uses a horizontal flexbox layout from a JSX element." }), _jsx(SlotContainer, { children: _jsx(Slot, { id: "org.openedx.frontend.slot.dev.slotShowcaseCustom", layout: _jsx(HorizontalSlotLayout, {}) }) })] }), _jsxs(Section, { title: "Slot with override custom layout", children: [_jsx("p", { children: "This slot uses a horizontal flexbox layout, but it was added by a layout replace operation." }), _jsx(SlotContainer, { children: _jsx(Slot, { id: "org.openedx.frontend.slot.dev.slotShowcaseCustomConfig" }) })] }), _jsxs(Section, { title: "Slot with layout options (default)", children: [_jsx("p", { children: "This slot uses a custom layout that takes options. It shows the default title." }), _jsx(SlotContainer, { children: _jsx(Slot, { id: "org.openedx.frontend.slot.dev.slotShowcaseLayoutWithOptionsDefault", layout: LayoutWithOptions }) })] }), _jsxs(Section, { title: "Slot with layout options (configured)", children: [_jsx("p", { children: "Same layout, but the title option is set to \"Bar\"." }), _jsx(SlotContainer, { children: _jsx(Slot, { id: "org.openedx.frontend.slot.dev.slotShowcaseLayoutWithOptions", layout: LayoutWithOptions }) })] }), _jsxs(Section, { title: "Slot with widget filtering by role", children: [_jsxs("p", { children: ["This slot has four widgets, two with a \"highlighted\" role. The layout uses ", _jsx("code", { children: "widgets.byRole()" }), " to toggle between all and highlighted."] }), _jsx(SlotContainer, { children: _jsx(Slot, { id: "org.openedx.frontend.slot.dev.slotShowcaseFilterByRole", layout: ToggleByRoleLayout }) })] }), _jsx("h2", { className: "showcase-divider", children: "UI Widget Operations" }), _jsxs(Section, { title: "Slot with prepended element", children: [_jsx("p", { children: "This slot has a prepended element (and two appended elements)." }), _jsx(SlotContainer, { children: _jsx(Slot, { id: "org.openedx.frontend.slot.dev.slotShowcasePrepending" }) })] }), _jsxs(Section, { title: "Slot with inserted elements", children: [_jsxs("p", { children: ["This slot has elements inserted before and after the second element. The insert operations are declared ", _jsx("em", { children: "before" }), " the related element, but can still insert themselves relative to it."] }), _jsx(SlotContainer, { children: _jsx(Slot, { id: "org.openedx.frontend.slot.dev.slotShowcaseInserting" }) })] }), _jsxs(Section, { title: "Slot with replaced element", children: [_jsx("p", { children: "This slot has an element replacing element two." }), _jsx(SlotContainer, { children: _jsx(Slot, { id: "org.openedx.frontend.slot.dev.slotShowcaseReplacing" }) })] }), _jsxs(Section, { title: "Slot with removed element", children: [_jsxs("p", { children: ["This slot has removed element two (", _jsx("code", { children: "WidgetOperationTypes.REMOVE" }), ")."] }), _jsx(SlotContainer, { children: _jsx(Slot, { id: "org.openedx.frontend.slot.dev.slotShowcaseRemoving" }) })] }), _jsxs(Section, { title: "Slot with widget options (default)", children: [_jsx("p", { children: "This widget accepts options. It shows the default title." }), _jsx(SlotContainer, { children: _jsx(Slot, { id: "org.openedx.frontend.slot.dev.slotShowcaseWidgetOptions" }) })] })] }));
|
|
7
16
|
}
|
|
8
17
|
//# sourceMappingURL=SlotShowcasePage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlotShowcasePage.js","sourceRoot":"","sources":["../../../../shell/dev/slotShowcase/SlotShowcasePage.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"SlotShowcasePage.js","sourceRoot":"","sources":["../../../../shell/dev/slotShowcase/SlotShowcasePage.tsx"],"names":[],"mappings":"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","sourcesContent":["import { ReactNode } from 'react';\nimport { Card, Container } from '@openedx/paragon';\nimport { Slot } from '../../../runtime';\nimport HorizontalSlotLayout from './HorizontalSlotLayout';\nimport LayoutWithOptions from './LayoutWithOptions';\nimport ToggleByRoleLayout from './ToggleByRoleLayout';\nimport './SlotShowcase.scss';\n\nfunction SlotContainer({ children }: { children: ReactNode }) {\n return (\n <Card className=\"showcase-slot\">\n <Card.Body>\n {children}\n </Card.Body>\n </Card>\n );\n}\n\nfunction Section({ title, children }: { title: string, children: ReactNode }) {\n return (\n <div>\n <h3 className=\"text-primary-500\">{title}</h3>\n {children}\n </div>\n );\n}\n\nexport default function SlotShowcasePage() {\n return (\n <Container size=\"xl\" className=\"showcase-page py-4\">\n <div className=\"showcase-full-width\">\n <h1>Slot Showcase</h1>\n <p>As a best practice, widgets should pass additional props (<code>...props</code>) to their rendered HTMLElement. This allows custom layouts to add <code>className</code> and <code>style</code> props as necessary for the layout.</p>\n </div>\n\n <Section title=\"Simple slot with default layout\">\n <p>This slot has no opinionated layout, it just renders its children.</p>\n <SlotContainer>\n <Slot id=\"org.openedx.frontend.slot.dev.slotShowcaseSimple\" />\n </SlotContainer>\n </Section>\n\n <Section title=\"Simple slot with default content and props\">\n <p>This slot has default content, and it exposes a slot prop to widgets.</p>\n <SlotContainer>\n <Slot id=\"org.openedx.frontend.slot.dev.slotShowcaseSimpleWithDefaultContent\" aSlotProp=\"hello!\">\n <div className=\"showcase-widget\">Look, I'm default content!</div>\n </Slot>\n </SlotContainer>\n </Section>\n\n <h2 className=\"showcase-divider\">UI Layout Operations</h2>\n\n <Section title=\"Slot with custom layout (component)\">\n <p>This slot uses a horizontal flexbox layout from a component.</p>\n <SlotContainer>\n <Slot id=\"org.openedx.frontend.slot.dev.slotShowcaseCustom\" layout={HorizontalSlotLayout} />\n </SlotContainer>\n </Section>\n\n <Section title=\"Slot with custom layout (element)\">\n <p>This slot uses a horizontal flexbox layout from a JSX element.</p>\n <SlotContainer>\n <Slot id=\"org.openedx.frontend.slot.dev.slotShowcaseCustom\" layout={<HorizontalSlotLayout />} />\n </SlotContainer>\n </Section>\n\n <Section title=\"Slot with override custom layout\">\n <p>This slot uses a horizontal flexbox layout, but it was added by a layout replace operation.</p>\n <SlotContainer>\n <Slot id=\"org.openedx.frontend.slot.dev.slotShowcaseCustomConfig\" />\n </SlotContainer>\n </Section>\n\n <Section title=\"Slot with layout options (default)\">\n <p>This slot uses a custom layout that takes options. It shows the default title.</p>\n <SlotContainer>\n <Slot id=\"org.openedx.frontend.slot.dev.slotShowcaseLayoutWithOptionsDefault\" layout={LayoutWithOptions} />\n </SlotContainer>\n </Section>\n\n <Section title=\"Slot with layout options (configured)\">\n <p>Same layout, but the title option is set to "Bar".</p>\n <SlotContainer>\n <Slot id=\"org.openedx.frontend.slot.dev.slotShowcaseLayoutWithOptions\" layout={LayoutWithOptions} />\n </SlotContainer>\n </Section>\n\n <Section title=\"Slot with widget filtering by role\">\n <p>This slot has four widgets, two with a "highlighted" role. The layout uses <code>widgets.byRole()</code> to toggle between all and highlighted.</p>\n <SlotContainer>\n <Slot id=\"org.openedx.frontend.slot.dev.slotShowcaseFilterByRole\" layout={ToggleByRoleLayout} />\n </SlotContainer>\n </Section>\n\n <h2 className=\"showcase-divider\">UI Widget Operations</h2>\n\n <Section title=\"Slot with prepended element\">\n <p>This slot has a prepended element (and two appended elements).</p>\n <SlotContainer>\n <Slot id=\"org.openedx.frontend.slot.dev.slotShowcasePrepending\" />\n </SlotContainer>\n </Section>\n\n <Section title=\"Slot with inserted elements\">\n <p>This slot has elements inserted before and after the second element. The insert operations are declared <em>before</em> the related element, but can still insert themselves relative to it.</p>\n <SlotContainer>\n <Slot id=\"org.openedx.frontend.slot.dev.slotShowcaseInserting\" />\n </SlotContainer>\n </Section>\n\n <Section title=\"Slot with replaced element\">\n <p>This slot has an element replacing element two.</p>\n <SlotContainer>\n <Slot id=\"org.openedx.frontend.slot.dev.slotShowcaseReplacing\" />\n </SlotContainer>\n </Section>\n\n <Section title=\"Slot with removed element\">\n <p>This slot has removed element two (<code>WidgetOperationTypes.REMOVE</code>).</p>\n <SlotContainer>\n <Slot id=\"org.openedx.frontend.slot.dev.slotShowcaseRemoving\" />\n </SlotContainer>\n </Section>\n\n <Section title=\"Slot with widget options (default)\">\n <p>This widget accepts options. It shows the default title.</p>\n <SlotContainer>\n <Slot id=\"org.openedx.frontend.slot.dev.slotShowcaseWidgetOptions\" />\n </SlotContainer>\n </Section>\n\n </Container>\n );\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function ToggleByRoleLayout(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Button } from '@openedx/paragon';
|
|
4
|
+
import { useWidgets } from '../../../runtime';
|
|
5
|
+
const highlitedRole = 'org.openedx.frontend.role.slotShowcase.highlighted';
|
|
6
|
+
export default function ToggleByRoleLayout() {
|
|
7
|
+
const widgets = useWidgets();
|
|
8
|
+
const [showHighlighted, setShowHighlighted] = useState(false);
|
|
9
|
+
return (_jsxs("div", { children: [_jsx(Button, { size: "sm", variant: "outline-primary", className: "mb-2", onClick: () => setShowHighlighted(!showHighlighted), children: showHighlighted ? 'Show all widgets' : 'Show only highlighted widgets' }), _jsx("div", { children: showHighlighted ? widgets.byRole(highlitedRole) : widgets })] }));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=ToggleByRoleLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToggleByRoleLayout.js","sourceRoot":"","sources":["../../../../shell/dev/slotShowcase/ToggleByRoleLayout.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,aAAa,GAAG,oDAAoD,CAAC;AAE3E,MAAM,CAAC,OAAO,UAAU,kBAAkB;IACxC,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE9D,OAAO,CACL,0BACE,KAAC,MAAM,IAAC,IAAI,EAAC,IAAI,EAAC,OAAO,EAAC,iBAAiB,EAAC,SAAS,EAAC,MAAM,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,CAAC,eAAe,CAAC,YAC7G,eAAe,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,+BAA+B,GAChE,EACT,wBACG,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,OAAO,GACtD,IACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { useState } from 'react';\nimport { Button } from '@openedx/paragon';\nimport { useWidgets } from '../../../runtime';\n\nconst highlitedRole = 'org.openedx.frontend.role.slotShowcase.highlighted';\n\nexport default function ToggleByRoleLayout() {\n const widgets = useWidgets();\n const [showHighlighted, setShowHighlighted] = useState(false);\n\n return (\n <div>\n <Button size=\"sm\" variant=\"outline-primary\" className=\"mb-2\" onClick={() => setShowHighlighted(!showHighlighted)}>\n {showHighlighted ? 'Show all widgets' : 'Show only highlighted widgets'}\n </Button>\n <div>\n {showHighlighted ? widgets.byRole(highlitedRole) : widgets}\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -3,6 +3,6 @@ import { useWidgetOptions } from '../../../runtime';
|
|
|
3
3
|
export default function WidgetWithOptions() {
|
|
4
4
|
const options = useWidgetOptions();
|
|
5
5
|
const title = typeof options.title === 'string' ? options.title : 'Foo';
|
|
6
|
-
return (_jsx("div", { children: title }));
|
|
6
|
+
return (_jsx("div", { className: "showcase-widget", children: title }));
|
|
7
7
|
}
|
|
8
8
|
//# sourceMappingURL=WidgetWithOptions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WidgetWithOptions.js","sourceRoot":"","sources":["../../../../shell/dev/slotShowcase/WidgetWithOptions.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,CAAC,OAAO,UAAU,iBAAiB;IACvC,MAAM,OAAO,GAAG,gBAAgB,EAAE,CAAC;IAEnC,MAAM,KAAK,GAAG,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;IAExE,OAAO,CACL,
|
|
1
|
+
{"version":3,"file":"WidgetWithOptions.js","sourceRoot":"","sources":["../../../../shell/dev/slotShowcase/WidgetWithOptions.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,CAAC,OAAO,UAAU,iBAAiB;IACvC,MAAM,OAAO,GAAG,gBAAgB,EAAE,CAAC;IAEnC,MAAM,KAAK,GAAG,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;IAExE,OAAO,CACL,cAAK,SAAS,EAAC,iBAAiB,YAAE,KAAK,GAAO,CAC/C,CAAC;AACJ,CAAC","sourcesContent":["import { useWidgetOptions } from '../../../runtime';\n\nexport default function WidgetWithOptions() {\n const options = useWidgetOptions();\n\n const title = typeof options.title === 'string' ? options.title : 'Foo';\n\n return (\n <div className=\"showcase-widget\">{title}</div>\n );\n}\n"]}
|
|
@@ -1,23 +1,32 @@
|
|
|
1
|
-
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
13
|
import { NavDropdownMenuSlot } from '../..';
|
|
3
14
|
import LinkMenuItem from '../../menus/LinkMenuItem';
|
|
4
15
|
import { LayoutOperationTypes, WidgetOperationTypes, useSlotContext } from '../../../runtime';
|
|
5
16
|
import HorizontalSlotLayout from './HorizontalSlotLayout';
|
|
6
17
|
import SlotShowcasePage from './SlotShowcasePage';
|
|
7
18
|
import WidgetWithOptions from './WidgetWithOptions';
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
function Child({ title, op }) {
|
|
12
|
-
return (_jsxs("div", { children: [title, op && (_jsxs("span", { children: [' ', "(", _jsx("code", { children: op }), ")"] }))] }));
|
|
19
|
+
function Widget(_a) {
|
|
20
|
+
var { title, op, className } = _a, props = __rest(_a, ["title", "op", "className"]);
|
|
21
|
+
return (_jsxs("div", Object.assign({ className: `showcase-widget ${className !== null && className !== void 0 ? className : ''}` }, props, { children: [title, op && (_jsxs("span", { children: [' ', "(", _jsx("code", { children: op }), ")"] }))] })));
|
|
13
22
|
}
|
|
14
23
|
function TakesProps({ aSlotProp }) {
|
|
15
|
-
return (_jsxs("div", { children: ["And this is a slot prop that was passed down via props: ", _jsx("code", { children: aSlotProp })] }));
|
|
24
|
+
return (_jsxs("div", { className: "showcase-widget", children: ["And this is a slot prop that was passed down via props: ", _jsx("code", { children: aSlotProp })] }));
|
|
16
25
|
}
|
|
17
26
|
function TakesPropsViaContext() {
|
|
18
27
|
const slotContext = useSlotContext();
|
|
19
28
|
const aSlotProp = typeof slotContext.aSlotProp === 'string' ? slotContext.aSlotProp : 'foo';
|
|
20
|
-
return (_jsxs("div", { children: ["And this is the same prop, but accessed via slot context: ", _jsx("code", { children: aSlotProp })] }));
|
|
29
|
+
return (_jsxs("div", { className: "showcase-widget", children: ["And this is the same prop, but accessed via slot context: ", _jsx("code", { children: aSlotProp })] }));
|
|
21
30
|
}
|
|
22
31
|
const app = {
|
|
23
32
|
appId: 'org.openedx.frontend.app.slotShowcase',
|
|
@@ -35,19 +44,19 @@ const app = {
|
|
|
35
44
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseSimple',
|
|
36
45
|
id: 'org.openedx.frontend.widget.slotShowcase.simpleChild1',
|
|
37
46
|
op: WidgetOperationTypes.APPEND,
|
|
38
|
-
element: (_jsx(
|
|
47
|
+
element: (_jsx(Widget, { title: "Widget One" }))
|
|
39
48
|
},
|
|
40
49
|
{
|
|
41
50
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseSimple',
|
|
42
51
|
id: 'org.openedx.frontend.widget.slotShowcase.simpleChild2',
|
|
43
52
|
op: WidgetOperationTypes.APPEND,
|
|
44
|
-
element: (_jsx(
|
|
53
|
+
element: (_jsx(Widget, { title: "Widget Two" }))
|
|
45
54
|
},
|
|
46
55
|
{
|
|
47
56
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseSimple',
|
|
48
57
|
id: 'org.openedx.frontend.widget.slotShowcase.simpleChild3',
|
|
49
58
|
op: WidgetOperationTypes.APPEND,
|
|
50
|
-
element: (_jsx(
|
|
59
|
+
element: (_jsx(Widget, { title: "Widget Three" }))
|
|
51
60
|
},
|
|
52
61
|
{
|
|
53
62
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseSimpleWithDefaultContent',
|
|
@@ -66,38 +75,38 @@ const app = {
|
|
|
66
75
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseCustom',
|
|
67
76
|
id: 'org.openedx.frontend.widget.slotShowcase.customChild1',
|
|
68
77
|
op: WidgetOperationTypes.APPEND,
|
|
69
|
-
element: (_jsx(
|
|
78
|
+
element: (_jsx(Widget, { title: "Widget One" }))
|
|
70
79
|
},
|
|
71
80
|
{
|
|
72
81
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseCustom',
|
|
73
82
|
id: 'org.openedx.frontend.widget.slotShowcase.customChild2',
|
|
74
83
|
op: WidgetOperationTypes.APPEND,
|
|
75
|
-
element: (_jsx(
|
|
84
|
+
element: (_jsx(Widget, { title: "Widget Two" }))
|
|
76
85
|
},
|
|
77
86
|
{
|
|
78
87
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseCustom',
|
|
79
88
|
id: 'org.openedx.frontend.widget.slotShowcase.customChild3',
|
|
80
89
|
op: WidgetOperationTypes.APPEND,
|
|
81
|
-
element: (_jsx(
|
|
90
|
+
element: (_jsx(Widget, { title: "Widget Three" }))
|
|
82
91
|
},
|
|
83
92
|
// Override custom layout
|
|
84
93
|
{
|
|
85
94
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseCustomConfig',
|
|
86
95
|
id: 'org.openedx.frontend.widget.slotShowcase.customConfigChild1',
|
|
87
96
|
op: WidgetOperationTypes.APPEND,
|
|
88
|
-
element: (_jsx(
|
|
97
|
+
element: (_jsx(Widget, { title: "Widget One" }))
|
|
89
98
|
},
|
|
90
99
|
{
|
|
91
100
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseCustomConfig',
|
|
92
101
|
id: 'org.openedx.frontend.widget.slotShowcase.customConfigChild2',
|
|
93
102
|
op: WidgetOperationTypes.APPEND,
|
|
94
|
-
element: (_jsx(
|
|
103
|
+
element: (_jsx(Widget, { title: "Widget Two" }))
|
|
95
104
|
},
|
|
96
105
|
{
|
|
97
106
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseCustomConfig',
|
|
98
107
|
id: 'org.openedx.frontend.widget.slotShowcase.customConfigChild3',
|
|
99
108
|
op: WidgetOperationTypes.APPEND,
|
|
100
|
-
element: (_jsx(
|
|
109
|
+
element: (_jsx(Widget, { title: "Widget Three" }))
|
|
101
110
|
},
|
|
102
111
|
{
|
|
103
112
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseCustomConfig',
|
|
@@ -109,44 +118,44 @@ const app = {
|
|
|
109
118
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseLayoutWithOptions',
|
|
110
119
|
op: LayoutOperationTypes.OPTIONS,
|
|
111
120
|
options: {
|
|
112
|
-
title:
|
|
121
|
+
title: 'Bar',
|
|
113
122
|
}
|
|
114
123
|
},
|
|
115
124
|
{
|
|
116
125
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseLayoutWithOptions',
|
|
117
126
|
id: 'org.openedx.frontend.widget.slotShowcase.layoutWithOptionsChild1',
|
|
118
127
|
op: WidgetOperationTypes.APPEND,
|
|
119
|
-
element: (_jsx(
|
|
128
|
+
element: (_jsx(Widget, { title: "Widget One" }))
|
|
120
129
|
},
|
|
121
130
|
{
|
|
122
131
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseLayoutWithOptions',
|
|
123
132
|
id: 'org.openedx.frontend.widget.slotShowcase.layoutWithOptionsChild2',
|
|
124
133
|
op: WidgetOperationTypes.APPEND,
|
|
125
|
-
element: (_jsx(
|
|
134
|
+
element: (_jsx(Widget, { title: "Widget Two" }))
|
|
126
135
|
},
|
|
127
136
|
{
|
|
128
137
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseLayoutWithOptions',
|
|
129
138
|
id: 'org.openedx.frontend.widget.slotShowcase.layoutWithOptionsChild3',
|
|
130
139
|
op: WidgetOperationTypes.APPEND,
|
|
131
|
-
element: (_jsx(
|
|
140
|
+
element: (_jsx(Widget, { title: "Widget Three" }))
|
|
132
141
|
},
|
|
133
142
|
{
|
|
134
143
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseLayoutWithOptionsDefault',
|
|
135
144
|
id: 'org.openedx.frontend.widget.slotShowcase.layoutWithOptionsDefaultChild1',
|
|
136
145
|
op: WidgetOperationTypes.APPEND,
|
|
137
|
-
element: (_jsx(
|
|
146
|
+
element: (_jsx(Widget, { title: "Widget One" }))
|
|
138
147
|
},
|
|
139
148
|
{
|
|
140
149
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseLayoutWithOptionsDefault',
|
|
141
150
|
id: 'org.openedx.frontend.widget.slotShowcase.layoutWithOptionsDefaultChild2',
|
|
142
151
|
op: WidgetOperationTypes.APPEND,
|
|
143
|
-
element: (_jsx(
|
|
152
|
+
element: (_jsx(Widget, { title: "Widget Two" }))
|
|
144
153
|
},
|
|
145
154
|
{
|
|
146
155
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseLayoutWithOptionsDefault',
|
|
147
156
|
id: 'org.openedx.frontend.widget.slotShowcase.layoutWithOptionsDefaultChild3',
|
|
148
157
|
op: WidgetOperationTypes.APPEND,
|
|
149
|
-
element: (_jsx(
|
|
158
|
+
element: (_jsx(Widget, { title: "Widget Three" }))
|
|
150
159
|
},
|
|
151
160
|
// TODO: Override Layout
|
|
152
161
|
// Prepending
|
|
@@ -154,19 +163,19 @@ const app = {
|
|
|
154
163
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcasePrepending',
|
|
155
164
|
id: 'org.openedx.frontend.widget.slotShowcase.prependingChild1',
|
|
156
165
|
op: WidgetOperationTypes.APPEND,
|
|
157
|
-
element: (_jsx(
|
|
166
|
+
element: (_jsx(Widget, { title: "Widget One", op: "WidgetOperationTypes.APPEND" }))
|
|
158
167
|
},
|
|
159
168
|
{
|
|
160
169
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcasePrepending',
|
|
161
170
|
id: 'org.openedx.frontend.widget.slotShowcase.prependingChild2',
|
|
162
171
|
op: WidgetOperationTypes.APPEND,
|
|
163
|
-
element: (_jsx(
|
|
172
|
+
element: (_jsx(Widget, { title: "Widget Two", op: "WidgetOperationTypes.APPEND" }))
|
|
164
173
|
},
|
|
165
174
|
{
|
|
166
175
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcasePrepending',
|
|
167
176
|
id: 'org.openedx.frontend.widget.slotShowcase.prependingChild3',
|
|
168
177
|
op: WidgetOperationTypes.PREPEND,
|
|
169
|
-
element: (_jsx(
|
|
178
|
+
element: (_jsx(Widget, { title: "Widget Three", op: "WidgetOperationTypes.PREPEND" }))
|
|
170
179
|
},
|
|
171
180
|
// Inserting
|
|
172
181
|
{
|
|
@@ -174,77 +183,77 @@ const app = {
|
|
|
174
183
|
id: 'slot-showcase.inserting.child4',
|
|
175
184
|
op: WidgetOperationTypes.INSERT_AFTER,
|
|
176
185
|
relatedId: 'org.openedx.frontend.widget.slotShowcase.insertingChild2',
|
|
177
|
-
element: (_jsx(
|
|
186
|
+
element: (_jsx(Widget, { title: "Widget Four", op: "WidgetOperationTypes.INSERT_AFTER" }))
|
|
178
187
|
},
|
|
179
188
|
{
|
|
180
189
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseInserting',
|
|
181
190
|
id: 'slot-showcase.inserting.child5',
|
|
182
191
|
op: WidgetOperationTypes.INSERT_BEFORE,
|
|
183
192
|
relatedId: 'org.openedx.frontend.widget.slotShowcase.insertingChild2',
|
|
184
|
-
element: (_jsx(
|
|
193
|
+
element: (_jsx(Widget, { title: "Widget Five", op: "WidgetOperationTypes.INSERT_BEFORE" }))
|
|
185
194
|
},
|
|
186
195
|
{
|
|
187
196
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseInserting',
|
|
188
197
|
id: 'org.openedx.frontend.widget.slotShowcase.insertingChild1',
|
|
189
198
|
op: WidgetOperationTypes.APPEND,
|
|
190
|
-
element: (_jsx(
|
|
199
|
+
element: (_jsx(Widget, { title: "Widget One" }))
|
|
191
200
|
},
|
|
192
201
|
{
|
|
193
202
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseInserting',
|
|
194
203
|
id: 'org.openedx.frontend.widget.slotShowcase.insertingChild2',
|
|
195
204
|
op: WidgetOperationTypes.APPEND,
|
|
196
|
-
element: (_jsx(
|
|
205
|
+
element: (_jsx(Widget, { title: "Widget Two" }))
|
|
197
206
|
},
|
|
198
207
|
{
|
|
199
208
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseInserting',
|
|
200
209
|
id: 'org.openedx.frontend.widget.slotShowcase.insertingChild3',
|
|
201
210
|
op: WidgetOperationTypes.APPEND,
|
|
202
|
-
element: (_jsx(
|
|
211
|
+
element: (_jsx(Widget, { title: "Widget Three" }))
|
|
203
212
|
},
|
|
204
213
|
// Replacing
|
|
205
214
|
{
|
|
206
215
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseReplacing',
|
|
207
216
|
id: 'org.openedx.frontend.widget.slotShowcase.replacingChild1',
|
|
208
217
|
op: WidgetOperationTypes.APPEND,
|
|
209
|
-
element: (_jsx(
|
|
218
|
+
element: (_jsx(Widget, { title: "Widget One" }))
|
|
210
219
|
},
|
|
211
220
|
{
|
|
212
221
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseReplacing',
|
|
213
222
|
id: 'org.openedx.frontend.widget.slotShowcase.replacingChild2',
|
|
214
223
|
op: WidgetOperationTypes.APPEND,
|
|
215
|
-
element: (_jsx(
|
|
224
|
+
element: (_jsx(Widget, { title: "Widget Two" }))
|
|
216
225
|
},
|
|
217
226
|
{
|
|
218
227
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseReplacing',
|
|
219
228
|
id: 'org.openedx.frontend.widget.slotShowcase.replacingChild3',
|
|
220
229
|
op: WidgetOperationTypes.APPEND,
|
|
221
|
-
element: (_jsx(
|
|
230
|
+
element: (_jsx(Widget, { title: "Widget Three" }))
|
|
222
231
|
},
|
|
223
232
|
{
|
|
224
233
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseReplacing',
|
|
225
234
|
id: 'org.openedx.frontend.widget.slotShowcase.replacingChild4',
|
|
226
235
|
op: WidgetOperationTypes.REPLACE,
|
|
227
236
|
relatedId: 'org.openedx.frontend.widget.slotShowcase.replacingChild2',
|
|
228
|
-
element: (_jsx(
|
|
237
|
+
element: (_jsx(Widget, { title: "Widget Four", op: "WidgetOperationTypes.REPLACE" }))
|
|
229
238
|
},
|
|
230
239
|
// Hiding
|
|
231
240
|
{
|
|
232
241
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseRemoving',
|
|
233
242
|
id: 'org.openedx.frontend.widget.slotShowcase.removingChild1',
|
|
234
243
|
op: WidgetOperationTypes.APPEND,
|
|
235
|
-
element: (_jsx(
|
|
244
|
+
element: (_jsx(Widget, { title: "Widget One" }))
|
|
236
245
|
},
|
|
237
246
|
{
|
|
238
247
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseRemoving',
|
|
239
248
|
id: 'org.openedx.frontend.widget.slotShowcase.removingChild2',
|
|
240
249
|
op: WidgetOperationTypes.APPEND,
|
|
241
|
-
element: (_jsx(
|
|
250
|
+
element: (_jsx(Widget, { title: "Widget Two" }))
|
|
242
251
|
},
|
|
243
252
|
{
|
|
244
253
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseRemoving',
|
|
245
254
|
id: 'org.openedx.frontend.widget.slotShowcase.removingChild3',
|
|
246
255
|
op: WidgetOperationTypes.APPEND,
|
|
247
|
-
element: (_jsx(
|
|
256
|
+
element: (_jsx(Widget, { title: "Widget Three" }))
|
|
248
257
|
},
|
|
249
258
|
{
|
|
250
259
|
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseRemoving',
|
|
@@ -269,9 +278,36 @@ const app = {
|
|
|
269
278
|
relatedId: 'org.openedx.frontend.widget.slotShowcase.widgetOptionsChild2',
|
|
270
279
|
op: WidgetOperationTypes.OPTIONS,
|
|
271
280
|
options: {
|
|
272
|
-
title:
|
|
281
|
+
title: 'Bar',
|
|
273
282
|
}
|
|
274
283
|
},
|
|
284
|
+
// Widget filtering by role
|
|
285
|
+
{
|
|
286
|
+
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseFilterByRole',
|
|
287
|
+
id: 'org.openedx.frontend.widget.slotShowcase.filterChild1',
|
|
288
|
+
op: WidgetOperationTypes.APPEND,
|
|
289
|
+
element: (_jsx(Widget, { title: "Widget One" }))
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseFilterByRole',
|
|
293
|
+
id: 'org.openedx.frontend.widget.slotShowcase.filterChild2',
|
|
294
|
+
role: 'org.openedx.frontend.role.slotShowcase.highlighted',
|
|
295
|
+
op: WidgetOperationTypes.APPEND,
|
|
296
|
+
element: (_jsx(Widget, { title: "Widget Two (highlighted)", className: "showcase-widget-highlighted" }))
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseFilterByRole',
|
|
300
|
+
id: 'org.openedx.frontend.widget.slotShowcase.filterChild3',
|
|
301
|
+
op: WidgetOperationTypes.APPEND,
|
|
302
|
+
element: (_jsx(Widget, { title: "Widget Three" }))
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
slotId: 'org.openedx.frontend.slot.dev.slotShowcaseFilterByRole',
|
|
306
|
+
id: 'org.openedx.frontend.widget.slotShowcase.filterChild4',
|
|
307
|
+
role: 'org.openedx.frontend.role.slotShowcase.highlighted',
|
|
308
|
+
op: WidgetOperationTypes.APPEND,
|
|
309
|
+
element: (_jsx(Widget, { title: "Widget Four (highlighted)", className: "showcase-widget-highlighted" }))
|
|
310
|
+
},
|
|
275
311
|
// Header
|
|
276
312
|
{
|
|
277
313
|
slotId: 'org.openedx.frontend.slot.header.primaryLinks.v1',
|