UNPKG

@awsui/components-react

Version:

On July 19th, 2022, we launched [Cloudscape Design System](https://cloudscape.design). Cloudscape is an evolution of AWS-UI. It consists of user interface guidelines, front-end components, design resources, and development tools for building intuitive, en

50 lines 3.18 kB
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { SYSTEM } from '../internal/environment'; import { getComputedAbstractSwitchState } from '../internal/utils/style'; export function getOuterCircleStyle(style, checked, disabled, readOnly) { var _a, _b; let properties; if (SYSTEM === 'core' && (style === null || style === void 0 ? void 0 : style.input)) { const computedState = getComputedAbstractSwitchState(checked, disabled, readOnly, undefined); properties = { fill: ((_a = style.input) === null || _a === void 0 ? void 0 : _a.fill) && style.input.fill[computedState], stroke: ((_b = style.input) === null || _b === void 0 ? void 0 : _b.stroke) && style.input.stroke[computedState], }; } return properties; } export function getInnerCircleStyle(style, checked, disabled, readOnly) { var _a, _b, _c; let properties; if (SYSTEM === 'core' && (style === null || style === void 0 ? void 0 : style.input)) { const computedState = getComputedAbstractSwitchState(checked, disabled, readOnly, undefined); properties = { fill: ((_b = (_a = style.input) === null || _a === void 0 ? void 0 : _a.circle) === null || _b === void 0 ? void 0 : _b.fill) && style.input.circle.fill[computedState], stroke: ((_c = style.input) === null || _c === void 0 ? void 0 : _c.fill) && style.input.fill[computedState], }; } return properties; } export function getAbstractSwitchStyles(style, checked, disabled, readOnly) { var _a, _b, _c, _d, _e, _f, _g, _h; let properties = {}; if (SYSTEM === 'core' && ((style === null || style === void 0 ? void 0 : style.label) || (style === null || style === void 0 ? void 0 : style.description) || (style === null || style === void 0 ? void 0 : style.input))) { const computedState = getComputedAbstractSwitchState(checked, disabled, readOnly, undefined); properties = { label: { color: ((_a = style === null || style === void 0 ? void 0 : style.label) === null || _a === void 0 ? void 0 : _a.color) && style.label.color[computedState], }, description: { color: ((_b = style === null || style === void 0 ? void 0 : style.description) === null || _b === void 0 ? void 0 : _b.color) && style.description.color[computedState], }, focusRing: { borderColor: (_d = (_c = style === null || style === void 0 ? void 0 : style.input) === null || _c === void 0 ? void 0 : _c.focusRing) === null || _d === void 0 ? void 0 : _d.borderColor, borderRadius: (_f = (_e = style === null || style === void 0 ? void 0 : style.input) === null || _e === void 0 ? void 0 : _e.focusRing) === null || _f === void 0 ? void 0 : _f.borderRadius, borderWidth: (_h = (_g = style === null || style === void 0 ? void 0 : style.input) === null || _g === void 0 ? void 0 : _g.focusRing) === null || _h === void 0 ? void 0 : _h.borderWidth, }, }; } return properties; } //# sourceMappingURL=style.js.map