From 86da5111d9724b1fe74469c9b3a7f346d1da7725 Mon Sep 17 00:00:00 2001 From: GCHQ-Developer-112 <113986285+GCHQ-Developer-112@users.noreply.github.com> Date: Tue, 30 Apr 2024 15:32:23 +0100 Subject: [PATCH] feat(root): add Stackblitz functionality to component code examples update code examples to work with the new Stackblitz functionality, add toggle button to switch between TypeScript and JavaScript, add show more/less button to component code examples . #773 #774 #751 --- gatsby-node.js | 110 +- src/components/CodePreview/index.css | 8 +- src/components/CodePreview/index.tsx | 291 +- .../structured/components/accordion/code.mdx | 198 +- .../structured/components/alerts/code.mdx | 259 +- .../components/back-to-top/code.mdx | 29 +- .../structured/components/badge/code.mdx | 914 +++-- .../components/breadcrumbs/code.mdx | 137 +- .../structured/components/buttons/code.mdx | 517 ++- .../structured/components/cards/code.mdx | 1563 +++++--- .../structured/components/cards/guidance.mdx | 4 +- .../structured/components/checkboxes/code.mdx | 222 +- .../structured/components/chips/code.mdx | 102 +- .../components/classification-banner/code.mdx | 62 +- .../components/data-entity/code.mdx | 560 +-- .../structured/components/data-table/code.mdx | 3188 ++++++++++++++--- .../components/data-table/story-data.ts | 89 + .../structured/components/date-input/code.mdx | 392 +- .../components/date-picker/code.mdx | 996 ++++- .../structured/components/dialog/code.mdx | 1161 +++--- .../components/empty-state/code.mdx | 515 ++- .../structured/components/footer/code.mdx | 439 ++- .../structured/components/hero/code.mdx | 402 ++- .../structured/components/links/code.mdx | 198 +- .../components/loading-indicators/code.mdx | 219 +- .../components/multi-select/code.mdx | 1657 +++++++-- .../components/page-header/code.mdx | 304 +- .../structured/components/pagination/code.mdx | 224 +- .../components/popover-menu/code.mdx | 333 +- .../structured/components/radio/code.mdx | 300 +- .../structured/components/search-bar/code.mdx | 772 +++- .../components/section-container/code.mdx | 229 +- .../structured/components/select/code.mdx | 934 +++-- .../structured/components/side-nav/code.mdx | 288 +- .../structured/components/skeleton/code.mdx | 511 +-- .../components/status-tags/code.mdx | 225 +- .../structured/components/stepper/code.mdx | 154 +- .../structured/components/switch/code.mdx | 138 +- .../structured/components/tabs/code.mdx | 368 +- .../structured/components/text-field/code.mdx | 546 ++- .../structured/components/toasts/code.mdx | 713 +++- .../components/toggle-buttons/code.mdx | 1117 ++++-- .../structured/components/tooltips/code.mdx | 407 ++- .../structured/components/top-nav/code.mdx | 783 ++-- .../components/top-nav/guidance.mdx | 8 +- .../structured/components/typography/code.mdx | 184 +- .../components/StackblitzButton/index.tsx | 14 +- .../StackblitzButton/stackblitz-helpers.ts | 279 +- .../patterns/side-navigation-layout.mdx | 923 ++++- .../patterns/top-navigation-layout.mdx | 1301 +++++-- src/data/canary-component-names.json | 93 + src/icds-pages-data.json | 708 ++-- src/pages/footer-layout.tsx | 4 +- .../side-navigation-back-to-top-pattern.tsx | 52 +- .../side-navigation-page-header-pattern.tsx | 56 +- src/pages/side-navigation-pattern.tsx | 52 +- 56 files changed, 19986 insertions(+), 6266 deletions(-) create mode 100644 src/data/canary-component-names.json diff --git a/gatsby-node.js b/gatsby-node.js index a024c806f..a62ab24f5 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -1,4 +1,7 @@ -const path = require(`path`); +const path = require("path"); +const fs = require("fs"); +// eslint-disable-next-line import/no-extraneous-dependencies +const prettier = require("prettier"); // eslint-disable-next-line import/no-extraneous-dependencies const webpack = require("webpack"); const pagesConfig = require("./src/config"); @@ -236,6 +239,11 @@ exports.createResolvers = ({ createResolvers }) => { exports.onCreateWebpackConfig = ({ actions }) => { actions.setWebpackConfig({ + resolve: { + fallback: { + fs: false, + }, + }, plugins: [ /** * See line 203 of: @@ -277,3 +285,103 @@ exports.onCreateWebpackConfig = ({ actions }) => { ], }); }; + +exports.sourceNodes = () => { + // Find the name of the components in the @ukic* folders + const canaryReact = path.resolve( + __dirname, + "node_modules/@ukic/canary-react/dist/components.d.ts" + ); + const canaryWebComponents = path.resolve( + __dirname, + "node_modules/@ukic/canary-web-components/dist/types/components" + ); + const react = path.resolve( + __dirname, + "node_modules/@ukic/react/dist/components.d.ts" + ); + + // Get the names of components in the canary-web-components package + const canaryWebComponentsNames = fs + .readdirSync(canaryWebComponents, { withFileTypes: true }) + .filter((dirent) => dirent.isDirectory()) + .map((dirent) => dirent.name); + + const getComponentNames = (filePath, regex) => { + const fileContent = fs.readFileSync(filePath, "utf8"); + const componentNames = []; + let match = regex.exec(fileContent); + while (match !== null) { + componentNames.push(match[1]); + match = regex.exec(fileContent); + } + return componentNames; + }; + + const regex = /export declare const (\w+):/g; + // Read the contents of the canaryReact and react file + const canaryReactComponentNames = getComponentNames(canaryReact, regex); + const reactComponentNames = getComponentNames(react, regex); + + // Get the types of the components in the canary-web-components package + const getCanaryWebComponentTypes = (directory, componentNames) => { + const typesRegex = /export\s+type\s+(\w+)\s+=/g; + let canaryTypes = []; + + if (!directory || typeof directory !== "string") { + throw new Error("Invalid directory"); + } + + if (!Array.isArray(componentNames)) { + throw new Error("Invalid componentNames"); + } + + componentNames.forEach((componentName) => { + const componentDirectory = path.join(directory, componentName); + + const filesInDirectory = fs.readdirSync(componentDirectory); + + filesInDirectory.forEach((fileName) => { + if (fileName.endsWith(".types.d.ts")) { + const fileContent = fs.readFileSync( + path.join(componentDirectory, fileName), + "utf8" + ); + + let typesMatch = typesRegex.exec(fileContent); + while (typesMatch !== null) { + const exports = typesMatch[1] + .trim() + .split(",") + .map((item) => item.trim()); + canaryTypes = [...canaryTypes, ...exports]; + typesMatch = typesRegex.exec(fileContent); + } + } + }); + }); + return [...new Set(canaryTypes)]; + }; + + const data = { + canaryReactComponentNames, + canaryWebComponentsNames, + canaryTypes: getCanaryWebComponentTypes( + canaryWebComponents, + canaryWebComponentsNames + ), + reactComponentNames, + }; + const outputFilePath = path.resolve( + __dirname, + "./src/data/canary-component-names.json" + ); + if (!outputFilePath.startsWith(__dirname)) { + throw new Error("Invalid file path"); + } + + fs.writeFileSync( + outputFilePath, + prettier.format(JSON.stringify(data), { parser: "json" }) + ); +}; diff --git a/src/components/CodePreview/index.css b/src/components/CodePreview/index.css index d8f3a6e25..ad1436a6e 100644 --- a/src/components/CodePreview/index.css +++ b/src/components/CodePreview/index.css @@ -6,6 +6,10 @@ justify-content: space-between; } +.toggle-button-container { + margin: auto var(--ic-space-xs) auto 0; +} + .comp-preview { position: relative; border: 1px solid var(--ic-architectural-300); @@ -71,12 +75,8 @@ .snippet-container { display: flex; - justify-content: flex-end; background-color: var(--ic-architectural-40) !important; padding: var(--ic-space-xxs); -} - -.snippet-container.pattern { justify-content: space-between; } diff --git a/src/components/CodePreview/index.tsx b/src/components/CodePreview/index.tsx index 77f5a6448..b36072ae6 100644 --- a/src/components/CodePreview/index.tsx +++ b/src/components/CodePreview/index.tsx @@ -5,6 +5,8 @@ import React, { useState, Dispatch, SetStateAction, + useRef, + useEffect, } from "react"; import startCase from "lodash.startcase"; import { @@ -16,19 +18,40 @@ import { } from "@mdi/js"; import Icon from "@mdi/react"; import clsx from "clsx"; -import { SlottedSVG } from "@ukic/react"; +import { + IcButton, + IcTab, + IcTabContext, + IcTabGroup, + IcTabPanel, + IcToggleButton, + IcToggleButtonGroup, + SlottedSVG, +} from "@ukic/react"; import StackblitzButton, { StackblitzProps, } from "../../content/structured/patterns/components/StackblitzButton"; +import { useViewportWidth } from "../../utils/helpers"; import PageMetadataContext from "../../context/PageMetadata"; import "./index.css"; -import { useViewportWidth } from "../../utils/helpers"; +import { + createReactAppTsx, + createWebComponentsIndexHTML, +} from "../../content/structured/patterns/components/StackblitzButton/stackblitz-helpers"; -interface Snippet { - language: string; +interface LongCodeSnippet { + language: "jsx" | "tsx"; snippet: string; } +interface Snippet { + technology: string; + snippets: { + short?: string | undefined; + long: string | LongCodeSnippet[]; + }; +} + interface ComponentPreviewProps extends Partial { snippets?: Snippet[]; left?: boolean; @@ -37,26 +60,35 @@ interface ComponentPreviewProps extends Partial { children: ReactNode; style: CSSProperties; state: "none" | "good" | "bad"; + showStackblitzBtn: boolean; type?: string; } interface CodeSnippetProps extends Partial { code: string; + longCode: string; type?: string; show: boolean; setShow: Dispatch>; + showMore: boolean; + setShowMore: Dispatch>; showStackblitzBtn?: boolean; + selectedLanguage: "Typescript" | "Javascript"; } const CodeSnippet: React.FC = ({ code, + longCode, isWebComponents, type, show, setShow, + showMore, + setShowMore, showStackblitzBtn, projectTitle, projectDescription, + selectedLanguage, }) => { const viewportWidth = useViewportWidth(); const isLargeViewport: boolean = viewportWidth > 992; @@ -85,9 +117,9 @@ const CodeSnippet: React.FC = ({ )} )} -
+
{type === "pattern" && ( - = ({ height="24" path={!show ? mdiMenuDown : mdiMenuUp} /> - + + )} + {type !== "pattern" && ( + setShowMore(!showMore)} + > + Show {showMore ? "less" : "full"} code + + )}
{showStackblitzBtn && projectTitle !== undefined && ( )} - = ({ height="24" /> {isLargeViewport && "Copy code"} - +
@@ -147,11 +197,39 @@ const ComponentPreview: React.FC = ({ centered = true, style, state = "none", + showStackblitzBtn = true, projectTitle, projectDescription, type, }) => { + const viewportWidth = useViewportWidth(); + const isLargeViewport: boolean = viewportWidth > 992; + + const [tabCount, setTabCount] = useState(2); + const tabContextRef = useRef(null); + + useEffect(() => { + if (tabContextRef.current) { + const tabs = tabContextRef.current.querySelectorAll("ic-tab"); + setTabCount(tabs.length); + } + }, []); + + // Show/hide functionality for pattern code previews const [show, setShow] = useState(type !== "pattern"); + // Show more/less functionality for component code previews + const [showMore, setShowMore] = useState(false); + const [selectedTab, setSelectedTab] = useState<"Web component" | "React">( + tabCount === 1 ? "React" : "Web component" + ); + + const [selectedLanguage, setSelectedLanguage] = useState< + "Typescript" | "Javascript" + >("Typescript"); + + const tabSelectCallback = (ev: CustomEvent) => { + setSelectedTab(ev.detail.tabLabel); + }; const pageMetadata = React.useContext(PageMetadataContext); @@ -159,12 +237,115 @@ const ComponentPreview: React.FC = ({ if (type === "pattern") { return " pattern"; } - if (snippet.language === "React") { + if (snippet.technology === "React") { return " component"; } return ""; }; + // need to account for if the code starts with styling as opposed to a tag + + const formatLines = ( + lines: string[] | undefined, + snippet: Snippet, + longCodeIndex: number + ) => { + const formatWhiteSpace = (codeSnippet: Snippet, index: number) => { + if ( + selectedTab === "React" && + Array.isArray(codeSnippet.snippets.long) && + codeSnippet.snippets.long[index].snippet === "{shortCode}" + ) { + return `\t`; + } + return ``; + }; + + const newLines = lines ? [...lines] : []; + if (newLines.length > 0) { + for (let i = 1; i < newLines.length; i += 1) { + const whiteSpace = formatWhiteSpace(snippet, longCodeIndex); + newLines[i] = ` ${ + selectedTab === "Web component" ? ` ` : whiteSpace + }${newLines[i]}`; + } + } + return newLines.join("\n"); + }; + + const getCodeSnippetForWebComponent = ( + snippet: Snippet, + shortCodeSnippet: string + ) => { + let longCode = ""; + if ( + !Array.isArray(snippet.snippets.long) && + typeof snippet.snippets.long === "string" + ) { + longCode = snippet.snippets.long.replace( + "{shortCode}", + `${shortCodeSnippet}` + ); + } + + let codeSnippet; + if (showMore) { + codeSnippet = createWebComponentsIndexHTML(longCode); + } else if (type === "pattern") { + if (typeof snippet.snippets.long === "string") + codeSnippet = createWebComponentsIndexHTML(snippet.snippets.long); + } else { + codeSnippet = snippet.snippets.short; + } + + return { + longCode: createWebComponentsIndexHTML(longCode), + codeSnippet: codeSnippet || "", + }; + }; + + const getCodeSnippet = (snippet: Snippet) => { + const isLongCode = showMore || type === "pattern"; + const longCodeIndex = selectedLanguage === "Typescript" ? 0 : 1; + let shortCodeSnippet: string | undefined = ""; + if (type !== "pattern") shortCodeSnippet = snippet.snippets.short; + + shortCodeSnippet = formatLines( + shortCodeSnippet?.split("\n"), + snippet, + longCodeIndex + ); + + if (selectedTab === "Web component" && snippet.technology !== "React") { + return getCodeSnippetForWebComponent(snippet, shortCodeSnippet); + } + + if (Array.isArray(snippet.snippets.long)) { + let longCode = ""; + if ( + !Array.isArray(snippet.snippets.long[longCodeIndex].snippet) && + typeof snippet.snippets.long[longCodeIndex].snippet === "string" + ) { + longCode = createReactAppTsx( + snippet.snippets.long[longCodeIndex].snippet.replace( + "{shortCode}", + `${shortCodeSnippet}` + ), + pageMetadata.pageTitle, + longCodeIndex === 0 ? "tsx" : "jsx" + ); + } + return { + longCode, + codeSnippet: isLongCode ? longCode : snippet.snippets.short, + }; + } + return { + longCode: "error", + codeSnippet: "error", + }; + }; + return (

Interactive example

@@ -197,37 +378,99 @@ const ComponentPreview: React.FC = ({ {children}
{snippets && ( - +
- + {snippets.map((snippet, index) => ( - {snippet.language} + + {snippet.technology} + ))} - + +
+ {(selectedTab === "React" || tabCount === 1) && ( + + + setSelectedLanguage( + selectedLanguage === "Typescript" + ? "Javascript" + : "Typescript" + ) + } + > + + + + + + setSelectedLanguage( + selectedLanguage === "Typescript" + ? "Javascript" + : "Typescript" + ) + } + > + + + + + + )} +
{snippets.map((snippet, index) => ( - + - + ))} -
+ )}
); diff --git a/src/content/structured/components/accordion/code.mdx b/src/content/structured/components/accordion/code.mdx index b4420e5a6..6276504e6 100644 --- a/src/content/structured/components/accordion/code.mdx +++ b/src/content/structured/components/accordion/code.mdx @@ -1,7 +1,7 @@ --- path: "/components/accordion/code" -date: "2023-10-11" +date: "2024-05-02" title: "Accordion" @@ -30,8 +30,9 @@ import { export const snippets = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` A blend of different black teas. @@ -40,12 +41,14 @@ export const snippets = [ A tea blend that has been flavoured with oil of bergamot. - -`, +`, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` A blend of different black teas. @@ -54,8 +57,22 @@ export const snippets = [ A tea blend that has been flavoured with oil of bergamot. - -`, +`, + long: [ + { + language: "Typescript", + snippet: `<> + {shortCode} +`, + }, + { + language: "Javascript", + snippet: `<> + {shortCode} +`, + }, + ], + }, }, ]; @@ -84,70 +101,89 @@ export const snippets = [ export const withIcon = [ { - language: "Web component", - snippet: ` - - - + technology: "Web component", + snippets: { + short: ` + + + A blend of different black teas. - - - - A tea blend that has been flavoured with oil of bergamot. - - `, + slot="icon" + width="24" + height="24" + viewBox="0 0 24 24" + fill="currentColor" + xmlns="http://www.w3.org/2000/svg" + > + + + + A tea blend that has been flavoured with oil of bergamot. + +`, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` - - + slot="icon" + width="24" + height="24" + viewBox="0 0 24 24" + fill="currentColor" + xmlns="http://www.w3.org/2000/svg" + > + + A blend of different black teas. - - - - A tea blend that has been flavoured with oil of bergamot. - - `, + slot="icon" + width="24" + height="24" + viewBox="0 0 24 24" + fill="currentColor" + xmlns="http://www.w3.org/2000/svg" + > + + + + A tea blend that has been flavoured with oil of bergamot. + +`, + long: [ + { + language: "Typescript", + snippet: `<> + {shortCode} +`, + }, + { + language: "Javascript", + snippet: `<> + {shortCode} +`, + }, + ], + }, }, ]; @@ -202,8 +238,9 @@ export const withIcon = [ export const groupTitle = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` An espresso-based drink that is traditionally prepared with steamed milk foam. @@ -215,10 +252,13 @@ export const groupTitle = [ `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` An espresso-based drink that is traditionally prepared with steamed milk foam. @@ -230,6 +270,17 @@ export const groupTitle = [ `, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -237,8 +288,9 @@ export const groupTitle = [ export const snippetsNested = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` An espresso-based drink that is traditionally prepared with steamed milk foam. @@ -257,10 +309,13 @@ export const snippetsNested = [ `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` An espresso-based drink that is traditionally prepared with steamed milk foam. @@ -279,6 +334,17 @@ export const snippetsNested = [ `, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; diff --git a/src/content/structured/components/alerts/code.mdx b/src/content/structured/components/alerts/code.mdx index 8b1e640a4..ce327e0ea 100644 --- a/src/content/structured/components/alerts/code.mdx +++ b/src/content/structured/components/alerts/code.mdx @@ -1,7 +1,7 @@ --- path: "/components/alert/code" -date: "2024-02-02" +date: "2024-05-02" title: "Alert" @@ -25,20 +25,77 @@ import { IcAlert, IcButton, IcLink } from "@ukic/react"; export const snippetsDefault = [ { - language: "Web component", - snippet: ` - - - -`, + technology: "Web component", + snippets: { + short: ` + + + +`, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` - - - -`, + technology: "React", + snippets: { + short: ` + + + +`, + long: [ + { + language: "Typescript", + snippet: `<> + {shortCode} +`, + }, + { + language: "Javascript", + snippet: `<> + {shortCode} +`, + }, + ], + }, }, ]; @@ -84,12 +141,35 @@ export const snippetsDefault = [ export const snippetsDismissible = [ { - language: "Web component", - snippet: ``, + technology: "Web component", + snippets: { + short: ``, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ``, + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -105,22 +185,47 @@ export const snippetsDismissible = [ export const snippetsWithAction = [ { - language: "Web component", - snippet: ` - View Drinks - + technology: "Web component", + snippets: { + short: ` + View Drinks`, + long: `{shortCode} `, + }, }, { - language: "React", - snippet: ` - console.log(ev)}>View Drinks + technology: "React", + snippets: { + short: ` + console.log(ev)} + > + View Drinks + `, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -145,21 +250,37 @@ export const snippetsWithAction = [ export const snippetsTitleAbove = [ { - language: "Web component", - snippet: ` - `, + technology: "Web component", + snippets: { + short: ``, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ``, + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -176,19 +297,35 @@ export const snippetsTitleAbove = [ export const snippetsResponsiveTitle = [ { - language: "Web component", - snippet: ` - `, + technology: "Web component", + snippets: { + short: ``, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ``, + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -204,16 +341,30 @@ export const snippetsResponsiveTitle = [ export const snippetsCustomMessage = [ { - language: "Web component", - snippet: ` - Go to our coffee page to learn more. -`, + technology: "Web component", + snippets: { + short: ` + Go to our coffee page to learn more.`, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` Go to our coffee page to learn more. `, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; diff --git a/src/content/structured/components/back-to-top/code.mdx b/src/content/structured/components/back-to-top/code.mdx index e15eb5c69..d280c628a 100644 --- a/src/content/structured/components/back-to-top/code.mdx +++ b/src/content/structured/components/back-to-top/code.mdx @@ -1,7 +1,7 @@ --- path: "/components/back-to-top/code" -date: "2023-02-03" +date: "2024-05-02" title: "Back to top" @@ -23,18 +23,35 @@ import { IcButton } from "@ukic/react"; export const snippets = [ { - language: "Web component", - snippet: ``, + technology: "Web component", + snippets: { + short: ``, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ``, + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; ## Component demo - +A StackBlitz example of how the back to top component works in the context of other components can be seen in the [Top Navigation with Back to Top layout example](/patterns/navigation-patterns/top-navigation-layout#back-to-top). + + { diff --git a/src/content/structured/components/badge/code.mdx b/src/content/structured/components/badge/code.mdx index d5bccc12b..ef6ed2431 100644 --- a/src/content/structured/components/badge/code.mdx +++ b/src/content/structured/components/badge/code.mdx @@ -1,7 +1,7 @@ --- path: "/components/badge/code" -date: "2024-02-02" +date: "2024-05-02" title: "Badge" @@ -35,35 +35,71 @@ import { useState } from "react"; export const snippetsDefault = [ { - language: "Web component", - snippet: ` - + - + > Coffee orders `, + long: `.parent-container { + padding: 16px; + } + + +
+ {shortCode} +
`, + }, }, { - language: "React", - snippet: ` - + technology: "React", + snippets: { + short: ` + Coffee orders `, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; - - + + Coffee orders @@ -78,23 +114,37 @@ export const snippetsDefault = [ export const snippetsSizes = [ { - language: "Web component", - snippet: ` - + technology: "Web component", + snippets: { + short: ` + Coffee orders - + Coffee orders - + Coffee orders `, + long: `.parent-container { + display: flex; + flex-wrap: wrap; + padding: 16px; + gap: 16px; + } + + +
+ {shortCode} +
`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` Coffee orders @@ -106,15 +156,52 @@ export const snippetsSizes = [ Coffee orders `, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + display: "flex", + flexWrap: "wrap", + padding: "16px", + gap: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + display: "flex", + flexWrap: "wrap", + padding: "16px", + gap: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; - - + + Coffee orders - + Coffee orders @@ -128,59 +215,110 @@ export const snippetsSizes = [ export const snippetsStatus = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` Coffee orders - + Coffee orders - + Coffee orders - + Coffee orders `, + long: `.parent-container { + display: flex; + flex-wrap: wrap; + padding: 16px; + gap: 16px; + } + + +
+ {shortCode} +
`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` Coffee orders - + Coffee orders - + Coffee orders - + Coffee orders `, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + display: "flex", + flexWrap: "wrap", + padding: "16px", + gap: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + display: "flex", + flexWrap: "wrap", + padding: "16px", + gap: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; - - + + Coffee orders - + Coffee orders - + Coffee orders - + Coffee orders @@ -190,23 +328,24 @@ export const snippetsStatus = [ export const snippetsInformation = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` Coffee orders - + Coffee orders - + @@ -217,231 +356,354 @@ export const snippetsInformation = [ Coffee orders `, + long: `.parent-container { + display: flex; + flex-wrap: wrap; + padding: 16px; + gap: 16px; + } + + +
+ {shortCode} +
`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` Coffee orders - + Coffee orders - + - - + Coffee orders `, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + display: "flex", + flexWrap: "wrap", + padding: "16px", + gap: "16px", }, -]; - - -
- - - Coffee orders - +}); +const classes = useStyles(); +return ( +
+ {shortCode}
-
- - - Coffee orders - -
-
- - - - - - - - Coffee orders - +)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + display: "flex", + flexWrap: "wrap", + padding: "16px", + gap: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode}
+)`, + }, + ], + }, + }, +]; + + + + + Coffee orders + + + + Coffee orders + + + + + + + + + Coffee orders + ### Max number export const snippetsMaxNumber = [ { - language: "Web component", - snippet: `
- - - - Coffee orders - -
`, + technology: "Web component", + snippets: { + short: ` + + Coffee orders +`, + long: `.parent-container { + padding: 16px; + } + + +
+ {shortCode} +
`, + }, }, { - language: "React", - snippet: `
- - - Coffee orders - -
`, + technology: "React", + snippets: { + short: ` + + Coffee orders +`, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; -
- - - Coffee orders - -
+ + + Coffee orders +
### Positioning export const snippetsNear = [ { - language: "Web component", - snippet: `
- - - - - - - - - - - - - - -
`, + technology: "Web component", + snippets: { + short: ` + + + + + + + + + + + + +`, + long: `.chip-container { + display: flex; + flex-wrap: wrap; + padding: 16px; + gap: 16px; + } + + +
+ {shortCode} +
`, + }, }, { - language: "React", - snippet: `
- + technology: "React", + snippets: { + short: ` + + + + + + + + + + + + +`, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + chipContainer: { + display: "flex", + flexWrap: "wrap", + padding: "16px", + gap: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + chipContainer: { + display: "flex", + flexWrap: "wrap", + padding: "16px", + gap: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, + }, +]; + + + - - - + + - + - - - - + + + -
`, - }, -]; - - -
-
- - - - - - - - - - - - - - -
-
### Position inline export const snippetsInline = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` - About + + About - Ingredients + Ingredients - Orders - + > + Orders About page Ingredients page Orders page `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` - About + About - Ingredients + Ingredients - Orders + Orders About page Ingredients page Orders page `, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -516,45 +792,83 @@ Click the button to hide and show the badge. export const snippetsHideBadge = [ { - language: "Web component", - snippet: ` -
- - - Coffee orders - -
`, + + +
+ {shortCode} +
+ `, + }, }, { - language: "React", - snippet: `export const ToggleBadge = () => { - const [showBadge, setShowBadge] = useState(false); - const handleShowHideBadge = () => { - setShowBadge(!showBadge); - }; - return ( -
- - - Coffee orders - -
- ); -};`, + technology: "React", + snippets: { + short: ` + + Coffee orders +`, + long: [ + { + language: "Typescript", + snippet: `const [showBadge, setShowBadge] = useState(false); +const handleShowHideBadge = () => { + setShowBadge(!showBadge); +}; +const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const [showBadge, setShowBadge] = useState(false); +const handleShowHideBadge = () => { + setShowBadge(!showBadge); +}; +const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; @@ -592,49 +906,85 @@ export const ToggleBadge = () => { export const snippetsAccessibleLabel = [ { - language: "Web component", - snippet: `
- - - - Coffee orders - -
`, + technology: "Web component", + snippets: { + short: ` + + + Coffee orders +`, + long: `.parent-container { + padding: 16px; +} + + +
+ {shortCode} +
`, + }, }, { - language: "React", - snippet: `
- + technology: "React", + snippets: { + short: ` + + Coffee orders +`, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, + }, +]; + + + Coffee orders -
`, - }, -]; - - -
- - - Coffee orders - -
diff --git a/src/content/structured/components/breadcrumbs/code.mdx b/src/content/structured/components/breadcrumbs/code.mdx index e95699712..e2f899c68 100644 --- a/src/content/structured/components/breadcrumbs/code.mdx +++ b/src/content/structured/components/breadcrumbs/code.mdx @@ -1,7 +1,7 @@ --- path: "/components/breadcrumb/code" -date: "2024-02-02" +date: "2024-05-02" title: "Breadcrumb" @@ -27,8 +27,9 @@ import { NavLink, MemoryRouter } from "react-router-dom"; export const snippets = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` `, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -88,8 +103,9 @@ export const snippets = [ export const back = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` `, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -139,8 +169,9 @@ export const back = [ export const withIcons = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` `, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -311,29 +356,44 @@ export const withIcons = [ export const collapsed = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` - + current="true" + page-title="Coffee" + href="#" + > + `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` - - - + technology: "React", + snippets: { + short: ` + + + `, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -362,8 +422,9 @@ export const collapsed = [ export const withReactRouter = [ { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` @@ -381,8 +442,18 @@ export const withReactRouter = [ - -`, +`, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; diff --git a/src/content/structured/components/buttons/code.mdx b/src/content/structured/components/buttons/code.mdx index c516f4ec6..adbad6a10 100644 --- a/src/content/structured/components/buttons/code.mdx +++ b/src/content/structured/components/buttons/code.mdx @@ -1,7 +1,7 @@ --- path: "/components/button/code" -date: "2024-03-13" +date: "2024-05-02" title: "Button" @@ -25,24 +25,77 @@ import { IcButton } from "@ukic/react"; export const snippetsDefault = [ { - language: "Web component", - snippet: `Add to order + technology: "Web component", + snippets: { + short: `Add to order View coffees Find out more -Cancel order -`, +Cancel order`, + long: `.btn-container { + display: flex; + flex-wrap: wrap; + gap: 8px; + padding: 16px; + } + + +
+ {shortCode} +
+ `, + }, }, { - language: "React", - snippet: ` console.log(ev)}>Add to order - View coffees - Find out more - Cancel order`, + technology: "React", + snippets: { + short: ` console.log(ev)}> + Add to order + +View coffees +Find out more +Cancel order`, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + btnContainer: { + display: "flex", + flexWrap: "wrap", + gap: "8px", + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + btnContainer: { + display: "flex", + flexWrap: "wrap", + gap: "8px", + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; @@ -65,16 +118,67 @@ export const snippetsDefault = [ export const snippetsOtherStates = [ { - language: "Web component", - snippet: `Add to order + technology: "Web component", + snippets: { + short: `Add to order Loading button Add to order`, + long: `.btn-container { + display: flex; + flex-wrap: wrap; + gap: 8px; + padding: 16px; + } + + +
+ {shortCode} +
`, + }, }, { - language: "React", - snippet: `Add to order + technology: "React", + snippets: { + short: `Add to order Loading button Add to order`, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + btnContainer: { + display: "flex", + flexWrap: "wrap", + gap: "8px", + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + btnContainer: { + display: "flex", + flexWrap: "wrap", + gap: "8px", + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; @@ -94,30 +198,34 @@ export const snippetsOtherStates = [ export const snippetsWithIcon = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` Refresh order status `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` @@ -125,6 +233,17 @@ export const snippetsWithIcon = [ Refresh order status `, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -134,9 +253,9 @@ export const snippetsWithIcon = [ @@ -149,34 +268,49 @@ export const snippetsWithIcon = [ export const snippetsIcon = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` `, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -184,9 +318,9 @@ export const snippetsIcon = [ @@ -199,16 +333,67 @@ export const snippetsIcon = [ export const snippetsSizing = [ { - language: "Web component", - snippet: `Add to order + technology: "Web component", + snippets: { + short: `Add to order Add to order Add to order`, + long: `.btn-container { + display: flex; + flex-wrap: wrap; + gap: 8px; + padding: 16px; + } + + +
+ {shortCode} +
`, + }, }, { - language: "React", - snippet: `Add to order + technology: "React", + snippets: { + short: `Add to order Add to order Add to order`, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + btnContainer: { + display: "flex", + flexWrap: "wrap", + gap: "8px", + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + btnContainer: { + display: "flex", + flexWrap: "wrap", + gap: "8px", + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; @@ -226,20 +411,67 @@ export const snippetsSizing = [ export const snippetsColour = [ { - language: "Web component", - snippet: ` - Add to order - + technology: "Web component", + snippets: { + short: `Add to order Add to order Add to order`, + long: `.btn-container { + display: flex; + flex-wrap: wrap; + gap: 8px; + padding: 16px; + } + + +
+ {shortCode} +
`, + }, }, { - language: "React", - snippet: ` - Add to order - + technology: "React", + snippets: { + short: `Add to order Add to order Add to order`, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + btnContainer: { + display: "flex", + flexWrap: "wrap", + gap: "8px", + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + btnContainer: { + display: "flex", + flexWrap: "wrap", + gap: "8px", + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; @@ -255,83 +487,136 @@ export const snippetsColour = [ ### File upload -export const FileUpload = () => { - function updateFileList(fileArray) { - const fileList = []; - Array.from(fileArray).forEach((file) => { - fileList.push(file.name); - }); - return fileList.join(", "); - } - return ( - - document.addEventListener("icFileSelection", (event) => - console.log(updateFileList(event.detail)) - ) - } - > - Upload File - - ); -}; - export const snippetsFileUpload = [ { - language: "Web component", - snippet: ` - Upload File + Upload a file -`, + document + .querySelector("#file-button-multiple") + .addEventListener("icFileSelection", (ev) => { + console.log("Multiple files upload", ev.detail); + }); + `, + }, }, { - language: "React", - snippet: `export const FileUpload = () => { - function updateFileList(fileArray) { - const fileList = []; - Array.from(fileArray).forEach((file) => { - fileList.push(file.name); - }); - return fileList.join(", "); + technology: "React", + snippets: { + short: ` + console.log("Single file upload", event.detail) } - return ( - - document.addEventListener("icFileSelection", (event) => - console.log(updateFileList(event.detail)) - ) - } - > - Upload File - - ); -};`, +> + Upload a file + + + console.log("Multiple files upload", event.detail) + } +> + Upload multiple files +`, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + btnContainer: { + display: "flex", + flexWrap: "wrap", + gap: "8px", + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + btnContainer: { + display: "flex", + flexWrap: "wrap", + gap: "8px", + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; - - + + + console.log("Single file upload", event.detail) + } + > + Upload a file + + + console.log("Multiple files upload", event.detail) + } + > + Upload multiple files + diff --git a/src/content/structured/components/cards/code.mdx b/src/content/structured/components/cards/code.mdx index 967c78174..d243b12f2 100644 --- a/src/content/structured/components/cards/code.mdx +++ b/src/content/structured/components/cards/code.mdx @@ -1,7 +1,7 @@ --- path: "/components/card/code" -date: "2024-02-02" +date: "2024-05-02" title: "Card" @@ -32,9 +32,9 @@ export const CardIcon = () => ( @@ -49,7 +49,6 @@ export const InteractionIcon = () => ( width="16" height="16" fill="currentColor" - class="bi bi-three-dots-vertical" viewBox="0 0 16 16" > @@ -60,138 +59,192 @@ export const InteractionIcon = () => ( export const snippets = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` - - - - - - - - - - - - - - - - - - + -
- Accept - Cancel -
- - To cancel your order click cancel. - +
+ + + + + + + + + + + + + + + + +
+ Accept + Cancel +
+ + To cancel your order click cancel. + `, + long: `ic-card { + width: 360px; + } + .interaction-area { + display: flex; + gap: 16px; + } + .card-image { + height: 100%; + width: 100%; + max-height: 20.375rem; + max-width: 20.375rem; + } + + + {shortCode}`, + }, }, { - language: "React", - snippet: ` - - - + technology: "React", + snippets: { + short: ` + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + +
- Accept - Cancel -
- - To cancel your order click cancel. - + slot="interaction-controls" + className={classes.interactionArea}> + Accept + Cancel +
+ + To cancel your order click cancel. + `, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + card: { + width: "360px", + }, + cardImage: { + height: "100%", + width: "100%", + maxHeight: "20.375rem", + maxWidth: "20.375rem", + }, + interactionArea: { + display: "flex", + gap: "16px", + }, +}); +const classes = useStyles(); +return ( + {shortCode} +)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + card: { + width: "360px", + }, + cardImage: { + height: "100%", + width: "100%", + maxHeight: "20.375rem", + maxWidth: "20.375rem", + }, + interactionArea: { + display: "flex", + gap: "16px", + }, +}); +const classes = useStyles(); +return ( + {shortCode} +)`, + }, + ], + }, }, ]; @@ -244,9 +297,9 @@ export const snippets = [ @@ -271,12 +324,27 @@ export const snippets = [ export const headingOnly = [ { - language: "Web component", - snippet: ``, + technology: "Web component", + snippets: { + short: ``, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ``, + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -288,35 +356,49 @@ export const headingOnly = [ export const withIcon = [ { - language: "Web component", - snippet: ` - + technology: "Web component", + snippets: { + short: ` `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` `, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -325,9 +407,9 @@ export const withIcon = [ @@ -339,34 +421,49 @@ export const withIcon = [ export const withMessage = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` `, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -378,9 +475,9 @@ export const withMessage = [ @@ -392,40 +489,57 @@ export const withMessage = [ export const withSubHeading = [ { - language: "Web component", - snippet: ` + message="Extras: Double espresso shot and oat milk." +> `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` + message="Extras: Double espresso shot and oat milk." +> `, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -438,9 +552,9 @@ export const withSubHeading = [ @@ -452,21 +566,23 @@ export const withSubHeading = [ export const interactionButton = [ { - language: "Web component", - snippet: ` - - - + message="Extras: Double espresso shot and oat milk." +> + + + `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` - - - + message="Extras: Double espresso shot and oat milk." +> + + + `, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -523,9 +652,9 @@ export const interactionButton = [ @@ -540,42 +669,59 @@ export const interactionButton = [ export const adornment = [ { - language: "Web component", - snippet: ` - - - + message="Extras: Double espresso shot and oat milk." +> + + + `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` - - - + message="Extras: Double espresso shot and oat milk." +> + + + `, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -588,9 +734,9 @@ export const adornment = [ @@ -608,120 +754,149 @@ export const adornment = [ export const topImage = [ { - language: "Web component", - snippet: ` - - - - - - - - - - - - - - - +> + + + + + + + + + + + + + + + + + + + - + - - - - - + `, + long: `ic-card { + width: 360px; + } + .card-image { + height: 100%; + width: 100%; + maxHeight: 20.375rem; + maxWidth: 20.375rem; + } + + + {shortCode}`, + }, }, { - language: "React", - snippet: ` - - - - - - - - - - - - - - - + className={classes.card} +> + + + + + + + + + + + + + + + + + + + - + - - - - `, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + card: { + width: "360px", + }, + cardImage: { + height: "100%", + width: "100%", + maxHeight: "20.375rem", + maxWidth: "20.375rem", + }, +}); +const classes = useStyles(); +return ( + {shortCode} +)`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -730,14 +905,13 @@ export const topImage = [ heading="Americano order" subheading="Name: Michael" message="Extras: Double espresso shot and oat milk." - style={{ width: "360px" }} > @@ -783,79 +957,89 @@ export const topImage = [ export const midImage = [ { - language: "Web component", - snippet: ` - + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + `, + long: `ic-card { + width:360px; + } + .card-image { + height: 100%; + width: 100%; + maxHeight: 20.375rem; + maxWidth: 20.375rem; + } + + + {shortCode}`, + }, }, { - language: "React", - snippet: ` - - - + className={classes.card} +> + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + `, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + card: { + width: "360px", + }, + cardImage: { + height: "100%", + width: "100%", + maxHeight: "20.375rem", + maxWidth: "20.375rem", + }, +}); +const classes = useStyles(); +return ( + {shortCode} +)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + card: { + width: "360px", + }, + cardImage: { + height: "100%", + width: "100%", + maxHeight: "20.375rem", + maxWidth: "20.375rem", + }, +}); +const classes = useStyles(); +return ( + {shortCode} +)`, + }, + ], + }, }, ]; @@ -903,14 +1120,13 @@ export const midImage = [ heading="Americano order" subheading="Name: Michael" message="Extras: Double espresso shot and oat milk." - style={{ width: "360px" }} > @@ -955,50 +1171,91 @@ export const midImage = [ export const interactionControls = [ { - language: "Web component", - snippet: ` + message="Extras: Double espresso shot and oat milk." +> - + -
+
Accept Cancel
`, + long: `.interaction-area { + display: flex; + gap: 16px; + } + + + {shortCode}`, + }, }, { - language: "React", - snippet: ` + message="Extras: Double espresso shot and oat milk." +> - + -
+
Accept Cancel
`, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + interactionArea: { + display: "flex", + gap: "16px", + }, +}); +const classes = useStyles(); +return ( + {shortCode} +)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + interactionArea: { + display: "flex", + gap: "16px", + }, +}); +const classes = useStyles(); +return ( + {shortCode} +)`, + }, + ], + }, }, ]; @@ -1011,9 +1268,9 @@ export const interactionControls = [ @@ -1029,23 +1286,25 @@ export const interactionControls = [ export const expandable = [ { - language: "Web component", - snippet: ` + expandable="true" +> -
+
Accept Cancel
@@ -1053,25 +1312,35 @@ export const expandable = [ To cancel your order click cancel. `, + long: `.interaction-area { + display: flex; + gap: 16px; + } + + + {shortCode}`, + }, }, { - language: "React", - snippet: ` + expandable +> -
+
Accept Cancel
@@ -1079,6 +1348,35 @@ export const expandable = [ To cancel your order click cancel. `, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + interactionArea: { + display: "flex", + gap: "16px", + }, + }); + const classes = useStyles(); + return ( + {shortCode} + )`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + interactionArea: { + display: "flex", + gap: "16px", + }, + }); + const classes = useStyles(); + return ( + {shortCode} + )`, + }, + ], + }, }, ]; @@ -1092,9 +1390,9 @@ export const expandable = [ @@ -1113,44 +1411,88 @@ export const expandable = [ export const clickableLink = [ { - language: "Web component", - snippet: ` + href="#" +> `, + long: `.parent-container { + padding: 16px; + } + + +
+ {shortCode} +
`, + }, }, { - language: "React", - snippet: ` + href="#" +> `, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; @@ -1166,9 +1508,9 @@ export const clickableLink = [ @@ -1180,50 +1522,94 @@ export const clickableLink = [ export const clickableBtn = [ { - language: "Web component", - snippet: ` + clickable="true" +> - -`, +`, + long: `.parent-container { + padding: 16px; + } + + +
+ {shortCode} +
+ `, + }, }, { - language: "React", - snippet: ` console.log(ev)}> + onClick={(ev) => console.log(ev)} +> `, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; @@ -1238,9 +1624,9 @@ export const clickableBtn = [ @@ -1252,46 +1638,95 @@ export const clickableBtn = [ export const withBadge = [ { - language: "Web component", - snippet: ` - - + + `, + long: `.parent-container { + padding: 16px; + } + + +
+ {shortCode} +
`, + }, }, { - language: "React", - snippet: ` + href="#" +> `, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; @@ -1308,9 +1743,9 @@ export const withBadge = [ @@ -1322,44 +1757,88 @@ export const withBadge = [ export const disabled = [ { - language: "Web component", - snippet: ` + disabled="true" +> `, + long: `.parent-container { + padding: 16px; + } + + +
+ {shortCode} +
`, + }, }, { - language: "React", - snippet: ` + disabled +> `, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; @@ -1374,9 +1853,9 @@ export const disabled = [ @@ -1388,44 +1867,88 @@ export const disabled = [ export const fullWidth = [ { - language: "Web component", - snippet: ` + full-width="true" + clickable="true" +> `, + long: `.parent-container { + padding: 16px; + } + + +
+ {shortCode} +
`, + }, }, { - language: "React", - snippet: ` + clickable +> `, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; @@ -1434,15 +1957,15 @@ export const fullWidth = [ heading="Americano order" subheading="Name: Michael" message="Extras: Double espresso shot and oat milk." - clickable="true" - fullWidth="true" + fullWidth + clickable > @@ -1454,8 +1977,9 @@ export const fullWidth = [ export const wrapped = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` `, + long: `.parent-container { + padding: 16px; + } + + +
+ {shortCode} +
`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` `, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; @@ -1510,9 +2075,9 @@ export const wrapped = [ diff --git a/src/content/structured/components/cards/guidance.mdx b/src/content/structured/components/cards/guidance.mdx index f9774f71e..0f352810e 100644 --- a/src/content/structured/components/cards/guidance.mdx +++ b/src/content/structured/components/cards/guidance.mdx @@ -89,9 +89,9 @@ There are three variants of cards: diff --git a/src/content/structured/components/checkboxes/code.mdx b/src/content/structured/components/checkboxes/code.mdx index c6959d5ea..790c9c4c0 100644 --- a/src/content/structured/components/checkboxes/code.mdx +++ b/src/content/structured/components/checkboxes/code.mdx @@ -1,7 +1,7 @@ --- path: "/components/checkbox/code" -date: "2024-01-18" +date: "2024-05-02" title: "Checkbox" @@ -25,12 +25,14 @@ import { IcCheckboxGroup, IcCheckbox, IcTextField } from "@ukic/react"; export const snippetsDefault = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` - +`, + long: `{shortCode} -`, +`, + }, }, { - language: "React", - snippet: ` console.log("onIcChange", ev.detail.value)}> + technology: "React", + snippets: { + short: ` console.log("onIcChange", ev.detail.value)}> console.log("onIcCheck", ev)} /> `, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -83,18 +97,33 @@ export const snippetsDefault = [ export const snippetsHiddenLabel = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` `, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -109,18 +138,33 @@ export const snippetsHiddenLabel = [ export const snippetsHelperText = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` `, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -139,8 +183,9 @@ export const snippetsHelperText = [ export const snippetsSizes = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` @@ -152,10 +197,13 @@ export const snippetsSizes = [ `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` @@ -167,6 +215,21 @@ export const snippetsSizes = [ `, + long: [ + { + language: "Typescript", + snippet: `<> + {shortCode} +`, + }, + { + language: "Javascript", + snippet: `<> + {shortCode} +`, + }, + ], + }, }, ]; @@ -189,16 +252,35 @@ export const snippetsSizes = [ export const snippetsSettingEachCheckboxSize = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` `, + long: [ + { + language: "Typescript", + snippet: `<> + {shortCode} +`, + }, + { + language: "Javascript", + snippet: `<> + {shortCode} +`, + }, + ], + }, }, ]; @@ -220,8 +302,9 @@ export const snippetsSettingEachCheckboxSize = [ export const snippetsConditional = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` @@ -234,10 +317,13 @@ export const snippetsConditional = [ > `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` @@ -250,6 +336,17 @@ export const snippetsConditional = [ /> `, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -270,8 +367,9 @@ export const snippetsConditional = [ export const snippetsConditionalDynamic = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` @@ -284,10 +382,13 @@ export const snippetsConditionalDynamic = [ > `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` @@ -300,6 +401,17 @@ export const snippetsConditionalDynamic = [ /> `, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -325,18 +437,33 @@ export const snippetsConditionalDynamic = [ export const snippetsValidation = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` `, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -356,8 +483,9 @@ export const snippetsValidation = [ export const snippetsIndeterminate = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` @@ -372,10 +500,13 @@ export const snippetsIndeterminate = [ `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` @@ -390,6 +521,17 @@ export const snippetsIndeterminate = [ `, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; diff --git a/src/content/structured/components/chips/code.mdx b/src/content/structured/components/chips/code.mdx index 49beaaf31..63a955eca 100644 --- a/src/content/structured/components/chips/code.mdx +++ b/src/content/structured/components/chips/code.mdx @@ -1,7 +1,7 @@ --- path: "/components/chip/code" -date: "2024-02-28" +date: "2024-05-02" title: "Chip" @@ -25,8 +25,9 @@ import { IcChip } from "@ukic/react"; export const snippetsDefault = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` console.log(ev)}> + technology: "React", + snippets: { + short: ` console.log(ev)}> `, + long: [ + { + language: "Typescript", + snippet: `<> + {shortCode} +`, + }, + { + language: "Javascript", + snippet: `<> + {shortCode} +`, + }, + ], + }, }, ]; @@ -119,8 +138,9 @@ export const snippetsDefault = [ export const snippetsOutline = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` `, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -174,8 +208,9 @@ export const snippetsOutline = [ export const snippetsDismissible = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` console.log(ev)); `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` console.log(ev)}> + technology: "React", + snippets: { + short: ` console.log(ev)}> `, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -233,8 +282,9 @@ export const snippetsDismissible = [ export const snippetsDisabled = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` `, + long: [ + { + language: "Typescript", + snippet: `<> + {shortCode} +`, + }, + { + language: "Javascript", + snippet: `<> + {shortCode} +`, + }, + ], + }, }, ]; diff --git a/src/content/structured/components/classification-banner/code.mdx b/src/content/structured/components/classification-banner/code.mdx index afaec6fbd..f1e0522ba 100644 --- a/src/content/structured/components/classification-banner/code.mdx +++ b/src/content/structured/components/classification-banner/code.mdx @@ -1,7 +1,7 @@ --- path: "/components/classification-banner/code" -date: "2023-02-03" +date: "2024-05-02" title: "Classification banner" @@ -26,20 +26,39 @@ import { IcClassificationBanner } from "@ukic/react"; export const snippets = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` `, + long: [ + { + language: "Typescript", + snippet: `<> + {shortCode} +`, + }, + { + language: "Javascript", + snippet: `<> + {shortCode} +`, + }, + ], + }, }, ]; @@ -61,12 +80,37 @@ export const snippets = [ export const snippetsVariants = [ { - language: "Web component", - snippet: ``, + technology: "Web component", + snippets: { + short: ` +`, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ``, + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; diff --git a/src/content/structured/components/data-entity/code.mdx b/src/content/structured/components/data-entity/code.mdx index 5eb21e012..e0fee703e 100644 --- a/src/content/structured/components/data-entity/code.mdx +++ b/src/content/structured/components/data-entity/code.mdx @@ -1,7 +1,7 @@ --- path: "/components/data-entity/code" -date: "2024-02-02" +date: "2024-05-02" title: "Data entity" @@ -33,90 +33,105 @@ import { export const snippets = [ { - language: "Web component", - snippet: ` - - - Edit - - - - - Edit - - - - - Edit - - - - - Edit - - - - - VISA ending 5896 - - - Edit - - - - - - - - - - `, + technology: "Web component", + snippets: { + short: ` + + + Edit + + + + + Edit + + + + + Edit + + + + + Edit + + + + + VISA ending 5896 + + + Edit + + + + + + + + + +`, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` - - - Edit - - - - - Edit - - - - - Edit - - - - - Edit - - - - - VISA ending 5896 - - - Edit - - - - - - - - - - `, + technology: "React", + snippets: { + short: ` + + + Edit + + + + + Edit + + + + + Edit + + + + + Edit + + + + + VISA ending 5896 + + + Edit + + + + + + + + + +`, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -152,7 +167,7 @@ export const snippets = [ - + - - - - - - - - - - - - VISA ending 5896 - - - - `, + technology: "Web component", + snippets: { + short: ` + + + + + + + + + + + + VISA ending 5896 + + + +`, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` - - - - - - - - - - - - VISA ending 5896 - - - - `, + technology: "React", + snippets: { + short: ` + + + + + + + + + VISA ending 5896 + + + +`, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -266,8 +293,9 @@ export const withStatusTags = [ export const smallSnippet = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` `, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -411,92 +453,110 @@ export const smallSnippet = [ export const editableExample = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` - - Confirm - - - Edit - -
+ + Confirm + + + Edit + +
`, + long: `.btn-container { + display: flex; + gap: 16px; + padding-top: 16px; + } + .parent-container { + padding: 16px; + } + + +
+ {shortCode} +
+ `, + `, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` @@ -505,8 +565,8 @@ export const editableExample = [ label="Drink" value="Americano" readonly - hide-label - full-width + hideLabel + fullWidth /> @@ -515,8 +575,8 @@ export const editableExample = [ label="Milk option" value="Soya milk" readonly - hide-label - full-width + hideLabel + fullWidth /> @@ -525,8 +585,8 @@ export const editableExample = [ label="Price" value="£3.25" readonly - hide-label - full-width + hideLabel + fullWidth /> @@ -535,37 +595,75 @@ export const editableExample = [ label="Payment method" value="VISA ending 5896" readonly - hide-label - full-width + hideLabel + fullWidth /> - { - const textFields = document.querySelectorAll('ic-text-field'); - textFields.forEach((textField) => { - textField.setAttribute('readonly', ''); - }) - }} - style={{ - marginRight: "var(--ic-space-md)", - marginTop: "var(--ic-space-lg)", - }} -> - Confirm - - { - const textFields = document.querySelectorAll('ic-text-field'); - textFields.forEach((textField) => { - textField.removeAttribute('readonly'); - }) - }} - variant="secondary" - style={{ marginTop: "var(--ic-space-lg)" }} -> - Edit -`, +
+ { + const textFields = document.querySelectorAll('ic-text-field'); + textFields.forEach((textField) => { + textField.setAttribute('readonly', ''); + }); + }} + > + Confirm + + { + const textFields = document.querySelectorAll('ic-text-field'); + textFields.forEach((textField) => { + textField.removeAttribute('readonly'); + }); + }} + variant="secondary" + > + Edit + +
`, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + btnContainer: { + display: "flex", + gap: "16px", + paddingTop: "16px", + }, + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + btnContainer: { + display: "flex", + gap: "16px", + paddingTop: "16px", + }, + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; @@ -577,8 +675,8 @@ export const editableExample = [ label="Order name" value="Michael" readonly - hide-label - full-width + hideLabel + fullWidth />
@@ -587,8 +685,8 @@ export const editableExample = [ label="Drink" value="Americano" readonly - hide-label - full-width + hideLabel + fullWidth /> @@ -597,8 +695,8 @@ export const editableExample = [ label="Milk option" value="Soya milk" readonly - hide-label - full-width + hideLabel + fullWidth /> @@ -607,8 +705,8 @@ export const editableExample = [ label="Price" value="£3.25" readonly - hide-label - full-width + hideLabel + fullWidth /> @@ -617,8 +715,8 @@ export const editableExample = [ label="Payment method" value="VISA ending 5896" readonly - hide-label - full-width + hideLabel + fullWidth /> diff --git a/src/content/structured/components/data-table/code.mdx b/src/content/structured/components/data-table/code.mdx index 810e8297a..5d28adc19 100644 --- a/src/content/structured/components/data-table/code.mdx +++ b/src/content/structured/components/data-table/code.mdx @@ -17,7 +17,7 @@ tabs: --- import { IcDataTable } from "@ukic/canary-react"; -import { IcButton } from "@ukic/react"; +import { IcEmptyState, IcButton } from "@ukic/react"; import { useRef } from "react"; import { COLUMNS, @@ -29,14 +29,18 @@ import { COLUMN_OVERRIDES, ROW_OVERRIDES_DATA, CELL_OVERRIDES_DATA, + COLUMNS_ELEMENTS, + DATA_ELEMENTS, } from "./story-data"; ## Component demo export const snippetsDefault = [ { - language: "Web components", - snippet: ` + technology: "Web component", + snippets: { + short: ``, + long: `{shortCode} `, + }, }, { - language: "React", - snippet: `const columns = [ + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `const columns: IcDataTableColumnObject[] = [ { key: "firstName", title: "First name", @@ -114,9 +124,52 @@ const data = [ age: 45, }, ]; -const DataTable = () => ( - -);`, +return ( + {shortCode} +)`, + }, + { + language: "Javascript", + snippet: `const columns = [ + { + key: "firstName", + title: "First name", + dataType: "string", + }, + { + key: "lastName", + title: "Last name", + dataType: "string", + }, + { + key: "age", + title: "Age", + dataType: "number", + }, +]; +const data = [ + { + firstName: "Joe", + lastName: "Bloggs", + age: 30, + }, + { + firstName: "Sarah", + lastName: "Smith", + age: 28, + }, + { + firstName: "Mark", + lastName: "Owens", + age: 45, + }, +]; +return ( + {shortCode} +)`, + }, + ], + }, }, ]; @@ -134,384 +187,544 @@ const DataTable = () => ( export const snippetsEmbedded = [ { - language: "Web components", - snippet: ` + technology: "Web component", + snippets: { + short: ``, + long: `{shortCode} `, + }, }, { - language: "React", - snippet: ``, + long: [ + { + language: "Typescript", + snippet: `const columns: IcDataTableColumnObject[] = [ + { + key: "firstName", + title: "First name", + dataType: "string", }, -]; - - - - - -### Dense - -export const snippetsDense = [ { - language: "Web components", - snippet: ` -`, + key: "lastName", + title: "Last name", + dataType: "string", }, { - language: "React", - snippet: ``, + key: "age", + title: "Age", + dataType: "number", }, ]; - - - - - -### Spacious - -export const snippetsSpacious = [ +const data = [ { - language: "Web components", - snippet: ` -`, + firstName: "Joe", + lastName: "Bloggs", + age: 30, }, { - language: "React", - snippet: ``, + firstName: "Sarah", + lastName: "Smith", + age: 28, }, -]; - - - - - -### Sticky column headers - -export const snippetsStickyColumnHeaders = [ { - language: "Web components", - snippet: ` -`, + firstName: "Mark", + lastName: "Owens", + age: 45, }, +]; +return ( + {shortCode} +)`, + }, + { + language: "Javascript", + snippet: `const columns = [ { - language: "React", - snippet: `const long_columns = [ - { - key: "employeeNumber", - title: "Employee number", - dataType: "number", - columnAlignment: { horizontal: "left" }, + key: "firstName", + title: "First name", + dataType: "string", }, { - key: "name", - title: "Name", + key: "lastName", + title: "Last name", dataType: "string", }, - ... + { + key: "age", + title: "Age", + dataType: "number", + }, ]; -const long_data = [ +const data = [ { - employeeNumber: 1, - name: "Joe Bloggs", + firstName: "Joe", + lastName: "Bloggs", age: 30, }, - ... + { + firstName: "Sarah", + lastName: "Smith", + age: 28, + }, + { + firstName: "Mark", + lastName: "Owens", + age: 45, + }, ]; return ( - -);`, + {shortCode} +)`, + }, + ], + }, }, ]; -export const StickyColumnHeaders = () => { - const dataTableEl = useRef(null); - const stickHeader = (sticky) => { - dataTableEl.current.stickyColumnHeaders = sticky; - }; - return ( - <> - - stickHeader(true)}>Stick Header - stickHeader(false)}>Unstick Header - - ); -}; - - - + + -### Row headers +### Dense -export const snippetsRowHeaders = [ +export const snippetsDense = [ { - language: "Web components", - snippet: ` + technology: "Web component", + snippets: { + short: ``, + long: `{shortCode} `, + }, }, { - language: "React", - snippet: `const columns = [ - { - key: 'header', - title: 'Job Title', - dataType: 'string' - }, + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `const columns: IcDataTableColumnObject[] = [ { key: "firstName", title: "First name", dataType: "string", }, - ... + { + key: "lastName", + title: "Last name", + dataType: "string", + }, + { + key: "age", + title: "Age", + dataType: "number", + }, ]; const data = [ { - header: { title: 'Employee' }, firstName: "Joe", lastName: "Bloggs", age: 30, }, - ... + { + firstName: "Sarah", + lastName: "Smith", + age: 28, + }, + { + firstName: "Mark", + lastName: "Owens", + age: 45, + }, ]; -const DataTable = () => ( - -);`, +return ( + {shortCode} +)`, + }, + { + language: "Javascript", + snippet: `const columns = [ + { + key: "firstName", + title: "First name", + dataType: "string", + }, + { + key: "lastName", + title: "Last name", + dataType: "string", + }, + { + key: "age", + title: "Age", + dataType: "number", }, ]; - - - - - -### Sortable - -export const snippetsSortable = [ +const data = [ { - language: "Web components", - snippet: ` -`, + firstName: "Joe", + lastName: "Bloggs", + age: 30, }, { - language: "React", - snippet: ``, + firstName: "Sarah", + lastName: "Smith", + age: 28, + }, + { + firstName: "Mark", + lastName: "Owens", + age: 45, + }, +]; +return ( + {shortCode} +)`, + }, + ], + }, }, ]; - - + + -### Sort options +### Spacious -export const snippetsSortOptions = [ +export const snippetsSpacious = [ { - language: "Web components", - snippet: ` + technology: "Web component", + snippets: { + short: ``, + long: `{shortCode} `, + }, }, { - language: "React", - snippet: ``, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; - + -### Pagination +### Sticky column headers -export const snippetsPagination = [ +export const snippetsStickyColumnHeaders = [ { - language: "Web components", - snippet: ` -`, }, - ... - ]; - dataTable.columns = long_columns; - dataTable.data = long_data; -`, }, { - language: "React", - snippet: `const long_columns = [ + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: ` const dataTableEl = useRef(null); +const stickHeader = (sticky: boolean) => { + dataTableEl.current.stickyColumnHeaders = sticky; +}; +const long_columns: IcDataTableColumnObject[] = [ { key: "employeeNumber", title: "Employee number", @@ -523,7 +736,11 @@ export const snippetsPagination = [ title: "Name", dataType: "string", }, - ... + { + key: "age", + title: "Age", + dataType: "number", + }, ]; const long_data = [ { @@ -531,102 +748,293 @@ const long_data = [ name: "Joe Bloggs", age: 30, }, - ... -]; -return ( - -);`, + { + employeeNumber: 2, + name: "Sarah Jones", + age: 28, }, -]; - - - - - -### Column overrides - -export const snippetsColumnOverrides = [ { - language: "Web components", - snippet: ` -`, + employeeNumber: 3, + name: "Mark Owens", + age: 45, }, { - language: "React", - snippet: `const columns = [ + employeeNumber: 4, + name: "Naomi Thomas", + age: 32, + }, { - key: "firstName", - title: "First name", + employeeNumber: 5, + name: "Luke Ashford", + age: 18, + }, + { + employeeNumber: 6, + name: "Dave Smith", + age: 33, + }, + { + employeeNumber: 7, + name: "Amy Fox", + age: 27, + }, + { + employeeNumber: 8, + name: "Mary Cooper", + age: 31, + }, + { + employeeNumber: 9, + name: "Alice Cole", + age: 38, + }, + { + employeeNumber: 10, + name: "Ben Fields", + age: 40, + }, + { + employeeNumber: 11, + name: "Pete Norton", + age: 32, + }, + { + employeeNumber: 12, + name: "Ashley Langford", + age: 29, + }, + { + employeeNumber: 13, + name: "Michael Hall", + age: 35, + }, + { + employeeNumber: 14, + name: "David Frank", + age: 28, + }, + { + employeeNumber: 15, + name: "Mary Lincoln", + age: 23, + }, + { + employeeNumber: 16, + name: "Will Barns", + age: 36, + }, + { + employeeNumber: 17, + name: "Elizabeth Long", + age: 43, + }, + { + employeeNumber: 18, + name: "Keith Jones", + age: 37, + }, + { + employeeNumber: 19, + name: "Olivia Brown", + age: 19, + }, + { + employeeNumber: 20, + name: "Tim Green", + age: 50, + }, +]; +const useStyles = createUseStyles({ + dataTable: { + height: "300px", + }, +}); +const classes = useStyles(); +return ( + <> + {shortCode} + stickHeader(true)}>Stick Header + stickHeader(false)}>Unstick Header + +);`, + }, + { + language: "Javascript", + snippet: `const dataTableEl = useRef(null); +const stickHeader = (sticky) => { + dataTableEl.current.stickyColumnHeaders = sticky; +}; +const long_columns = [ + { + key: "employeeNumber", + title: "Employee number", + dataType: "number", + columnAlignment: { horizontal: "left" }, + }, + { + key: "name", + title: "Name", dataType: "string", - columnAlignment: { horizontal: 'center', vertical: 'middle'}, - emphasis: 'high', }, - ... + { + key: "age", + title: "Age", + dataType: "number", + }, +]; +const long_data = [ + { + employeeNumber: 1, + name: "Joe Bloggs", + age: 30, + }, + { + employeeNumber: 2, + name: "Sarah Jones", + age: 28, + }, + { + employeeNumber: 3, + name: "Mark Owens", + age: 45, + }, + { + employeeNumber: 4, + name: "Naomi Thomas", + age: 32, + }, + { + employeeNumber: 5, + name: "Luke Ashford", + age: 18, + }, + { + employeeNumber: 6, + name: "Dave Smith", + age: 33, + }, + { + employeeNumber: 7, + name: "Amy Fox", + age: 27, + }, + { + employeeNumber: 8, + name: "Mary Cooper", + age: 31, + }, + { + employeeNumber: 9, + name: "Alice Cole", + age: 38, + }, + { + employeeNumber: 10, + name: "Ben Fields", + age: 40, + }, + { + employeeNumber: 11, + name: "Pete Norton", + age: 32, + }, + { + employeeNumber: 12, + name: "Ashley Langford", + age: 29, + }, + { + employeeNumber: 13, + name: "Michael Hall", + age: 35, + }, + { + employeeNumber: 14, + name: "David Frank", + age: 28, + }, + { + employeeNumber: 15, + name: "Mary Lincoln", + age: 23, + }, + { + employeeNumber: 16, + name: "Will Barns", + age: 36, + }, + { + employeeNumber: 17, + name: "Elizabeth Long", + age: 43, + }, + { + employeeNumber: 18, + name: "Keith Jones", + age: 37, + }, + { + employeeNumber: 19, + name: "Olivia Brown", + age: 19, + }, + { + employeeNumber: 20, + name: "Tim Green", + age: 50, + }, ]; +const useStyles = createUseStyles({ + dataTable: { + height: "300px", + }, +}); +const classes = useStyles(); return ( - + <> + {shortCode} + stickHeader(true)}>Stick Header + stickHeader(false)}>Unstick Header + );`, + }, + ], + }, }, ]; - - +export const StickyColumnHeaders = () => { + const dataTableEl = useRef(null); + const stickHeader = (sticky) => { + dataTableEl.current.stickyColumnHeaders = sticky; + }; + return ( + <> + + stickHeader(true)}>Stick Header + stickHeader(false)}>Unstick Header + + ); +}; + + + -### Row overrides +### Row headers -export const snippetsRowOverrides = [ +export const snippetsRowHeaders = [ { - language: "Web components", - snippet: ` + technology: "Web component", + snippets: { + short: ``, + long: `{shortCode} `, + }, }, { - language: "React", - snippet: `const columns = [ + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `const columns: IcDataTableColumnObject[] = [ { - key: "header", - title: "Job type", + key: "firstName", + title: "First name", + // dataType types: "string" | "number" | "address" | "element" | "date"; + dataType: "string", + }, + { + key: "lastName", + title: "Last name", dataType: "string", }, + { + key: "age", + title: "Age", + dataType: "number", + }, +]; +const data = [ + { + firstName: "Joe", + lastName: "Bloggs", + age: 30, + }, + { + firstName: "Sarah", + lastName: "Smith", + age: 28, + }, + { + firstName: "Mark", + lastName: "Owens", + age: 45, + }, +]; +return ( + {shortCode} +)`, + }, + { + language: "Javascript", + snippet: `const columns = [ { key: "firstName", title: "First name", + // dataType types: "string" | "number" | "address" | "element" | "date"; + dataType: "string", + }, + { + key: "lastName", + title: "Last name", dataType: "string", }, - ... + { + key: "age", + title: "Age", + dataType: "number", + }, ]; const data = [ { - header: { - title: 'Employee', - rowAlignment: 'middle', - emphasis: 'high' - } firstName: "Joe", lastName: "Bloggs", age: 30, }, - ... + { + firstName: "Sarah", + lastName: "Smith", + age: 28, + }, + { + firstName: "Mark", + lastName: "Owens", + age: 45, + }, ]; return ( - -);`, + {shortCode} +)`, + }, + ], + }, }, ]; - + -### Cell overrides +### Sortable -export const snippetsCellOverrides = [ +export const snippetsSortable = [ { - language: "Web components", - snippet: ` + technology: "Web component", + snippets: { + short: ``, + long: `{shortCode} `, + }, }, { - language: "React", - snippet: `const data = [ + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `const columns: IcDataTableColumnObject[] = [ { - firstName: { - data: "Joe", - cellAlignment: { horizontal: "center", vertical: "middle" }, - emphasis: "high", + key: "firstName", + title: "First name", + // dataType types: "string" | "number" | "address" | "element" | "date"; + dataType: "string", + }, + { + key: "lastName", + title: "Last name", + dataType: "string", + }, + { + key: "age", + title: "Age", + dataType: "number", + }, +]; +const data = [ + { + firstName: "Joe", + lastName: "Bloggs", + age: 30, + }, + { + firstName: "Sarah", + lastName: "Smith", + age: 28, + }, + { + firstName: "Mark", + lastName: "Owens", + age: 45, + }, +]; +return ( + {shortCode} +)`, + }, + { + language: "Javascript", + snippet: `const columns: IcDataTableColumnObject[] = [ + { + key: "firstName", + title: "First name", + // dataType types: "string" | "number" | "address" | "element" | "date"; + dataType: "string", + }, + { + key: "lastName", + title: "Last name", + dataType: "string", + }, + { + key: "age", + title: "Age", + dataType: "number", + }, +]; +const data = [ + { + firstName: "Joe", + lastName: "Bloggs", + age: 30, + }, + { + firstName: "Sarah", + lastName: "Smith", + age: 28, + }, + { + firstName: "Mark", + lastName: "Owens", + age: 45, + }, +]; +return ( + {shortCode} +)`, + }, + ], + }, + }, +]; + + + + + +### Sort options + +export const snippetsSortOptions = [ + { + technology: "Web component", + snippets: { + short: ``, + long: `{shortCode} +`, }, + }, + { + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `const columns: IcDataTableColumnObject[] = [ + { + key: "firstName", + title: "First name", + // dataType types: "string" | "number" | "address" | "element" | "date"; + dataType: "string", + }, + { + key: "lastName", + title: "Last name", + dataType: "string", + }, + { + key: "age", + title: "Age", + dataType: "number", + }, +]; +const data = [ + { + firstName: "Joe", + lastName: "Bloggs", + age: 30, + }, + { + firstName: "Sarah", + lastName: "Smith", + age: 28, + }, + { + firstName: "Mark", + lastName: "Owens", + age: 45, + }, +]; +return ( + {shortCode} +)`, + }, + { + language: "Javascript", + snippet: `const columns: IcDataTableColumnObject[] = [ + { + key: "firstName", + title: "First name", + // dataType types: "string" | "number" | "address" | "element" | "date"; + dataType: "string", + }, + { + key: "lastName", + title: "Last name", + dataType: "string", + }, + { + key: "age", + title: "Age", + dataType: "number", + }, +]; +const data = [ + { + firstName: "Joe", lastName: "Bloggs", age: 30, }, - ... + { + firstName: "Sarah", + lastName: "Smith", + age: 28, + }, + { + firstName: "Mark", + lastName: "Owens", + age: 45, + }, ]; return ( - -);`, + {shortCode} +)`, + }, + ], + }, }, ]; - + + +### Pagination + +export const snippetsPagination = [ + { + technology: "Web component", + snippets: { + short: ``, + long: `{shortCode} +`, + }, + }, + { + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `const long_columns: IcDataTableColumnObject[] = [ + { + key: "employeeNumber", + title: "Employee number", + dataType: "number", + columnAlignment: { horizontal: "left" }, + }, + { + key: "name", + title: "Name", + dataType: "string", + }, + { + key: "age", + title: "Age", + dataType: "number", + }, +]; +const long_data = [ + { + employeeNumber: 1, + name: "Joe Bloggs", + age: 30, + }, + { + employeeNumber: 2, + name: "Sarah Jones", + age: 28, + }, + { + employeeNumber: 3, + name: "Mark Owens", + age: 45, + }, + { + employeeNumber: 4, + name: "Naomi Thomas", + age: 32, + }, + { + employeeNumber: 5, + name: "Luke Ashford", + age: 18, + }, + { + employeeNumber: 6, + name: "Dave Smith", + age: 33, + }, + { + employeeNumber: 7, + name: "Amy Fox", + age: 27, + }, + { + employeeNumber: 8, + name: "Mary Cooper", + age: 31, + }, + { + employeeNumber: 9, + name: "Alice Cole", + age: 38, + }, + { + employeeNumber: 10, + name: "Ben Fields", + age: 40, + }, + { + employeeNumber: 11, + name: "Pete Norton", + age: 32, + }, + { + employeeNumber: 12, + name: "Ashley Langford", + age: 29, + }, + { + employeeNumber: 13, + name: "Michael Hall", + age: 35, + }, + { + employeeNumber: 14, + name: "David Frank", + age: 28, + }, + { + employeeNumber: 15, + name: "Mary Lincoln", + age: 23, + }, + { + employeeNumber: 16, + name: "Will Barns", + age: 36, + }, + { + employeeNumber: 17, + name: "Elizabeth Long", + age: 43, + }, + { + employeeNumber: 18, + name: "Keith Jones", + age: 37, + }, + { + employeeNumber: 19, + name: "Olivia Brown", + age: 19, + }, + { + employeeNumber: 20, + name: "Tim Green", + age: 50, + }, +]; +return ( + {shortCode} +);`, + }, + { + language: "Javascript", + snippet: `const long_columns = [ + { + key: "employeeNumber", + title: "Employee number", + dataType: "number", + columnAlignment: { horizontal: "left" }, + }, + { + key: "name", + title: "Name", + dataType: "string", + }, + { + key: "age", + title: "Age", + dataType: "number", + }, +]; +const long_data = [ + { + employeeNumber: 1, + name: "Joe Bloggs", + age: 30, + }, + { + employeeNumber: 2, + name: "Sarah Jones", + age: 28, + }, + { + employeeNumber: 3, + name: "Mark Owens", + age: 45, + }, + { + employeeNumber: 4, + name: "Naomi Thomas", + age: 32, + }, + { + employeeNumber: 5, + name: "Luke Ashford", + age: 18, + }, + { + employeeNumber: 6, + name: "Dave Smith", + age: 33, + }, + { + employeeNumber: 7, + name: "Amy Fox", + age: 27, + }, + { + employeeNumber: 8, + name: "Mary Cooper", + age: 31, + }, + { + employeeNumber: 9, + name: "Alice Cole", + age: 38, + }, + { + employeeNumber: 10, + name: "Ben Fields", + age: 40, + }, + { + employeeNumber: 11, + name: "Pete Norton", + age: 32, + }, + { + employeeNumber: 12, + name: "Ashley Langford", + age: 29, + }, + { + employeeNumber: 13, + name: "Michael Hall", + age: 35, + }, + { + employeeNumber: 14, + name: "David Frank", + age: 28, + }, + { + employeeNumber: 15, + name: "Mary Lincoln", + age: 23, + }, + { + employeeNumber: 16, + name: "Will Barns", + age: 36, + }, + { + employeeNumber: 17, + name: "Elizabeth Long", + age: 43, + }, + { + employeeNumber: 18, + name: "Keith Jones", + age: 37, + }, + { + employeeNumber: 19, + name: "Olivia Brown", + age: 19, + }, + { + employeeNumber: 20, + name: "Tim Green", + age: 50, + }, +]; +return ( + {shortCode} +);`, + }, + ], + }, + }, +]; + + + + + +### Column overrides + +export const snippetsColumnOverrides = [ + { + technology: "Web component", + snippets: { + short: ``, + long: `{shortCode} +`, + }, + }, + { + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `const columns: IcDataTableColumnObject[] = [ + { + key: "firstName", + title: "First name", + dataType: "string", + columnAlignment: { horizontal: 'center', vertical: 'middle'}, + emphasis: 'high', + }, + { + key: "lastName", + title: "Last name", + dataType: "string", + }, + { + key: "age", + title: "Age", + dataType: "number", + }, +]; +const data = [ + { + firstName: "Joe", + lastName: "Bloggs", + age: 30, + }, + { + firstName: "Sarah", + lastName: "Smith", + age: 28, + }, + { + firstName: "Mark", + lastName: "Owens", + age: 45, + }, +]; +return ( + {shortCode} +)`, + }, + { + language: "Javascript", + snippet: `const columns = [ + { + key: "firstName", + title: "First name", + dataType: "string", + columnAlignment: { horizontal: 'center', vertical: 'middle'}, + emphasis: 'high', + }, + { + key: "lastName", + title: "Last name", + dataType: "string", + }, + { + key: "age", + title: "Age", + dataType: "number", + }, +]; +const data = [ + { + firstName: "Joe", + lastName: "Bloggs", + age: 30, + }, + { + firstName: "Sarah", + lastName: "Smith", + age: 28, + }, + { + firstName: "Mark", + lastName: "Owens", + age: 45, + }, +]; +return ( + {shortCode} +)`, + }, + ], + }, + }, +]; + + + + + +### Row overrides + +export const snippetsRowOverrides = [ + { + technology: "Web component", + snippets: { + short: ``, + long: `{shortCode} +`, + }, + }, + { + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `const columns: IcDataTableColumnObject[] = [ + { + key: "header", + title: "Job Title", + dataType: "string", + }, + { + key: "firstName", + title: "First name", + dataType: "string", + }, + { + key: "lastName", + title: "Last name", + dataType: "string", + }, + { + key: "age", + title: "Age", + dataType: "number", + }, +]; +const data = [ + { + header: { title: "Employee" }, + firstName: "Joe", + lastName: "Bloggs", + age: 30, + }, + { + header: { title: "Employee" }, + firstName: "Sarah", + lastName: "Smith", + age: 28, + }, + { + header: { title: "Manager" }, + firstName: "Mark", + lastName: "Owens", + age: 45, + }, +]; +return ( + {shortCode} +);`, + }, + { + language: "Javascript", + snippet: `const columns = [ + { + key: "header", + title: "Job Title", + dataType: "string", + }, + { + key: "firstName", + title: "First name", + dataType: "string", + }, + { + key: "lastName", + title: "Last name", + dataType: "string", + }, + { + key: "age", + title: "Age", + dataType: "number", + }, +]; +const data = [ + { + header: { title: "Employee" }, + firstName: "Joe", + lastName: "Bloggs", + age: 30, + }, + { + header: { title: "Employee" }, + firstName: "Sarah", + lastName: "Smith", + age: 28, + }, + { + header: { title: "Manager" }, + firstName: "Mark", + lastName: "Owens", + age: 45, + }, +]; +return ( + {shortCode} +);`, + }, + ], + }, + }, +]; + + + + + +### Cell overrides + +export const snippetsCellOverrides = [ + { + technology: "Web component", + snippets: { + short: ``, + long: `{shortCode} + `, + }, + }, + { + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `const columns: IcDataTableColumnObject[] = [ + { + key: "firstName", + title: "First name", + // dataType types: "string" | "number" | "address" | "element" | "date"; + dataType: "string", + }, + { + key: "lastName", + title: "Last name", + dataType: "string", + }, + { + key: "age", + title: "Age", + dataType: "number", + }, +]; +const data = [ + { + firstName: { + data: "Joe", + cellAlignment: { horizontal: "center", vertical: "middle" }, + emphasis: "high", + }, + lastName: "Bloggs", + age: 30, + }, + { + firstName: "Sarah", + lastName: "Smith", + age: 28, + }, + { + firstName: "Mark", + lastName: "Owens", + age: 45, + }, +]; +return ( + {shortCode} +)`, + }, + { + language: "Javascript", + snippet: `const data = [ +{ +firstName: { +data: "Joe", +cellAlignment: { horizontal: "center", vertical: "middle" }, +emphasis: "high", +}, +lastName: "Bloggs", +age: 30, +}, +]; +return ( +{shortCode} +)`, + }, + ], + }, + }, +]; + + + + + +### Default Empty State + +export const snippetsDefaultEmptyState = [ + { + technology: "Web component", + snippets: { + short: ``, + long: `{shortCode} + `, + }, + }, + { + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `const columns: IcDataTableColumnObject[] = [ + { + key: "firstName", + title: "First name", + // dataType types: "string" | "number" | "address" | "element" | "date"; + dataType: "string", + }, + { + key: "lastName", + title: "Last name", + dataType: "string", + }, + { + key: "age", + title: "Age", + dataType: "number", + }, +]; +return ( + {shortCode} +)`, + }, + { + language: "Javascript", + snippet: `const columns = [ + { + key: "firstName", + title: "First name", + // dataType types: "string" | "number" | "address" | "element" | "date"; + dataType: "string", + }, + { + key: "lastName", + title: "Last name", + dataType: "string", + }, + { + key: "age", + title: "Age", + dataType: "number", + }, +]; +return ( + {shortCode} +)`, + }, + ], + }, + }, +]; + + + + + +### Slotted Empty State + +export const snippetsSlottedEmptyState = [ + { + technology: "Web component", + snippets: { + short: ` + + Retry + +`, + long: `{shortCode} + `, + }, + }, + { + technology: "React", + snippets: { + short: ` + + Retry + +`, + long: [ + { + language: "Typescript", + snippet: `const columns: IcDataTableColumnObject[] = [ + { + key: "firstName", + title: "First name", + // dataType types: "string" | "number" | "address" | "element" | "date"; + dataType: "string", + }, + { + key: "lastName", + title: "Last name", + dataType: "string", + }, + { + key: "age", + title: "Age", + dataType: "number", + }, +]; +return ( + {shortCode} +)`, + }, + { + language: "Javascript", + snippet: `const columns = [ + { + key: "firstName", + title: "First name", + // dataType types: "string" | "number" | "address" | "element" | "date"; + dataType: "string", + }, + { + key: "lastName", + title: "Last name", + dataType: "string", + }, + { + key: "age", + title: "Age", + dataType: "number", + }, +]; +return ( + {shortCode} +)`, + }, + ], + }, + }, +]; + + + + + Retry + + + + +### Loading state + +export const snippetsLoadingState = [ + { + technology: "Web component", + snippets: { + short: ``, + long: `{shortCode} + `, + }, + }, + { + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `const columns: IcDataTableColumnObject[] = [ + { + key: "firstName", + title: "First name", + // dataType types: "string" | "number" | "address" | "element" | "date"; + dataType: "string", + }, + { + key: "lastName", + title: "Last name", + dataType: "string", + }, + { + key: "age", + title: "Age", + dataType: "number", + }, +]; +const data = [ + { + firstName: "Joe", + lastName: "Bloggs", + age: 30, + }, + { + firstName: "Sarah", + lastName: "Smith", + age: 28, + }, + { + firstName: "Mark", + lastName: "Owens", + age: 45, + }, +]; +return ( + {shortCode} +)`, + }, + { + language: "Javascript", + snippet: `const columns = [ + { + key: "firstName", + title: "First name", + // dataType types: "string" | "number" | "address" | "element" | "date"; + dataType: "string", + }, + { + key: "lastName", + title: "Last name", + dataType: "string", + }, + { + key: "age", + title: "Age", + dataType: "number", + }, +]; +const data = [ + { + firstName: "Joe", + lastName: "Bloggs", + age: 30, + }, + { + firstName: "Sarah", + lastName: "Smith", + age: 28, + }, + { + firstName: "Mark", + lastName: "Owens", + age: 45, + }, +]; +return ( + {shortCode} +)`, + }, + ], + }, + }, +]; + + + + + +### Updating state + +export const snippetsUpdatingState = [ + { + technology: "Web component", + snippets: { + short: ``, + long: `{shortCode} + `, + }, + }, + { + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `const columns: IcDataTableColumnObject[] = [ + { + key: "firstName", + title: "First name", + // dataType types: "string" | "number" | "address" | "element" | "date"; + dataType: "string", + }, + { + key: "lastName", + title: "Last name", + dataType: "string", + }, + { + key: "age", + title: "Age", + dataType: "number", + }, +]; +const data = [ + { + firstName: "Joe", + lastName: "Bloggs", + age: 30, + }, + { + firstName: "Sarah", + lastName: "Smith", + age: 28, + }, + { + firstName: "Mark", + lastName: "Owens", + age: 45, + }, +]; +return ( + {shortCode} +)`, + }, + { + language: "Javascript", + snippet: `const columns = [ + { + key: "firstName", + title: "First name", + // dataType types: "string" | "number" | "address" | "element" | "date"; + dataType: "string", + }, + { + key: "lastName", + title: "Last name", + dataType: "string", + }, + { + key: "age", + title: "Age", + dataType: "number", + }, +]; +const data = [ + { + firstName: "Joe", + lastName: "Bloggs", + age: 30, + }, + { + firstName: "Sarah", + lastName: "Smith", + age: 28, + }, + { + firstName: "Mark", + lastName: "Owens", + age: 45, + }, +]; +return ( + {shortCode} +)`, + }, + ], + }, + }, +]; + + + + + +### Links and Elements in data + +export const snippetsElements = [ + { + technology: "Web component", + snippets: { + short: ``, + long: `{shortCode} + `, + }, + }, + { + technology: "React", + snippets: { + short: ` + {data.map((_, index) => ( + _.closest('Delete')} + > + Delete + + ))} + `, + long: [ + { + language: "Typescript", + snippet: `const columns: IcDataTableColumnObject[] = [ + { + key: "firstName", + title: "First name", + dataType: "string", + }, + { + key: "lastName", + title: "Last name", + dataType: "string", + }, + { + key: "age", + title: "Age", + dataType: "number", + }, + { + key: "actions", + title: "Actions", + dataType: "element", + columnAlignment: { horizontal: "center" }, + }, +]; +const data = [ + { + firstName: { + data: "Joe", + href: "#", + }, + lastName: "Bloggs", + age: 30, + actions: \`Delete\`, + }, + { + firstName: 'Sarah', + lastName: 'Smith', + age: 28, + actions: \`Delete\`, + }, + { + firstName: 'Mark', + lastName: 'Owens', + age: 45, + actions: \`Delete\`, + }, +]; +return ( + {shortCode} +)`, + }, + { + language: "Javascript", + snippet: `const columns = [ + { + key: "firstName", + title: "First name", + dataType: "string", + }, + { + key: "lastName", + title: "Last name", + dataType: "string", + }, + { + key: "age", + title: "Age", + dataType: "number", + }, + { + key: "actions", + title: "Actions", + dataType: "element", + columnAlignment: { horizontal: "center" }, + }, +]; +const data = [ + { + firstName: { + data: "Joe", + href: "#", + }, + lastName: "Bloggs", + age: 30, + actions: \`Delete\`, + }, + { + firstName: 'Sarah', + lastName: 'Smith', + age: 28, + actions: \`Delete\`, + }, + { + firstName: 'Mark', + lastName: 'Owens', + age: 45, + actions: \`Delete\`, + }, +]; +return ( + {shortCode} +)`, + }, + ], + }, + }, +]; + + + + {DATA_ELEMENTS.map((_, index) => ( + console.log("Delete")} + > + Delete + + ))} + + diff --git a/src/content/structured/components/data-table/story-data.ts b/src/content/structured/components/data-table/story-data.ts index de97ad5be..e025f1f4e 100644 --- a/src/content/structured/components/data-table/story-data.ts +++ b/src/content/structured/components/data-table/story-data.ts @@ -258,3 +258,92 @@ export const CELL_OVERRIDES_DATA = [ age: 45, }, ]; + +export const COLUMNS_ELEMENTS = [ + { + key: "firstName", + title: "First name", + dataType: "string", + }, + { + key: "lastName", + title: "Last name", + dataType: "string", + }, + { + key: "age", + title: "Age", + dataType: "number", + }, + { + key: "actions", + title: "Actions", + dataType: "element", + columnAlignment: { horizontal: "center" }, + }, +]; + +export const DATA_ELEMENTS = [ + { + firstName: { + data: "Joe", + href: "#", + }, + lastName: "Bloggs", + age: 30, + actions: `Delete`, + }, + { + firstName: "Sarah", + lastName: "Smith", + age: 28, + actions: `Delete`, + }, + { + firstName: "Mark", + lastName: "Owens", + age: 45, + actions: `Delete`, + }, +]; + +export const DATA_REACT_ELEMENTS = [ + { + firstName: { + data: "Joe", + href: "https://www.example.com", + }, + lastName: "Bloggs", + age: 30, + jobTitle: "Developer", + address: "1 Main Street, Town, County, Postcode", + }, + { + firstName: "Sarah", + lastName: "Smith", + age: 28, + jobTitle: "Analyst", + address: "2 Main Street, Town, Country, Postcode", + }, + { + firstName: "Mark", + lastName: "Owens", + age: 45, + jobTitle: "Team Lead", + address: "12 Key Street, Town, Country, Postcode", + }, + { + firstName: "Naomi", + lastName: "Thomas", + age: 32, + jobTitle: "Developer", + address: "8 Side Street, Town, Country, Postcode", + }, + { + firstName: "Luke", + lastName: "Ashford", + age: 18, + jobTitle: "Junior Developer", + address: "5 New Street, Town, Country, Postcode", + }, +]; diff --git a/src/content/structured/components/date-input/code.mdx b/src/content/structured/components/date-input/code.mdx index 2b11733d9..ea461b2ae 100644 --- a/src/content/structured/components/date-input/code.mdx +++ b/src/content/structured/components/date-input/code.mdx @@ -24,21 +24,36 @@ import { IcDateInput } from "@ukic/canary-react"; export const snippetsDefault = [ { - language: "Web components", - snippet: ` + technology: "Web component", + snippets: { + short: ``, + long: `{shortCode} `, + }, }, { - language: "React", - snippet: ` console.log(detail.value)} />`, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -69,12 +84,27 @@ export const snippetsDefault = [ export const snippetsStringValue = [ { - language: "Web components", - snippet: ``, + technology: "Web component", + snippets: { + short: ``, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ``, + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -89,19 +119,34 @@ export const snippetsStringValue = [ export const snippetsDateObject = [ { - language: "Web components", - snippet: ` + technology: "Web component", + snippets: { + short: ``, + long: `{shortCode} `, + }, }, { - language: "React", - snippet: ``, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -116,19 +161,34 @@ export const snippetsDateObject = [ export const snippetsZulu = [ { - language: "Web components", - snippet: ` + technology: "Web component", + snippets: { + short: ``, + long: `{shortCode} `, + }, }, { - language: "React", - snippet: ``, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -143,16 +203,31 @@ export const snippetsZulu = [ export const snippetsHyphens = [ { - language: "Web components", - snippet: ` + technology: "Web component", + snippets: { + short: ``, + long: `{shortCode} `, + }, }, { - language: "React", - snippet: ``, + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -167,19 +242,34 @@ export const snippetsHyphens = [ export const snippetsEpoch = [ { - language: "Web components", - snippet: ` + technology: "Web component", + snippets: { + short: ``, + long: `{shortCode} `, + }, }, { - language: "React", - snippet: ``, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -194,12 +284,27 @@ export const snippetsEpoch = [ export const snippetsRequired = [ { - language: "Web components", - snippet: ``, + technology: "Web component", + snippets: { + short: ``, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ``, + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -211,12 +316,27 @@ export const snippetsRequired = [ export const snippetsDisabled = [ { - language: "Web components", - snippet: ``, + technology: "Web component", + snippets: { + short: ``, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ``, + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -228,16 +348,66 @@ export const snippetsDisabled = [ export const snippetsSizes = [ { - language: "Web components", - snippet: ` + technology: "Web component", + snippets: { + short: ` `, + long: `.parent-container { + display: flex; + flex-direction: column; + gap: 16px; + padding: 16px; + } + + +
+ {shortCode} +
`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` `, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + display: "flex", + flexDirection: "column", + gap: "16px", + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + display: "flex", + flexDirection: "column", + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; @@ -265,18 +435,33 @@ export const snippetsSizes = [ export const snippetsCustomHelperText = [ { - language: "Web components", - snippet: ``, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ``, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -291,8 +476,9 @@ export const snippetsCustomHelperText = [ export const snippetsValidation = [ { - language: "Web components", - snippet: ``, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ``, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -358,12 +558,27 @@ export const snippetsValidation = [ export const snippetsDisabledPastDates = [ { - language: "Web components", - snippet: ``, + technology: "Web component", + snippets: { + short: ``, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ``, + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -378,12 +593,27 @@ export const snippetsDisabledPastDates = [ export const snippetsDisabledFutureDates = [ { - language: "Web components", - snippet: ``, + technology: "Web component", + snippets: { + short: ``, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ``, + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -398,20 +628,35 @@ export const snippetsDisabledFutureDates = [ export const snippetsMinMax = [ { - language: "Web components", - snippet: ``, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ``, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -427,22 +672,26 @@ export const snippetsMinMax = [ export const snippetsForm = [ { - language: "Web components", - snippet: `
+ technology: "Web component", + snippets: { + short: ` -
`, + long: `{shortCode} +`, + }, }, { - language: "React", - snippet: `const formSubmit = (ev) => { + technology: "React", + snippets: { + short: `const formSubmit = (ev) => { ev.preventDefault(); console.log(ev); }; @@ -453,6 +702,17 @@ return ( Reset );`, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; diff --git a/src/content/structured/components/date-picker/code.mdx b/src/content/structured/components/date-picker/code.mdx index 6f1243852..6ee5f4a8e 100644 --- a/src/content/structured/components/date-picker/code.mdx +++ b/src/content/structured/components/date-picker/code.mdx @@ -24,12 +24,56 @@ import { useState } from "react"; export const snippets = [ { - language: "Web Component", - snippet: ``, + technology: "Web component", + snippets: { + short: ``, + long: `.parent-container { + padding: 16px; + } + + +
+ {shortCode} +
`, + }, }, { - language: "React", - snippet: ``, + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; @@ -49,16 +93,79 @@ Set the size of the date picker by using the `size` prop. This prop takes the va export const sizes = [ { - language: "Web component", - snippet: ` - -`, + technology: "Web component", + snippets: { + short: ` + +`, + long: `.parent-container { + padding: 16px; + } + + +
+ {shortCode} +
`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: `IcDatePicker + label="When would you like to collect your coffee?" + size="small" +/> -`, +`, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + display: "flex", + flexDirection: "column", + gap: "16px", + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + display: "flex", + flexDirection: "column", + gap: "16px", + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; @@ -88,16 +195,96 @@ Set the size of the input field by using the `--input-width` CSS custom property export const maxWidth = [ { - language: "Web component", - snippet: ` - -`, + technology: "Web component", + snippets: { + short: ` + +`, + long: `.parent-container { + display: flex; + flex-direction: column; + gap: 16px; + padding: 16px; + } + ic-date-picker { + --input-width: 500px; + } + + +
+ {shortCode} +
`, + }, }, { - language: "React", - snippet: ` - -`, + technology: "React", + snippets: { + short: ` + +`, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + display: "flex", + flexDirection: "column", + gap: "16px", + padding: "16px", + }, + datePicker: { + "--input-width": "500px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + display: "flex", + flexDirection: "column", + gap: "16px", + padding: "16px", + }, + datePicker: { + "--input-width": "500px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; @@ -130,12 +317,60 @@ export const maxWidth = [ export const disabled = [ { - language: "Web component", - snippet: ``, + technology: "Web component", + snippets: { + short: ``, + long: `.parent-container { + padding: 16px; + } + + +
+ {shortCode} +
`, + }, }, { - language: "React", - snippet: ``, + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; @@ -150,16 +385,70 @@ The default format is `DD/MM/YYYY`. export const dateFormats = [ { - language: "Web component", - snippet: ` - -`, + technology: "Web component", + snippets: { + short: ` + +`, + long: `.parent-container { + display: flex; + flex-direction: column; + gap: 16px; + padding: 16px; + } + ic-date-picker { + --input-width: 500px; + } + + +
+ {shortCode} +
`, + }, }, { - language: "React", - snippet: ` + technology: "React", + snippets: { + short: ` `, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + display: "flex", + flexDirection: "column", + gap: "16px", + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + display: "flex", + flexDirection: "column", + gap: "16px", + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; @@ -183,12 +472,54 @@ The `value` prop sets the date in the input field. The value can be in any forma export const valueSnippet = [ { - language: "Web component", - snippet: ``, + technology: "Web component", + snippets: { + short: ``, + long: `.parent-container { + padding: 16px; + } + + +
+ {shortCode} +
`, + }, }, { - language: "React", - snippet: ``, + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; @@ -207,12 +538,54 @@ The supported formats are the same as for the `value` prop. export const openDate = [ { - language: "Web component", - snippet: ``, + technology: "Web component", + snippets: { + short: ``, + long: `.parent-container { + padding: 16px; + } + + +
+ {shortCode} +
`, + }, }, { - language: "React", - snippet: ``, + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; @@ -230,12 +603,54 @@ The first day of the week can be changed by setting the `startOfWeek` prop. This export const startWeek = [ { - language: "Web component", - snippet: ``, + technology: "Web component", + snippets: { + short: ``, + long: `.parent-container { + padding: 16px; + } + + +
+ {shortCode} +
`, + }, }, { - language: "React", - snippet: ``, + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; @@ -254,15 +669,59 @@ export const disabledDaysOfWeek = [0, 6]; export const disableDays = [ { - language: "Web component", - snippet: ` -`, + technology: "Web component", + snippets: { + short: ``, + long: `.parent-container { + padding: 16px; + } + + +
+ {shortCode} +
+ `, + }, }, { - language: "React", - snippet: `const disabledDaysOfWeek = [0, 6 ;`, + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `const disabledDaysOfWeek = [0, 6] +const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const disabledDaysOfWeek = [0, 6]; +const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; @@ -279,12 +738,54 @@ The `max` and `min` props can be used to limit the range of dates available for export const maxMin = [ { - language: "Web component", - snippet: ``, + technology: "Web component", + snippets: { + short: ``, + long: `.parent-container { + padding: 16px; + } + + +
+ {shortCode} +
`, + }, }, { - language: "React", - snippet: ``, + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; @@ -304,12 +805,54 @@ Dates before today can be disabled with the `disablePast` prop. export const disablePast = [ { - language: "Web component", - snippet: ``, + technology: "Web component", + snippets: { + short: ``, + long: `.parent-container { + padding: 16px; + } + + +
+ {shortCode} +
`, + }, }, { - language: "React", - snippet: ``, + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; @@ -326,12 +869,54 @@ Dates after today can be disabled with the `disableFuture` prop. export const disableFuture = [ { - language: "Web component", - snippet: ``, + technology: "Web component", + snippets: { + short: ``, + long: `.parent-container { + padding: 16px; + } + + +
+ {shortCode} +
}`, + }, }, { - language: "React", - snippet: ``, + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; @@ -348,12 +933,54 @@ Days outside of the current month in view can be hidden by setting the `showDays export const dayHidden = [ { - language: "Web component", - snippet: ``, + technology: "Web component", + snippets: { + short: ``, + long: `.parent-container { + padding: 16px; + } + + +
+ {shortCode} +
`, + }, }, { - language: "React", - snippet: ``, + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; @@ -370,12 +997,54 @@ The "Go to today" and "Clear" buttons can be hidden from the calendar view by se export const btnHidden = [ { - language: "Web component", - snippet: ``, + technology: "Web component", + snippets: { + short: ``, + long: `.parent-container { + padding: 16px; + } + + +
+ {shortCode} +
`, + }, }, { - language: "React", - snippet: ``, + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; @@ -393,18 +1062,72 @@ Any prop that accepts a date value can be set to a Javascript Date object. The f export const jsDates = [ { - language: "Web component", - snippet: ` -`, + technology: "Web component", + snippets: { + short: ``, + long: `.parent-container { + padding: 16px; + } + + +
+ {shortCode} +
+ `, + }, }, { - language: "React", - snippet: ``, + technology: "React", + snippets: { + short: ``, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; @@ -425,37 +1148,96 @@ The `IcChange` event is emitted by the date picker when the selected date change export const change = [ { - language: "Web component", - snippet: ` -`, + technology: "Web component", + snippets: { + short: ` + + Selected date: +`, + long: `.parent-container { + display: flex; + flex-direction: column; + gap: 50px; + padding: 16px; + } + + +
+ {shortCode} +
+ `, + }, }, { - language: "React", - snippet: `export const DatePickerWithIcChange = () => { - const [selectedDate, setSelectedDate] = useState('Selected date:'); - const [value, setValue] = useState(); - const dateChangedHandler = (event) => { - setValue(event.detail.value); - setSelectedDate("Selected date:" + event.detail.value); - } - return ( -
- - - {selectedDate} - -
- ); -};`, + technology: "React", + snippets: { + short: ` + + {selectedDate} +`, + long: [ + { + language: "Typescript", + snippet: `const [selectedDate, setSelectedDate] = useState("Selected date:"); +const [value, setValue] = useState(); +const dateChangedHandler = (event: { detail: { value: Date; }; }) => { + setValue(event.detail.value); + setSelectedDate("Selected date: " + event.detail.value); +}; +const useStyles = createUseStyles({ + parentContainer: { + display: "flex", + flexDirection: "column", + gap: "50px", + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const [selectedDate, setSelectedDate] = useState("Selected date:"); +const [value, setValue] = useState(); +const dateChangedHandler = (event) => { + setValue(event.detail.value); + setSelectedDate("Selected date: " + event.detail.value); +}; +const useStyles = createUseStyles({ + parentContainer: { + display: "flex", + flexDirection: "column", + gap: "50px", + padding: "16px", + }, +}); +const classes = useStyles(); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; diff --git a/src/content/structured/components/dialog/code.mdx b/src/content/structured/components/dialog/code.mdx index cf473e3f6..5b381f4b2 100644 --- a/src/content/structured/components/dialog/code.mdx +++ b/src/content/structured/components/dialog/code.mdx @@ -1,7 +1,7 @@ --- path: "/components/dialog/code" -date: "2023-10-26" +date: "2024-05-02" title: "Dialog" @@ -45,8 +45,16 @@ export const buttonProps = [ export const snippetsDefault = [ { - language: "Web component", - snippet: ` -Launch dialog - - - You are about to add 'Americano' to your basket. Are you sure you want to continue? - -`, +`, + }, }, { - language: "React", - snippet: `const [openDialog, setOpenDialog] = useState(false); + technology: "React", + snippets: { + short: `Launch dialog + + + You are about to add 'Americano' to your basket. Are you sure you want + to continue? + +`, + long: [ + { + language: "Typescript", + snippet: `const [openDialog, setOpenDialog] = useState(false); const handleDialogOpen = () => setOpenDialog(true); const handleDialogClose = () => setOpenDialog(false); return ( <> - Launch dialog - - - You are about to add 'Americano' to your basket. Are you sure you want - to continue? - - + {shortCode} -) - `, +)`, + }, + { + language: "Javascript", + snippet: `const [openDialog, setOpenDialog] = useState(false); +const handleDialogOpen = () => setOpenDialog(true); +const handleDialogClose = () => setOpenDialog(false); +return ( + <> + {shortCode} + +)`, + }, + ], + }, }, ]; @@ -137,8 +158,16 @@ export const DefaultDialog = () => { export const snippetsSizes = [ { - language: "Web component", - snippet: ` -Launch sizes dialog -`, + }, + }, + { + technology: "React", + snippets: { + short: `Launch sizes dialog + - - You are about to add 'Americano' to your basket. Are you sure you want to continue? - -`, - }, - { - language: "React", - snippet: `const [openDialog, setOpenDialog] = useState(false); + + You are about to add 'Americano' to your basket. Are you sure you want to + continue? + +`, + long: [ + { + language: "Typescript", + snippet: `const [openDialog, setOpenDialog] = useState(false); +const handleDialogOpen = () => setOpenDialog(true); +const handleDialogClose = () => setOpenDialog(false); +return ( + <> + {shortCode} + +);`, + }, + { + language: "Javascript", + snippet: `const [openDialog, setOpenDialog] = useState(false); const handleDialogOpen = () => setOpenDialog(true); const handleDialogClose = () => setOpenDialog(false); return ( <> - Launch sizes dialog - - - You are about to add 'Americano' to your basket. Are you sure you want to - continue? - - + {shortCode} );`, + }, + ], + }, }, ]; @@ -228,8 +265,29 @@ export const SizesDialogs = () => { export const snippetsAlert = [ { - language: "Web component", - snippet: ` -Launch status dialog -`, + }, + }, + { + technology: "React", + snippets: { + short: ` + Launch status dialog + + - - - - You are about to add 'Americano' to your basket. Are you sure you want to continue? - -`, - }, - { - language: "React", - snippet: `const [openDialog, setOpenDialog] = useState(false); + variant="neutral" // "neutral" | "info" | "warn" | "error" | "success" + titleAbove + /> + + You are about to add 'Americano' to your basket. Are you sure you want + to continue? + +`, + long: [ + { + language: "Typescript", + snippet: `const [openDialog, setOpenDialog] = useState(false); const handleDialogOpen = () => setOpenDialog(true); const handleDialogClose = () => setOpenlDialog(false); return ( <> - - Launch status dialog - - - - - You are about to add 'Americano' to your basket. Are you sure you want - to continue? - - + {shortCode} );`, + }, + { + language: "Javascript", + snippet: `const [openDialog, setOpenDialog] = useState(false); +const handleDialogOpen = () => setOpenDialog(true); +const handleDialogClose = () => setOpenlDialog(false); +return ( + <> + {shortCode} + +);`, + }, + ], + }, }, ]; @@ -358,8 +416,41 @@ export const AlertDialog = () => { export const snippetsCustomButtons = [ { - language: "Web component", - snippet: ` - Launch no button dialog - Launch single button dialog - Launch three button dialog - Launch destructive button dialog - - Sorry, you cannot place orders at the moment. Please try again later. - - - - Your order for an Americano coffee has been placed. - - - - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod - tempor incididunt ut labore et dolore magna aliqua. - - - - You are about to cancel your order for an Americano. Are you sure you want to continue? - - `, + `, + }, }, { - language: "React", - snippet: `const [openNoButtonDialog, setOpenNoButtonDialog] = useState(false); + technology: "React", + snippets: { + short: `
+ + Launch no button dialog + + + Launch single button dialog + + + Launch three button dialog + + + Launch destructive button dialog + +
+ + + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do + eiusmod tempor incididunt ut labore et dolore magna aliqua. + + + + + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do + eiusmod tempor incididunt ut labore et dolore magna aliqua. + + + + + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do + eiusmod tempor incididunt ut labore et dolore magna aliqua. + + + + + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do + eiusmod tempor incididunt ut labore et dolore magna aliqua. + +`, + long: [ + { + language: "Typescript", + snippet: `const [openNoButtonDialog, setOpenNoButtonDialog] = useState(false); +const [openSingleButtonDialog, setOpenSingleButtonDialog] = useState(false); +const [openThreeButtonsDialog, setOpenThreeButtonsDialog] = useState(false); +const [openDestructiveButtonDialog, setOpenDestructiveButtonDialog] = useState(false); +const handleNoButtonDialogOpen = () => setOpenNoButtonDialog(true); +const handleSingleButtonDialogOpen = () => setOpenSingleButtonDialog(true); +const handleThreeButtonsDialogOpen = () => setOpenThreeButtonsDialog(true); +const handleDestructiveButtonDialogOpen = () => setOpenDestructiveButtonDialog(true); +const handleDialogClose = () => { + setOpenNoButtonDialog(false); + setOpenSingleButtonDialog(false); + setOpenThreeButtonsDialog(false); + setOpenDestructiveButtonDialog(false); +} +const useStyles = createUseStyles({ + btnContainer: { + display: "flex", + gap: "8px", + flexWrap: "wrap", + }, +}); +const classes = useStyles(); +return ( + <> + {shortCode} + +)`, + }, + { + language: "Javascript", + snippet: `const [openNoButtonDialog, setOpenNoButtonDialog] = useState(false); const [openSingleButtonDialog, setOpenSingleButtonDialog] = useState(false); const [openThreeButtonsDialog, setOpenThreeButtonsDialog] = useState(false); const [openDestructiveButtonDialog, setOpenDestructiveButtonDialog] = useState(false); @@ -438,89 +613,22 @@ const handleDialogClose = () => { setOpenThreeButtonsDialog(false); setOpenDestructiveButtonDialog(false); } +const useStyles = createUseStyles({ + btnContainer: { + display: "flex", + gap: "8px", + flexWrap: "wrap", + }, +}); +const classes = useStyles(); return ( <> -
- - Launch no button dialog - - - Launch single button dialog - - - Launch three button dialog - - - Launch destructive button dialog - -
- - - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do - eiusmod tempor incididunt ut labore et dolore magna aliqua. - - - - - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do - eiusmod tempor incididunt ut labore et dolore magna aliqua. - - - - - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do - eiusmod tempor incididunt ut labore et dolore magna aliqua. - - - - - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do - eiusmod tempor incididunt ut labore et dolore magna aliqua. - - + {shortCode} -);`, +)`, + }, + ], + }, }, ]; @@ -643,8 +751,22 @@ export const CustomButtonsDialog = () => { export const snippetsSlottedButtons = [ { - language: "Web component", - snippet: ` -Launch dialog - - - You are about to add 'Americano' to your basket. Are you sure you want to continue? - - - Go back - - - Add to basket - -`, +`, + }, }, { - language: "React", - snippet: `const [openDialog, setOpenDialog] = useState(false); + technology: "React", + snippets: { + short: `Launch slotted buttons dialog + + + You are about to add 'Americano' to your basket. Are you sure you want + to continue? + + + Go back + + + Add to basket + +`, + long: [ + { + language: "Typescript", + snippet: `const [openDialog, setOpenDialog] = useState(false); const handleDialogOpen = () => setOpenDialog(true); const handleDialogClose = () => setOpenDialog(false); const handleAddToBasket = () => { @@ -685,26 +818,27 @@ const handleAddToBasket = () => { } return ( <> - Launch slotted buttons dialog - - - You are about to add 'Americano' to your basket. Are you sure you want - to continue? - - - Go back - - - Add to basket - - + {shortCode} + +);`, + }, + { + language: "Javascript", + snippet: `const [openDialog, setOpenDialog] = useState(false); +const handleDialogOpen = () => setOpenDialog(true); +const handleDialogClose = () => setOpenDialog(false); +const handleAddToBasket = () => { + alert("Added to basket"); + setOpenDialog(false); +} +return ( + <> + {shortCode} );`, + }, + ], + }, }, ]; @@ -752,32 +886,9 @@ export const SlottedButtonsDialog = () => { export const interactiveContentSnippet = [ { - language: "Web component", - snippet: ` -Launch dialog + technology: "Web component", + snippets: { + short: `Launch dialog `, + long: `.parent-container { + padding: 16px; + } + ic-checkbox-group { + margin-top: 8px + } + + +
+ {shortCode} +
+ `, + }, }, { - language: "React", - snippet: `const [termsAgreed, setTermsAgreed] = useState(false); -const [openDialog, setOpenDialog] = useState(false); + technology: "React", + snippets: { + short: `Launch dialog + + + Before continuing, please agree to our terms and conditions. + + + + +`, + long: [ + { + language: "Typescript", + snippet: `const [termsAgreed, setTermsAgreed] = useState(false); +const [openDialog, setOpenDialog] = useState(false); const handleDialogOpen = () => setOpenDialog(true); const handleDialogClose = () => setOpenDialog(false); const toggleTermsAgreed = () => { setTermsAgreed(!termsAgreed); -} +}; const termsDialogConfirmed = (ev) => { const message = (termsAgreed) ? "Terms agreed" : "Terms not agreed"; alert(message); setOpenDialog(false); -} +}; +const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, + checkboxGroup: { + marginTop: "8px", + }, +}); +const classes = useStyles(); return ( - <> - Launch dialog - - - Before continuing, please agree to our terms and conditions. - - - - - - -);`, +
+ {shortCode} +
+)`, + }, + { + language: "Javascript", + snippet: `const [termsAgreed, setTermsAgreed] = useState(false); +const [openDialog, setOpenDialog] = useState(false); +const handleDialogOpen = () => setOpenDialog(true); +const handleDialogClose = () => setOpenDialog(false); +const toggleTermsAgreed = () => { + setTermsAgreed(!termsAgreed); +}; +const termsDialogConfirmed = (ev) => { + const message = (termsAgreed) ? "Terms agreed" : "Terms not agreed"; + alert(message); + setOpenDialog(false); +}; +const useStyles = createUseStyles({ + parentContainer: { + padding: "16px", + }, + checkboxGroup: { + marginTop: "8px", + }, +}); +return ( +
+ {shortCode} +
+)`, + }, + ], + }, }, ]; @@ -894,8 +1085,21 @@ export const InteractiveContent = () => { export const noCloseSnippet = [ { - language: "Web component", - snippet: ` -Launch dialog -`, + }, + }, + { + technology: "React", + snippets: { + short: `Launch dialog + - + You are about to add 'Americano' to your basket. Are you sure you want to continue? - -`, - }, - { - language: "React", - snippet: `const [openDialog, setOpenDialog] = useState(false); -const handleDialogOpen = () => setOpenDialog(true); -const handleDialogClose = () => setOpenDialog(false); -const handleConfirmDialog = (ev) => { - alert("Confirmed!"); - setOpenDialog(false); -}; -return ( - <> - Launch dialog - - - You are about to add 'Americano' to your basket. Are you sure you want to continue? - - - -);`, + +`, + long: [ + { + language: "Typescript", + snippet: `const [openDialog, setOpenDialog] = useState(false); + const handleDialogOpen = () => setOpenDialog(true); + const handleDialogClose = () => setOpenDialog(false); + const handleConfirmDialog = (ev) => { + alert("Confirmed!"); + setOpenDialog(false); + }; + return ( + <> + {shortCode} + + + );`, + }, + { + language: "Javascript", + snippet: `const [openDialog, setOpenDialog] = useState(false); + const handleDialogOpen = () => setOpenDialog(true); + const handleDialogClose = () => setOpenDialog(false); + const handleConfirmDialog = (ev) => { + alert("Confirmed!"); + setOpenDialog(false); + }; + return ( + <> + {shortCode} + + + );`, + }, + ], + }, }, ]; @@ -992,11 +1211,25 @@ export const NoCloseContent = () => { export const eventsSnippet = [ { - language: "Web component", - snippet: ` -Launch dialog - - +`, + }, + }, + { + technology: "React", + snippets: { + short: `Launch dialog + + You are about to add 'Americano' to your basket. Are you sure you want to continue? - - + + Cancel - - + + Confirm - -`, - }, - { - language: "React", - snippet: `const [openDialog, setOpenDialog] = useState(false); + +`, + long: [ + { + language: "Typescript", + snippet: `const [openDialog, setOpenDialog] = useState(false); const handleDialogOpen = () => setOpenDialog(true); const handleDialogClose = () => setOpenDialog(false); const handleDialogOpened = () => alert("Dialog opened"); @@ -1073,28 +1319,46 @@ const handleSlottedConfirm = () => { }; return ( <> - Launch dialog - - - You are about to add 'Americano' to your basket. Are you sure you want to continue? - - - Cancel - - - Confirm - - + {shortCode} -);`, +)`, + }, + { + language: "Javascript", + snippet: `const [openDialog, setOpenDialog] = useState(false); +const handleDialogOpen = () => setOpenDialog(true); +const handleDialogClose = () => setOpenDialog(false); +const handleDialogOpened = () => alert("Dialog opened"); +const handleDialogClosed = () => { + alert("Dialog closed"); + if (openDialog) { + handleDialogClose(); + } +} +const handleDialogCancelled = () => { + alert("Dialog cancelled"); + setOpenDialog(false); +} +const handleDialogConfirmed = () => { + alert("Dialog confirmed"); + setOpenDialog(false); +}; +const handleSlottedCancel = () => { + alert('Slotted cancel button'); + setOpenDialog(false); +}; +const handleSlottedConfirm = () => { + alert('Slotted confirm button'); + setOpenDialog(false); +}; +return ( + <> + {shortCode} + +)`, + }, + ], + }, }, ]; @@ -1164,8 +1428,20 @@ export const EventsContent = () => { export const popoutElements = [ { - language: "Web component", - snippet: ` -Launch disabled height constraint dialog - - Sure, let's dive into the delightful world of milk, where dairy dreams and coffee collide in the harmonious dance of a flat white. Picture this: you stroll into your favorite coffee haunt, the aroma of freshly ground beans tickling your senses. You approach the counter, ready to make a crucial decision – what kind of milk will accompany your flat white?
- In the end, whether you go for the classic, embrace the trendy, or opt for the exotic, the flat white remains a canvas waiting to be painted with your milk of choice. So, next time you're at the coffee counter, let your taste buds embark on a journey – a journey where milk and coffee meet, and every sip tells a story, sprinkled with a dash of humor and a whole lot of flavor. Cheers to the caffeinated adventure!
- -
`, +`, + }, }, { - language: "React", - snippet: `const [openDialog, setOpenDialog] = useState(false); + technology: "React", + snippets: { + short: `Launch disabled height constraint dialog + + + Sure, let's dive into the delightful world of milk, where dairy dreams + and coffee collide in the harmonious dance of a flat white. Picture + this: you stroll into your favorite coffee haunt, the aroma of freshly + ground beans tickling your senses. You approach the counter, ready to + make a crucial decision – what kind of milk will accompany your flat + white? + +
+ + In the end, whether you go for the classic, embrace the trendy, or opt + for the exotic, the flat white remains a canvas waiting to be painted + with your milk of choice. So, next time you're at the coffee counter, + let your taste buds embark on a journey – a journey where milk and + coffee meet, and every sip tells a story, sprinkled with a dash of + humor and a whole lot of flavor. Cheers to the caffeinated adventure! + +
+ +
`, + long: [ + { + language: "Typescript", + snippet: `const [openDialog, setOpenDialog] = useState(false); const handleDialogOpen = () => setOpenDialog(true); const handleDialogClose = () => setOpenDialog(false); return ( <> - Launch disabled height constraint dialog - - Sure, let's dive into the delightful world of milk, where dairy dreams and coffee collide in the harmonious dance of a flat white. Picture this: you stroll into your favorite coffee haunt, the aroma of freshly ground beans tickling your senses. You approach the counter, ready to make a crucial decision – what kind of milk will accompany your flat white?
- In the end, whether you go for the classic, embrace the trendy, or opt for the exotic, the flat white remains a canvas waiting to be painted with your milk of choice. So, next time you're at the coffee counter, let your taste buds embark on a journey – a journey where milk and coffee meet, and every sip tells a story, sprinkled with a dash of humor and a whole lot of flavor. Cheers to the caffeinated adventure!
- -
+ {shortCode} + +)`, + }, + { + language: "Javascript", + snippet: `const [openDialog, setOpenDialog] = useState(false); +const handleDialogOpen = () => setOpenDialog(true); +const handleDialogClose = () => setOpenDialog(false); +return ( + <> + {shortCode} )`, + }, + ], + }, }, ]; diff --git a/src/content/structured/components/empty-state/code.mdx b/src/content/structured/components/empty-state/code.mdx index 49b2ff75b..2343e6236 100644 --- a/src/content/structured/components/empty-state/code.mdx +++ b/src/content/structured/components/empty-state/code.mdx @@ -1,7 +1,7 @@ --- path: "/components/empty-state/code" -date: "2023-08-09" +date: "2024-05-02" title: "Empty state" @@ -25,59 +25,75 @@ import { IcEmptyState, IcButton, IcLink } from "@ukic/react"; export const snippets = [ { - language: "Web component", - snippet: ` - - - - - - - - - - - - - - - - Go to favourite coffees - - Customer support - + technology: "Web component", + snippets: { + short: ` + + + + + + + + + + + + + + + + Go to favourite coffees + + Customer support + `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` - - - - - - - - - - - - - - - - Go to favourite coffees - - Customer support - - `, + technology: "React", + snippets: { + short: ` + + + + + + + + + + + + + + + + Go to favourite coffees + + Customer support + +`, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -119,26 +135,41 @@ export const snippets = [ export const actionsSnippets = [ { - language: "Web component", - snippet: ` - Go to favourite coffees - Customer support + Go to favourite coffees + Customer support `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` - Go to favourite coffees - Customer support + Go to favourite coffees + Customer support `, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -159,58 +190,73 @@ export const actionsSnippets = [ export const imageSnippets = [ { - language: "Web component", - snippet: ` - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + `, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -242,60 +288,75 @@ export const imageSnippets = [ export const imageLargeSnippets = [ { - language: "Web component", - snippet: ` - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + `, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -328,11 +389,12 @@ export const imageLargeSnippets = [ export const iconSnippets = [ { - language: "Web component", - snippet: ` `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` `, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -390,22 +466,37 @@ export const iconSnippets = [ export const rightSnippets = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ``, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -422,22 +513,37 @@ export const rightSnippets = [ export const centreSnippets = [ { - language: "Web component", - snippet: ` `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ``, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -454,22 +560,37 @@ export const centreSnippets = [ export const maxLinesSnippets = [ { - language: "Web component", - snippet: ` + technology: "Web component", + snippets: { + short: ` `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ``, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; diff --git a/src/content/structured/components/footer/code.mdx b/src/content/structured/components/footer/code.mdx index 3d46260a4..349811a5b 100644 --- a/src/content/structured/components/footer/code.mdx +++ b/src/content/structured/components/footer/code.mdx @@ -1,7 +1,7 @@ --- path: "/components/footer/code" -date: "2024-02-02" +date: "2024-05-02" title: "Footer" @@ -27,42 +27,59 @@ import { NavLink, MemoryRouter } from "react-router-dom"; export const snippets = [ { - language: "Web component", - snippet: ` - - Accessibility - - - Styles - - - Components - - - Patterns - + technology: "Web component", + snippets: { + short: ` + + Accessibility + + + Styles + + + Components + + + Patterns + `, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` - - Accessibility - - - Styles - - - Components - - - Patterns - + technology: "React", + snippets: { + short: ` + + Accessibility + + + Styles + + + Components + + + Patterns + `, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -71,16 +88,16 @@ export const snippets = [ description="The UK Intelligence Community Design System (ICDS) is a joint project by MI6, GCHQ, MI5, and partners." caption="All content is available under the Open Government Licence v3.0, except source code and code examples which are available under the MIT Licence." > - + Accessibility - + Styles - + Components - + Patterns @@ -104,56 +121,71 @@ export const snippets = [ export const snippetsGroupedLinks = [ { - language: "Web component", - snippet: ` - - Accessibility - Styles - Components - Patterns - - - Accessibility - Styles - Components - Patterns - - - Accessibility - Styles - Components - Patterns - - `, + technology: "Web component", + snippets: { + short: ` + + Accessibility + Styles + Components + Patterns + + + Accessibility + Styles + Components + Patterns + + + Accessibility + Styles + Components + Patterns + +`, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` - - Accessibility - Styles - Components - Patterns - - - Accessibility - Styles - Components - Patterns - - - Accessibility - Styles - Components - Patterns - - `, + technology: "React", + snippets: { + short: ` + + Accessibility + Styles + Components + Patterns + + + Accessibility + Styles + Components + Patterns + + + Accessibility + Styles + Components + Patterns + +`, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; @@ -164,22 +196,22 @@ export const snippetsGroupedLinks = [ please get in touch." > - Accessibility - Styles - Components - Patterns + Accessibility + Styles + Components + Patterns - Accessibility - Styles - Components - Patterns + Accessibility + Styles + Components + Patterns - Accessibility - Styles - Components - Patterns + Accessibility + Styles + Components + Patterns
@@ -188,18 +220,19 @@ export const snippetsGroupedLinks = [ export const snippetsLogoLinks = [ { - language: "Web component", - snippet: ` - Accessibility - Styles - Components - Patterns + technology: "Web component", + snippets: { + short: ` + Accessibility + Styles + Components + Patterns
- + - +
`, + long: `{shortCode}`, + }, }, { - language: "React", - snippet: ` - Accessibility - Styles - Components - Patterns + technology: "React", + snippets: { + short: ` + Accessibility + Styles + Components + Patterns
- + - +
`, + long: [ + { + language: "Typescript", + snippet: `{shortCode}`, + }, + { + language: "Javascript", + snippet: `{shortCode}`, + }, + ], + }, }, ]; - + Accessibility - + Styles - + Components - + Patterns
- + - + + technology: "React", + snippets: { + short: ` - This is the accessibility page} /> - This page is about styles} /> + This is the accessibility page} /> + This page is about styles} /> - Accessibility + Accessibility Styles -
+ Logo +
+ +`, + long: [ + { + language: "Typescript", + snippet: `const useStyles = createUseStyles({ + logoContainer: { + width: "100px", + height: "100px", + display: "flex", + alignItems: "center", + justifyContent: "center", + backgroundColor: "var(--ic-theme-primary)", + color: "var(--ic-theme-text)" + }, +}); +const classes = useStyles(); +return ( + {shortCode} +)`, + }, + { + language: "Javascript", + snippet: `const useStyles = createUseStyles({ + logoContainer: { width: "100px", height: "100px", display: "flex", @@ -345,12 +420,14 @@ export const withReactRouter = [ justifyContent: "center", backgroundColor: "var(--ic-theme-primary)", color: "var(--ic-theme-text)" - }}> - Logo -
-
- - `, + }, +}); +return ( + {shortCode} +)`, + }, + ], + }, }, ]; @@ -364,7 +441,7 @@ export const withReactRouter = [ caption="This information is exempt under the Freedom of Information Act 2000 (FOIA) and may be exempt under other UK information legislation." > - Accessibility + Accessibility Styles @@ -393,16 +470,17 @@ Adding a `minHeight` of `100vh` ensures the footer appears below the page fold. export const footerLayoutExample = [ { - language: "Web component", - snippet: `\n \n
\n", + "contents": "\nimport { IcLink } from \"@ukic/react\";\n\nimport { MemoryRouter, NavLink } from \"react-router-dom\";\n\nexport const snippets = [\n {\n technology: \"Web component\",\n snippets: {\n short: `About our coffees`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `About our coffees`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n## Component demo\n\n\n e.preventDefault()}>\n About our coffees\n \n\n\n## Link details\n\n\n\n## Variants\n\n### With icon\n\nexport const snippetsIcon = [\n {\n technology: \"Web component\",\n snippets: {\n short: `About our coffees`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `About our coffees`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n About our coffees\n \n\n\n### Light and dark\n\nexport const snippetsLightDark = [\n {\n technology: \"Web component\",\n snippets: {\n short: `About our coffees\nAbout our coffees`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `About our coffees\nAbout our coffees`,\n long: [\n {\n language: \"Typescript\",\n snippet: `
\n {shortCode}\n
`,\n },\n {\n language: \"Javascript\",\n snippet: `
\n {shortCode}\n
`,\n },\n ],\n },\n },\n];\n\n\n \n \n About our coffees\n \n
\n \n \n About our coffees\n \n
\n\n\n### With React Router\n\nexport const withReactRouter = [\n {\n technology: \"React\",\n snippets: {\n short: `\n
\n \n Home\n \n \n Beverages\n \n
\n \n \n This is the home page} />\n This page is about beverages} />\n \n \n
`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n Home\n \n \n \n \n Beverages\n \n \n
\n \n\n", "path": "/components/link/code", - "date": "2023-07-27", + "date": "2024-05-02", "title": "Link", "status": "BETA", "subTitle": "Links can be used either as standalone components or inline with text.", @@ -2413,10 +2413,10 @@ ], "meta": { "relativePath": "components/links/code.mdx", - "createdAt": "2024-05-09T10:42:41.843Z", - "lastModified": "2024-05-09T10:42:41.843Z", - "size": 3608, - "formattedSize": "3.5 KB" + "createdAt": "2024-05-21T09:12:11.371Z", + "lastModified": "2024-05-21T09:12:11.371Z", + "size": 4767, + "formattedSize": "4.7 KB" } }, { @@ -2445,8 +2445,8 @@ ], "meta": { "relativePath": "components/links/guidance.mdx", - "createdAt": "2024-02-14T15:16:06.058Z", - "lastModified": "2024-02-14T15:16:06.058Z", + "createdAt": "2024-05-13T07:27:37.352Z", + "lastModified": "2024-05-13T07:27:37.352Z", "size": 7199, "formattedSize": "7.0 KB" } @@ -2484,9 +2484,9 @@ }, { "id": "components__loading-indicators__codex", - "contents": "\nimport { IcLoadingIndicator } from \"@ukic/react\";\n\n## Component demo\n\nexport const snippets = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: `\n`,\n },\n];\n\n\n \n \n\n\n## Loading indicator details\n\n\n\n## Variants\n\n### Sizes\n\nexport const snippetsSizes = [\n {\n language: \"Web component\",\n snippet: `\n\n\n`,\n },\n {\n language: \"React\",\n snippet: `\n\n\n`,\n },\n];\n\n\n \n \n \n \n\n\n### Icon\n\nexport const snippetsIcon = [\n {\n language: \"Web component\",\n snippet: ``,\n },\n {\n language: \"React\",\n snippet: ``,\n },\n];\n\n\n \n\n\n### Determinate\n\nexport const snippetsDeterminate = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: `\n`,\n },\n];\n\n\n \n \n\n\n### Light\n\nexport const snippetsLight = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: `\n`,\n },\n];\n\n\n \n \n\n\n### Changing label\n\nexport const snippetsChangingLabel = [\n {\n language: \"Web component\",\n snippet: ``,\n },\n {\n language: \"React\",\n snippet: ``,\n },\n];\n\n\n \n\n", + "contents": "\nimport { IcLoadingIndicator } from \"@ukic/react\";\n\n## Component demo\n\nexport const snippets = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `<>\n {shortCode}\n `,\n },\n {\n language: \"Javascript\",\n snippet: `<>\n {shortCode}\n `,\n },\n ],\n },\n },\n];\n\n\n \n \n\n\n## Loading indicator details\n\n\n\n## Variants\n\n### Sizes\n\nexport const snippetsSizes = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n\n\n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n\n\n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `<>\n {shortCode}\n `,\n },\n {\n language: \"Javascript\",\n snippet: `<>\n {shortCode}\n `,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n\n\n### Icon\n\nexport const snippetsIcon = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ``,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n\n\n### Determinate\n\nexport const snippetsDeterminate = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `<>\n {shortCode}\n `,\n },\n {\n language: \"Javascript\",\n snippet: `<>\n {shortCode}\n `,\n },\n ],\n },\n },\n];\n\n\n \n \n\n\n### Light\n\nexport const snippetsLight = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n `,\n long: `.dark-background {\n flex-direction: column; \n gap: 8px; \n background: #333333;\n }\n \n \n
\n {shortCode}\n
`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n darkBackground: {\n display: \"flex\",\n flexDirection: \"column\", \n gap: \"8px\", \n background: \"#333333\",\n },\n});\nconst classes = useStyles();\nreturn (\n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n darkBackground: {\n display: \"flex\",\n flexDirection: \"column\", \n gap: \"8px\", \n background: \"#333333\",\n },\n});\nconst classes = useStyles();\nreturn (\n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n \n \n\n\n### Changing label\n\nexport const snippetsChangingLabel = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ``,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n\n", "path": "/components/loading-indicator/code", - "date": "2023-02-03", + "date": "2024-05-02", "title": "Loading indicator", "status": "BETA", "subTitle": "Loading indicators help inform users that a request is being processed. Circular and linear indicators provide flexibility in design.", @@ -2507,10 +2507,10 @@ ], "meta": { "relativePath": "components/loading-indicators/code.mdx", - "createdAt": "2024-05-09T10:42:41.843Z", - "lastModified": "2024-05-09T10:42:41.843Z", - "size": 5056, - "formattedSize": "4.9 KB" + "createdAt": "2024-05-21T09:12:11.375Z", + "lastModified": "2024-05-21T09:12:11.375Z", + "size": 7834, + "formattedSize": "7.7 KB" } }, { @@ -2539,15 +2539,15 @@ ], "meta": { "relativePath": "components/loading-indicators/guidance.mdx", - "createdAt": "2024-02-14T15:16:06.062Z", - "lastModified": "2024-02-14T15:16:06.062Z", + "createdAt": "2024-05-13T07:27:37.360Z", + "lastModified": "2024-05-13T07:27:37.360Z", "size": 6945, "formattedSize": "6.8 KB" } }, { "id": "components__multi-select__codex", - "contents": "\nimport { IcSelectWithMulti } from \"@ukic/canary-react\";\n\nimport {\n OPTIONS,\n OPTIONS_WITH_DESCRIPTIONS,\n OPTIONS_WITH_DISABLED,\n GROUPED_OPTIONS,\n OPTIONS_WITH_RECOMMENDED,\n} from \"./story-data\";\n\n## Component demo\n\nexport const snippets = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: ` console.log(event.detail.value)}\nonIcOptionSelect={(event) => console.log(event.detail.value)}\nonIcOptionDeselect={(event) => console.log(event.detail.value)}\n/>`,\n },\n];\n\n\n \n\n\n## Select with multi details\n\n\n\n## Variants\n\n### Default value\n\nShow options as pre-selected by setting the `value` prop to an array containing the values of these options.\n\nexport const defaultValue = [\n {\n language: \"Web component\",\n snippet: `\n>`,\n },\n {\n language: \"React\",\n snippet: ` console.log(event.detail.value)}\nonIcOptionSelect={(event) => console.log(event.detail.value)}\nonIcOptionDeselect={(event) => console.log(event.detail.value)}\n/>`,\n },\n];\n\n\n \n\n\n### With clear button\n\nDisplay a clear button by using the `showClearButton` prop.\n\nThis will appear when the user has selected some options and allow them to easily clear their selection.\n\nexport const clear = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: ` console.log(event.detail.value)}\nonIcOptionSelect={(event) => console.log(event.detail.value)}\nonIcOptionDeselect={(event) => console.log(event.detail.value)}\n/>`,\n },\n];\n\n\n \n\n\n### With descriptions\n\nDisplay extra information about the options by providing a description using the `description` property for each option.\n\nexport const desc = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: ` console.log(event.detail.value)}\nonIcOptionSelect={(event) => console.log(event.detail.value)}\nonIcOptionDeselect={(event) => console.log(event.detail.value)}\n/>`,\n },\n];\n\n\n \n\n\n### Helper text\n\nDisplay helper text to provide additional information by using the `helperText` prop.\n\nexport const helper = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: ` console.log(event.detail.value)}\nonIcOptionSelect={(event) => console.log(event.detail.value)}\nonIcOptionDeselect={(event) => console.log(event.detail.value)}\n/>`,\n },\n];\n\n\n \n\n\n### Sizes\n\nSet the size of the multi-select by using the `size` prop. This prop takes the values `small`, `default` or `large`.\nDepending on the chosen size, the prop will apply styling to increase or decrease the amount of spacing within the component.\nThe `default` variant is seen in the first [default](#default) example.\n\nexport const sizes = [\n {\n language: \"Web component\",\n snippet: `\n\n\n`,\n },\n {\n language: \"React\",\n snippet: `const OPTIONS = [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Latte\", value: \"Lat\" },\n { label: \"Americano\", value: \"Ame\" },\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Flat white\", value: \"Fla\" },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n]\n\n\n`,\n },\n];\n\n\n
\n \n \n \n
\n
\n\n### Disabled\n\nDisable the multi-select and prevent user interaction by using the `disabled` prop.\n\nexport const disabled = [\n {\n language: \"Web component\",\n snippet: ``,\n },\n {\n language: \"React\",\n snippet: ``,\n },\n];\n\n\n
\n \n
\n
\n\n### Disabled options\n\nDisable certain options by setting the `disabled` property to `true` for each option.\n\nexport const disabledOptions = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: ` console.log(event.detail.value)}\nonIcOptionSelect={(event) => console.log(event.detail.value)}\nonIcOptionDeselect={(event) => console.log(event.detail.value)}\n/>`,\n },\n];\n\n\n
\n \n
\n
\n\n### Hide label\n\nHide the visible label for the multi-select by using the `hideLabel` prop.\n\nexport const hideLabel = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: ``,\n },\n];\n\n\n
\n \n
\n
\n\n### Required\n\nInform the user that the multi-select is a required field by using the `required` prop.\nThis will display an asterisk next to the label and apply the `aria-required` attribute.\n\nexport const required = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: ``,\n },\n];\n\n\n
\n \n
\n
\n\n### Read-only\n\nMake the multi-select read-only by using the `readonly` prop.\nUse the `value` prop to set which options are selected and will be displayed when it is read-only.\n\nexport const read = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: ``,\n },\n];\n\n\n
\n \n
\n
\n\n### Groups\n\nDisplay options in groups by passing an array of child options to the `children` property of a parent option.\nThe parent option will be rendered as the title of the group.\n\nexport const group = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: ``,\n },\n];\n\n\n
\n \n
\n
\n\n### Recommended\n\nDisplay certain options at the top of the option list by setting the `recommended` property to `true` on each option.\nThis will allow for quick access to these options.\n\nexport const recc = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: ``,\n },\n];\n\n\n
\n \n
\n
\n\n### Validation\n\nDisplay a validation status and message by using the `validation-status` and `validation-message` props.\nThe `validation-status` prop takes the values `success`, `warning` or `error`.\n\nexport const validation = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: ``,\n },\n];\n\n\n
\n \n
\n
\n\n### Loading with error\n\nDisplay the loading state by using the `loading` prop.\nThe multi-select will show a loading error after the amount of time specified using the `timeout` prop has elapsed.\n\nexport const loading = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: ``,\n },\n];\n\n\n
\n \n
\n
\n", + "contents": "\nimport { IcSelectWithMulti } from \"@ukic/canary-react\";\n\nimport {\n OPTIONS,\n OPTIONS_WITH_DESCRIPTIONS,\n OPTIONS_WITH_DISABLED,\n GROUPED_OPTIONS,\n OPTIONS_WITH_RECOMMENDED,\n} from \"./story-data\";\n\n## Component demo\n\nexport const snippets = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `.parent-container {\n padding: 16px;\n }\n\n\n
\n {shortCode}\n
\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ` console.log(event.detail.value)}\n onIcOptionSelect={(event) => console.log(event.detail.value)}\n onIcOptionDeselect={(event) => console.log(event.detail.value)}\n multiple\n/>`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nconst options = [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Latte\", value: \"Lat\" },\n { label: \"Americano\", value: \"Ame\" },\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Flat white\", value: \"Fla\" },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n];\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n \n\n\n## Select with multi details\n\n\n\n## Variants\n\n### Default value\n\nShow options as pre-selected by setting the `value` prop to an array containing the values of these options.\n\nexport const defaultValue = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `.parent-container {\n padding: 16px;\n }\n\n\n
\n {shortCode}\n
\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ` console.log(event.detail.value)}\n onIcOptionSelect={(event) => console.log(event.detail.value)}\n onIcOptionDeselect={(event) => console.log(event.detail.value)}\n multiple\n/>`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nconst options = [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Latte\", value: \"Lat\" },\n { label: \"Americano\", value: \"Ame\" },\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Flat white\", value: \"Fla\" },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n];\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nconst options = [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Latte\", value: \"Lat\" },\n { label: \"Americano\", value: \"Ame\" },\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Flat white\", value: \"Fla\" },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n];\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n \n\n\n### With clear button\n\nDisplay a clear button by using the `showClearButton` prop.\n\nThis will appear when the user has selected some options and allow them to easily clear their selection.\n\nexport const clear = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `.parent-container {\n padding: 16px;\n }\n\n\n
\n {shortCode}\n
\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ` console.log(event.detail.value)}\n onIcOptionSelect={(event) => console.log(event.detail.value)}\n onIcOptionDeselect={(event) => console.log(event.detail.value)}\n multiple\n showClearButton\n/>`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nconst options = [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Latte\", value: \"Lat\" },\n { label: \"Americano\", value: \"Ame\" },\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Flat white\", value: \"Fla\" },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n];\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nconst options = [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Latte\", value: \"Lat\" },\n { label: \"Americano\", value: \"Ame\" },\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Flat white\", value: \"Fla\" },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n];\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n \n\n\n### With descriptions\n\nDisplay extra information about the options by providing a description using the `description` property for each option.\n\nexport const desc = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `.parent-container {\n padding: 16px;\n }\n\n\n
\n {shortCode}\n
\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ` console.log(event.detail.value)}\n onIcOptionSelect={(event) => console.log(event.detail.value)}\n onIcOptionDeselect={(event) => console.log(event.detail.value)}\n multiple\n/>`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nconst options = [\n {\n label: \"Cappuccino\",\n value: \"Cap\",\n description: \"Coffee frothed up with pressurised steam\",\n },\n {\n label: \"Latte\",\n value: \"Lat\",\n description: \"A milkier coffee than a cappuccino\",\n },\n {\n label: \"Americano\",\n value: \"Ame\",\n description: \"Espresso coffee diluted with hot water\",\n },\n {\n label: \"Filter\",\n value: \"Fil\",\n description: \"Coffee filtered using paper or a mesh\",\n },\n {\n label: \"Flat white\",\n value: \"Fla\",\n description:\n \"Coffee without froth made with espresso and hot steamed milk\",\n },\n {\n label: \"Mocha\",\n value: \"Moc\",\n description: \"A mixture of coffee and chocolate\",\n },\n {\n label: \"Macchiato\",\n value: \"Mac\",\n description: \"Espresso coffee with a dash of frothy steamed milk\",\n },\n];\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nconst options = [\n {\n label: \"Cappuccino\",\n value: \"Cap\",\n description: \"Coffee frothed up with pressurised steam\",\n },\n {\n label: \"Latte\",\n value: \"Lat\",\n description: \"A milkier coffee than a cappuccino\",\n },\n {\n label: \"Americano\",\n value: \"Ame\",\n description: \"Espresso coffee diluted with hot water\",\n },\n {\n label: \"Filter\",\n value: \"Fil\",\n description: \"Coffee filtered using paper or a mesh\",\n },\n {\n label: \"Flat white\",\n value: \"Fla\",\n description:\n \"Coffee without froth made with espresso and hot steamed milk\",\n },\n {\n label: \"Mocha\",\n value: \"Moc\",\n description: \"A mixture of coffee and chocolate\",\n },\n {\n label: \"Macchiato\",\n value: \"Mac\",\n description: \"Espresso coffee with a dash of frothy steamed milk\",\n },\n];\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n \n\n\n### Helper text\n\nDisplay helper text to provide additional information by using the `helperText` prop.\n\nexport const helper = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `.parent-container {\n padding: 16px;\n }\n\n\n
\n {shortCode}\n
\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ` console.log(event.detail.value)}\n onIcOptionSelect={(event) => console.log(event.detail.value)}\n onIcOptionDeselect={(event) => console.log(event.detail.value)}\n multiple\n/>`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nconst options = [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Latte\", value: \"Lat\" },\n { label: \"Americano\", value: \"Ame\" },\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Flat white\", value: \"Fla\" },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n];\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nconst options = [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Latte\", value: \"Lat\" },\n { label: \"Americano\", value: \"Ame\" },\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Flat white\", value: \"Fla\" },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n];\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n \n\n\n### Sizes\n\nSet the size of the multi-select by using the `size` prop. This prop takes the values `small`, `default` or `large`.\nDepending on the chosen size, the prop will apply styling to increase or decrease the amount of spacing within the component.\nThe `default` variant is seen in the first [default](#default) example.\n\nexport const sizes = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n\n`,\n long: `.parent-container {\n display: flex;\n flex-direction: column;\n gap: 16px;\n padding: 16px;\n }\n\n\n
\n {shortCode}\n
\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n\n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"16px\",\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nconst options = [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Latte\", value: \"Lat\" },\n { label: \"Americano\", value: \"Ame\" },\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Flat white\", value: \"Fla\" },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n];\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n display: \"flex\",\n flexDirection: \"column\",\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nconst options = [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Latte\", value: \"Lat\" },\n { label: \"Americano\", value: \"Ame\" },\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Flat white\", value: \"Fla\" },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n];\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n
\n \n \n \n
\n
\n\n### Disabled\n\nDisable the multi-select and prevent user interaction by using the `disabled` prop.\n\nexport const disabled = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `.parent-container {\n padding: 16px;\n }\n\n\n
\n {shortCode}\n
`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ``,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nconst options = [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Latte\", value: \"Lat\" },\n { label: \"Americano\", value: \"Ame\" },\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Flat white\", value: \"Fla\" },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n];\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nconst options = [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Latte\", value: \"Lat\" },\n { label: \"Americano\", value: \"Ame\" },\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Flat white\", value: \"Fla\" },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n];\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n
\n \n
\n
\n\n### Disabled options\n\nDisable certain options by setting the `disabled` property to `true` for each option.\n\nexport const disabledOptions = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `.parent-container {\n padding: 16px;\n }\n\n\n
\n {shortCode}\n
\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ` console.log(event.detail.value)}\n onIcOptionSelect={(event) => console.log(event.detail.value)}\n onIcOptionDeselect={(event) => console.log(event.detail.value)}\n multiple\n/>`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nconst options = [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Latte\", value: \"Lat\", disabled: true },\n { label: \"Americano\", value: \"Ame\" },\n { label: \"Filter\", value: \"Fil\", disabled: true },\n { label: \"Flat white\", value: \"Fla\", disabled: true },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n];\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nconst options = [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Latte\", value: \"Lat\", disabled: true },\n { label: \"Americano\", value: \"Ame\" },\n { label: \"Filter\", value: \"Fil\", disabled: true },\n { label: \"Flat white\", value: \"Fla\", disabled: true },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n];\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n
\n \n
\n
\n\n### Hide label\n\nHide the visible label for the multi-select by using the `hideLabel` prop.\n\nexport const hideLabel = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `.parent-container {\n padding: 16px;\n }\n\n\n
\n {shortCode}\n
\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ``,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nconst options = [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Latte\", value: \"Lat\" },\n { label: \"Americano\", value: \"Ame\" },\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Flat white\", value: \"Fla\" },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n];\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nconst options = [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Latte\", value: \"Lat\" },\n { label: \"Americano\", value: \"Ame\" },\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Flat white\", value: \"Fla\" },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n];\nreturn (\n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n
\n \n
\n
\n\n### Required\n\nInform the user that the multi-select is a required field by using the `required` prop.\nThis will display an asterisk next to the label and apply the `aria-required` attribute.\n\nexport const required = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `.parent-container {\n padding: 16px;\n }\n\n\n
\n {shortCode}\n
\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ``,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nconst options = [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Latte\", value: \"Lat\" },\n { label: \"Americano\", value: \"Ame\" },\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Flat white\", value: \"Fla\" },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n];\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nconst options = [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Latte\", value: \"Lat\" },\n { label: \"Americano\", value: \"Ame\" },\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Flat white\", value: \"Fla\" },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n];\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n
\n \n
\n
\n\n### Read-only\n\nMake the multi-select read-only by using the `readonly` prop.\nUse the `value` prop to set which options are selected and will be displayed when it is read-only.\n\nexport const read = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `.parent-container {\n padding: 16px;\n }\n\n\n
\n {shortCode}\n
\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ``,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nconst options = [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Latte\", value: \"Lat\" },\n { label: \"Americano\", value: \"Ame\" },\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Flat white\", value: \"Fla\" },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n];\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nconst options = [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Latte\", value: \"Lat\" },\n { label: \"Americano\", value: \"Ame\" },\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Flat white\", value: \"Fla\" },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n];\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n
\n \n
\n
\n\n### Groups\n\nDisplay options in groups by passing an array of child options to the `children` property of a parent option.\nThe parent option will be rendered as the title of the group.\n\nexport const group = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `.parent-container {\n padding: 16px;\n }\n\n\n
\n {shortCode}\n
\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ``,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nconst options = [\n {\n label: \"Fancy\",\n children: [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Flat white\", value: \"Flat\" },\n ],\n },\n {\n label: \"Boring\",\n children: [\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Latte\", value: \"Lat\" },\n ],\n },\n];\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nconst options = [\n {\n label: \"Fancy\",\n children: [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Flat white\", value: \"Flat\" },\n ],\n },\n {\n label: \"Boring\",\n children: [\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Latte\", value: \"Lat\" },\n ],\n },\n];\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n
\n \n
\n
\n\n### Recommended\n\nDisplay certain options at the top of the option list by setting the `recommended` property to `true` on each option.\nThis will allow for quick access to these options.\n\nexport const recc = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `.parent-container {\n padding: 16px;\n }\n\n\n
\n {shortCode}\n
\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ``,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nconst options = [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Latte\", value: \"Lat\" },\n { label: \"Americano\", value: \"Ame\", recommended: true },\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Flat white\", value: \"Fla\", recommended: true },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n];\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nconst options = [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Latte\", value: \"Lat\" },\n { label: \"Americano\", value: \"Ame\", recommended: true },\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Flat white\", value: \"Fla\", recommended: true },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n];\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n
\n \n
\n
\n\n### Validation\n\nDisplay a validation status and message by using the `validation-status` and `validation-message` props.\nThe `validation-status` prop takes the values `success`, `warning` or `error`.\n\nexport const validation = [\n {\n technology: \"Web component\",\n snippets: {\n short: ` `,\n long: `.parent-container {\n padding: 16px;\n }\n\n\n
\n {shortCode}\n
\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ``,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nconst options = [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Latte\", value: \"Lat\" },\n { label: \"Americano\", value: \"Ame\" },\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Flat white\", value: \"Fla\" },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n];\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nconst options = [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Latte\", value: \"Lat\" },\n { label: \"Americano\", value: \"Ame\" },\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Flat white\", value: \"Fla\" },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n];\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n
\n \n
\n
\n\n### Loading with error\n\nDisplay the loading state by using the `loading` prop.\nThe multi-select will show a loading error after the amount of time specified using the `timeout` prop has elapsed.\n\nexport const loading = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `.parent-container {\n padding: 16px;\n }\n\n\n
\n {shortCode}\n
\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ``,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nconst options = [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Latte\", value: \"Lat\" },\n { label: \"Americano\", value: \"Ame\" },\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Flat white\", value: \"Fla\" },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n];\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nconst options = [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Latte\", value: \"Lat\" },\n { label: \"Americano\", value: \"Ame\" },\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Flat white\", value: \"Fla\" },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n];\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n
\n \n
\n
\n", "path": "/components/multi-select/code", "date": "2024-05-02", "title": "Multi select", @@ -2565,10 +2565,10 @@ ], "meta": { "relativePath": "components/multi-select/code.mdx", - "createdAt": "2024-05-02T13:33:41.532Z", - "lastModified": "2024-05-02T13:33:41.532Z", - "size": 26343, - "formattedSize": "25.7 KB" + "createdAt": "2024-05-21T09:12:11.375Z", + "lastModified": "2024-05-21T09:12:11.375Z", + "size": 44191, + "formattedSize": "43.2 KB" } }, { @@ -2592,8 +2592,8 @@ ], "meta": { "relativePath": "components/multi-select/guidance.mdx", - "createdAt": "2024-05-02T13:34:20.141Z", - "lastModified": "2024-05-02T13:34:20.141Z", + "createdAt": "2024-05-13T07:27:37.360Z", + "lastModified": "2024-05-13T07:27:37.360Z", "size": 1951, "formattedSize": "1.9 KB" } @@ -2631,9 +2631,9 @@ }, { "id": "components__page-header__codex", - "contents": "\nimport {\n IcPageHeader,\n IcButton,\n IcStepper,\n IcStep,\n SlottedSVG,\n IcTextField,\n IcNavigationItem,\n IcBreadcrumb,\n IcBreadcrumbGroup,\n IcSectionContainer,\n IcChip,\n IcTypography,\n} from \"@ukic/react\";\n\nimport { NavLink, MemoryRouter } from \"react-router-dom\";\n\n## Component demo\n\nexport const snippets = [\n {\n language: \"Web component\",\n snippet: `\n \n \n Create coffee\n \n \n Filter coffee\n \n \n \n \n \n \n \n `,\n },\n {\n language: \"React\",\n snippet: `\n \n \n Create coffee\n \n \n Filter coffee\n \n \n \n \n \n \n \n `,\n },\n];\n\n\n \n \n \n Create coffee\n \n \n Filter coffee\n \n \n \n \n \n \n \n \n\n\n## Page header details\n\n\n\n## Variants\n\n### Size small\n\nexport const snippetsSmall = [\n {\n language: \"Web component\",\n snippet: ``,\n },\n {\n language: \"React\",\n snippet: ``,\n },\n];\n\n\n \n\n\n### With breadcrumb navigation\n\nexport const withBreadcrumbNavigation = [\n {\n language: \"Web component\",\n snippet: `\n \n \n \n \n \n \n \n\n `,\n },\n {\n language: \"React\",\n snippet: `\n \n \n \n \n \n \n\n `,\n },\n];\n\n\n \n \n \n \n \n \n \n \n\n\n### With actions, input and stepper\n\nexport const withActionsInputStepper = [\n {\n language: \"Web component\",\n snippet: `\n \n Create coffee\n Filter coffee\n \n \n \n \n \n \n\n `,\n },\n {\n language: \"React\",\n snippet: `\n \n \n Create coffee\n \n \n Filter coffee\n \n \n \n \n \n \n \n\n `,\n },\n];\n\n\n \n \n \n Create coffee\n \n \n Filter coffee\n \n \n \n \n \n \n \n \n\n\n### With actions, input and tabs\n\nexport const withActionsInputTabs = [\n {\n language: \"Web component\",\n snippet: `\n \n Create coffee\n Filter coffee\n \n \n \n \n \n\n `,\n },\n {\n language: \"React\",\n snippet: `\n \n \n Create coffee\n \n \n Filter coffee\n \n \n \n \n\n `,\n },\n];\n\n\n \n \n \n Create coffee\n \n \n Filter coffee\n \n \n \n \n \n\n\n### With React Router\n\nexport const withReactRouter = [\n {\n language: \"React\",\n snippet: `\n \n \n Create coffee\n \n \n \n \n Filter coffee\n \n Method\n \n \n Ingredients\n \n \n \n \n \n This page is about our Latte making methods}/>\n This page is about the ingredients used in our Latte}/>\n \n \n\n `,\n },\n];\n\n\n \n \n \n \n Create coffee\n \n \n \n \n \n Filter coffee\n \n \n \n Method\n \n \n \n \n Ingredients\n \n \n \n \n \n \n\n\n### With Slots\n\nexport const withSlots = [\n {\n language: \"Web component\",\n snippet: `\n Latte recipe\n A Latte is a popular Italian coffee, made with espresso, steamed milk and a thin layer of foam.\n \n \n \n \n \n \n \n`,\n },\n {\n language: \"React\",\n snippet: `\n \n Latte recipe\n \n \n A Latte is a popular Italian coffee, made with espresso, steamed milk and\n a thin layer of foam.\n \n \n \n \n \n \n \n \n`,\n },\n];\n\n\n \n \n Latte recipe\n \n \n A Latte is a popular Italian coffee, made with espresso, steamed milk and\n a thin layer of foam.\n \n \n \n \n \n \n \n \n \n\n", + "contents": "\nimport {\n IcPageHeader,\n IcButton,\n IcStepper,\n IcStep,\n SlottedSVG,\n IcTextField,\n IcNavigationItem,\n IcBreadcrumb,\n IcBreadcrumbGroup,\n IcSectionContainer,\n IcChip,\n IcTypography,\n} from \"@ukic/react\";\n\nimport { NavLink, MemoryRouter } from \"react-router-dom\";\n\n## Component demo\n\nexport const snippets = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n Create coffee\n \n \n Filter coffee\n \n \n \n \n \n \n \n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n Create coffee\n \n \n Filter coffee\n \n \n \n \n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n Create coffee\n \n \n Filter coffee\n \n \n \n \n \n \n \n \n\n\n## Page header details\n\n\n\n## Variants\n\n### Size small\n\nexport const snippetsSmall = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ``,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n\n\n### With breadcrumb navigation\n\nexport const withBreadcrumbNavigation = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n \n \n \n \n \n\n `,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n \n \n \n \n\n `,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n \n \n \n \n\n\n### With actions, input and stepper\n\nexport const withActionsInputStepper = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n Create coffee\n Filter coffee\n \n \n \n \n \n \n\n `,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n Create coffee\n \n \n Filter coffee\n \n \n \n \n \n \n \n\n `,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n Create coffee\n \n \n Filter coffee\n \n \n \n \n \n \n \n \n\n\n### With actions, input and tabs\n\nexport const withActionsInputTabs = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n Create coffee\n Filter coffee\n \n \n \n \n \n\n `,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n Create coffee\n \n \n Filter coffee\n \n \n \n \n\n `,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n Create coffee\n \n \n Filter coffee\n \n \n \n \n \n\n\n### With React Router\n\nexport const withReactRouter = [\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n Create coffee\n \n \n \n \n Filter coffee\n \n Method\n \n \n Ingredients\n \n \n \n \n \n This page is about our Latte making methods}/>\n This page is about the ingredients used in our Latte}/>\n \n \n\n `,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n textField: {\n '@media (max-width: 576px)': {\n width: '280px;'\n }\n }\n })\n const classes = useStyles();\n return(\n {shortCode}\n )`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n text: {\n '@media (max-width: 576px)': {\n width: '280px;'\n }\n }\n })\n const classes = useStyles();\n return(\n {shortCode}\n )`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n Create coffee\n \n \n \n \n \n Filter coffee\n \n \n \n Method\n \n \n \n \n Ingredients\n \n \n \n \n \n \n\n\n### With Slots\n\nexport const withSlots = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n Latte recipe\n A Latte is a popular Italian coffee, made with espresso, steamed milk and a thin layer of foam.\n \n \n \n \n \n \n \n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n Latte recipe\n \n \n A Latte is a popular Italian coffee, made with espresso, steamed milk and\n a thin layer of foam.\n \n \n \n \n \n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n Latte recipe\n \n \n A Latte is a popular Italian coffee, made with espresso, steamed milk and\n a thin layer of foam.\n \n \n \n \n \n \n \n \n \n\n", "path": "/components/page-header/code", - "date": "2023-10-25", + "date": "2024-05-02", "title": "Page header", "status": "BETA", "subTitle": "A page header defines the top of the page content and is a consistent way to show page context, key actions and secondary navigation.", @@ -2654,10 +2654,10 @@ ], "meta": { "relativePath": "components/page-header/code.mdx", - "createdAt": "2024-05-09T10:42:41.847Z", - "lastModified": "2024-05-09T10:42:41.847Z", - "size": 16912, - "formattedSize": "16.5 KB" + "createdAt": "2024-05-21T09:12:11.375Z", + "lastModified": "2024-05-21T09:12:11.375Z", + "size": 19280, + "formattedSize": "18.8 KB" } }, { @@ -2665,7 +2665,7 @@ "contents": "\nimport {\n IcPageHeader,\n IcButton,\n IcTextField,\n IcStepper,\n IcStep,\n IcChip,\n} from \"@ukic/react\";\nimport pageHeaderFig1 from \"./images/fig-1-page-header-anatomy.png\";\nimport pageHeaderFig2 from \"./images/fig-2-dont-use-global-actions-in-a-page-header.png\";\nimport pageHeaderFig3 from \"./images/fig-3-use-default-and-dense-sizing.png\";\nimport pageHeaderFig4 from \"./images/fig-4-set-width-of-page-header-to-match-width-of-main-content.png\";\nimport pageHeaderFig5 from \"./images/fig-5-dont-set-width-of-page-header-to-align-to-content.png\";\nimport pageHeaderFig6 from \"./images/fig-6-page-header-displayed-whilst-scroll-position-is-at-top-of-page.png\";\nimport pageHeaderFig7 from \"./images/fig-7-sticky-page-header-displayed-whilst-scrolled.png\";\nimport pageHeaderFig8 from \"./images/fig-8-centre-alignment.png\";\nimport pageHeaderFig9 from \"./images/fig-9-left-alignment.png\";\nimport pageHeaderFig10 from \"./images/fig-10-full-width.png\";\nimport pageHeaderFig11 from \"./images/fig-11-dont-mix-alignment.png\";\n\n## Introduction\n\nAn example of the page header component.\n\n\n \n \n \n Create coffee\n \n \n Filter coffee\n \n \n \n \n \n \n \n \n\n\n## When to use\n\nUse a page header to display an introduction to the content of the page. Add additional elements to provide actions, navigation or inputs at the page level.\n\n\n\n### With action\n\nUse [buttons](/components/button) when you need to provide actions that affect all content on the page. For example, to filter or to add a new record. Only use one primary button per page header. Use any type of button within the page header’s interaction area.\n\n### With input\n\nInclude an [input field](/components/search-bar) to search or filter data displayed on the page. Don’t overload the input area with components, consider placing them in the page content instead.\n\n### With breadcrumb navigation\n\nUse a [breadcrumb](/components/breadcrumb) to show the current page’s position in the app’s hierarchy or show a link to the parent page.\n\n### With tab navigation\n\nUse [tabs](/components/tabs) if the content grouped by the header can be split into distinct categories.\n\n### With stepper\n\nUse a [stepper](/components/stepper) to show progress through a multi-step process.\n\n## When not to use\n\nDon’t use the page header to include global actions or global navigation, instead use the [top navigation](/components/top-navigation) or [side navigation](/components/side-navigation).\n\n\n\n## Sizing\n\n\n\nSet the width of the page header to match the width of the page’s main content.\n\n\n\n\n\n## Layout and placement\n\n### Sticky scroll\n\nSet the page header to stick to the top of the screen if you need it to be visible when scrolling. Otherwise, set it to scroll with content to maximise available space for content.\n\n\n\n\n\n### Alignment\n\nAlign the page header either to the left, centre or full-width to match the rest of the content on the page.\n\n\n\n\n\n\n\nDon’t align a page header’s content differently to how the rest of the page content is aligned.\n\n\n\n## Content\n\nUse short titles that clearly describe the page's content.\n\nKeep page subtitles concise within the page header. If more content is required, consider placing it within the page itself.\n\nInclude a title adornment to convey information such as a status or versioning.\n\n## Related components\n\n- [Hero](/components/hero)\n- [Top navigation](/components/top-navigation)\n- [Side navigation](/components/side-navigation)\n", "path": "/components/page-header", "navPriority": 22, - "date": "2023-02-03", + "date": "2024-05-10", "title": "Page header", "status": "BETA", "subTitle": "A page header defines the top of the page content and is a consistent way to show page context, key actions and secondary navigation.", @@ -2686,8 +2686,8 @@ ], "meta": { "relativePath": "components/page-header/guidance.mdx", - "createdAt": "2024-02-14T15:16:06.062Z", - "lastModified": "2024-02-14T15:16:06.062Z", + "createdAt": "2024-05-13T07:27:37.364Z", + "lastModified": "2024-05-13T07:27:37.364Z", "size": 9062, "formattedSize": "8.8 KB" } @@ -2725,9 +2725,9 @@ }, { "id": "components__pagination__codex", - "contents": "\nimport { IcPagination } from \"@ukic/react\";\n\n## Component demo\n\nexport const snippets = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: `\n`,\n },\n];\n\n\n
\n \n
\n \n\n\n## Pagination details\n\n\n\n## Variants\n\n### Hide first and last page buttons\n\nexport const hideFirstLast = [\n {\n language: \"Web component\",\n snippet: ``,\n },\n {\n language: \"React\",\n snippet: ``,\n },\n];\n\n\n \n\n\n### Hide current page (only in 'simple' type)\n\nexport const hideCurrent = [\n {\n language: \"Web component\",\n snippet: ``,\n },\n {\n language: \"React\",\n snippet: ``,\n },\n];\n\n\n \n\n\n### Appearance\n\nexport const appearance = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: `\n`,\n },\n];\n\n\n \n
\n \n
\n\n\n### Boundary and Adjacent items set\n\nexport const boundaryAdjacent = [\n {\n language: \"Web component\",\n snippet: ``,\n },\n {\n language: \"React\",\n snippet: ``,\n },\n];\n\n\n \n\n\n### Disabled\n\nexport const disabled = [\n {\n language: \"Web component\",\n snippet: ``,\n },\n {\n language: \"React\",\n snippet: ``,\n },\n];\n\n\n \n\n\n### Label\n\nexport const label = [\n {\n language: \"Web component\",\n snippet: ``,\n },\n {\n language: \"React\",\n snippet: ``,\n },\n];\n\n\n \n\n\n### Default page\n\nexport const defaultPage = [\n {\n language: \"Web component\",\n snippet: ``,\n },\n {\n language: \"React\",\n snippet: ``,\n },\n];\n\n\n \n\n", + "contents": "\nimport { IcPagination } from \"@ukic/react\";\n\n## Component demo\n\nexport const snippets = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `<>\n {shortCode}\n `,\n },\n {\n language: \"Javascript\",\n snippet: `<>\n {shortCode}\n `,\n },\n ],\n },\n },\n];\n\n\n
\n \n
\n \n\n\n## Pagination details\n\n\n\n## Variants\n\n### Hide first and last page buttons\n\nexport const hideFirstLast = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ``,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n\n\n### Hide current page (only in 'simple' type)\n\nexport const hideCurrent = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ``,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n\n\n### Appearance\n\nexport const appearance = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n`,\n long: `.dark-background {\n background-color: #2c2f34;\n }\n \n \n {shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n darkBackground: {\n backgroundColor: \"#2c2f34\",\n }\n});\nconst classes = useStyles();\nreturn (\n <>\n {shortCode}\n \n)`,\n },\n {\n language: \"Javascript\",\n snippet: `<>\n {shortCode}\n `,\n },\n ],\n },\n },\n];\n\n\n \n
\n \n
\n\n\n### Boundary and Adjacent items set\n\nexport const boundaryAdjacent = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ``,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n\n\n### Disabled\n\nexport const disabled = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ``,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n\n\n### Label\n\nexport const label = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ``,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n\n\n### Default page\n\nexport const defaultPage = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ``,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n\n", "path": "/components/pagination/code", - "date": "2023-05-05", + "date": "2024-05-02", "title": "Pagination", "status": "BETA", "subTitle": "Use the Pagination components to split large amounts of content into pages and navigate between them.", @@ -2748,10 +2748,10 @@ ], "meta": { "relativePath": "components/pagination/code.mdx", - "createdAt": "2024-05-09T10:42:41.855Z", - "lastModified": "2024-05-09T10:42:41.855Z", - "size": 4638, - "formattedSize": "4.5 KB" + "createdAt": "2024-05-21T09:12:11.375Z", + "lastModified": "2024-05-21T09:12:11.375Z", + "size": 7256, + "formattedSize": "7.1 KB" } }, { @@ -2780,8 +2780,8 @@ ], "meta": { "relativePath": "components/pagination/guidance.mdx", - "createdAt": "2024-02-14T15:16:06.066Z", - "lastModified": "2024-02-14T15:16:06.066Z", + "createdAt": "2024-05-13T07:27:37.368Z", + "lastModified": "2024-05-13T07:27:37.368Z", "size": 11142, "formattedSize": "10.9 KB" } @@ -2819,9 +2819,9 @@ }, { "id": "components__popover-menu__codex", - "contents": "\nimport { IcPopoverMenu, IcMenuItem, IcMenuGroup, IcButton } from \"@ukic/react\";\nimport { useRef } from \"react\";\n\n## Component demo\n\nexport const snippets = [\n {\n language: \"Web component\",\n snippet: `\n \n \n \n\n\n
\n \n \n \n \n \n \n \n \n \n \n
`,\n },\n {\n language: \"React\",\n snippet: `const popoverEl = useRef(null);\nconst handleClick = () => {\n popoverEl.current.open = !popoverEl.current.open;\n};\nreturn (\n <>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n);`,\n },\n];\n\nexport const DemoPopover = () => {\n const popoverEl = useRef(null);\n const handleClick = () => {\n popoverEl.current.open = !popoverEl.current.open;\n };\n return (\n <>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n );\n};\n\n\n \n\n\n## Popover menu details\n\n\n\n## Menu item details\n\n\n\n## Menu group details\n\n\n\n## Variants\n\n### With button variations\n\nexport const snippetsButtons = [\n {\n language: \"Web component\",\n snippet: `\n \n \n \n\n\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
`,\n },\n {\n language: \"React\",\n snippet: `const popoverEl = useRef(null);\nconst handleClick = () => {\n popoverEl.current.open = !popoverEl.current.open;\n};\nreturn (\n <>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n);`,\n },\n];\n\nexport const ButtonsPopover = () => {\n const popoverEl = useRef(null);\n const handleClick = () => {\n popoverEl.current.open = !popoverEl.current.open;\n };\n return (\n <>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n );\n};\n\n\n \n\n\n### With menu groups\n\nexport const snippetsGroups = [\n {\n language: \"Web component\",\n snippet: `\n \n \n \n\n\n
\n \n \n \n \n \n \n \n \n \n \n
`,\n },\n {\n language: \"React\",\n snippet: `const popoverEl = useRef(null);\nconst handleClick = () => {\n popoverEl.current.open = !popoverEl.current.open;\n};\nreturn (\n <>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n);`,\n },\n];\n\nexport const GroupsPopover = () => {\n const popoverEl = useRef(null);\n const handleClick = () => {\n popoverEl.current.open = !popoverEl.current.open;\n };\n return (\n <>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n );\n};\n\n\n \n\n", + "contents": "\nimport { IcPopoverMenu, IcMenuItem, IcMenuGroup, IcButton } from \"@ukic/react\";\nimport { useRef } from \"react\";\n\n## Component demo\n\nexport const snippets = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n \n\n
\n \n \n \n \n \n \n \n \n \n \n
`,\n long: `{shortCode}\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n \n\n\n \n \n \n\n\n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const popoverEl = useRef(null);\nconst handleClick = () => {\n popoverEl.current.open = !popoverEl.current.open;\n};\nreturn (\n <>\n {shortCode}\n \n);`,\n },\n {\n language: \"Javascript\",\n snippet: `const popoverEl = useRef(null);\nconst handleClick = () => {\n popoverEl.current.open = !popoverEl.current.open;\n};\nreturn (\n <>\n {shortCode}\n \n);`,\n },\n ],\n },\n },\n];\n\nexport const DemoPopover = () => {\n const popoverEl = useRef(null);\n const handleClick = () => {\n popoverEl.current.open = !popoverEl.current.open;\n };\n return (\n <>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n );\n};\n\n\n \n\n\n## Popover menu details\n\n\n\n## Menu item details\n\n\n\n## Menu group details\n\n\n\n## Variants\n\n### With button variations\n\nexport const snippetsButtons = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n \n\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
`,\n long: `{shortCode}\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n \n\n\n \n \n \n \n \n \n \n \n \n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const popoverEl = useRef(null);\nconst handleClick = () => {\n popoverEl.current.open = !popoverEl.current.open;\n};\nreturn (\n <>\n {shortCode}\n \n);`,\n },\n {\n language: \"Javascript\",\n snippet: `const popoverEl = useRef(null);\nconst handleClick = () => {\n popoverEl.current.open = !popoverEl.current.open;\n};\nreturn (\n <>\n {shortCode}\n \n);`,\n },\n ],\n },\n },\n];\n\nexport const ButtonsPopover = () => {\n const popoverEl = useRef(null);\n const handleClick = () => {\n popoverEl.current.open = !popoverEl.current.open;\n };\n return (\n <>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n );\n};\n\n\n \n\n\n### With menu groups\n\nexport const snippetsGroups = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n \n\n
\n \n \n \n \n \n \n \n \n \n \n
`,\n long: `{shortCode}\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n \n \n \n \n \n \n \n \n \n \n \n `,\n long: [\n {\n language: \"Typescript\",\n snippet: `const popoverEl = useRef(null);\nconst handleClick = () => {\n popoverEl.current.open = !popoverEl.current.open;\n};\nreturn (\n <>\n {shortCode}\n \n);`,\n },\n {\n language: \"Javascript\",\n snippet: `const popoverEl = useRef(null);\nconst handleClick = () => {\n popoverEl.current.open = !popoverEl.current.open;\n};\nreturn (\n <>\n {shortCode}\n \n);`,\n },\n ],\n },\n },\n];\n\nexport const GroupsPopover = () => {\n const popoverEl = useRef(null);\n const handleClick = () => {\n popoverEl.current.open = !popoverEl.current.open;\n };\n return (\n <>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n );\n};\n\n\n \n\n", "path": "/components/popover-menu/code", - "date": "2023-07-31", + "date": "2024-05-02", "title": "Popover menu", "status": "BETA", "subTitle": "Use popover menus to place actions inside a menu that overlays other page content when opened.", @@ -2842,10 +2842,10 @@ ], "meta": { "relativePath": "components/popover-menu/code.mdx", - "createdAt": "2024-05-09T10:42:41.859Z", - "lastModified": "2024-05-09T10:42:41.859Z", - "size": 13771, - "formattedSize": "13.4 KB" + "createdAt": "2024-05-21T09:12:11.375Z", + "lastModified": "2024-05-21T09:12:11.375Z", + "size": 14820, + "formattedSize": "14.5 KB" } }, { @@ -2874,8 +2874,8 @@ ], "meta": { "relativePath": "components/popover-menu/guidance.mdx", - "createdAt": "2024-02-14T15:20:53.000Z", - "lastModified": "2024-02-14T15:20:53.000Z", + "createdAt": "2024-05-13T07:27:37.372Z", + "lastModified": "2024-05-13T07:27:37.372Z", "size": 11284, "formattedSize": "11.0 KB" } @@ -2913,9 +2913,9 @@ }, { "id": "components__radio__codex", - "contents": "\nimport { IcRadioGroup, IcRadioOption, IcTextField } from \"@ukic/react\";\n\n## Component demo\n\nexport const snippets = [\n {\n language: \"Web component\",\n snippet: `\n \n \n \n \n \n\n`,\n },\n {\n language: \"React\",\n snippet: ` console.log(ev.detail.value)}>\n \n \n \n \n`,\n },\n];\n\n\n console.log(ev.detail.value)}\n >\n \n \n \n \n \n\n\n## Radio group details\n\n\n\n## Radio option details\n\n\n\n## Variants\n\n### Conditional\n\nexport const conditional = [\n {\n language: \"Web component\",\n snippet: `\n \n \n \n \n \n`,\n },\n {\n language: \"React\",\n snippet: `\n \n \n \n \n`,\n },\n];\n\n\n \n \n \n \n \n \n\n\n### Conditional dynamic\n\nexport const conditionalDynamic = [\n {\n language: \"Web component\",\n snippet: `\n \n \n \n \n \n`,\n },\n {\n language: \"React\",\n snippet: `\n \n \n \n \n`,\n },\n];\n\n\n
\n \n \n \n \n \n \n
\n
\n\n### With helper text\n\nexport const withHelperText = [\n {\n language: \"Web component\",\n snippet: `\n \n \n`,\n },\n {\n language: \"React\",\n snippet: `\n \n \n`,\n },\n];\n\n\n \n \n \n \n\n\n### Size small\n\nexport const smallSnippet = [\n {\n language: \"Web component\",\n snippet: `\n \n \n`,\n },\n {\n language: \"React\",\n snippet: `\n \n \n`,\n },\n];\n\n\n \n \n \n \n\n\n### With validation\n\nexport const withValidation = [\n {\n language: \"Web component\",\n snippet: `\n \n \n`,\n },\n {\n language: \"React\",\n snippet: `\n \n \n`,\n },\n];\n\n\n \n \n \n \n\n", + "contents": "\nimport { IcRadioGroup, IcRadioOption, IcTextField } from \"@ukic/react\";\n\n## Component demo\n\nexport const snippets = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n \n \n \n`,\n long: `{shortCode} \n`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ` console.log(ev.detail.value)}>\n \n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n console.log(ev.detail.value)}\n >\n \n \n \n \n \n\n\n## Radio group details\n\n\n\n## Radio option details\n\n\n\n## Variants\n\n### Conditional\n\nexport const conditional = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n \n \n \n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ` console.log(ev.detail.value)}\n>\n \n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n \n \n\n\n### Conditional dynamic\n\nexport const conditionalDynamic = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n \n \n \n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n
\n \n \n \n \n \n \n
\n
\n\n### With helper text\n\nexport const withHelperText = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n\n\n### Size small\n\nexport const smallSnippet = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n\n\n### With validation\n\nexport const withValidation = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n\n", "path": "/components/radio/code", - "date": "2024-01-18", + "date": "2024-05-02", "title": "Radio button", "status": "BETA", "subTitle": "Radio buttons let people select a single option from a list.", @@ -2936,10 +2936,10 @@ ], "meta": { "relativePath": "components/radio/code.mdx", - "createdAt": "2024-05-09T10:42:41.867Z", - "lastModified": "2024-05-09T10:42:41.867Z", - "size": 9346, - "formattedSize": "9.1 KB" + "createdAt": "2024-05-21T09:12:11.375Z", + "lastModified": "2024-05-21T09:12:11.375Z", + "size": 11057, + "formattedSize": "10.8 KB" } }, { @@ -2968,8 +2968,8 @@ ], "meta": { "relativePath": "components/radio/guidance.mdx", - "createdAt": "2024-02-14T15:16:06.086Z", - "lastModified": "2024-02-14T15:16:06.086Z", + "createdAt": "2024-05-13T07:27:37.372Z", + "lastModified": "2024-05-13T07:27:37.372Z", "size": 8265, "formattedSize": "8.1 KB" } @@ -3007,9 +3007,9 @@ }, { "id": "components__search-bar__codex", - "contents": "\nimport { IcSearchBar, IcTypography } from \"@ukic/react\";\n\n## Component demo\n\nexport const snippets = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: ` console.log(ev.detail.value)}\n onIcSubmitSearch={(ev) => console.log(ev.detail.value)}\n placeholder=\"Start typing to search…\"\n/>`,\n },\n];\n\n\n console.log(\"onIcChange\", ev.detail.value)}\n onIcSubmitSearch={(ev) => console.log(\"onIcSubmitSearch\", ev.detail.value)}\n placeholder=\"Start typing to search…\"\n />\n\n\n## Search bar details\n\n\n\n## Variants\n\n### With options (no filtering)\n\nexport const optionsNoFiltering = [\n {\n language: \"Web component\",\n snippet: `\n\n
\n\n All options will be displayed as you type\n\n`,\n },\n {\n language: \"React\",\n snippet: `\n
\nAll options will be displayed as you type`,\n },\n];\n\n\n \n
\n \n All options will be displayed as you type\n \n\n\n### With helper text\n\nexport const withHelperText = [\n {\n language: \"Web component\",\n snippet: `\n\n`,\n },\n {\n language: \"React\",\n snippet: ``,\n },\n];\n\n\n \n\n\n### With hidden label\n\nexport const withHiddenLabel = [\n {\n language: \"Web component\",\n snippet: `\n\n`,\n },\n {\n language: \"React\",\n snippet: ``,\n },\n];\n\n\n \n\n\n### Disabled\n\nexport const disabled = [\n {\n language: \"Web component\",\n snippet: `\n\n`,\n },\n {\n language: \"React\",\n snippet: ``,\n },\n];\n\n\n \n\n\n### Size small\n\nexport const sizeSmall = [\n {\n language: \"Web component\",\n snippet: `\n\n`,\n },\n {\n language: \"React\",\n snippet: ``,\n },\n];\n\n\n \n\n\n## Custom filtering example\n\nThis example shows how to filter data asynchronously when the value in the input field changes. The data is mocked and displayed after a one second delay, but could be replaced with a call to an API or database.\n\nexport const customFiltering = [\n {\n language: \"Web component\",\n snippet: `\n\n`,\n },\n {\n language: \"React\",\n snippet: `const mockData = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\" },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappucino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n];\nconst [results, setResults] = useState([]);\nconst changeHandler = (event) =>{\n const searchFor = event.detail.value;\n if (searchFor.length > 1) {\n const mockAPI = (query) => {\n const filteredResults = mockData.filter((item) =>\n item.label.toLowerCase().includes(query.toLowerCase())\n );\n return new Promise((resolve) => {\n setTimeout(() => resolve(filteredResults), 1000);\n });\n };\n mockAPI(searchFor).then((newResults) => setResults(newResults));\n } else {\n setResults([]);\n }\n}\nreturn(\n<>\n \n\n);`,\n },\n];\n\nexport const CustomFilterExample = () => {\n const mockData = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\" },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappucino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n ];\n const [results, setResults] = React.useState([]);\n const changeHandler = (event) => {\n const searchFor = event.detail.value;\n if (searchFor.length > 1) {\n const mockAPI = (query) => {\n const filteredResults = mockData.filter((item) =>\n item.label.toLowerCase().includes(query.toLowerCase())\n );\n return new Promise((resolve) => {\n setTimeout(() => resolve(filteredResults), 1000);\n });\n };\n mockAPI(searchFor).then((newResults) => setResults(newResults));\n } else {\n setResults([]);\n }\n };\n return (\n \n );\n};\n\n\n \n\n", + "contents": "\nimport { IcSearchBar, IcTypography } from \"@ukic/react\";\n\n## Component demo\n\nexport const snippets = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `{shortCode}\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ` console.log(ev.detail.value)}\n onIcSubmitSearch={(ev) => console.log(ev.detail.value)}\n placeholder=\"Start typing to search…\"\n/>`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const options = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\" },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappuccino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n ]\n \n return (\n {shortCode}\n )`,\n },\n {\n language: \"Javascript\",\n snippet: `const options = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\" },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappuccino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n ]\n \n return (\n {shortCode}\n )`,\n },\n ],\n },\n },\n];\n\n\n console.log(\"onIcChange\", ev.detail.value)}\n onIcSubmitSearch={(ev) => console.log(\"onIcSubmitSearch\", ev.detail.value)}\n placeholder=\"Start typing to search…\"\n />\n\n\n## Search bar details\n\n\n\n## Variants\n\n### With options (no filtering)\n\nexport const optionsNoFiltering = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n\n
\n\n All options will be displayed as you type\n`,\n long: `{shortCode}\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n
\nAll options will be displayed as you type`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const options = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\" },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappuccino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n ]\n \n return (\n <>\n {shortCode}\n \n )`,\n },\n {\n language: \"Javascript\",\n snippet: `const options = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\" },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappuccino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n ]\n \n return (\n <>\n {shortCode}\n \n )`,\n },\n ],\n },\n },\n];\n\n\n \n
\n \n All options will be displayed as you type\n \n\n\n### With helper text\n\nexport const withHelperText = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n`,\n long: `{shortCode}\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ``,\n long: [\n {\n language: \"Typescript\",\n snippet: `const options = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\" },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappuccino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n ]\n \n return (\n {shortCode}\n )`,\n },\n {\n language: \"Javascript\",\n snippet: `const options = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\" },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappuccino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n ]\n \n return (\n {shortCode}\n )`,\n },\n ],\n },\n },\n];\n\n\n \n\n\n### With hidden label\n\nexport const withHiddenLabel = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n`,\n long: `{shortCode}\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ``,\n long: [\n {\n language: \"Typescript\",\n snippet: `const options = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\" },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappuccino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n ]\n \n return (\n {shortCode}\n )`,\n },\n {\n language: \"Javascript\",\n snippet: `const options = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\" },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappuccino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n ]\n \n return (\n {shortCode}\n )`,\n },\n ],\n },\n },\n];\n\n\n \n\n\n### Disabled\n\nexport const disabled = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n`,\n long: `{shortCode}\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ``,\n long: [\n {\n language: \"Typescript\",\n snippet: `const options = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\" },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappuccino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n ]\n \n return (\n {shortCode}\n )`,\n },\n {\n language: \"Javascript\",\n snippet: `const options = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\" },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappuccino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n ]\n \n return (\n {shortCode}\n )`,\n },\n ],\n },\n },\n];\n\n\n \n\n\n### Size small\n\nexport const sizeSmall = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n`,\n long: `{shortCode}\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ``,\n long: [\n {\n language: \"Typescript\",\n snippet: `const options = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\" },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappuccino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n ]\n \n return (\n {shortCode}\n )`,\n },\n {\n language: \"Javascript\",\n snippet: `const options = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\" },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappuccino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n ]\n \n return (\n {shortCode}\n )`,\n },\n ],\n },\n },\n];\n\n\n \n\n\n## Custom filtering example\n\nThis example shows how to filter data asynchronously when the value in the input field changes. The data is mocked and displayed after a one second delay, but could be replaced with a call to an API or database.\n\nexport const customFiltering = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n`,\n long: `{shortCode}\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ``,\n long: [\n {\n language: \"Typescript\",\n snippet: `const mockData = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\" },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappucino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n];\nconst [results, setResults] = useState([]);\nconst changeHandler = (event) =>{\n const searchFor = event.detail.value;\n if (searchFor.length > 1) {\n const mockAPI = (query) => {\n const filteredResults = mockData.filter((item) =>\n item.label.toLowerCase().includes(query.toLowerCase())\n );\n return new Promise((resolve) => {\n setTimeout(() => resolve(filteredResults), 1000);\n });\n };\n mockAPI(searchFor).then((newResults) => setResults(newResults));\n } else {\n setResults([]);\n }\n}\nreturn(\n {shortCode}\n);`,\n },\n {\n language: \"Javascript\",\n snippet: `const mockData = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\" },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappucino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n];\nconst [results, setResults] = useState([]);\nconst changeHandler = (event) =>{\n const searchFor = event.detail.value;\n if (searchFor.length > 1) {\n const mockAPI = (query) => {\n const filteredResults = mockData.filter((item) =>\n item.label.toLowerCase().includes(query.toLowerCase())\n );\n return new Promise((resolve) => {\n setTimeout(() => resolve(filteredResults), 1000);\n });\n };\n mockAPI(searchFor).then((newResults) => setResults(newResults));\n } else {\n setResults([]);\n }\n}\nreturn(\n {shortCode}\n);`,\n },\n ],\n },\n },\n];\n\nexport const CustomFilterExample = () => {\n const mockData = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\" },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappucino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n ];\n const [results, setResults] = React.useState([]);\n const changeHandler = (event) => {\n const searchFor = event.detail.value;\n if (searchFor.length > 1) {\n const mockAPI = (query) => {\n const filteredResults = mockData.filter((item) =>\n item.label.toLowerCase().includes(query.toLowerCase())\n );\n return new Promise((resolve) => {\n setTimeout(() => resolve(filteredResults), 1000);\n });\n };\n mockAPI(searchFor).then((newResults) => setResults(newResults));\n } else {\n setResults([]);\n }\n };\n return (\n \n );\n};\n\n\n \n\n", "path": "/components/search-bar/code", - "date": "2024-02-02", + "date": "2024-05-02", "title": "Search bar", "status": "BETA", "subTitle": "The search bar allows users to search for information using keywords or phrases.", @@ -3030,10 +3030,10 @@ ], "meta": { "relativePath": "components/search-bar/code.mdx", - "createdAt": "2024-05-09T10:42:41.867Z", - "lastModified": "2024-05-09T10:42:41.867Z", - "size": 14707, - "formattedSize": "14.4 KB" + "createdAt": "2024-05-21T09:12:11.375Z", + "lastModified": "2024-05-21T09:12:11.375Z", + "size": 20198, + "formattedSize": "19.7 KB" } }, { @@ -3062,8 +3062,8 @@ ], "meta": { "relativePath": "components/search-bar/guidance.mdx", - "createdAt": "2024-02-14T15:16:06.086Z", - "lastModified": "2024-02-14T15:16:06.086Z", + "createdAt": "2024-05-13T07:27:37.376Z", + "lastModified": "2024-05-13T07:27:37.376Z", "size": 5837, "formattedSize": "5.7 KB" } @@ -3101,9 +3101,9 @@ }, { "id": "components__section-container__codex", - "contents": "\nimport { IcChip, IcSectionContainer } from \"@ukic/react\";\n\n## Component demo\n\nexport const snippetsDefault = [\n {\n language: \"Web component\",\n snippet: `\n
\n \n \n \n
\n
`,\n },\n {\n language: \"React\",\n snippet: `\n
\n \n \n \n
\n
`,\n },\n];\n\n\n \n \n \n \n \n
\n \n\n\n## Section container details\n\n\n\n## Variants\n\n### Center align\n\nexport const snippetsCenter = [\n {\n language: \"Web component\",\n snippet: `\n
\n \n \n \n
\n`,\n },\n {\n language: \"React\",\n snippet: `\n
\n \n \n \n
\n`,\n },\n];\n\n\n \n \n \n \n \n
\n \n
\n\n### Full-width align\n\nexport const snippetsFullWidth = [\n {\n language: \"Web component\",\n snippet: `\n
\n \n \n \n
\n`,\n },\n {\n language: \"React\",\n snippet: `\n
\n \n \n \n
\n
`,\n },\n];\n\n\n \n \n \n \n \n \n \n\n\n### Full height\n\nexport const snippetsFullHeight = [\n {\n language: \"Web component\",\n snippet: `\n
\n \n \n \n
\n`,\n },\n {\n language: \"React\",\n snippet: `\n
\n \n \n \n
\n
`,\n },\n];\n\n\n \n \n \n \n \n \n \n\n", + "contents": "\nimport { IcChip, IcSectionContainer } from \"@ukic/react\";\n\n## Component demo\n\nexport const snippetsDefault = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n
\n \n \n \n
\n
`,\n long: `ic-section-container {\n border: 1px solid black;\n }\n .container {\n display: flex;\n justify-content: space-between;\n padding: 8px;\n }\n \n \n {shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n
\n \n \n \n
\n
`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n \n \n \n\n\n## Section container details\n\n\n\n## Variants\n\n### Center align\n\nexport const snippetsCenter = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n
\n \n \n \n
\n
`,\n long: `ic-section-container {\n border: 1px solid black;\n width: 60%;\n }\n .container {\n display: flex;\n justify-content: space-between;\n padding: 8px;\n }\n \n \n {shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n
\n \n \n \n
\n
`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n \n \n \n\n\n### Full-width align\n\nexport const snippetsFullWidth = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n
\n \n \n \n
\n
`,\n long: `ic-section-container {\n border: 1px solid black;\n width: 60%;\n }\n .container {\n display: flex;\n justify-content: space-between;\n padding: 8px;\n }\n \n \n {shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n
\n \n \n \n
\n
`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n \n \n \n\n\n### Full height\n\nexport const snippetsFullHeight = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n
\n \n \n \n
\n
`,\n long: `ic-section-container {\n border: 1px solid black;\n width: 60%;\n }\n .container {\n display: flex;\n justify-content: space-between;\n padding: 8px;\n }\n \n \n {shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n
\n \n \n \n
\n
`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n \n \n \n\n", "path": "/components/section-container/code", - "date": "2024-02-02", + "date": "2024-05-02", "title": "Section container", "status": "BETA", "subTitle": "Use the section container component to consistently align content within an app.", @@ -3124,10 +3124,10 @@ ], "meta": { "relativePath": "components/section-container/code.mdx", - "createdAt": "2024-05-09T10:42:41.871Z", - "lastModified": "2024-05-09T10:42:41.871Z", - "size": 5598, - "formattedSize": "5.5 KB" + "createdAt": "2024-05-21T09:12:11.375Z", + "lastModified": "2024-05-21T09:12:11.375Z", + "size": 7144, + "formattedSize": "7.0 KB" } }, { @@ -3156,8 +3156,8 @@ ], "meta": { "relativePath": "components/section-container/guidance.mdx", - "createdAt": "2024-02-14T15:16:06.090Z", - "lastModified": "2024-02-14T15:16:06.090Z", + "createdAt": "2024-05-13T07:27:37.380Z", + "lastModified": "2024-05-13T07:27:37.380Z", "size": 5569, "formattedSize": "5.4 KB" } @@ -3195,9 +3195,9 @@ }, { "id": "components__select__codex", - "contents": "\nimport { IcSelect } from \"@ukic/react\";\n\n## Component demo\n\nexport const snippets = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: ` console.log(event.detail.value)}\n/>`,\n },\n];\n\nexport const SelectExample = () => (\n console.log(event.detail.value)}\n />\n);\n\n\n \n\n\n## Select details\n\n\n\n## Variants\n\n### With clear button, descriptions, helper text and custom placeholder\n\nexport const snippetsWithExtras = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: ` console.log(event.detail.value)}\n/>`,\n },\n];\n\nexport const SelectExampleWithExtras = () => (\n console.log(event.detail.value)}\n />\n);\n\n\n \n\n\n### Disabled\n\nexport const snippetsDisabled = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: ` console.log(event.detail.value)}\n/>`,\n },\n];\n\nexport const SelectExampleDisabled = () => (\n console.log(event.detail.value)}\n />\n);\n\n\n \n\n\n### Options disabled\n\nexport const snippetsOptionDisabled = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: ` console.log(event.detail.value)}\n/>`,\n },\n];\n\nexport const SelectExampleOptionsDisabled = () => (\n console.log(event.detail.value)}\n />\n);\n\n\n \n\n\n### Size small\n\nexport const snippetsSmall = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: ` console.log(event.detail.value)}\n size=\"small\"\n/>`,\n },\n];\n\nexport const SelectExampleSmall = () => (\n console.log(event.detail.value)}\n size=\"small\"\n />\n);\n\n\n \n\n\n### Hidden label\n\nexport const snippetsHideLabel = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: ` console.log(event.detail.value)}\n/>`,\n },\n];\n\nexport const SelectExampleHideLabel = () => (\n console.log(event.detail.value)}\n />\n);\n\n\n \n\n\n### Groups\n\nexport const snippetsGroups = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: ` console.log(event.detail.value)}\n/>`,\n },\n];\n\nexport const SelectExampleGroups = () => (\n console.log(event.detail.value)}\n />\n);\n\n\n \n\n\n### Recommended\n\nexport const snippetsRecommended = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: ` console.log(event.detail.value)}\n/>`,\n },\n];\n\nexport const SelectExampleRecommended = () => (\n console.log(event.detail.value)}\n />\n);\n\n\n \n\n\n### Validation\n\nexport const snippetsValidation = [\n {\n language: \"Web component\",\n snippet: `\n\n\n\n\n`,\n },\n {\n language: \"React\",\n snippet: ` console.log(event.detail.value)}\n/>\n console.log(event.detail.value)}\n/>\n console.log(event.detail.value)}\n/>`,\n },\n];\n\nexport const SelectExampleValidation = () => (\n
\n console.log(event.detail.value)}\n />\n console.log(event.detail.value)}\n />\n console.log(event.detail.value)}\n />\n
\n);\n\n\n \n\n\n### Searchable\n\nexport const snippetsSearchable = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: ` console.log(event.detail.value)}\n/>`,\n },\n];\n\nexport const SearchableSelectExample = () => (\n console.log(event.detail.value)}\n />\n);\n\n\n \n\n\n### Searchable - with descriptions included in search\n\nexport const snippetsSearchableWithDescriptions = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: ` console.log(event.detail.value)}\n/>`,\n },\n];\n\nexport const SearchableSelectWithDescriptionsExample = () => (\n console.log(event.detail.value)}\n />\n);\n\n\n \n\n\n### Searchable - with group titles included in search\n\nexport const snippetsSearchableWithGroups = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: ` console.log(event.detail.value)}\n/>`,\n },\n];\n\nexport const SearchableSelectWithGroupsExample = () => (\n console.log(event.detail.value)}\n />\n);\n\n\n \n\n\n## Custom filtering example\n\nThis example shows how to filter data asynchronously when the value in the select field changes. The data is mocked and displayed after a one second delay, but could be replaced with a call to an API or database.\n\nexport const customFiltering = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: `const mockData = [\n { label: \"Espresso\", value: \"Esp\" },\n { label: \"Double Espresso\", value: \"Dou\" },\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Latte\", value: \"Lat\" },\n { label: \"Americano\", value: \"Ame\" },\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Flat white\", value: \"Fla\" },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n];\nconst [results, setResults] = useState([]);\nconst [selectedValue, setSelectedValue] = useState(\"\");\nconst changeHandler = (event) => {\n const newValue = event.detail.value;\n console.log(newValue);\n if (newValue !== selectedValue) {\n if (newValue && newValue.length > 1) {\n const mockAPI = (query) => {\n const filteredResults = mockData.filter((item) => \n item.label.toLowerCase().includes(query.toLowerCase()));\n return new Promise(resolve => { \n setTimeout(() => resolve(filteredResults), 1000)\n });\n };\n mockAPI(newValue).then((results) => setResults(results));\n } else {\n setResults([]);\n }\n } \n}\nreturn(\n <>\n setSelectedValue(event.detail.value)}\n onIcClear={() => setResults([])}\n onIcChange={changeHandler}\n />\n \n);`,\n },\n];\n\nexport const CustomFilterExample = () => {\n const mockData = [\n { label: \"Espresso\", value: \"Esp\" },\n { label: \"Double Espresso\", value: \"Dou\" },\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Latte\", value: \"Lat\" },\n { label: \"Americano\", value: \"Ame\" },\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Flat white\", value: \"Fla\" },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n ];\n const [results, setResults] = React.useState([]);\n const [selectedValue, setSelectedValue] = React.useState(\"\");\n const changeHandler = (event) => {\n const newValue = event.detail.value;\n console.log(newValue);\n if (newValue !== selectedValue) {\n if (newValue && newValue.length > 1) {\n const mockAPI = (query) => {\n const filteredResults = mockData.filter((item) =>\n item.label.toLowerCase().includes(query.toLowerCase())\n );\n return new Promise((resolve) => {\n setTimeout(() => resolve(filteredResults), 1000);\n });\n };\n mockAPI(newValue).then((newResults) => setResults(newResults));\n } else {\n setResults([]);\n }\n }\n };\n return (\n setSelectedValue(event.detail.value)}\n onIcClear={() => setResults([])}\n onIcChange={changeHandler}\n />\n );\n};\n\n\n \n\n", + "contents": "\nimport { IcSelect } from \"@ukic/react\";\n\n## Component demo\n\nexport const snippets = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `{shortCode}\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ` console.log(event.detail.value)}\n/>`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const options = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\" },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappuccino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n ];\n return (\n {shortCode}\n )`,\n },\n {\n language: \"Javascript\",\n snippet: `const options = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\" },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappuccino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n ];\n return (\n {shortCode}\n )`,\n },\n ],\n },\n },\n];\n\nexport const SelectExample = () => (\n console.log(event.detail.value)}\n />\n);\n\n\n \n\n\n## Select details\n\n\n\n## Variants\n\n### With clear button, descriptions, helper text and custom placeholder\n\nexport const snippetsWithExtras = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `{shortCode}\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ` console.log(event.detail.value)}\n/>`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const options = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\" },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappuccino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n ];\n return (\n {shortCode}\n )`,\n },\n {\n language: \"Javascript\",\n snippet: `const options = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\" },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappuccino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n ];\n return (\n {shortCode}\n )`,\n },\n ],\n },\n },\n];\n\nexport const SelectExampleWithExtras = () => (\n console.log(event.detail.value)}\n />\n);\n\n\n \n\n\n### Disabled\n\nexport const snippetsDisabled = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `{shortCode}\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ` console.log(event.detail.value)}\n/>`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const options = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\" },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappuccino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n ];\n return (\n {shortCode}\n )`,\n },\n {\n language: \"Javascript\",\n snippet: `const options = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\" },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappuccino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n ];\n return (\n {shortCode}\n )`,\n },\n ],\n },\n },\n];\n\nexport const SelectExampleDisabled = () => (\n console.log(event.detail.value)}\n />\n);\n\n\n \n\n\n### Options disabled\n\nexport const snippetsOptionDisabled = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `{shortCode}\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ` console.log(event.detail.value)}\n/>`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const options = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\", disabled: true },\n { label: \"Flat White\", value: \"flatwhite\", disabled: true },\n { label: \"Cappuccino\", value: \"cappuccino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n ];\n return (\n {shortCode}\n )`,\n },\n {\n language: \"Javascript\",\n snippet: `const options = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\", disabled: true },\n { label: \"Flat White\", value: \"flatwhite\", disabled: true },\n { label: \"Cappuccino\", value: \"cappuccino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n ];\n return (\n {shortCode}\n )`,\n },\n ],\n },\n },\n];\n\nexport const SelectExampleOptionsDisabled = () => (\n console.log(event.detail.value)}\n />\n);\n\n\n \n\n\n### Size small\n\nexport const snippetsSmall = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `{shortCode}\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ` console.log(event.detail.value)}\n size=\"small\"\n/>`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const options = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\" },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappuccino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n ];\n return (\n {shortCode}\n )`,\n },\n {\n language: \"Javascript\",\n snippet: `const options = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\" },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappuccino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n ];\n return (\n {shortCode}\n )`,\n },\n ],\n },\n },\n];\n\nexport const SelectExampleSmall = () => (\n console.log(event.detail.value)}\n size=\"small\"\n />\n);\n\n\n \n\n\n### Hidden label\n\nexport const snippetsHideLabel = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `{shortCode}\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ` console.log(event.detail.value)}\n/>`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const options = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\" },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappuccino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n ];\n return (\n {shortCode}\n )`,\n },\n {\n language: \"Javascript\",\n snippet: `const options = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\" },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappuccino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n ];\n return (\n {shortCode}\n )`,\n },\n ],\n },\n },\n];\n\nexport const SelectExampleHideLabel = () => (\n console.log(event.detail.value)}\n />\n);\n\n\n \n\n\n### Groups\n\nexport const snippetsGroups = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `{shortCode}\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ` console.log(event.detail.value)}\n/>`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const options = [\n {\n label: \"Fancy\",\n children: [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Flat white\", value: \"Flat\" },\n ],\n },\n {\n label: \"Boring\",\n children: [\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Latte\", value: \"Lat\" },\n ],\n },\n ];\n return (\n {shortCode}\n )`,\n },\n {\n language: \"Javascript\",\n snippet: `const options = [\n {\n label: \"Fancy\",\n children: [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Flat white\", value: \"Flat\" },\n ],\n },\n {\n label: \"Boring\",\n children: [\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Latte\", value: \"Lat\" },\n ],\n },\n ];\n return (\n {shortCode}\n )`,\n },\n ],\n },\n },\n];\n\nexport const SelectExampleGroups = () => (\n console.log(event.detail.value)}\n />\n);\n\n\n \n\n\n### Recommended\n\nexport const snippetsRecommended = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `{shortCode}\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ` console.log(event.detail.value)}\n/>`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const options = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\", recommended: true },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappuccino\" },\n { label: \"Americano\", value: \"americano\", recommended: true },\n { label: \"Mocha\", value: \"mocha\" },\n ];\n return (\n {shortCode}\n )`,\n },\n {\n language: \"Javascript\",\n snippet: `const options = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\", recommended: true },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappuccino\" },\n { label: \"Americano\", value: \"americano\", recommended: true },\n { label: \"Mocha\", value: \"mocha\" },\n ];\n return (\n {shortCode}\n )`,\n },\n ],\n },\n },\n];\n\nexport const SelectExampleRecommended = () => (\n console.log(event.detail.value)}\n />\n);\n\n\n \n\n\n### Validation\n\nexport const snippetsValidation = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n\n`,\n long: `{shortCode}\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ` console.log(event.detail.value)}\n/>\n console.log(event.detail.value)}\n/>\n console.log(event.detail.value)}\n/>`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const options = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\" },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappuccino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n ];\n return (\n <>\n {shortCode}\n \n )`,\n },\n {\n language: \"Javascript\",\n snippet: `const options = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\" },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappuccino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n ];\n return (\n <>\n {shortCode}\n \n )`,\n },\n ],\n },\n },\n];\n\nexport const SelectExampleValidation = () => (\n
\n console.log(event.detail.value)}\n />\n console.log(event.detail.value)}\n />\n console.log(event.detail.value)}\n />\n
\n);\n\n\n \n\n\n### Searchable\n\nexport const snippetsSearchable = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `{shortCode}\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ` console.log(event.detail.value)}\n/>`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const options = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\" },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappuccino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n ];\n return (\n {shortCode}\n )`,\n },\n {\n language: \"Javascript\",\n snippet: `const options = [\n { label: \"Espresso\", value: \"espresso\" },\n { label: \"Double Espresso\", value: \"doubleespresso\" },\n { label: \"Flat White\", value: \"flatwhite\" },\n { label: \"Cappuccino\", value: \"cappuccino\" },\n { label: \"Americano\", value: \"americano\" },\n { label: \"Mocha\", value: \"mocha\" },\n ];\n return (\n {shortCode}\n )`,\n },\n ],\n },\n },\n];\n\nexport const SearchableSelectExample = () => (\n console.log(event.detail.value)}\n />\n);\n\n\n \n\n\n### Searchable - with descriptions included in search\n\nexport const snippetsSearchableWithDescriptions = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `{shortCode}\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ` console.log(event.detail.value)}\n/>`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const options = [\n { label: \"Cappuccino\", value: \"Cap\", description: \"Coffee frothed up with pressurised steam\" },\n { label: \"Americano\", value: \"Ame\", description: \"Espresso coffee diluted with hot water\" },\n { label: \"Mocha\", value: \"Moc\", description: \"Coffee with chocolate\" },\n { label: \"Latte\", value: \"Lat\", description: \"Milky coffee with one or two shots of espresso\" },\n { label: \"Flat white\", value: \"Fla\", description: \"Coffee with frothed milk poured over espresso\" },\n { label: \"Macchiato\", value: \"Mac\", description: \"Espresso coffee topped with steamed milk\" },\n { label: \"Café au lait\", value: \"Caf\", description: \"Brewed coffee with steamed milk\" },\n { label: \"Espresso\", value: \"Esp\", description: \"Concentrated form of coffee\" },\n { label: \"Cortado\", value: \"Cor\", description: \"Coffee cut with milk\" },\n { label: \"Latte macchiato\", value: \"Lam\", description: \"Espresso coffee with milk and a spoonful of foamed milk\" },\n ];\n return (\n {shortCode}\n )`,\n },\n {\n language: \"Javascript\",\n snippet: `const options = [\n { label: \"Cappuccino\", value: \"Cap\", description: \"Coffee frothed up with pressurised steam\" },\n { label: \"Americano\", value: \"Ame\", description: \"Espresso coffee diluted with hot water\" },\n { label: \"Mocha\", value: \"Moc\", description: \"Coffee with chocolate\" },\n { label: \"Latte\", value: \"Lat\", description: \"Milky coffee with one or two shots of espresso\" },\n { label: \"Flat white\", value: \"Fla\", description: \"Coffee with frothed milk poured over espresso\" },\n { label: \"Macchiato\", value: \"Mac\", description: \"Espresso coffee topped with steamed milk\" },\n { label: \"Café au lait\", value: \"Caf\", description: \"Brewed coffee with steamed milk\" },\n { label: \"Espresso\", value: \"Esp\", description: \"Concentrated form of coffee\" },\n { label: \"Cortado\", value: \"Cor\", description: \"Coffee cut with milk\" },\n { label: \"Latte macchiato\", value: \"Lam\", description: \"Espresso coffee with milk and a spoonful of foamed milk\" },\n ];\n return (\n {shortCode}\n )`,\n },\n ],\n },\n },\n];\n\nexport const SearchableSelectWithDescriptionsExample = () => (\n console.log(event.detail.value)}\n />\n);\n\n\n \n\n\n### Searchable - with group titles included in search\n\nexport const snippetsSearchableWithGroups = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `{shortCode}\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ` console.log(event.detail.value)}\n/>`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const options = [\n {\n label: \"Fancy\",\n children: [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Flat white\", value: \"Flat\" },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n { label: \"Cortado\", value: \"Cor\" },\n { label: \"Latte macchiato\", value: \"Lam\" },\n ],\n },\n {\n label: \"Boring\",\n children: [\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Latte\", value: \"Lat\" },\n { label: \"Americano\", value: \"Ame\" },\n { label: \"Espresso\", value: \"Esp\" },\n ],\n },\n ];\n return (\n {shortCode}\n )`,\n },\n {\n language: \"Javascript\",\n snippet: `const options = [\n {\n label: \"Fancy\",\n children: [\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Flat white\", value: \"Flat\" },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n { label: \"Cortado\", value: \"Cor\" },\n { label: \"Latte macchiato\", value: \"Lam\" },\n ],\n },\n {\n label: \"Boring\",\n children: [\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Latte\", value: \"Lat\" },\n { label: \"Americano\", value: \"Ame\" },\n { label: \"Espresso\", value: \"Esp\" },\n ],\n },\n ];\n return (\n {shortCode}\n )`,\n },\n ],\n },\n },\n];\n\nexport const SearchableSelectWithGroupsExample = () => (\n console.log(event.detail.value)}\n />\n);\n\n\n \n\n\n## Custom filtering example\n\nThis example shows how to filter data asynchronously when the value in the select field changes. The data is mocked and displayed after a one second delay, but could be replaced with a call to an API or database.\n\nexport const customFiltering = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `{shortCode}\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ` setSelectedValue(event.detail.value)}\n onIcClear={() => setResults([])}\n onIcChange={changeHandler}\n/>`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const mockData = [\n { label: \"Espresso\", value: \"Esp\" },\n { label: \"Double Espresso\", value: \"Dou\" },\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Latte\", value: \"Lat\" },\n { label: \"Americano\", value: \"Ame\" },\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Flat white\", value: \"Fla\" },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n];\nconst [results, setResults] = useState([]);\nconst [selectedValue, setSelectedValue] = useState(\"\");\nconst changeHandler = (event) => {\n const newValue = event.detail.value;\n console.log(newValue);\n if (newValue !== selectedValue) {\n if (newValue && newValue.length > 1) {\n const mockAPI = (query) => {\n const filteredResults = mockData.filter((item) => \n item.label.toLowerCase().includes(query.toLowerCase()));\n return new Promise(resolve => { \n setTimeout(() => resolve(filteredResults), 1000)\n });\n };\n mockAPI(newValue).then((results) => setResults(results));\n } else {\n setResults([]);\n }\n } \n}\nreturn(\n <>\n {shortCode}\n \n);`,\n },\n {\n language: \"Javascript\",\n snippet: `const mockData = [\n { label: \"Espresso\", value: \"Esp\" },\n { label: \"Double Espresso\", value: \"Dou\" },\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Latte\", value: \"Lat\" },\n { label: \"Americano\", value: \"Ame\" },\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Flat white\", value: \"Fla\" },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n];\nconst [results, setResults] = useState([]);\nconst [selectedValue, setSelectedValue] = useState(\"\");\nconst changeHandler = (event) => {\n const newValue = event.detail.value;\n console.log(newValue);\n if (newValue !== selectedValue) {\n if (newValue && newValue.length > 1) {\n const mockAPI = (query) => {\n const filteredResults = mockData.filter((item) => \n item.label.toLowerCase().includes(query.toLowerCase()));\n return new Promise(resolve => { \n setTimeout(() => resolve(filteredResults), 1000)\n });\n };\n mockAPI(newValue).then((results) => setResults(results));\n } else {\n setResults([]);\n }\n } \n}\nreturn(\n <>\n {shortCode}\n \n);`,\n },\n ],\n },\n },\n];\n\nexport const CustomFilterExample = () => {\n const mockData = [\n { label: \"Espresso\", value: \"Esp\" },\n { label: \"Double Espresso\", value: \"Dou\" },\n { label: \"Cappuccino\", value: \"Cap\" },\n { label: \"Latte\", value: \"Lat\" },\n { label: \"Americano\", value: \"Ame\" },\n { label: \"Filter\", value: \"Fil\" },\n { label: \"Flat white\", value: \"Fla\" },\n { label: \"Mocha\", value: \"Moc\" },\n { label: \"Macchiato\", value: \"Mac\" },\n ];\n const [results, setResults] = React.useState([]);\n const [selectedValue, setSelectedValue] = React.useState(\"\");\n const changeHandler = (event) => {\n const newValue = event.detail.value;\n console.log(newValue);\n if (newValue !== selectedValue) {\n if (newValue && newValue.length > 1) {\n const mockAPI = (query) => {\n const filteredResults = mockData.filter((item) =>\n item.label.toLowerCase().includes(query.toLowerCase())\n );\n return new Promise((resolve) => {\n setTimeout(() => resolve(filteredResults), 1000);\n });\n };\n mockAPI(newValue).then((newResults) => setResults(newResults));\n } else {\n setResults([]);\n }\n }\n };\n return (\n setSelectedValue(event.detail.value)}\n onIcClear={() => setResults([])}\n onIcChange={changeHandler}\n />\n );\n};\n\n\n \n\n", "path": "/components/select/code", - "date": "2024-02-02", + "date": "2024-05-02", "title": "Select", "status": "BETA", "subTitle": "Select allows users to select one or more values from a list of options.", @@ -3218,15 +3218,15 @@ ], "meta": { "relativePath": "components/select/code.mdx", - "createdAt": "2024-05-09T10:42:41.879Z", - "lastModified": "2024-05-09T10:42:41.879Z", - "size": 35528, - "formattedSize": "34.7 KB" + "createdAt": "2024-05-21T09:12:11.379Z", + "lastModified": "2024-05-21T09:12:11.379Z", + "size": 46068, + "formattedSize": "45.0 KB" } }, { "id": "components__select__guidancex", - "contents": "\nimport { IcSelect, IcAlert } from \"@ukic/react\";\nimport selectFig1 from \"./images/fig-1-use-radio-or-checkbox-groups-when-less-than-four-options-are-available2x.png\";\nimport selectFig2 from \"./images/fig-2-dont-use-dropdowns-when-displaying-a-limited-number-of-options2x.png\";\nimport selectFig3 from \"./images/fig-3-use-labels-to-indicate-the-title-of-the-field.png\";\nimport selectFig4 from \"./images/fig-4-dont-replace-labels-with-placeholder-text.png\";\nimport selectFig5 from \"./images/fig-5-use-a-standard-select-when-providing-less-than-ten-options.png\";\nimport selectFig6 from \"./images/fig-6-do-not-use-the-searchable-variant-when-providing-less-than-ten-options.png\";\n\n## Component variants\n\nThere are two types of select components:\n\n- Single-select\n- Multi-select\n\n### Single-select\n\nAn example of the single-select component.\n\nexport const SelectExample = () => (\n \n);\n\n\n \n\n\n### Multi-select\n\n\n\n## When to use\n\nUse the select component to allow the user to choose one or more options from four or more items. For less than four, use a [radio group](/components/radio) or a [checkbox group](/components/checkbox).\nWhen more than ten options are available, consider using the [searchable variant](/components/select#searchable-single-select) of select to allow users to search the options, rather than scroll through the dropdown list.\n\n\n \n \n\n\n## Validation\n\nReal-time validation helps the user streamline their process and efficiently complete a form. All error validation should be accompanied by an error label.\n\n## Content\n\n### Option list\n\nThe options in the option list display a label by default and can also include a description.\n\nUse a default option list to display all options without any grouping or recommendations.\n\n#### Recommended\n\nUse an option list with recommendations to display specific options at the top of the list for quick access.\n\n#### Groups\n\nUse an option list with groups to combine the options into groups with descriptive headings.\n\n### Labels\n\nClear labels help users understand what information they should provide.\n\nLabels should always be visible regardless of the state of the field and should be announced by a screen reader on focus.\n\n\n \n \n\n\n### Helper text\n\nHelper text should be included when additional information can help the user to either provide the right information or understand why or how the information will be used.\n\nMake sure any helper text that appears under an input is read when an assistive technology user stops at an input using ARIA.\n\n### Dismissible inputs\n\nAlways allow the user to clear their selection by including a clear button inside the input field.\n\n## Searchable (single-select)\n\nexport const SearchableSelectExample = () => (\n console.log(event.detail.value)}\n />\n);\n\n\n \n\n\nThe single-select component can be set to be searchable to filter options in the option list. A user can open the option list to view the available options, but can also type into the input field to filter the option list to more easily find the desired option.\n\nUse the searchable variant when including several options in the option list, so that the user can quickly filter their desired selection.\n\nDon’t use the searchable variant when providing less than ten options. The added functionality for short lists may confuse users while providing no benefit to their experience.\n\n\n \n \n\n\n### Content\n\nThe component can be configured to show values that either match the search term, or show values that contain the search term. For example, United Kingdom matches the search term ‘Un’, and Tunisia contains the search term ‘Un’.\n\nFor searches that take time to load results or suggestions, display the loading state whilst the search is loading. Use the empty state for searches that have no results or suggested options.\n\n## Related components\n\n- [Search bar](/components/search-bar)\n", + "contents": "\nimport { IcSelect } from \"@ukic/react\";\nimport selectFig1 from \"./images/fig-1-use-radio-or-checkbox-groups-when-less-than-four-options-are-available2x.png\";\nimport selectFig2 from \"./images/fig-2-dont-use-dropdowns-when-displaying-a-limited-number-of-options2x.png\";\nimport selectFig3 from \"./images/fig-3-use-labels-to-indicate-the-title-of-the-field.png\";\nimport selectFig4 from \"./images/fig-4-dont-replace-labels-with-placeholder-text.png\";\nimport selectFig5 from \"./images/fig-5-use-a-standard-select-when-providing-less-than-ten-options.png\";\nimport selectFig6 from \"./images/fig-6-do-not-use-the-searchable-variant-when-providing-less-than-ten-options.png\";\n\n## Component variants\n\nThere are two types of select components:\n\n- Single-select\n- Multi-select\n\n### Single-select\n\nAn example of the single-select component.\n\nexport const SelectExample = () => (\n \n);\n\n\n \n\n\n### Multi-select\n\nThe multi-select is currently released in our canary packages, which means it is likely to change in future releases. Guidance and documentation can be found on the [multi-select page](/components/multi-select).\n\n## When to use\n\nUse the select component to allow the user to choose one or more options from four or more items. For less than four, use a [radio group](/components/radio) or a [checkbox group](/components/checkbox).\nWhen more than ten options are available, consider using the [searchable variant](/components/select#searchable-single-select) of select to allow users to search the options, rather than scroll through the dropdown list.\n\n\n \n \n\n\n## Validation\n\nReal-time validation helps the user streamline their process and efficiently complete a form. All error validation should be accompanied by an error label.\n\n## Content\n\n### Option list\n\nThe options in the option list display a label by default and can also include a description.\n\nUse a default option list to display all options without any grouping or recommendations.\n\n#### Recommended\n\nUse an option list with recommendations to display specific options at the top of the list for quick access.\n\n#### Groups\n\nUse an option list with groups to combine the options into groups with descriptive headings.\n\n### Labels\n\nClear labels help users understand what information they should provide.\n\nLabels should always be visible regardless of the state of the field and should be announced by a screen reader on focus.\n\n\n \n \n\n\n### Helper text\n\nHelper text should be included when additional information can help the user to either provide the right information or understand why or how the information will be used.\n\nMake sure any helper text that appears under an input is read when an assistive technology user stops at an input using ARIA.\n\n### Dismissible inputs\n\nAlways allow the user to clear their selection by including a clear button inside the input field.\n\n## Searchable (single-select)\n\nexport const SearchableSelectExample = () => (\n console.log(event.detail.value)}\n />\n);\n\n\n \n\n\nThe single-select component can be set to be searchable to filter options in the option list. A user can open the option list to view the available options, but can also type into the input field to filter the option list to more easily find the desired option.\n\nUse the searchable variant when including several options in the option list, so that the user can quickly filter their desired selection.\n\nDon’t use the searchable variant when providing less than ten options. The added functionality for short lists may confuse users while providing no benefit to their experience.\n\n\n \n \n\n\n### Content\n\nThe component can be configured to show values that either match the search term, or show values that contain the search term. For example, United Kingdom matches the search term ‘Un’, and Tunisia contains the search term ‘Un’.\n\nFor searches that take time to load results or suggestions, display the loading state whilst the search is loading. Use the empty state for searches that have no results or suggested options.\n\n## Related components\n\n- [Search bar](/components/search-bar)\n", "path": "/components/select", "navPriority": 28, "date": "2024-05-02", @@ -3250,10 +3250,10 @@ ], "meta": { "relativePath": "components/select/guidance.mdx", - "createdAt": "2024-05-08T15:13:48.202Z", - "lastModified": "2024-05-08T15:13:48.202Z", - "size": 7371, - "formattedSize": "7.2 KB" + "createdAt": "2024-05-13T07:27:37.380Z", + "lastModified": "2024-05-13T07:27:37.380Z", + "size": 7459, + "formattedSize": "7.3 KB" } }, { @@ -3289,9 +3289,9 @@ }, { "id": "components__side-nav__codex", - "contents": "\nimport {\n IcSideNavigation,\n IcNavigationItem,\n IcNavigationGroup,\n IcDivider,\n IcLink,\n SlottedSVG,\n IcBadge,\n} from \"@ukic/react\";\n\nimport {\n mdiHome,\n mdiCoffeeOutline,\n mdiMagnify,\n mdiCoffeeMakerOutline,\n mdiCogOutline,\n mdiTeaOutline,\n} from \"@mdi/js\";\n\nimport { MemoryRouter, NavLink } from \"react-router-dom\";\n\n## Component demo\n\nexport const snippetsDefault = [\n {\n language: \"Web component\",\n snippet: `\n \n coffee-outline\n \n \n \n \n home\n \n \n \n \n \n \n magnify\n \n \n \n \n \n coffee-outline\n \n \n \n \n \n coffee-maker-outline\n \n \n \n \n \n cog-outline\n \n \n \n`,\n },\n {\n language: \"React\",\n snippet: `\n \n coffee-outline\n \n \n \n \n home\n \n \n \n \n \n \n magnify\n \n \n \n \n \n coffee-outline\n \n \n \n \n \n coffee-maker-outline\n \n \n \n \n \n cog-outline\n \n \n \n`,\n },\n];\n\n\n \n \n coffee-outline\n \n \n \n \n home\n \n \n \n \n \n \n magnify\n \n \n \n \n \n coffee-outline\n \n \n \n \n \n coffee-maker-outline\n \n \n \n \n \n cog-outline\n \n \n \n \n
\n\n## Side navigation details\n\n\n\n## Navigation group details\n\n\n\n## Navigation item details\n\n\n\n## Variants\n\n### Static\n\nexport const snippetsStatic = [\n {\n language: \"Web component\",\n snippet: `\n \n coffee-outline\n \n \n \n \n home\n \n \n \n \n \n \n magnify\n \n \n \n \n \n coffee-outline\n \n \n \n \n \n coffee-maker-outline\n \n \n \n \n \n cog-outline\n \n \n \n`,\n },\n {\n language: \"React\",\n snippet: `\n \n coffee-outline\n \n \n \n \n home\n \n \n \n \n \n \n magnify\n \n \n \n \n \n coffee-outline\n \n \n \n \n \n coffee-maker-outline\n \n \n \n \n \n cog-outline\n \n \n \n`,\n },\n];\n\n\n \n \n coffee-outline\n \n \n \n \n home\n \n \n \n \n \n \n magnify\n \n \n \n \n \n coffee-outline\n \n \n \n \n \n coffee-maker-outline\n \n \n \n \n \n cog-outline\n \n \n \n \n
\n\n### Expanded on default\n\nexport const snippetsExpanded = [\n {\n language: \"Web component\",\n snippet: `\n \n coffee-outline\n \n \n \n \n home\n \n \n \n \n \n magnify\n \n \n \n \n \n coffee-outline\n \n \n \n \n \n coffee-maker-outline\n \n \n \n \n \n cog-outline\n \n \n \n`,\n },\n {\n language: \"React\",\n snippet: `\n \n coffee-outline\n \n \n \n \n home\n \n \n \n \n magnify\n \n \n \n \n \n coffee-outline\n \n \n \n \n \n coffee-maker-outline\n \n \n \n \n \n cog-outline\n \n \n \n`,\n },\n];\n\n\n \n \n coffee-outline\n \n \n \n \n home\n \n \n \n \n \n magnify\n \n \n \n \n \n coffee-outline\n \n \n \n \n \n coffee-maker-outline\n \n \n \n \n \n cog-outline\n \n \n \n \n
\n\n### Collapsed labels\n\nexport const snippetsCollapsed = [\n {\n language: \"Web component\",\n snippet: `\n \n coffee-outline\n \n \n \n \n home\n \n \n \n \n \n magnify\n \n \n \n \n \n coffee-outline\n \n \n \n \n \n coffee-maker-outline\n \n \n \n \n \n cog-outline\n \n \n \n`,\n },\n {\n language: \"React\",\n snippet: `\n \n coffee-outline\n \n \n \n \n home\n \n \n \n \n \n magnify\n \n \n \n \n \n coffee-outline\n \n \n \n \n \n coffee-maker-outline\n \n \n \n \n \n cog-outline\n \n \n \n`,\n },\n];\n\n\n \n \n coffee-outline\n \n \n \n \n home\n \n \n \n \n \n magnify\n \n \n \n \n \n coffee-outline\n \n \n \n \n \n coffee-maker-outline\n \n \n \n \n \n cog-outline\n \n \n \n \n
\n\n### With badges on navigation items\n\nexport const snippetsBadge = [\n {\n language: \"Web component\",\n snippet: `\n \n coffee-outline\n \n \n \n \n home\n \n \n \n \n \n \n magnify\n \n \n \n \n \n \n coffee-outline\n \n \n \n \n \n \n coffee-maker-outline\n \n \n \n \n \n cog-outline\n \n \n \n`,\n },\n {\n language: \"React\",\n snippet: `\n \n coffee-outline\n \n \n \n \n home\n \n \n \n \n \n \n magnify\n \n \n \n \n \n \n coffee-outline\n \n \n \n \n \n \n coffee-maker-outline\n \n \n \n \n \n cog-outline\n \n \n \n`,\n },\n];\n\n\n \n \n coffee-outline\n \n \n \n \n home\n \n \n \n \n \n \n magnify\n \n \n \n \n \n \n coffee-outline\n \n \n \n \n \n \n coffee-maker-outline\n \n \n \n \n \n cog-outline\n \n \n \n \n
\n\n### With Material Design icons in SlottedSVG\n\n[MDI](https://pictogrammers.com/library/mdi/) can be imported from the `@mdi/js` package and used in ``.\nTo scale the icons, use the ['viewBox' attribute](https://css-tricks.com/scale-svg/#aa-the-viewbox-attribute)\n\n```bash\nnpm i @mdi/js\n```\n\nexport const withMDIicons = [\n {\n language: \"React\",\n snippet: `// importing Material Design icons\nimport { \n mdiCoffeeOutline, \n mdiHome,\n mdiMagnify,\n mdiCoffeeMakerOutline,\n mdiCogOutline,\n mdiTeaOutline\n} from \"@mdi/js\";\n...\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n`,\n },\n];\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n\n### With React Router and Material Design Icons (using slots)\n\nThe following example also demonstrates using a slotted app title link.\n\nexport const withReactRouter = [\n {\n language: \"React\",\n snippet: `\n
\n \n ACME coffee shop\n \n \n \n \n Home\n \n \n \n \n \n Search\n \n \n \n \n \n Drinks\n \n \n \n \n \n Equipment\n \n \n \n \n \n Settings\n \n \n \n
\n \n \n This is the home page} />\n Search} />\n Drinks} />\n Coffee Maker} />\n Settings} />\n \n \n
\n
\n
`,\n },\n];\n\n\n \n
\n \n \n ACME coffee shop\n \n \n \n \n \n Home\n \n \n \n \n \n Search\n \n \n \n \n \n Drinks\n \n \n \n \n \n Equipment\n \n \n \n \n \n Settings\n \n \n \n
\n
\n\n\n## Layout example\n\nFixed side navigation places the side navigation to the viewport.\n\nexport const basicLayoutFixedViewport = [\n {\n language: \"Web component\",\n snippet: `// Inline styling added for verboseness\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n \n \n

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vestibulum venenatis facilisis. Nam tortor felis, auctor vel ante quis, tempor interdum libero. In dictum sodales velit, eu egestas arcu dignissim ac. Aliquam facilisis eros dolor, id laoreet orci sagittis ut. Sed tempus, lacus in pretium molestie, lectus magna interdum risus, vel fringilla libero ex eu dui. Suspendisse ullamcorper vehicula lacinia. Phasellus congue velit nisl, vitae congue ligula rutrum id.

\n
\n \n

Etiam in suscipit metus. Duis semper, sapien a molestie semper, ex nibh porttitor tellus, vel molestie justo odio vel purus. Curabitur porttitor, tortor sed semper sollicitudin, odio odio congue tortor, eget pulvinar tellus nisl ac lacus. In ultricies commodo lorem, a laoreet diam. Ut a mauris at tellus tincidunt ullamcorper sit amet in metus. Aenean facilisis placerat dictum. Phasellus mattis ante sollicitudin luctus iaculis. Nam porttitor lobortis rhoncus. Nam nec malesuada purus, at pulvinar mauris. Nam non lorem ante.

\n
\n
\n
\n \n Get Started\n Accessibility\n Styles\n \n \n
\n
`,\n },\n {\n language: \"React\",\n snippet: `// Inline styling added for verboseness\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n \n \n

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vestibulum venenatis facilisis. Nam tortor felis, auctor vel ante quis, tempor interdum libero. In dictum sodales velit, eu egestas arcu dignissim ac. Aliquam facilisis eros dolor, id laoreet orci sagittis ut. Sed tempus, lacus in pretium molestie, lectus magna interdum risus, vel fringilla libero ex eu dui. Suspendisse ullamcorper vehicula lacinia. Phasellus congue velit nisl, vitae congue ligula rutrum id.

\n
\n \n

Etiam in suscipit metus. Duis semper, sapien a molestie semper, ex nibh porttitor tellus, vel molestie justo odio vel purus. Curabitur porttitor, tortor sed semper sollicitudin, odio odio congue tortor, eget pulvinar tellus nisl ac lacus. In ultricies commodo lorem, a laoreet diam. Ut a mauris at tellus tincidunt ullamcorper sit amet in metus. Aenean facilisis placerat dictum. Phasellus mattis ante sollicitudin luctus iaculis. Nam porttitor lobortis rhoncus. Nam nec malesuada purus, at pulvinar mauris. Nam non lorem ante.

\n
\n
\n
\n \n Get Started\n Accessibility\n Styles\n \n \n
\n
`,\n },\n];\n\n\n \n View example in new window\n \n\n", + "contents": "\nimport {\n IcSideNavigation,\n IcNavigationItem,\n IcNavigationGroup,\n IcDivider,\n IcLink,\n SlottedSVG,\n IcBadge,\n} from \"@ukic/react\";\n\nimport {\n mdiHome,\n mdiCoffeeOutline,\n mdiMagnify,\n mdiCoffeeMakerOutline,\n mdiCogOutline,\n mdiTeaOutline,\n} from \"@mdi/js\";\n\nimport { MemoryRouter, NavLink } from \"react-router-dom\";\n\n## Component demo\n\nexport const snippetsDefault = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n coffee-outline\n \n \n \n \n home\n \n \n \n \n \n \n magnify\n \n \n \n \n \n coffee-outline\n \n \n \n \n \n coffee-maker-outline\n \n \n \n \n \n cog-outline\n \n \n \n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n coffee-outline\n \n \n \n \n home\n \n \n \n \n \n \n magnify\n \n \n \n \n \n coffee-outline\n \n \n \n \n \n coffee-maker-outline\n \n \n \n \n \n cog-outline\n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n coffee-outline\n \n \n \n \n home\n \n \n \n \n \n \n magnify\n \n \n \n \n \n coffee-outline\n \n \n \n \n \n coffee-maker-outline\n \n \n \n \n \n cog-outline\n \n \n \n \n\n\n## Side navigation details\n\n\n\n## Navigation group details\n\n\n\n## Navigation item details\n\n\n\n## Variants\n\n### Static\n\nexport const snippetsStatic = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n coffee-outline\n \n \n \n \n home\n \n \n \n \n \n \n magnify\n \n \n \n \n \n coffee-outline\n \n \n \n \n \n coffee-maker-outline\n \n \n \n \n \n cog-outline\n \n \n \n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n coffee-outline\n \n \n \n \n home\n \n \n \n \n \n \n magnify\n \n \n \n \n \n coffee-outline\n \n \n \n \n \n coffee-maker-outline\n \n \n \n \n \n cog-outline\n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n coffee-outline\n \n \n \n \n home\n \n \n \n \n \n \n magnify\n \n \n \n \n \n coffee-outline\n \n \n \n \n \n coffee-maker-outline\n \n \n \n \n \n cog-outline\n \n \n \n \n\n\n### Expanded by default\n\nexport const snippetsExpanded = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n coffee-outline\n \n \n \n \n home\n \n \n \n \n \n magnify\n \n \n \n \n \n coffee-outline\n \n \n \n \n \n coffee-maker-outline\n \n \n \n \n \n cog-outline\n \n \n \n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n coffee-outline\n \n \n \n \n home\n \n \n \n \n magnify\n \n \n \n \n \n coffee-outline\n \n \n \n \n \n coffee-maker-outline\n \n \n \n \n \n cog-outline\n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n coffee-outline\n \n \n \n \n home\n \n \n \n \n \n magnify\n \n \n \n \n \n coffee-outline\n \n \n \n \n \n coffee-maker-outline\n \n \n \n \n \n cog-outline\n \n \n \n \n\n\n### Collapsed labels\n\nexport const snippetsCollapsed = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n coffee-outline\n \n \n \n \n home\n \n \n \n \n \n magnify\n \n \n \n \n \n coffee-outline\n \n \n \n \n \n coffee-maker-outline\n \n \n \n \n \n cog-outline\n \n \n \n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n coffee-outline\n \n \n \n \n home\n \n \n \n \n \n magnify\n \n \n \n \n \n coffee-outline\n \n \n \n \n \n coffee-maker-outline\n \n \n \n \n \n cog-outline\n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n coffee-outline\n \n \n \n \n home\n \n \n \n \n \n magnify\n \n \n \n \n \n coffee-outline\n \n \n \n \n \n coffee-maker-outline\n \n \n \n \n \n cog-outline\n \n \n \n \n\n\n### With badges on navigation items\n\nexport const snippetsBadge = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n coffee-outline\n \n \n \n \n home\n \n \n \n \n \n \n magnify\n \n \n \n \n \n \n coffee-outline\n \n \n \n \n \n \n coffee-maker-outline\n \n \n \n \n \n cog-outline\n \n \n \n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n coffee-outline\n \n \n \n \n home\n \n \n \n \n \n \n magnify\n \n \n \n \n \n \n coffee-outline\n \n \n \n \n \n \n coffee-maker-outline\n \n \n \n \n \n cog-outline\n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n coffee-outline\n \n \n \n \n home\n \n \n \n \n \n \n magnify\n \n \n \n \n \n \n coffee-outline\n \n \n \n \n \n \n coffee-maker-outline\n \n \n \n \n \n cog-outline\n \n \n \n \n\n\n### With Material Design icons in SlottedSVG\n\n[MDI](https://pictogrammers.com/library/mdi/) can be imported from the `@mdi/js` package and used in ``.\nTo scale the icons, use the ['viewBox' attribute](https://css-tricks.com/scale-svg/#aa-the-viewbox-attribute)\n\n```bash\nnpm i @mdi/js\n```\n\nexport const withMDIicons = [\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n\n### With React Router and Material Design Icons (using slots)\n\nThe following example also demonstrates using a slotted app title link.\n\nexport const withReactRouter = [\n {\n technology: \"React\",\n snippets: {\n short: `\n
\n \n ACME coffee shop\n \n \n \n \n Home\n \n \n \n \n \n Search\n \n \n \n \n \n Drinks\n \n \n \n \n \n Equipment\n \n \n \n \n \n Settings\n \n \n \n
\n \n \n \n \n \n \n \n \n \n
\n
\n
`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n
\n \n \n ACME coffee shop\n \n \n \n \n \n Home\n \n \n \n \n \n Search\n \n \n \n \n \n Drinks\n \n \n \n \n \n Equipment\n \n \n \n \n \n Settings\n \n \n \n
\n
\n\n\n## Layout example\n\nFixed side navigation places the side navigation to the viewport.\n\nexport const basicLayoutFixedViewport = [\n {\n technology: \"Web component\",\n snippets: {\n short: `
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n \n \n

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vestibulum venenatis facilisis. Nam tortor felis, auctor vel ante quis, tempor interdum libero. In dictum sodales velit, eu egestas arcu dignissim ac. Aliquam facilisis eros dolor, id laoreet orci sagittis ut. Sed tempus, lacus in pretium molestie, lectus magna interdum risus, vel fringilla libero ex eu dui. Suspendisse ullamcorper vehicula lacinia. Phasellus congue velit nisl, vitae congue ligula rutrum id.

\n
\n \n

Etiam in suscipit metus. Duis semper, sapien a molestie semper, ex nibh porttitor tellus, vel molestie justo odio vel purus. Curabitur porttitor, tortor sed semper sollicitudin, odio odio congue tortor, eget pulvinar tellus nisl ac lacus. In ultricies commodo lorem, a laoreet diam. Ut a mauris at tellus tincidunt ullamcorper sit amet in metus. Aenean facilisis placerat dictum. Phasellus mattis ante sollicitudin luctus iaculis. Nam porttitor lobortis rhoncus. Nam nec malesuada purus, at pulvinar mauris. Nam non lorem ante.

\n
\n
\n
\n \n Get Started\n Accessibility\n Styles\n \n \n
\n
`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `// Inline styling added for verboseness\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n \n \n

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vestibulum venenatis facilisis. Nam tortor felis, auctor vel ante quis, tempor interdum libero. In dictum sodales velit, eu egestas arcu dignissim ac. Aliquam facilisis eros dolor, id laoreet orci sagittis ut. Sed tempus, lacus in pretium molestie, lectus magna interdum risus, vel fringilla libero ex eu dui. Suspendisse ullamcorper vehicula lacinia. Phasellus congue velit nisl, vitae congue ligula rutrum id.

\n
\n \n

Etiam in suscipit metus. Duis semper, sapien a molestie semper, ex nibh porttitor tellus, vel molestie justo odio vel purus. Curabitur porttitor, tortor sed semper sollicitudin, odio odio congue tortor, eget pulvinar tellus nisl ac lacus. In ultricies commodo lorem, a laoreet diam. Ut a mauris at tellus tincidunt ullamcorper sit amet in metus. Aenean facilisis placerat dictum. Phasellus mattis ante sollicitudin luctus iaculis. Nam porttitor lobortis rhoncus. Nam nec malesuada purus, at pulvinar mauris. Nam non lorem ante.

\n
\n
\n
\n \n Get Started\n Accessibility\n Styles\n \n \n
\n
`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n View example in new window\n \n\n", "path": "/components/side-navigation/code", - "date": "2023-10-11", + "date": "2024-05-02", "title": "Side navigation", "status": "BETA", "subTitle": "Side navigation provides an app's main navigation and is fixed on the left-hand side of the app. It includes the app's name, main navigation and optional secondary links.", @@ -3312,10 +3312,10 @@ ], "meta": { "relativePath": "components/side-nav/code.mdx", - "createdAt": "2024-05-09T10:42:41.907Z", - "lastModified": "2024-05-09T10:42:41.907Z", - "size": 75440, - "formattedSize": "73.7 KB" + "createdAt": "2024-05-21T09:12:11.379Z", + "lastModified": "2024-05-21T09:12:11.379Z", + "size": 77390, + "formattedSize": "75.6 KB" } }, { @@ -3344,8 +3344,8 @@ ], "meta": { "relativePath": "components/side-nav/guidance.mdx", - "createdAt": "2024-02-14T15:16:06.090Z", - "lastModified": "2024-02-14T15:16:06.090Z", + "createdAt": "2024-05-13T07:27:37.384Z", + "lastModified": "2024-05-13T07:27:37.384Z", "size": 12176, "formattedSize": "11.9 KB" } @@ -3383,9 +3383,9 @@ }, { "id": "components__skeleton__codex", - "contents": "\nimport {\n IcSkeleton,\n IcTypography,\n IcCard,\n IcButton,\n SlottedSVG,\n} from \"@ukic/react\";\n\n## Component demo\n\nexport const snippets = [\n {\n language: \"Web component\",\n snippet: `\n\n \n\n`,\n },\n {\n language: \"React\",\n snippet: `\n\n \n\n`,\n },\n];\n\n\n
\n \n \n \n \n \n
\n
\n\n## Skeleton details\n\n\n\n## Variants\n\n### Inherited size from child\n\nexport const snippetsInherited = [\n {\n language: \"Web component\",\n snippet: `
Test text
`,\n },\n {\n language: \"React\",\n snippet: `\n
Test text
\n
`,\n },\n];\n\n\n \n \n Test text\n \n \n\n\n### Set width and height\n\nexport const snippetsSetWidthAndHeight = [\n {\n language: \"Web component\",\n snippet: `Height and width set with styles\n\nHeight set with styles\n\nWidth set with styles\n`,\n },\n {\n language: \"React\",\n snippet: `Height and width set with styles\n\nHeight set with styles\n\nWidth set with styles\n`,\n },\n];\n\n\n
\n Height and width set with styles\n \n Height set with styles\n \n Width set with styles\n \n
\n
\n\n### Light\n\nexport const snippetsLight = [\n {\n language: \"Web component\",\n snippet: `\n\n \n\n`,\n },\n {\n language: \"React\",\n snippet: `\n\n \n\n`,\n },\n];\n\n\n
\n \n \n \n \n \n
\n
\n\n### Within IcCard component\n\nexport const snippetsInCard = [\n {\n language: \"Web component\",\n snippet: `
\n
\n
\n \n \n \n \n \n Reload\n \n
\n `,\n },\n {\n language: \"React\",\n snippet: `const loading = () => {\n return (\n \n \n \n \n \n \n \n \n );\n};\nconst loaded = () => {\n return (\n \n \n \n \n
\n
\n Learn more\n Hide\n
\n \n );\n};\n const ContentFunction = () => {\n const [content, setContent] = React.useState(loading);\n const loadFunc = () => {\n setContent(loading);\n setTimeout(() => {\n setContent(loaded);\n }, 3000);\n };\n return (\n
\n {content}\n
\n {\n loadFunc();\n }}\n >\n \n \n \n \n Refresh\n \n
\n );\n};`,\n },\n];\n\nexport const loading = () => (\n \n \n \n \n \n \n \n \n);\n\nexport const loaded = () => (\n \n \n \n
\n
\n Accept\n Cancel\n
\n \n);\n\nexport const ContentFunction = () => {\n const [content, setContent] = React.useState(loaded);\n const loadFunc = () => {\n setContent(loading);\n setTimeout(() => {\n setContent(loaded);\n }, 3000);\n };\n return (\n
\n {content}\n
\n {\n loadFunc();\n }}\n >\n \n \n \n \n Refresh\n \n
\n );\n};\n\n\n \n\n", + "contents": "\nimport {\n IcSkeleton,\n IcTypography,\n IcCard,\n IcButton,\n SlottedSVG,\n} from \"@ukic/react\";\n\n## Component demo\n\nexport const snippets = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n\n \n\n`,\n long: `.container {\n display: flex;\n flex-direction: column;\n gap: 8px;\n }\n \n \n
\n {shortCode}\n
`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n\n \n\n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `
\n {shortCode}\n
`,\n },\n {\n language: \"Javascript\",\n snippet: `
\n {shortCode}\n
`,\n },\n ],\n },\n },\n];\n\n\n
\n \n \n \n \n \n
\n
\n\n## Skeleton details\n\n\n\n## Variants\n\n### Inherited size from child\n\nexport const snippetsInherited = [\n {\n technology: \"Web component\",\n snippets: {\n short: `
Test text
`,\n long: `.child {\n height:200px;\n width:450px;\n }\n \n \n {shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n
Test text
\n
`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n child: {\n height: \"200px\",\n width: \"450px\"\n },\n });\n const classes = useStyles();\n return (\n {shortCode}\n )`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n child: {\n height: \"200px\",\n width: \"450px\"\n },\n });\n const classes = useStyles();\n return (\n {shortCode}\n )`,\n },\n ],\n },\n },\n];\n\n\n \n \n Test text\n \n \n\n\n### Set width and height\n\nCSS changes directly to `Skeleton` must be applied with inline styling.\n\nexport const snippetsSetWidthAndHeight = [\n {\n technology: \"Web component\",\n snippets: {\n short: `

Height and width set with styles

\n\n

Height set with styles

\n\n

Width set with styles

\n`,\n long: `.container {\n display: flex;\n flex-direction: column;\n gap: 8px;\n }\n \n \n
\n {shortCode}\n
`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `

Height and width set with styles

\n\n

Height set with styles<

/IcTypography>\n\n

Width set with styles

\n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `<>\n {shortCode}\n `,\n },\n {\n language: \"Javascript\",\n snippet: `<>\n {shortCode}\n `,\n },\n ],\n },\n },\n];\n\n\n
\n \n

Height and width set with styles

\n
\n \n \n

Height set with styles

\n
\n \n \n

Width set with styles

\n
\n \n
\n
\n\n### Light\n\nexport const snippetsLight = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n\n \n\n`,\n long: `
\n {shortCode}\n
`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n\n \n\n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `
\n {shortCode}\n
`,\n },\n {\n language: \"Javascript\",\n snippet: `
\n {shortCode}\n
`,\n },\n ],\n },\n },\n];\n\n\n
\n \n \n \n \n \n
\n
\n\n### Within IcCard component\n\nexport const snippetsInCard = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n \n \n \n \n `,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n \n \n \n \n `,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\nexport const loading = () => (\n \n \n \n \n \n \n \n \n);\n\nexport const loaded = () => (\n \n \n \n
\n
\n Accept\n Cancel\n
\n \n);\n\nexport const ContentFunction = () => {\n const [content, setContent] = React.useState(loaded);\n const loadFunc = () => {\n setContent(loading);\n setTimeout(() => {\n setContent(loaded);\n }, 3000);\n };\n return (\n
\n {content}\n
\n {\n loadFunc();\n }}\n >\n \n \n \n \n Refresh\n \n
\n );\n};\n\n\n \n\n", "path": "/components/skeleton/code", - "date": "2023-10-24", + "date": "2024-05-02", "title": "Skeleton", "status": "BETA", "subTitle": "Skeleton loading states are representations of the shape of content that help inform users that a specific type of component is loading.", @@ -3406,10 +3406,10 @@ ], "meta": { "relativePath": "components/skeleton/code.mdx", - "createdAt": "2024-05-09T10:42:41.911Z", - "lastModified": "2024-05-09T10:42:41.911Z", - "size": 13492, - "formattedSize": "13.2 KB" + "createdAt": "2024-05-21T09:12:11.379Z", + "lastModified": "2024-05-21T09:12:11.379Z", + "size": 11928, + "formattedSize": "11.6 KB" } }, { @@ -3438,8 +3438,8 @@ ], "meta": { "relativePath": "components/skeleton/guidance.mdx", - "createdAt": "2024-02-14T15:16:06.094Z", - "lastModified": "2024-02-14T15:16:06.094Z", + "createdAt": "2024-05-13T07:27:37.384Z", + "lastModified": "2024-05-13T07:27:37.384Z", "size": 4677, "formattedSize": "4.6 KB" } @@ -3477,9 +3477,9 @@ }, { "id": "components__status-tags__codex", - "contents": "\nimport { IcStatusTag } from \"@ukic/react\";\n\n## Component demo\n\nexport const snippetsDefault = [\n {\n language: \"Web component\",\n snippet: `\n\n\n`,\n },\n {\n language: \"React\",\n snippet: `\n\n\n`,\n },\n];\n\n\n \n \n \n \n\n\n## Status tag details\n\n\n\n## Variants\n\n### Emphasis\n\nexport const snippetsEmphasis = [\n {\n language: \"Web component\",\n snippet: `\n\n\n`,\n },\n {\n language: \"React\",\n snippet: `\n\n\n`,\n },\n];\n\n\n \n \n \n \n\n\n### Small\n\nexport const snippetsSmall = [\n {\n language: \"Web component\",\n snippet: `\n\n\n`,\n },\n {\n language: \"React\",\n snippet: `\n\n\n`,\n },\n];\n\n\n \n \n \n \n\n", + "contents": "\nimport { IcStatusTag } from \"@ukic/react\";\n\nexport const snippetsDefault = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n\n\n`,\n long: `.parent-container {\n display: flex;\n gap: 8px;\n flex-wrap: wrap;\n padding: 16px;\n }\n \n \n
\n {shortCode}\n
`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n\n\n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n display: \"flex\",\n flexWrap: \"wrap\",\n gap: \"8px\",\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nreturn (\n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n display: \"flex\",\n flexWrap: \"wrap\",\n gap: \"8px\",\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nreturn (\n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n\n\n## Status tag details\n\n\n\n## Variants\n\n### Emphasis\n\nexport const snippetsEmphasis = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n\n\n`,\n long: `.parent-container {\n display: flex;\n gap: 8px;\n flex-wrap: wrap;\n padding: 16px;\n }\n \n \n
\n {shortCode}\n
`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n\n\n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n display: \"flex\",\n flexWrap: \"wrap\",\n gap: \"8px\",\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nreturn (\n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n display: \"flex\",\n flexWrap: \"wrap\",\n gap: \"8px\",\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nreturn (\n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n\n\n### Small\n\nexport const snippetsSmall = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n\n\n`,\n long: `.parent-container {\n display: flex;\n gap: 8px;\n flex-wrap: wrap;\n padding: 16px;\n }\n \n \n
\n {shortCode}\n
`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n\n\n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n display: \"flex\",\n flexWrap: \"wrap\",\n gap: \"8px\",\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nreturn (\n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n parentContainer: {\n display: \"flex\",\n flexWrap: \"wrap\",\n gap: \"8px\",\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nreturn (\n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n\n", "path": "/components/status-tag/code", - "date": "2023-10-24", + "date": "2024-05-02", "title": "Status tag", "status": "BETA", "subTitle": "Status tags are short, clear and digestible ways to display the status of something on the page.", @@ -3500,10 +3500,10 @@ ], "meta": { "relativePath": "components/status-tags/code.mdx", - "createdAt": "2024-05-09T10:42:41.915Z", - "lastModified": "2024-05-09T10:42:41.915Z", - "size": 3729, - "formattedSize": "3.6 KB" + "createdAt": "2024-05-21T09:12:11.379Z", + "lastModified": "2024-05-21T09:12:11.379Z", + "size": 6597, + "formattedSize": "6.4 KB" } }, { @@ -3532,8 +3532,8 @@ ], "meta": { "relativePath": "components/status-tags/guidance.mdx", - "createdAt": "2024-02-14T15:16:06.098Z", - "lastModified": "2024-02-14T15:16:06.098Z", + "createdAt": "2024-05-13T07:27:37.384Z", + "lastModified": "2024-05-13T07:27:37.384Z", "size": 6863, "formattedSize": "6.7 KB" } @@ -3571,9 +3571,9 @@ }, { "id": "components__stepper__codex", - "contents": "\nimport { IcStepper, IcStep } from \"@ukic/react\";\n\n## Component demo\n\nexport const snippets = [\n {\n language: \"Web component\",\n snippet: `\n \n \n \n`,\n },\n {\n language: \"React\",\n snippet: `\n \n \n \n`,\n },\n];\n\n\n \n \n \n \n \n\n\n## Step details\n\n\n\n## Stepper details\n\n\n\n## Variants\n\n### Compact stepper\n\nexport const compactStepper = [\n {\n language: \"Web component\",\n snippet: `\n \n \n \n`,\n },\n {\n language: \"React\",\n snippet: `\n \n \n \n`,\n },\n];\n\n\n \n \n \n \n \n\n\n### Left-aligned\n\nexport const leftAligned = [\n {\n language: \"Web component\",\n snippet: `\n \n \n \n`,\n },\n {\n language: \"React\",\n snippet: `\n \n \n \n`,\n },\n];\n\n\n \n \n \n \n \n\n\n### With hidden step information\n\nexport const hiddenStepInfo = [\n {\n language: \"Web component\",\n snippet: `\n \n \n \n`,\n },\n {\n language: \"React\",\n snippet: `\n \n \n \n`,\n },\n];\n\n\n \n \n \n \n \n\n\n### With subtitles\n\nexport const withSubtitles = [\n {\n language: \"Web component\",\n snippet: `\n \n \n \n \n \n \n`,\n },\n {\n language: \"React\",\n snippet: `\n \n \n \n \n`,\n },\n];\n\n\n \n \n \n \n \n \n\n\n### Custom connector width\n\nexport const customConnectorWidth = [\n {\n language: \"Web component\",\n snippet: `\n \n \n \n`,\n },\n {\n language: \"React\",\n snippet: `\n \n \n \n`,\n },\n];\n\n\n \n \n \n \n \n\n", + "contents": "\nimport { IcStepper, IcStep } from \"@ukic/react\";\n\n## Component demo\n\nexport const snippets = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n \n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n \n\n\n## Step details\n\n\n\n## Stepper details\n\n\n\n## Variants\n\n### Compact stepper\n\nexport const compactStepper = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n \n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n \n\n\n### Left-aligned\n\nexport const leftAligned = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n \n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n \n\n\n### With hidden step information\n\nexport const hiddenStepInfo = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n \n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n \n\n\n### With subtitles\n\nexport const withSubtitles = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n \n \n \n \n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n \n \n\n\n### Custom connector width\n\nexport const customConnectorWidth = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n \n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n \n\n", "path": "/components/stepper/code", - "date": "2023-02-03", + "date": "2024-05-02", "title": "Stepper", "status": "BETA", "subTitle": "A stepper is a visual representation of a user's progress through a predefined set of steps in a linear process.", @@ -3594,10 +3594,10 @@ ], "meta": { "relativePath": "components/stepper/code.mdx", - "createdAt": "2024-05-09T10:42:41.935Z", - "lastModified": "2024-05-09T10:42:41.935Z", - "size": 6694, - "formattedSize": "6.5 KB" + "createdAt": "2024-05-21T09:12:11.379Z", + "lastModified": "2024-05-21T09:12:11.379Z", + "size": 8348, + "formattedSize": "8.2 KB" } }, { @@ -3626,8 +3626,8 @@ ], "meta": { "relativePath": "components/stepper/guidance.mdx", - "createdAt": "2024-02-14T15:16:06.098Z", - "lastModified": "2024-02-14T15:16:06.098Z", + "createdAt": "2024-05-13T07:27:37.388Z", + "lastModified": "2024-05-13T07:27:37.388Z", "size": 7478, "formattedSize": "7.3 KB" } @@ -3665,9 +3665,9 @@ }, { "id": "components__switch__codex", - "contents": "\nimport { IcSwitch } from \"@ukic/react\";\n\n## Component demo\n\nexport const snippetsDefault = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: ` console.log({ \n checked: ev.detail.checked, \n value: ev.detail.value\n })}\n/>`,\n },\n];\n\n\n \n console.log({\n checked: ev.detail.checked,\n value: ev.detail.value,\n })\n }\n />\n\n\n## Switch details\n\n\n\n## Variants\n\n### State\n\nexport const snippetsState = [\n {\n language: \"Web component\",\n snippet: ``,\n },\n {\n language: \"React\",\n snippet: ``,\n },\n];\n\n\n \n\n\n### Small\n\nexport const snippetsSmall = [\n {\n language: \"Web component\",\n snippet: ``,\n },\n {\n language: \"React\",\n snippet: ``,\n },\n];\n\n\n \n\n\n### Disabled\n\nexport const snippetsDisabled = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: `\n`,\n },\n];\n\n\n
\n \n \n
\n
\n\n### Helper text and right adornment\n\nexport const snippetsHelperAndAdornment = [\n {\n language: \"Web component\",\n snippet: `\n \n \n \n`,\n },\n {\n language: \"React\",\n snippet: `\n \n \n
\n`,\n },\n];\n\n\n \n \n \n \n \n\n", + "contents": "\nimport { IcSwitch } from \"@ukic/react\";\n\n## Component demo\n\nexport const snippetsDefault = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ` console.log({ \n checked: ev.detail.checked, \n value: ev.detail.value\n })}\n/>`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n console.log({\n checked: ev.detail.checked,\n value: ev.detail.value,\n })\n }\n />\n\n\n## Switch details\n\n\n\n## Variants\n\n### State\n\nexport const snippetsState = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ``,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n\n\n### Small\n\nexport const snippetsSmall = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ``,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n\n\n### Disabled\n\nexport const snippetsDisabled = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n `,\n long: [\n {\n language: \"Typescript\",\n snippet: `<>\n {shortCode}\n `,\n },\n {\n language: \"Javascript\",\n snippet: `<>\n {shortCode}\n `,\n },\n ],\n },\n },\n];\n\n\n
\n \n \n
\n
\n\n### Helper text and right adornment\n\nexport const snippetsHelperAndAdornment = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n \n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n
\n\n", "path": "/components/switch/code", - "date": "2023-10-24", + "date": "2024-05-02", "title": "Switch", "status": "BETA", "subTitle": "Switches are used to quickly toggle an option on or off.", @@ -3688,10 +3688,10 @@ ], "meta": { "relativePath": "components/switch/code.mdx", - "createdAt": "2024-05-09T10:42:41.939Z", - "lastModified": "2024-05-09T10:42:41.939Z", - "size": 4428, - "formattedSize": "4.3 KB" + "createdAt": "2024-05-21T09:12:11.379Z", + "lastModified": "2024-05-21T09:12:11.379Z", + "size": 5903, + "formattedSize": "5.8 KB" } }, { @@ -3720,8 +3720,8 @@ ], "meta": { "relativePath": "components/switch/guidance.mdx", - "createdAt": "2024-02-14T15:16:06.098Z", - "lastModified": "2024-02-14T15:16:06.098Z", + "createdAt": "2024-05-13T07:27:37.388Z", + "lastModified": "2024-05-13T07:27:37.388Z", "size": 6214, "formattedSize": "6.1 KB" } @@ -3759,9 +3759,9 @@ }, { "id": "components__tabs__codex", - "contents": "\nimport { IcTab, IcTabContext, IcTabGroup, IcTabPanel } from \"@ukic/react\";\n\n## Component demo\n\nexport const snippets = [\n {\n language: \"Web component\",\n snippet: `\n \n Ingredients\n Method\n History\n \n Tab One - Ingredients\n Tab Two - Method\n Tab Three - History\n\n`,\n },\n {\n language: \"React\",\n snippet: `\n console.log({\n tabIndex: ev.detail.tabIndex,\n tabLabel: ev.detail.tabLabel,\n })\n }\n>\n \n Ingredients\n Method\n History\n \n Tab One - Ingredients\n Tab Two - Method\n Tab Three - History\n`,\n },\n];\n\n\n \n console.log({\n tabIndex: ev.detail.tabIndex,\n tabLabel: ev.detail.tabLabel,\n })\n }\n >\n \n Ingredients\n Method\n History\n \n Tab One - Ingredients\n Tab Two - Method\n Tab Three - History\n \n\n\n## Tab details\n\n\n\n## Tab context details\n\n\n\n## Tab list details\n\n\n\n## Tab panel details\n\n\n\n## Variants\n\n### With icons\n\nexport const withIcons = [\n {\n language: \"Web component\",\n snippet: `\n \n \n Ingredients\n \n \n \n \n \n Method\n \n \n \n \n \n History\n \n \n \n \n \n Tab One - Ingredients\n Tab Two - Method\n Tab Three - History\n`,\n },\n {\n language: \"React\",\n snippet: `\n \n \n Ingredients\n \n \n \n \n \n Method\n \n \n \n \n \n History\n \n \n \n \n \n Tab One - Ingredients\n Tab Two - Method\n Tab Three - History\n `,\n },\n];\n\n\n \n \n \n Ingredients\n \n \n \n \n \n Method\n \n \n \n \n \n History\n \n \n \n \n \n Tab One - Ingredients\n Tab Two - Method\n Tab Three - History\n \n\n\n### Disabled\n\nexport const disabled = [\n {\n language: \"Web component\",\n snippet: `\n \n Ingredients\n Method\n History\n \n Tab One - Ingredients\n Tab Two - Method\n Tab Three - History\n`,\n },\n {\n language: \"React\",\n snippet: `\n \n Ingredients\n Method\n History\n \n Tab One - Ingredients\n Tab Two - Method\n Tab Three - History\n`,\n },\n];\n\n\n \n \n Ingredients\n Method\n History\n \n Tab One - Ingredients\n Tab Two - Method\n Tab Three - History\n \n\n\n### Light\n\nexport const light = [\n {\n language: \"Web component\",\n snippet: `\n \n Ingredients\n Method\n History\n \n Tab One - Ingredients\n Tab Two - Method\n Tab Three - History\n`,\n },\n {\n language: \"React\",\n snippet: `\n \n Ingredients\n Method\n History\n \n Tab One - Ingredients\n Tab Two - Method\n Tab Three - History\n`,\n },\n];\n\n\n \n \n Ingredients\n Method\n History\n \n Tab One - Ingredients\n Tab Two - Method\n Tab Three - History\n \n\n\n### Compact\n\nexport const compact = [\n {\n language: \"Web component\",\n snippet: `\n \n Ingredients\n Method\n History\n Drinks\n Recipes\n \n Tab One - Ingredients\n Tab Two - Method\n Tab Three - History\n Tab Four - Drinks\n Tab Five - Recipes\n \n`,\n },\n {\n language: \"React\",\n snippet: `const compactStyle = {\n width: \"60%\",\n marginLeft: \"auto\",\n marginRight: \"auto\",\n }\nreturn (\n <>\n \n \n Ingredients\n Method\n History\n Drinks\n Recipes\n \n Tab One - Ingredients\n Tab Two - Method\n Tab Three - History\n Tab Four - Drinks\n Tab Five - Recipes\n \n \n);`,\n },\n];\n\n\n \n \n Ingredients\n Method\n History\n Drinks\n Recipes\n \n Tab One - Ingredients\n Tab Two - Method\n Tab Three - History\n Tab Four - Drinks\n Tab Five - Recipes\n \n\n\n### Nested Tabs\n\nexport const nested = [\n {\n language: \"Web component\",\n snippet: `\n \n Ingredients\n Method\n History\n \n \n \n \n Espresso\n Water\n Milk\n \n Nested Tab Panel One - Espresso\n Nested Tab Panel Two - Water\n Nested Tab Panel Three - Milk\n \n \n Outer Tab Panel Two - Method\n Outer Tab Panel Three - History\n`,\n },\n {\n language: \"React\",\n snippet: `\n \n Ingredients\n Method\n History\n \n \n \n \n Espresso\n Water\n Milk\n \n Nested Tab Panel One - Espresso\n Nested Tab Panel Two - Water\n Nested Tab Panel Three - Milk\n \n \n Outer Tab Panel Two - Method\n Outer Tab Panel Three - History\n`,\n },\n];\n\n\n \n \n Ingredients\n Method\n History\n \n \n \n \n Espresso\n Water\n Milk\n \n Nested Tab Panel One - Espresso\n Nested Tab Panel Two - Water\n Nested Tab Panel Three - Milk\n \n \n Outer Tab Panel Two - Method\n Outer Tab Panel Three - History\n \n\n", + "contents": "\nimport { IcTab, IcTabContext, IcTabGroup, IcTabPanel } from \"@ukic/react\";\n\n## Component demo\n\nexport const snippets = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n Ingredients\n Method\n History\n \n Tab One - Ingredients\n Tab Two - Method\n Tab Three - History\n\n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n console.log({\n tabIndex: ev.detail.tabIndex,\n tabLabel: ev.detail.tabLabel,\n })\n }\n>\n \n Ingredients\n Method\n History\n \n Tab One - Ingredients\n Tab Two - Method\n Tab Three - History\n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n console.log({\n tabIndex: ev.detail.tabIndex,\n tabLabel: ev.detail.tabLabel,\n })\n }\n >\n \n Ingredients\n Method\n History\n \n Tab One - Ingredients\n Tab Two - Method\n Tab Three - History\n \n\n\n## Tab details\n\n\n\n## Tab context details\n\n\n\n## Tab list details\n\n\n\n## Tab panel details\n\n\n\n## Variants\n\n### With icons\n\nexport const withIcons = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n Ingredients\n \n \n \n \n \n Method\n \n \n \n \n \n History\n \n \n \n \n \n Tab One - Ingredients\n Tab Two - Method\n Tab Three - History\n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n Ingredients\n \n \n \n \n \n Method\n \n \n \n \n \n History\n \n \n \n \n \n Tab One - Ingredients\n Tab Two - Method\n Tab Three - History\n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n Ingredients\n \n \n \n \n \n Method\n \n \n \n \n \n History\n \n \n \n \n \n Tab One - Ingredients\n Tab Two - Method\n Tab Three - History\n \n\n\n### Disabled\n\nexport const disabled = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n Ingredients\n Method\n History\n \n Tab One - Ingredients\n Tab Two - Method\n Tab Three - History\n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n Ingredients\n Method\n History\n \n Tab One - Ingredients\n Tab Two - Method\n Tab Three - History\n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n Ingredients\n Method\n History\n \n Tab One - Ingredients\n Tab Two - Method\n Tab Three - History\n \n\n\n### Light\n\nexport const light = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n Ingredients\n Method\n History\n \n Tab One - Ingredients\n Tab Two - Method\n Tab Three - History\n`,\n long: `.dark-background {\n background-color: #2c2f34;\n }\n \n \n
\n {shortCode}\n
`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n Ingredients\n Method\n History\n \n Tab One - Ingredients\n Tab Two - Method\n Tab Three - History\n`,\n long: [\n {\n language: \"Typescript\",\n snippet: ` const useStyles = createUseStyles({\n darkBackground: {\n backgroundColor: \"#2c2f34\",\n },\n });\n const classes = useStyles();\n return (\n
\n {shortCode}\n
\n )`,\n },\n {\n language: \"Javascript\",\n snippet: ` const useStyles = createUseStyles({\n darkBackground: {\n backgroundColor: \"#2c2f34\",\n },\n });\n const classes = useStyles();\n return (\n
\n {shortCode}\n
\n )`,\n },\n ],\n },\n },\n];\n\n\n \n \n Ingredients\n Method\n History\n \n Tab One - Ingredients\n Tab Two - Method\n Tab Three - History\n \n\n\n### Compact\n\nexport const compact = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n Ingredients\n Method\n History\n Drinks\n Recipes\n \n Tab One - Ingredients\n Tab Two - Method\n Tab Three - History\n Tab Four - Drinks\n Tab Five - Recipes\n`,\n long: `.tabs ic-tab-group,\n .tabs ic-tab-panel {\n width: 60%;\n margin-left: auto;\n margin-right: auto;\n }\n \n \n {shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n Ingredients\n Method\n History\n Drinks\n Recipes\n \n Tab One - Ingredients\n Tab Two - Method\n Tab Three - History\n Tab Four - Drinks\n Tab Five - Recipes\n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n compactTabsContainer: {\n width: \"60%\",\n marginLeft: \"auto\",\n marginRight: \"auto\",\n },\n});\nconst classes = useStyles();\nreturn (\n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n compactTabsContainer: {\n width: \"60%\",\n marginLeft: \"auto\",\n marginRight: \"auto\",\n },\n});\nconst classes = useStyles();\nreturn (\n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n \n \n Ingredients\n Method\n History\n Drinks\n Recipes\n \n Tab One - Ingredients\n Tab Two - Method\n Tab Three - History\n Tab Four - Drinks\n Tab Five - Recipes\n \n\n\n### Nested Tabs\n\nexport const nested = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n Ingredients\n Method\n History\n \n \n \n \n Espresso\n Water\n Milk\n \n Nested Tab Panel One - Espresso\n Nested Tab Panel Two - Water\n Nested Tab Panel Three - Milk\n \n \n Outer Tab Panel Two - Method\n Outer Tab Panel Three - History\n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n Ingredients\n Method\n History\n \n \n \n \n Espresso\n Water\n Milk\n \n Nested Tab Panel One - Espresso\n Nested Tab Panel Two - Water\n Nested Tab Panel Three - Milk\n \n \n Outer Tab Panel Two - Method\n Outer Tab Panel Three - History\n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n Ingredients\n Method\n History\n \n \n \n \n Espresso\n Water\n Milk\n \n Nested Tab Panel One - Espresso\n Nested Tab Panel Two - Water\n Nested Tab Panel Three - Milk\n \n \n Outer Tab Panel Two - Method\n Outer Tab Panel Three - History\n \n\n", "path": "/components/tabs/code", - "date": "2024-04-17", + "date": "2024-05-02", "title": "Tabs", "status": "BETA", "subTitle": "Tabs let users navigate between content within the same context. Tabs organise complex layouts by moving content into multiple sections.", @@ -3782,10 +3782,10 @@ ], "meta": { "relativePath": "components/tabs/code.mdx", - "createdAt": "2024-05-09T10:42:41.947Z", - "lastModified": "2024-05-09T10:42:41.947Z", - "size": 14510, - "formattedSize": "14.2 KB" + "createdAt": "2024-05-21T09:12:11.379Z", + "lastModified": "2024-05-21T09:12:11.379Z", + "size": 16836, + "formattedSize": "16.4 KB" } }, { @@ -3814,8 +3814,8 @@ ], "meta": { "relativePath": "components/tabs/guidance.mdx", - "createdAt": "2024-02-14T15:16:06.102Z", - "lastModified": "2024-02-14T15:16:06.102Z", + "createdAt": "2024-05-13T07:27:37.388Z", + "lastModified": "2024-05-13T07:27:37.388Z", "size": 7072, "formattedSize": "6.9 KB" } @@ -3853,9 +3853,9 @@ }, { "id": "components__text-field__codex", - "contents": "\nimport { IcTextField } from \"@ukic/react\";\n\n## Component demo\n\nexport const snippetsDefault = [\n {\n language: \"Web component\",\n snippet: `\n\n`,\n },\n {\n language: \"React\",\n snippet: ` console.log(ev.detail.value)}\n/>`,\n },\n];\n\n\n console.log(ev.detail.value)}\n />\n\n\n## Text field details\n\n\n\n## Variants\n\n### With icon, value and max length\n\nexport const snippetsIconValueMaxLength = [\n {\n language: \"Web component\",\n snippet: `\n \n \n \n`,\n },\n {\n language: \"React\",\n snippet: `\n \n \n \n`,\n },\n];\n\n\n \n \n \n \n \n\n\n### Disabled\n\nexport const snippetsDisabled = [\n {\n language: \"Web component\",\n snippet: `\n \n \n \n \n`,\n },\n {\n language: \"React\",\n snippet: `\n \n \n \n \n`,\n },\n];\n\n\n \n \n \n \n \n \n\n\n### Size small\n\nexport const snippetsSmall = [\n {\n language: \"Web component\",\n snippet: `\n\n`,\n },\n {\n language: \"React\",\n snippet: ` console.log(ev.detail.value)}\n/>`,\n },\n];\n\n\n console.log(ev.detail.value)}\n />\n\n\n### Validation\n\nexport const snippetsValidation = [\n {\n language: \"Web component\",\n snippet: `\n\n\n\n\n\n\n`,\n },\n {\n language: \"React\",\n snippet: `\n\n\n`,\n },\n];\n\n\n
\n \n \n \n \n
\n
\n\n### With min and max values\n\nIn this example, an error message will display when the input is either below the min value or above the max value. This only affects numeric input fields.\n\nexport const snippetsMinMax = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: ``,\n },\n];\n\n\n \n\n\n### Text area with resize\n\nexport const snippetsTextArea = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: ``,\n },\n];\n\n\n \n\n", + "contents": "\nimport { IcTextField } from \"@ukic/react\";\n\n## Component demo\n\nexport const snippetsDefault = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n`,\n long: `{shortCode}\n`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ` console.log(ev.detail.value)}\n/>`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n console.log(ev.detail.value)}\n />\n\n\n## Text field details\n\n\n\n## Variants\n\n### With icon, value and max length\n\nexport const snippetsIconValueMaxLength = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n \n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n \n\n\n### Disabled\n\nexport const snippetsDisabled = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n \n \n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n \n
\n\n\n### Size small\n\nexport const snippetsSmall = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n`,\n long: `{shortCode}\n`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ` console.log(ev.detail.value)}\n/>`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n console.log(ev.detail.value)}\n />\n\n\n### Validation\n\nexport const snippetsValidation = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n\n\n\n\n\n\n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n\n\n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `<>\n {shortCode}\n `,\n },\n {\n language: \"Javascript\",\n snippet: `<>\n {shortCode}\n `,\n },\n ],\n },\n },\n];\n\n\n
\n \n \n \n \n
\n
\n\n### With min and max values\n\nIn this example, an error message will display when the input is either below the min value or above the max value. This only affects numeric input fields.\n\nexport const snippetsMinMax = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ``,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n\n\n### Text area with resize\n\nexport const snippetsTextArea = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ``,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n\n", "path": "/components/text-field/code", - "date": "2023-10-25", + "date": "2024-05-02", "title": "Text field", "status": "BETA", "subTitle": "Text fields let users input and edit text. Text fields capture a single line of text and text areas capture multiple lines of text.", @@ -3876,10 +3876,10 @@ ], "meta": { "relativePath": "components/text-field/code.mdx", - "createdAt": "2024-05-09T10:42:41.951Z", - "lastModified": "2024-05-09T10:42:41.951Z", - "size": 11660, - "formattedSize": "11.4 KB" + "createdAt": "2024-05-21T09:12:11.383Z", + "lastModified": "2024-05-21T09:12:11.383Z", + "size": 13530, + "formattedSize": "13.2 KB" } }, { @@ -3908,8 +3908,8 @@ ], "meta": { "relativePath": "components/text-field/guidance.mdx", - "createdAt": "2024-02-14T15:16:06.106Z", - "lastModified": "2024-02-14T15:16:06.106Z", + "createdAt": "2024-05-13T07:27:37.392Z", + "lastModified": "2024-05-13T07:27:37.392Z", "size": 6758, "formattedSize": "6.6 KB" } @@ -3947,9 +3947,9 @@ }, { "id": "components__toasts__codex", - "contents": "\nimport {\n IcToast,\n IcToastRegion,\n IcButton,\n IcLink,\n SlottedSVG,\n} from \"@ukic/react\";\nimport { useRef } from \"react\";\n\nexport const defaultSnippet = [\n {\n language: \"Web component\",\n snippet: `Display toast\n\n \n\n`,\n },\n {\n language: \"React\",\n snippet: `const toastRegionEl = useRef(null);\nconst toastEl = useRef(null);\nconst handleClick = () => {\n toastRegionEl.current.openToast = toastEl.current;\n}\nreturn (\n <>\n Display toast component\n \n \n \n \n)`,\n },\n];\n\n## Component demo\n\nexport const DefaultToast = () => {\n const toastRegionEl = useRef(null);\n const toastEl = useRef(null);\n const handleClick = () => {\n toastRegionEl.current.openToast = toastEl.current;\n };\n return (\n <>\n Display toast component\n \n \n \n \n );\n};\n\n\n \n\n\n## Toast region details\n\n\n\n## Toast details\n\n\n\n## Variants\n\n### Displaying toasts\n\nUse the `openToast` prop on the toast region component to display a toast message. Do not use the `setVisible` method on the toast component as this does not work with the toast queuing functionality.\n\n### Queuing toasts\n\nTo view the toasts queuing in the following example, click each button to open a toast and then the dismiss button on the visible toast. Each toast will appear one after the other.\n\nexport const queuingSnippet = [\n {\n language: \"Web component\",\n snippet: `Display default toast\nDisplay error toast\nDisplay auto dismiss toast\n\n \n \n \n\n`,\n },\n {\n language: \"React\",\n snippet: `const toastRegionEl = useRef(null);\nconst toastEl = useRef(null);\nconst errorToastEl = useRef(null);\nconst autoDismissToastEl = useRef(null);\nconst handleClick = () => {\n toastRegionEl.current.openToast = toastEl.current;\n};\nconst handleErrorClick = () => {\n toastRegionEl.current.openToast = errorToastEl.current;\n};\nconst handleAutoDismissClick = () => {\n toastRegionEl.current.openToast = autoDismissToastEl.current;\n};\nreturn (\n <>\n
\n Display default toast\n Display error toast\n Display auto dismiss toast\n
\n \n \n \n \n \n \n);`,\n },\n];\n\nexport const QueuingToast = () => {\n const toastRegionEl = useRef(null);\n const toastEl = useRef(null);\n const errorToastEl = useRef(null);\n const autoDismissToastEl = useRef(null);\n const handleClick = () => {\n toastRegionEl.current.openToast = toastEl.current;\n };\n const handleErrorClick = () => {\n toastRegionEl.current.openToast = errorToastEl.current;\n };\n const handleAutoDismissClick = () => {\n toastRegionEl.current.openToast = autoDismissToastEl.current;\n };\n return (\n <>\n
\n Display default toast\n Display error toast\n \n Display auto dismiss toast\n \n
\n \n \n \n \n \n \n );\n};\n\n\n \n\n\n### Status variant\n\nexport const withVariantSnippet = [\n {\n language: \"Web component\",\n snippet: `Display success toast\n\n \n\n`,\n },\n {\n language: \"React\",\n snippet: `const toastRegionEl = useRef(null);\nconst toastEl = useRef(null);\nconst handleClick = () => {\n toastRegionEl.current.openToast = toastEl.current;\n}\nreturn (\n <>\n Display success toast\n \n \n \n \n)`,\n },\n];\n\nexport const WithVariantToast = () => {\n const toastRegionEl = useRef(null);\n const toastEl = useRef(null);\n const handleClick = () => {\n toastRegionEl.current.openToast = toastEl.current;\n };\n return (\n <>\n Display success toast\n \n \n \n \n );\n};\n\n\n \n\n\n### Multi-line\n\nexport const withMultilineSnippet = [\n {\n language: \"Web component\",\n snippet: `Display multi-line toast\n\n \n\n`,\n },\n {\n language: \"React\",\n snippet: `const toastRegionEl = useRef(null);\nconst toastEl = useRef(null);\nconst handleClick = () => {\n toastRegionEl.current.openToast = toastEl.current;\n}\nreturn (\n <>\n Display multi-line toast\n \n \n \n \n)`,\n },\n];\n\nexport const MultilineToast = () => {\n const toastRegionEl = useRef(null);\n const toastEl = useRef(null);\n const handleClick = () => {\n toastRegionEl.current.openToast = toastEl.current;\n };\n return (\n <>\n Display multi-line toast\n \n \n \n \n );\n};\n\n\n \n\n\n### Slotted 'action' toast\n\nexport const slottedActionsSnippet = [\n {\n language: \"Web component\",\n snippet: `Display slotted buttons toast\nDisplay slotted buttons toast\n\n \n Retry\n \n \n Retry\n \n\n`,\n },\n {\n language: \"React\",\n snippet: `const toastRegionEl = useRef(null);\nconst buttonToastEl = useRef(null);\nconst linkToastEl = useRef(null);\nconst handleButtonToastClick = () => {\n toastRegionEl.current.openToast = buttonToastEl.current;\n}\nconst handleLinkToastClick = () => {\n toastRegionEl.current.openToast = linkToastEl.current;\n}\nreturn (\n <>\n
\n Display slotted button toast\n Display slotted link toast\n
\n \n \n Retry\n \n \n Retry\n \n \n \n)`,\n },\n];\n\nexport const SlottedActionsToast = () => {\n const toastRegionEl = useRef(null);\n const buttonToastEl = useRef(null);\n const linkToastEl = useRef(null);\n const handleButtonToastClick = () => {\n toastRegionEl.current.openToast = buttonToastEl.current;\n };\n const handleLinkToastClick = () => {\n toastRegionEl.current.openToast = linkToastEl.current;\n };\n return (\n <>\n
\n \n Display slotted button toast\n \n \n Display slotted link toast\n \n
\n \n \n \n Retry\n \n \n \n \n Retry\n \n \n \n \n );\n};\n\n\n \n\n\n### Auto-dismiss\n\nexport const autoDismissSnippet = [\n {\n language: \"Web component\",\n snippet: `Display auto-dismiss toast\n\n \n\n`,\n },\n {\n language: \"React\",\n snippet: `const toastRegionEl = useRef(null);\nconst toastEl = useRef(null);\nconst handleClick = () => {\n toastRegionEl.current.openToast = toastEl.current;\n}\nreturn (\n <>\n Display auto-dismiss toast\n \n \n \n \n)`,\n },\n];\n\nexport const AutoDismissToast = () => {\n const toastRegionEl = useRef(null);\n const toastEl = useRef(null);\n const handleClick = () => {\n toastRegionEl.current.openToast = toastEl.current;\n };\n return (\n <>\n Display auto-dismiss toast\n \n \n \n \n );\n};\n\n\n \n\n\n### Custom neutral icon and aria-labels\n\nexport const customIconAriaLabelsSnippet = [\n {\n language: \"Web component\",\n snippet: `Display auto-dismiss toast\n\n \n \n coffee-outline\n \n \n \n\n`,\n },\n {\n language: \"React\",\n snippet: `const toastRegionEl = useRef(null);\nconst toastEl = useRef(null);\nconst handleClick = () => {\n toastRegionEl.current.openToast = toastEl.current;\n}\nreturn (\n <>\n Display custom icon and aria-label toast\n \n \n \n coffee-outline\n \n \n \n \n \n)`,\n },\n];\n\nexport const CustomIconAriaLabels = () => {\n const toastRegionEl = useRef(null);\n const toastEl = useRef(null);\n const handleClick = () => {\n toastRegionEl.current.openToast = toastEl.current;\n };\n return (\n <>\n \n Display custom icon and aria-labels toast\n \n \n \n \n coffee-outline\n \n \n \n \n \n );\n};\n\n\n \n\n", + "contents": "\nimport {\n IcToast,\n IcToastRegion,\n IcButton,\n IcLink,\n SlottedSVG,\n} from \"@ukic/react\";\nimport { useRef } from \"react\";\n\nexport const defaultSnippet = [\n {\n technology: \"Web component\",\n snippets: {\n short: `Display toast\n\n \n`,\n long: `{shortCode}\n`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `Display toast component\n\n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const toastRegionEl = useRef(null);\n const toastEl = useRef(null);\n const handleClick = () => {\n if (toastRegionEl.current && toastEl.current) {\n toastRegionEl.current.openToast = toastEl.current;\n }\n };\n return (\n <>\n {shortCode}\n \n )`,\n },\n {\n language: \"Javascript\",\n snippet: `const toastRegionEl = useRef(null);\n const toastEl = useRef(null);\n const handleClick = () => {\n if (toastRegionEl.current && toastEl.current) {\n toastRegionEl.current.openToast = toastEl.current;\n }\n };\n return (\n <>\n {shortCode}\n \n )`,\n },\n ],\n },\n },\n];\n\n## Component demo\n\nexport const DefaultToast = () => {\n const toastRegionEl = useRef(null);\n const toastEl = useRef(null);\n const handleClick = () => {\n toastRegionEl.current.openToast = toastEl.current;\n };\n return (\n <>\n Display toast component\n \n \n \n \n );\n};\n\n\n \n\n\n## Toast region details\n\n\n\n## Toast details\n\n\n\n## Variants\n\n### Displaying toasts\n\nUse the `openToast` prop on the toast region component to display a toast message. Do not use the `setVisible` method on the toast component as this does not work with the toast queuing functionality.\n\n### Queuing toasts\n\nTo view the toasts queuing in the following example, click each button to open a toast and then the dismiss button on the visible toast. Each toast will appear one after the other.\n\nexport const queuingSnippet = [\n {\n technology: \"Web component\",\n snippets: {\n short: `Display default toast\nDisplay error toast\nDisplay auto dismiss toast\n\n \n \n \n`,\n long: `.btn-container {\n display: flex;\n gap: 8px;\n flex-wrap: wrap;\n padding: 16px;\n }\n\n\n
\n Display default toast\n Display error toast\n Display auto dismiss toast\n
\n \n \n \n \n \n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `Display default toast\nDisplay error toast\n\n Display auto dismiss toast\n\n\n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const toastRegionEl = useRef(null);\nconst toastEl = useRef(null);\nconst errorToastEl = useRef(null);\nconst autoDismissToastEl = useRef(null);\nconst handleClick = () => {\n if (toastRegionEl.current && toastEl.current) {\n toastRegionEl.current.openToast = toastEl.current;\n }\n};\nconst handleErrorClick = () => {\n if (toastRegionEl.current && errorToastEl.current) {\n toastRegionEl.current.openToast = errorToastEl.current;\n }\n};\nconst handleAutoDismissClick = () => {\n if (toastRegionEl.current && autoDismissToastEl.current) {\n toastRegionEl.current.openToast = autoDismissToastEl.current;\n }\n};\nconst useStyles = createUseStyles({\n btnContainer: {\n display: \"flex\",\n flexWrap: \"wrap\",\n gap: \"8px\",\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nreturn (\n <>\n
\n Display default toast\n Display error toast\n \n Display auto dismiss toast\n \n
\n \n \n \n \n \n \n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const toastRegionEl = useRef(null);\nconst toastEl = useRef(null);\nconst errorToastEl = useRef(null);\nconst autoDismissToastEl = useRef(null);\nconst handleClick = () => {\n if (toastRegionEl.current && toastEl.current) {\n toastRegionEl.current.openToast = toastEl.current;\n }\n};\nconst handleErrorClick = () => {\n if (toastRegionEl.current && errorToastEl.current) {\n toastRegionEl.current.openToast = errorToastEl.current;\n }\n};\nconst handleAutoDismissClick = () => {\n if (toastRegionEl.current && autoDismissToastEl.current) {\n toastRegionEl.current.openToast = autoDismissToastEl.current;\n }\n};\nconst useStyles = createUseStyles({\n btnContainer: {\n display: \"flex\",\n flexWrap: \"wrap\",\n gap: \"8px\",\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nreturn (\n <>\n
\n Display default toast\n Display error toast\n \n Display auto dismiss toast\n \n
\n \n \n \n \n \n \n)`,\n },\n ],\n },\n },\n];\n\nexport const QueuingToast = () => {\n const toastRegionEl = useRef(null);\n const toastEl = useRef(null);\n const errorToastEl = useRef(null);\n const autoDismissToastEl = useRef(null);\n const handleClick = () => {\n toastRegionEl.current.openToast = toastEl.current;\n };\n const handleErrorClick = () => {\n toastRegionEl.current.openToast = errorToastEl.current;\n };\n const handleAutoDismissClick = () => {\n toastRegionEl.current.openToast = autoDismissToastEl.current;\n };\n return (\n <>\n
\n Display default toast\n Display error toast\n \n Display auto dismiss toast\n \n
\n \n \n \n \n \n \n );\n};\n\n\n \n\n\n### Status variant\n\nexport const withVariantSnippet = [\n {\n technology: \"Web component\",\n snippets: {\n short: `Display success toast\n\n \n`,\n long: `{shortCode}\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `Display success toast\n\n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const toastRegionEl = useRef(null);\nconst toastEl = useRef(null);\nconst handleClick = () => {\n if (toastRegionEl.current && toastEl.current) {\n toastRegionEl.current.openToast = toastEl.current;\n }\n};\nreturn (\n <>\n {shortCode}\n \n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const toastRegionEl = useRef(null);\nconst toastEl = useRef(null);\nconst handleClick = () => {\n if (toastRegionEl.current && toastEl.current) {\n toastRegionEl.current.openToast = toastEl.current;\n }\n};\nreturn (\n <>\n {shortCode}\n \n)`,\n },\n ],\n },\n },\n];\n\nexport const WithVariantToast = () => {\n const toastRegionEl = useRef(null);\n const toastEl = useRef(null);\n const handleClick = () => {\n toastRegionEl.current.openToast = toastEl.current;\n };\n return (\n <>\n Display success toast\n \n \n \n \n );\n};\n\n\n \n\n\n### Multi-line\n\nexport const withMultilineSnippet = [\n {\n technology: \"Web component\",\n snippets: {\n short: `Display multi-line toast\n\n \n`,\n long: `{shortCode}\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `Display multi-line toast\n\n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const toastRegionEl = useRef(null);\nconst toastEl = useRef(null);\nconst handleClick = () => {\n if (toastRegionEl.current && toastEl.current) {\n toastRegionEl.current.openToast = toastEl.current;\n }\n};\nreturn (\n <>\n {shortCode}\n \n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const toastRegionEl = useRef(null);\nconst toastEl = useRef(null);\nconst handleClick = () => {\n if (toastRegionEl.current && toastEl.current) {\n toastRegionEl.current.openToast = toastEl.current;\n }\n};\nreturn (\n <>\n {shortCode}\n \n)`,\n },\n ],\n },\n },\n];\n\nexport const MultilineToast = () => {\n const toastRegionEl = useRef(null);\n const toastEl = useRef(null);\n const handleClick = () => {\n toastRegionEl.current.openToast = toastEl.current;\n };\n return (\n <>\n Display multi-line toast\n \n \n \n \n );\n};\n\n\n \n\n\n### Slotted 'action' toast\n\nexport const slottedActionsSnippet = [\n {\n technology: \"Web component\",\n snippets: {\n short: `Display slotted buttons toast\nDisplay slotted buttons toast\n\n \n Retry\n \n \n Retry\n \n`,\n long: `.btn-container {\n display: flex;\n gap: 8px;\n flex-wrap: wrap;\n padding: 16px;\n }\n \n \n
\n Display slotted buttons toast\n Display slotted buttons toast\n
\n \n \n Retry\n \n \n Retry\n \n \n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `Display slotted button toast\nDisplay slotted link toast\n\n \n Retry\n \n \n Retry\n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const toastRegionEl = useRef(null);\nconst buttonToastEl = useRef(null);\nconst linkToastEl = useRef(null);\nconst handleButtonToastClick = () => {\n if (toastRegionEl.current && buttonToastEl.current) {\n toastRegionEl.current.openToast = buttonToastEl.current;\n }\n};\nconst handleLinkToastClick = () => {\n if (toastRegionEl.current && linkToastEl.current) {\n toastRegionEl.current.openToast = linkToastEl.current;\n }\n};\nconst useStyles = createUseStyles({\n btnContainer: {\n display: \"flex\",\n flexWrap: \"wrap\",\n gap: \"8px\",\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nreturn (\n <>\n
\n \n Display slotted button toast\n \n \n Display slotted link toast\n \n
\n \n \n \n Retry\n \n \n \n \n Retry\n \n \n \n \n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const toastRegionEl = useRef(null);\nconst buttonToastEl = useRef(null);\nconst linkToastEl = useRef(null);\nconst handleButtonToastClick = () => {\n if (toastRegionEl.current && buttonToastEl.current) {\n toastRegionEl.current.openToast = buttonToastEl.current;\n }\n};\nconst handleLinkToastClick = () => {\n if (toastRegionEl.current && linkToastEl.current) {\n toastRegionEl.current.openToast = linkToastEl.current;\n }\n};\nconst useStyles = createUseStyles({\n btnContainer: {\n display: \"flex\",\n flexWrap: \"wrap\",\n gap: \"8px\",\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nreturn (\n <>\n
\n \n Display slotted button toast\n \n \n Display slotted link toast\n \n
\n \n \n \n Retry\n \n \n \n \n Retry\n \n \n \n \n)`,\n },\n ],\n },\n },\n];\n\nexport const SlottedActionsToast = () => {\n const toastRegionEl = useRef(null);\n const buttonToastEl = useRef(null);\n const linkToastEl = useRef(null);\n const handleButtonToastClick = () => {\n toastRegionEl.current.openToast = buttonToastEl.current;\n };\n const handleLinkToastClick = () => {\n toastRegionEl.current.openToast = linkToastEl.current;\n };\n return (\n <>\n
\n \n Display slotted button toast\n \n \n Display slotted link toast\n \n
\n \n \n \n Retry\n \n \n \n \n Retry\n \n \n \n \n );\n};\n\n\n \n\n\n### Auto-dismiss\n\nexport const autoDismissSnippet = [\n {\n technology: \"Web component\",\n snippets: {\n short: `Display auto-dismiss toast\n\n \n`,\n long: `{shortCode}\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `Display auto-dismiss toast\n\n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const toastRegionEl = useRef(null);\nconst toastEl = useRef(null);\nconst handleClick = () => {\n if (toastRegionEl.current && toastEl.current) {\n toastRegionEl.current.openToast = toastEl.current;\n }\n};\nreturn (\n <>\n {shortCode}\n \n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const toastRegionEl = useRef(null);\nconst toastEl = useRef(null);\nconst handleClick = () => {\n if (toastRegionEl.current && toastEl.current) {\n toastRegionEl.current.openToast = toastEl.current;\n }\n};\nreturn (\n <>\n {shortCode}\n \n)`,\n },\n ],\n },\n },\n];\n\nexport const AutoDismissToast = () => {\n const toastRegionEl = useRef(null);\n const toastEl = useRef(null);\n const handleClick = () => {\n toastRegionEl.current.openToast = toastEl.current;\n };\n return (\n <>\n Display auto-dismiss toast\n \n \n \n \n );\n};\n\n\n \n\n\n### Custom neutral icon and aria-labels\n\nexport const customIconAriaLabelsSnippet = [\n {\n technology: \"Web component\",\n snippets: {\n short: `Display auto-dismiss toast\n\n \n \n coffee-outline\n \n \n \n`,\n long: `{shortCode}\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n Display custom icon and aria-label toast\n\n\n \n \n coffee-outline\n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const toastRegionEl = useRef(null);\nconst toastEl = useRef(null);\nconst handleClick = () => {\n if (toastRegionEl.current && toastEl.current) {\n toastRegionEl.current.openToast = toastEl.current;\n }\n};\nreturn (\n <>\n {shortCode}\n \n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const toastRegionEl = useRef(null);\nconst toastEl = useRef(null);\nconst handleClick = () => {\n if (toastRegionEl.current && toastEl.current) {\n toastRegionEl.current.openToast = toastEl.current;\n }\n};\nreturn (\n <>\n {shortCode}\n \n)`,\n },\n ],\n },\n },\n];\n\nexport const CustomIconAriaLabels = () => {\n const toastRegionEl = useRef(null);\n const toastEl = useRef(null);\n const handleClick = () => {\n toastRegionEl.current.openToast = toastEl.current;\n };\n return (\n <>\n \n Display custom icon and aria-labels toast\n \n \n \n \n coffee-outline\n \n \n \n \n \n );\n};\n\n\n \n\n", "path": "/components/toast/code", - "date": "2023-11-09", + "date": "2024-05-02", "title": "Toast", "status": "BETA", "subTitle": "Toasts give brief, non-critical updates about events that happen in an app. Toasts are sometimes called 'snackbars'.", @@ -3970,10 +3970,10 @@ ], "meta": { "relativePath": "components/toasts/code.mdx", - "createdAt": "2024-05-09T10:42:41.955Z", - "lastModified": "2024-05-09T10:42:41.955Z", - "size": 18111, - "formattedSize": "17.7 KB" + "createdAt": "2024-05-21T09:12:11.383Z", + "lastModified": "2024-05-21T09:12:11.383Z", + "size": 28834, + "formattedSize": "28.2 KB" } }, { @@ -4002,8 +4002,8 @@ ], "meta": { "relativePath": "components/toasts/guidance.mdx", - "createdAt": "2024-05-01T14:41:23.665Z", - "lastModified": "2024-05-01T14:41:23.665Z", + "createdAt": "2024-05-13T07:27:37.392Z", + "lastModified": "2024-05-13T07:27:37.392Z", "size": 7215, "formattedSize": "7.0 KB" } @@ -4041,9 +4041,9 @@ }, { "id": "components__toggle-buttons__codex", - "contents": "\nimport {\n IcToggleButton,\n IcToggleButtonGroup,\n SlottedSVG,\n IcBadge,\n} from \"@ukic/react\";\n\n## Component demo\n\nexport const snippetsDefault = [\n {\n language: \"Web component\",\n snippet: `\n`,\n },\n {\n language: \"React\",\n snippet: ` console.log(event.detail.checked)}\n/>`,\n },\n];\n\n\n console.log(event.detail.checked)}\n />\n\n\n## Toggle button details\n\n\n\n## Toggle button group details\n\n\n\n## Variants\n\n### Other states\n\nexport const snippetsOtherStates = [\n {\n language: \"Web component\",\n snippet: `\n\n\n`,\n },\n {\n language: \"React\",\n snippet: `\n\n\n`,\n },\n];\n\n\n \n \n \n \n\n\n### With icon\n\nexport const snippetsWithIcon = [\n {\n language: \"Web component\",\n snippet: `\n \n`,\n },\n {\n language: \"React\",\n snippet: `\n \n \n \n`,\n },\n];\n\n\n \n \n \n \n \n\n\n### Sizing\n\nexport const snippetsSizing = [\n {\n language: \"Web component\",\n snippet: `\n\n`,\n },\n {\n language: \"React\",\n snippet: `\n\n`,\n },\n];\n\n\n \n \n \n\n\n### With badge\n\nexport const snippetsWithBadge = [\n {\n language: \"Web component\",\n snippet: `\n \n`,\n },\n {\n language: \"React\",\n snippet: `\n \n`,\n },\n];\n\n\n \n \n \n\n\n### Dark\n\nexport const snippetsDark = [\n {\n language: \"Web component\",\n snippet: `\n\n`,\n },\n {\n language: \"React\",\n snippet: `\n\n`,\n },\n];\n\n\n \n \n \n\n\n### Light\n\nexport const snippetsLight = [\n {\n language: \"Web component\",\n snippet: `\n\n`,\n },\n {\n language: \"React\",\n snippet: `\n\n`,\n },\n];\n\n\n \n \n \n\n\n### Full width\n\nexport const snippetsFullWidth = [\n {\n language: \"Web component\",\n snippet: `\n \n \n \n \n`,\n },\n {\n language: \"React\",\n snippet: `\n \n \n \n \n`,\n },\n];\n\n\n \n \n \n \n \n \n\n\n### Icon only\n\nexport const snippetsIconOnly = [\n {\n language: \"Web component\",\n snippet: `\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n `,\n },\n {\n language: \"React\",\n snippet: `\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n `,\n },\n];\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n\n### Icon right\n\nexport const snippetsIconRight = [\n {\n language: \"Web component\",\n snippet: ` \n \n \n \n \n \n \n \n \n \n \n`,\n },\n {\n language: \"React\",\n snippet: ` \n \n \n \n \n\n \n \n \n \n \n\n`,\n },\n];\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n\n\n### Icon top\n\nexport const snippetsIconTopGroup = [\n {\n language: \"Web component\",\n snippet: ` \n \n \n \n \n \n \n \n \n \n \n \n`,\n },\n {\n language: \"React\",\n snippet: ` \n \n \n \n \n \n \n \n \n \n \n \n \n `,\n },\n];\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n\n", + "contents": "\nimport {\n IcToggleButton,\n IcToggleButtonGroup,\n SlottedSVG,\n IcBadge,\n} from \"@ukic/react\";\n\n## Component demo\n\nexport const snippetsDefault = [\n {\n technology: \"Web component\",\n snippets: {\n short: ``,\n long: `.toggle-btn-container {\n padding: 16px;\n }\n \n \n
\n {shortCode}\n
\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: ` console.log(event.detail.checked)}\n/>`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n toggleBtnContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n toggleBtnContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n console.log(event.detail.checked)}\n />\n\n\n## Toggle button details\n\n\n\n## Toggle button group details\n\n\n\n## Variants\n\n### Other states\n\nexport const snippetsOtherStates = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n\n\n`,\n long: `.toggle-btn-container {\n display: flex;\n flex-wrap: wrap;\n padding: 16px;\n gap: 8px;\n }\n \n \n
\n {shortCode}\n
`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n\n\n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n toggleBtnContainer: {\n display: \"flex\",\n flexWrap: \"wrap\",\n padding: \"16px\",\n gap: \"8px\",\n },\n});\nconst classes = useStyles();\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n toggleBtnContainer: {\n display: \"flex\",\n flexWrap: \"wrap\",\n padding: \"16px\",\n gap: \"8px\",\n },\n});\nconst classes = useStyles();\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n\n\n### With icon\n\nexport const snippetsWithIcon = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n \n`,\n long: `.toggle-btn-container {\n padding: 16px;\n }\n \n \n
\n {shortCode}\n
`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n toggleBtnContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n toggleBtnContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n \n\n\n### Sizing\n\nexport const snippetsSizing = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n\n`,\n long: `.toggle-btn-container {\n display: flex;\n flex-wrap: wrap;\n padding: 16px;\n gap: 8px;\n }\n \n \n
\n {shortCode}\n
`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n\n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n toggleBtnContainer: {\n display: \"flex\",\n flexWrap: \"wrap\",\n padding: \"16px\",\n gap: \"8px\",\n },\n});\nconst classes = useStyles();\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n toggleBtnContainer: {\n display: \"flex\",\n flexWrap: \"wrap\",\n padding: \"16px\",\n gap: \"8px\",\n },\n});\nconst classes = useStyles();\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n\n\n### With badge\n\nexport const snippetsWithBadge = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n`,\n long: `.toggle-btn-container {\n padding: 16px;\n }\n \n \n
\n {shortCode}\n
`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n toggleBtnContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n toggleBtnContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n\n\n### Dark\n\nexport const snippetsDark = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n\n`,\n long: `.toggle-btn-container {\n display: flex;\n flex-wrap: wrap;\n padding: 16px;\n gap: 8px;\n }\n \n \n
\n {shortCode}\n
`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n\n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n toggleBtnContainer: {\n display: \"flex\",\n flexWrap: \"wrap\",\n padding: \"16px\",\n gap: \"8px\",\n },\n});\nconst classes = useStyles();\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n toggleBtnContainer: {\n display: \"flex\",\n flexWrap: \"wrap\",\n padding: \"16px\",\n gap: \"8px\",\n },\n});\nconst classes = useStyles();\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n\n\n### Light\n\nexport const snippetsLight = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n\n`,\n long: `.dark-background {\n display: flex;\n flex-wrap: wrap;\n background-color: #2c2f34;\n padding: 16px;\n gap: 8px;\n }\n \n \n
\n {shortCode}\n
`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n\n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n darkBackground: {\n display: \"flex\",\n flexWrap: \"wrap\",\n backgroundColor: \"#2c2f34\",\n padding: \"16px\",\n gap: \"8px\",\n },\n});\nconst classes = useStyles();\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n darkBackground: {\n display: \"flex\",\n flexWrap: \"wrap\",\n backgroundColor: \"#2c2f34\",\n padding: \"16px\",\n gap; \"8px\",\n },\n});\nconst classes = useStyles();\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n\n\n### Full width\n\nexport const snippetsFullWidth = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n \n \n`,\n long: `.toggle-btn-container {\n padding: 16px;\n }\n \n \n
\n {shortCode}\n
`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n toggleBtnContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n toggleBtnContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n \n \n\n\n### Icon only\n\nexport const snippetsIconOnly = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n`,\n long: `.toggle-btn-container {\n padding: 16px;\n }\n \n \n
\n {shortCode}\n
`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n toggleBtnContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n toggleBtnContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n\n### Icon right\n\nexport const snippetsIconRight = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n \n \n \n \n \n \n \n \n`,\n long: `.toggle-btn-container {\n padding: 16px;\n }\n \n \n
\n {shortCode}\n
`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n \n \n \n \n \n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n toggleBtnContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n toggleBtnContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n\n\n### Icon top\n\nexport const snippetsIconTopGroup = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n \n \n \n \n \n \n \n \n`,\n long: `.toggle-btn-container {\n padding: 16px;\n }\n \n \n
\n {shortCode}\n
`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n \n \n \n \n \n \n \n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n toggleBtnContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n toggleBtnContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nreturn ( \n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n\n", "path": "/components/toggle-button/code", - "date": "2024-03-08", + "date": "2024-05-02", "title": "Toggle button", "status": "BETA", "subTitle": "Toggle buttons provide an action capable of indicating a state. They are commonly used for turning settings either ‘on’ or ‘off’.", @@ -4064,10 +4064,10 @@ ], "meta": { "relativePath": "components/toggle-buttons/code.mdx", - "createdAt": "2024-05-09T10:42:41.971Z", - "lastModified": "2024-05-09T10:42:41.971Z", - "size": 20281, - "formattedSize": "19.8 KB" + "createdAt": "2024-05-21T09:12:11.383Z", + "lastModified": "2024-05-21T09:12:11.383Z", + "size": 29888, + "formattedSize": "29.2 KB" } }, { @@ -4096,8 +4096,8 @@ ], "meta": { "relativePath": "components/toggle-buttons/guidance.mdx", - "createdAt": "2024-03-22T15:57:13.306Z", - "lastModified": "2024-03-22T15:57:13.306Z", + "createdAt": "2024-05-13T07:27:37.392Z", + "lastModified": "2024-05-13T07:27:37.392Z", "size": 11033, "formattedSize": "10.8 KB" } @@ -4135,9 +4135,9 @@ }, { "id": "components__tooltips__codex", - "contents": "\nimport { IcTooltip, IcButton, IcChip } from \"@ukic/react\";\nimport { useRef } from \"react\";\n\n## Component demo\n\nexport const snippets = [\n {\n language: \"Web component\",\n snippet: `\n Add\n\n\n Remove\n`,\n },\n {\n language: \"React\",\n snippet: `\n Add\n\n\n Remove\n`,\n },\n];\n\n\n
\n \n \n Add\n \n \n \n \n Remove\n \n \n
\n
\n\n## Tooltip details\n\n\n\n## Variants\n\n### Left placement\n\nexport const snippetsLeft = [\n {\n language: \"Web component\",\n snippet: `\n Add\n`,\n },\n {\n language: \"React\",\n snippet: `\n Add\n`,\n },\n];\n\n\n \n \n Add\n \n \n\n\n### Right placement\n\nexport const snippetsRight = [\n {\n language: \"Web component\",\n snippet: ` \n Add\n`,\n },\n {\n language: \"React\",\n snippet: `\n Add\n`,\n },\n];\n\n\n \n \n Add\n \n \n\n\n### Chip\n\nexport const snippetsDefault = [\n {\n language: \"Web component\",\n snippet: ` \n \n \n \n \n \n`,\n },\n {\n language: \"React\",\n snippet: `\n \n \n \n \n \n`,\n },\n];\n\n\n \n \n \n \n \n \n \n\n\n### Programmatic trigger\n\nexport const snippetsProgrammatic = [\n {\n language: \"Web component\",\n snippet: `\nShow tooltip\n\n \n Add\n \n`,\n },\n {\n language: \"React\",\n snippet: `let display = true;\nconst tooltipEl = useRef(null);\nconst handleDisplay = () => {\n tooltipEl.current.displayTooltip(display, display);\n display = !display;\n}\nreturn (\n <>\n Show tooltip\n \n \n Add\n \n \n \n);`,\n },\n];\n\nexport const TriggerExample = () => {\n let display = true;\n const tooltipEl = useRef(null);\n const handleDisplay = () => {\n tooltipEl.current.displayTooltip(display, display);\n display = !display;\n };\n return (\n <>\n Show tooltip\n \n \n Add\n \n \n \n );\n};\n\n\n \n\n", + "contents": "\nimport { IcTooltip, IcButton, IcChip } from \"@ukic/react\";\nimport { useRef, useState } from \"react\";\n\n## Component demo\n\nexport const snippets = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n Add\n \n\n\n \n Remove\n \n`,\n long: `.tooltip-container {\n display: flex; \n flex-direction: column;\n gap: 8px; \n padding: 16px;\n }\n \n \n
\n {shortCode}\n
`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n Add\n \n\n\n \n Remove\n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n tooltipContainer: {\n display: \"flex\", \n flexDirection: \"column\",\n gap: \"8px\", \n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nreturn (\n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n tooltipContainer: {\n display: \"flex\", \n flexDirection: \"column\",\n gap: \"8px\", \n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nreturn (\n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n
\n \n \n Add\n \n \n \n \n Remove\n \n \n
\n
\n\n## Tooltip details\n\n\n\n## Variants\n\n### Left placement\n\nexport const snippetsLeft = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n Add\n \n`,\n long: `.tooltip-container {\n display: flex; \n justify-content: flex-end;\n }\n \n \n
\n {shortCode}\n
`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n Add\n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n tooltipContainer: {\n display: \"flex\",\n justifyContent: \"flex-end\"\n },\n});\nconst classes = useStyles();\nreturn (\n
\n {shortCode}\n
\n)}`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n tooltipContainer: {\n display: \"flex\",\n justifyContent: \"flex-end\"\n },\n});\nconst classes = useStyles();\nreturn (\n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n \n \n Add\n \n \n\n\n### Right placement\n\nexport const snippetsRight = [\n {\n technology: \"Web component\",\n snippets: {\n short: ` \n Add\n`,\n long: `.tooltip-container {\n display: flex; \n justify-content: flex-start;\n }\n \n \n
\n {shortCode}\n
`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n Add\n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n tooltipContainer: {\n display: \"flex\",\n justifyContent: \"flex-start\"\n },\n});\nconst classes = useStyles();\nreturn (\n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n tooltipContainer: {\n display: \"flex\",\n justifyContent: \"flex-start\"\n },\n});\nconst classes = useStyles();\nreturn (\n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\n\n \n \n Add\n \n \n\n\n### Chip\n\nexport const snippetsChip = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n \n \n \n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n \n \n \n\n\n### Programmatic trigger\n\nexport const snippetsProgrammatic = [\n {\n technology: \"Web component\",\n snippets: {\n short: `Show tooltip\n\n \n Add\n \n`,\n long: `{shortCode}\n `,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `Show tooltip\n\n \n Add\n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const [display, setDisplay] = useState(true);\nconst tooltipEl = useRef(null);\nconst handleDisplay = () => {\n tooltipEl.current?.displayTooltip(display, display);\n setDisplay(!display);\n};\nconst useStyles = createUseStyles({\n btnContainer: {\n display: 'flex',\n gap: '8px',\n padding: '16px',\n },\n});\nconst classes = useStyles();\nreturn (\n
\n {shortCode}\n
\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const [display, setDisplay] = useState(true);\nconst tooltipEl = useRef(null);\nconst handleDisplay = () => {\n tooltipEl.current?.displayTooltip(display, display);\n setDisplay(!display);\n};\nconst useStyles = createUseStyles({\n btnContainer: {\n display: 'flex',\n gap: '8px',\n padding: '16px',\n },\n});\nconst classes = useStyles();\nreturn (\n
\n {shortCode}\n
\n)`,\n },\n ],\n },\n },\n];\n\nexport const TriggerExample = () => {\n const [display, setDisplay] = useState(true);\n const tooltipEl = useRef(null);\n const handleDisplay = async () => {\n await tooltipEl.current?.displayTooltip(display, display);\n setDisplay(!display);\n };\n return (\n <>\n Show tooltip\n \n \n Add\n \n \n \n );\n};\n\n\n \n\n", "path": "/components/tooltip/code", - "date": "2024-02-02", + "date": "2024-05-02", "title": "Tooltip", "status": "BETA", "subTitle": "Tooltips provide helpful information when the cursor hovers over an element or when focus is applied.", @@ -4158,10 +4158,10 @@ ], "meta": { "relativePath": "components/tooltips/code.mdx", - "createdAt": "2024-05-09T10:42:41.979Z", - "lastModified": "2024-05-09T10:42:41.979Z", - "size": 7782, - "formattedSize": "7.6 KB" + "createdAt": "2024-05-21T09:12:11.383Z", + "lastModified": "2024-05-21T09:12:11.383Z", + "size": 11999, + "formattedSize": "11.7 KB" } }, { @@ -4190,8 +4190,8 @@ ], "meta": { "relativePath": "components/tooltips/guidance.mdx", - "createdAt": "2024-03-20T09:51:14.418Z", - "lastModified": "2024-03-20T09:51:14.418Z", + "createdAt": "2024-05-13T07:27:37.396Z", + "lastModified": "2024-05-13T07:27:37.396Z", "size": 5536, "formattedSize": "5.4 KB" } @@ -4229,9 +4229,9 @@ }, { "id": "components__top-nav__codex", - "contents": "\nimport {\n IcTopNavigation,\n IcSearchBar,\n IcNavigationButton,\n IcNavigationItem,\n IcNavigationGroup,\n SlottedSVG,\n IcBadge,\n} from \"@ukic/react\";\n\nimport { MemoryRouter, NavLink } from \"react-router-dom\";\n\n## Component demo\n\nexport const snippetsDefault = [\n {\n language: \"Web component\",\n snippet: `\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n`,\n },\n {\n language: \"React\",\n snippet: `\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n`,\n },\n];\n\n\n \n \n \n \n \n \n \n \n \n \n \n e.preventDefault()}\n />\n e.preventDefault()}\n />\n e.preventDefault()}\n />\n e.preventDefault()}\n selected\n />\n e.preventDefault()}\n />\n \n\n\n## Top navigation details\n\n\n\n## Navigation group details\n\n\n\n## Navigation item details\n\n\n\n## Navigation button details\n\n\n\n## Variants\n\n### Grouped links\n\nexport const snippetsGroupedLinks = [\n {\n language: \"Web component\",\n snippet: `\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n`,\n },\n {\n language: \"React\",\n snippet: `\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n`,\n },\n];\n\n\n \n \n \n \n \n \n \n e.preventDefault()}\n />\n e.preventDefault()}\n />\n e.preventDefault()}\n />\n \n \n e.preventDefault()}\n />\n e.preventDefault()}\n />\n \n \n\n\n### Centre aligned\n\nexport const snippetsCentreAligned = [\n {\n language: \"Web component\",\n snippet: `\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n`,\n },\n {\n language: \"React\",\n snippet: `\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n`,\n },\n];\n\n\n \n \n \n \n \n \n \n \n \n \n \n e.preventDefault()}\n />\n e.preventDefault()}\n />\n e.preventDefault()}\n />\n e.preventDefault()}\n selected\n />\n e.preventDefault()}\n />\n \n\n\n### Left aligned\n\nexport const snippetsLeftAligned = [\n {\n language: \"Web component\",\n snippet: `\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n`,\n },\n {\n language: \"React\",\n snippet: `\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n`,\n },\n];\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n e.preventDefault()}\n />\n e.preventDefault()}\n />\n e.preventDefault()}\n />\n e.preventDefault()}\n selected\n />\n e.preventDefault()}\n />\n \n\n\n### With badge on navigation button\n\nexport const snippetsBadge = [\n {\n language: \"Web component\",\n snippet: `\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n`,\n },\n {\n language: \"React\",\n snippet: `\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n`,\n },\n];\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n e.preventDefault()}\n />\n e.preventDefault()}\n />\n e.preventDefault()}\n />\n e.preventDefault()}\n selected\n />\n e.preventDefault()}\n />\n \n\n\n### With short app title\n\nView on a small screen size to display the short title in place of the app title.\n\nexport const snippetsShortTitle = [\n {\n language: \"Web component\",\n snippet: `\n \n \n \n \n \n \n \n \n \n`,\n },\n {\n language: \"React\",\n snippet: `\n \n \n \n \n \n \n \n \n \n`,\n },\n];\n\n\n \n \n \n \n \n e.preventDefault()}\n />\n e.preventDefault()}\n />\n e.preventDefault()}\n />\n e.preventDefault()}\n selected\n />\n e.preventDefault()}\n />\n \n\n\n### With React Router (using slots)\n\nThe following example also demonstrates using a slotted link for app title, short app title, and app icon.\n\nTo guarantee the correct styling for non-svg content slotted into app-icon, set `width`, `height` and `fill` to `inherit`.\n\nexport const withReactRouter = [\n {\n language: \"React\",\n snippet: `\n \n ICDS Title\n ICDS\n \n \n \n \n \n \n \n alert('test')}>\n \n \n \n \n \n \n Get started\n \n \n Accessibility\n \n \n
\n \n \n This is the get started page} />\n This page is about accessibility} />\n \n \n
\n
\n `,\n },\n];\n\n\n \n \n \n ICDS Title\n \n \n ICDS\n \n \n \n \n \n \n \n \n alert(\"test\")}\n >\n \n \n \n \n \n \n \n Get started\n \n \n \n \n Accessibility\n \n \n \n \n\n", + "contents": "\nimport {\n IcTopNavigation,\n IcSearchBar,\n IcNavigationButton,\n IcNavigationItem,\n IcNavigationGroup,\n SlottedSVG,\n IcBadge,\n IcButton,\n} from \"@ukic/react\";\n\nimport { MemoryRouter, NavLink } from \"react-router-dom\";\nimport { useState } from \"react\";\n\n## Component demo\n\nexport const snippetsDefault = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n`,\n long: [\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n \n \n \n \n \n \n \n e.preventDefault()}\n />\n e.preventDefault()}\n />\n e.preventDefault()}\n />\n e.preventDefault()}\n selected\n />\n e.preventDefault()}\n />\n \n\n\n## Top navigation details\n\n\n\n## Navigation group details\n\n\n\n## Navigation item details\n\n\n\n## Navigation button details\n\n\n\n## Variants\n\n### Grouped links\n\nexport const snippetsGroupedLinks = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n \n \n \n e.preventDefault()}\n />\n e.preventDefault()}\n />\n e.preventDefault()}\n />\n \n \n e.preventDefault()}\n />\n e.preventDefault()}\n />\n \n \n\n\n### Centre aligned\n\nexport const snippetsCentreAligned = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n \n \n alert('test')}\n >\n \n \n \n \n \n \n \n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n \n \n \n \n \n \n \n e.preventDefault()}\n />\n e.preventDefault()}\n />\n e.preventDefault()}\n />\n e.preventDefault()}\n selected\n />\n e.preventDefault()}\n />\n \n\n\n### Left aligned\n\nexport const snippetsLeftAligned = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n \n \n \n alert('test')}\n >\n \n \n \n \n \n \n \n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n e.preventDefault()}\n />\n e.preventDefault()}\n />\n e.preventDefault()}\n />\n e.preventDefault()}\n selected\n />\n e.preventDefault()}\n />\n \n\n\n### With badge on navigation button\n\nexport const snippetsBadge = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n e.preventDefault()}\n />\n e.preventDefault()}\n />\n e.preventDefault()}\n />\n e.preventDefault()}\n selected\n />\n e.preventDefault()}\n />\n \n\n\n### With short app title\n\nView on a small screen size to display the short title in place of the app title.\n\nexport const snippetsShortTitle = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n \n \n \n \n \n \n \n \n \n`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n \n \n \n \n \n \n \n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n \n \n e.preventDefault()}\n />\n e.preventDefault()}\n />\n e.preventDefault()}\n />\n e.preventDefault()}\n selected\n />\n e.preventDefault()}\n />\n \n\n\n### Conditional tabs\n\nexport const ConditionalTabsExample = () => {\n const [showTabs, setShowTabs] = useState(false);\n return (\n <>\n \n \n \n \n \n \n \n \n {showTabs && (\n <>\n \n \n \n )}\n \n setShowTabs(!showTabs)}>Show/Hide tabs\n \n );\n};\n\nexport const conditionalTabs = [\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n \n \n \n \n \n {showTabs && (\n <>\n \n \n \n )}\n`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const [showTabs, setShowTabs] = useState(false);\nreturn (\n <>\n {shortCode}\n setShowTabs(!showTabs)}>Show/Hide tabs\n \n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const [showTabs, setShowTabs] = useState(false);\nreturn (\n <>\n {shortCode}\n setShowTabs(!showTabs)}>Show/Hide tabs\n \n)`,\n },\n ],\n },\n },\n];\n\n\n \n\n\n### With React Router (using slots)\n\nThe following examples also demonstrate using a slotted link for app title, short app title, and app icon.\n\nTo guarantee the correct styling for non-svg content slotted into app-icon, set `width`, `height` and `fill` to `inherit`.\n\nexport const withReactRouter = [\n {\n technology: \"React\",\n snippets: {\n short: `\n \n \n ICDS Title\n \n \n ICDS\n \n \n \n \n \n \n \n \n alert(\"test\")}\n >\n \n \n \n \n \n \n \n Get started\n \n \n \n \n Accessibility\n \n \n \n
\n \n \n This is the get started page\n }\n />\n This page is about accessibility\n }\n />\n \n \n
\n
`,\n long: [\n {\n language: \"Typescript\",\n snippet: `const useStyles = createUseStyles({\n sectionContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nreturn (\n {shortCode}\n)`,\n },\n {\n language: \"Javascript\",\n snippet: `const useStyles = createUseStyles({\n sectionContainer: {\n padding: \"16px\",\n },\n});\nconst classes = useStyles();\nreturn (\n {shortCode}\n)}`,\n },\n ],\n },\n },\n];\n\n\n \n \n \n ICDS Title\n \n \n ICDS\n \n \n \n \n \n \n \n \n alert(\"test\")}\n >\n \n \n \n \n \n \n \n Get started\n \n \n \n \n Accessibility\n \n \n \n \n\n", "path": "/components/top-navigation/code", - "date": "2024-02-02", + "date": "2024-05-02", "title": "Top navigation", "status": "BETA", "subTitle": "Top navigation sits across the top of the page. It includes the app name, search bar, main navigation and secondary links.", @@ -4252,15 +4252,15 @@ ], "meta": { "relativePath": "components/top-nav/code.mdx", - "createdAt": "2024-05-09T10:42:42.003Z", - "lastModified": "2024-05-09T10:42:42.003Z", - "size": 34621, - "formattedSize": "33.8 KB" + "createdAt": "2024-05-21T09:47:02.295Z", + "lastModified": "2024-05-21T09:47:02.295Z", + "size": 40953, + "formattedSize": "40.0 KB" } }, { "id": "components__top-nav__guidancex", - "contents": "\nimport {\n IcTopNavigation,\n IcSearchBar,\n IcNavigationItem,\n IcNavigationGroup,\n} from \"@ukic/react\";\nimport topNavFig1 from \"./images/fig-1-dont-use-both-side-and-top-navigation.png\";\nimport topNavFig2 from \"./images/fig-2-show-status-version-and-secondary-links.png\";\nimport topNavFig3 from \"./images/fig-3-top-nav-with-megamenu.png\";\nimport topNavFig4 from \"./images/fig-4-use-drawer-navigation-on-small-screens.png\";\nimport topNavFig5 from \"./images/fig-5-personality-colours.png\";\nimport topNavFig6 from \"./images/fig-6-dont-position-top-nav-not-full-width.png\";\nimport topNavFig7 from \"./images/fig-7-use-full-width-alignment.png\";\nimport topNavFig8 from \"./images/fig-8-use-centre-alignment.png\";\nimport topNavFig9 from \"./images/fig-9-dont-use-long-labels.png\";\nimport topNavFig10 from \"./images/fig-10-megamenu-with-too-many-links.png\";\n\n## Component variants\n\nTop navigation has two variants: standard and one with a mega-menu.\n\n### Standard\n\nUse a standard top navigation for apps with eight or fewer navigation options.\n\n\n \n \n \n \n \n \n e.preventDefault()}\n />\n e.preventDefault()}\n />\n e.preventDefault()}\n />\n e.preventDefault()}\n selected=\"true\"\n />\n e.preventDefault()}\n />\n \n\n\n### With mega-menu\n\nUse a top navigation with mega-menu for apps with more than eight navigation options, or options that can be grouped into categories. The main link groups are displayed in the top navigation and open a mega-menu when hovered over or focused.\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n\n## When to use\n\nUse the top navigation component for intranet-style and content heavy apps. Use it for apps with complex page structures where every page should be accessible from any other page using the mega-menu.\n\nUse top navigation alongside additional components like [page headers](/components/page-header) to create a variety of different [layout](/styles/layout-spacing) and navigation styles.\n\n## When not to use\n\nFor apps with a small number of pages, use [side navigation](/components/side-navigation) as it's better suited for providing quick access and maximising the screen space for page content.\n\nUse either top navigation or side navigation. Don't use both at the same time.\n\n\n\n## Optional elements\n\n### Search bar\n\nInclude an optional [search bar](/components/search-bar) to provide search functionality on every page in the app.\n\n### Secondary links\n\nInclude secondary links or actions that appear on the right-hand side of the top navigation. Use these for global utilities like application settings, or as links to other related sites.\n\n### App status and version\n\nUse the title adornment and app version to display the app's info in the top navigation.\n\n\n\n## Interaction behaviour\n\nWhen using a top navigation with mega-menu, the menu is displayed when hovering over, or focusing on, the main navigation groups.\n\n\n\nOn smaller screens, both top navigation variants will display a menu button that opens a drawer menu from the right-hand side of the screen. The drawer menu can display lists of single links or grouped links that can be expanded and collapsed.\n\n\n\n## Colour\n\nThe top navigation uses the app's [theme colour](/styles/colour/#theme) as the background and automatically sets the foreground colour to ensure accessible contrast ratios.\n\nChange the app's theme colour to change the background colour of the top navigation and help distinguish your app from others your users may use.\n\n\n\n## Sizing\n\nAlways position the top navigation at the top of the screen and make sure that it horizontally fills the browser window.\n\n\n\n## Layout and placement\n\n### Alignment\n\nAlign the top navigation's content either full width or centred.\n\nUse full width alignment to position the top navigation content to the left and right of the browser window.\n\n\n\nUse centre alignment to position the top navigation content in line with other page content.\n\n\n\n## Content\n\n### Labels and icons\n\nFollow the [content style guidelines](/styles/content-style) for all navigation option labels as well as each option group label.\n\nFollow the [icon style guidelines](/styles/icons) when selecting icons for menu options or secondary links.\n\n### Navigation options\n\nMake sure to keep navigation option labels concise, as they may not all fit within the top navigation on all screen sizes.\n\nFor the standard variant, don't use more than eight links as this may not display correctly.\n\n\n\n### Mega-menu\n\nInclude up to five columns of navigation links in the mega-menu and aim to keep the number of links in each column to six or fewer.\n\n\n", + "contents": "\nimport {\n IcTopNavigation,\n IcSearchBar,\n IcNavigationItem,\n IcNavigationGroup,\n} from \"@ukic/react\";\nimport topNavFig1 from \"./images/fig-1-dont-use-both-side-and-top-navigation.png\";\nimport topNavFig2 from \"./images/fig-2-show-status-version-and-secondary-links.png\";\nimport topNavFig3 from \"./images/fig-3-top-nav-with-megamenu.png\";\nimport topNavFig4 from \"./images/fig-4-use-drawer-navigation-on-small-screens.png\";\nimport topNavFig5 from \"./images/fig-5-personality-colours.png\";\nimport topNavFig6 from \"./images/fig-6-dont-position-top-nav-not-full-width.png\";\nimport topNavFig7 from \"./images/fig-7-use-full-width-alignment.png\";\nimport topNavFig8 from \"./images/fig-8-use-centre-alignment.png\";\nimport topNavFig9 from \"./images/fig-9-dont-use-long-labels.png\";\nimport topNavFig10 from \"./images/fig-10-megamenu-with-too-many-links.png\";\n\n## Component variants\n\nTop navigation has two variants: standard and one with a mega-menu.\n\n### Standard\n\nUse a standard top navigation for apps with eight or fewer navigation options.\n\n\n \n \n \n \n \n \n e.preventDefault()}\n />\n e.preventDefault()}\n />\n e.preventDefault()}\n />\n e.preventDefault()}\n selected=\"true\"\n />\n e.preventDefault()}\n />\n \n\n\n### With mega-menu\n\nUse a top navigation with mega-menu for apps with more than eight navigation options, or options that can be grouped into categories. The main link groups are displayed in the top navigation and open a mega-menu when hovered over or focused.\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n\n## When to use\n\nUse the top navigation component for intranet-style and content heavy apps. Use it for apps with complex page structures where every page should be accessible from any other page using the mega-menu.\n\nUse top navigation alongside additional components like [page headers](/components/page-header) to create a variety of different [layout](/styles/layout-spacing) and navigation styles.\n\n## When not to use\n\nFor apps with a small number of pages, use [side navigation](/components/side-navigation) as it's better suited for providing quick access and maximising the screen space for page content.\n\nUse either top navigation or side navigation. Don't use both at the same time.\n\n\n\n## Optional elements\n\n### Search bar\n\nInclude an optional [search bar](/components/search-bar) to provide search functionality on every page in the app.\n\n### Secondary links\n\nInclude secondary links or actions that appear on the right-hand side of the top navigation. Use these for global utilities like application settings, or as links to other related sites.\n\n### App status and version\n\nUse the title adornment and app version to display the app's info in the top navigation.\n\n\n\n## Interaction behaviour\n\nWhen using a top navigation with mega-menu, the menu is displayed when hovering over, or focusing on, the main navigation groups.\n\n\n\nOn smaller screens, both top navigation variants will display a menu button that opens a drawer menu from the right-hand side of the screen. The drawer menu can display lists of single links or grouped links that can be expanded and collapsed.\n\n\n\n## Colour\n\nThe top navigation uses the app's [theme colour](/styles/colour/#theme) as the background and automatically sets the foreground colour to ensure accessible contrast ratios.\n\nChange the app's theme colour to change the background colour of the top navigation and help distinguish your app from others your users may use.\n\n\n\n## Sizing\n\nAlways position the top navigation at the top of the screen and make sure that it horizontally fills the browser window.\n\n\n\n## Layout and placement\n\n### Alignment\n\nAlign the top navigation's content either full width or centred.\n\nUse full width alignment to position the top navigation content to the left and right of the browser window.\n\n\n\nUse centre alignment to position the top navigation content in line with other page content.\n\n\n\n## Content\n\n### Labels and icons\n\nFollow the [content style guidelines](/styles/content-style) for all navigation option labels as well as each option group label.\n\nFollow the [icon style guidelines](/styles/icons) when selecting icons for menu options or secondary links.\n\n### Navigation options\n\nMake sure to keep navigation option labels concise, as they may not all fit within the top navigation on all screen sizes.\n\nFor the standard variant, don't use more than eight links as this may not display correctly.\n\n\n\n### Mega-menu\n\nInclude up to five columns of navigation links in the mega-menu and aim to keep the number of links in each column to six or fewer.\n\n\n", "path": "/components/top-navigation", "navPriority": 39, "date": "2023-02-03", @@ -4284,9 +4284,9 @@ ], "meta": { "relativePath": "components/top-nav/guidance.mdx", - "createdAt": "2024-05-09T10:42:42.003Z", - "lastModified": "2024-05-09T10:42:42.003Z", - "size": 11248, + "createdAt": "2024-05-21T09:12:11.383Z", + "lastModified": "2024-05-21T09:12:11.383Z", + "size": 11240, "formattedSize": "11.0 KB" } }, @@ -4324,9 +4324,9 @@ }, { "id": "components__typography__codex", - "contents": "\nimport { IcTypography } from \"@ukic/react\";\n\n## Component demo\n\nexport const snippets = [\n {\n language: \"Web component\",\n snippet: `H1\nH2\nH3\nH4\nBody\nSubtitle large\nSubtitle small\nLabel\nLabel uppercase\nCaption\nCaption uppercase\nCode large\nCode small\nCode extra small`,\n },\n {\n language: \"React\",\n snippet: `H1\nH2\nH3\nH4\nBody\nSubtitle large\nSubtitle small\nLabel\nLabel uppercase\nCaption\nCaption uppercase\nCode large\nCode small\nCode extra small`,\n },\n];\n\n\n
\n H1\n H2\n H3\n H4\n Body\n Subtitle large\n Subtitle small\n Label\n Label uppercase\n Caption\n Caption uppercase\n Code large\n Code small\n Code extra small\n
\n
\n\n## Typography details\n\n\n\n## Variants\n\n### Re-styled typography\n\nAdd a variant to the typography element to change its style. This does not change the semantic level of the typography element.\n\nexport const snippetsRestyled = [\n {\n language: \"Web component\",\n snippet: `\n
H5 with H2 styling
\n
`,\n },\n {\n language: \"React\",\n snippet: `\n
H5 with H2 styling
\n
`,\n },\n];\n\n\n \n
H5 with H2 styling
\n
\n
\n\n### Vertical margins applied\n\nexport const spacingSnippets = [\n {\n language: \"Web component\",\n snippet: `\n
H5 with margins applied
\n
`,\n },\n {\n language: \"React\",\n snippet: `\n
H5 with margins applied
\n
`,\n },\n];\n\n\n \n
H5 with margins applied
\n
\n
\n\n### Vertical margins applied on re-styled typography\n\nexport const spacingRestyledSnippets = [\n {\n language: \"Web component\",\n snippet: `\n
H5 with H2 styling and margins applied
\n
`,\n },\n {\n language: \"React\",\n snippet: `\n
H5 with H2 styling and margins applied
\n
`,\n },\n];\n\n\n \n
H5 with H2 styling and margins applied
\n
\n
\n\n### Truncation\n\nText can be truncated to a maximum number of lines when using `variant=\"body\"`.\n\nexport const truncationSnippets = [\n {\n language: \"Web component\",\n snippet: `\n Body of text that is truncated to three lines. Click the 'See more' link\n to expand the text, then click 'See less' to truncate the text once\n more!\n
\n Dripper caramelization java saucer grounds galão, mocha, and robusta\n kopi-luwak, percolator, instant, qui saucer latte in brewed café au\n lait. Con panna, cup, cream, body americano affogato cup espresso, rich\n milk seasonal saucer grinder spoon that cultivar strong redeye\n frappuccino barista extraction redeye mazagran. Grounds, french press\n dripper organic and foam id saucer, crema, black rich dark, grounds\n breve coffee steamed caramelization percolator.\n
`,\n },\n {\n language: \"React\",\n snippet: `\n Body of text that is truncated to three lines. Click the 'See more' link\n to expand the text, then click 'See less' to truncate the text once\n more!\n
\n Dripper caramelization java saucer grounds galão, mocha, and robusta\n kopi-luwak, percolator, instant, qui saucer latte in brewed café au\n lait. Con panna, cup, cream, body americano affogato cup espresso, rich\n milk seasonal saucer grinder spoon that cultivar strong redeye\n frappuccino barista extraction redeye mazagran. Grounds, french press\n dripper organic and foam id saucer, crema, black rich dark, grounds\n breve coffee steamed caramelization percolator.\n
`,\n },\n];\n\n\n \n Body of text that is truncated to three lines. Click the 'See more' link to\n expand the text, then click 'See less' to truncate the text once more!\n
\n Dripper caramelization java saucer grounds galão, mocha, and robusta\n kopi-luwak, percolator, instant, qui saucer latte in brewed café au lait.\n Con panna, cup, cream, body americano affogato cup espresso, rich milk\n seasonal saucer grinder spoon that cultivar strong redeye frappuccino\n barista extraction redeye mazagran. Grounds, french press dripper organic\n and foam id saucer, crema, black rich dark, grounds breve coffee steamed\n caramelization percolator.\n
\n
\n\n### Additional styling\n\nexport const additionalStylingSnippets = [\n {\n language: \"Web component\",\n snippet: `Bold\nItalic\nUnderline\nStrikethrough`,\n },\n {\n language: \"React\",\n snippet: `Bold\nItalic\nUnderline\nStrikethrough`,\n },\n];\n\n\n
\n \n Bold\n \n \n Italic\n \n \n Underline\n \n \n Strikethrough\n \n
\n
\n", + "contents": "\nimport { IcTypography } from \"@ukic/react\";\n\n## Component demo\n\nexport const snippets = [\n {\n technology: \"Web component\",\n snippets: {\n short: `

H1

\n

H2

\n

H3

\n

H4

\nBody\nSubtitle large\nSubtitle small\nLabel\nLabel uppercase\nCaption\nCaption uppercase\nCode large\nCode small\nCode extra small`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `H1\n

H2

\n

H3

\n

H4

\nBody\nSubtitle large\nSubtitle small\nLabel\nLabel uppercase\nCaption\nCaption uppercase\nCode large\nCode small\nCode extra small`,\n long: [\n {\n language: \"Typescript\",\n snippet: `<>\n {shortCode}\n `,\n },\n {\n language: \"Javascript\",\n snippet: `<>\n {shortCode}\n `,\n },\n ],\n },\n },\n];\n\n\n
\n \n

H1

\n
\n \n

H2

\n
\n \n

H3

\n
\n \n

H4

\n
\n Body\n Subtitle large\n Subtitle small\n Label\n Label uppercase\n Caption\n Caption uppercase\n Code large\n Code small\n Code extra small\n
\n
\n\n## Typography details\n\n\n\n## Variants\n\n### Re-styled typography\n\nAdd a variant to the typography element to change its style. This does not change the semantic level of the typography element.\n\nexport const snippetsRestyled = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n
H5 with H2 styling
\n
`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n
H5 with H2 styling
\n
`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n
H5 with H2 styling
\n
\n
\n\n### Vertical margins applied\n\nexport const spacingSnippets = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n
H5 with margins applied
\n
`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n
H5 with margins applied
\n
`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n
H5 with margins applied
\n
\n
\n\n### Vertical margins applied on re-styled typography\n\nexport const spacingRestyledSnippets = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n
H5 with H2 styling and margins applied
\n
`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n
H5 with H2 styling and margins applied
\n
`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n
H5 with H2 styling and margins applied
\n
\n
\n\n### Truncation\n\nText can be truncated to a maximum number of lines when using `variant=\"body\"`.\n\nexport const truncationSnippets = [\n {\n technology: \"Web component\",\n snippets: {\n short: `\n Body of text that is truncated to three lines. Click the 'See more' link\n to expand the text, then click 'See less' to truncate the text once\n more!\n
\n Dripper caramelization java saucer grounds galão, mocha, and robusta\n kopi-luwak, percolator, instant, qui saucer latte in brewed café au\n lait. Con panna, cup, cream, body americano affogato cup espresso, rich\n milk seasonal saucer grinder spoon that cultivar strong redeye\n frappuccino barista extraction redeye mazagran. Grounds, french press\n dripper organic and foam id saucer, crema, black rich dark, grounds\n breve coffee steamed caramelization percolator.\n
`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `\n Body of text that is truncated to three lines. Click the 'See more' link\n to expand the text, then click 'See less' to truncate the text once\n more!\n
\n Dripper caramelization java saucer grounds galão, mocha, and robusta\n kopi-luwak, percolator, instant, qui saucer latte in brewed café au\n lait. Con panna, cup, cream, body americano affogato cup espresso, rich\n milk seasonal saucer grinder spoon that cultivar strong redeye\n frappuccino barista extraction redeye mazagran. Grounds, french press\n dripper organic and foam id saucer, crema, black rich dark, grounds\n breve coffee steamed caramelization percolator.\n
`,\n long: [\n {\n language: \"Typescript\",\n snippet: `{shortCode}`,\n },\n {\n language: \"Javascript\",\n snippet: `{shortCode}`,\n },\n ],\n },\n },\n];\n\n\n \n Body of text that is truncated to three lines. Click the 'See more' link to\n expand the text, then click 'See less' to truncate the text once more!\n
\n Dripper caramelization java saucer grounds galão, mocha, and robusta\n kopi-luwak, percolator, instant, qui saucer latte in brewed café au lait.\n Con panna, cup, cream, body americano affogato cup espresso, rich milk\n seasonal saucer grinder spoon that cultivar strong redeye frappuccino\n barista extraction redeye mazagran. Grounds, french press dripper organic\n and foam id saucer, crema, black rich dark, grounds breve coffee steamed\n caramelization percolator.\n
\n
\n\n### Additional styling\n\nexport const additionalStylingSnippets = [\n {\n technology: \"Web component\",\n snippets: {\n short: `Bold\nItalic\nUnderline\nStrikethrough`,\n long: `{shortCode}`,\n },\n },\n {\n technology: \"React\",\n snippets: {\n short: `Bold\nItalic\nUnderline\nStrikethrough`,\n long: [\n {\n language: \"Typescript\",\n snippet: `<>\n {shortCode}\n `,\n },\n {\n language: \"Javascript\",\n snippet: `<>\n {shortCode}\n `,\n },\n ],\n },\n },\n];\n\n\n
\n \n

Bold

\n
\n \n

Italic

\n
\n \n

Underline

\n
\n \n

Strikethrough

\n
\n
\n
\n", "path": "/components/typography/code", - "date": "2023-11-27", + "date": "2024-05-02", "title": "Typography", "status": "BETA", "subTitle": "Use the typography component for consistent styling across typographical elements.", @@ -4348,10 +4348,10 @@ ], "meta": { "relativePath": "components/typography/code.mdx", - "createdAt": "2024-05-09T10:42:42.007Z", - "lastModified": "2024-05-09T10:42:42.007Z", - "size": 8635, - "formattedSize": "8.4 KB" + "createdAt": "2024-05-21T09:12:11.383Z", + "lastModified": "2024-05-21T09:12:11.383Z", + "size": 10594, + "formattedSize": "10.3 KB" } }, { @@ -4381,8 +4381,8 @@ ], "meta": { "relativePath": "components/typography/guidance.mdx", - "createdAt": "2024-03-20T09:51:14.418Z", - "lastModified": "2024-03-20T09:51:14.418Z", + "createdAt": "2024-05-13T07:27:37.396Z", + "lastModified": "2024-05-13T07:27:37.396Z", "size": 2180, "formattedSize": "2.1 KB" } @@ -4840,7 +4840,7 @@ }, { "id": "patterns__side-navigation-layoutx", - "contents": "\nimport { IcLink } from \"@ukic/react\";\nimport {\n createReactAppTsx,\n createWebComponentsIndexHTML,\n} from \"./components/StackblitzButton/stackblitz-helpers\";\nimport sideNavigationPatternFig1 from \"./images/fig-1-example-of-theming-applied-to-side-navigation-layout.png\";\n\n## Introduction\n\nexport const snippetsSideNav = [\n {\n language: \"Web component\",\n snippet: createWebComponentsIndexHTML(`
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n \n
\n \n

Example heading

\n
\n \n

Example sub-heading

\n
\n \n

\n Remove this div and add your custom content in\n ic-section-container.\n

\n
\n
\n
\n
\n \n [footerLink]\n [footerLink]\n [footerLink]\n [footerLink]\n [footerLink]\n \n \n \n \n \n \n
\n
`),\n },\n {\n language: \"React\",\n snippet: createReactAppTsx(\n `const useStyles = createUseStyles({\n contentDivContainer: {\n display: \"flex\",\n flexDirection: \"column\",\n flexGrow: \"1\",\n },\n mainContentDiv: {\n border: \"var(--ic-border-width) dashed var(--ic-architectural-400)\",\n padding: \"var(--ic-space-md)\",\n height: \"800px\",\n },\n parentDiv: { display: \"flex\", height: \"100%\" },\n main: { minHeight: \"100vh\" },\n });\n const classes = useStyles();\n const alignment = \"center\";\n return (\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n \n
\n \n

Example heading

\n
\n \n

Example sub-heading

\n
\n \n

\n Remove this div and add your custom content in\n IcSectionContainer.\n

\n
\n
\n
\n
\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n \n \n \n \n \n
\n
)`,\n \"SideNavigationPattern\",\n \"jsx\",\n true\n ),\n },\n];\n\n\n \n View example in new window\n \n\n\nThis pattern includes the components:\n\n- [Side navigation](/components/side-navigation)\n- [Section container](/components/section-container)\n- [Footer](/components/footer)\n- [Classification banner](/components/classification-banner)\n\nWith options for:\n\n- [Page header](/components/page-header)\n- [Back to top](/components/back-to-top)\n\n## When to use\n\nWhen choosing a layout pattern, make sure it works for all pages within your app and avoid switching layout patterns on different pages.\n\nUse the side navigation layout to help provide more screen space for main content. Side navigation is well suited to apps that have mutually exclusive features which need to be switched between easily from any page. For example, email providers often use side navigation to provide maximum screen space to email content whilst allowing constant access to other pages.\n\n## When not to use\n\nFor intranet-style and content heavy apps, use the top navigation layout as it's better suited for providing links to a large number of pages.\n\nUse either the top navigation layout or the side navigation layout. Don't use both at the same time.\n\n## Implementation\n\nMake sure the pattern always fits the entire viewport and is never within another page container. The pattern content will adapt responsively when the viewport changes.\n\nAlways place the footer at the bottom of the page and below the fold meaning users should scroll to see it.\n\n## Variants\n\nUse the side navigation layout with additional components including page header to create other common layouts.\n\n### Page header\n\nUse a page header to display an introduction to the content of the page. Add additional elements to provide actions, navigation or inputs at the page level.\n\nFor more information, see the [page header component](/components/page-header).\n\nexport const snippetsSideNavWithPageHeader = [\n {\n language: \"Web component\",\n snippet: createWebComponentsIndexHTML(`
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n Primary button\n \n Tertiary button\n
\n \n Submit\n
\n \n
\n \n
\n \n

Example heading

\n
\n \n

Example sub-heading

\n
\n \n

\n Remove this div and add your custom content in ic-section-container.\n

\n
\n
\n
\n
\n \n [footerLink]\n [footerLink]\n [footerLink]\n [footerLink]\n [footerLink]\n \n \n \n \n \n \n
\n
`),\n },\n {\n language: \"React\",\n snippet: createReactAppTsx(\n `const useStyles = createUseStyles({\n contentDivContainer: {\n display: \"flex\",\n flexDirection: \"column\",\n flexGrow: \"1\",\n },\n mainContentDiv: {\n border: \"var(--ic-border-width) dashed var(--ic-architectural-400)\",\n padding: \"var(--ic-space-md)\",\n height: \"800px\",\n },\n parentDiv: { display: \"flex\", height: \"100%\" },\n main: { minHeight: \"100vh\" },\n inputArea: {\n display: \"flex\",\n flexWrap: \"wrap\",\n gap: \"var(--ic-space-md)\",\n \"@media screen and (max-width: 320px)\": {\n gap: \"var(--ic-space-xs)\",\n },\n },\n textField: {\n \"--input-width\": \"21.5rem\",\n \"@media screen and (max-width: 768px)\": {\n \"--input-width\": \"100%\",\n flex: \"1 1 0\",\n },\n },\n });\n const classes = useStyles();\n const alignment = \"center\";\n const pageHeaderAlignment = \"center\";\n return (\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n \n \n \n \n \n \n \n \n \n \n \n Primary button\n \n \n Tertiary button\n \n
\n \n Submit\n
\n \n
\n \n
\n \n

Example heading

\n
\n \n

Example sub-heading

\n
\n \n

\n Remove this div and add your custom content in\n IcSectionContainer.\n

\n
\n
\n
\n
\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n \n \n \n \n \n
\n
\n )`,\n \"SideNavigationWithPageHeaderPattern\",\n \"jsx\",\n true\n ),\n },\n];\n\n\n \n View example in new window\n \n\n\n### Back to top\n\nUse the back to top component to help people quickly return to the top of a long page.\n\nConsider using it on all apps to improve usability for everyone, including keyboard-only and some assistive technology users.\n\nDon't use back to top when the page is designed to fill the viewport without scrolling.\n\nFor more information, see the [back to top component](/components/back-to-top).\n\nexport const snippetsSideNavBackToTop = [\n {\n language: \"Web component\",\n snippet: createWebComponentsIndexHTML(`
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n \n
\n \n

Example heading

\n
\n \n

Example sub-heading

\n
\n \n

\n Remove this div and add your custom content in ic-section-container.\n

\n
\n
\n
\n
\n \n \n [footerLink]\n [footerLink]\n [footerLink]\n [footerLink]\n [footerLink]\n \n \n \n \n \n \n
\n
`),\n },\n {\n language: \"React\",\n snippet: createReactAppTsx(\n `const useStyles = createUseStyles({\n contentDivContainer: {\n display: \"flex\",\n flexDirection: \"column\",\n flexGrow: \"1\",\n },\n mainContentDiv: {\n border: \"var(--ic-border-width) dashed var(--ic-architectural-400)\",\n padding: \"var(--ic-space-md)\",\n flex: 1,\n },\n parentDiv: { display: \"flex\", height: \"100%\" },\n main: { minHeight: \"100vh\", display: \"flex\" },\n mainSectionContainer: { display: \"flex\", flex: 1 },\n });\n const classes = useStyles();\n const alignment = \"center\";\n return (\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n \n
\n \n

Example heading

\n
\n \n

Example sub-heading

\n
\n \n

\n Remove this div and add your custom content in\n IcSectionContainer.\n

\n
\n
\n \n
\n \n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n \n \n \n \n \n
\n
\n )`,\n \"SideNavigationWithBackToTopPattern\",\n \"jsx\",\n true\n ),\n },\n];\n\n\n \n View example in new window\n \n\n\n## Customisation\n\nThis pattern can be themed to change the look and feel of the app. Use the [custom theme](/get-started/install-components/custom-theme) guidance to change your app's theme. Make sure to select your theme in line with the accessibility requirements around colour contrast.\n\n\n\n## Accessibility considerations\n\nWhen configuring a page make sure to follow all [accessibility guidance](/accessibility). Most accessibility requirements are covered by the individual components. For further accessibility information see the individual component pages.\n\nWe’ve tested this pattern against WCAG 2.1 Level AA. It’s been tested with NVDA and VoiceOver, and several different users with different interaction methods.\n\n## Related patterns\n\n- [Top navigation layout](/patterns/navigation-patterns/top-navigation-layout)\n", + "contents": "\nimport { IcLink } from \"@ukic/react\";\nimport {\n createReactAppTsx,\n createWebComponentsIndexHTML,\n} from \"./components/StackblitzButton/stackblitz-helpers\";\nimport sideNavigationPatternFig1 from \"./images/fig-1-example-of-theming-applied-to-side-navigation-layout.png\";\n\n## Introduction\n\nexport const snippetsSideNav = [\n {\n technology: \"Web component\",\n snippets: createWebComponentsIndexHTML(`
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n \n
\n \n

Example heading

\n
\n \n

Example sub-heading

\n
\n \n

\n Remove this div and add your custom content in\n ic-section-container.\n

\n
\n
\n
\n
\n \n [footerLink]\n [footerLink]\n [footerLink]\n [footerLink]\n [footerLink]\n \n \n \n \n \n \n
\n
`),\n },\n {\n technology: \"React\",\n snippets: createReactAppTsx(\n `const useStyles = createUseStyles({\n contentDivContainer: {\n display: \"flex\",\n flexDirection: \"column\",\n flexGrow: \"1\",\n },\n mainContentDiv: {\n border: \"var(--ic-border-width) dashed var(--ic-architectural-400)\",\n padding: \"var(--ic-space-md)\",\n height: \"800px\",\n },\n parentDiv: { display: \"flex\", height: \"100%\" },\n main: { minHeight: \"100vh\" },\n });\n const classes = useStyles();\n const alignment = \"center\";\n return (\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n \n
\n \n

Example heading

\n
\n \n

Example sub-heading

\n
\n \n

\n Remove this div and add your custom content in\n IcSectionContainer.\n

\n
\n
\n
\n
\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n \n \n \n \n \n
\n
)`,\n \"SideNavigationPattern\",\n \"jsx\",\n true\n ),\n },\n];\n\n\n \n View example in new window\n \n\n\nThis pattern includes the components:\n\n- [Side navigation](/components/side-navigation)\n- [Section container](/components/section-container)\n- [Footer](/components/footer)\n- [Classification banner](/components/classification-banner)\n\nWith options for:\n\n- [Page header](/components/page-header)\n- [Back to top](/components/back-to-top)\n\n## When to use\n\nWhen choosing a layout pattern, make sure it works for all pages within your app and avoid switching layout patterns on different pages.\n\nUse the side navigation layout to help provide more screen space for main content. Side navigation is well suited to apps that have mutually exclusive features which need to be switched between easily from any page. For example, email providers often use side navigation to provide maximum screen space to email content whilst allowing constant access to other pages.\n\n## When not to use\n\nFor intranet-style and content heavy apps, use the top navigation layout as it's better suited for providing links to a large number of pages.\n\nUse either the top navigation layout or the side navigation layout. Don't use both at the same time.\n\n## Implementation\n\nMake sure the pattern always fits the entire viewport and is never within another page container. The pattern content will adapt responsively when the viewport changes.\n\nAlways place the footer at the bottom of the page and below the fold meaning users should scroll to see it.\n\n## Variants\n\nUse the side navigation layout with additional components including page header to create other common layouts.\n\n### Page header\n\nUse a page header to display an introduction to the content of the page. Add additional elements to provide actions, navigation or inputs at the page level.\n\nFor more information, see the [page header component](/components/page-header).\n\nexport const snippetsSideNavWithPageHeader = [\n {\n technology: \"Web component\",\n snippets: createWebComponentsIndexHTML(`
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n Primary button\n \n Tertiary button\n
\n \n Submit\n
\n \n
\n \n
\n \n

Example heading

\n
\n \n

Example sub-heading

\n
\n \n

\n Remove this div and add your custom content in ic-section-container.\n

\n
\n
\n
\n
\n \n [footerLink]\n [footerLink]\n [footerLink]\n [footerLink]\n [footerLink]\n \n \n \n \n \n \n
\n
`),\n },\n {\n technology: \"React\",\n snippets: createReactAppTsx(\n `const useStyles = createUseStyles({\n contentDivContainer: {\n display: \"flex\",\n flexDirection: \"column\",\n flexGrow: \"1\",\n },\n mainContentDiv: {\n border: \"var(--ic-border-width) dashed var(--ic-architectural-400)\",\n padding: \"var(--ic-space-md)\",\n height: \"800px\",\n },\n parentDiv: { display: \"flex\", height: \"100%\" },\n main: { minHeight: \"100vh\" },\n inputArea: {\n display: \"flex\",\n flexWrap: \"wrap\",\n gap: \"var(--ic-space-md)\",\n \"@media screen and (max-width: 320px)\": {\n gap: \"var(--ic-space-xs)\",\n },\n },\n textField: {\n \"--input-width\": \"21.5rem\",\n \"@media screen and (max-width: 768px)\": {\n \"--input-width\": \"100%\",\n flex: \"1 1 0\",\n },\n },\n });\n const classes = useStyles();\n const alignment = \"center\";\n const pageHeaderAlignment = \"center\";\n return (\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n \n \n \n \n \n \n \n \n \n \n \n Primary button\n \n \n Tertiary button\n \n
\n \n Submit\n
\n \n
\n \n
\n \n

Example heading

\n
\n \n

Example sub-heading

\n
\n \n

\n Remove this div and add your custom content in\n IcSectionContainer.\n

\n
\n
\n
\n
\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n \n \n \n \n \n
\n
\n )`,\n \"SideNavigationWithPageHeaderPattern\",\n \"jsx\",\n true\n ),\n },\n];\n\n\n \n View example in new window\n \n\n\n### Back to top\n\nUse the back to top component to help people quickly return to the top of a long page.\n\nConsider using it on all apps to improve usability for everyone, including keyboard-only and some assistive technology users.\n\nDon't use back to top when the page is designed to fill the viewport without scrolling.\n\nFor more information, see the [back to top component](/components/back-to-top).\n\nexport const snippetsSideNavBackToTop = [\n {\n technology: \"Web component\",\n snippets: createWebComponentsIndexHTML(`
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n \n
\n \n

Example heading

\n
\n \n

Example sub-heading

\n
\n \n

\n Remove this div and add your custom content in ic-section-container.\n

\n
\n
\n
\n
\n \n \n [footerLink]\n [footerLink]\n [footerLink]\n [footerLink]\n [footerLink]\n \n \n \n \n \n \n
\n
`),\n },\n {\n technology: \"React\",\n snippets: createReactAppTsx(\n `const useStyles = createUseStyles({\n contentDivContainer: {\n display: \"flex\",\n flexDirection: \"column\",\n flexGrow: \"1\",\n },\n mainContentDiv: {\n border: \"var(--ic-border-width) dashed var(--ic-architectural-400)\",\n padding: \"var(--ic-space-md)\",\n flex: 1,\n },\n parentDiv: { display: \"flex\", height: \"100%\" },\n main: { minHeight: \"100vh\", display: \"flex\" },\n mainSectionContainer: { display: \"flex\", flex: 1 },\n });\n const classes = useStyles();\n const alignment = \"center\";\n return (\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n \n
\n \n

Example heading

\n
\n \n

Example sub-heading

\n
\n \n

\n Remove this div and add your custom content in\n IcSectionContainer.\n

\n
\n
\n \n
\n \n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n \n \n \n \n \n
\n
\n )`,\n \"SideNavigationWithBackToTopPattern\",\n \"jsx\",\n true\n ),\n },\n];\n\n\n \n View example in new window\n \n\n\n## Customisation\n\nThis pattern can be themed to change the look and feel of the app. Use the [custom theme](/get-started/install-components/custom-theme) guidance to change your app's theme. Make sure to select your theme in line with the accessibility requirements around colour contrast.\n\n\n\n## Accessibility considerations\n\nWhen configuring a page make sure to follow all [accessibility guidance](/accessibility). Most accessibility requirements are covered by the individual components. For further accessibility information see the individual component pages.\n\nWe’ve tested this pattern against WCAG 2.1 Level AA. It’s been tested with NVDA and VoiceOver, and several different users with different interaction methods.\n\n## Related patterns\n\n- [Top navigation layout](/patterns/navigation-patterns/top-navigation-layout)\n", "path": "/patterns/navigation-patterns/side-navigation-layout", "navPriority": 2, "date": "2024-03-25", @@ -4849,9 +4849,9 @@ "contribute": "https://github.com/mi6/ic-design-system/tree/main/src/content/structured/patterns/navigation-patterns/side-navigation-layout.mdx", "meta": { "relativePath": "patterns/side-navigation-layout.mdx", - "createdAt": "2024-05-09T10:42:42.398Z", - "lastModified": "2024-05-09T10:42:42.398Z", - "size": 62900, + "createdAt": "2024-05-21T09:12:11.395Z", + "lastModified": "2024-05-21T09:12:11.395Z", + "size": 62918, "formattedSize": "61.4 KB" } }, @@ -4874,7 +4874,7 @@ }, { "id": "patterns__top-navigation-layoutx", - "contents": "\nimport { IcLink } from \"@ukic/react\";\n\nimport {\n createReactAppTsx,\n createWebComponentsIndexHTML,\n} from \"./components/StackblitzButton/stackblitz-helpers\";\n\nimport topNavigationPatternFig1 from \"./images/fig-1-example-of-theming-applied-to-top-navigation-layout@2x.png\";\n\n## Introduction\n\nexport const snippetsTopNav = [\n {\n language: \"Web component\",\n snippet:\n createWebComponentsIndexHTML(`\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n \n

Example heading

\n
\n \n

Example sub-heading

\n
\n \n

\n Remove this div and add your custom content in ic-section-container.\n

\n
\n
\n
\n
\n \n [footerLink]\n [footerLink]\n [footerLink]\n [footerLink]\n [footerLink]\n \n \n \n \n \n `),\n },\n {\n language: \"React\",\n snippet: createReactAppTsx(\n `const alignment = \"center\";\n const useStyles = createUseStyles({\n main: { minHeight: \"100vh\", display: \"flex\" },\n mainContentDiv: {\n border: \"var(--ic-border-width) dashed var(--ic-architectural-400)\",\n padding: \"var(--ic-space-md)\",\n flex: 1,\n },\n mainSectionContainer: { display: \"flex\", flex: 1 },\n });\n const classes = useStyles(); \n return (\n <>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n \n

Example heading

\n
\n \n

Example sub-heading

\n
\n \n

\n Remove this div and add your custom content in IcSectionContainer.\n

\n
\n
\n
\n
\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n \n \n \n \n \n \n )`,\n \"TopNavigation\",\n \"jsx\",\n true\n ),\n },\n];\n\n\n \n View example in new window\n \n\n\nThis pattern includes the components:\n\n- [Top navigation](/components/top-navigation)\n- [Section container](/components/section-container)\n- [Footer](/components/footer)\n- [Classification banner](/components/classification-banner)\n\nWith options for:\n\n- [Page header](/components/page-header)\n- [Mega-menu](/components/top-navigation)\n- [Back to top](/components/back-to-top)\n\n## When to use\n\nWhen choosing a layout pattern, make sure it works for all pages within your app and avoid switching layouts on different pages.\n\nUse the top navigation layout for article pages or content heavy apps with lots of text.\n\nUse the top navigation layout with a mega-menu for access to a large range of navigation items.\n\nUse a mega-menu for apps with complex page structures where every page should be accessible from any other page through the mega-menu. For example, department stores or supermarkets use a top navigation with mega-menu to provide access to their large number of product categories.\n\n## When not to use\n\nFor apps that require constant access to switch between pages, use side navigation as it's better suited for providing quick access and maximising the screen space for page content.\n\nUse either the top navigation layout or the side navigation layout. Don't use both at the same time.\n\n## Implementation\n\nMake sure the pattern always fits the entire viewport and is never within another page container. The pattern content will adapt responsively when the viewport changes.\n\nAlways place the footer at the bottom of the page and below the fold meaning users should\nscroll to see it.\n\n## Variants\n\nUse the top navigation layout with additional components including page header to create other common layouts.\n\n### Page header\n\nUse a page header to display an introduction to the content of the page. Add additional elements to provide actions, navigation or inputs at the page level.\n\nFor more information, see the [page header component](/components/page-header).\n\nexport const snippetsTopNavPageHeader = [\n {\n language: \"Web component\",\n snippet:\n createWebComponentsIndexHTML(`\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n Primary button\n \n Tertiary button\n
\n \n Submit\n
\n \n
\n \n
\n \n

Example heading

\n
\n \n

Example sub-heading

\n
\n \n

\n Remove this div and add your custom content in ic-section-container.\n

\n
\n
\n
\n
\n \n [footerLink]\n [footerLink]\n [footerLink]\n [footerLink]\n [footerLink]\n \n \n \n \n \n `),\n },\n {\n language: \"React\",\n snippet: createReactAppTsx(\n `const alignment = \"center\";\n let pageHeaderAlignment;\n // pageHeaderAlignment = \"center\";\n const useStyles = createUseStyles({\n main: { minHeight: \"100vh\", display: \"flex\" },\n mainContentDiv: {\n border: \"var(--ic-border-width) dashed var(--ic-architectural-400)\",\n padding: \"var(--ic-space-md)\",\n flex: 1,\n },\n mainSectionContainer: { display: \"flex\", flex: 1 },\n inputArea: {\n display: \"flex\",\n flexWrap: \"wrap\",\n gap: \"var(--ic-space-md)\",\n \"@media screen and (max-width: 320px)\": {\n gap: \"var(--ic-space-xs)\",\n },\n },\n textField: {\n \"--input-width\": \"21.5rem\",\n \"@media screen and (max-width: 768px)\": {\n \"--input-width\": \"100%\",\n flex: \"1 1 0\",\n },\n },\n });\n const classes = useStyles();\n return (\n <>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n Primary button\n \n \n Tertiary button\n \n
\n \n Submit\n
\n \n
\n \n
\n \n

Example heading

\n
\n \n

Example sub-heading

\n
\n \n

\n Remove this div and add your custom content in IcSectionContainer.\n

\n
\n
\n
\n
\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n \n \n \n \n \n \n )`,\n \"TopNavigationWithPageHeader\",\n \"jsx\",\n true\n ),\n },\n];\n\n\n \n View example in new window\n \n\n\n### Mega-menu\n\nUse a top navigation with a mega-menu for apps with more than eight navigation options or options that can be grouped into categories. The main link groups are displayed in the top navigation and open a mega-menu when hovered over or focused.\n\nFor more information, see the [mega-menu component](/components/top-navigation#mega-menu).\n\nexport const snippetsTopNavMegaMenu = [\n {\n language: \"Web component\",\n snippet:\n createWebComponentsIndexHTML(`\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n \n

Example heading

\n
\n \n

Example sub-heading

\n
\n \n

\n Remove this div and add your custom content in ic-section-container.\n

\n
\n
\n
\n
\n \n [footerLink]\n [footerLink]\n [footerLink]\n [footerLink]\n [footerLink]\n \n \n \n \n \n `),\n },\n {\n language: \"React\",\n snippet: createReactAppTsx(\n `const alignment = \"center\";\n const useStyles = createUseStyles({\n main: { minHeight: \"100vh\", display: \"flex\" },\n mainContentDiv: {\n border: \"var(--ic-border-width) dashed var(--ic-architectural-400)\",\n padding: \"var(--ic-space-md)\",\n flex: 1,\n },\n mainSectionContainer: { display: \"flex\", flex: 1 },\n });\n const classes = useStyles(); \n return (\n <>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n \n

Example heading

\n
\n \n

Example sub-heading

\n
\n \n

\n Remove this div and add your custom content in IcSectionContainer.\n

\n
\n
\n
\n
\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n \n \n \n \n \n \n )`,\n \"TopNavigationWithMegaMenu\",\n \"jsx\",\n true\n ),\n },\n];\n\n\n \n View example in new window\n \n\n\n### Back to top\n\nUse the back to top component to help people quickly return to the top of a long page.\n\nConsider using it on all apps to improve usability for everyone, including keyboard-only and some assistive technology users.\n\nDon't use back to top when the page is designed to fill the viewport without scrolling.\n\nFor more information, see the [back to top component](/components/back-to-top).\n\nexport const snippetsTopNavBackToTop = [\n {\n language: \"Web component\",\n snippet:\n createWebComponentsIndexHTML(`\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n \n

Example heading

\n
\n \n

Example sub-heading

\n
\n \n

\n Remove this div and add your custom content in ic-section-container.\n

\n
\n
\n
\n
\n \n \n [footerLink]\n [footerLink]\n [footerLink]\n [footerLink]\n [footerLink]\n \n \n \n \n \n `),\n },\n {\n language: \"React\",\n snippet: createReactAppTsx(\n `const alignment = \"center\";\n const useStyles = createUseStyles({\n main: { minHeight: \"100vh\", display: \"flex\" },\n mainContentDiv: {\n border: \"var(--ic-border-width) dashed var(--ic-architectural-400)\",\n padding: \"var(--ic-space-md)\",\n flex: 1,\n },\n mainSectionContainer: { display: \"flex\", flex: 1 },\n });\n const classes = useStyles(); \n return (\n <>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n \n

Example heading

\n
\n \n

Example sub-heading

\n
\n \n

\n Remove this div and add your custom content in IcSectionContainer.\n

\n
\n
\n
\n
\n \n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n \n \n \n \n \n \n )`,\n \"TopNavigationWithBackToTop\",\n \"jsx\",\n true\n ),\n },\n];\n\n\n \n View example in new window\n \n\n\n## Customisation\n\nThis pattern can be themed to change the look and feel of the app. Use the [custom theme](/get-started/install-components/custom-theme) guidance to change your app's theme. Make sure to select your theme in line with the accessibility requirements around colour contrast.\n\n\n\n## Accessibility considerations\n\nWhen configuring a page make sure to follow all [accessibility guidance](/accessibility). Most accessibility requirements are covered by the individual components. For further accessibility information see the individual component pages.\n\nWe’ve tested this pattern against WCAG 2.1 Level AA. It’s been tested with NVDA and VoiceOver, and several different users with different interaction methods.\n\n## Related patterns\n\n- [Side navigation layout](/patterns/navigation-patterns/side-navigation-layout)\n", + "contents": "\nimport { IcLink } from \"@ukic/react\";\n\nimport {\n createReactAppTsx,\n createWebComponentsIndexHTML,\n} from \"./components/StackblitzButton/stackblitz-helpers\";\n\nimport topNavigationPatternFig1 from \"./images/fig-1-example-of-theming-applied-to-top-navigation-layout@2x.png\";\n\n## Introduction\n\nexport const snippetsTopNav = [\n {\n technology: \"Web component\",\n snippets: {\n long: createWebComponentsIndexHTML(`\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n \n

Example heading

\n
\n \n

Example sub-heading

\n
\n \n

\n Remove this div and add your custom content in ic-section-container.\n

\n
\n
\n
\n
\n \n [footerLink]\n [footerLink]\n [footerLink]\n [footerLink]\n [footerLink]\n \n \n \n \n \n `),\n },\n },\n {\n technology: \"React\",\n snippets: {\n long: [\n {\n language: \"Typescript\",\n snippet: createReactAppTsx(\n `const alignment = \"center\";\n const useStyles = createUseStyles({\n main: { minHeight: \"100vh\", display: \"flex\" },\n mainContentDiv: {\n border: \"var(--ic-border-width) dashed var(--ic-architectural-400)\",\n padding: \"var(--ic-space-md)\",\n flex: 1,\n },\n mainSectionContainer: { display: \"flex\", flex: 1 },\n });\n const classes = useStyles(); \n return (\n <>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n \n

Example heading

\n
\n \n

Example sub-heading

\n
\n \n

\n Remove this div and add your custom content in IcSectionContainer.\n

\n
\n
\n
\n
\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n \n \n \n \n \n \n )`,\n \"TopNavigation\",\n \"tsx\",\n true\n ),\n },\n {\n language: \"Javascript\",\n snippet: createReactAppTsx(\n `const alignment = \"center\";\n const useStyles = createUseStyles({\n main: { minHeight: \"100vh\", display: \"flex\" },\n mainContentDiv: {\n border: \"var(--ic-border-width) dashed var(--ic-architectural-400)\",\n padding: \"var(--ic-space-md)\",\n flex: 1,\n },\n mainSectionContainer: { display: \"flex\", flex: 1 },\n });\n const classes = useStyles(); \n return (\n <>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n \n

Example heading

\n
\n \n

Example sub-heading

\n
\n \n

\n Remove this div and add your custom content in IcSectionContainer.\n

\n
\n
\n
\n
\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n \n \n \n \n \n \n )`,\n \"TopNavigation\",\n \"jsx\",\n true\n ),\n },\n ],\n },\n },\n];\n\n\n \n View example in new window\n \n\n\nThis pattern includes the components:\n\n- [Top navigation](/components/top-navigation)\n- [Section container](/components/section-container)\n- [Footer](/components/footer)\n- [Classification banner](/components/classification-banner)\n\nWith options for:\n\n- [Page header](/components/page-header)\n- [Mega-menu](/components/top-navigation)\n- [Back to top](/components/back-to-top)\n\n## When to use\n\nWhen choosing a layout pattern, make sure it works for all pages within your app and avoid switching layouts on different pages.\n\nUse the top navigation layout for article pages or content heavy apps with lots of text.\n\nUse the top navigation layout with a mega-menu for access to a large range of navigation items.\n\nUse a mega-menu for apps with complex page structures where every page should be accessible from any other page through the mega-menu. For example, department stores or supermarkets use a top navigation with mega-menu to provide access to their large number of product categories.\n\n## When not to use\n\nFor apps that require constant access to switch between pages, use side navigation as it's better suited for providing quick access and maximising the screen space for page content.\n\nUse either the top navigation layout or the side navigation layout. Don't use both at the same time.\n\n## Implementation\n\nMake sure the pattern always fits the entire viewport and is never within another page container. The pattern content will adapt responsively when the viewport changes.\n\nAlways place the footer at the bottom of the page and below the fold meaning users should\nscroll to see it.\n\n## Variants\n\nUse the top navigation layout with additional components including page header to create other common layouts.\n\n### Page header\n\nUse a page header to display an introduction to the content of the page. Add additional elements to provide actions, navigation or inputs at the page level.\n\nFor more information, see the [page header component](/components/page-header).\n\nexport const snippetsTopNavPageHeader = [\n {\n technology: \"Web component\",\n snippets:\n createWebComponentsIndexHTML(`\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n Primary button\n \n Tertiary button\n
\n \n Submit\n
\n \n
\n \n
\n \n

Example heading

\n
\n \n

Example sub-heading

\n
\n \n

\n Remove this div and add your custom content in ic-section-container.\n

\n
\n
\n
\n
\n \n [footerLink]\n [footerLink]\n [footerLink]\n [footerLink]\n [footerLink]\n \n \n \n \n \n `),\n },\n {\n technology: \"React\",\n snippets: createReactAppTsx(\n `const alignment = \"center\";\n let pageHeaderAlignment;\n // pageHeaderAlignment = \"center\";\n const useStyles = createUseStyles({\n main: { minHeight: \"100vh\", display: \"flex\" },\n mainContentDiv: {\n border: \"var(--ic-border-width) dashed var(--ic-architectural-400)\",\n padding: \"var(--ic-space-md)\",\n flex: 1,\n },\n mainSectionContainer: { display: \"flex\", flex: 1 },\n inputArea: {\n display: \"flex\",\n flexWrap: \"wrap\",\n gap: \"var(--ic-space-md)\",\n \"@media screen and (max-width: 320px)\": {\n gap: \"var(--ic-space-xs)\",\n },\n },\n textField: {\n \"--input-width\": \"21.5rem\",\n \"@media screen and (max-width: 768px)\": {\n \"--input-width\": \"100%\",\n flex: \"1 1 0\",\n },\n },\n });\n const classes = useStyles();\n return (\n <>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n Primary button\n \n \n Tertiary button\n \n
\n \n Submit\n
\n \n
\n \n
\n \n

Example heading

\n
\n \n

Example sub-heading

\n
\n \n

\n Remove this div and add your custom content in IcSectionContainer.\n

\n
\n
\n
\n
\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n \n \n \n \n \n \n )`,\n \"TopNavigationWithPageHeader\",\n \"jsx\",\n true\n ),\n },\n];\n\n\n \n View example in new window\n \n\n\n### Mega-menu\n\nUse a top navigation with a mega-menu for apps with more than eight navigation options or options that can be grouped into categories. The main link groups are displayed in the top navigation and open a mega-menu when hovered over or focused.\n\nFor more information, see the [mega-menu component](/components/top-navigation#mega-menu).\n\nexport const snippetsTopNavMegaMenu = [\n {\n technology: \"Web component\",\n snippets:\n createWebComponentsIndexHTML(`\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n \n

Example heading

\n
\n \n

Example sub-heading

\n
\n \n

\n Remove this div and add your custom content in ic-section-container.\n

\n
\n
\n
\n
\n \n [footerLink]\n [footerLink]\n [footerLink]\n [footerLink]\n [footerLink]\n \n \n \n \n \n `),\n },\n {\n technology: \"React\",\n snippets: createReactAppTsx(\n `const alignment = \"center\";\n const useStyles = createUseStyles({\n main: { minHeight: \"100vh\", display: \"flex\" },\n mainContentDiv: {\n border: \"var(--ic-border-width) dashed var(--ic-architectural-400)\",\n padding: \"var(--ic-space-md)\",\n flex: 1,\n },\n mainSectionContainer: { display: \"flex\", flex: 1 },\n });\n const classes = useStyles(); \n return (\n <>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n \n

Example heading

\n
\n \n

Example sub-heading

\n
\n \n

\n Remove this div and add your custom content in IcSectionContainer.\n

\n
\n
\n
\n
\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n \n \n \n \n \n \n )`,\n \"TopNavigationWithMegaMenu\",\n \"jsx\",\n true\n ),\n },\n];\n\n\n \n View example in new window\n \n\n\n### Back to top\n\nUse the back to top component to help people quickly return to the top of a long page.\n\nConsider using it on all apps to improve usability for everyone, including keyboard-only and some assistive technology users.\n\nDon't use back to top when the page is designed to fill the viewport without scrolling.\n\nFor more information, see the [back to top component](/components/back-to-top).\n\nexport const snippetsTopNavBackToTop = [\n {\n technology: \"Web component\",\n snippets:\n createWebComponentsIndexHTML(`\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n \n

Example heading

\n
\n \n

Example sub-heading

\n
\n \n

\n Remove this div and add your custom content in ic-section-container.\n

\n
\n
\n
\n
\n \n \n [footerLink]\n [footerLink]\n [footerLink]\n [footerLink]\n [footerLink]\n \n \n \n \n \n `),\n },\n {\n technology: \"React\",\n snippets: createReactAppTsx(\n `const alignment = \"center\";\n const useStyles = createUseStyles({\n main: { minHeight: \"100vh\", display: \"flex\" },\n mainContentDiv: {\n border: \"var(--ic-border-width) dashed var(--ic-architectural-400)\",\n padding: \"var(--ic-space-md)\",\n flex: 1,\n },\n mainSectionContainer: { display: \"flex\", flex: 1 },\n });\n const classes = useStyles(); \n return (\n <>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n \n

Example heading

\n
\n \n

Example sub-heading

\n
\n \n

\n Remove this div and add your custom content in IcSectionContainer.\n

\n
\n
\n
\n
\n \n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n [footerLink]\n \n \n \n \n \n \n \n \n )`,\n \"TopNavigationWithBackToTop\",\n \"jsx\",\n true\n ),\n },\n];\n\n\n \n View example in new window\n \n\n\n## Customisation\n\nThis pattern can be themed to change the look and feel of the app. Use the [custom theme](/get-started/install-components/custom-theme) guidance to change your app's theme. Make sure to select your theme in line with the accessibility requirements around colour contrast.\n\n\n\n## Accessibility considerations\n\nWhen configuring a page make sure to follow all [accessibility guidance](/accessibility). Most accessibility requirements are covered by the individual components. For further accessibility information see the individual component pages.\n\nWe’ve tested this pattern against WCAG 2.1 Level AA. It’s been tested with NVDA and VoiceOver, and several different users with different interaction methods.\n\n## Related patterns\n\n- [Side navigation layout](/patterns/navigation-patterns/side-navigation-layout)\n", "path": "/patterns/navigation-patterns/top-navigation-layout", "navPriority": 1, "date": "2024-03-25", @@ -4883,10 +4883,10 @@ "contribute": "https://github.com/mi6/ic-design-system/tree/main/src/content/structured/patterns/navigation-patterns/top-navigation-layout.mdx", "meta": { "relativePath": "patterns/top-navigation-layout.mdx", - "createdAt": "2024-05-09T10:42:42.402Z", - "lastModified": "2024-05-09T10:42:42.402Z", - "size": 52244, - "formattedSize": "51.0 KB" + "createdAt": "2024-05-21T09:12:11.395Z", + "lastModified": "2024-05-21T09:12:11.395Z", + "size": 57202, + "formattedSize": "55.9 KB" } }, { @@ -4894,13 +4894,13 @@ "contents": "\nimport ColorTable from \"./components/ColourTable\";\nimport {\n ColoursText,\n ColoursAction,\n ColoursActionBackgrounds,\n ColoursLinks,\n ColoursStatus,\n ColoursDeprecatedStatus,\n ColoursClassification,\n ColoursArchitecturalAll,\n ColoursTheme,\n} from \"./components/ColourTable/colours.config\";\n\n## Using colours\n\nPeople can complete tasks faster with recognisable, accessible and consistent colours.\n\nAlways use the Design System colour styles. These colours meet or exceed all [accessibility requirements](/accessibility/requirement).\n\nThe colour styles are built into the [UI Kit](/get-started). You should use these to help maintain consistency for when you are building custom experiences.\n\n## Text\n\nPrimary text is an off-black colour that satisfies minimum and maximum contrast needs. Use this colour for the majority of text and elements.\n\nUse the secondary text colour for supporting content such as helper text or less important information in lists and tables.\n\nUse the tertiary text colour for even less important information. Use the tertiary text colour sparingly and always try to use the primary or secondary colours first.\n\nDon't use different colours for text, unless specified as part of a component.\n\n\n\n## Action\n\nUse the action colour for interactive elements like buttons, form controls and important actions. This makes it easy for people to recognise elements and switch between contexts.\n\nThe single action colour creates consistency across a range of apps. Use the dark or light action colour variant if a background colour is used.\n\nUse the destructive action colour styles for actions that can't be reversed.\n\n\n\n### Action backgrounds\n\nInteractive elements sometimes require transparent backgrounds for their hover and pressed states. The action background colour styles use the action colour styles with transparency.\n\n\n\n## Links\n\nUse these colours for all links. These specific colours help to identify links from non-interactive text.\n\nUse the contrast colour variants to achieve good contrast for links that appear on dark backgrounds.\n\n\n\n## Status\n\nUse these colours only for status updates, errors and warnings. Always include text describing the status even if you use an icon.\n\nUse the contrast colour variants to achieve good contrast when displaying status on dark backgrounds.\n\nUse the 'warning dark' colour for any 'warning' text.\n\n\n\n
\n\nThe following status colours have been deprecated. You can find equivalent colours in the table above.\n\n\n\n## Classification\n\nUse these colour styles for components that indicate content's classification.\n\n\n\n## Architectural\n\nUse these colours in lines, borders and backgrounds to logically separate distinct pieces of content.\n\n\n\n## Theme\n\nYou may choose a theme colour to give your app a distinct theme or 'brand'. Make sure it meets contrast requirements with either black or white foreground text.\n\nIf you use the [IC UI Kit](/components), the foreground colour will be automatically determined based on your theme colour.\n\nThe theme colour is used on the [top navigation](/components/top-navigation), [side navigation](/components/side-navigation), [hero](/components/hero) and [footer](/components/footer) components.\n\nDon't use theme colours on any other components.\n\n\n\n## Accessibility considerations\n\nThese colours have been considered against a variety of accessibility and usability practices. This includes colour contrast, recognition, consistency and with various colour deficiencies.\n\nIf using a 'light' theme colour, any text in those components will need to be black instead of white. This is automatic if you're using the IC UI Kit. It's not possible to use 'inaccessible' colours in the IC UI Kit as they'll revert to the default theme colour. See the component documentation for more details.\n", "path": "/styles/colour", "navPriority": 1, - "date": "2022-11-15", + "date": "2024-05-10", "title": "Colour", "contribute": "https://github.com/mi6/ic-design-system/tree/main/src/content/structured/styles/colour.mdx", "meta": { "relativePath": "styles/colour.mdx", - "createdAt": "2024-05-09T12:39:18.004Z", - "lastModified": "2024-05-09T12:39:18.004Z", + "createdAt": "2024-05-13T07:27:37.419Z", + "lastModified": "2024-05-13T07:27:37.419Z", "size": 4356, "formattedSize": "4.3 KB" } diff --git a/src/pages/footer-layout.tsx b/src/pages/footer-layout.tsx index 7abcc0991..c0708962b 100644 --- a/src/pages/footer-layout.tsx +++ b/src/pages/footer-layout.tsx @@ -16,9 +16,9 @@ const FooterLayout: React.FC = () => ( diff --git a/src/pages/side-navigation-back-to-top-pattern.tsx b/src/pages/side-navigation-back-to-top-pattern.tsx index 2d091ace6..18538a3bf 100644 --- a/src/pages/side-navigation-back-to-top-pattern.tsx +++ b/src/pages/side-navigation-back-to-top-pattern.tsx @@ -61,9 +61,9 @@ const SideNavigationBackToTopPattern: React.FC = () => { > = () => { > @@ -87,9 +87,9 @@ const SideNavigationBackToTopPattern: React.FC = () => { >
@@ -100,9 +100,9 @@ const SideNavigationBackToTopPattern: React.FC = () => { >
@@ -113,9 +113,9 @@ const SideNavigationBackToTopPattern: React.FC = () => { >
@@ -127,9 +127,9 @@ const SideNavigationBackToTopPattern: React.FC = () => { >
@@ -140,9 +140,9 @@ const SideNavigationBackToTopPattern: React.FC = () => { >
@@ -153,9 +153,9 @@ const SideNavigationBackToTopPattern: React.FC = () => { >
@@ -166,9 +166,9 @@ const SideNavigationBackToTopPattern: React.FC = () => { >
@@ -179,9 +179,9 @@ const SideNavigationBackToTopPattern: React.FC = () => { >
@@ -192,9 +192,9 @@ const SideNavigationBackToTopPattern: React.FC = () => { >
@@ -205,9 +205,9 @@ const SideNavigationBackToTopPattern: React.FC = () => { >
@@ -259,9 +259,9 @@ const SideNavigationBackToTopPattern: React.FC = () => { = () => { > = () => { > @@ -109,9 +109,9 @@ const SideNavigationPattern: React.FC = () => { >
@@ -122,9 +122,9 @@ const SideNavigationPattern: React.FC = () => { >
@@ -135,9 +135,9 @@ const SideNavigationPattern: React.FC = () => { >
@@ -149,9 +149,9 @@ const SideNavigationPattern: React.FC = () => { >
@@ -162,9 +162,9 @@ const SideNavigationPattern: React.FC = () => { >
@@ -175,9 +175,9 @@ const SideNavigationPattern: React.FC = () => { >
@@ -188,9 +188,9 @@ const SideNavigationPattern: React.FC = () => { >
@@ -201,9 +201,9 @@ const SideNavigationPattern: React.FC = () => { >
@@ -214,9 +214,9 @@ const SideNavigationPattern: React.FC = () => { >
@@ -227,9 +227,9 @@ const SideNavigationPattern: React.FC = () => { >
@@ -254,9 +254,9 @@ const SideNavigationPattern: React.FC = () => { Primary button @@ -319,9 +319,9 @@ const SideNavigationPattern: React.FC = () => { = () => { > = () => { > @@ -86,9 +86,9 @@ const SideNavigationPattern: React.FC = () => { >
@@ -99,9 +99,9 @@ const SideNavigationPattern: React.FC = () => { >
@@ -112,9 +112,9 @@ const SideNavigationPattern: React.FC = () => { >
@@ -126,9 +126,9 @@ const SideNavigationPattern: React.FC = () => { >
@@ -139,9 +139,9 @@ const SideNavigationPattern: React.FC = () => { >
@@ -152,9 +152,9 @@ const SideNavigationPattern: React.FC = () => { >
@@ -165,9 +165,9 @@ const SideNavigationPattern: React.FC = () => { >
@@ -178,9 +178,9 @@ const SideNavigationPattern: React.FC = () => { >
@@ -191,9 +191,9 @@ const SideNavigationPattern: React.FC = () => { >
@@ -204,9 +204,9 @@ const SideNavigationPattern: React.FC = () => { >
@@ -257,9 +257,9 @@ const SideNavigationPattern: React.FC = () => {