@workday/canvas-kit-docs 16.0.0-alpha.0499-next.0 → 16.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es6/lib/docs.js +2801 -17
- package/dist/es6/lib/specs.js +1549 -615
- package/dist/es6/lib/stackblitzFiles/packageJSONFile.js +5 -5
- package/dist/es6/lib/stackblitzFiles/packageJSONFile.ts +5 -5
- package/dist/es6/utils/parseSpecFile.d.ts.map +1 -1
- package/dist/es6/utils/parseSpecFile.js +27 -6
- package/dist/mdx/16.0-UPGRADE-GUIDE.mdx +148 -3
- package/dist/mdx/react/common/mdx/Theming.mdx +75 -431
- package/dist/mdx/react/common/mdx/examples/SimplifiedSanaSetup.tsx +35 -0
- package/dist/mdx/react/common/mdx/examples/ThemingBrandScope.tsx +29 -0
- package/package.json +6 -6
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/CommentBoxWithCharLimit.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/CommentBoxWithCharLimit.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/CommentBoxWithCharLimit.js +0 -31
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/FilterListWithLiveStatus.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/FilterListWithLiveStatus.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/FilterListWithLiveStatus.js +0 -43
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/HiddenLiveRegion.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/HiddenLiveRegion.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/HiddenLiveRegion.js +0 -27
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/IconButtonsWithLiveBadges.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/IconButtonsWithLiveBadges.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/IconButtonsWithLiveBadges.js +0 -56
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/TextInputWithLiveError.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/TextInputWithLiveError.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/TextInputWithLiveError.js +0 -19
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/VisibleLiveRegion.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/VisibleLiveRegion.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/VisibleLiveRegion.js +0 -35
- package/dist/es6/mdx/accessibility/examples/GlobalHeader.d.ts +0 -8
- package/dist/es6/mdx/accessibility/examples/GlobalHeader.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/GlobalHeader.js +0 -149
- package/dist/es6/mdx/accessibility/examples/PageStructure/BreadcrumbNavRegion.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/PageStructure/BreadcrumbNavRegion.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/PageStructure/BreadcrumbNavRegion.js +0 -12
- package/dist/es6/mdx/accessibility/examples/PageStructure/FullPageDemo.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/PageStructure/FullPageDemo.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/PageStructure/FullPageDemo.js +0 -46
- package/dist/es6/mdx/accessibility/examples/PageStructure/LandmarkRegions.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/PageStructure/LandmarkRegions.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/PageStructure/LandmarkRegions.js +0 -28
- package/dist/es6/mdx/accessibility/examples/Popups/InlinePopupNoPortal.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/Popups/InlinePopupNoPortal.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/Popups/InlinePopupNoPortal.js +0 -62
- package/dist/es6/mdx/accessibility/examples/Popups/InlinePortalPopup.d.ts +0 -7
- package/dist/es6/mdx/accessibility/examples/Popups/InlinePortalPopup.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/Popups/InlinePortalPopup.js +0 -65
- package/dist/es6/mdx/accessibility/examples/Popups/PopupAriaOwns.d.ts +0 -7
- package/dist/es6/mdx/accessibility/examples/Popups/PopupAriaOwns.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/Popups/PopupAriaOwns.js +0 -46
- package/dist/es6/mdx/accessibility/examples/SidePanelWithNavigation.d.ts +0 -3
- package/dist/es6/mdx/accessibility/examples/SidePanelWithNavigation.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/SidePanelWithNavigation.js +0 -100
- package/dist/es6/mdx/accessibility/examples/SidePanelWithOverlay.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/SidePanelWithOverlay.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/SidePanelWithOverlay.js +0 -30
- package/dist/es6/mdx/accessibility/examples/Table/WithColumnHeaderFilters.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/Table/WithColumnHeaderFilters.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/Table/WithColumnHeaderFilters.js +0 -101
- package/dist/es6/mdx/accessibility/examples/Table/WithExpandableRows.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/Table/WithExpandableRows.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/Table/WithExpandableRows.js +0 -115
- package/dist/es6/mdx/accessibility/examples/Table/WithFormFields.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/Table/WithFormFields.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/Table/WithFormFields.js +0 -79
- package/dist/es6/mdx/accessibility/examples/Table/WithSelectableRows.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/Table/WithSelectableRows.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/Table/WithSelectableRows.js +0 -89
- package/dist/es6/mdx/accessibility/examples/Table/WithSortableColumnHeaders.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/Table/WithSortableColumnHeaders.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/Table/WithSortableColumnHeaders.js +0 -114
- package/dist/es6/mdx/installBlock.d.ts +0 -6
- package/dist/es6/mdx/installBlock.d.ts.map +0 -1
- package/dist/es6/mdx/installBlock.js +0 -35
- package/dist/es6/mdx/style-props/examples/Background.d.ts +0 -2
- package/dist/es6/mdx/style-props/examples/Background.d.ts.map +0 -1
- package/dist/es6/mdx/style-props/examples/Background.js +0 -13
- package/dist/es6/mdx/style-props/examples/Border.d.ts +0 -2
- package/dist/es6/mdx/style-props/examples/Border.d.ts.map +0 -1
- package/dist/es6/mdx/style-props/examples/Border.js +0 -11
- package/dist/es6/mdx/style-props/examples/Color.d.ts +0 -2
- package/dist/es6/mdx/style-props/examples/Color.d.ts.map +0 -1
- package/dist/es6/mdx/style-props/examples/Color.js +0 -10
- package/dist/es6/mdx/style-props/examples/Depth.d.ts +0 -2
- package/dist/es6/mdx/style-props/examples/Depth.d.ts.map +0 -1
- package/dist/es6/mdx/style-props/examples/Depth.js +0 -11
- package/dist/es6/mdx/style-props/examples/Flex.d.ts +0 -2
- package/dist/es6/mdx/style-props/examples/Flex.d.ts.map +0 -1
- package/dist/es6/mdx/style-props/examples/Flex.js +0 -9
- package/dist/es6/mdx/style-props/examples/FlexItem.d.ts +0 -2
- package/dist/es6/mdx/style-props/examples/FlexItem.d.ts.map +0 -1
- package/dist/es6/mdx/style-props/examples/FlexItem.js +0 -9
- package/dist/es6/mdx/style-props/examples/Grid.d.ts +0 -2
- package/dist/es6/mdx/style-props/examples/Grid.d.ts.map +0 -1
- package/dist/es6/mdx/style-props/examples/Grid.js +0 -7
- package/dist/es6/mdx/style-props/examples/GridItem.d.ts +0 -2
- package/dist/es6/mdx/style-props/examples/GridItem.d.ts.map +0 -1
- package/dist/es6/mdx/style-props/examples/GridItem.js +0 -7
- package/dist/es6/mdx/style-props/examples/Layout.d.ts +0 -2
- package/dist/es6/mdx/style-props/examples/Layout.d.ts.map +0 -1
- package/dist/es6/mdx/style-props/examples/Layout.js +0 -10
- package/dist/es6/mdx/style-props/examples/Other.d.ts +0 -2
- package/dist/es6/mdx/style-props/examples/Other.d.ts.map +0 -1
- package/dist/es6/mdx/style-props/examples/Other.js +0 -11
- package/dist/es6/mdx/style-props/examples/Position.d.ts +0 -2
- package/dist/es6/mdx/style-props/examples/Position.d.ts.map +0 -1
- package/dist/es6/mdx/style-props/examples/Position.js +0 -12
- package/dist/es6/mdx/style-props/examples/Space.d.ts +0 -2
- package/dist/es6/mdx/style-props/examples/Space.d.ts.map +0 -1
- package/dist/es6/mdx/style-props/examples/Space.js +0 -9
- package/dist/es6/mdx/style-props/examples/Text.d.ts +0 -2
- package/dist/es6/mdx/style-props/examples/Text.d.ts.map +0 -1
- package/dist/es6/mdx/style-props/examples/Text.js +0 -3
- package/dist/es6/mdx/tokens/StorybookInformationHighlight/index.d.ts +0 -2
- package/dist/es6/mdx/tokens/StorybookInformationHighlight/index.d.ts.map +0 -1
- package/dist/es6/mdx/tokens/StorybookInformationHighlight/index.js +0 -6
- package/dist/es6/mdx/versionsTable.d.ts +0 -2
- package/dist/es6/mdx/versionsTable.d.ts.map +0 -1
- package/dist/es6/mdx/versionsTable.js +0 -60
- package/dist/es6/mdx/welcomePage.d.ts +0 -2
- package/dist/es6/mdx/welcomePage.d.ts.map +0 -1
- package/dist/es6/mdx/welcomePage.js +0 -57
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { PopupStack } from '@workday/canvas-kit-popup-stack';
|
|
4
|
-
import { DeleteButton } from '@workday/canvas-kit-react/button';
|
|
5
|
-
import { changeFocus, useUniqueId } from '@workday/canvas-kit-react/common';
|
|
6
|
-
import { Box, Flex } from '@workday/canvas-kit-react/layout';
|
|
7
|
-
import { Popup, useCloseOnEscape, useCloseOnOutsideClick, usePopupModel, useReturnFocus, } from '@workday/canvas-kit-react/popup';
|
|
8
|
-
import { createStyles, px2rem } from '@workday/canvas-kit-styling';
|
|
9
|
-
import { system } from '@workday/canvas-tokens-web';
|
|
10
|
-
const cardStyles = createStyles({
|
|
11
|
-
width: px2rem(320),
|
|
12
|
-
});
|
|
13
|
-
const flexStyles = createStyles({
|
|
14
|
-
gap: system.gap.md,
|
|
15
|
-
padding: system.padding.xs,
|
|
16
|
-
});
|
|
17
|
-
const layoutStyles = createStyles({
|
|
18
|
-
gap: system.gap.md,
|
|
19
|
-
alignItems: 'flex-start',
|
|
20
|
-
flexDirection: 'column',
|
|
21
|
-
});
|
|
22
|
-
const bodyStyles = createStyles({
|
|
23
|
-
marginBlock: '0',
|
|
24
|
-
});
|
|
25
|
-
/**
|
|
26
|
-
* Portals popup content into a sentinel div after the trigger (via PopupStack.pushStackContext)
|
|
27
|
-
* so DOM reading order matches page context. Uses a two-phase open so pushStackContext runs
|
|
28
|
-
* before Popper mounts and registers with the stack.
|
|
29
|
-
*/
|
|
30
|
-
export const InlinePortalPopup = () => {
|
|
31
|
-
const messageId = useUniqueId();
|
|
32
|
-
const sentinelRef = React.useRef(null);
|
|
33
|
-
const initialFocusRef = React.useRef(null);
|
|
34
|
-
const model = usePopupModel({ initialFocusRef });
|
|
35
|
-
const visible = model.state.visibility !== 'hidden';
|
|
36
|
-
const [portalReady, setPortalReady] = React.useState(false);
|
|
37
|
-
useCloseOnOutsideClick(model);
|
|
38
|
-
useCloseOnEscape(model);
|
|
39
|
-
useReturnFocus(model);
|
|
40
|
-
// Defer initial focus until Popper content is mounted. useInitialFocus runs when visible while
|
|
41
|
-
// stackRef can still point at an empty sentinel (second open) and throws.
|
|
42
|
-
React.useEffect(() => {
|
|
43
|
-
if (!visible || !portalReady) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
const el = initialFocusRef.current;
|
|
47
|
-
if (!el) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
requestAnimationFrame(() => {
|
|
51
|
-
changeFocus(el);
|
|
52
|
-
});
|
|
53
|
-
}, [visible, portalReady]);
|
|
54
|
-
React.useLayoutEffect(() => {
|
|
55
|
-
if (visible && sentinelRef.current && !portalReady) {
|
|
56
|
-
PopupStack.pushStackContext(sentinelRef.current);
|
|
57
|
-
setPortalReady(true);
|
|
58
|
-
}
|
|
59
|
-
if (!visible && portalReady) {
|
|
60
|
-
PopupStack.popStackContext(sentinelRef.current);
|
|
61
|
-
setPortalReady(false);
|
|
62
|
-
}
|
|
63
|
-
}, [visible, portalReady]);
|
|
64
|
-
return (_jsxs(Flex, { cs: layoutStyles, children: [_jsx(Flex, { children: _jsxs(Popup, { model: model, children: [_jsx(Popup.Target, { as: DeleteButton, children: "Delete Item" }), _jsx("div", { ref: sentinelRef }), visible && portalReady ? (_jsx(Popup.Popper, { placement: "top", children: _jsxs(Popup.Card, { cs: cardStyles, "aria-describedby": messageId, children: [_jsx(Popup.Heading, { children: "Delete Item" }), _jsx(Popup.Body, { children: _jsx(Box, { as: "p", id: messageId, cs: bodyStyles, children: "Are you sure you'd like to delete the item titled 'My Item'?" }) }), _jsxs(Flex, { cs: flexStyles, children: [_jsx(Popup.CloseButton, { ref: initialFocusRef, children: "Cancel" }), _jsx(Popup.CloseButton, { as: DeleteButton, children: "Delete" })] })] }) })) : null] }) }), _jsx("p", { children: "This content should come after the popup in the reading order. When someone uses a screen reader or moves through the page with tabbing, they will read or reach this content only after the popup content is shown. This helps keep the page easy to follow and makes sure that the popup is announced before any information that comes next." })] }));
|
|
65
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Default portal to body; sibling div with aria-owns references the portaled stack container
|
|
3
|
-
* so screen readers that support aria-owns can present content in logical order.
|
|
4
|
-
* useInitialFocus announces the popup in screen readers; useFocusRedirect manages Tab in/out.
|
|
5
|
-
*/
|
|
6
|
-
export declare const PopupAriaOwns: () => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
//# sourceMappingURL=PopupAriaOwns.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PopupAriaOwns.d.ts","sourceRoot":"","sources":["../../../../../../mdx/accessibility/examples/Popups/PopupAriaOwns.tsx"],"names":[],"mappings":"AAoCA;;;;GAIG;AACH,eAAO,MAAM,aAAa,+CAkDzB,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { DeleteButton } from '@workday/canvas-kit-react/button';
|
|
4
|
-
import { useUniqueId } from '@workday/canvas-kit-react/common';
|
|
5
|
-
import { Box, Flex } from '@workday/canvas-kit-react/layout';
|
|
6
|
-
import { Popup, useCloseOnEscape, useCloseOnOutsideClick, useFocusRedirect, useInitialFocus, usePopupModel, useReturnFocus, } from '@workday/canvas-kit-react/popup';
|
|
7
|
-
import { createStyles, px2rem } from '@workday/canvas-kit-styling';
|
|
8
|
-
import { system } from '@workday/canvas-tokens-web';
|
|
9
|
-
const cardStyles = createStyles({
|
|
10
|
-
width: px2rem(400),
|
|
11
|
-
});
|
|
12
|
-
const bodyStyles = createStyles({
|
|
13
|
-
marginBlock: '0',
|
|
14
|
-
});
|
|
15
|
-
const flexStyles = createStyles({
|
|
16
|
-
gap: system.gap.md,
|
|
17
|
-
padding: system.padding.xs,
|
|
18
|
-
});
|
|
19
|
-
const layoutStyles = createStyles({
|
|
20
|
-
gap: system.gap.md,
|
|
21
|
-
alignItems: 'flex-start',
|
|
22
|
-
flexDirection: 'column',
|
|
23
|
-
});
|
|
24
|
-
/**
|
|
25
|
-
* Default portal to body; sibling div with aria-owns references the portaled stack container
|
|
26
|
-
* so screen readers that support aria-owns can present content in logical order.
|
|
27
|
-
* useInitialFocus announces the popup in screen readers; useFocusRedirect manages Tab in/out.
|
|
28
|
-
*/
|
|
29
|
-
export const PopupAriaOwns = () => {
|
|
30
|
-
const initialFocusRef = React.useRef(null);
|
|
31
|
-
const model = usePopupModel({ initialFocusRef });
|
|
32
|
-
useCloseOnOutsideClick(model);
|
|
33
|
-
useCloseOnEscape(model);
|
|
34
|
-
useInitialFocus(model);
|
|
35
|
-
useReturnFocus(model);
|
|
36
|
-
useFocusRedirect(model);
|
|
37
|
-
const messageId = useUniqueId();
|
|
38
|
-
const popupId = useUniqueId();
|
|
39
|
-
const visible = model.state.visibility !== 'hidden';
|
|
40
|
-
React.useLayoutEffect(() => {
|
|
41
|
-
if (visible && model.state.stackRef.current) {
|
|
42
|
-
model.state.stackRef.current.setAttribute('id', popupId);
|
|
43
|
-
}
|
|
44
|
-
}, [model.state.stackRef, visible, popupId]);
|
|
45
|
-
return (_jsxs(Flex, { cs: layoutStyles, children: [_jsx(Flex, { children: _jsxs(Popup, { model: model, children: [_jsx(Popup.Target, { as: DeleteButton, children: "Delete Item" }), _jsx("div", { "aria-owns": popupId, style: { position: 'absolute' } }), _jsx(Popup.Popper, { children: _jsxs(Popup.Card, { cs: cardStyles, "aria-describedby": messageId, children: [_jsx(Popup.CloseIcon, { "aria-label": "Close" }), _jsx(Popup.Heading, { children: "Delete Item" }), _jsx(Popup.Body, { children: _jsx(Box, { as: "p", id: messageId, cs: bodyStyles, children: "Are you sure you'd like to delete the item titled 'My Item'?" }) }), _jsxs(Flex, { cs: flexStyles, children: [_jsx(Popup.CloseButton, { as: DeleteButton, children: "Delete" }), _jsx(Popup.CloseButton, { ref: initialFocusRef, children: "Cancel" })] })] }) })] }) }), _jsx("p", { children: "This content should come after the popup in the reading order. When someone uses a screen reader or moves through the page with tabbing, they will read or reach this content only after the popup content is shown. This helps keep the page easy to follow and makes sure that the popup is announced before any information that comes next." })] }));
|
|
46
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SidePanelWithNavigation.d.ts","sourceRoot":"","sources":["../../../../../mdx/accessibility/examples/SidePanelWithNavigation.tsx"],"names":[],"mappings":"AAkLA,eAAO,MAAM,cAAc,+CAiB1B,CAAC;AAEF,eAAO,MAAM,cAAc,+CAM1B,CAAC"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { SidePanel, useSidePanel } from '@workday/canvas-kit-preview-react/side-panel';
|
|
4
|
-
import { TertiaryButton } from '@workday/canvas-kit-react/button';
|
|
5
|
-
import { Expandable } from '@workday/canvas-kit-react/expandable';
|
|
6
|
-
import { SystemIcon } from '@workday/canvas-kit-react/icon';
|
|
7
|
-
import { Flex } from '@workday/canvas-kit-react/layout';
|
|
8
|
-
import { Menu } from '@workday/canvas-kit-react/menu';
|
|
9
|
-
import { Heading, Subtext } from '@workday/canvas-kit-react/text';
|
|
10
|
-
import { Tooltip } from '@workday/canvas-kit-react/tooltip';
|
|
11
|
-
import { createStyles, px2rem } from '@workday/canvas-kit-styling';
|
|
12
|
-
import { birthdayIcon, checkIcon, ribbonIcon, } from '@workday/canvas-system-icons-web';
|
|
13
|
-
import { system } from '@workday/canvas-tokens-web';
|
|
14
|
-
const data = {
|
|
15
|
-
bestsellers: {
|
|
16
|
-
icon: ribbonIcon,
|
|
17
|
-
title: 'Best Sellers',
|
|
18
|
-
subtitle: 'Award winning sweet treats',
|
|
19
|
-
items: ['Mango Coco Sago', 'Matcha Creme Pie', 'Key Lime Cheesecake', 'Tiramisu'],
|
|
20
|
-
},
|
|
21
|
-
cakes: {
|
|
22
|
-
icon: birthdayIcon,
|
|
23
|
-
title: 'Custom Cakes',
|
|
24
|
-
subtitle: 'To celebrate your life milestones',
|
|
25
|
-
items: ['Anniversary', 'Birthday', 'Graduation', 'Wedding'],
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
const stylesOverride = {
|
|
29
|
-
navContainer: createStyles({
|
|
30
|
-
height: px2rem(800),
|
|
31
|
-
positio: 'relative',
|
|
32
|
-
backgroundColor: system.color.bg.alt.default,
|
|
33
|
-
}),
|
|
34
|
-
heading: createStyles({
|
|
35
|
-
margin: '0',
|
|
36
|
-
}),
|
|
37
|
-
toggleBtn: createStyles({
|
|
38
|
-
top: '0',
|
|
39
|
-
}),
|
|
40
|
-
accordionContainer: createStyles({
|
|
41
|
-
listStyle: 'none',
|
|
42
|
-
flexDirection: 'column',
|
|
43
|
-
rowGap: '0',
|
|
44
|
-
paddingInlineStart: '0',
|
|
45
|
-
}),
|
|
46
|
-
accordionIcon: createStyles({
|
|
47
|
-
verticalAlign: 'middle',
|
|
48
|
-
padding: system.padding.xxs,
|
|
49
|
-
}),
|
|
50
|
-
accordionSubText: createStyles({
|
|
51
|
-
margin: '0',
|
|
52
|
-
}),
|
|
53
|
-
listContainer: createStyles({
|
|
54
|
-
listStyle: 'none',
|
|
55
|
-
padding: system.padding.md,
|
|
56
|
-
}),
|
|
57
|
-
compactListContainer: createStyles({
|
|
58
|
-
listStyle: 'none',
|
|
59
|
-
padding: system.padding.md,
|
|
60
|
-
flexDirection: 'column',
|
|
61
|
-
marginBlockStart: system.gap.xl,
|
|
62
|
-
}),
|
|
63
|
-
links: createStyles({
|
|
64
|
-
textDecoration: 'none',
|
|
65
|
-
padding: system.padding.md,
|
|
66
|
-
}),
|
|
67
|
-
linkCheck: createStyles({
|
|
68
|
-
marginInlineStart: 'auto',
|
|
69
|
-
}),
|
|
70
|
-
flyOut: createStyles({
|
|
71
|
-
marginBlockStart: '8rem',
|
|
72
|
-
}),
|
|
73
|
-
};
|
|
74
|
-
const Accordion = ({ config }) => {
|
|
75
|
-
const [currentPage, setCurrentPage] = React.useState('');
|
|
76
|
-
const handleClick = (e) => {
|
|
77
|
-
e.preventDefault();
|
|
78
|
-
const target = e.target;
|
|
79
|
-
setCurrentPage(target.textContent || '');
|
|
80
|
-
};
|
|
81
|
-
return (_jsxs(Expandable, { children: [_jsxs(Expandable.Target, { children: [_jsx(SystemIcon, { cs: stylesOverride.accordionIcon, icon: config.icon }), _jsxs(Expandable.Title, { children: [config.title, _jsx(Subtext, { size: "medium", cs: stylesOverride.accordionSubText, children: config.subtitle })] }), _jsx(Expandable.Icon, { iconPosition: "end" })] }), _jsx(Expandable.Content, { as: "ul", cs: stylesOverride.listContainer, children: config.items.map((i) => {
|
|
82
|
-
return (_jsx("li", { children: _jsxs(Flex, { as: "a", href: "#", "aria-current": i === currentPage ? 'true' : undefined, className: stylesOverride.links, onClick: handleClick, children: [i, i === currentPage && _jsx(SystemIcon, { icon: checkIcon, cs: stylesOverride.linkCheck })] }) }, i));
|
|
83
|
-
}) })] }));
|
|
84
|
-
};
|
|
85
|
-
const IconButtonMenu = ({ config }) => {
|
|
86
|
-
return (_jsxs(Menu, { children: [_jsx(Tooltip, { title: config.title, placement: "right", children: _jsx(Menu.Target, { as: TertiaryButton, children: _jsx(SystemIcon, { icon: config.icon }) }) }), _jsx(Menu.Popper, { placement: "right", children: _jsx(Menu.Card, { cs: stylesOverride.flyOut, children: _jsx(Menu.List, { children: config.items.map((i) => (_jsx(Menu.Item, { children: i }, i))) }) }) })] }));
|
|
87
|
-
};
|
|
88
|
-
const CompactView = () => {
|
|
89
|
-
return (_jsxs(Flex, { as: "ul", cs: stylesOverride.compactListContainer, children: [_jsx(Flex.Item, { as: "li", children: _jsx(IconButtonMenu, { config: data.bestsellers }) }), _jsx(Flex.Item, { as: "li", children: _jsx(IconButtonMenu, { config: data.cakes }) })] }));
|
|
90
|
-
};
|
|
91
|
-
const ExpandedView = () => {
|
|
92
|
-
return (_jsxs(Flex, { as: "ul", cs: stylesOverride.accordionContainer, children: [_jsx(Flex.Item, { as: "li", children: _jsx(Accordion, { config: data.bestsellers }) }), _jsx(Flex.Item, { as: "li", children: _jsx(Accordion, { config: data.cakes }) })] }));
|
|
93
|
-
};
|
|
94
|
-
export const SideBarContent = () => {
|
|
95
|
-
const { expanded, panelProps, labelProps, controlProps } = useSidePanel();
|
|
96
|
-
return (_jsxs(SidePanel, { as: "div", touched: panelProps.touched, expanded: panelProps.expanded, children: [_jsx(Heading, { size: "small", cs: stylesOverride.heading, ...labelProps, hidden: !expanded ? true : undefined, children: "Cake or Death Bakery" }), _jsx(SidePanel.ToggleButton, { cs: stylesOverride.toggleBtn, ...controlProps }), expanded ? _jsx(ExpandedView, {}) : _jsx(CompactView, {})] }));
|
|
97
|
-
};
|
|
98
|
-
export const WithNavigation = () => {
|
|
99
|
-
return (_jsx(Flex, { as: "nav", cs: stylesOverride.navContainer, children: _jsx(SideBarContent, {}) }));
|
|
100
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SidePanelWithOverlay.d.ts","sourceRoot":"","sources":["../../../../../mdx/accessibility/examples/SidePanelWithOverlay.tsx"],"names":[],"mappings":"AA2BA,eAAO,MAAM,WAAW,+CAgBvB,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { SidePanel, useSidePanel } from '@workday/canvas-kit-preview-react/side-panel';
|
|
3
|
-
import { Box, Flex } from '@workday/canvas-kit-react/layout';
|
|
4
|
-
import { Heading } from '@workday/canvas-kit-react/text';
|
|
5
|
-
import { createStyles, px2rem } from '@workday/canvas-kit-styling';
|
|
6
|
-
import { system } from '@workday/canvas-tokens-web';
|
|
7
|
-
const stylesOverride = {
|
|
8
|
-
panelContainer: createStyles({
|
|
9
|
-
height: px2rem(320),
|
|
10
|
-
backgroundColor: system.color.surface.alt.default,
|
|
11
|
-
position: 'relative',
|
|
12
|
-
}),
|
|
13
|
-
panelContent: createStyles({
|
|
14
|
-
alignItems: 'center',
|
|
15
|
-
padding: system.padding.md,
|
|
16
|
-
}),
|
|
17
|
-
panel: createStyles({
|
|
18
|
-
zIndex: 1,
|
|
19
|
-
}),
|
|
20
|
-
overlay: createStyles({
|
|
21
|
-
position: 'absolute',
|
|
22
|
-
background: system.color.surface.overlay.scrim,
|
|
23
|
-
height: '100%',
|
|
24
|
-
width: '100%',
|
|
25
|
-
}),
|
|
26
|
-
};
|
|
27
|
-
export const WithOverlay = () => {
|
|
28
|
-
const { expanded, panelProps, labelProps, controlProps } = useSidePanel();
|
|
29
|
-
return (_jsxs(Flex, { cs: stylesOverride.panelContainer, children: [_jsx(SidePanel, { className: stylesOverride.panel, ...panelProps, variant: "alternate", children: _jsxs(Flex, { cs: stylesOverride.panelContainer, children: [_jsx(Heading, { size: "small", ...labelProps, hidden: !expanded ? true : undefined, children: "Alternate Panel" }), _jsx(SidePanel.ToggleButton, { ...controlProps })] }) }), expanded && _jsx(Box, { cs: stylesOverride.overlay })] }));
|
|
30
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WithColumnHeaderFilters.d.ts","sourceRoot":"","sources":["../../../../../../mdx/accessibility/examples/Table/WithColumnHeaderFilters.tsx"],"names":[],"mappings":"AAsJA,eAAO,MAAM,uBAAuB,+CAyDnC,CAAC"}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { PrimaryButton, TertiaryButton } from '@workday/canvas-kit-react/button';
|
|
4
|
-
import { AriaLiveRegion, createComponent, useUniqueId } from '@workday/canvas-kit-react/common';
|
|
5
|
-
import { FormField } from '@workday/canvas-kit-react/form-field';
|
|
6
|
-
import { SystemIcon } from '@workday/canvas-kit-react/icon';
|
|
7
|
-
import { Flex } from '@workday/canvas-kit-react/layout';
|
|
8
|
-
import { Popup, useCloseOnEscape, useCloseOnOutsideClick, useFocusRedirect, useInitialFocus, usePopupModel, useReturnFocus, } from '@workday/canvas-kit-react/popup';
|
|
9
|
-
import { Table } from '@workday/canvas-kit-react/table';
|
|
10
|
-
import { Text } from '@workday/canvas-kit-react/text';
|
|
11
|
-
import { InputGroup, TextInput } from '@workday/canvas-kit-react/text-input';
|
|
12
|
-
import { Tooltip } from '@workday/canvas-kit-react/tooltip';
|
|
13
|
-
import { createStyles } from '@workday/canvas-kit-styling';
|
|
14
|
-
import { filterIcon, searchIcon } from '@workday/canvas-system-icons-web';
|
|
15
|
-
import { system } from '@workday/canvas-tokens-web';
|
|
16
|
-
const countryData = [
|
|
17
|
-
{ country: 'Australia', capital: 'Canberra', population: 25690000 },
|
|
18
|
-
{ country: 'Bahamas', capital: 'Nassau', population: 407906 },
|
|
19
|
-
{ country: 'Canada', capital: 'Ottawa', population: 38250000 },
|
|
20
|
-
{ country: 'Fiji', capital: 'Suva', population: 924610 },
|
|
21
|
-
{ country: 'Ghana', capital: 'Accra', population: 32830000 },
|
|
22
|
-
{ country: 'Hong Kong', capital: 'City of Victoria', population: 7413000 },
|
|
23
|
-
{ country: 'India', capital: 'New Delhi', population: 1408000000 },
|
|
24
|
-
{ country: 'Ireland', capital: 'Dublin', population: 5033000 },
|
|
25
|
-
{ country: 'Jamaica', capital: 'Kingston', population: 2828000 },
|
|
26
|
-
{ country: 'Kenya', capital: 'Nairobi', population: 53010000 },
|
|
27
|
-
{ country: 'Micronesia', capital: 'Palikir', population: 113131 },
|
|
28
|
-
{ country: 'New Zealand', capital: 'Wellington', population: 5123000 },
|
|
29
|
-
{ country: 'Philippines', capital: 'Manila', population: 113900000 },
|
|
30
|
-
{ country: 'Puerto Rico', capital: 'San Juan', population: 3264000 },
|
|
31
|
-
{ country: 'Samoa', capital: 'Apia', population: 218764 },
|
|
32
|
-
{ country: 'Singapore', capital: 'Singapore', population: 5454000 },
|
|
33
|
-
{ country: 'Tanzania', capital: 'Dodoma', population: 63590000 },
|
|
34
|
-
{ country: 'United Kingdom', capital: 'London', population: 67330000 },
|
|
35
|
-
{ country: 'United States', capital: 'Washington, D.C.', population: 331900000 },
|
|
36
|
-
{ country: 'Zimbabwe', capital: 'Harare', population: 15990000 },
|
|
37
|
-
];
|
|
38
|
-
const textStyles = createStyles({
|
|
39
|
-
paddingInlineStart: system.padding.md,
|
|
40
|
-
});
|
|
41
|
-
const FilterableColumnHeader = createComponent('th')({
|
|
42
|
-
displayName: 'FilterableColumnHeader',
|
|
43
|
-
Component: ({ label, onFilter }, ref) => {
|
|
44
|
-
const [inputVal, setInputVal] = React.useState('');
|
|
45
|
-
const targetId = useUniqueId();
|
|
46
|
-
const popupId = useUniqueId();
|
|
47
|
-
const initialFocusRef = React.useRef(null);
|
|
48
|
-
const filterPopupModel = usePopupModel({
|
|
49
|
-
initialFocusRef,
|
|
50
|
-
});
|
|
51
|
-
useCloseOnOutsideClick(filterPopupModel);
|
|
52
|
-
useCloseOnEscape(filterPopupModel);
|
|
53
|
-
useInitialFocus(filterPopupModel);
|
|
54
|
-
useFocusRedirect(filterPopupModel);
|
|
55
|
-
useReturnFocus(filterPopupModel);
|
|
56
|
-
function handleChange(e) {
|
|
57
|
-
const newVal = e.target.value;
|
|
58
|
-
setInputVal(newVal);
|
|
59
|
-
onFilter({ filterText: newVal, column: label.toLowerCase() });
|
|
60
|
-
}
|
|
61
|
-
return (_jsx(Table.Header, { scope: "col", "aria-owns": targetId + ' ' + popupId, children: _jsxs(Popup, { model: filterPopupModel, children: [_jsx(Tooltip, { title: `Filter${inputVal !== '' ? `ed: "${inputVal}"` : ''}`, type: "description", children: _jsx(Popup.Target, { as: TertiaryButton, id: targetId, icon: inputVal === '' ? searchIcon : filterIcon, iconPosition: "end", children: label }) }), _jsx(Popup.Popper, { children: _jsxs(Popup.Card, { id: popupId, children: [_jsx(Popup.Heading, { children: "Filter" }), _jsx(Popup.Body, { children: _jsxs(FormField, { children: [_jsx(FormField.Label, { children: label }), _jsxs(FormField.Input, { as: InputGroup, children: [_jsx(InputGroup.InnerStart, { children: _jsx(SystemIcon, { icon: searchIcon }) }), _jsx(InputGroup.Input, { as: TextInput, type: "search", ref: initialFocusRef, onChange: handleChange, value: inputVal })] })] }) }), _jsx(Flex, { children: _jsx(Popup.CloseButton, { as: PrimaryButton, children: "Done" }) })] }) })] }) }));
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
function filterTableData(data, filters) {
|
|
65
|
-
return data.filter(item => {
|
|
66
|
-
for (const key in filters) {
|
|
67
|
-
if (filters.hasOwnProperty(key) && filters[key]) {
|
|
68
|
-
const filterText = filters[key].toLowerCase();
|
|
69
|
-
const itemValue = String(item[key]).toLowerCase();
|
|
70
|
-
if (!itemValue.includes(filterText)) {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return true;
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
export const FilterableColumnHeaders = () => {
|
|
79
|
-
const [filteredData, setFilteredData] = React.useState(countryData);
|
|
80
|
-
const [colFilters, setColFilters] = React.useState({
|
|
81
|
-
country: '',
|
|
82
|
-
capital: '',
|
|
83
|
-
population: '',
|
|
84
|
-
});
|
|
85
|
-
React.useEffect(() => {
|
|
86
|
-
setFilteredData(filterTableData(countryData, colFilters));
|
|
87
|
-
}, [colFilters]);
|
|
88
|
-
let typingDelay;
|
|
89
|
-
function handleColFilters({ filterText, column }) {
|
|
90
|
-
clearTimeout(typingDelay);
|
|
91
|
-
typingDelay = setTimeout(() => {
|
|
92
|
-
setColFilters(prev => {
|
|
93
|
-
const newState = { ...prev, [column]: filterText };
|
|
94
|
-
return newState;
|
|
95
|
-
});
|
|
96
|
-
}, 400);
|
|
97
|
-
}
|
|
98
|
-
return (_jsxs(Table, { cs: { maxHeight: '40rem' }, children: [_jsxs(Table.Caption, { children: ["Population Listed by Country (2021)", _jsxs(AriaLiveRegion, { cs: textStyles, children: [filteredData.length, " of ", countryData.length, " items"] })] }), _jsx(Table.Head, { children: _jsxs(Table.Row, { children: [_jsx(FilterableColumnHeader, { label: "Country", onFilter: handleColFilters }), _jsx(FilterableColumnHeader, { label: "Capital", onFilter: handleColFilters }), _jsx(FilterableColumnHeader, { label: "Population", onFilter: handleColFilters })] }) }), _jsx(Table.Body, { children: filteredData.map(item => {
|
|
99
|
-
return (_jsxs(Table.Row, { children: [_jsx(Table.Header, { scope: "row", children: _jsx(Text, { cs: textStyles, children: item.country }) }), _jsx(Table.Cell, { children: _jsx(Text, { cs: textStyles, children: item.capital }) }), _jsx(Table.Cell, { children: _jsx(Text, { cs: textStyles, children: item.population.toLocaleString() }) })] }, item.country));
|
|
100
|
-
}) })] }));
|
|
101
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WithExpandableRows.d.ts","sourceRoot":"","sources":["../../../../../../mdx/accessibility/examples/Table/WithExpandableRows.tsx"],"names":[],"mappings":"AA8LA,eAAO,MAAM,cAAc,+CAwB1B,CAAC"}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { StatusIndicator } from '@workday/canvas-kit-preview-react/status-indicator';
|
|
4
|
-
import { TertiaryButton } from '@workday/canvas-kit-react/button';
|
|
5
|
-
import { generateUniqueId } from '@workday/canvas-kit-react/common';
|
|
6
|
-
import { Table } from '@workday/canvas-kit-react/table';
|
|
7
|
-
import { Heading, Subtext } from '@workday/canvas-kit-react/text';
|
|
8
|
-
import { Tooltip } from '@workday/canvas-kit-react/tooltip';
|
|
9
|
-
import { createStyles } from '@workday/canvas-kit-styling';
|
|
10
|
-
import { chevronDownSmallIcon, chevronRightSmallIcon } from '@workday/canvas-system-icons-web';
|
|
11
|
-
import { system } from '@workday/canvas-tokens-web';
|
|
12
|
-
const headingID = generateUniqueId();
|
|
13
|
-
const autoData = [
|
|
14
|
-
{
|
|
15
|
-
id: generateUniqueId(),
|
|
16
|
-
brand: 'Porsche',
|
|
17
|
-
model: '992 911 GT3',
|
|
18
|
-
year: '2022',
|
|
19
|
-
price: 'Starts at $160,000',
|
|
20
|
-
engine: '4.0L Flat 6',
|
|
21
|
-
transmission: 'PDK or 7-Speed Manual',
|
|
22
|
-
horsepower: '502hp',
|
|
23
|
-
torque: '346 lb-ft',
|
|
24
|
-
curbWeight: '3,164 lbs',
|
|
25
|
-
orderStatus: 'Order Placed',
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
id: generateUniqueId(),
|
|
29
|
-
brand: 'BMW',
|
|
30
|
-
model: 'M5 Competition',
|
|
31
|
-
year: '2018',
|
|
32
|
-
price: 'Starts at $105,000',
|
|
33
|
-
engine: 'Twin-Turbo 4.4L V8',
|
|
34
|
-
transmission: 'Automatic',
|
|
35
|
-
horsepower: '627hp',
|
|
36
|
-
torque: '553 lb-ft',
|
|
37
|
-
curbWeight: '4,345 lbs',
|
|
38
|
-
orderStatus: 'Order Fulfilled',
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
id: generateUniqueId(),
|
|
42
|
-
brand: 'Audi',
|
|
43
|
-
model: 'R8',
|
|
44
|
-
year: '2022',
|
|
45
|
-
price: 'Starts at $148,000',
|
|
46
|
-
engine: '5.2L V10',
|
|
47
|
-
transmission: 'Automatic',
|
|
48
|
-
horsepower: '562hp',
|
|
49
|
-
torque: '408 lb-ft',
|
|
50
|
-
curbWeight: '3,594 lbs',
|
|
51
|
-
orderStatus: 'Order Fulfilled',
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
id: generateUniqueId(),
|
|
55
|
-
brand: 'Lotus',
|
|
56
|
-
model: 'Emira',
|
|
57
|
-
year: '2023',
|
|
58
|
-
price: 'Starts at $78,000',
|
|
59
|
-
engine: 'Supercharged 3.5L V6',
|
|
60
|
-
transmission: 'Automatic or 6-Speed Manual',
|
|
61
|
-
horsepower: '400hp',
|
|
62
|
-
torque: '317 lb-ft',
|
|
63
|
-
curbWeight: '3520 lbs',
|
|
64
|
-
orderStatus: 'Shipped: In Transit',
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
id: generateUniqueId(),
|
|
68
|
-
brand: 'Toyota',
|
|
69
|
-
model: 'Supra',
|
|
70
|
-
year: '1998',
|
|
71
|
-
price: '$40,000 - $80,000',
|
|
72
|
-
engine: '3.0L Inline 6',
|
|
73
|
-
transmission: 'Automatic or 6-Speed Manual',
|
|
74
|
-
horsepower: '320hp',
|
|
75
|
-
torque: '315 lb-ft',
|
|
76
|
-
curbWeight: '3,599 lbs',
|
|
77
|
-
orderStatus: 'Delivered',
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
id: generateUniqueId(),
|
|
81
|
-
brand: 'Nissan',
|
|
82
|
-
model: 'Skyline GT-R',
|
|
83
|
-
year: '1994',
|
|
84
|
-
price: '$45,000 - $90,000',
|
|
85
|
-
engine: '2.6L Twin-Turbo Inline 6',
|
|
86
|
-
transmission: '5-Speed Manual',
|
|
87
|
-
horsepower: '276hp',
|
|
88
|
-
torque: '260 lb-ft',
|
|
89
|
-
curbWeight: '3,153 lbs',
|
|
90
|
-
orderStatus: 'Delivered',
|
|
91
|
-
},
|
|
92
|
-
];
|
|
93
|
-
const expandableSectionStyles = createStyles({
|
|
94
|
-
alignItems: 'flex-start',
|
|
95
|
-
display: 'flex',
|
|
96
|
-
gap: system.gap.md,
|
|
97
|
-
padding: system.padding.xxl,
|
|
98
|
-
});
|
|
99
|
-
const expandableHeadingStyles = createStyles({
|
|
100
|
-
margin: 0,
|
|
101
|
-
fontWeight: system.fontWeight.bold,
|
|
102
|
-
});
|
|
103
|
-
const expandableListStyles = createStyles({
|
|
104
|
-
listStyle: 'none',
|
|
105
|
-
margin: 0,
|
|
106
|
-
padding: 0,
|
|
107
|
-
gap: system.gap.sm,
|
|
108
|
-
});
|
|
109
|
-
function ExpandableRow({ data }) {
|
|
110
|
-
const [rowExpanded, setRowExpanded] = React.useState(false);
|
|
111
|
-
return (_jsxs(_Fragment, { children: [_jsxs(Table.Row, { cs: { gridTemplateColumns: '4rem repeat(4, 1fr)' }, children: [_jsx(Table.Cell, { children: _jsx(Tooltip, { title: `${data.brand} ${data.model}`, children: _jsx(TertiaryButton, { size: "small", icon: rowExpanded ? chevronDownSmallIcon : chevronRightSmallIcon, "aria-expanded": rowExpanded, onClick: () => setRowExpanded(!rowExpanded) }) }) }), _jsx(Table.Header, { scope: "row", children: data.brand }), _jsx(Table.Cell, { children: data.model }), _jsx(Table.Cell, { children: data.year }), _jsx(Table.Cell, { children: data.price })] }), rowExpanded && (_jsx(Table.Row, { children: _jsxs(Table.Cell, { colSpan: 5, cs: expandableSectionStyles, children: [_jsxs("div", { children: [_jsx(Subtext, { as: "h4", size: "large", cs: expandableHeadingStyles, children: "Status" }), _jsx(StatusIndicator, { variant: "blue", children: data.orderStatus })] }), _jsxs("div", { children: [_jsx(Subtext, { as: "h4", size: "large", cs: expandableHeadingStyles, children: "Specifications" }), _jsxs("ul", { className: expandableListStyles, children: [_jsxs(Subtext, { as: "li", size: "large", children: ["Engine: ", data.engine] }), _jsxs(Subtext, { as: "li", size: "large", children: ["Transmission: ", data.transmission] }), _jsxs(Subtext, { as: "li", size: "large", children: ["Horsepower: ", data.horsepower] }), _jsxs(Subtext, { as: "li", size: "large", children: ["Torque: ", data.torque] }), _jsxs(Subtext, { as: "li", size: "large", children: ["Curb Weight: ", data.curbWeight] })] })] })] }) }))] }));
|
|
112
|
-
}
|
|
113
|
-
export const ExpandableRows = () => {
|
|
114
|
-
return (_jsxs(_Fragment, { children: [_jsx(Heading, { as: "h3", id: headingID, size: "small", children: "Showroom Inventory" }), _jsxs(Table, { "aria-labelledby": headingID, children: [_jsx(Table.Head, { children: _jsxs(Table.Row, { cs: { gridTemplateColumns: '4rem repeat(4, 1fr)' }, children: [_jsx(Table.Cell, {}), _jsx(Table.Header, { scope: "col", children: "Make" }), _jsx(Table.Header, { scope: "col", children: "Model" }), _jsx(Table.Header, { scope: "col", children: "Year" }), _jsx(Table.Header, { scope: "col", children: "Price" })] }) }), _jsx(Table.Body, { children: autoData.map(item => (_jsx(ExpandableRow, { data: item }, item.id))) })] })] }));
|
|
115
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WithFormFields.d.ts","sourceRoot":"","sources":["../../../../../../mdx/accessibility/examples/Table/WithFormFields.tsx"],"names":[],"mappings":"AAyHA,eAAO,MAAM,cAAc,+CAiC1B,CAAC"}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { TertiaryButton } from '@workday/canvas-kit-react/button';
|
|
4
|
-
import { Checkbox } from '@workday/canvas-kit-react/checkbox';
|
|
5
|
-
import { useUniqueId } from '@workday/canvas-kit-react/common';
|
|
6
|
-
import { Table } from '@workday/canvas-kit-react/table';
|
|
7
|
-
import { TextInput } from '@workday/canvas-kit-react/text-input';
|
|
8
|
-
import { Tooltip } from '@workday/canvas-kit-react/tooltip';
|
|
9
|
-
import { createStyles } from '@workday/canvas-kit-styling';
|
|
10
|
-
import { trashIcon } from '@workday/canvas-system-icons-web';
|
|
11
|
-
import { system } from '@workday/canvas-tokens-web';
|
|
12
|
-
const rowStyles = createStyles({
|
|
13
|
-
gridTemplateColumns: '24rem 12rem 7rem 7rem',
|
|
14
|
-
});
|
|
15
|
-
const centerStyles = createStyles({
|
|
16
|
-
display: 'flex',
|
|
17
|
-
justifyContent: 'center',
|
|
18
|
-
alignItems: 'center',
|
|
19
|
-
});
|
|
20
|
-
const currencyInputContainer = createStyles({
|
|
21
|
-
position: 'relative',
|
|
22
|
-
display: 'inline-block',
|
|
23
|
-
});
|
|
24
|
-
const dollarPrefix = createStyles({
|
|
25
|
-
position: 'absolute',
|
|
26
|
-
left: system.gap.sm,
|
|
27
|
-
top: '50%',
|
|
28
|
-
transform: 'translateY(-50%)',
|
|
29
|
-
color: system.color.fg.default,
|
|
30
|
-
pointerEvents: 'none',
|
|
31
|
-
zIndex: 1,
|
|
32
|
-
...system.type.subtext.lg,
|
|
33
|
-
});
|
|
34
|
-
const currencyInput = createStyles({
|
|
35
|
-
paddingInlineStart: system.padding.md, // Make room for dollar sign
|
|
36
|
-
});
|
|
37
|
-
const expensesData = [
|
|
38
|
-
'Rent',
|
|
39
|
-
'Groceries',
|
|
40
|
-
'Electricity bill',
|
|
41
|
-
'Internet service',
|
|
42
|
-
'Gasoline',
|
|
43
|
-
'Cell phone bill',
|
|
44
|
-
'Health insurance',
|
|
45
|
-
'Car payment',
|
|
46
|
-
'Student loan payment',
|
|
47
|
-
'Dining out',
|
|
48
|
-
];
|
|
49
|
-
const LineItem = ({ itemName, labelIds }) => {
|
|
50
|
-
const [name, setName] = React.useState(itemName);
|
|
51
|
-
const [amount, setAmount] = React.useState('');
|
|
52
|
-
function handleNameChange(e) {
|
|
53
|
-
setName(e.target.value);
|
|
54
|
-
}
|
|
55
|
-
function handleAmountChange(e) {
|
|
56
|
-
const value = e.target.value;
|
|
57
|
-
// For type="number", the browser handles most validation
|
|
58
|
-
// We just need to limit decimal places to 2 for currency
|
|
59
|
-
if (value.includes('.')) {
|
|
60
|
-
const parts = value.split('.');
|
|
61
|
-
if (parts[1] && parts[1].length > 2) {
|
|
62
|
-
// Limit to 2 decimal places
|
|
63
|
-
const limitedValue = parts[0] + '.' + parts[1].substring(0, 2);
|
|
64
|
-
setAmount(limitedValue);
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
setAmount(value);
|
|
69
|
-
}
|
|
70
|
-
return (_jsxs(Table.Row, { cs: rowStyles, children: [_jsx(Table.Header, { scope: "row", children: _jsx(TextInput, { onChange: handleNameChange, value: name, "aria-labelledby": labelIds.name }) }), _jsx(Table.Cell, { children: _jsxs("div", { className: currencyInputContainer, children: [_jsx("span", { className: dollarPrefix, "aria-hidden": "true", children: "$" }), _jsx(TextInput, { type: "number", value: amount, onChange: handleAmountChange, placeholder: "0.00", min: "0", step: "0.01", width: "10.5rem", "aria-labelledby": labelIds.amount, cs: currencyInput })] }) }), _jsx(Table.Cell, { cs: centerStyles, children: _jsx(Checkbox, { "aria-labelledby": labelIds.recon }) }), _jsx(Table.Cell, { cs: centerStyles, children: _jsx(Tooltip, { title: "Delete", children: _jsx(TertiaryButton, { icon: trashIcon }) }) })] }));
|
|
71
|
-
};
|
|
72
|
-
export const WithFormFields = () => {
|
|
73
|
-
const colHeadIds = {
|
|
74
|
-
name: useUniqueId(),
|
|
75
|
-
amount: useUniqueId(),
|
|
76
|
-
recon: useUniqueId(),
|
|
77
|
-
};
|
|
78
|
-
return (_jsxs(Table, { children: [_jsx(Table.Caption, { children: "Budget Planning Tool" }), _jsx(Table.Head, { children: _jsxs(Table.Row, { cs: rowStyles, children: [_jsxs(Table.Header, { scope: "col", id: colHeadIds.name, children: ["Expense Name", ' '] }), _jsxs(Table.Header, { scope: "col", id: colHeadIds.amount, children: ["Budgeted Amount (USD)", ' '] }), _jsx(Table.Header, { scope: "col", id: colHeadIds.recon, cs: centerStyles, children: "Reconciled" }), _jsxs(Table.Header, { scope: "col", cs: centerStyles, children: ["Actions", ' '] })] }) }), _jsx(Table.Body, { children: expensesData.map(i => (_jsx(LineItem, { itemName: i, labelIds: colHeadIds }))) })] }));
|
|
79
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WithSelectableRows.d.ts","sourceRoot":"","sources":["../../../../../../mdx/accessibility/examples/Table/WithSelectableRows.tsx"],"names":[],"mappings":"AA0EA,eAAO,MAAM,cAAc,+CAiF1B,CAAC"}
|