UNPKG

@atlaskit/flag

Version:

A flag is used for confirmations, alerts, and acknowledgments that require minimal user interaction, often displayed using a flag group.

92 lines (90 loc) 5.95 kB
/* flag-actions.tsx generated by @compiled/babel-plugin v3.0.2 */ /* eslint-disable @atlaskit/design-system/no-nested-styles */ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); var _typeof = require("@babel/runtime/helpers/typeof"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; require("./flag-actions.compiled.css"); var React = _interopRequireWildcard(require("react")); var _runtime = require("@compiled/react/runtime"); var _customThemeButton = _interopRequireDefault(require("@atlaskit/button/custom-theme-button/custom-theme-button")); var _fg = require("@atlaskit/platform-feature-flags/fg"); var _compiled = require("@atlaskit/primitives/compiled"); var _actionTextColor = require("./action-text-color"); var _constants = require("./constants"); var _theme = require("./theme"); function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); } var buttonStylesOld = null; var buttonStyles = null; var fontStyles = null; var appearanceNormalButtonStyles = null; var appearanceBoldButtonStyles = null; var appearanceNormalActionsContainerStyles = null; var FlagActions = function FlagActions(props) { var _props$appearance = props.appearance, appearance = _props$appearance === void 0 ? _constants.DEFAULT_APPEARANCE : _props$appearance, _props$actions = props.actions, actions = _props$actions === void 0 ? [] : _props$actions, linkComponent = props.linkComponent, testId = props.testId; if (!actions.length) { return null; } var isBold = appearance !== _constants.DEFAULT_APPEARANCE; return /*#__PURE__*/React.createElement("span", { className: (0, _runtime.ax)([!isBold && "_1g4l107e _y8dn107e", "_11c8fhey"]) }, /*#__PURE__*/React.createElement(_compiled.Inline, { space: "space.100", shouldWrap: true, alignBlock: "center", separator: isBold ? undefined : '·', testId: testId && "".concat(testId, "-actions") }, actions.map(function (action, index) { return (0, _fg.fg)('platform_dst_flag_action_padding_fix') ? /*#__PURE__*/React.createElement(_customThemeButton.default, { onClick: action.onClick, href: action.href, target: action.target, appearance: isBold ? 'default' : 'link', component: linkComponent, spacing: "compact", testId: action.testId, key: index, style: { // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766 '--color': _actionTextColor.actionTextColor[appearance], // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766 '--bg-color': _theme.actionBackgroundColor[appearance].default, // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766 '--bg-color-hover': _theme.actionBackgroundColor[appearance].pressed, // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766 '--bg-color-active': _theme.actionBackgroundColor[appearance].active }, className: (0, _runtime.ax)(["_nup91zz4 _u4iq1zz4 _1w901pkf _qkwg1pkf _12r21wq8 _il101wq8 _ow071r31 _1p6b1r31 _8dbm1r31 _77mc1r31 _17rj8stv _1p6m8stv _5kwq8stv _1pd88stv _1iqunqa1 _1ejunqa1 _b6ztnqa1 _1rsgnqa1 _u1mb14jz _10fu17w4", isBold ? "_1dltgrf3 _h03xgrf3 _w8sq1a66 _1iys1a66 _fjwrgrf3 _cwkngrf3 _1yxx1a66 _z7cd1a66" : "_1dltgrf3 _h03xgrf3 _w8sqgrf3 _1iysgrf3 _fjwrgrf3 _cwkngrf3 _1yxxgrf3 _z7cdgrf3"]) }, action.content) : /*#__PURE__*/React.createElement(_customThemeButton.default, { onClick: action.onClick, href: action.href, target: action.target, appearance: isBold ? 'default' : 'link', component: linkComponent, spacing: "compact", testId: action.testId, key: index, style: { // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766 '--color': _actionTextColor.actionTextColor[appearance], // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766 '--bg-color': _theme.actionBackgroundColor[appearance].default, // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766 '--bg-color-hover': _theme.actionBackgroundColor[appearance].pressed, // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766 '--bg-color-active': _theme.actionBackgroundColor[appearance].active }, className: (0, _runtime.ax)(["_nup91zz4 _u4iq1zz4 _1w901pkf _qkwg1pkf _12r21wq8 _il101wq8 _1ku2grf3 _1v8mgrf3 _gbuigrf3 _1dwvgrf3 _1bk61a66 _1wy61a66 _b3g31a66 _eqps1a66 _ow071r31 _1p6b1r31 _8dbm1r31 _77mc1r31 _17rj8stv _1p6m8stv _5kwq8stv _1pd88stv _1iqunqa1 _1ejunqa1 _b6ztnqa1 _1rsgnqa1 _u1mb14jz _10fu17w4", !isBold && "_1dltgrf3 _h03xgrf3 _w8sqgrf3 _1iysgrf3 _fjwrgrf3 _cwkngrf3 _1yxxgrf3 _z7cdgrf3"]) }, action.content); }))); }; // eslint-disable-next-line @repo/internal/react/require-jsdoc var _default = exports.default = FlagActions;