@qoretechnologies/reqore 0.78.7-pr.717.gef00123 → 0.78.7-pr.720.gf7b3a6d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/dist/components/Accordion/index.d.ts.map +1 -1
  2. package/dist/components/Accordion/index.js +11 -34
  3. package/dist/components/Accordion/index.js.map +1 -1
  4. package/dist/components/Breadcrumbs/index.d.ts.map +1 -1
  5. package/dist/components/Breadcrumbs/index.js +23 -64
  6. package/dist/components/Breadcrumbs/index.js.map +1 -1
  7. package/dist/components/Bubble/index.d.ts.map +1 -1
  8. package/dist/components/Bubble/index.js +4 -13
  9. package/dist/components/Bubble/index.js.map +1 -1
  10. package/dist/components/Button/index.d.ts +0 -65
  11. package/dist/components/Button/index.d.ts.map +1 -1
  12. package/dist/components/Button/index.js +99 -245
  13. package/dist/components/Button/index.js.map +1 -1
  14. package/dist/components/Callout/index.d.ts.map +1 -1
  15. package/dist/components/Callout/index.js +24 -57
  16. package/dist/components/Callout/index.js.map +1 -1
  17. package/dist/components/Checkbox/index.d.ts.map +1 -1
  18. package/dist/components/Checkbox/index.js +32 -109
  19. package/dist/components/Checkbox/index.js.map +1 -1
  20. package/dist/components/CollapsibleContent/index.d.ts.map +1 -1
  21. package/dist/components/CollapsibleContent/index.js +2 -6
  22. package/dist/components/CollapsibleContent/index.js.map +1 -1
  23. package/dist/components/ControlGroup/index.d.ts.map +1 -1
  24. package/dist/components/ControlGroup/index.js +15 -44
  25. package/dist/components/ControlGroup/index.js.map +1 -1
  26. package/dist/components/DataView/index.d.ts.map +1 -1
  27. package/dist/components/DataView/index.js +10 -13
  28. package/dist/components/DataView/index.js.map +1 -1
  29. package/dist/components/DescriptionList/index.d.ts.map +1 -1
  30. package/dist/components/DescriptionList/index.js +4 -22
  31. package/dist/components/DescriptionList/index.js.map +1 -1
  32. package/dist/components/Drawer/index.d.ts.map +1 -1
  33. package/dist/components/Drawer/index.js +25 -41
  34. package/dist/components/Drawer/index.js.map +1 -1
  35. package/dist/components/Dropdown/list.d.ts.map +1 -1
  36. package/dist/components/Dropdown/list.js +14 -19
  37. package/dist/components/Dropdown/list.js.map +1 -1
  38. package/dist/components/Effect/index.d.ts +0 -48
  39. package/dist/components/Effect/index.d.ts.map +1 -1
  40. package/dist/components/Effect/index.js +55 -215
  41. package/dist/components/Effect/index.js.map +1 -1
  42. package/dist/components/EntityRow/index.d.ts.map +1 -1
  43. package/dist/components/EntityRow/index.js +46 -97
  44. package/dist/components/EntityRow/index.js.map +1 -1
  45. package/dist/components/FadeScroller/index.js +2 -2
  46. package/dist/components/FadeScroller/index.js.map +1 -1
  47. package/dist/components/FeatureCard/index.d.ts.map +1 -1
  48. package/dist/components/FeatureCard/index.js +20 -59
  49. package/dist/components/FeatureCard/index.js.map +1 -1
  50. package/dist/components/Header/index.d.ts.map +1 -1
  51. package/dist/components/Header/index.js +4 -7
  52. package/dist/components/Header/index.js.map +1 -1
  53. package/dist/components/Icon/index.d.ts.map +1 -1
  54. package/dist/components/Icon/index.js +3 -13
  55. package/dist/components/Icon/index.js.map +1 -1
  56. package/dist/components/Input/index.d.ts +1 -37
  57. package/dist/components/Input/index.d.ts.map +1 -1
  58. package/dist/components/Input/index.js +22 -85
  59. package/dist/components/Input/index.js.map +1 -1
  60. package/dist/components/InputClearButton/index.d.ts +2 -7
  61. package/dist/components/InputClearButton/index.d.ts.map +1 -1
  62. package/dist/components/InputClearButton/index.js +6 -13
  63. package/dist/components/InputClearButton/index.js.map +1 -1
  64. package/dist/components/InternalPopover/index.d.ts.map +1 -1
  65. package/dist/components/InternalPopover/index.js +10 -19
  66. package/dist/components/InternalPopover/index.js.map +1 -1
  67. package/dist/components/Link/index.d.ts.map +1 -1
  68. package/dist/components/Link/index.js +1 -6
  69. package/dist/components/Link/index.js.map +1 -1
  70. package/dist/components/Menu/divider.d.ts.map +1 -1
  71. package/dist/components/Menu/divider.js +3 -7
  72. package/dist/components/Menu/divider.js.map +1 -1
  73. package/dist/components/Menu/index.d.ts.map +1 -1
  74. package/dist/components/Menu/index.js +10 -22
  75. package/dist/components/Menu/index.js.map +1 -1
  76. package/dist/components/Menu/item.d.ts.map +1 -1
  77. package/dist/components/Menu/item.js +5 -7
  78. package/dist/components/Menu/item.js.map +1 -1
  79. package/dist/components/Message/index.d.ts.map +1 -1
  80. package/dist/components/Message/index.js +4 -20
  81. package/dist/components/Message/index.js.map +1 -1
  82. package/dist/components/NavRail/index.d.ts +0 -2
  83. package/dist/components/NavRail/index.d.ts.map +1 -1
  84. package/dist/components/NavRail/index.js +21 -94
  85. package/dist/components/NavRail/index.js.map +1 -1
  86. package/dist/components/Notifications/notification.d.ts +2 -6
  87. package/dist/components/Notifications/notification.d.ts.map +1 -1
  88. package/dist/components/Notifications/notification.js +15 -70
  89. package/dist/components/Notifications/notification.js.map +1 -1
  90. package/dist/components/Notifications/styles.d.ts +0 -20
  91. package/dist/components/Notifications/styles.d.ts.map +1 -1
  92. package/dist/components/Notifications/styles.js +7 -32
  93. package/dist/components/Notifications/styles.js.map +1 -1
  94. package/dist/components/Panel/index.d.ts +0 -3
  95. package/dist/components/Panel/index.d.ts.map +1 -1
  96. package/dist/components/Panel/index.js +155 -206
  97. package/dist/components/Panel/index.js.map +1 -1
  98. package/dist/components/Paragraph/index.d.ts.map +1 -1
  99. package/dist/components/Paragraph/index.js +5 -8
  100. package/dist/components/Paragraph/index.js.map +1 -1
  101. package/dist/components/Popover/index.d.ts.map +1 -1
  102. package/dist/components/Popover/index.js +3 -3
  103. package/dist/components/Popover/index.js.map +1 -1
  104. package/dist/components/Progress/index.d.ts.map +1 -1
  105. package/dist/components/Progress/index.js +1 -1
  106. package/dist/components/Progress/index.js.map +1 -1
  107. package/dist/components/Rating/index.d.ts.map +1 -1
  108. package/dist/components/Rating/index.js +4 -11
  109. package/dist/components/Rating/index.js.map +1 -1
  110. package/dist/components/RichTextEditor/index.d.ts.map +1 -1
  111. package/dist/components/RichTextEditor/index.js +46 -89
  112. package/dist/components/RichTextEditor/index.js.map +1 -1
  113. package/dist/components/RowActionsMenu/index.d.ts +1 -8
  114. package/dist/components/RowActionsMenu/index.d.ts.map +1 -1
  115. package/dist/components/RowActionsMenu/index.js +6 -18
  116. package/dist/components/RowActionsMenu/index.js.map +1 -1
  117. package/dist/components/SegmentedControl/index.d.ts.map +1 -1
  118. package/dist/components/SegmentedControl/index.js +41 -67
  119. package/dist/components/SegmentedControl/index.js.map +1 -1
  120. package/dist/components/SeverityRow/index.d.ts.map +1 -1
  121. package/dist/components/SeverityRow/index.js +1 -1
  122. package/dist/components/SeverityRow/index.js.map +1 -1
  123. package/dist/components/Span/index.d.ts.map +1 -1
  124. package/dist/components/Span/index.js +5 -8
  125. package/dist/components/Span/index.js.map +1 -1
  126. package/dist/components/StackedBar/index.d.ts.map +1 -1
  127. package/dist/components/StackedBar/index.js +12 -42
  128. package/dist/components/StackedBar/index.js.map +1 -1
  129. package/dist/components/Statistic/index.d.ts.map +1 -1
  130. package/dist/components/Statistic/index.js +6 -41
  131. package/dist/components/Statistic/index.js.map +1 -1
  132. package/dist/components/Table/body.js +6 -6
  133. package/dist/components/Table/body.js.map +1 -1
  134. package/dist/components/Table/cell.d.ts.map +1 -1
  135. package/dist/components/Table/cell.js +40 -71
  136. package/dist/components/Table/cell.js.map +1 -1
  137. package/dist/components/Table/header.js +2 -2
  138. package/dist/components/Table/header.js.map +1 -1
  139. package/dist/components/Tabs/item.js +2 -2
  140. package/dist/components/Tabs/item.js.map +1 -1
  141. package/dist/components/Tag/index.d.ts +3 -70
  142. package/dist/components/Tag/index.d.ts.map +1 -1
  143. package/dist/components/Tag/index.js +67 -233
  144. package/dist/components/Tag/index.js.map +1 -1
  145. package/dist/components/Testimonial/index.d.ts.map +1 -1
  146. package/dist/components/Testimonial/index.js +15 -40
  147. package/dist/components/Testimonial/index.js.map +1 -1
  148. package/dist/components/Textarea/index.d.ts +0 -6
  149. package/dist/components/Textarea/index.d.ts.map +1 -1
  150. package/dist/components/Textarea/index.js +18 -22
  151. package/dist/components/Textarea/index.js.map +1 -1
  152. package/dist/components/Timeline/index.d.ts +0 -2
  153. package/dist/components/Timeline/index.d.ts.map +1 -1
  154. package/dist/components/Timeline/index.js +13 -56
  155. package/dist/components/Timeline/index.js.map +1 -1
  156. package/dist/components/Tree/index.d.ts.map +1 -1
  157. package/dist/components/Tree/index.js +20 -23
  158. package/dist/components/Tree/index.js.map +1 -1
  159. package/dist/containers/UIProvider.d.ts +0 -7
  160. package/dist/containers/UIProvider.d.ts.map +1 -1
  161. package/dist/containers/UIProvider.js +2 -25
  162. package/dist/containers/UIProvider.js.map +1 -1
  163. package/dist/helpers/colors.d.ts +2 -189
  164. package/dist/helpers/colors.d.ts.map +1 -1
  165. package/dist/helpers/colors.js +86 -754
  166. package/dist/helpers/colors.js.map +1 -1
  167. package/dist/hooks/useAutoFocus.d.ts.map +1 -1
  168. package/dist/hooks/useAutoFocus.js +1 -11
  169. package/dist/hooks/useAutoFocus.js.map +1 -1
  170. package/dist/hooks/useCombinedRefs.d.ts +6 -16
  171. package/dist/hooks/useCombinedRefs.d.ts.map +1 -1
  172. package/dist/hooks/useCombinedRefs.js +27 -34
  173. package/dist/hooks/useCombinedRefs.js.map +1 -1
  174. package/dist/index.d.ts +0 -2
  175. package/dist/index.d.ts.map +1 -1
  176. package/dist/index.js +2 -5
  177. package/dist/index.js.map +1 -1
  178. package/package.json +11 -4
  179. package/vitest.config.ts +0 -12
  180. package/dist/components/Panel/surface.d.ts +0 -18
  181. package/dist/components/Panel/surface.d.ts.map +0 -1
  182. package/dist/components/Panel/surface.js +0 -56
  183. package/dist/components/Panel/surface.js.map +0 -1
  184. package/dist/context/SurfaceContext.d.ts +0 -18
  185. package/dist/context/SurfaceContext.d.ts.map +0 -1
  186. package/dist/context/SurfaceContext.js +0 -39
  187. package/dist/context/SurfaceContext.js.map +0 -1
  188. package/dist/helpers/iconProps.d.ts +0 -14
  189. package/dist/helpers/iconProps.d.ts.map +0 -1
  190. package/dist/helpers/iconProps.js +0 -33
  191. package/dist/helpers/iconProps.js.map +0 -1
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import { TSizes } from '../../constants/sizes';
3
3
  import { IReqoreCustomTheme, IReqoreTheme, TReqoreIntent } from '../../constants/theme';
