UNPKG

@workday/canvas-kit-react

Version:

The parent module that contains all Workday Canvas Kit React components

36 lines (35 loc) 2.9 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.LoadingDots = exports.loadingDotsStencil = void 0; const jsx_runtime_1 = require("react/jsx-runtime"); const canvas_tokens_web_1 = require("@workday/canvas-tokens-web"); const common_1 = require("@workday/canvas-kit-react/common"); const canvas_kit_styling_1 = require("@workday/canvas-kit-styling"); /** * Keyframe for the dots loading animation. */ const keyframesLoading = (0, canvas_kit_styling_1.keyframes)({ name: "4c7rte", styles: "0%, 80%, 100%{transform:scale(0);}40%{transform:scale(1);}0%, 79%, 100%{opacity:0.6;}27%{opacity:1;}53%{opacity:0.8;}" }); exports.loadingDotsStencil = (0, canvas_kit_styling_1.createStencil)({ vars: { animationDurationMs: '40ms', loadingDotColor: canvas_tokens_web_1.system.color.bg.muted.strong, }, parts: { loadingAnimationDot: 'loading-animation-dot', }, base: { name: "48o3we", styles: "--animationDurationMs-loading-dots-89a0c0:40ms;--loadingDotColor-loading-dots-89a0c0:var(--cnvs-sys-color-bg-muted-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-89a0c0);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-4c7rte;animation-duration:calc(var(--animationDurationMs-loading-dots-89a0c0) * 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-89a0c0) * 4);}&:nth-child(3){animation-delay:calc(var(--animationDurationMs-loading-dots-89a0c0) * 8);}}" }, modifiers: { variant: { inverse: { name: "44yc01", styles: "[data-part=\"loading-animation-dot\"]{background-color:var(--cnvs-sys-color-bg-default, var(--loadingDotColor-loading-dots-89a0c0));}" } } } }, "loading-dots-89a0c0"); /** * A simple component that displays three horizontal dots, to be used when some data is loading. */ exports.LoadingDots = (0, common_1.createComponent)('div')({ displayName: 'LoadingDots', Component: ({ loadingDotColor, animationDurationMs, variant, ...elemProps }, ref, Element) => { return ((0, jsx_runtime_1.jsxs)(Element, { ref: ref, ...(0, canvas_kit_styling_1.handleCsProp)(elemProps, (0, exports.loadingDotsStencil)({ loadingDotColor, animationDurationMs, variant })), children: [(0, jsx_runtime_1.jsx)("div", { "data-part": "loading-animation-dot" }), (0, jsx_runtime_1.jsx)("div", { "data-part": "loading-animation-dot" }), (0, jsx_runtime_1.jsx)("div", { "data-part": "loading-animation-dot" })] })); }, });