UNPKG

@workday/canvas-kit-preview-react

Version:

Canvas Kit Preview is made up of components that have the full design and a11y review, are part of the DS ecosystem and are approved for use in product. The API's could be subject to change, but not without strong communication and migration strategies.

36 lines (35 loc) 2.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.LoadingSparkles = exports.loadingSparklesStencil = 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 icon_1 = require("@workday/canvas-kit-react/icon"); const canvas_kit_styling_1 = require("@workday/canvas-kit-styling"); const sparkleIcon_1 = require("./sparkleIcon"); /** * Duration of the sparkle animation (in ms). */ const ANIMATION_DURATION_MS = 1230; /** * The animation for the sparkle. */ const LOADING_ANIMATION = (0, canvas_kit_styling_1.keyframes)({ name: "368twn", styles: "0%, 79%, 100%{opacity:0.2;transform:scale(0.55);}27%{opacity:1;transform:scale(1);}53%{opacity:0.6;transform:scale(0.7);}" }); /** * An individual loading sparkle. ✨ */ const Sparkle = () => { return (0, jsx_runtime_1.jsx)(icon_1.SystemIcon, { "data-part": "sparkle", icon: sparkleIcon_1.sparkleIcon, size: canvas_tokens_web_1.system.space.x3 }); }; exports.loadingSparklesStencil = (0, canvas_kit_styling_1.createStencil)({ base: { name: "rjl8d", styles: "box-sizing:border-box;display:inline-flex;gap:0.0625rem;& [data-part=\"sparkle\"]{animation-duration:1230ms;animation-fill-mode:both;animation-iteration-count:infinite;animation-name:animation-368twn;animation-timing-function:ease-in-out;--color-system-icon-3a4847:var(--cnvs-sys-color-fg-ai);&:nth-child(1){animation-delay:0ms;}&:nth-child(2){animation-delay:calc(1230ms * (1/3));}&:nth-child(3){animation-delay:calc(1230ms * (2/3));}}" } }, "loading-sparkles-322f75"); /** * A simple component that displays three horizontal sparkles, to be used when an AI operation is in progress. */ exports.LoadingSparkles = (0, common_1.createComponent)('div')({ displayName: 'LoadingSparkles', Component: (elemProps, ref, Element) => { return ((0, jsx_runtime_1.jsxs)(Element, { ref: ref, role: "status", ...(0, canvas_kit_styling_1.handleCsProp)(elemProps, (0, exports.loadingSparklesStencil)()), children: [(0, jsx_runtime_1.jsx)(Sparkle, {}), (0, jsx_runtime_1.jsx)(Sparkle, {}), (0, jsx_runtime_1.jsx)(Sparkle, {})] })); }, });