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

37 lines 2.38 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 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.input) || (style === null || style === void 0 ? void 0 : style.label))) { const computedState = getComputedAbstractSwitchState(checked, disabled, readOnly, false); properties = { control: { background: ((_a = style === null || style === void 0 ? void 0 : style.input) === null || _a === void 0 ? void 0 : _a.background) && style.input.background[computedState], }, label: { color: ((_b = style === null || style === void 0 ? void 0 : style.label) === null || _b === void 0 ? void 0 : _b.color) && style.label.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; } export function getStyledControlStyle(style, checked, disabled, readOnly) { var _a, _b; let properties = {}; if (SYSTEM === 'core' && ((_b = (_a = style === null || style === void 0 ? void 0 : style.input) === null || _a === void 0 ? void 0 : _a.handle) === null || _b === void 0 ? void 0 : _b.background)) { const computedState = getComputedAbstractSwitchState(checked, disabled, readOnly, undefined); properties = { background: style.input.handle.background[computedState], }; } return properties; } //# sourceMappingURL=style.js.map