UNPKG

@workday/canvas-kit-react

Version:

The parent module that contains all Workday Canvas Kit React components

25 lines (24 loc) 2.23 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { system } from '@workday/canvas-tokens-web'; import { createComponent } from '@workday/canvas-kit-react/common'; import { handleCsProp, keyframes, createStencil, calc, px2rem, } from '@workday/canvas-kit-styling'; /** * Keyframe for the dots loading animation. */ const keyframesLoading = keyframes({ name: "3kxwd0", styles: "0%, 80%, 100%{transform:scale(0);}40%{transform:scale(1);}" }); export const loadingDotsStencil = createStencil({ vars: { animationDurationMs: '40ms', loadingDotColor: system.color.bg.alt.strong, }, base: { name: "3qeewt", styles: "--animationDurationMs-loading-dots-b610f7:40ms;--loadingDotColor-loading-dots-b610f7:var(--cnvs-sys-color-bg-alt-strong);box-sizing:border-box;display:inline-flex;gap:var(--cnvs-sys-space-x2);& [data-part=\"loading-animation-dot\"]{background-color:var(--loadingDotColor-loading-dots-b610f7);width:var(--cnvs-sys-space-x4);height:var(--cnvs-sys-space-x4);font-size:var(--cnvs-sys-space-zero);border-radius:var(--cnvs-sys-shape-round);outline:0.125rem solid transparent;transform:scale(0);display:inline-block;animation-name:animation-3kxwd0;animation-duration:calc(var(--animationDurationMs-loading-dots-b610f7) * 35);animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-fill-mode:both;&:nth-child(1){animation-delay:0ms;}&:nth-child(2){animation-delay:calc(var(--animationDurationMs-loading-dots-b610f7) * 4);}&:nth-child(3){animation-delay:calc(var(--animationDurationMs-loading-dots-b610f7) * 8);}}" } }, "loading-dots-b610f7"); /** * A simple component that displays three horizontal dots, to be used when some data is loading. */ export const LoadingDots = createComponent('div')({ displayName: 'LoadingDots', Component: ({ loadingDotColor, animationDurationMs, ...elemProps }, ref, Element) => { return (_jsxs(Element, { ref: ref, ...handleCsProp(elemProps, loadingDotsStencil({ loadingDotColor, animationDurationMs })), children: [_jsx("div", { "data-part": "loading-animation-dot" }), _jsx("div", { "data-part": "loading-animation-dot" }), _jsx("div", { "data-part": "loading-animation-dot" })] })); }, });