@mirai/ui 1.1.0-beta → 1.1.0-d

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 (95) hide show
  1. package/build/components/Action/Action.js +2 -4
  2. package/build/components/Action/Action.js.map +1 -1
  3. package/build/components/Action/Action.module.css +50 -49
  4. package/build/components/Action/Action.stories.js +4 -7
  5. package/build/components/Action/Action.stories.js.map +1 -1
  6. package/build/components/Button/Button.js +5 -7
  7. package/build/components/Button/Button.js.map +1 -1
  8. package/build/components/Calendar/Calendar.Month.js +4 -6
  9. package/build/components/Calendar/Calendar.Month.js.map +1 -1
  10. package/build/components/Calendar/Calendar.Week.js +6 -6
  11. package/build/components/Calendar/Calendar.Week.js.map +1 -1
  12. package/build/components/Calendar/Calendar.Weekdays.js +3 -6
  13. package/build/components/Calendar/Calendar.Weekdays.js.map +1 -1
  14. package/build/components/Calendar/Calendar.js +3 -3
  15. package/build/components/Calendar/Calendar.js.map +1 -1
  16. package/build/components/Calendar/__tests__/__snapshots__/Calendar.test.jsx.snap +32 -32
  17. package/build/components/InputNumber/InputNumber.js +6 -9
  18. package/build/components/InputNumber/InputNumber.js.map +1 -1
  19. package/build/components/InputNumber/__tests__/__snapshots__/InputNumber.test.js.snap +24 -24
  20. package/build/components/InputOption/InputOption.js +4 -7
  21. package/build/components/InputOption/InputOption.js.map +1 -1
  22. package/build/components/InputOption/__tests__/__snapshots__/InputOption.test.js.snap +4 -4
  23. package/build/components/InputPhone/InputPhone.js +11 -11
  24. package/build/components/InputPhone/InputPhone.js.map +1 -1
  25. package/build/components/InputPhone/__tests__/__snapshots__/InputPhone.test.js.snap +27 -27
  26. package/build/components/InputSelect/InputSelect.js +7 -7
  27. package/build/components/InputSelect/InputSelect.js.map +1 -1
  28. package/build/components/InputSelect/__tests__/__snapshots__/InputSelect.test.js.snap +12 -12
  29. package/build/components/InputText/InputText.js +10 -10
  30. package/build/components/InputText/InputText.js.map +1 -1
  31. package/build/components/InputText/__tests__/__snapshots__/InputText.test.js.snap +7 -7
  32. package/build/components/InputText/partials/InputText.Hint.js +2 -5
  33. package/build/components/InputText/partials/InputText.Hint.js.map +1 -1
  34. package/build/components/InputText/partials/InputText.IconState.js +2 -5
  35. package/build/components/InputText/partials/InputText.IconState.js.map +1 -1
  36. package/build/components/InputText/partials/InputText.Label.js +3 -6
  37. package/build/components/InputText/partials/InputText.Label.js.map +1 -1
  38. package/build/components/Menu/Menu.Option.js +5 -8
  39. package/build/components/Menu/Menu.Option.js.map +1 -1
  40. package/build/components/Menu/Menu.js +3 -6
  41. package/build/components/Menu/Menu.js.map +1 -1
  42. package/build/components/Menu/Menu.module.css +0 -3
  43. package/build/components/Menu/__tests__/__snapshots__/Menu.test.jsx.snap +2 -2
  44. package/build/components/Modal/Modal.js +9 -8
  45. package/build/components/Modal/Modal.js.map +1 -1
  46. package/build/components/Modal/__tests__/__snapshots__/Modal.test.js.snap +3 -3
  47. package/build/components/Notification/Notification.js +5 -8
  48. package/build/components/Notification/Notification.js.map +1 -1
  49. package/build/components/Notification/__tests__/__snapshots__/Notification.test.js.snap +19 -19
  50. package/build/components/Progress/Progress.js +3 -6
  51. package/build/components/Progress/Progress.js.map +1 -1
  52. package/build/components/Slider/Slider.js +11 -11
  53. package/build/components/Slider/Slider.js.map +1 -1
  54. package/build/components/Slider/__tests__/__snapshots__/Slider.test.js.snap +12 -12
  55. package/build/components/Table/Table.ColumnFilter.js +9 -9
  56. package/build/components/Table/Table.ColumnFilter.js.map +1 -1
  57. package/build/components/Table/Table.Filter.js +4 -7
  58. package/build/components/Table/Table.Filter.js.map +1 -1
  59. package/build/components/Table/Table.Row.js +7 -7
  60. package/build/components/Table/Table.Row.js.map +1 -1
  61. package/build/components/Table/Table.js +3 -3
  62. package/build/components/Table/Table.js.map +1 -1
  63. package/build/components/Table/Table.stories.js +5 -4
  64. package/build/components/Table/Table.stories.js.map +1 -1
  65. package/build/components/Table/__tests__/__snapshots__/Table.ColumnFilter.test.js.snap +12 -12
  66. package/build/components/Table/__tests__/__snapshots__/Table.test.js.snap +60 -60
  67. package/build/components/Tooltip/Tooltip.js +4 -4
  68. package/build/components/Tooltip/Tooltip.js.map +1 -1
  69. package/build/primitives/Checkbox/Checkbox.js +3 -6
  70. package/build/primitives/Checkbox/Checkbox.js.map +1 -1
  71. package/build/primitives/Icon/Icon.js +2 -4
  72. package/build/primitives/Icon/Icon.js.map +1 -1
  73. package/build/primitives/Icon/Icon.module.css +4 -4
  74. package/build/primitives/Icon/__tests__/__snapshots__/Icon.test.js.snap +27 -27
  75. package/build/primitives/Input/Input.js +2 -2
  76. package/build/primitives/Input/Input.js.map +1 -1
  77. package/build/primitives/Layer/Layer.js +2 -2
  78. package/build/primitives/Layer/Layer.js.map +1 -1
  79. package/build/primitives/Pressable/Pressable.js +2 -4
  80. package/build/primitives/Pressable/Pressable.js.map +1 -1
  81. package/build/primitives/Radio/Radio.js +4 -7
  82. package/build/primitives/Radio/Radio.js.map +1 -1
  83. package/build/primitives/ScrollView/ScrollView.js +2 -2
  84. package/build/primitives/ScrollView/ScrollView.js.map +1 -1
  85. package/build/primitives/Select/Select.js +2 -2
  86. package/build/primitives/Select/Select.js.map +1 -1
  87. package/build/primitives/Switch/Switch.js +4 -7
  88. package/build/primitives/Switch/Switch.js.map +1 -1
  89. package/build/primitives/Text/Text.js +2 -4
  90. package/build/primitives/Text/Text.js.map +1 -1
  91. package/build/primitives/Text/Text.module.css +4 -4
  92. package/build/primitives/View/View.js +2 -4
  93. package/build/primitives/View/View.js.map +1 -1
  94. package/package.json +1 -5
  95. package/build/primitives/Primitive/Primitive.module.css +0 -241
@@ -12,7 +12,7 @@ var _components = require("../../components");
12
12
  var _helpers = require("../../helpers");
13
13
  var _hooks = require("../../hooks");
14
14
  var _primitives = require("../../primitives");
15
- var style = _interopRequireWildcard(require("./Modal.module.css"));
15
+ var _ModalModule = _interopRequireDefault(require("./Modal.module.css"));
16
16
  var _excluded = ["blur", "children", "fit", "overflow", "portal", "preventDefault", "title", "visible", "onBack", "onClose", "onOverflow"];
17
17
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
18
18
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -66,6 +66,7 @@ var Modal = function Modal(_ref) {
66
66
  return function () {
67
67
  return document.removeEventListener('keydown', handleKeydown);
68
68
  };
69
+ // eslint-disable-next-line react-hooks/exhaustive-deps
69
70
  }, [visible]);
