@charcoal-ui/react 2.0.0-alpha.21 → 2.0.0-alpha.22

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.
@@ -1,6 +1,6 @@
1
- import React, { useContext, useCallback, createContext, useMemo, useRef, useState, useEffect } from 'react';
1
+ import React, { useContext, useCallback, createContext, useMemo, useRef, useState, useEffect, useImperativeHandle } from 'react';
2
2
  export { SSRProvider } from '@react-aria/ssr';
3
- import styled, { css } from 'styled-components';
3
+ import styled, { css, keyframes } from 'styled-components';
4
4
  import { createTheme } from '@charcoal-ui/styled';
5
5
  import { disabledSelector, px } from '@charcoal-ui/utils';
6
6
  import warning from 'warning';
@@ -9,6 +9,7 @@ import { useToggleState } from 'react-stately';
9
9
  import { useTextField } from '@react-aria/textfield';
10
10
  import { useVisuallyHidden } from '@react-aria/visually-hidden';
11
11
  import '@charcoal-ui/icons';
12
+ import { transparentize } from 'polished';
12
13
 
13
14
  function _extends() {
14
15
  _extends = Object.assign || function (target) {
@@ -125,7 +126,7 @@ function unreachable(value) {
125
126
 
126
127
  var theme$2 = createTheme(styled);
127
128
 
128
- var _templateObject$7, _templateObject2$5, _templateObject3$5;
129
+ var _templateObject$8, _templateObject2$6, _templateObject3$6;
129
130
 
130
131
  var _excluded$6 = ["onClick", "disabled"];
131
132
  var Clickable = React.forwardRef(function Clickable(props, ref) {
@@ -150,11 +151,11 @@ var Clickable = React.forwardRef(function Clickable(props, ref) {
150
151
  }));
151
152
  }
152
153
  });
153
- var clickableCss = css(_templateObject$7 || (_templateObject$7 = _taggedTemplateLiteralLoose(["\n /* Clickable style */\n cursor: pointer;\n\n ", " {\n cursor: default;\n }\n"])), disabledSelector);
154
- var Button$1 = styled.button(_templateObject2$5 || (_templateObject2$5 = _taggedTemplateLiteralLoose(["\n /* Reset button appearance */\n appearance: none;\n background: transparent;\n padding: 0;\n border-style: none;\n outline: none;\n color: inherit;\n text-rendering: inherit;\n letter-spacing: inherit;\n word-spacing: inherit;\n\n &:focus {\n outline: none;\n }\n\n /* Change the font styles in all browsers. */\n font: inherit;\n\n /* Remove the margin in Firefox and Safari. */\n margin: 0;\n\n /* Show the overflow in Edge. */\n overflow: visible;\n\n /* Remove the inheritance of text transform in Firefox. */\n text-transform: none;\n\n /* Remove the inner border and padding in Firefox. */\n &::-moz-focus-inner {\n border-style: none;\n padding: 0;\n }\n\n ", "\n"])), clickableCss);
155
- var A = styled.span(_templateObject3$5 || (_templateObject3$5 = _taggedTemplateLiteralLoose(["\n /* Reset a-tag appearance */\n color: inherit;\n\n &:focus {\n outline: none;\n }\n\n .text {\n top: calc(1em + 2em);\n }\n\n ", "\n"])), clickableCss);
154
+ var clickableCss = css(_templateObject$8 || (_templateObject$8 = _taggedTemplateLiteralLoose(["\n /* Clickable style */\n cursor: pointer;\n\n ", " {\n cursor: default;\n }\n"])), disabledSelector);
155
+ var Button$1 = styled.button(_templateObject2$6 || (_templateObject2$6 = _taggedTemplateLiteralLoose(["\n /* Reset button appearance */\n appearance: none;\n background: transparent;\n padding: 0;\n border-style: none;\n outline: none;\n color: inherit;\n text-rendering: inherit;\n letter-spacing: inherit;\n word-spacing: inherit;\n\n &:focus {\n outline: none;\n }\n\n /* Change the font styles in all browsers. */\n font: inherit;\n\n /* Remove the margin in Firefox and Safari. */\n margin: 0;\n\n /* Show the overflow in Edge. */\n overflow: visible;\n\n /* Remove the inheritance of text transform in Firefox. */\n text-transform: none;\n\n /* Remove the inner border and padding in Firefox. */\n &::-moz-focus-inner {\n border-style: none;\n padding: 0;\n }\n\n ", "\n"])), clickableCss);
156
+ var A = styled.span(_templateObject3$6 || (_templateObject3$6 = _taggedTemplateLiteralLoose(["\n /* Reset a-tag appearance */\n color: inherit;\n\n &:focus {\n outline: none;\n }\n\n .text {\n top: calc(1em + 2em);\n }\n\n ", "\n"])), clickableCss);
156
157
 
157
- var _templateObject$6;
158
+ var _templateObject$7;
158
159
 
159
160
  var _excluded$5 = ["children", "variant", "size", "fixed", "disabled"];
160
161
  var Button = React.forwardRef(function Button(_ref, ref) {
@@ -182,7 +183,7 @@ var StyledButton = styled(Clickable).withConfig({
182
183
  // fixed は <button> 要素に渡ってはいけない
183
184
  return prop !== 'fixed';
184
185
  }
185
- }).attrs(styledProps$1)(_templateObject$6 || (_templateObject$6 = _taggedTemplateLiteralLoose(["\n width: ", ";\n display: inline-grid;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n user-select: none;\n white-space: nowrap;\n\n ", "\n\n /* \u3088\u304F\u8003\u3048\u305F\u3089height=32\u3063\u3066\u5B9A\u7FA9\u304C\u5B58\u5728\u3057\u306A\u3044\u306A... */\n height: ", "px;\n"])), function (p) {
186
+ }).attrs(styledProps$1)(_templateObject$7 || (_templateObject$7 = _taggedTemplateLiteralLoose(["\n width: ", ";\n display: inline-grid;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n user-select: none;\n white-space: nowrap;\n\n ", "\n\n /* \u3088\u304F\u8003\u3048\u305F\u3089height=32\u3063\u3066\u5B9A\u7FA9\u304C\u5B58\u5728\u3057\u306A\u3044\u306A... */\n height: ", "px;\n"])), function (p) {
186
187
  return p.fixed ? 'stretch' : 'min-content';
187
188
  }, function (p) {
188
189
  return theme$2(function (o) {
@@ -249,7 +250,7 @@ function sizeToProps$1(size) {
249
250
  }
250
251
  }
251
252
 
252
- var _templateObject$5;
253
+ var _templateObject$6;
253
254
 
254
255
  var _excluded$4 = ["variant", "size", "icon"];
255
256
  var IconButton = React.forwardRef(function IconButtonInner(_ref, ref) {
@@ -269,7 +270,7 @@ var IconButton = React.forwardRef(function IconButtonInner(_ref, ref) {
269
270
  name: icon
270
271
  }));
271
272
  });
272
- var StyledIconButton = styled(Clickable).attrs(styledProps)(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteralLoose(["\n user-select: none;\n\n width: ", "px;\n height: ", "px;\n display: flex;\n align-items: center;\n justify-content: center;\n\n ", "\n"])), function (p) {
273
+ var StyledIconButton = styled(Clickable).attrs(styledProps)(_templateObject$6 || (_templateObject$6 = _taggedTemplateLiteralLoose(["\n user-select: none;\n\n width: ", "px;\n height: ", "px;\n display: flex;\n align-items: center;\n justify-content: center;\n\n ", "\n"])), function (p) {
273
274
  return p.width;
274
275
  }, function (p) {
275
276
  return p.height;
@@ -356,7 +357,7 @@ function validateIconSize(size, icon) {
356
357
  }
357
358
  }
358
359
 
359
- var _templateObject$4, _templateObject2$4, _templateObject3$4, _templateObject4$3;
360
+ var _templateObject$5, _templateObject2$5, _templateObject3$5, _templateObject4$3;
360
361
  function Radio(_ref) {
361
362
  var value = _ref.value,
362
363
  _ref$forceChecked = _ref.forceChecked,
@@ -392,7 +393,7 @@ function Radio(_ref) {
392
393
  disabled: isDisabled || isReadonly
393
394
  }), children != null && /*#__PURE__*/React.createElement(RadioLabel, null, children));
394
395
  }
395
- var RadioRoot = styled.label(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteralLoose(["\n display: grid;\n grid-template-columns: auto 1fr;\n grid-gap: ", ";\n align-items: center;\n cursor: pointer;\n\n ", "\n"])), function (_ref2) {
396
+ var RadioRoot = styled.label(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteralLoose(["\n display: grid;\n grid-template-columns: auto 1fr;\n grid-gap: ", ";\n align-items: center;\n cursor: pointer;\n\n ", "\n"])), function (_ref2) {
396
397
  var theme = _ref2.theme;
397
398
  return px(theme.spacing[4]);
398
399
  }, theme$2(function (o) {
@@ -400,7 +401,7 @@ var RadioRoot = styled.label(_templateObject$4 || (_templateObject$4 = _taggedTe
400
401
  }));
401
402
  var RadioInput = styled.input.attrs({
402
403
  type: 'radio'
403
- })(_templateObject2$4 || (_templateObject2$4 = _taggedTemplateLiteralLoose(["\n /** Make prior to browser default style */\n &[type='radio'] {\n appearance: none;\n display: block;\n box-sizing: border-box;\n\n padding: 6px;\n\n width: 20px;\n height: 20px;\n\n ", ";\n\n &:not(:checked) {\n border-width: 2px;\n border-style: solid;\n border-color: ", ";\n }\n\n &:checked {\n ", "\n\n &::after {\n content: '';\n display: block;\n width: 8px;\n height: 8px;\n pointer-events: none;\n\n ", "\n }\n }\n\n ", "\n }\n"])), function (_ref3) {
404
+ })(_templateObject2$5 || (_templateObject2$5 = _taggedTemplateLiteralLoose(["\n /** Make prior to browser default style */\n &[type='radio'] {\n appearance: none;\n display: block;\n box-sizing: border-box;\n\n padding: 6px;\n\n width: 20px;\n height: 20px;\n\n ", ";\n\n &:not(:checked) {\n border-width: 2px;\n border-style: solid;\n border-color: ", ";\n }\n\n &:checked {\n ", "\n\n &::after {\n content: '';\n display: block;\n width: 8px;\n height: 8px;\n pointer-events: none;\n\n ", "\n }\n }\n\n ", "\n }\n"])), function (_ref3) {
404
405
  var _ref3$hasError = _ref3.hasError,
405
406
  hasError = _ref3$hasError === void 0 ? false : _ref3$hasError;
406
407
  return theme$2(function (o) {
@@ -416,7 +417,7 @@ var RadioInput = styled.input.attrs({
416
417
  }), theme$2(function (o) {
417
418
  return o.outline["default"].focus;
418
419
  }));
419
- var RadioLabel = styled.div(_templateObject3$4 || (_templateObject3$4 = _taggedTemplateLiteralLoose(["\n ", "\n"])), theme$2(function (o) {
420
+ var RadioLabel = styled.div(_templateObject3$5 || (_templateObject3$5 = _taggedTemplateLiteralLoose(["\n ", "\n"])), theme$2(function (o) {
420
421
  return [o.typography(14)];
421
422
  })); // TODO: use (or polyfill) flex gap
422
423
 
@@ -476,7 +477,7 @@ var SelectGroupContext = createContext({
476
477
  }
477
478
  });
478
479
 
479
- var _templateObject$3, _templateObject2$3, _templateObject3$3, _templateObject4$2, _templateObject5$1;
480
+ var _templateObject$4, _templateObject2$4, _templateObject3$4, _templateObject4$2, _templateObject5$1;
480
481
  function Select(_ref) {
481
482
  var value = _ref.value,
482
483
  _ref$forceChecked = _ref.forceChecked,
@@ -534,18 +535,18 @@ function Select(_ref) {
534
535
  "unsafe-non-guideline-scale": 16 / 24
535
536
  })), Boolean(children) && /*#__PURE__*/React.createElement(SelectLabel, null, children));
536
537
  }
537
- var SelectRoot = styled.label(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteralLoose(["\n display: grid;\n grid-template-columns: auto 1fr;\n align-items: center;\n position: relative;\n cursor: pointer;\n ", " {\n cursor: default;\n }\n gap: ", ";\n ", "\n"])), disabledSelector, function (_ref2) {
538
+ var SelectRoot = styled.label(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteralLoose(["\n display: grid;\n grid-template-columns: auto 1fr;\n align-items: center;\n position: relative;\n cursor: pointer;\n ", " {\n cursor: default;\n }\n gap: ", ";\n ", "\n"])), disabledSelector, function (_ref2) {
538
539
  var theme = _ref2.theme;
539
540
  return px(theme.spacing[4]);
540
541
  }, theme$2(function (o) {
541
542
  return o.disabled;
542
543
  }));
543
- var SelectLabel = styled.div(_templateObject2$3 || (_templateObject2$3 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n ", "\n"])), theme$2(function (o) {
544
+ var SelectLabel = styled.div(_templateObject2$4 || (_templateObject2$4 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n ", "\n"])), theme$2(function (o) {
544
545
  return [o.typography(14), o.font.text1];
545
546
  }));
546
547
  var SelectInput = styled.input.attrs({
547
548
  type: 'checkbox'
548
- })(_templateObject3$3 || (_templateObject3$3 = _taggedTemplateLiteralLoose(["\n &[type='checkbox'] {\n appearance: none;\n display: block;\n width: 20px;\n height: 20px;\n margin: 0;\n\n &:checked {\n ", "\n }\n\n ", ";\n }\n"])), theme$2(function (o) {
549
+ })(_templateObject3$4 || (_templateObject3$4 = _taggedTemplateLiteralLoose(["\n &[type='checkbox'] {\n appearance: none;\n display: block;\n width: 20px;\n height: 20px;\n margin: 0;\n\n &:checked {\n ", "\n }\n\n ", ";\n }\n"])), theme$2(function (o) {
549
550
  return o.bg.brand.hover.press;
550
551
  }), function (_ref3) {
551
552
  var hasError = _ref3.hasError,
@@ -609,7 +610,7 @@ function SelectGroup(_ref7) {
609
610
  }, children));
610
611
  }
611
612
 
612
- var _templateObject$2, _templateObject2$2, _templateObject3$2;
613
+ var _templateObject$3, _templateObject2$3, _templateObject3$3;
613
614
 
614
615
  var _excluded$3 = ["className", "type"];
615
616
  function SwitchCheckbox(props) {
@@ -640,18 +641,18 @@ function SwitchCheckbox(props) {
640
641
  // eslint-disable-next-line react/destructuring-assignment
641
642
  React.createElement(LabelInner, null, props.children) : undefined);
642
643
  }
643
- var Label$1 = styled.label(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteralLoose(["\n display: inline-grid;\n grid-template-columns: auto 1fr;\n gap: ", ";\n cursor: pointer;\n outline: 0;\n\n ", "\n\n ", " {\n cursor: default;\n }\n"])), function (_ref) {
644
+ var Label$1 = styled.label(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteralLoose(["\n display: inline-grid;\n grid-template-columns: auto 1fr;\n gap: ", ";\n cursor: pointer;\n outline: 0;\n\n ", "\n\n ", " {\n cursor: default;\n }\n"])), function (_ref) {
644
645
  var theme = _ref.theme;
645
646
  return px(theme.spacing[4]);
646
647
  }, theme$2(function (o) {
647
648
  return o.disabled;
648
649
  }), disabledSelector);
649
- var LabelInner = styled.div(_templateObject2$2 || (_templateObject2$2 = _taggedTemplateLiteralLoose(["\n ", "\n"])), theme$2(function (o) {
650
+ var LabelInner = styled.div(_templateObject2$3 || (_templateObject2$3 = _taggedTemplateLiteralLoose(["\n ", "\n"])), theme$2(function (o) {
650
651
  return o.typography(14);
651
652
  }));
652
653
  var SwitchInput = styled.input.attrs({
653
654
  type: 'checkbox'
654
- })(_templateObject3$2 || (_templateObject3$2 = _taggedTemplateLiteralLoose(["\n &[type='checkbox'] {\n appearance: none;\n display: inline-flex;\n position: relative;\n box-sizing: border-box;\n width: 28px;\n border: 2px solid transparent;\n transition: box-shadow 0.2s, background-color 0.2s;\n cursor: inherit;\n ", "\n\n &::after {\n content: '';\n position: absolute;\n display: block;\n top: 0;\n left: 0;\n width: 12px;\n height: 12px;\n transform: translateX(0);\n transition: transform 0.2s;\n ", "\n }\n\n &:checked {\n ", "\n\n &::after {\n transform: translateX(12px);\n }\n }\n }\n"])), theme$2(function (o) {
655
+ })(_templateObject3$3 || (_templateObject3$3 = _taggedTemplateLiteralLoose(["\n &[type='checkbox'] {\n appearance: none;\n display: inline-flex;\n position: relative;\n box-sizing: border-box;\n width: 28px;\n border: 2px solid transparent;\n transition: box-shadow 0.2s, background-color 0.2s;\n cursor: inherit;\n ", "\n\n &::after {\n content: '';\n position: absolute;\n display: block;\n top: 0;\n left: 0;\n width: 12px;\n height: 12px;\n transform: translateX(0);\n transition: transform 0.2s;\n ", "\n }\n\n &:checked {\n ", "\n\n &::after {\n transform: translateX(12px);\n }\n }\n }\n"])), theme$2(function (o) {
655
656
  return [o.borderRadius(16), o.height.px(16), o.bg.text4.hover.press, o.outline["default"].focus];
656
657
  }), theme$2(function (o) {
657
658
  return [o.bg.text5.hover.press, o.borderRadius('oval')];
@@ -659,7 +660,7 @@ var SwitchInput = styled.input.attrs({
659
660
  return o.bg.brand.hover.press;
660
661
  }));
661
662
 
662
- var _templateObject$1, _templateObject2$1, _templateObject3$1, _templateObject4$1;
663
+ var _templateObject$2, _templateObject2$2, _templateObject3$2, _templateObject4$1;
663
664
 
664
665
  var _excluded$2 = ["style", "className", "label", "required", "requiredText", "subLabel"];
665
666
  var FieldLabel = React.forwardRef(function FieldLabel(_ref, ref) {
@@ -680,13 +681,13 @@ var FieldLabel = React.forwardRef(function FieldLabel(_ref, ref) {
680
681
  }, labelProps), label), required && /*#__PURE__*/React.createElement(RequiredText, null, requiredText), /*#__PURE__*/React.createElement(SubLabelClickable, null, /*#__PURE__*/React.createElement("span", null, subLabel)));
681
682
  });
682
683
  var theme$1 = createTheme(styled);
683
- var Label = styled.label(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteralLoose(["\n ", "\n"])), theme$1(function (o) {
684
+ var Label = styled.label(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteralLoose(["\n ", "\n"])), theme$1(function (o) {
684
685
  return [o.typography(14).bold, o.font.text1];
685
686
  }));
686
- var RequiredText = styled.span(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteralLoose(["\n ", "\n"])), theme$1(function (o) {
687
+ var RequiredText = styled.span(_templateObject2$2 || (_templateObject2$2 = _taggedTemplateLiteralLoose(["\n ", "\n"])), theme$1(function (o) {
687
688
  return [o.typography(14), o.font.text3];
688
689
  }));
689
- var SubLabelClickable = styled.div(_templateObject3$1 || (_templateObject3$1 = _taggedTemplateLiteralLoose(["\n ", "\n"])), theme$1(function (o) {
690
+ var SubLabelClickable = styled.div(_templateObject3$2 || (_templateObject3$2 = _taggedTemplateLiteralLoose(["\n ", "\n"])), theme$1(function (o) {
690
691
  return [o.typography(14), o.font.text3.hover.press, o.outline["default"].focus];
691
692
  }));
692
693
  var FieldLabelWrapper = styled.div(_templateObject4$1 || (_templateObject4$1 = _taggedTemplateLiteralLoose(["\n display: inline-flex;\n align-items: center;\n\n > ", " {\n ", "\n }\n\n > ", " {\n ", "\n }\n"])), RequiredText, theme$1(function (o) {
@@ -695,7 +696,7 @@ var FieldLabelWrapper = styled.div(_templateObject4$1 || (_templateObject4$1 = _
695
696
  return o.margin.left('auto');
696
697
  }));
697
698
 
698
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14;
699
+ var _templateObject$1, _templateObject2$1, _templateObject3$1, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14;
699
700
 
700
701
  var _excluded$1 = ["onChange"],
701
702
  _excluded2 = ["onChange"];
@@ -893,11 +894,8 @@ var MultiLineTextField = React.forwardRef(function MultiLineTextFieldInner(_ref2
893
894
  var syncHeight = useCallback(function (textarea) {
894
895
  var _$match$length, _$match;
895
896
 
896
- var rows = (_$match$length = (_$match = (textarea.value + "\n").match(/\n/g)) == null ? void 0 : _$match.length) != null ? _$match$length : 1;
897
-
898
- if (initialRows <= rows) {
899
- setRows(rows);
900
- }
897
+ var rows = ((_$match$length = (_$match = (textarea.value + "\n").match(/\n/g)) == null ? void 0 : _$match.length) != null ? _$match$length : 0) || 1;
898
+ setRows(initialRows <= rows ? rows : initialRows);
901
899
  }, [initialRows]);
902
900
  var nonControlled = props.value === undefined;
903
901
  var handleChange = useCallback(function (value) {
@@ -961,15 +959,15 @@ var MultiLineTextField = React.forwardRef(function MultiLineTextFieldInner(_ref2
961
959
  invalid: invalid
962
960
  }, invalid ? errorMessageProps : descriptionProps), assistiveText));
963
961
  });
964
- var TextFieldRoot = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n\n ", "\n"])), function (p) {
962
+ var TextFieldRoot = styled.div(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n\n ", "\n"])), function (p) {
965
963
  return p.isDisabled && {
966
964
  opacity: p.theme.elementEffect.disabled.opacity
967
965
  };
968
966
  });
969
- var TextFieldLabel = styled(FieldLabel)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n ", "\n"])), theme(function (o) {
967
+ var TextFieldLabel = styled(FieldLabel)(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteralLoose(["\n ", "\n"])), theme(function (o) {
970
968
  return o.margin.bottom(8);
971
969
  }));
972
- var StyledInputContainer = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n height: 40px;\n display: grid;\n position: relative;\n"])));
970
+ var StyledInputContainer = styled.div(_templateObject3$1 || (_templateObject3$1 = _taggedTemplateLiteralLoose(["\n height: 40px;\n display: grid;\n position: relative;\n"])));
973
971
  var PrefixContainer = styled.span(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n position: absolute;\n top: 50%;\n left: 8px;\n transform: translateY(-50%);\n"])));
974
972
  var SuffixContainer = styled.span(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n position: absolute;\n top: 50%;\n right: 8px;\n transform: translateY(-50%);\n\n display: flex;\n gap: 8px;\n"])));
975
973
  var Affix = styled.span(_templateObject6 || (_templateObject6 = _taggedTemplateLiteralLoose(["\n user-select: none;\n\n ", "\n"])), theme(function (o) {
@@ -1020,7 +1018,7 @@ var AssistiveText = styled.p(_templateObject14 || (_templateObject14 = _taggedTe
1020
1018
  });
1021
1019
 
1022
1020
  var _excluded = ["name", "scale", "unsafeNonGuidelineScale", "className"];
1023
- var Icon = React.forwardRef(function IconInner(_ref, ref) {
1021
+ var Icon$1 = React.forwardRef(function IconInner(_ref, ref) {
1024
1022
  var name = _ref.name,
1025
1023
  scale = _ref.scale,
1026
1024
  unsafeNonGuidelineScale = _ref.unsafeNonGuidelineScale,
@@ -1036,5 +1034,65 @@ var Icon = React.forwardRef(function IconInner(_ref, ref) {
1036
1034
  }, rest));
1037
1035
  });
1038
1036
 
1039
- export { Button, Clickable, ComponentAbstraction, Icon, IconButton, Radio, RadioGroup, Select, SelectGroup, SwitchCheckbox as Switch, TextField, useComponentAbstraction };
1037
+ var _templateObject, _templateObject2, _templateObject3;
1038
+ function LoadingSpinner(_ref) {
1039
+ var _ref$size = _ref.size,
1040
+ size = _ref$size === void 0 ? 48 : _ref$size,
1041
+ _ref$padding = _ref.padding,
1042
+ padding = _ref$padding === void 0 ? 16 : _ref$padding,
1043
+ _ref$transparent = _ref.transparent,
1044
+ transparent = _ref$transparent === void 0 ? false : _ref$transparent;
1045
+ return /*#__PURE__*/React.createElement(LoadingSpinnerRoot, {
1046
+ size: size,
1047
+ padding: padding,
1048
+ transparent: transparent
1049
+ }, /*#__PURE__*/React.createElement(LoadingSpinnerIcon, null));
1050
+ }
1051
+ var LoadingSpinnerRoot = styled.div.attrs({
1052
+ role: 'progressbar'
1053
+ })(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n margin: auto;\n padding: ", "px;\n border-radius: 8px;\n font-size: ", "px;\n width: ", "px;\n height: ", "px;\n background-color: ", ";\n color: ", ";\n"])), function (props) {
1054
+ return props.padding;
1055
+ }, function (props) {
1056
+ return props.size;
1057
+ }, function (props) {
1058
+ return props.size;
1059
+ }, function (props) {
1060
+ return props.size;
1061
+ }, function (_ref2) {
1062
+ var theme = _ref2.theme,
1063
+ transparent = _ref2.transparent;
1064
+ return transparent ? 'transparent' : transparentize(0.32, theme.color.background1);
1065
+ }, function (_ref3) {
1066
+ var theme = _ref3.theme;
1067
+ return theme.color.text4;
1068
+ });
1069
+ var scaleout = keyframes(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n from {\n transform: scale(0);\n opacity: 1;\n }\n\n to {\n transform: scale(1);\n opacity: 0;\n }\n"])));
1070
+ var Icon = styled.div.attrs({
1071
+ role: 'presentation'
1072
+ })(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n width: 1em;\n height: 1em;\n border-radius: 1em;\n background-color: currentColor;\n animation: ", " 1s both ease-out;\n animation-iteration-count: ", ";\n\n &[data-reset-animation] {\n animation: none;\n }\n"])), scaleout, function (p) {
1073
+ return p.once ? 1 : 'infinite';
1074
+ });
1075
+ var LoadingSpinnerIcon = React.forwardRef(function LoadingSpinnerIcon(_ref4, ref) {
1076
+ var _ref4$once = _ref4.once,
1077
+ once = _ref4$once === void 0 ? false : _ref4$once;
1078
+ var iconRef = useRef(null);
1079
+ useImperativeHandle(ref, function () {
1080
+ return {
1081
+ restart: function restart() {
1082
+ if (!iconRef.current) {
1083
+ return;
1084
+ }
1085
+
1086
+ iconRef.current.dataset.resetAnimation = 'true'; // Force reflow hack!
1087
+ delete iconRef.current.dataset.resetAnimation;
1088
+ }
1089
+ };
1090
+ });
1091
+ return /*#__PURE__*/React.createElement(Icon, {
1092
+ ref: iconRef,
1093
+ once: once
1094
+ });
1095
+ });
1096
+
1097
+ export { Button, Clickable, ComponentAbstraction, Icon$1 as Icon, IconButton, LoadingSpinner, LoadingSpinnerIcon, Radio, RadioGroup, Select, SelectGroup, SwitchCheckbox as Switch, TextField, useComponentAbstraction };
1040
1098
  //# sourceMappingURL=index.module.js.map