4
- import { TReqoreSurface } from '../../helpers/colors';
5
4
  import { TReqoreKeyboardShortcut } from '../../helpers/shortcuts';
6
5
  import { TReqoreStylePropKeys } from '../../helpers/styled';
7
6
  import { IReqoreDisabled, IReqoreIntent, IReqoreReadOnly, IWithReqoreEffect, IWithReqoreLoading, IWithReqoreSize, TReqoreTooltipProp } from '../../types/global';
@@ -146,75 +145,11 @@ export interface IReqoreButtonProps extends React.HTMLAttributes<HTMLButtonEleme
146
145
  }
147
146
  export interface IReqoreButtonStyle extends IReqoreButtonProps {
148
147
  theme: IReqoreTheme;
149
- /** What the button is drawn on (`useReqoreSurface`): the theme's surface when not known. */
150
- $surface?: TReqoreSurface;
151
148
  animate?: boolean;
152
149
  color?: TReqoreHexColor;
153
150
  /** Rendered as an `<a>`: no underline from the browser's link style. */
154
151
  $isLink?: boolean;
155
- /** What the button is painted with, worked out once per render (`getButtonPaint`). */
156
- $paint?: IReqoreButtonPaint;
157
152
  }
158
- /** A button at rest, under the pointer, or pressed (`active`). */
159
- type TReqoreButtonState = 'rest' | 'hover' | 'active';
160
- /** What a button's colors are worked out from. */
161
- type TReqoreButtonColorProps = Pick<IReqoreButtonStyle, 'theme' | 'color' | 'minimal' | 'transparent' | 'effect' | '$surface'>;
162
- interface IReqoreButtonColors {
163
- /** What the button is drawn on, as the browser draws it: one color, or each color of its gradient. */
164
- backgrounds: TReqoreHexColor[];
165
- /** Its text, which stands out from every one of them. */
166
- text: TReqoreHexColor;
167
- }
168
- /**
169
- * What a button is drawn on and in, in a state. The background as it is drawn: a minimal button's wash and a
170
- * translucent color (the muted intent) blended over the theme the button sits on, a transparent button as that
171
- * theme, a gradient as each of its colors. The text is picked against that, and stands out from all of it by 4.5:1;
172
- * a minimal or transparent button with a color of its own keeps the color in its text, in a shade that reads.
173
- */
174
- export declare const getButtonColors: ({ theme, color, minimal, transparent, effect, $surface }: TReqoreButtonColorProps, state?: TReqoreButtonState) => IReqoreButtonColors;
175
- /** A button's colors in each state it is drawn in: at rest, hovered (when it is not active), and active. */
176
- export interface IReqoreButtonStateColors {
177
- rest: IReqoreButtonColors;
178
- hover?: IReqoreButtonColors;
179
- active?: IReqoreButtonColors;
180
- }
181
- /**
182
- * How a button draws an icon, at rest and hovered alike: in its own color (`color`, in a shade that stands out by
183
- * 3:1) or the button's text color, at `CONTROL_ICON_OPACITY` or as much more as it needs to stand out by 3:1.
184
- */
185
- export declare const getButtonIconLook: (style: TReqoreButtonColorProps, color?: TReqoreEffectColor, active?: boolean) => {
186
- color?: TReqoreHexColor;
187
- opacity: number;
188
- };
189
- /** What a button's styles paint it with, worked out once per render (`getButtonPaint`), not in each style rule. */
190
- export interface IReqoreButtonPaint {
191
- /** Its fill and text at rest. */
192
- background: string;
193
- text: TReqoreHexColor;
194
- /** Its color a step lighter: the edge (`flat={false}`), the focus ring and an active button's fill. */
195
- edge: string;
196
- /** The ring drawn while it is hovered or pressed, and its edge then. */
197
- ring: string;
198
- /** Hovered (not when active): its fill and text. */
199
- hoverBackground?: string;
200
- hoverText?: TReqoreHexColor;
201
- /** Active (a selected menu item): its text and edge, at rest and hovered. */
202
- activeText?: TReqoreHexColor;
203
- activeEdge: string;
204
- activeHoverEdge: string;
205
- /** The description's color, faded as far as it still reads (with a description only). */
206
- description?: string;
207
- }
208
- /**
209
- * A button's colors in the states it is drawn in (`IReqoreButtonStateColors`): at rest, and hovered or - when it
210
- * is `active` - active.
211
- */
212
- export declare const getButtonStateColors: (style: TReqoreButtonColorProps, active?: boolean) => IReqoreButtonStateColors;
213
- /**
214
- * Everything a button is painted with (`IReqoreButtonPaint`), from its colors in each state. `description`: whether
215
- * it has one, whose color is then worked out too.
216
- */
217
- export declare const getButtonPaint: (style: TReqoreButtonColorProps, states: IReqoreButtonStateColors, description?: boolean) => IReqoreButtonPaint;
218
153
  export declare const StyledAnimatedTextWrapper: any;