70
71
  (0, _react.useEffect)(function () {
71
72
  if (visible && !dataset) {
@@ -92,7 +93,7 @@ var Modal = function Modal(_ref) {
92
93
  preventDefault: preventDefault,
93
94
  role: others.role ? "".concat(others.role, "-overflow") : 'modal-overflow',
94
95
  onPress: visible && overflow ? handleOverflow : undefined,
95
- className: (0, _helpers.styles)(style.container, overflow && style.overflow, overflow && blur && style.blur, visible && style.visible, onOverflow && style.onOverflow),
96
+ className: (0, _helpers.styles)(_ModalModule.default.container, overflow && _ModalModule.default.overflow, overflow && blur && _ModalModule.default.blur, visible && _ModalModule.default.visible, onOverflow && _ModalModule.default.onOverflow),
96
97
  style: {
97
98
  height: height
98
99
  },
@@ -101,10 +102,10 @@ var Modal = function Modal(_ref) {
101
102
  fit: true,
102
103
  ref: ref,
103
104
  role: others.role || 'modal',
104
- className: (0, _helpers.styles)(style.modal, !fit && style.calcWidth, visible && style.visible, others.className)
105
+ className: (0, _helpers.styles)(_ModalModule.default.modal, !fit && _ModalModule.default.calcWidth, visible && _ModalModule.default.visible, others.className)
105
106
  }), (title || onBack || onClose) && /*#__PURE__*/_react.default.createElement(_primitives.View, {
106
107
  forceRow: true,
107
- className: style.header
108
+ className: _ModalModule.default.header
108
109
  }, onBack && /*#__PURE__*/_react.default.createElement(_components.Button, {
109
110
  transparent: true,
110
111
  small: true,
@@ -113,20 +114,20 @@ var Modal = function Modal(_ref) {
113
114
  testId: testId ? "".concat(testId, "-button-back") : undefined
114
115
  }, /*#__PURE__*/_react.default.createElement(_primitives.Icon, {
115
116
  value: _primitives.ICON.LEFT,
116
- className: style.icon
117
+ className: _ModalModule.default.icon
117
118
  })), title && /*#__PURE__*/_react.default.createElement(_primitives.Text, {
118
119
  headline: true,
119
- className: (0, _helpers.styles)(style.title, !onBack && style.left, !onClose && style.right)
120
+ className: (0, _helpers.styles)(_ModalModule.default.title, !onBack && _ModalModule.default.left, !onClose && _ModalModule.default.right)
120
121
  }, title), onClose && /*#__PURE__*/_react.default.createElement(_components.Button, {
121
122
  transparent: true,
122
123
  small: true,
123
124
  squared: true,
124
125
  onPress: onClose,
125
126
  testId: testId ? "".concat(testId, "-button-close") : undefined,
126
- className: style.button
127
+ className: _ModalModule.default.button
127
128
  }, /*#__PURE__*/_react.default.createElement(_primitives.Icon, {
128
129
  value: isDesktop || title !== undefined ? _primitives.ICON.CLOSE : _primitives.ICON.EXPAND_MORE,
129
- className: style.icon
130
+ className: _ModalModule.default.icon
130
131
  }))), _react.default.Children.map(children, function (child, index) {
131
132
  return !child || child === null ? null : /*#__PURE__*/_react.default.cloneElement(child, _objectSpread(_objectSpread({
132
133
  key: child.key || index
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.js","names":["Modal","blur","children","fit","overflow","portal","preventDefault","title","visible","onBack","onClose","onOverflow","others","useDevice","isDesktop","height","ref","useRef","useState","dataset","setDataset","useEffect","handleKeydown","event","key","document","addEventListener","removeEventListener","body","miraiModal","undefined","handleOverflow","target","current","contains","renderer","IS_JEST","jsx","ReactDOM","createPortal","testId","role","styles","style","container","modal","calcWidth","className","header","ICON","LEFT","icon","left","right","button","CLOSE","EXPAND_MORE","React","Children","map","child","index","cloneElement","props","propTypes","PropTypes","bool","node","string","func"],"sources":["../../../src/components/Modal/Modal.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useEffect, useRef, useState } from 'react';\nimport ReactDOM from 'react-dom';\n\nimport { Button } from '../../components';\nimport { IS_JEST, styles } from '../../helpers';\nimport { useDevice } from '../../hooks';\nimport { Icon, ICON, Pressable, Text, View } from '../../primitives';\nimport * as style from './Modal.module.css';\n\nconst Modal = ({\n blur = false,\n children,\n fit = false,\n overflow = true,\n portal = false,\n preventDefault = true,\n title,\n visible,\n onBack,\n onClose,\n onOverflow,\n ...others\n}) => {\n const { isDesktop, height } = useDevice();\n const ref = useRef();\n\n const [dataset, setDataset] = useState();\n\n useEffect(() => {\n if (!visible || !onClose) return;\n\n const handleKeydown = (event) => event.key === 'Escape' && onClose();\n\n document.addEventListener('keydown', handleKeydown);\n return () => document.removeEventListener('keydown', handleKeydown);\n }, [visible]);\n\n useEffect(() => {\n if (visible && !dataset) {\n setDataset(true);\n document.body.dataset.miraiModal = true;\n }\n\n return () => {\n if (visible && dataset) {\n setDataset(undefined);\n delete document.body.dataset.miraiModal;\n }\n };\n }, [dataset, visible]);\n\n const handleOverflow = (event) => {\n const { target } = event;\n onOverflow && !ref.current?.contains(target) && onOverflow(event);\n };\n\n const renderer = IS_JEST || !portal ? (jsx) => jsx : ReactDOM.createPortal;\n\n const { testId } = others;\n\n return renderer(\n <Pressable\n preventDefault={preventDefault}\n role={others.role ? `${others.role}-overflow` : 'modal-overflow'}\n onPress={visible && overflow ? handleOverflow : undefined}\n className={styles(\n style.container,\n overflow && style.overflow,\n overflow && blur && style.blur,\n visible && style.visible,\n onOverflow && style.onOverflow,\n )}\n style={{ height }}\n testId={testId ? `${testId}-overflow` : undefined}\n >\n <View\n {...others}\n fit\n ref={ref}\n role={others.role || 'modal'}\n className={styles(style.modal, !fit && style.calcWidth, visible && style.visible, others.className)}\n >\n {(title || onBack || onClose) && (\n <View forceRow className={style.header}>\n {onBack && (\n <Button transparent small squared onPress={onBack} testId={testId ? `${testId}-button-back` : undefined}>\n <Icon value={ICON.LEFT} className={style.icon} />\n </Button>\n )}\n {title && (\n <Text headline className={styles(style.title, !onBack && style.left, !onClose && style.right)}>\n {title}\n </Text>\n )}\n {onClose && (\n <Button\n transparent\n small\n squared\n onPress={onClose}\n testId={testId ? `${testId}-button-close` : undefined}\n className={style.button}\n >\n <Icon value={isDesktop || title !== undefined ? ICON.CLOSE : ICON.EXPAND_MORE} className={style.icon} />\n </Button>\n )}\n </View>\n )}\n\n {React.Children.map(children, (child, index) =>\n !child || child === null\n ? null\n : React.cloneElement(child, { key: child.key || index, ...child.props, role: 'modal-content' }),\n )}\n </View>\n </Pressable>,\n document.body,\n );\n};\n\nModal.propTypes = {\n blur: PropTypes.bool,\n children: PropTypes.node,\n fit: PropTypes.bool,\n overflow: PropTypes.bool,\n portal: PropTypes.bool,\n preventDefault: PropTypes.bool,\n title: PropTypes.string,\n visible: PropTypes.bool,\n onBack: PropTypes.func,\n onClose: PropTypes.func,\n onOverflow: PropTypes.func,\n};\n\nexport { Modal };\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAA4C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAE5C,IAAMA,KAAK,GAAG,SAARA,KAAK,OAaL;EAAA,qBAZJC,IAAI;IAAJA,IAAI,0BAAG,KAAK;IACZC,QA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AK,IAAIA,KAAK,KAAK,IAAI,GACpB,IAAI,gBACJH,cAAK,CAACK,YAAY,CAACF,KAAK;MAAIpC,GAAG,EAAEoC,KAAK,CAACpC,GAAG,IAAIqC;IAAK,GAAKD,KAAK,CAACG,KAAK;MAAEtB,IAAI,EAAE;IAAe,GAAG;EAAA,EAClG,CACI,CACG,EACZhB,QAAQ,CAACG,IAAI,CACd;AACH,CAAC;AAAC;AAEF5B,KAAK,CAACgE,SAAS,GAAG;EAChB/D,IAAI,EAAEgE,kBAAS,CAACC,IAAI;EACpBhE,QAAQ,EAAE+D,kBAAS,CAACE,IAAI;EACxBhE,GAAG,EAAE8D,kBAAS,CAACC,IAAI;EACnB9D,QAAQ,EAAE6D,kBAAS,CAACC,IAAI;EACxB7D,MAAM,EAAE4D,kBAAS,CAACC,IAAI;EACtB5D,cAAc,EAAE2D,kBAAS,CAACC,IAAI;EAC9B3D,KAAK,EAAE0D,kBAAS,CAACG,MAAM;EACvB5D,OAAO,EAAEyD,kBAAS,CAACC,IAAI;EACvBzD,MAAM,EAAEwD,kBAAS,CAACI,IAAI;EACtB3D,OAAO,EAAEuD,kBAAS,CAACI,IAAI;EACvB1D,UAAU,EAAEsD,kBAAS,CAACI;AACxB,CAAC"}
1
+ {"version":3,"file":"Modal.js","names":["Modal","blur","children","fit","overflow","portal","preventDefault","title","visible","onBack","onClose","onOverflow","others","useDevice","isDesktop","height","ref","useRef","useState","dataset","setDataset","useEffect","handleKeydown","event","key","document","addEventListener","removeEventListener","body","miraiModal","undefined","handleOverflow","target","current","contains","renderer","IS_JEST","jsx","ReactDOM","createPortal","testId","role","styles","style","container","modal","calcWidth","className","header","ICON","LEFT","icon","left","right","button","CLOSE","EXPAND_MORE","React","Children","map","child","index","cloneElement","props","propTypes","PropTypes","bool","node","string","func"],"sources":["../../../src/components/Modal/Modal.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useEffect, useRef, useState } from 'react';\nimport ReactDOM from 'react-dom';\n\nimport { Button } from '../../components';\nimport { IS_JEST, styles } from '../../helpers';\nimport { useDevice } from '../../hooks';\nimport { Icon, ICON, Pressable, Text, View } from '../../primitives';\nimport style from './Modal.module.css';\n\nconst Modal = ({\n blur = false,\n children,\n fit = false,\n overflow = true,\n portal = false,\n preventDefault = true,\n title,\n visible,\n onBack,\n onClose,\n onOverflow,\n ...others\n}) => {\n const { isDesktop, height } = useDevice();\n const ref = useRef();\n\n const [dataset, setDataset] = useState();\n\n useEffect(() => {\n if (!visible || !onClose) return;\n\n const handleKeydown = (event) => event.key === 'Escape' && onClose();\n\n document.addEventListener('keydown', handleKeydown);\n return () => document.removeEventListener('keydown', handleKeydown);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [visible]);\n\n useEffect(() => {\n if (visible && !dataset) {\n setDataset(true);\n document.body.dataset.miraiModal = true;\n }\n\n return () => {\n if (visible && dataset) {\n setDataset(undefined);\n delete document.body.dataset.miraiModal;\n }\n };\n }, [dataset, visible]);\n\n const handleOverflow = (event) => {\n const { target } = event;\n onOverflow && !ref.current?.contains(target) && onOverflow(event);\n };\n\n const renderer = IS_JEST || !portal ? (jsx) => jsx : ReactDOM.createPortal;\n\n const { testId } = others;\n\n return renderer(\n <Pressable\n preventDefault={preventDefault}\n role={others.role ? `${others.role}-overflow` : 'modal-overflow'}\n onPress={visible && overflow ? handleOverflow : undefined}\n className={styles(\n style.container,\n overflow && style.overflow,\n overflow && blur && style.blur,\n visible && style.visible,\n onOverflow && style.onOverflow,\n )}\n style={{ height }}\n testId={testId ? `${testId}-overflow` : undefined}\n >\n <View\n {...others}\n fit\n ref={ref}\n role={others.role || 'modal'}\n className={styles(style.modal, !fit && style.calcWidth, visible && style.visible, others.className)}\n >\n {(title || onBack || onClose) && (\n <View forceRow className={style.header}>\n {onBack && (\n <Button transparent small squared onPress={onBack} testId={testId ? `${testId}-button-back` : undefined}>\n <Icon value={ICON.LEFT} className={style.icon} />\n </Button>\n )}\n {title && (\n <Text headline className={styles(style.title, !onBack && style.left, !onClose && style.right)}>\n {title}\n </Text>\n )}\n {onClose && (\n <Button\n transparent\n small\n squared\n onPress={onClose}\n testId={testId ? `${testId}-button-close` : undefined}\n className={style.button}\n >\n <Icon value={isDesktop || title !== undefined ? ICON.CLOSE : ICON.EXPAND_MORE} className={style.icon} />\n </Button>\n )}\n </View>\n )}\n\n {React.Children.map(children, (child, index) =>\n !child || child === null\n ? null\n : React.cloneElement(child, { key: child.key || index, ...child.props, role: 'modal-content' }),\n )}\n </View>\n </Pressable>,\n document.body,\n );\n};\n\nModal.propTypes = {\n blur: PropTypes.bool,\n children: PropTypes.node,\n fit: PropTypes.bool,\n overflow: PropTypes.bool,\n portal: PropTypes.bool,\n preventDefault: PropTypes.bool,\n title: PropTypes.string,\n visible: PropTypes.bool,\n onBack: PropTypes.func,\n onClose: PropTypes.func,\n onOverflow: PropTypes.func,\n};\n\nexport { Modal };\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAAuC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEvC,IAAMA,KAAK,GAAG,SAARA,KAAK,OAaL;EAAA,qBAZJC,IAAI;IAAJA,IAAI,0BAAG,KAAK;IACZC,QAAQ,QAARA,QAAQ;IAAA,gBACRC,GAAG;IAAHA,GAAG,yBAAG,KAAK;IAAA,qBACXC,QAAQ;IAARA,QAAQ,8BAAG,IAAI;IAAA,mBACfC,MAAM;IAANA,MAAM,4BAAG,KAAK;IAAA,2BACdC,cAAc;IAAdA,cAAc,oCAAG,IAAI;IACrBC,KAAK,QAALA,KAAK;IACLC,OAAO,QAAPA,OAAO;IACPC,MAAM,QAANA,MAAM;IACNC,OAAO,QAAPA,OAAO;IACPC,UAAU,QAAVA,UAAU;IACPC,MAAM;EAET,iBAA8B,IAAAC,gBAAS,GAAE;IAAjCC,SAAS,cAATA,SAAS;IAAEC,MAAM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E,GAAG,EAAE8D,kBAAS,CAACC,IAAI;EACnB9D,QAAQ,EAAE6D,kBAAS,CAACC,IAAI;EACxB7D,MAAM,EAAE4D,kBAAS,CAACC,IAAI;EACtB5D,cAAc,EAAE2D,kBAAS,CAACC,IAAI;EAC9B3D,KAAK,EAAE0D,kBAAS,CAACG,MAAM;EACvB5D,OAAO,EAAEyD,kBAAS,CAACC,IAAI;EACvBzD,MAAM,EAAEwD,kBAAS,CAACI,IAAI;EACtB3D,OAAO,EAAEuD,kBAAS,CAACI,IAAI;EACvB1D,UAAU,EAAEsD,kBAAS,CAACI;AACxB,CAAC"}
@@ -21,7 +21,7 @@ exports[`component:<Modal> Mobile environment prop:onClose 1`] = `
21
21
  tabindex="0"
22
22
  >
23
23
  <ui_icon
24
- class="icon headline-3 icon"
24
+ class="icon h3 icon"
25
25
  >
26
26
  <svg
27
27
  fill="currentColor"
@@ -132,7 +132,7 @@ exports[`component:<Modal> prop:onBack 1`] = `
132
132
  tabindex="0"
133
133
  >
134
134
  <ui_icon
135
- class="icon headline-3 icon"
135
+ class="icon h3 icon"
136
136
  >
137
137
  <svg
138
138
  fill="currentColor"
@@ -180,7 +180,7 @@ exports[`component:<Modal> prop:onClose 1`] = `
180
180
  tabindex="0"
181
181
  >
182
182
  <ui_icon
183
- class="icon headline-3 icon"
183
+ class="icon h3 icon"
184
184
  >
185
185
  <svg
186
186
  fill="currentColor"
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
@@ -9,10 +8,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
9
8
  var _react = _interopRequireDefault(require("react"));
10
9
  var _helpers = require("../../helpers");
11
10
  var _primitives = require("../../primitives");
12
- var style = _interopRequireWildcard(require("./Notification.module.css"));
11
+ var _NotificationModule = _interopRequireDefault(require("./Notification.module.css"));
13
12
  var _excluded = ["children", "error", "info", "inline", "large", "small", "success", "warning", "wide", "onClose"];
14
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
16
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
14
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
18
15
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
@@ -33,7 +30,7 @@ var Notification = function Notification(_ref) {
33
30
  return /*#__PURE__*/_react.default.createElement(_primitives.View, _extends({}, others, {
34
31
  row: true,
35
32
  role: others.role || 'notification',
36
- className: (0, _helpers.styles)(style.notification, error ? style.error : warning ? style.warning : success ? style.success : info ? style.info : undefined, inline ? style.inline : style.outlined, inline && style.inline, large ? style.large : small && style.small, wide && style.wide, others.className)
33
+ className: (0, _helpers.styles)(_NotificationModule.default.notification, error ? _NotificationModule.default.error : warning ? _NotificationModule.default.warning : success ? _NotificationModule.default.success : info ? _NotificationModule.default.info : undefined, inline ? _NotificationModule.default.inline : _NotificationModule.default.outlined, inline && _NotificationModule.default.inline, large ? _NotificationModule.default.large : small && _NotificationModule.default.small, wide && _NotificationModule.default.wide, others.className)
37
34
  }), /*#__PURE__*/_react.default.createElement(_primitives.Icon, {
38
35
  headline: large,
39
36
  level: large ? 1 : undefined,
@@ -43,13 +40,13 @@ var Notification = function Notification(_ref) {
43
40
  success: success,
44
41
  warning: warning
45
42
  }),
46
- className: style.icon
43
+ className: _NotificationModule.default.icon
47
44
  }), /*#__PURE__*/_react.default.createElement(_primitives.Text, {
48
45
  small: small,
49
- className: (0, _helpers.styles)(style.text, error ? style.error : warning ? style.warning : success ? style.success : undefined)
46
+ className: (0, _helpers.styles)(_NotificationModule.default.text, error ? _NotificationModule.default.error : warning ? _NotificationModule.default.warning : success ? _NotificationModule.default.success : undefined)
50
47
  }, children), !large && onClose && /*#__PURE__*/_react.default.createElement(_primitives.Pressable, {
51
48
  onPress: onClose,
52
- className: (0, _helpers.styles)(style.pressable, style.icon),
49
+ className: (0, _helpers.styles)(_NotificationModule.default.pressable, _NotificationModule.default.icon),
53
50
  testId: others.testId ? "".concat(others.testId, "-button-close") : undefined
54
51
  }, /*#__PURE__*/_react.default.createElement(_primitives.Icon, {
55
52
  value: _primitives.ICON.CLOSE,
@@ -1 +1 @@
1
- {"version":3,"file":"Notification.js","names":["Notification","children","error","info","inline","large","small","success","warning","wide","onClose","others","role","styles","style","notification","undefined","outlined","className","getIconState","icon","text","pressable","testId","ICON","CLOSE","displayName","propTypes","PropTypes","any","isRequired","bool","func"],"sources":["../../../src/components/Notification/Notification.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { getIconState, styles } from '../../helpers';\nimport { Icon, ICON, Pressable, Text, View } from '../../primitives';\nimport * as style from './Notification.module.css';\n\nconst Notification = ({\n children,\n error,\n info,\n inline = false,\n large,\n small,\n success,\n warning,\n wide,\n onClose,\n ...others\n}) => (\n <View\n {...others}\n row\n role={others.role || 'notification'}\n className={styles(\n style.notification,\n error ? style.error : warning ? style.warning : success ? style.success : info ? style.info : undefined,\n inline ? style.inline : style.outlined,\n inline && style.inline,\n large ? style.large : small && style.small,\n wide && style.wide,\n others.className,\n )}\n >\n <Icon\n headline={large}\n level={large ? 1 : undefined}\n paragraph={small}\n value={getIconState({ error, success, warning })}\n className={style.icon}\n />\n <Text\n small={small}\n className={styles(\n style.text,\n error ? style.error : warning ? style.warning : success ? style.success : undefined,\n )}\n >\n {children}\n </Text>\n {!large && onClose && (\n <Pressable\n onPress={onClose}\n className={styles(style.pressable, style.icon)}\n testId={others.testId ? `${others.testId}-button-close` : undefined}\n >\n <Icon value={ICON.CLOSE} paragraph={small} />\n </Pressable>\n )}\n </View>\n);\n\nNotification.displayName = 'Component:Notification';\n\nNotification.propTypes = {\n children: PropTypes.any.isRequired,\n error: PropTypes.bool,\n info: PropTypes.bool,\n inline: PropTypes.bool,\n large: PropTypes.bool,\n small: PropTypes.bool,\n success: PropTypes.bool,\n warning: PropTypes.bool,\n wide: PropTypes.bool,\n onClose: PropTypes.func,\n};\n\nexport { Notification };\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AACA;AACA;AAAmD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEnD,IAAMA,YAAY,GAAG,SAAfA,YAAY;EA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M,EACfC,KAAK,CAACO,IAAI,EACVnB,KAAK,GAAGY,KAAK,CAACZ,KAAK,GAAGM,OAAO,GAAGM,KAAK,CAACN,OAAO,GAAGD,OAAO,GAAGO,KAAK,CAACP,OAAO,GAAGS,SAAS;EACnF,GAEDf,QAAQ,CACJ,EACN,CAACI,KAAK,IAAIK,OAAO,iBAChB,6BAAC,qBAAS;IACR,OAAO,EAAEA,OAAQ;IACjB,SAAS,EAAE,IAAAG,eAAM,EAACC,KAAK,CAACQ,SAAS,EAAER,KAAK,CAACM,IAAI,CAAE;IAC/C,MAAM,EAAET,MAAM,CAACY,MAAM,aAAMZ,MAAM,CAACY,MAAM,qBAAkBP;EAAU,gBAEpE,6BAAC,gBAAI;IAAC,KAAK,EAAEQ,gBAAI,CAACC,KAAM;IAAC,SAAS,EAAEnB;EAAM,EAAG,CAEhD,CACI;AAAA,CACR;AAAC;AAEFN,YAAY,CAAC0B,WAAW,GAAG,wBAAwB;AAEnD1B,YAAY,CAAC2B,SAAS,GAAG;EACvB1B,QAAQ,EAAE2B,kBAAS,CAACC,GAAG,CAACC,UAAU;EAClC5B,KAAK,EAAE0B,kBAAS,CAACG,IAAI;EACrB5B,IAAI,EAAEyB,kBAAS,CAACG,IAAI;EACpB3B,MAAM,EAAEwB,kBAAS,CAACG,IAAI;EACtB1B,KAAK,EAAEuB,kBAAS,CAACG,IAAI;EACrBzB,KAAK,EAAEsB,kBAAS,CAACG,IAAI;EACrBxB,OAAO,EAAEqB,kBAAS,CAACG,IAAI;EACvBvB,OAAO,EAAEoB,kBAAS,CAACG,IAAI;EACvBtB,IAAI,EAAEmB,kBAAS,CAACG,IAAI;EACpBrB,OAAO,EAAEkB,kBAAS,CAACI;AACrB,CAAC"}
1
+ {"version":3,"file":"Notification.js","names":["Notification","children","error","info","inline","large","small","success","warning","wide","onClose","others","role","styles","style","notification","undefined","outlined","className","getIconState","icon","text","pressable","testId","ICON","CLOSE","displayName","propTypes","PropTypes","any","isRequired","bool","func"],"sources":["../../../src/components/Notification/Notification.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { getIconState, styles } from '../../helpers';\nimport { Icon, ICON, Pressable, Text, View } from '../../primitives';\nimport style from './Notification.module.css';\n\nconst Notification = ({\n children,\n error,\n info,\n inline = false,\n large,\n small,\n success,\n warning,\n wide,\n onClose,\n ...others\n}) => (\n <View\n {...others}\n row\n role={others.role || 'notification'}\n className={styles(\n style.notification,\n error ? style.error : warning ? style.warning : success ? style.success : info ? style.info : undefined,\n inline ? style.inline : style.outlined,\n inline && style.inline,\n large ? style.large : small && style.small,\n wide && style.wide,\n others.className,\n )}\n >\n <Icon\n headline={large}\n level={large ? 1 : undefined}\n paragraph={small}\n value={getIconState({ error, success, warning })}\n className={style.icon}\n />\n <Text\n small={small}\n className={styles(\n style.text,\n error ? style.error : warning ? style.warning : success ? style.success : undefined,\n )}\n >\n {children}\n </Text>\n {!large && onClose && (\n <Pressable\n onPress={onClose}\n className={styles(style.pressable, style.icon)}\n testId={others.testId ? `${others.testId}-button-close` : undefined}\n >\n <Icon value={ICON.CLOSE} paragraph={small} />\n </Pressable>\n )}\n </View>\n);\n\nNotification.displayName = 'Component:Notification';\n\nNotification.propTypes = {\n children: PropTypes.any.isRequired,\n error: PropTypes.bool,\n info: PropTypes.bool,\n inline: PropTypes.bool,\n large: PropTypes.bool,\n small: PropTypes.bool,\n success: PropTypes.bool,\n warning: PropTypes.bool,\n wide: PropTypes.bool,\n onClose: PropTypes.func,\n};\n\nexport { Notification };\n"],"mappings":";;;;;;AAAA;AACA;AAEA;AACA;AACA;AAA8C;AAAA;AAAA;AAAA;AAAA;AAE9C,IAAMA,YAAY,GAAG,SAAfA,YAAY;EAAA,IAChBC,QAAQ,QAARA,QAAQ;IACRC,KAAK,QAALA,KAAK;IACLC,IAAI,QAAJA,IAAI;IAAA,mBACJC,MAAM;IAANA,MAAM,4BAAG,KAAK;IACdC,KAAK,QAALA,KAAK;IACLC,KAAK,QAALA,KAAK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AS;EACnF,GAEDf,QAAQ,CACJ,EACN,CAACI,KAAK,IAAIK,OAAO,iBAChB,6BAAC,qBAAS;IACR,OAAO,EAAEA,OAAQ;IACjB,SAAS,EAAE,IAAAG,eAAM,EAACC,2BAAK,CAACQ,SAAS,EAAER,2BAAK,CAACM,IAAI,CAAE;IAC/C,MAAM,EAAET,MAAM,CAACY,MAAM,aAAMZ,MAAM,CAACY,MAAM,qBAAkBP;EAAU,gBAEpE,6BAAC,gBAAI;IAAC,KAAK,EAAEQ,gBAAI,CAACC,KAAM;IAAC,SAAS,EAAEnB;EAAM,EAAG,CAEhD,CACI;AAAA,CACR;AAAC;AAEFN,YAAY,CAAC0B,WAAW,GAAG,wBAAwB;AAEnD1B,YAAY,CAAC2B,SAAS,GAAG;EACvB1B,QAAQ,EAAE2B,kBAAS,CAACC,GAAG,CAACC,UAAU;EAClC5B,KAAK,EAAE0B,kBAAS,CAACG,IAAI;EACrB5B,IAAI,EAAEyB,kBAAS,CAACG,IAAI;EACpB3B,MAAM,EAAEwB,kBAAS,CAACG,IAAI;EACtB1B,KAAK,EAAEuB,kBAAS,CAACG,IAAI;EACrBzB,KAAK,EAAEsB,kBAAS,CAACG,IAAI;EACrBxB,OAAO,EAAEqB,kBAAS,CAACG,IAAI;EACvBvB,OAAO,EAAEoB,kBAAS,CAACG,IAAI;EACvBtB,IAAI,EAAEmB,kBAAS,CAACG,IAAI;EACpBrB,OAAO,EAAEkB,kBAAS,CAACI;AACrB,CAAC"}
@@ -6,7 +6,7 @@ exports[`component:<Notification> inherit:className 1`] = `
6
6
  class="view row notification outlined mirai"
7
7
  >
8
8
  <ui_icon
9
- class="icon headline-3 icon"
9
+ class="icon h3 icon"
10
10
  >
11
11
  <svg
12
12
  fill="currentColor"
@@ -41,7 +41,7 @@ exports[`component:<Notification> prop:error 1`] = `
41
41
  class="view row notification error outlined"
42
42
  >
43
43
  <ui_icon
44
- class="icon headline-3 icon"
44
+ class="icon h3 icon"
45
45
  >
46
46
  <svg
47
47
  fill="currentColor"
@@ -76,7 +76,7 @@ exports[`component:<Notification> prop:info & inline 1`] = `
76
76
  class="view row notification info inline inline"
77
77
  >
78
78
  <ui_icon
79
- class="icon headline-3 icon"
79
+ class="icon h3 icon"
80
80
  >
81
81
  <svg
82
82
  fill="currentColor"
@@ -111,7 +111,7 @@ exports[`component:<Notification> prop:info & large 1`] = `
111
111
  class="view row notification info outlined large"
112
112
  >
113
113
  <ui_icon
114
- class="icon headline-1 icon"
114
+ class="icon h1 icon"
115
115
  >
116
116
  <svg
117
117
  fill="currentColor"
@@ -181,7 +181,7 @@ exports[`component:<Notification> prop:info 1`] = `
181
181
  class="view row notification info outlined"
182
182
  >
183
183
  <ui_icon
184
- class="icon headline-3 icon"
184
+ class="icon h3 icon"
185
185
  >
186
186
  <svg
187
187
  fill="currentColor"
@@ -216,7 +216,7 @@ exports[`component:<Notification> prop:inline 1`] = `
216
216
  class="view row notification inline inline"
217
217
  >
218
218
  <ui_icon
219
- class="icon headline-3 icon"
219
+ class="icon h3 icon"
220
220
  >
221
221
  <svg
222
222
  fill="currentColor"
@@ -251,7 +251,7 @@ exports[`component:<Notification> prop:large & prop:inline 1`] = `
251
251
  class="view row notification inline inline large"
252
252
  >
253
253
  <ui_icon
254
- class="icon headline-1 icon"
254
+ class="icon h1 icon"
255
255
  >
256
256
  <svg
257
257
  fill="currentColor"
@@ -286,7 +286,7 @@ exports[`component:<Notification> prop:large 1`] = `
286
286
  class="view row notification outlined large"
287
287
  >
288
288
  <ui_icon
289
- class="icon headline-1 icon"
289
+ class="icon h1 icon"
290
290
  >
291
291
  <svg
292
292
  fill="currentColor"
@@ -322,7 +322,7 @@ exports[`component:<Notification> prop:onClose 1`] = `
322
322
  data-testid="mirai-onClose"
323
323
  >
324
324
  <ui_icon
325
- class="icon headline-3 icon"
325
+ class="icon h3 icon"
326
326
  >
327
327
  <svg
328
328
  fill="currentColor"
@@ -353,7 +353,7 @@ exports[`component:<Notification> prop:onClose 1`] = `
353
353
  tabindex="0"
354
354
  >
355
355
  <ui_icon
356
- class="icon headline-3"
356
+ class="icon h3"
357
357
  >
358
358
  <svg
359
359
  fill="currentColor"
@@ -454,7 +454,7 @@ exports[`component:<Notification> prop:success & inline 1`] = `
454
454
  class="view row notification success inline inline"
455
455
  >
456
456
  <ui_icon
457
- class="icon headline-3 icon"
457
+ class="icon h3 icon"
458
458
  >
459
459
  <svg
460
460
  fill="currentColor"
@@ -489,7 +489,7 @@ exports[`component:<Notification> prop:success & large 1`] = `
489
489
  class="view row notification success outlined large"
490
490
  >
491
491
  <ui_icon
492
- class="icon headline-1 icon"
492
+ class="icon h1 icon"
493
493
  >
494
494
  <svg
495
495
  fill="currentColor"
@@ -559,7 +559,7 @@ exports[`component:<Notification> prop:success 1`] = `
559
559
  class="view row notification success outlined"
560
560
  >
561
561
  <ui_icon
562
- class="icon headline-3 icon"
562
+ class="icon h3 icon"
563
563
  >
564
564
  <svg
565
565
  fill="currentColor"
@@ -594,7 +594,7 @@ exports[`component:<Notification> prop:warning & inline 1`] = `
594
594
  class="view row notification warning inline inline"
595
595
  >
596
596
  <ui_icon
597
- class="icon headline-3 icon"
597
+ class="icon h3 icon"
598
598
  >
599
599
  <svg
600
600
  fill="currentColor"
@@ -625,7 +625,7 @@ exports[`component:<Notification> prop:warning & large 1`] = `
625
625
  class="view row notification warning outlined large"
626
626
  >
627
627
  <ui_icon
628
- class="icon headline-1 icon"
628
+ class="icon h1 icon"
629
629
  >
630
630
  <svg
631
631
  fill="currentColor"
@@ -687,7 +687,7 @@ exports[`component:<Notification> prop:warning 1`] = `
687
687
  class="view row notification warning outlined"
688
688
  >
689
689
  <ui_icon
690
- class="icon headline-3 icon"
690
+ class="icon h3 icon"
691
691
  >
692
692
  <svg
693
693
  fill="currentColor"
@@ -718,7 +718,7 @@ exports[`component:<Notification> prop:wide 1`] = `
718
718
  class="view row notification outlined wide"
719
719
  >
720
720
  <ui_icon
721
- class="icon headline-3 icon"
721
+ class="icon h3 icon"
722
722
  >
723
723
  <svg
724
724
  fill="currentColor"
@@ -753,7 +753,7 @@ exports[`component:<Notification> renders 1`] = `
753
753
  class="view row notification outlined"
754
754
  >
755
755
  <ui_icon
756
- class="icon headline-3 icon"
756
+ class="icon h3 icon"
757
757
  >
758
758
  <svg
759
759
  fill="currentColor"
@@ -789,7 +789,7 @@ exports[`component:<Notification> testId 1`] = `
789
789
  data-testid="mirai"
790
790
  >
791
791
  <ui_icon
792
- class="icon headline-3 icon"
792
+ class="icon h3 icon"
793
793
  >
794
794
  <svg
795
795
  fill="currentColor"
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
@@ -9,10 +8,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
9
8
  var _react = _interopRequireDefault(require("react"));
10
9
  var _helpers = require("../../helpers");
11
10
  var _primitives = require("../../primitives");
12
- var style = _interopRequireWildcard(require("./Progress.module.css"));
11
+ var _ProgressModule = _interopRequireDefault(require("./Progress.module.css"));
13
12
  var _excluded = ["indeterminate", "value", "visible"];
14
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
16
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
14
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
18
15
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
@@ -27,9 +24,9 @@ var Progress = function Progress(_ref) {
27
24
  others = _objectWithoutProperties(_ref, _excluded);
28
25
  return /*#__PURE__*/_react.default.createElement(_primitives.View, _extends({}, others, {
29
26
  role: others.role || 'progress',
30
- className: (0, _helpers.styles)(style.progress, visible && style.visible, others.className)
27
+ className: (0, _helpers.styles)(_ProgressModule.default.progress, visible && _ProgressModule.default.visible, others.className)
31
28
  }), /*#__PURE__*/_react.default.createElement(_primitives.View, {
32
- className: (0, _helpers.styles)(style.value, indeterminate && style.indeterminate),
29
+ className: (0, _helpers.styles)(_ProgressModule.default.value, indeterminate && _ProgressModule.default.indeterminate),
33
30
  style: !indeterminate ? {
34
31
  width: "".concat(value, "%")
35
32
  } : undefined
@@ -1 +1 @@
1
- {"version":3,"file":"Progress.js","names":["Progress","indeterminate","value","visible","others","role","styles","style","progress","className","width","undefined","propTypes","PropTypes","bool","number"],"sources":["../../../src/components/Progress/Progress.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport { View } from '../../primitives';\nimport * as style from './Progress.module.css';\n\nconst Progress = ({ indeterminate = false, value = 0, visible = false, ...others }) => (\n <View\n {...others}\n role={others.role || 'progress'}\n className={styles(style.progress, visible && style.visible, others.className)}\n >\n <View\n className={styles(style.value, indeterminate && style.indeterminate)}\n style={!indeterminate ? { width: `${value}%` } : undefined}\n />\n </View>\n);\n\nProgress.propTypes = {\n indeterminate: PropTypes.bool,\n value: PropTypes.number,\n visible: PropTypes.bool,\n};\n\nexport { Progress };\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AACA;AACA;AAA+C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAE/C,IAAMA,QAAQ,GAAG,SAAXA,QAAQ;EAAA,8BAAMC,aAAa;IAAbA,aAAa,mCAAG,KAAK;IAAA,kBAAEC,KAAK;IAALA,KAAK,2BAAG,CAAC;IAAA,oBAAEC,OAAO;IAAPA,OAAO,6BAAG,KAAK;IAAKC,MAAM;EAAA,oBAC9E,6BAAC,gBAAI,eACCA,MAAM;IACV,IAAI,EAAEA,MAAM,CAACC,IAAI,IAAI,UAAW;IAChC,SAAS,EAAE,IAAAC,eAAM,EAACC,KAAK,CAACC,QAAQ,EAAEL,OAAO,IAAII,KAAK,CAACJ,OAAO,EAAEC,MAAM,CAACK,SAAS;EAAE,iBAE9E,6BAAC,gBAAI;IACH,SAAS,EAAE,IAAAH,eAAM,EAACC,KAAK,CAACL,KAAK,EAAED,aAAa,IAAIM,KAAK,CAACN,aAAa,CAAE;IACrE,KAAK,EAAE,CAACA,aAAa,GAAG;MAAES,KAAK,YAAKR,KAAK;IAAI,CAAC,GAAGS;EAAU,EAC3D,CACG;AAAA,CACR;AAAC;AAEFX,QAAQ,CAACY,SAAS,GAAG;EACnBX,aAAa,EAAEY,kBAAS,CAACC,IAAI;EAC7BZ,KAAK,EAAEW,kBAAS,CAACE,MAAM;EACvBZ,OAAO,EAAEU,kBAAS,CAACC;AACrB,CAAC"}
1
+ {"version":3,"file":"Progress.js","names":["Progress","indeterminate","value","visible","others","role","styles","style","progress","className","width","undefined","propTypes","PropTypes","bool","number"],"sources":["../../../src/components/Progress/Progress.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport { View } from '../../primitives';\nimport style from './Progress.module.css';\n\nconst Progress = ({ indeterminate = false, value = 0, visible = false, ...others }) => (\n <View\n {...others}\n role={others.role || 'progress'}\n className={styles(style.progress, visible && style.visible, others.className)}\n >\n <View\n className={styles(style.value, indeterminate && style.indeterminate)}\n style={!indeterminate ? { width: `${value}%` } : undefined}\n />\n </View>\n);\n\nProgress.propTypes = {\n indeterminate: PropTypes.bool,\n value: PropTypes.number,\n visible: PropTypes.bool,\n};\n\nexport { Progress };\n"],"mappings":";;;;;;AAAA;AACA;AAEA;AACA;AACA;AAA0C;AAAA;AAAA;AAAA;AAAA;AAE1C,IAAMA,QAAQ,GAAG,SAAXA,QAAQ;EAAA,8BAAMC,aAAa;IAAbA,aAAa,mCAAG,KAAK;IAAA,kBAAEC,KAAK;IAALA,KAAK,2BAAG,CAAC;IAAA,oBAAEC,OAAO;IAAPA,OAAO,6BAAG,KAAK;IAAKC,MAAM;EAAA,oBAC9E,6BAAC,gBAAI,eACCA,MAAM;IACV,IAAI,EAAEA,MAAM,CAACC,IAAI,IAAI,UAAW;IAChC,SAAS,EAAE,IAAAC,eAAM,EAACC,uBAAK,CAACC,QAAQ,EAAEL,OAAO,IAAII,uBAAK,CAACJ,OAAO,EAAEC,MAAM,CAACK,SAAS;EAAE,iBAE9E,6BAAC,gBAAI;IACH,SAAS,EAAE,IAAAH,eAAM,EAACC,uBAAK,CAACL,KAAK,EAAED,aAAa,IAAIM,uBAAK,CAACN,aAAa,CAAE;IACrE,KAAK,EAAE,CAACA,aAAa,GAAG;MAAES,KAAK,YAAKR,KAAK;IAAI,CAAC,GAAGS;EAAU,EAC3D,CACG;AAAA,CACR;AAAC;AAEFX,QAAQ,CAACY,SAAS,GAAG;EACnBX,aAAa,EAAEY,kBAAS,CAACC,IAAI;EAC7BZ,KAAK,EAAEW,kBAAS,CAACE,MAAM;EACvBZ,OAAO,EAAEU,kBAAS,CAACC;AACrB,CAAC"}
@@ -12,7 +12,7 @@ var _hooks = require("../../hooks");
12
12
  var _primitives = require("../../primitives");
13
13
  var _helpers2 = require("./helpers");
14
14
  var _Slider = require("./Slider.constants");
15
- var style = _interopRequireWildcard(require("./Slider.module.css"));
15
+ var _SliderModule = _interopRequireDefault(require("./Slider.module.css"));
16
16
  var _excluded = ["auto", "captions", "fullScreen", "height", "images", "index", "thumbnails", "width", "onChange", "onFullScreen"];
17
17
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
18
18
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -109,7 +109,7 @@ var Slider = function Slider(_ref) {
109
109
  onMouseLeave: isDesktop ? function () {
110
110
  return setFocus(false);
111
111
  } : undefined,
112
- className: (0, _helpers.styles)(style.container, fullScreen && style.fullScreen, others.className),
112
+ className: (0, _helpers.styles)(_SliderModule.default.container, fullScreen && _SliderModule.default.fullScreen, others.className),
113
113
  style: _objectSpread(_objectSpread({}, !fullScreen ? others.style : undefined), {}, {
114
114
  width: fullScreen ? screenWidth : width
115
115
  })
@@ -117,7 +117,7 @@ var Slider = function Slider(_ref) {
117
117
  onPress: function onPress() {
118
118
  return setIndex(index - 1);
119
119
  },
120
- className: (0, _helpers.styles)(style.button, (index <= 0 || isDesktop && !focus) && style.hide, style.back)
120
+ className: (0, _helpers.styles)(_SliderModule.default.button, (index <= 0 || isDesktop && !focus) && _SliderModule.default.hide, _SliderModule.default.back)
121
121
  }, /*#__PURE__*/_react.default.createElement(_primitives.Icon, {
122
122
  value: _primitives.ICON.LEFT
123
123
  })), /*#__PURE__*/_react.default.createElement(_primitives.ScrollView, {
@@ -126,47 +126,47 @@ var Slider = function Slider(_ref) {
126
126
  snap: true,
127
127
  width: width,
128
128
  onScroll: handleScroll,
129
- className: style.scrollView
129
+ className: _SliderModule.default.scrollView
130
130
  }, images.map(function (image, imageIndex) {
131
131
  return /*#__PURE__*/_react.default.createElement(_primitives.View, {
132
132
  key: imageIndex,
133
- className: style.item
133
+ className: _SliderModule.default.item
134
134
  }, /*#__PURE__*/_react.default.createElement(_primitives.View, {
135
135
  role: "image",
136
136
  onClick: function onClick() {
137
137
  return setFullScreen(!fullScreen);
138
138
  },
139
- className: style.image,
139
+ className: _SliderModule.default.image,
140
140
  style: {
141
141
  backgroundImage: fullScreen || imageIndex >= index - _Slider.PRELOAD_IMAGES && imageIndex <= index + _Slider.PRELOAD_IMAGES ? "url(".concat(image, ")") : undefined,
142
142
  height: height,
143
143
  width: width
144
144
  }
145
145
  }), captions[imageIndex] && /*#__PURE__*/_react.default.createElement(_primitives.View, {
146
- className: style.caption
146
+ className: _SliderModule.default.caption
147
147
  }, /*#__PURE__*/_react.default.createElement(_primitives.Text, {
148
148
  bold: true,
149
149
  small: true,
150
- className: style.text
150
+ className: _SliderModule.default.text
151
151
  }, captions[imageIndex])));
152
152
  })), !fullScreen && /*#__PURE__*/_react.default.createElement(_primitives.Pressable, {
153
153
  onPress: function onPress() {
154
154
  return setIndex(index + 1);
155
155
  },
156
- className: (0, _helpers.styles)(style.button, (index >= images.length - 1 || isDesktop && !focus) && style.hide && style.hide, style.forward)
156
+ className: (0, _helpers.styles)(_SliderModule.default.button, (index >= images.length - 1 || isDesktop && !focus) && _SliderModule.default.hide && _SliderModule.default.hide, _SliderModule.default.forward)
157
157
  }, /*#__PURE__*/_react.default.createElement(_primitives.Icon, {
158
158
  value: _primitives.ICON.RIGHT
159
159
  })), fullScreen && /*#__PURE__*/_react.default.createElement(_primitives.ScrollView, {
160
160
  horizontal: true,
161
161
  snap: true,
162
- className: style.thumbnails
162
+ className: _SliderModule.default.thumbnails
163
163
  }, images.map(function (image, imageIndex) {
164
164
  return /*#__PURE__*/_react.default.createElement(_primitives.Pressable, {
165
165
  key: imageIndex,
166
166
  onPress: function onPress() {
167
167
  return setIndex(imageIndex);
168
168
  },
169
- className: (0, _helpers.styles)(style.thumbnail, index === imageIndex && style.active),
169
+ className: (0, _helpers.styles)(_SliderModule.default.thumbnail, index === imageIndex && _SliderModule.default.active),
170
170
  style: {
171
171
  backgroundImage: "url(".concat(thumbnails[imageIndex] || image, ")")
172
172
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Slider.js","names":["interval","timeout","Slider","auto","captions","fullScreen","propFullScreen","height","propHeight","images","index","propIndex","thumbnails","width","propWidth","onChange","onFullScreen","others","useDevice","screenHeight","isDesktop","isLandscape","screenWidth","useState","focus","setFocus","setFullScreen","setIndex","useEffect","setInterval","length","clearInterval","handleScroll","x","clearTimeout","setTimeout","Math","round","getMotionExpand","undefined","styles","style","container","className","button","hide","back","ICON","LEFT","floor","scrollView","map","image","imageIndex","item","backgroundImage","PRELOAD_IMAGES","caption","text","forward","RIGHT","thumbnail","active","displayName","propTypes","PropTypes","bool","arrayOf","string","number","isRequired","func"],"sources":["../../../src/components/Slider/Slider.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useEffect, useState } from 'react';\n\nimport { styles } from '../../helpers';\nimport { useDevice } from '../../hooks';\nimport { Icon, ICON, ScrollView, Pressable, Text, View } from '../../primitives';\nimport { getMotionExpand } from './helpers';\nimport { PRELOAD_IMAGES } from './Slider.constants';\nimport * as style from './Slider.module.css';\n\nlet interval;\nlet timeout;\n\nconst Slider = ({\n auto = false,\n captions = [],\n fullScreen: propFullScreen = false,\n height: propHeight = 240,\n images = [],\n index: propIndex = 0,\n thumbnails = [],\n width: propWidth = 320,\n onChange = () => {},\n onFullScreen = () => {},\n ...others\n}) => {\n const { height: screenHeight, isDesktop, isLandscape, width: screenWidth } = useDevice();\n\n const [focus, setFocus] = useState(false);\n const [fullScreen, setFullScreen] = useState(propFullScreen);\n const [index, setIndex] = useState(propIndex);\n\n useEffect(() => {\n if (auto) interval = setInterval(() => setIndex(index < images.length - 1 ? index + 1 : 0), 2000);\n return () => clearInterval(interval);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [auto, index]);\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => onChange(index), [index]);\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => onFullScreen(fullScreen), [fullScreen]);\n\n const height = fullScreen ? screenHeight * (isLandscape ? 0.9 : 0.4) : propHeight;\n\n const width = fullScreen ? screenWidth * (isLandscape ? 0.85 : 0.9) : propWidth;\n\n const handleScroll = ({ x } = {}) => {\n clearTimeout(timeout);\n timeout = setTimeout(() => {\n setIndex(x < width ? 0 : Math.round(x / width));\n }, getMotionExpand());\n };\n\n return (\n <View\n {...others}\n role=\"slider\"\n onMouseEnter={isDesktop ? () => setFocus(true) : undefined}\n onMouseLeave={isDesktop ? () => setFocus(false) : undefined}\n className={styles(style.container, fullScreen && style.fullScreen, others.className)}\n style={{ ...(!fullScreen ? others.style : undefined), width: fullScreen ? screenWidth : width }}\n >\n {!fullScreen && (\n <Pressable\n onPress={() => setIndex(index - 1)}\n className={styles(style.button, (index <= 0 || (isDesktop && !focus)) && style.hide, style.back)}\n >\n <Icon value={ICON.LEFT} />\n </Pressable>\n )}\n\n <ScrollView\n horizontal\n scrollTo={index * Math.floor(width)}\n snap\n width={width}\n onScroll={handleScroll}\n className={style.scrollView}\n >\n {images.map((image, imageIndex) => (\n <View key={imageIndex} className={style.item}>\n <View\n role=\"image\"\n onClick={() => setFullScreen(!fullScreen)}\n className={style.image}\n style={{\n backgroundImage:\n fullScreen || (imageIndex >= index - PRELOAD_IMAGES && imageIndex <= index + PRELOAD_IMAGES)\n ? `url(${image})`\n : undefined,\n height,\n width,\n }}\n />\n {captions[imageIndex] && (\n <View className={style.caption}>\n <Text bold small className={style.text}>\n {captions[imageIndex]}\n </Text>\n </View>\n )}\n </View>\n ))}\n </ScrollView>\n\n {!fullScreen && (\n <Pressable\n onPress={() => setIndex(index + 1)}\n className={styles(\n style.button,\n (index >= images.length - 1 || (isDesktop && !focus)) && style.hide && style.hide,\n style.forward,\n )}\n >\n <Icon value={ICON.RIGHT} />\n </Pressable>\n )}\n\n {fullScreen && (\n <ScrollView horizontal snap className={style.thumbnails}>\n {images.map((image, imageIndex) => (\n <Pressable\n key={imageIndex}\n onPress={() => setIndex(imageIndex)}\n className={styles(style.thumbnail, index === imageIndex && style.active)}\n style={{ backgroundImage: `url(${thumbnails[imageIndex] || image})` }}\n />\n ))}\n </ScrollView>\n )}\n </View>\n );\n};\n\nSlider.displayName = 'Component:Slider';\n\nSlider.propTypes = {\n auto: PropTypes.bool,\n captions: PropTypes.arrayOf(PropTypes.string),\n fullScreen: PropTypes.bool,\n height: PropTypes.number.isRequired,\n images: PropTypes.arrayOf(PropTypes.string).isRequired,\n index: PropTypes.number,\n thumbnails: PropTypes.arrayOf(PropTypes.string),\n width: PropTypes.number.isRequired,\n onChange: PropT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,KAAK,CAACoB,SAAS,EAAEnD,KAAK,KAAK2C,UAAU,IAAIZ,KAAK,CAACqB,MAAM,CAAE;MACzE,KAAK,EAAE;QAAEP,eAAe,gBAAS3C,UAAU,CAACyC,UAAU,CAAC,IAAID,KAAK;MAAI;IAAE,EACtE;EAAA,CACH,CAAC,CAEL,CACI;AAEX,CAAC;AAAC;AAEFlD,MAAM,CAAC6D,WAAW,GAAG,kBAAkB;AAEvC7D,MAAM,CAAC8D,SAAS,GAAG;EACjB7D,IAAI,EAAE8D,kBAAS,CAACC,IAAI;EACpB9D,QAAQ,EAAE6D,kBAAS,CAACE,OAAO,CAACF,kBAAS,CAACG,MAAM,CAAC;EAC7C/D,UAAU,EAAE4D,kBAAS,CAACC,IAAI;EAC1B3D,MAAM,EAAE0D,kBAAS,CAACI,MAAM,CAACC,UAAU;EACnC7D,MAAM,EAAEwD,kBAAS,CAACE,OAAO,CAACF,kBAAS,CAACG,MAAM,CAAC,CAACE,UAAU;EACtD5D,KAAK,EAAEuD,kBAAS,CAACI,MAAM;EACvBzD,UAAU,EAAEqD,kBAAS,CAACE,OAAO,CAACF,kBAAS,CAACG,MAAM,CAAC;EAC/CvD,KAAK,EAAEoD,kBAAS,CAACI,MAAM,CAACC,UAAU;EAClCvD,QAAQ,EAAEkD,kBAAS,CAACM,IAAI;EACxBvD,YAAY,EAAEiD,kBAAS,CAACM;AAC1B,CAAC"}
1
+ {"version":3,"file":"Slider.js","names":["interval","timeout","Slider","auto","captions","fullScreen","propFullScreen","height","propHeight","images","index","propIndex","thumbnails","width","propWidth","onChange","onFullScreen","others","useDevice","screenHeight","isDesktop","isLandscape","screenWidth","useState","focus","setFocus","setFullScreen","setIndex","useEffect","setInterval","length","clearInterval","handleScroll","x","clearTimeout","setTimeout","Math","round","getMotionExpand","undefined","styles","style","container","className","button","hide","back","ICON","LEFT","floor","scrollView","map","image","imageIndex","item","backgroundImage","PRELOAD_IMAGES","caption","text","forward","RIGHT","thumbnail","active","displayName","propTypes","PropTypes","bool","arrayOf","string","number","isRequired","func"],"sources":["../../../src/components/Slider/Slider.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useEffect, useState } from 'react';\n\nimport { styles } from '../../helpers';\nimport { useDevice } from '../../hooks';\nimport { Icon, ICON, ScrollView, Pressable, Text, View } from '../../primitives';\nimport { getMotionExpand } from './helpers';\nimport { PRELOAD_IMAGES } from './Slider.constants';\nimport style from './Slider.module.css';\n\nlet interval;\nlet timeout;\n\nconst Slider = ({\n auto = false,\n captions = [],\n fullScreen: propFullScreen = false,\n height: propHeight = 240,\n images = [],\n index: propIndex = 0,\n thumbnails = [],\n width: propWidth = 320,\n onChange = () => {},\n onFullScreen = () => {},\n ...others\n}) => {\n const { height: screenHeight, isDesktop, isLandscape, width: screenWidth } = useDevice();\n\n const [focus, setFocus] = useState(false);\n const [fullScreen, setFullScreen] = useState(propFullScreen);\n const [index, setIndex] = useState(propIndex);\n\n useEffect(() => {\n if (auto) interval = setInterval(() => setIndex(index < images.length - 1 ? index + 1 : 0), 2000);\n return () => clearInterval(interval);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [auto, index]);\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => onChange(index), [index]);\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => onFullScreen(fullScreen), [fullScreen]);\n\n const height = fullScreen ? screenHeight * (isLandscape ? 0.9 : 0.4) : propHeight;\n\n const width = fullScreen ? screenWidth * (isLandscape ? 0.85 : 0.9) : propWidth;\n\n const handleScroll = ({ x } = {}) => {\n clearTimeout(timeout);\n timeout = setTimeout(() => {\n setIndex(x < width ? 0 : Math.round(x / width));\n }, getMotionExpand());\n };\n\n return (\n <View\n {...others}\n role=\"slider\"\n onMouseEnter={isDesktop ? () => setFocus(true) : undefined}\n onMouseLeave={isDesktop ? () => setFocus(false) : undefined}\n className={styles(style.container, fullScreen && style.fullScreen, others.className)}\n style={{ ...(!fullScreen ? others.style : undefined), width: fullScreen ? screenWidth : width }}\n >\n {!fullScreen && (\n <Pressable\n onPress={() => setIndex(index - 1)}\n className={styles(style.button, (index <= 0 || (isDesktop && !focus)) && style.hide, style.back)}\n >\n <Icon value={ICON.LEFT} />\n </Pressable>\n )}\n\n <ScrollView\n horizontal\n scrollTo={index * Math.floor(width)}\n snap\n width={width}\n onScroll={handleScroll}\n className={style.scrollView}\n >\n {images.map((image, imageIndex) => (\n <View key={imageIndex} className={style.item}>\n <View\n role=\"image\"\n onClick={() => setFullScreen(!fullScreen)}\n className={style.image}\n style={{\n backgroundImage:\n fullScreen || (imageIndex >= index - PRELOAD_IMAGES && imageIndex <= index + PRELOAD_IMAGES)\n ? `url(${image})`\n : undefined,\n height,\n width,\n }}\n />\n {captions[imageIndex] && (\n <View className={style.caption}>\n <Text bold small className={style.text}>\n {captions[imageIndex]}\n </Text>\n </View>\n )}\n </View>\n ))}\n </ScrollView>\n\n {!fullScreen && (\n <Pressable\n onPress={() => setIndex(index + 1)}\n className={styles(\n style.button,\n (index >= images.length - 1 || (isDesktop && !focus)) && style.hide && style.hide,\n style.forward,\n )}\n >\n <Icon value={ICON.RIGHT} />\n </Pressable>\n )}\n\n {fullScreen && (\n <ScrollView horizontal snap className={style.thumbnails}>\n {images.map((image, imageIndex) => (\n <Pressable\n key={imageIndex}\n onPress={() => setIndex(imageIndex)}\n className={styles(style.thumbnail, index === imageIndex && style.active)}\n style={{ backgroundImage: `url(${thumbnails[imageIndex] || image})` }}\n />\n ))}\n </ScrollView>\n )}\n </View>\n );\n};\n\nSlider.displayName = 'Component:Slider';\n\nSlider.propTypes = {\n auto: PropTypes.bool,\n captions: PropTypes.arrayOf(PropTypes.string),\n fullScreen: PropTypes.bool,\n height: PropTypes.number.isRequired,\n images: PropTypes.arrayOf(PropTypes.string).isRequired,\n index: PropTypes.number,\n thumbnails: PropTypes.arrayOf(PropTypes.string),\n width: PropTypes.number.isRequired,\n onChange: PropTypes.func,\n onFullScreen: PropTypes.func,\n};\n\nexport {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