219
154
  /**
220
155
  * Every button prop that only styles the button. None of them reaches the rendered element —
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Button/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAItE,OAAO,EAWL,MAAM,EACP,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACxF,OAAO,EAeL,cAAc,EACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAuB,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvF,OAAe,EAIb,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAmB9B,OAAO,EACL,eAAe,EACf,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAGL,aAAa,EAGb,YAAY,EACZ,kBAAkB,EAClB,eAAe,EAChB,MAAM,WAAW,CAAC;AACnB,OAAmB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAIvD,OAAkB,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAIpD,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,eAAe,CAAC;AAE7D,MAAM,MAAM,8BAA8B,GACtC,WAAW,GACX,UAAU,GACV,cAAc,GACd,aAAa,CAAC;AAElB,MAAM,WAAW,2BAA2B;IAC1C,mGAAmG;IACnG,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,+DAA+D;IAC/D,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,0FAA0F;IAC1F,KAAK,CAAC,EAAE,OA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,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED,eAAO,MAAM,WAAW,+FASnB,uBAAuB,6CA6F3B,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,YAAY,8HAoXjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -71,10 +71,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
71
71
  return (mod && mod.__esModule) ? mod : { "default": mod };
72
72
  };
73
73
  Object.defineProperty(exports, "__esModule", { value: true });
74
- exports.ButtonBadge = exports.StyledButtonContent = exports.StyledButton = exports.REQORE_BUTTON_STYLE_PROPS = exports.StyledAnimatedTextWrapper = exports.getButtonPaint = exports.getButtonStateColors = exports.getButtonIconLook = exports.getButtonColors = exports.StyledButtonIndicator = void 0;
74
+ exports.ButtonBadge = exports.StyledButtonContent = exports.StyledButton = exports.REQORE_BUTTON_STYLE_PROPS = exports.StyledAnimatedTextWrapper = exports.StyledButtonIndicator = void 0;
75
75
  var jsx_runtime_1 = require("react/jsx-runtime");
76
76
  var useMarqueeOnHover_1 = require("../../hooks/useMarqueeOnHover");
77
77
  var lodash_1 = require("lodash");
78
+ var polished_1 = require("polished");
78
79
  var react_1 = require("react");
79
80
  var react_hotkeys_hook_1 = require("react-hotkeys-hook");
80
81
  var styled_components_1 = require("styled-components");
@@ -88,11 +89,9 @@ var useCombinedRefs_1 = require("../../hooks/useCombinedRefs");
88
89
  var useReqoreContext_1 = require("../../hooks/useReqoreContext");
89
90
  var useReqoreEffect_1 = require("../../hooks/useReqoreEffect");
90
91
  var useTheme_1 = require("../../hooks/useTheme");
91
- var SurfaceContext_1 = require("../../context/SurfaceContext");
92
92
  var styles_1 = require("../../styles");
93
93
  var Effect_1 = require("../Effect");
94
94
  var Icon_1 = __importDefault(require("../Icon"));
95
- var iconProps_1 = require("../../helpers/iconProps");
96
95
  var KeyboardShortcut_1 = require("../KeyboardShortcut");
97
96
  var Spacer_1 = require("../Spacer");
98
97
  var Tag_1 = __importDefault(require("../Tag"));
@@ -127,142 +126,13 @@ var getButtonMainColor = function (theme, color, effect) {
127
126
  }
128
127
  return theme.main;
129
128
  };
130
- /**
131
- * What a button is drawn on and in, in a state. The background as it is drawn: a minimal button's wash and a
132
- * translucent color (the muted intent) blended over the theme the button sits on, a transparent button as that
133
- * theme, a gradient as each of its colors. The text is picked against that, and stands out from all of it by 4.5:1;
134
- * a minimal or transparent button with a color of its own keeps the color in its text, in a shade that reads.
135
- */
136
- var getButtonColors = function (_a, state) {
137
- var theme = _a.theme, color = _a.color, minimal = _a.minimal, transparent = _a.transparent, effect = _a.effect, $surface = _a.$surface;
138
- if (state === void 0) { state = 'rest'; }
139
- var main = getButtonMainColor(theme, color, effect);
140
- // what the button is drawn on: one color, or each color of a gradient
141
- var unders = (0, colors_2.getThemeSurfaces)(theme, $surface);
142
- var outlined = minimal || transparent;
143
- var gradient = (0, Effect_1.getPrimaryGradient)(effect === null || effect === void 0 ? void 0 : effect.gradient);
144
- // an outlined button's text starts from a light tint of its color, lighter hovered
145
- var tintAmount = state === 'hover' ? 0.9 : 0.8;
146
- var fills;
147
- if (gradient && !transparent) {
148
- var stops = (0, colors_2.getGradientColorList)(theme, gradient.colors);
149
- if (minimal) {
150
- // as a minimal gradient is painted: a translucent fill over a translucent ring over the button's wash
151
- var painted = unders.flatMap(function (under) {
152
- return (0, Effect_1.getEffectGradientBackgrounds)(theme, gradient.colors, true, (0, colors_2.getColorAtAlpha)(main, 0.2), under);
153
- });
154
- return {
155
- backgrounds: painted,
156
- text: (0, colors_2.isAchromatic)(main)
157
- ? (0, colors_2.getReadableColorOn)(painted, state === 'rest')
158
- : (0, colors_2.getReadableAccentColorOn)((0, colors_2.getSaturatedTint)(main, tintAmount), painted),
159
- };
160
- }
161
- // as the effect draws it: its colors at rest, each a step lighter hovered or pressed
162
- fills = state === 'rest' ? stops : stops.map(function (stop) { return (0, colors_2.changeLightness)(stop, 0.05); });
163
- }
164
- else if (state === 'active') {
165
- fills = [(0, colors_2.changeLightness)(main, 0.1)];
166
- }
167
- else if (state === 'hover') {
168
- fills = [getButtonHoverFill(theme, color, main, minimal, transparent)];
169
- }
170
- else {
171
- fills = [getButtonRestFill(color, main, minimal, transparent)];
172
- }
173
- var backgrounds = unders.flatMap(function (under) {
174
- return fills.map(function (fill) { return (fill === 'transparent' ? under : (0, colors_2.getDrawnColor)(fill, under)); });
175
- });
176
- var dim = state === 'rest';
177
- var text;
178
- if (outlined && state !== 'active' && !(0, colors_2.isAchromatic)(main)) {
179
- // a color the helpers cannot read (a CSS variable) is as it is given: the text is written in it
180
- text = (0, colors_2.getReadableAccentColorOn)((0, colors_2.getSaturatedTint)(main, tintAmount), backgrounds);
181
- }
182
- else {
183
- text = (0, colors_2.getReadableColorOn)(backgrounds, dim);
184
- }
185
- return { backgrounds: backgrounds, text: text };
186
- };
187
- exports.getButtonColors = getButtonColors;
188
- /**
189
- * The fill a button paints at rest: nothing when transparent, a wash of its color when minimal (one the helpers
190
- * cannot read, a CSS variable, is washed by the browser), else its color.
191
- */
192
- var getButtonRestFill = function (color, main, minimal, transparent) { return (transparent ? 'transparent' : minimal ? (0, colors_2.getColorAtAlpha)(main, 0.2) : color || main); };
193
- /** The fill a button paints hovered: a stronger wash when minimal or transparent, else its color a step lighter. */
194
- var getButtonHoverFill = function (theme, color, main, minimal, transparent) {
129
+ var getButtonTextColor = function (_a) {
130
+ var minimal = _a.minimal, transparent = _a.transparent, color = _a.color, theme = _a.theme;
195
131
  return minimal || transparent
196
- ? (0, colors_2.getColorAtAlpha)((0, colors_2.changeLightness)(main, 0.1), transparent ? 0.2 : 0.4)
197
- : (0, colors_2.changeLightness)(getButtonMainColor(theme, color), 0.05);
198
- };
199
- /**
200
- * How a button draws an icon, at rest and hovered alike: in its own color (`color`, in a shade that stands out by
201
- * 3:1) or the button's text color, at `CONTROL_ICON_OPACITY` or as much more as it needs to stand out by 3:1.
202
- */
203
- var getButtonIconLook = function (style, color, active) {
204
- return getButtonIconLookIn(style.theme, (0, exports.getButtonStateColors)(style, active), color);
205
- };
206
- exports.getButtonIconLook = getButtonIconLook;
207
- /** `getButtonIconLook`, from the button's colors worked out already (`IReqoreButtonStateColors`). */
208
- var getButtonIconLookIn = function (theme, states, color) {
209
- var _a, _b, _c;
210
- // an active button (a selected menu item) is drawn in its fill, hovered or not
211
- var rest = (_a = states.active) !== null && _a !== void 0 ? _a : states.rest;
212
- var hover = (_c = (_b = states.active) !== null && _b !== void 0 ? _b : states.hover) !== null && _c !== void 0 ? _c : rest;
213
- var look = (0, colors_2.getReadableIconLook)(theme, __spreadArray(__spreadArray([], rest.backgrounds, true), hover.backgrounds, true), rest.text, colors_1.CONTROL_ICON_OPACITY, color);
214
- // hovered, the text (which an icon without a color of its own is drawn in) may be another color
215
- return look.color
216
- ? look
217
- : {
218
- opacity: Math.max(look.opacity, (0, colors_2.getReadableAlpha)(hover.text, hover.backgrounds, colors_1.CONTROL_ICON_OPACITY, colors_2.READABLE_ICON_CONTRAST)),
219
- };
220
- };
221
- /**
222
- * A button's colors in the states it is drawn in (`IReqoreButtonStateColors`): at rest, and hovered or - when it
223
- * is `active` - active.
224
- */
225
- var getButtonStateColors = function (style, active) { return ({
226
- rest: (0, exports.getButtonColors)(style),
227
- hover: active ? undefined : (0, exports.getButtonColors)(style, 'hover'),
228
- active: active ? (0, exports.getButtonColors)(style, 'active') : undefined,
229
- }); };
230
- exports.getButtonStateColors = getButtonStateColors;
231
- /**
232
- * Everything a button is painted with (`IReqoreButtonPaint`), from its colors in each state. `description`: whether
233
- * it has one, whose color is then worked out too.
234
- */
235
- var getButtonPaint = function (style, states, description) {
236
- var _a, _b, _c;
237
- var theme = style.theme, color = style.color, minimal = style.minimal, transparent = style.transparent, effect = style.effect;
238
- var main = getButtonMainColor(theme, color, effect);
239
- var drawn = (_a = states.active) !== null && _a !== void 0 ? _a : states.rest;
240
- return {
241
- background: transparent ? 'transparent' : minimal ? (0, colors_2.getColorAtAlpha)(main, 0.2) : color,
242
- text: states.rest.text,
243
- edge: (0, colors_2.changeLightness)(main, 0.1),
244
- ring: (0, colors_2.changeLightness)(main, 0.25),
245
- hoverBackground: states.hover
246
- ? getButtonHoverFill(theme, color, main, minimal, transparent)
247
- : undefined,
248
- hoverText: (_b = states.hover) === null || _b === void 0 ? void 0 : _b.text,
249
- activeText: (_c = states.active) === null || _c === void 0 ? void 0 : _c.text,
250
- activeEdge: (0, colors_2.changeLightness)(main, 0.175),
251
- activeHoverEdge: (0, colors_2.changeLightness)(main, 0.275),
252
- // on the button as it is drawn: at rest, or filled when active (a selected menu item)
253
- description: description
254
- ? (0, colors_2.getReadableFadedColor)(drawn.text, drawn.backgrounds, 0.7)
255
- : undefined,
256
- };
257
- };
258
- exports.getButtonPaint = getButtonPaint;
259
- /**
260
- * What a styled button is painted with: what the button worked out for this render, or - a `StyledButton`
261
- * rendered on its own - worked out from its props.
262
- */
263
- var getStyledButtonPaint = function (props) {
264
- var _a;
265
- return (_a = props.$paint) !== null && _a !== void 0 ? _a : (0, exports.getButtonPaint)(props, (0, exports.getButtonStateColors)(props, props.active), !!props.description);
132
+ ? (0, colors_2.isAchromatic)(color)
133
+ ? (0, colors_2.getReadableColorFrom)(theme.originalMain, true)
134
+ : (0, polished_1.saturate)(1, (0, polished_1.tint)(0.8, color))
135
+ : (0, colors_2.getReadableColorFrom)(color, true);
266
136
  };
267
137
  exports.StyledAnimatedTextWrapper = styled_1.default.span(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n min-width: 5px;\n overflow: hidden;\n position: relative;\n text-align: ", ";\n display: flex;\n flex-flow: column;\n align-items: ", ";\n"], ["\n min-width: 5px;\n overflow: hidden;\n position: relative;\n text-align: ", ";\n display: flex;\n flex-flow: column;\n align-items: ", ";\n"])), function (_a) {
268
138
  var textAlign = _a.textAlign;
@@ -331,8 +201,9 @@ exports.StyledButton = (0, styled_1.default)(Effect_1.StyledEffect).withConfig({
331
201
  // Its own styling props, and the layout flags a containing ControlGroup hands it (`fill`, its
332
202
  // place in a stack, ...); `color` is the button's colour, read by its styles.
333
203
  shouldForwardProp: styled_1.omitStyleProps.apply(void 0, __spreadArray(__spreadArray(__spreadArray([], exports.REQORE_BUTTON_STYLE_PROPS, false), styled_1.REQORE_CONTROL_GROUP_CHILD_PROPS, false), ['color'], false)),
334
- })(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n display: flex;\n flex-flow: column;\n justify-content: center;\n /* The page's font (or the theme's, which the layout sets), not the browser's control font:\n a button left to the user-agent stylesheet renders in the platform's form-control face\n whatever font the text around it is in. */\n font-family: inherit;\n font-weight: 570;\n position: relative;\n overflow: hidden;\n vertical-align: middle;\n border: ", ";\n padding: ", ";\n font-size: ", "px;\n outline-offset: -2px;\n\n min-height: ", "px;\n min-width: ", "px;\n ", "\n max-width: ", ";\n\n ", "\n\n flex: ", ";\n flex-shrink: ", ";\n flex-grow: ", ";\n align-self: ", ";\n\n border-radius: ", ";\n\n background-color: ", ";\n\n color: ", ";\n\n ", ";\n\n ", "\n\n ", ";\n\n ", ";\n\n &:disabled {\n ", ";\n }\n\n ", "\n\n &:focus,\n &:active {\n outline: 2px solid ", ";\n border-color: ", ";\n }\n\n .reqore-button-description {\n padding-top: ", "px;\n /* on the button as it is drawn: at rest, or filled when active (a selected menu item) */\n color: ", ";\n }\n"], ["\n display: flex;\n flex-flow: column;\n justify-content: center;\n /* The page's font (or the theme's, which the layout sets), not the browser's control font:\n a button left to the user-agent stylesheet renders in the platform's form-control face\n whatever font the text around it is in. */\n font-family: inherit;\n font-weight: 570;\n position: relative;\n overflow: hidden;\n vertical-align: middle;\n border: ", ";\n padding: ", ";\n font-size: ", "px;\n outline-offset: -2px;\n\n min-height: ", "px;\n min-width: ", "px;\n ", "\n max-width: ", ";\n\n ", "\n\n flex: ", ";\n flex-shrink: ", ";\n flex-grow: ", ";\n align-self: ", ";\n\n border-radius: ", ";\n\n background-color: ", ";\n\n color: ", ";\n\n ", ";\n\n ", "\n\n ", ";\n\n ", ";\n\n &:disabled {\n ", ";\n }\n\n ", "\n\n &:focus,\n &:active {\n outline: 2px solid ", ";\n border-color: ", ";\n }\n\n .reqore-button-description {\n padding-top: ", "px;\n /* on the button as it is drawn: at rest, or filled when active (a selected menu item) */\n color: ", ";\n }\n"])), function (props) {
335
- return !props.flat ? "1px solid ".concat(getStyledButtonPaint(props).edge) : 0;
204
+ })(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n display: flex;\n flex-flow: column;\n justify-content: center;\n /* The page's font (or the theme's, which the layout sets), not the browser's control font:\n a button left to the user-agent stylesheet renders in the platform's form-control face\n whatever font the text around it is in. */\n font-family: inherit;\n font-weight: 570;\n position: relative;\n overflow: hidden;\n vertical-align: middle;\n border: ", ";\n padding: ", ";\n font-size: ", "px;\n outline-offset: -2px;\n\n min-height: ", "px;\n min-width: ", "px;\n ", "\n max-width: ", ";\n\n ", "\n\n flex: ", ";\n flex-shrink: ", ";\n flex-grow: ", ";\n align-self: ", ";\n\n border-radius: ", ";\n\n background-color: ", ";\n\n color: ", ";\n\n ", ";\n\n ", "\n\n ", ";\n\n ", ";\n\n &:disabled {\n ", ";\n }\n\n ", "\n\n &:focus,\n &:active {\n outline: 2px solid\n ", ";\n border-color: ", ";\n }\n\n .reqore-button-description {\n padding-top: ", "px;\n color: ", ";\n }\n"], ["\n display: flex;\n flex-flow: column;\n justify-content: center;\n /* The page's font (or the theme's, which the layout sets), not the browser's control font:\n a button left to the user-agent stylesheet renders in the platform's form-control face\n whatever font the text around it is in. */\n font-family: inherit;\n font-weight: 570;\n position: relative;\n overflow: hidden;\n vertical-align: middle;\n border: ", ";\n padding: ", ";\n font-size: ", "px;\n outline-offset: -2px;\n\n min-height: ", "px;\n min-width: ", "px;\n ", "\n max-width: ", ";\n\n ", "\n\n flex: ", ";\n flex-shrink: ", ";\n flex-grow: ", ";\n align-self: ", ";\n\n border-radius: ", ";\n\n background-color: ", ";\n\n color: ", ";\n\n ", ";\n\n ", "\n\n ", ";\n\n ", ";\n\n &:disabled {\n ", ";\n }\n\n ", "\n\n &:focus,\n &:active {\n outline: 2px solid\n ", ";\n border-color: ", ";\n }\n\n .reqore-button-description {\n padding-top: ", "px;\n color: ", ";\n }\n"])), function (_a) {
205
+ var theme = _a.theme, color = _a.color, flat = _a.flat, effect = _a.effect;
206
+ return !flat ? "1px solid ".concat((0, colors_2.changeLightness)(getButtonMainColor(theme, color, effect), 0.1)) : 0;
336
207
  }, function (_a) {
337
208
  var size = _a.size, compact = _a.compact, _b = _a.verticalPadding, verticalPadding = _b === void 0 ? 'normal' : _b, square = _a.square;
338
209
  return "".concat(sizes_1.CONTROL_VERTICAL_PADDING_FROM_SIZE[size] +
@@ -388,43 +259,79 @@ exports.StyledButton = (0, styled_1.default)(Effect_1.StyledEffect).withConfig({
388
259
  : circle
389
260
  ? '9999px'
390
261
  : "".concat((0, sizes_1.resolveRadius)(size, radiusSize) * (pill ? sizes_1.PILL_RADIUS_MODIFIER : 1), "px");
391
- }, function (props) { return getStyledButtonPaint(props).background; }, function (props) { return getStyledButtonPaint(props).text; }, styles_1.InactiveIconScale, function (_a) {
262
+ }, function (_a) {
263
+ var minimal = _a.minimal, color = _a.color, theme = _a.theme, transparent = _a.transparent, effect = _a.effect;
264
+ if (transparent) {
265
+ return 'transparent';
266
+ }
267
+ if (minimal) {
268
+ return (0, styled_components_1.css)(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n ", "\n "], ["\n ", "\n "])), (0, polished_1.rgba)(getButtonMainColor(theme, color, effect), 0.2));
269
+ }
270
+ return color;
271
+ }, function (_a) {
272
+ var color = _a.color, minimal = _a.minimal, transparent = _a.transparent, theme = _a.theme, effect = _a.effect;
273
+ var finalColor = getButtonMainColor(theme, color, effect);
274
+ return getButtonTextColor({ minimal: minimal, transparent: transparent, color: finalColor, theme: theme });
275
+ }, styles_1.InactiveIconScale, function (_a) {
392
276
  var raised = _a.raised, flat = _a.flat, transparent = _a.transparent;
393
277
  return raised && flat && !transparent && styles_1.RaisedElement;
394
- }, function (props) {
395
- var readOnly = props.readOnly, animate = props.animate, active = props.active, flat = props.flat;
396
- if (readOnly || active) {
397
- return readOnly
398
- ? (0, styled_components_1.css)(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n ", ";\n "], ["\n ", ";\n "])), styles_1.ReadOnlyElement) : undefined;
399
- }
400
- var _a = getStyledButtonPaint(props), ring = _a.ring, hoverBackground = _a.hoverBackground, hoverText = _a.hoverText;
401
- return (0, styled_components_1.css)(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n &:not(:disabled) {\n ", "\n\n cursor: pointer;\n transition: all 0.2s ease-out;\n\n &:active {\n outline: 3px solid ", ";\n outline-offset: -3px;\n transition: none;\n }\n\n &:hover:not(:active) {\n outline: 2px solid ", ";\n transition: none;\n }\n\n &:hover,\n &:active {\n border-color: ", ";\n background-color: ", ";\n /* Ended here: the animated content's rules below ran on into this declaration, which the\n browser then dropped - a hovered button kept its resting text on its hovered fill. */\n color: ", ";\n\n ", ";\n }\n }\n "], ["\n &:not(:disabled) {\n ", "\n\n cursor: pointer;\n transition: all 0.2s ease-out;\n\n &:active {\n outline: 3px solid ", ";\n outline-offset: -3px;\n transition: none;\n }\n\n &:hover:not(:active) {\n outline: 2px solid ", ";\n transition: none;\n }\n\n &:hover,\n &:active {\n border-color: ", ";\n background-color: ", ";\n /* Ended here: the animated content's rules below ran on into this declaration, which the\n browser then dropped - a hovered button kept its resting text on its hovered fill. */\n color: ", ";\n\n ", ";\n }\n }\n "])), styles_1.ScaleIconOnHover, ring, ring, flat ? undefined : ring, hoverBackground, hoverText, animate
402
- ? (0, styled_components_1.css)(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n cursor: pointer;\n\n ", " {\n transform: translateY(150%);\n filter: blur(10px);\n opacity: 0;\n }\n\n ", " {\n transform: translateY(0px);\n filter: blur(0);\n opacity: 1;\n }\n "], ["\n cursor: pointer;\n\n ", " {\n transform: translateY(150%);\n filter: blur(10px);\n opacity: 0;\n }\n\n ", " {\n transform: translateY(0px);\n filter: blur(0);\n opacity: 1;\n }\n "])), styles_1.StyledInActiveContent, styles_1.StyledActiveContent) : undefined);
403
- }, function (props) {
404
- if (props.active) {
405
- var flat = props.flat;
406
- var _a = getStyledButtonPaint(props), edge = _a.edge, activeText = _a.activeText, activeEdge = _a.activeEdge, activeHoverEdge = _a.activeHoverEdge;
407
- return (0, styled_components_1.css)(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n cursor: pointer;\n background-color: ", ";\n color: ", ";\n border-color: ", ";\n\n &:hover,\n &:active,\n &:focus {\n border-color: ", ";\n }\n\n ", "\n "], ["\n cursor: pointer;\n background-color: ", ";\n color: ", ";\n border-color: ", ";\n\n &:hover,\n &:active,\n &:focus {\n border-color: ", ";\n }\n\n ", "\n "])), edge, activeText, flat ? undefined : activeEdge, flat ? undefined : activeHoverEdge, styles_1.ActiveIconScale);
278
+ }, function (_a) {
279
+ var readOnly = _a.readOnly, animate = _a.animate, active = _a.active, theme = _a.theme, color = _a.color, effect = _a.effect;
280
+ return !readOnly && !active
281
+ ? (0, styled_components_1.css)(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n &:not(:disabled) {\n ", "\n\n cursor: pointer;\n transition: all 0.2s ease-out;\n\n &:active {\n outline: 3px solid ", ";\n outline-offset: -3px;\n transition: none;\n }\n\n &:hover:not(:active) {\n outline: 2px solid ", ";\n transition: none;\n }\n\n &:hover,\n &:active {\n border-color: ", ";\n background-color: ", ";\n color: ", "\n ", ";\n }\n }\n "], ["\n &:not(:disabled) {\n ", "\n\n cursor: pointer;\n transition: all 0.2s ease-out;\n\n &:active {\n outline: 3px solid ", ";\n outline-offset: -3px;\n transition: none;\n }\n\n &:hover:not(:active) {\n outline: 2px solid ", ";\n transition: none;\n }\n\n &:hover,\n &:active {\n border-color: ", ";\n background-color: ", ";\n color: ", "\n ", ";\n }\n }\n "])), styles_1.ScaleIconOnHover, (0, colors_2.changeLightness)(getButtonMainColor(theme, color, effect), 0.25), (0, colors_2.changeLightness)(getButtonMainColor(theme, color, effect), 0.25), function (_a) {
282
+ var flat = _a.flat, theme = _a.theme, color = _a.color;
283
+ return flat ? undefined : (0, colors_2.changeLightness)(getButtonMainColor(theme, color, effect), 0.25);
284
+ }, function (_a) {
285
+ var theme = _a.theme, color = _a.color, minimal = _a.minimal, transparent = _a.transparent;
286
+ return minimal || transparent
287
+ ? (0, polished_1.rgba)((0, colors_2.changeLightness)(getButtonMainColor(theme, color, effect), 0.1), transparent ? 0.2 : 0.4)
288
+ : (0, colors_2.changeLightness)(getButtonMainColor(theme, color), 0.05);
289
+ }, function (_a) {
290
+ var theme = _a.theme, color = _a.color, minimal = _a.minimal, transparent = _a.transparent, effect = _a.effect;
291
+ var finalColor = getButtonMainColor(theme, color, effect);
292
+ return minimal || transparent
293
+ ? (0, colors_2.isAchromatic)(finalColor)
294
+ ? (0, colors_2.getReadableColorFrom)(theme.originalMain)
295
+ : (0, polished_1.saturate)(1, (0, polished_1.tint)(0.9, finalColor))
296
+ : (0, colors_2.getReadableColorFrom)(finalColor);
297
+ }, animate
298
+ ? (0, styled_components_1.css)(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n cursor: pointer;\n\n ", " {\n transform: translateY(150%);\n filter: blur(10px);\n opacity: 0;\n }\n\n ", " {\n transform: translateY(0px);\n filter: blur(0);\n opacity: 1;\n }\n "], ["\n cursor: pointer;\n\n ", " {\n transform: translateY(150%);\n filter: blur(10px);\n opacity: 0;\n }\n\n ", " {\n transform: translateY(0px);\n filter: blur(0);\n opacity: 1;\n }\n "])), styles_1.StyledInActiveContent, styles_1.StyledActiveContent) : undefined) : readOnly
299
+ ? (0, styled_components_1.css)(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n ", ";\n "], ["\n ", ";\n "])), styles_1.ReadOnlyElement) : undefined;
300
+ }, function (_a) {
301
+ var active = _a.active, flat = _a.flat, theme = _a.theme, color = _a.color, effect = _a.effect;
302
+ if (active) {
303
+ return (0, styled_components_1.css)(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n cursor: pointer;\n background-color: ", ";\n color: ", ";\n border-color: ", ";\n\n &:hover,\n &:active,\n &:focus {\n border-color: ", ";\n }\n\n ", "\n "], ["\n cursor: pointer;\n background-color: ", ";\n color: ", ";\n border-color: ", ";\n\n &:hover,\n &:active,\n &:focus {\n border-color: ", ";\n }\n\n ", "\n "])), (0, colors_2.changeLightness)(getButtonMainColor(theme, color, effect), 0.1), (0, colors_2.getReadableColor)({ main: (0, colors_2.changeLightness)(getButtonMainColor(theme, color, effect), 0.1) }, undefined, undefined), flat
304
+ ? undefined
305
+ : (0, colors_2.changeLightness)(getButtonMainColor(theme, color, effect), 0.175), flat
306
+ ? undefined
307
+ : (0, colors_2.changeLightness)(getButtonMainColor(theme, color, effect), 0.275), styles_1.ActiveIconScale);
408
308
  }
409
309
  }, styles_1.DisabledElement, function (_a) {
410
310
  var $isLink = _a.$isLink;
411
311
  return $isLink
412
- ? (0, styled_components_1.css)(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n text-decoration: none;\n\n /* A link has no :disabled; a disabled one says so with aria-disabled. */\n &[aria-disabled='true'] {\n ", ";\n }\n "], ["\n text-decoration: none;\n\n /* A link has no :disabled; a disabled one says so with aria-disabled. */\n &[aria-disabled='true'] {\n ", ";\n }\n "])), styles_1.DisabledElement) : undefined;
413
- }, function (props) { return getStyledButtonPaint(props).edge; }, function (props) {
414
- return props.minimal ? undefined : getStyledButtonPaint(props).edge;
312
+ ? (0, styled_components_1.css)(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n text-decoration: none;\n\n /* A link has no :disabled; a disabled one says so with aria-disabled. */\n &[aria-disabled='true'] {\n ", ";\n }\n "], ["\n text-decoration: none;\n\n /* A link has no :disabled; a disabled one says so with aria-disabled. */\n &[aria-disabled='true'] {\n ", ";\n }\n "])), styles_1.DisabledElement) : undefined;
313
+ }, function (_a) {
314
+ var theme = _a.theme, color = _a.color, effect = _a.effect;
315
+ return (0, colors_2.changeLightness)(getButtonMainColor(theme, color, effect), 0.1);
316
+ }, function (_a) {
317
+ var minimal = _a.minimal, theme = _a.theme, color = _a.color, effect = _a.effect;
318
+ return minimal ? undefined : (0, colors_2.changeLightness)(getButtonMainColor(theme, color, effect), 0.1);
415
319
  }, function (_a) {
416
320
  var size = _a.size;
417
321
  return sizes_1.PADDING_FROM_SIZE[size] / 2;
418
- }, function (props) { return getStyledButtonPaint(props).description; });
322
+ }, function (_a) {
323
+ var theme = _a.theme, color = _a.color, minimal = _a.minimal, transparent = _a.transparent;
324
+ return (0, polished_1.rgba)(getButtonTextColor({ minimal: minimal, transparent: transparent, color: color, theme: theme }), 0.7);
325
+ });
419
326
  exports.StyledButtonContent = styled_1.default.div.withConfig({
420
327
  shouldForwardProp: (0, styled_1.omitStyleProps)('wrap'),
421
- })(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n width: 100%;\n height: 100%;\n min-width: ", "px;\n flex: 1;\n flex-shrink: 0;\n\n ", "\n"], ["\n display: flex;\n align-items: center;\n width: 100%;\n height: 100%;\n min-width: ", "px;\n flex: 1;\n flex-shrink: 0;\n\n ", "\n"])), function (_a) {
328
+ })(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n width: 100%;\n height: 100%;\n min-width: ", "px;\n flex: 1;\n flex-shrink: 0;\n\n ", "\n"], ["\n display: flex;\n align-items: center;\n width: 100%;\n height: 100%;\n min-width: ", "px;\n flex: 1;\n flex-shrink: 0;\n\n ", "\n"])), function (_a) {
422
329
  var size = _a.size;
423
330
  return sizes_1.ICON_FROM_SIZE[size];
424
331
  }, function (_a) {
425
332
  var wrap = _a.wrap, description = _a.description;
426
333
  return !wrap && !description
427
- ? (0, styled_components_1.css)(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n max-height: ", "px;\n "], ["\n max-height: ", "px;\n "])), function (_a) {
334
+ ? (0, styled_components_1.css)(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n max-height: ", "px;\n "], ["\n max-height: ", "px;\n "])), function (_a) {
428
335
  var size = _a.size;
429
336
  return sizes_1.SIZE_TO_PX[size];
430
337
  }) : null;
@@ -477,14 +384,13 @@ exports.ButtonBadge = (0, react_1.memo)(function (_a) {
477
384
  * Primary Reqore button component that supports intents, icons, and badges.
478
385
  */
479
386
  var ReqoreButton = (0, react_1.memo)((0, react_1.forwardRef)(function (_a, ref) {
480
- var _b, _c, _d, _e, _f, _g;
481
- var icon = _a.icon, _h = _a.size, size = _h === void 0 ? 'normal' : _h, minimal = _a.minimal, transparent = _a.transparent, children = _a.children, tooltip = _a.tooltip, className = _a.className, fluid = _a.fluid, fixed = _a.fixed, alignSelf = _a.alignSelf, intent = _a.intent, active = _a.active, flat = _a.flat, rightIcon = _a.rightIcon, customTheme = _a.customTheme, wrap = _a.wrap, readOnly = _a.readOnly, badge = _a.badge, indicator = _a.indicator, description = _a.description, maxWidth = _a.maxWidth, textAlignProp = _a.textAlign, effect = _a.effect, labelEffect = _a.labelEffect, descriptionEffect = _a.descriptionEffect, leftIconColor = _a.leftIconColor, rightIconColor = _a.rightIconColor, iconColor = _a.iconColor, iconsAlignProp = _a.iconsAlign, leftIconProps = _a.leftIconProps, rightIconProps = _a.rightIconProps, label = _a.label, compact = _a.compact, square = _a.square, as = _a.as, animated = _a.animated, loading = _a.loading, shortcut = _a.shortcut, shortcutHint = _a.shortcutHint, loadingIconType = _a.loadingIconType, href = _a.href, type = _a.type, rest = __rest(_a, ["icon", "size", "minimal", "transparent", "children", "tooltip", "className", "fluid", "fixed", "alignSelf", "intent", "active", "flat", "rightIcon", "customTheme", "wrap", "readOnly", "badge", "indicator", "description", "maxWidth", "textAlign", "effect", "labelEffect", "descriptionEffect", "leftIconColor", "rightIconColor", "iconColor", "iconsAlign", "leftIconProps", "rightIconProps", "label", "compact", "square", "as", "animated", "loading", "shortcut", "shortcutHint", "loadingIconType", "href", "type"]);
387
+ var _b, _c, _d;
388
+ var icon = _a.icon, _e = _a.size, size = _e === void 0 ? 'normal' : _e, minimal = _a.minimal, transparent = _a.transparent, children = _a.children, tooltip = _a.tooltip, className = _a.className, fluid = _a.fluid, fixed = _a.fixed, alignSelf = _a.alignSelf, intent = _a.intent, active = _a.active, flat = _a.flat, rightIcon = _a.rightIcon, customTheme = _a.customTheme, wrap = _a.wrap, readOnly = _a.readOnly, badge = _a.badge, indicator = _a.indicator, description = _a.description, maxWidth = _a.maxWidth, textAlignProp = _a.textAlign, effect = _a.effect, labelEffect = _a.labelEffect, descriptionEffect = _a.descriptionEffect, leftIconColor = _a.leftIconColor, rightIconColor = _a.rightIconColor, iconColor = _a.iconColor, iconsAlignProp = _a.iconsAlign, leftIconProps = _a.leftIconProps, rightIconProps = _a.rightIconProps, label = _a.label, compact = _a.compact, square = _a.square, as = _a.as, animated = _a.animated, loading = _a.loading, shortcut = _a.shortcut, shortcutHint = _a.shortcutHint, loadingIconType = _a.loadingIconType, href = _a.href, type = _a.type, rest = __rest(_a, ["icon", "size", "minimal", "transparent", "children", "tooltip", "className", "fluid", "fixed", "alignSelf", "intent", "active", "flat", "rightIcon", "customTheme", "wrap", "readOnly", "badge", "indicator", "description", "maxWidth", "textAlign", "effect", "labelEffect", "descriptionEffect", "leftIconColor", "rightIconColor", "iconColor", "iconsAlign", "leftIconProps", "rightIconProps", "label", "compact", "square", "as", "animated", "loading", "shortcut", "shortcutHint", "loadingIconType", "href", "type"]);
482
389
  var animations = (0, useReqoreContext_1.useReqoreProperty)('animations');
483
390
  var shortcutHintsEnabled = (0, useReqoreContext_1.useReqoreProperty)('shortcutHints');
484
391
  var theme = (0, useTheme_1.useReqoreTheme)('main', customTheme, intent);
485
- var surface = (0, SurfaceContext_1.useReqoreSurface)();
486
392
  var fixedEffect = (0, useReqoreEffect_1.useReqoreEffect)('buttons', theme, effect);
487
- var _j = (0, useCombinedRefs_1.useCombinedRefs)(ref), targetRef = _j.targetRef, setRef = _j.setRef;
393
+ var targetRef = (0, useCombinedRefs_1.useCombinedRefs)(ref).targetRef;
488
394
  // Square chips have no horizontal padding, so the content would
489
395
  // stick to the left edge if we kept `textAlign`'s usual `'left'`
490
396
  // default. Default `textAlign` and `iconsAlign` to `'center'` for
@@ -523,17 +429,6 @@ var ReqoreButton = (0, react_1.memo)((0, react_1.forwardRef)(function (_a, ref)
523
429
  var customColor = (0, react_1.useMemo)(function () { return (intent ? theme.main : (0, colors_2.changeLightness)(theme.main, 0.07)); }, [intent, theme.main]);
524
430
  var _flat = minimal ? flat : flat === true;
525
431
  var _children = (0, react_1.useMemo)(function () { return label || children; }, [label, children]);
526
- /* An icon alone names nothing: a button with no label of its own and no `aria-label` was read as
527
- "button", and a test that finds buttons by name found nothing to test (qorus#646). Its tooltip, when
528
- that is a string, is the words it would say, so it names it. A tooltip that is a node or an object is
529
- left to the caller, and a button that has a label, or is named already, is not named twice. */
530
- var tooltipName = !_children &&
531
- !rest['aria-label'] &&
532
- !rest['aria-labelledby'] &&
533
- typeof tooltip === 'string' &&
534
- tooltip.trim()
535
- ? tooltip
536
- : undefined;
537
432
  var _compact = (_c = compact !== null && compact !== void 0 ? compact : (_b = theme.buttons) === null || _b === void 0 ? void 0 : _b.compact) !== null && _c !== void 0 ? _c : !children;
538
433
  var hasLeftIcon = icon || (leftIconProps === null || leftIconProps === void 0 ? void 0 : leftIconProps.image);
539
434
  var hasRightIcon = rightIcon || (rightIconProps === null || rightIconProps === void 0 ? void 0 : rightIconProps.image);
@@ -550,46 +445,6 @@ var ReqoreButton = (0, react_1.memo)((0, react_1.forwardRef)(function (_a, ref)
550
445
  ? "Loader".concat(loadingIconType || '', "Line")
551
446
  : icon || (leftIconProps === null || leftIconProps === void 0 ? void 0 : leftIconProps.icon);
552
447
  var memoEffect = (0, react_1.useMemo)(function () { return (__assign(__assign({ interactive: !readOnly && !rest.disabled }, fixedEffect), { gradient: intent ? undefined : fixedEffect === null || fixedEffect === void 0 ? void 0 : fixedEffect.gradient })); }, [fixedEffect, intent, readOnly, rest.disabled]);
553
- /* The button's colors depend on its gradient alone of its effect: an effect the caller writes inline (a new
554
- object each render) with the same gradient keeps them. */
555
- var gradientKey = (memoEffect === null || memoEffect === void 0 ? void 0 : memoEffect.gradient) ? JSON.stringify(memoEffect.gradient) : undefined;
556
- // The icons stand out from what the button is drawn on, as its text does.
557
- var colorProps = (0, react_1.useMemo)(function () { return ({
558
- theme: theme,
559
- color: customColor,
560
- minimal: minimal,
561
- transparent: transparent,
562
- effect: memoEffect,
563
- $surface: surface,
564
- }); }, [theme, customColor, minimal, transparent, gradientKey, surface]);
565
- /* Its colors in the states it is drawn in, and what its styles paint it with, worked out once per render
566
- rather than in each of its style rules. */
567
- var states = (0, react_1.useMemo)(function () { return (0, exports.getButtonStateColors)(colorProps, active); }, [colorProps, active]);
568
- // whether it has a description, not the description: a node given inline is new each render
569
- var hasDescription = !!description;
570
- var paint = (0, react_1.useMemo)(function () { return (0, exports.getButtonPaint)(colorProps, states, hasDescription); }, [colorProps, states, hasDescription]);
571
- // an icon's own color: in its props (which win, as they are spread over the rest), else the button's
572
- var _k = (0, iconProps_1.splitIconColor)(leftIconProps), leftIconPropsColor = _k[0], leftIconRest = _k[1];
573
- var _l = (0, iconProps_1.splitIconColor)(rightIconProps), rightIconPropsColor = _l[0], rightIconRest = _l[1];
574
- var leftIconOwn = leftIconPropsColor || leftIconColor || iconColor;
575
- var rightIconOwn = rightIconPropsColor || rightIconColor || iconColor;
576
- // only for the icons the button draws
577
- var leftIconLook = (0, react_1.useMemo)(function () { return (hasLeftIcon ? getButtonIconLookIn(theme, states, leftIconOwn) : undefined); }, [hasLeftIcon, theme, states, leftIconOwn]);
578
- var rightIconLook = (0, react_1.useMemo)(function () { return (hasRightIcon ? getButtonIconLookIn(theme, states, rightIconOwn) : undefined); }, [hasRightIcon, theme, states, rightIconOwn]);
579
- /* What the button holds (its badges, a label given as a node) is drawn on the button: at rest, or in its
580
- fill when it is active (a selected menu item, whose badges were picked for the resting wash). */
581
- var restingBackground = ((_d = states.active) !== null && _d !== void 0 ? _d : states.rest).backgrounds;
582
- /* Its effect's color is written on its own fill, at rest and hovered (or active), not on the surface
583
- around it: an info text on a success button was read on the page, 2.7:1 on the green. */
584
- var fillBackgrounds = (0, react_1.useMemo)(function () {
585
- var _a, _b;
586
- return states.active
587
- ? states.active.backgrounds
588
- : __spreadArray(__spreadArray([], states.rest.backgrounds, true), ((_b = (_a = states.hover) === null || _a === void 0 ? void 0 : _a.backgrounds) !== null && _b !== void 0 ? _b : []), true);
589
- }, [states]);
590
- // one object for as long as the opacity holds: an icon is a memo component
591
- var leftIconEffect = (0, react_1.useMemo)(function () { return ({ opacity: leftIconLook === null || leftIconLook === void 0 ? void 0 : leftIconLook.opacity }); }, [leftIconLook === null || leftIconLook === void 0 ? void 0 : leftIconLook.opacity]);
592
- var rightIconEffect = (0, react_1.useMemo)(function () { return ({ opacity: rightIconLook === null || rightIconLook === void 0 ? void 0 : rightIconLook.opacity }); }, [rightIconLook === null || rightIconLook === void 0 ? void 0 : rightIconLook.opacity]);
593
448
  var indicatorConfig = (0, react_1.useMemo)(function () {
594
449
  var _a, _b, _c, _d, _e, _f, _g;
595
450
  if (!indicator) {
@@ -605,38 +460,37 @@ var ReqoreButton = (0, react_1.memo)((0, react_1.forwardRef)(function (_a, ref)
605
460
  pulse: (_g = config.pulse) !== null && _g !== void 0 ? _g : false,
606
461
  };
607
462
  }, [indicator, size, theme.intents]);
608
- return ((0, jsx_runtime_1.jsxs)(TooltipComponent_1.ReqoreTooltipComponent, __assign({}, rest, (tooltipName ? { 'aria-label': tooltipName } : {}), { effect: memoEffect,
463
+ return ((0, jsx_runtime_1.jsxs)(TooltipComponent_1.ReqoreTooltipComponent, __assign({}, rest, { effect: memoEffect,
609
464
  // The caller's tab stop wins — a grid or a diagram keeps one of its
610
465
  // buttons in the tab order and moves it — except that a disabled
611
466
  // button is never one.
612
- tabIndex: rest.disabled ? -1 : ((_e = rest.tabIndex) !== null && _e !== void 0 ? _e : 0) }, elementProps, { as: element, theme: theme, fluid: fluid, fixed: fixed, alignSelf: alignSelf, maxWidth: maxWidth, minimal: minimal, transparent: transparent, size: size, intent: intent, color: customColor,
613
- $surface: surface,
614
- $backgrounds: fillBackgrounds,
615
- $paint: paint, animate: animate, flat: _flat, active: active, readOnly: readOnly || loading, wrap: wrap, description: description, className: "".concat(className || '', " reqore-control reqore-button"),
616
- compact: _compact, square: square, tooltip: tooltip }, useMarqueeOnHover_1.REQORE_MARQUEE_HOST, { Component: exports.StyledButton, ref: setRef, children: [(0, jsx_runtime_1.jsxs)(SurfaceContext_1.ReqoreSurfaceProvider, { color: restingBackground, children: [(0, jsx_runtime_1.jsxs)(exports.StyledButtonContent, { size: size, wrap: wrap, description: description, flat: _flat, children: [hasLeftIcon ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Icon_1.default, __assign({ size: size, color: (_f = leftIconLook === null || leftIconLook === void 0 ? void 0 : leftIconLook.color) !== null && _f !== void 0 ? _f : leftIconOwn, compact: true, effect: leftIconEffect }, leftIconRest, { style: textAlign !== 'left' || iconsAlign === 'center' || !_children
617
- ? {
618
- marginRight: iconsAlign !== 'center' || !_children ? 'auto' : undefined,
619
- marginLeft: iconsAlign === 'center' ||
620
- !_children ||
621
- (textAlign === 'center' && !_children)
622
- ? 'auto'
623
- : undefined,
624
- }
625
- : undefined, animation: loading ? 'spin' : leftIconProps === null || leftIconProps === void 0 ? void 0 : leftIconProps.animation, icon: leftIcon })), _children || hasRightIcon ? ((0, jsx_runtime_1.jsx)(Spacer_1.ReqoreSpacer, { width: sizes_1.PADDING_FROM_SIZE[size] / 2 })) : null] })) : _children ? ((0, jsx_runtime_1.jsx)(Spacer_1.ReqoreHorizontalSpacer, { width: 1, style: textAlign !== 'left' ? { marginRight: 'auto' } : undefined })) : null, _children && ((0, jsx_runtime_1.jsxs)(exports.StyledAnimatedTextWrapper, { textAlign: textAlign, style: textAlign === 'center' && iconsAlign !== 'center'
626
- ? { margin: 'auto' }
627
- : undefined, children: [!animate && ((0, jsx_runtime_1.jsx)(styles_1.StyledContent, __assign({ wrap: wrap, effect: labelEffect, className: 'reqore-button-text-content' }, useMarqueeOnHover_1.REQORE_MARQUEE_TEXT, { children: _children }))), animate && ((0, jsx_runtime_1.jsx)(styles_1.StyledActiveContent, __assign({ wrap: wrap, effect: labelEffect, className: 'reqore-button-text-content reqore-animated reqore-active' }, useMarqueeOnHover_1.REQORE_MARQUEE_TEXT, { children: _children }))), animate && ((0, jsx_runtime_1.jsx)(styles_1.StyledInActiveContent, __assign({ wrap: wrap, effect: labelEffect, className: 'reqore-button-text-content reqore-animated reqore-inactive' }, useMarqueeOnHover_1.REQORE_MARQUEE_TEXT, { "aria-hidden": 'true', children: _children }))), animate && ((0, jsx_runtime_1.jsx)(styles_1.StyledInvisibleContent, { wrap: wrap, effect: labelEffect, className: 'reqore-button-text-content reqore-animated reqore-invisible', "aria-hidden": 'true', children: _children })), (badge || badge === 0) && wrap ? ((0, jsx_runtime_1.jsx)(exports.ButtonBadge, { content: badge, size: size, wrap: true, active: active })) : null] })), (badge || badge === 0) && !wrap ? ((0, jsx_runtime_1.jsx)(exports.ButtonBadge, { content: badge, size: size, compact: _compact, wrapGroup: false, wrap: false, active: active })) : null, !hasRightIcon ? (_children ? ((0, jsx_runtime_1.jsx)(Spacer_1.ReqoreHorizontalSpacer, { width: 1, style: textAlign !== 'right' && !hasRightAlignedBadge
628
- ? { marginLeft: 'auto' }
629
- : undefined })) : null) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [_children || badge ? (0, jsx_runtime_1.jsx)(Spacer_1.ReqoreSpacer, { width: sizes_1.PADDING_FROM_SIZE[size] / 2 }) : null, (0, jsx_runtime_1.jsx)(Icon_1.default, __assign({ icon: rightIcon, size: size, color: (_g = rightIconLook === null || rightIconLook === void 0 ? void 0 : rightIconLook.color) !== null && _g !== void 0 ? _g : rightIconOwn, effect: rightIconEffect }, rightIconRest, { style: textAlign !== 'right' || iconsAlign === 'center'
630
- ? {
631
- marginLeft: !hasRightAlignedBadge && (iconsAlign !== 'center' || !_children)
632
- ? 'auto'
633
- : undefined,
634
- marginRight: iconsAlign === 'center' || (textAlign === 'center' && !_children)
635
- ? 'auto'
636
- : undefined,
637
- }
638
- : undefined }))] })), showShortcutHint ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Spacer_1.ReqoreSpacer, { width: sizes_1.PADDING_FROM_SIZE[size] / 2 }), (0, jsx_runtime_1.jsx)(KeyboardShortcut_1.ReqoreKeyboardShortcut, { shortcut: shortcut, size: size, compact: _compact })] })) : null] }), description && ((0, jsx_runtime_1.jsx)(Effect_1.ReqoreTextEffect, { className: 'reqore-button-description', effect: __assign({ textSize: (0, utils_1.getOneLessSize)(size), weight: 'light', textAlign: textAlign }, descriptionEffect), children: description }))] }), indicatorConfig && ((0, jsx_runtime_1.jsx)(exports.StyledButtonIndicator, { className: 'reqore-button-indicator', "$color": indicatorConfig.color, "$diameter": indicatorConfig.diameter, "$offset": indicatorConfig.offset, "$position": indicatorConfig.position, "$pulse": indicatorConfig.pulse, "aria-hidden": 'true' }))] })));
467
+ tabIndex: rest.disabled ? -1 : ((_d = rest.tabIndex) !== null && _d !== void 0 ? _d : 0) }, elementProps, { as: element, theme: theme, fluid: fluid, fixed: fixed, alignSelf: alignSelf, maxWidth: maxWidth, minimal: minimal, transparent: transparent, size: size, intent: intent, color: customColor, animate: animate, flat: _flat, active: active, readOnly: readOnly || loading, wrap: wrap, description: description, className: "".concat(className || '', " reqore-control reqore-button"),
468
+ compact: _compact, square: square, tooltip: tooltip }, useMarqueeOnHover_1.REQORE_MARQUEE_HOST, { Component: exports.StyledButton, ref: targetRef, children: [(0, jsx_runtime_1.jsxs)(exports.StyledButtonContent, { size: size, wrap: wrap, description: description, flat: _flat, children: [hasLeftIcon ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Icon_1.default, __assign({ size: size, color: leftIconColor || iconColor, compact: true, effect: {
469
+ opacity: colors_1.CONTROL_ICON_OPACITY,
470
+ } }, leftIconProps, { style: textAlign !== 'left' || iconsAlign === 'center' || !_children
471
+ ? {
472
+ marginRight: iconsAlign !== 'center' || !_children ? 'auto' : undefined,
473
+ marginLeft: iconsAlign === 'center' ||
474
+ !_children ||
475
+ (textAlign === 'center' && !_children)
476
+ ? 'auto'
477
+ : undefined,
478
+ }
479
+ : undefined, animation: loading ? 'spin' : leftIconProps === null || leftIconProps === void 0 ? void 0 : leftIconProps.animation, icon: leftIcon })), _children || hasRightIcon ? ((0, jsx_runtime_1.jsx)(Spacer_1.ReqoreSpacer, { width: sizes_1.PADDING_FROM_SIZE[size] / 2 })) : null] })) : _children ? ((0, jsx_runtime_1.jsx)(Spacer_1.ReqoreHorizontalSpacer, { width: 1, style: textAlign !== 'left' ? { marginRight: 'auto' } : undefined })) : null, _children && ((0, jsx_runtime_1.jsxs)(exports.StyledAnimatedTextWrapper, { textAlign: textAlign, style: textAlign === 'center' && iconsAlign !== 'center' ? { margin: 'auto' } : undefined, children: [!animate && ((0, jsx_runtime_1.jsx)(styles_1.StyledContent, __assign({ wrap: wrap, effect: labelEffect, className: 'reqore-button-text-content' }, useMarqueeOnHover_1.REQORE_MARQUEE_TEXT, { children: _children }))), animate && ((0, jsx_runtime_1.jsx)(styles_1.StyledActiveContent, __assign({ wrap: wrap, effect: labelEffect, className: 'reqore-button-text-content reqore-animated reqore-active' }, useMarqueeOnHover_1.REQORE_MARQUEE_TEXT, { children: _children }))), animate && ((0, jsx_runtime_1.jsx)(styles_1.StyledInActiveContent, __assign({ wrap: wrap, effect: labelEffect, className: 'reqore-button-text-content reqore-animated reqore-inactive' }, useMarqueeOnHover_1.REQORE_MARQUEE_TEXT, { "aria-hidden": 'true', children: _children }))), animate && ((0, jsx_runtime_1.jsx)(styles_1.StyledInvisibleContent, { wrap: wrap, effect: labelEffect, className: 'reqore-button-text-content reqore-animated reqore-invisible', "aria-hidden": 'true', children: _children })), (badge || badge === 0) && wrap ? ((0, jsx_runtime_1.jsx)(exports.ButtonBadge, { content: badge, size: size, wrap: true, active: active })) : null] })), (badge || badge === 0) && !wrap ? ((0, jsx_runtime_1.jsx)(exports.ButtonBadge, { content: badge, size: size, compact: _compact, wrapGroup: false, wrap: false, active: active })) : null, !hasRightIcon ? (_children ? ((0, jsx_runtime_1.jsx)(Spacer_1.ReqoreHorizontalSpacer, { width: 1, style: textAlign !== 'right' && !hasRightAlignedBadge
480
+ ? { marginLeft: 'auto' }
481
+ : undefined })) : null) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [_children || badge ? (0, jsx_runtime_1.jsx)(Spacer_1.ReqoreSpacer, { width: sizes_1.PADDING_FROM_SIZE[size] / 2 }) : null, (0, jsx_runtime_1.jsx)(Icon_1.default, __assign({ icon: rightIcon, size: size, color: rightIconColor || iconColor, effect: {
482
+ opacity: colors_1.CONTROL_ICON_OPACITY,
483
+ } }, rightIconProps, { style: textAlign !== 'right' || iconsAlign === 'center'
484
+ ? {
485
+ marginLeft: !hasRightAlignedBadge && (iconsAlign !== 'center' || !_children)
486
+ ? 'auto'
487
+ : undefined,
488
+ marginRight: iconsAlign === 'center' || (textAlign === 'center' && !_children)
489
+ ? 'auto'
490
+ : undefined,
491
+ }
492
+ : undefined }))] })), showShortcutHint ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Spacer_1.ReqoreSpacer, { width: sizes_1.PADDING_FROM_SIZE[size] / 2 }), (0, jsx_runtime_1.jsx)(KeyboardShortcut_1.ReqoreKeyboardShortcut, { shortcut: shortcut, size: size, compact: _compact })] })) : null] }), description && ((0, jsx_runtime_1.jsx)(Effect_1.ReqoreTextEffect, { className: 'reqore-button-description', effect: __assign({ textSize: (0, utils_1.getOneLessSize)(size), weight: 'light', textAlign: textAlign }, descriptionEffect), children: description })), indicatorConfig && ((0, jsx_runtime_1.jsx)(exports.StyledButtonIndicator, { className: 'reqore-button-indicator', "$color": indicatorConfig.color, "$diameter": indicatorConfig.diameter, "$offset": indicatorConfig.offset, "$position": indicatorConfig.position, "$pulse": indicatorConfig.pulse, "aria-hidden": 'true' }))] })));
639
493
  }));
640
494
  exports.default = ReqoreButton;
641
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15;
495
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16;
642
496
  //# sourceMappingURL=index.js.map