@mirai/ui 1.0.118 → 1.0.120

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 (61) hide show
  1. package/README.md +23 -2
  2. package/build/components/Calendar/Calendar.Month.js +6 -3
  3. package/build/components/Calendar/Calendar.Month.js.map +1 -1
  4. package/build/components/Calendar/Calendar.Week.js +1 -1
  5. package/build/components/Calendar/Calendar.Week.js.map +1 -1
  6. package/build/components/Calendar/Calendar.Weekdays.js +5 -1
  7. package/build/components/Calendar/Calendar.Weekdays.js.map +1 -1
  8. package/build/components/Calendar/Calendar.module.css +1 -0
  9. package/build/components/Calendar/__tests__/__snapshots__/Calendar.test.jsx.snap +528 -528
  10. package/build/components/Form/Form.stories.js +11 -2
  11. package/build/components/Form/Form.stories.js.map +1 -1
  12. package/build/components/Form/__tests__/__snapshots__/Form.test.jsx.snap +14 -10
  13. package/build/components/InputDate/InputDate.js +21 -16
  14. package/build/components/InputDate/InputDate.js.map +1 -1
  15. package/build/components/InputDate/InputDate.module.css +8 -6
  16. package/build/components/InputDate/__tests__/__snapshots__/InputDate.test.js.snap +597 -512
  17. package/build/components/InputOption/InputOption.js +2 -4
  18. package/build/components/InputOption/InputOption.js.map +1 -1
  19. package/build/components/InputOption/InputOption.module.css +2 -16
  20. package/build/components/InputOption/__tests__/__snapshots__/InputOption.test.js.snap +1 -1
  21. package/build/components/InputSelect/InputSelect.js +23 -22
  22. package/build/components/InputSelect/InputSelect.js.map +1 -1
  23. package/build/components/InputSelect/__tests__/__snapshots__/InputSelect.test.js.snap +503 -495
  24. package/build/components/InputText/InputText.js +24 -21
  25. package/build/components/InputText/InputText.js.map +1 -1
  26. package/build/components/InputText/InputText.module.css +14 -35
  27. package/build/components/InputText/__tests__/__snapshots__/InputText.test.js.snap +223 -191
  28. package/build/components/InputText/partials/InputText.Hint.js +33 -0
  29. package/build/components/InputText/partials/InputText.Hint.js.map +1 -0
  30. package/build/components/InputText/partials/InputText.IconState.js +33 -0
  31. package/build/components/InputText/partials/InputText.IconState.js.map +1 -0
  32. package/build/components/InputText/partials/InputText.Label.js +39 -0
  33. package/build/components/InputText/partials/InputText.Label.js.map +1 -0
  34. package/build/components/InputText/partials/index.js +39 -0
  35. package/build/components/InputText/partials/index.js.map +1 -0
  36. package/build/components/Menu/Menu.Option.js +6 -2
  37. package/build/components/Menu/Menu.Option.js.map +1 -1
  38. package/build/components/Menu/Menu.module.css +6 -3
  39. package/build/components/Menu/__tests__/__snapshots__/Menu.test.jsx.snap +93 -69
  40. package/build/components/Modal/Modal.js +1 -1
  41. package/build/components/Modal/Modal.js.map +1 -1
  42. package/build/components/Modal/__tests__/__snapshots__/Modal.test.js.snap +4 -4
  43. package/build/components/Table/Table.Row.js +5 -2
  44. package/build/components/Table/Table.Row.js.map +1 -1
  45. package/build/components/Table/Table.module.css +7 -2
  46. package/build/components/Table/__tests__/__snapshots__/Table.test.js.snap +1829 -669
  47. package/build/primitives/Text/Text.module.css +4 -4
  48. package/build/primitives/View/View.js +5 -2
  49. package/build/primitives/View/View.js.map +1 -1
  50. package/build/primitives/View/View.module.css +11 -3
  51. package/build/primitives/View/View.stories.js +1 -0
  52. package/build/primitives/View/View.stories.js.map +1 -1
  53. package/build/primitives/View/__tests__/__snapshots__/View.test.js.snap +8 -0
  54. package/build/theme/default.theme.css +1 -1
  55. package/build/theme/index.js +11 -0
  56. package/build/theme/index.js.map +1 -1
  57. package/build/theme/theme.constants.js +21 -1
  58. package/build/theme/theme.constants.js.map +1 -1
  59. package/build/theme/theme.js +23 -1
  60. package/build/theme/theme.js.map +1 -1
  61. package/package.json +1 -1
@@ -18,22 +18,22 @@
18
18
  font-weight: var(--mirai-ui-font-bold-weight);
19
19
  }
20
20
 
21
- .headline-1 {
21
+ h1.headline-1 {
22
22
  font-size: var(--mirai-ui-font-size-headline-1);
23
23
  line-height: var(--mirai-ui-line-height-headline-1);
24
24
  }
25
25
 
26
- .headline-2 {
26
+ h2.headline-2 {
27
27
  font-size: var(--mirai-ui-font-size-headline-2);
28
28
  line-height: var(--mirai-ui-line-height-headline-2);
29
29
  }
30
30
 
31
- .headline-3 {
31
+ h3.headline-3 {
32
32
  font-size: var(--mirai-ui-font-size-headline-3);
33
33
  line-height: var(--mirai-ui-line-height-headline-3);
34
34
  }
35
35
 
36
- .headline-4 {
36
+ h4.headline-4 {
37
37
  font-size: var(--mirai-ui-font-size-headline-4);
38
38
  line-height: var(--mirai-ui-line-height-headline-4);
39
39
  }
@@ -9,7 +9,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _react = _interopRequireDefault(require("react"));
10
10
  var _helpers = require("../../helpers");
11
11
  var _ViewModule = _interopRequireDefault(require("./View.module.css"));
12
- var _excluded = ["children", "fit", "row", "tag", "wide"];
12
+ var _excluded = ["children", "fit", "forceRow", "row", "tag", "wide"];
13
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
14
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
15
15
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -21,13 +21,15 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
21
21
  var View = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
22
22
  var children = _ref.children,
23
23
  fit = _ref.fit,
24
+ _ref$forceRow = _ref.forceRow,
25
+ forceRow = _ref$forceRow === void 0 ? false : _ref$forceRow,
24
26
  row = _ref.row,
25
27
  _ref$tag = _ref.tag,
26
28
  tag = _ref$tag === void 0 ? 'div' : _ref$tag,
27
29
  wide = _ref.wide,
28
30
  others = _objectWithoutProperties(_ref, _excluded);
29
31
  return /*#__PURE__*/_react.default.createElement(tag, _objectSpread(_objectSpread({}, others), {}, {
30
- className: (0, _helpers.styles)(_ViewModule.default.view, fit && _ViewModule.default.fit, row && _ViewModule.default.row, wide && _ViewModule.default.wide, others.className),
32
+ className: (0, _helpers.styles)(_ViewModule.default.view, fit && _ViewModule.default.fit, row && !forceRow && _ViewModule.default.row, forceRow && _ViewModule.default.forceRow, wide && _ViewModule.default.wide, others.className),
31
33
  ref: ref
32
34
  }), children);
33
35
  });
@@ -36,6 +38,7 @@ View.displayName = 'Primitive:View';
36
38
  View.propTypes = {
37
39
  children: _propTypes.default.node,
38
40
  fit: _propTypes.default.bool,
41
+ forceRow: _propTypes.default.bool,
39
42
  row: _propTypes.default.bool,
40
43
  tag: _propTypes.default.string,
41
44
  wide: _propTypes.default.bool
@@ -1 +1 @@
1
- {"version":3,"file":"View.js","names":["View","React","forwardRef","ref","children","fit","row","tag","wide","others","createElement","className","styles","style","view","displayName","propTypes","PropTypes","node","bool","string"],"sources":["../../../src/primitives/View/View.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport style from './View.module.css';\n\nconst View = React.forwardRef(({ children, fit, row, tag = 'div', wide, ...others }, ref) =>\n React.createElement(\n tag,\n {\n ...others,\n className: styles(style.view, fit && style.fit, row && style.row, wide && style.wide, others.className),\n ref: ref,\n },\n children,\n ),\n);\n\nView.displayName = 'Primitive:View';\n\nView.propTypes = {\n children: PropTypes.node,\n fit: PropTypes.bool,\n row: PropTypes.bool,\n tag: PropTypes.string,\n wide: PropTypes.bool,\n};\n\nexport { View };\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AACA;AAAsC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEtC,IAAMA,IAAI,gBAAGC,cAAK,CAACC,UAAU,CAAC,gBAAuDC,GAAG;EAAA,IAAvDC,QAAQ,QAARA,QAAQ;IAAEC,GAAG,QAAHA,GAAG;IAAEC,GAAG,QAAHA,GAAG;IAAA,gBAAEC,GAAG;IAAHA,GAAG,yBAAG,KAAK;IAAEC,IAAI,QAAJA,IAAI;IAAKC,MAAM;EAAA,oBAC/ER,cAAK,CAACS,aAAa,CACjBH,GAAG,kCAEEE,MAAM;IACTE,SAAS,EAAE,IAAAC,eAAM,EAACC,mBAAK,CAACC,IAAI,EAAET,GAAG,IAAIQ,mBAAK,CAACR,GAAG,EAAEC,GAAG,IAAIO,mBAAK,CAACP,GAAG,EAAEE,IAAI,IAAIK,mBAAK,CAACL,IAAI,EAAEC,MAAM,CAACE,SAAS,CAAC;IACvGR,GAAG,EAAEA;EAAG,IAEVC,QAAQ,CACT;AAAA,EACF;AAAC;AAEFJ,IAAI,CAACe,WAAW,GAAG,gBAAgB;AAEnCf,IAAI,CAACgB,SAAS,GAAG;EACfZ,QAAQ,EAAEa,kBAAS,CAACC,IAAI;EACxBb,GAAG,EAAEY,kBAAS,CAACE,IAAI;EACnBb,GAAG,EAAEW,kBAAS,CAACE,IAAI;EACnBZ,GAAG,EAAEU,kBAAS,CAACG,MAAM;EACrBZ,IAAI,EAAES,kBAAS,CAACE;AAClB,CAAC"}
1
+ {"version":3,"file":"View.js","names":["View","React","forwardRef","ref","children","fit","forceRow","row","tag","wide","others","createElement","className","styles","style","view","displayName","propTypes","PropTypes","node","bool","string"],"sources":["../../../src/primitives/View/View.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport style from './View.module.css';\n\nconst View = React.forwardRef(({ children, fit, forceRow = false, row, tag = 'div', wide, ...others }, ref) =>\n React.createElement(\n tag,\n {\n ...others,\n className: styles(\n style.view,\n fit && style.fit,\n row && !forceRow && style.row,\n forceRow && style.forceRow,\n wide && style.wide,\n others.className,\n ),\n ref: ref,\n },\n children,\n ),\n);\n\nView.displayName = 'Primitive:View';\n\nView.propTypes = {\n children: PropTypes.node,\n fit: PropTypes.bool,\n forceRow: PropTypes.bool,\n row: PropTypes.bool,\n tag: PropTypes.string,\n wide: PropTypes.bool,\n};\n\nexport { View };\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AACA;AAAsC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEtC,IAAMA,IAAI,gBAAGC,cAAK,CAACC,UAAU,CAAC,gBAAyEC,GAAG;EAAA,IAAzEC,QAAQ,QAARA,QAAQ;IAAEC,GAAG,QAAHA,GAAG;IAAA,qBAAEC,QAAQ;IAARA,QAAQ,8BAAG,KAAK;IAAEC,GAAG,QAAHA,GAAG;IAAA,gBAAEC,GAAG;IAAHA,GAAG,yBAAG,KAAK;IAAEC,IAAI,QAAJA,IAAI;IAAKC,MAAM;EAAA,oBACjGT,cAAK,CAACU,aAAa,CACjBH,GAAG,kCAEEE,MAAM;IACTE,SAAS,EAAE,IAAAC,eAAM,EACfC,mBAAK,CAACC,IAAI,EACVV,GAAG,IAAIS,mBAAK,CAACT,GAAG,EAChBE,GAAG,IAAI,CAACD,QAAQ,IAAIQ,mBAAK,CAACP,GAAG,EAC7BD,QAAQ,IAAIQ,mBAAK,CAACR,QAAQ,EAC1BG,IAAI,IAAIK,mBAAK,CAACL,IAAI,EAClBC,MAAM,CAACE,SAAS,CACjB;IACDT,GAAG,EAAEA;EAAG,IAEVC,QAAQ,CACT;AAAA,EACF;AAAC;AAEFJ,IAAI,CAACgB,WAAW,GAAG,gBAAgB;AAEnChB,IAAI,CAACiB,SAAS,GAAG;EACfb,QAAQ,EAAEc,kBAAS,CAACC,IAAI;EACxBd,GAAG,EAAEa,kBAAS,CAACE,IAAI;EACnBd,QAAQ,EAAEY,kBAAS,CAACE,IAAI;EACxBb,GAAG,EAAEW,kBAAS,CAACE,IAAI;EACnBZ,GAAG,EAAEU,kBAAS,CAACG,MAAM;EACrBZ,IAAI,EAAES,kBAAS,CAACE;AAClB,CAAC"}
@@ -1,9 +1,9 @@
1
1
  .view {
2
- display: flex;
3
2
  box-sizing: border-box;
3
+ display: flex;
4
4
  }
5
5
 
6
- .view:not(.row) {
6
+ .view:not(.row):not(.forceRow) {
7
7
  flex-direction: column;
8
8
  }
9
9
 
@@ -11,11 +11,19 @@
11
11
  width: fit-content;
12
12
  }
13
13
 
14
- .row {
14
+ .row,
15
+ .forceRow {
15
16
  align-items: center;
17
+ }
18
+
19
+ .row {
16
20
  flex-direction: var(--mirai-ui-row-direction);
17
21
  }
18
22
 
23
+ .forceRow {
24
+ flex-direction: row;
25
+ }
26
+
19
27
  .wide {
20
28
  width: 100%;
21
29
  }
@@ -27,6 +27,7 @@ exports.Story = Story;
27
27
  Story.storyName = 'View';
28
28
  Story.args = (_Story$args = {
29
29
  fit: false,
30
+ forceRow: false,
30
31
  row: false,
31
32
  tag: 'div',
32
33
  wide: false
@@ -1 +1 @@
1
- {"version":3,"file":"View.stories.js","names":["title","Story","props","storyName","args","fit","row","tag","wide","argTypes"],"sources":["../../../src/primitives/View/View.stories.jsx"],"sourcesContent":["import React from 'react';\n\nimport { View } from './View';\n\nexport default { title: 'Primitives' };\n\nexport const Story = (props) => (\n <View {...props}>\n <span className=\"children\">child:1</span>\n <span className=\"children\">child:2</span>\n </View>\n);\n\nStory.storyName = 'View';\n\nStory.args = {\n fit: false,\n row: false,\n tag: 'div',\n wide: false,\n // inherited properties\n ['data-testid']: 'test-story',\n style: {},\n};\n\nStory.argTypes = {};\n"],"mappings":";;;;;;AAAA;AAEA;AAA8B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAEf;EAAEA,KAAK,EAAE;AAAa,CAAC;AAAA;AAE/B,IAAMC,KAAK,GAAG,SAARA,KAAK,CAAIC,KAAK;EAAA,oBACzB,6BAAC,UAAI,EAAKA,KAAK,eACb;IAAM,SAAS,EAAC;EAAU,aAAe,eACzC;IAAM,SAAS,EAAC;EAAU,aAAe,CACpC;AAAA,CACR;AAAC;AAEFD,KAAK,CAACE,SAAS,GAAG,MAAM;AAExBF,KAAK,CAACG,IAAI;EACRC,GAAG,EAAE,KAAK;EACVC,GAAG,EAAE,KAAK;EACVC,GAAG,EAAE,KAAK;EACVC,IAAI,EAAE;AAAK,gCAEV,aAAa,EAAG,YAAY,yCACtB,CAAC,CAAC,eACV;AAEDP,KAAK,CAACQ,QAAQ,GAAG,CAAC,CAAC"}
1
+ {"version":3,"file":"View.stories.js","names":["title","Story","props","storyName","args","fit","forceRow","row","tag","wide","argTypes"],"sources":["../../../src/primitives/View/View.stories.jsx"],"sourcesContent":["import React from 'react';\n\nimport { View } from './View';\n\nexport default { title: 'Primitives' };\n\nexport const Story = (props) => (\n <View {...props}>\n <span className=\"children\">child:1</span>\n <span className=\"children\">child:2</span>\n </View>\n);\n\nStory.storyName = 'View';\n\nStory.args = {\n fit: false,\n forceRow: false,\n row: false,\n tag: 'div',\n wide: false,\n // inherited properties\n ['data-testid']: 'test-story',\n style: {},\n};\n\nStory.argTypes = {};\n"],"mappings":";;;;;;AAAA;AAEA;AAA8B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAEf;EAAEA,KAAK,EAAE;AAAa,CAAC;AAAA;AAE/B,IAAMC,KAAK,GAAG,SAARA,KAAK,CAAIC,KAAK;EAAA,oBACzB,6BAAC,UAAI,EAAKA,KAAK,eACb;IAAM,SAAS,EAAC;EAAU,aAAe,eACzC;IAAM,SAAS,EAAC;EAAU,aAAe,CACpC;AAAA,CACR;AAAC;AAEFD,KAAK,CAACE,SAAS,GAAG,MAAM;AAExBF,KAAK,CAACG,IAAI;EACRC,GAAG,EAAE,KAAK;EACVC,QAAQ,EAAE,KAAK;EACfC,GAAG,EAAE,KAAK;EACVC,GAAG,EAAE,KAAK;EACVC,IAAI,EAAE;AAAK,gCAEV,aAAa,EAAG,YAAY,yCACtB,CAAC,CAAC,eACV;AAEDR,KAAK,CAACS,QAAQ,GAAG,CAAC,CAAC"}
@@ -28,6 +28,14 @@ exports[`primitive:<View> prop:fit 1`] = `
28
28
  </DocumentFragment>
29
29
  `;
30
30
 
31
+ exports[`primitive:<View> prop:forceRow 1`] = `
32
+ <DocumentFragment>
33
+ <div
34
+ class="view forceRow"
35
+ />
36
+ </DocumentFragment>
37
+ `;
38
+
31
39
  exports[`primitive:<View> prop:row 1`] = `
32
40
  <DocumentFragment>
33
41
  <div
@@ -183,7 +183,7 @@
183
183
 
184
184
  /* Calendar */
185
185
  --mirai-ui-calendar-caption-font-size: 10px;
186
- --mirai-ui-calendar-caption-line-height: var(--mirai-ui-calendar-caption-font-size) * 1.5;
186
+ --mirai-ui-calendar-caption-line-height: calc(var(--mirai-ui-calendar-caption-font-size) * 1.5);
187
187
  --mirai-ui-calendar-caption-color: var(--mirai-ui-content-light);
188
188
  --mirai-ui-calendar-cell: var(--mirai-ui-space-XL);
189
189
  --mirai-ui-calendar-highlight-color: var(--mirai-ui-accent);
@@ -3,9 +3,19 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ var _exportNames = {
7
+ DIRECTION_TYPE: true
8
+ };
9
+ Object.defineProperty(exports, "DIRECTION_TYPE", {
10
+ enumerable: true,
11
+ get: function get() {
12
+ return _theme2.DIRECTION_TYPE;
13
+ }
14
+ });
6
15
  var _theme = require("./theme");
7
16
  Object.keys(_theme).forEach(function (key) {
8
17
  if (key === "default" || key === "__esModule") return;
18
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
9
19
  if (key in exports && exports[key] === _theme[key]) return;
10
20
  Object.defineProperty(exports, key, {
11
21
  enumerable: true,
@@ -14,4 +24,5 @@ Object.keys(_theme).forEach(function (key) {
14
24
  }
15
25
  });
16
26
  });
27
+ var _theme2 = require("./theme.constants");
17
28
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/theme/index.js"],"sourcesContent":["export * from './theme';\n"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/theme/index.js"],"sourcesContent":["export * from './theme';\nexport { DIRECTION_TYPE } from './theme.constants';\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA"}
@@ -3,9 +3,29 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.MAGNITUDES = exports.DOMAIN = exports.COLORS = void 0;
6
+ exports.MAGNITUDES = exports.DOMAIN = exports.DIRECTION_TYPE = exports.DIRECTION = exports.COLORS = void 0;
7
+ var _DIRECTION;
8
+ 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); }
9
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
10
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
11
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
12
  var COLORS = ['accent'];
8
13
  exports.COLORS = COLORS;
14
+ var DIRECTION_TYPE = {
15
+ LEFT: 0,
16
+ RIGHT: 1
17
+ };
18
+ exports.DIRECTION_TYPE = DIRECTION_TYPE;
19
+ var DIRECTION = (_DIRECTION = {}, _defineProperty(_DIRECTION, DIRECTION_TYPE.LEFT, {
20
+ 'text-align': 'left',
21
+ 'text-direction': 'ltr',
22
+ 'row-direction': 'row'
23
+ }), _defineProperty(_DIRECTION, DIRECTION_TYPE.RIGHT, {
24
+ 'text-align': 'right',
25
+ 'text-direction': 'rtl',
26
+ 'row-direction': 'row-reverse'
27
+ }), _DIRECTION);
28
+ exports.DIRECTION = DIRECTION;
9
29
  var DOMAIN = '--mirai-ui-';
10
30
  exports.DOMAIN = DOMAIN;
11
31
  var MAGNITUDES = [400, 300, 200];
@@ -1 +1 @@
1
- {"version":3,"file":"theme.constants.js","names":["COLORS","DOMAIN","MAGNITUDES"],"sources":["../../src/theme/theme.constants.js"],"sourcesContent":["const COLORS = ['accent'];\n\nconst DOMAIN = '--mirai-ui-';\n\nconst MAGNITUDES = [400, 300, 200];\n\nexport { COLORS, DOMAIN, MAGNITUDES };\n"],"mappings":";;;;;;AAAA,IAAMA,MAAM,GAAG,CAAC,QAAQ,CAAC;AAAC;AAE1B,IAAMC,MAAM,GAAG,aAAa;AAAC;AAE7B,IAAMC,UAAU,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;AAAC"}
1
+ {"version":3,"file":"theme.constants.js","names":["COLORS","DIRECTION_TYPE","LEFT","RIGHT","DIRECTION","DOMAIN","MAGNITUDES"],"sources":["../../src/theme/theme.constants.js"],"sourcesContent":["const COLORS = ['accent'];\n\nconst DIRECTION_TYPE = {\n LEFT: 0,\n RIGHT: 1,\n};\nconst DIRECTION = {\n [DIRECTION_TYPE.LEFT]: {\n 'text-align': 'left',\n 'text-direction': 'ltr',\n 'row-direction': 'row',\n },\n [DIRECTION_TYPE.RIGHT]: {\n 'text-align': 'right',\n 'text-direction': 'rtl',\n 'row-direction': 'row-reverse',\n },\n};\nconst DOMAIN = '--mirai-ui-';\n\nconst MAGNITUDES = [400, 300, 200];\n\nexport { COLORS, DIRECTION, DIRECTION_TYPE, DOMAIN, MAGNITUDES };\n"],"mappings":";;;;;;;;;;;AAAA,IAAMA,MAAM,GAAG,CAAC,QAAQ,CAAC;AAAC;AAE1B,IAAMC,cAAc,GAAG;EACrBC,IAAI,EAAE,CAAC;EACPC,KAAK,EAAE;AACT,CAAC;AAAC;AACF,IAAMC,SAAS,iDACZH,cAAc,CAACC,IAAI,EAAG;EACrB,YAAY,EAAE,MAAM;EACpB,gBAAgB,EAAE,KAAK;EACvB,eAAe,EAAE;AACnB,CAAC,+BACAD,cAAc,CAACE,KAAK,EAAG;EACtB,YAAY,EAAE,OAAO;EACrB,gBAAgB,EAAE,KAAK;EACvB,eAAe,EAAE;AACnB,CAAC,cACF;AAAC;AACF,IAAME,MAAM,GAAG,aAAa;AAAC;AAE7B,IAAMC,UAAU,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;AAAC"}
@@ -6,6 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.Theme = void 0;
7
7
  var _helpers = require("./helpers");
8
8
  var _theme = require("./theme.constants");
9
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
10
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
11
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
12
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
13
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
10
14
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
11
15
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -39,7 +43,8 @@ var Theme = {
39
43
  }, [])));
40
44
  }, []);
41
45
  keys.forEach(function (key) {
42
- return variables[(0, _helpers.camelcase)(key.replace(domain, ''))] = style.getPropertyValue(key);
46
+ var _style$getPropertyVal;
47
+ return variables[(0, _helpers.camelcase)(key.replace(domain, ''))] = (_style$getPropertyVal = style.getPropertyValue(key)) === null || _style$getPropertyVal === void 0 ? void 0 : _style$getPropertyVal.trim();
43
48
  });
44
49
  return variables;
45
50
  },
@@ -62,6 +67,23 @@ var Theme = {
62
67
  return Theme.setVariable("".concat(color, "-").concat(magnitude), (0, _helpers.colorShade)(theme[color], magnitude));
63
68
  });
64
69
  });
70
+ },
71
+ getDirection: function getDirection() {
72
+ var _Theme$get = Theme.get(),
73
+ textDirection = _Theme$get.textDirection;
74
+ return textDirection !== _theme.DIRECTION[_theme.DIRECTION_TYPE.RIGHT]['text-direction'] ? _theme.DIRECTION_TYPE.LEFT : _theme.DIRECTION_TYPE.RIGHT;
75
+ },
76
+ setDirection: function setDirection() {
77
+ var direction = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _theme.DIRECTION_TYPE.LEFT;
78
+ if (!Object.values(_theme.DIRECTION_TYPE).includes(direction)) return;
79
+ var variables = _theme.DIRECTION[direction] || {};
80
+ Object.entries(variables).map(function (_ref3) {
81
+ var _ref4 = _slicedToArray(_ref3, 2),
82
+ key = _ref4[0],
83
+ value = _ref4[1];
84
+ return Theme.setVariable(key, value);
85
+ });
86
+ return direction;
65
87
  }
66
88
  };
67
89
  exports.Theme = Theme;
@@ -1 +1 @@
1
- {"version":3,"file":"theme.js","names":["Theme","get","domain","DOMAIN","style","getComputedStyle","document","querySelector","variables","keys","Array","from","styleSheets","filter","stylesheet","href","startsWith","window","location","origin","cssRules","reduce","value","selectorText","name","forEach","key","camelcase","replace","getPropertyValue","setVariable","variable","setProperty","shadeColors","theme","COLORS","color","undefined","MAGNITUDES","magnitude","colorShade"],"sources":["../../src/theme/theme.js"],"sourcesContent":["import { camelcase, colorShade } from './helpers';\nimport { COLORS, DOMAIN, MAGNITUDES } from './theme.constants';\n\nexport const Theme = {\n get: (domain = DOMAIN) => {\n const style = getComputedStyle(document.querySelector(':root'));\n const variables = {};\n\n const keys = Array.from(document.styleSheets)\n .filter((stylesheet) => {\n try {\n return (\n (stylesheet.href === null || stylesheet.href.startsWith(window.location.origin)) &&\n (stylesheet.cssRules ?? {})\n );\n } catch {\n return false;\n }\n })\n .reduce(\n (stylesheet, { cssRules } = {}) => [\n ...stylesheet,\n ...Array.from(cssRules).reduce(\n (value, { selectorText = '', style = [] } = {}) =>\n selectorText === ':root'\n ? [...value, ...Array.from(style).filter((name) => name.startsWith(domain))]\n : value,\n [],\n ),\n ],\n [],\n );\n\n keys.forEach((key) => (variables[camelcase(key.replace(domain, ''))] = style.getPropertyValue(key)));\n\n return variables;\n },\n\n setVariable: (variable, value, domain = DOMAIN) => {\n const { style } = document.querySelector(':root');\n\n style.setProperty(`${domain}${variable}`, value);\n\n // ! TODO: Should revisit this \"algo\"\n // Theme.shadeColors();\n },\n\n shadeColors: () => {\n const theme = Theme.get();\n\n COLORS.filter((color) => theme[color] !== undefined).forEach((color) =>\n MAGNITUDES.forEach((magnitude) =>\n Theme.setVariable(`${color}-${magnitude}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CACH;IAEHb,IAAI,CAACgB,OAAO,CAAC,UAACC,GAAG;MAAA,OAAMlB,SAAS,CAAC,IAAAmB,kBAAS,EAACD,GAAG,CAACE,OAAO,CAAC1B,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,GAAGE,KAAK,CAACyB,gBAAgB,CAACH,GAAG,CAAC;IAAA,CAAC,CAAC;IAEpG,OAAOlB,SAAS;EAClB,CAAC;EAEDsB,WAAW,EAAE,qBAACC,QAAQ,EAAET,KAAK,EAAsB;IAAA,IAApBpB,MAAM,uEAAGC,aAAM;IAC5C,4BAAkBG,QAAQ,CAACC,aAAa,CAAC,OAAO,CAAC;MAAzCH,KAAK,yBAALA,KAAK;IAEbA,KAAK,CAAC4B,WAAW,WAAI9B,MAAM,SAAG6B,QAAQ,GAAIT,KAAK,CAAC;;IAEhD;IACA;EACF,CAAC;;EAEDW,WAAW,EAAE,uBAAM;IACjB,IAAMC,KAAK,GAAGlC,KAAK,CAACC,GAAG,EAAE;IAEzBkC,aAAM,CAACtB,MAAM,CAAC,UAACuB,KAAK;MAAA,OAAKF,KAAK,CAACE,KAAK,CAAC,KAAKC,SAAS;IAAA,EAAC,CAACZ,OAAO,CAAC,UAACW,KAAK;MAAA,OACjEE,iBAAU,CAACb,OAAO,CAAC,UAACc,SAAS;QAAA,OAC3BvC,KAAK,CAAC8B,WAAW,WAAIM,KAAK,cAAIG,SAAS,GAAI,IAAAC,mBAAU,EAACN,KAAK,CAACE,KAAK,CAAC,EAAEG,SAAS,CAAC,CAAC;MAAA,EAChF;IAAA,EACF;EACH;AACF,CAAC;AAAC"}
1
+ {"version":3,"file":"theme.js","names":["Theme","get","domain","DOMAIN","style","getComputedStyle","document","querySelector","variables","keys","Array","from","styleSheets","filter","stylesheet","href","startsWith","window","location","origin","cssRules","reduce","value","selectorText","name","forEach","key","camelcase","replace","getPropertyValue","trim","setVariable","variable","setProperty","shadeColors","theme","COLORS","color","undefined","MAGNITUDES","magnitude","colorShade","getDirection","textDirection","DIRECTION","DIRECTION_TYPE","RIGHT","LEFT","setDirection","direction","Object","values","includes","entries","map"],"sources":["../../src/theme/theme.js"],"sourcesContent":["import { camelcase, colorShade } from './helpers';\nimport { COLORS, DIRECTION, DIRECTION_TYPE, DOMAIN, MAGNITUDES } from './theme.constants';\n\nexport const Theme = {\n get: (domain = DOMAIN) => {\n const style = getComputedStyle(document.querySelector(':root'));\n const variables = {};\n\n const keys = Array.from(document.styleSheets)\n .filter((stylesheet) => {\n try {\n return (\n (stylesheet.href === null || stylesheet.href.startsWith(window.location.origin)) &&\n (stylesheet.cssRules ?? {})\n );\n } catch {\n return false;\n }\n })\n .reduce(\n (stylesheet, { cssRules } = {}) => [\n ...stylesheet,\n ...Array.from(cssRules).reduce(\n (value, { selectorText = '', style = [] } = {}) =>\n selectorText === ':root'\n ? [...value, ...Array.from(style).filter((name) => name.startsWith(domain))]\n : value,\n [],\n ),\n ],\n [],\n );\n\n keys.forEach((key) => (variables[camelcase(key.replace(domain, ''))] = style.getPropertyValue(key)?.trim()));\n\n return variables;\n },\n\n setVariable: (variable, value, domain = DOMAIN) => {\n const { style } = document.querySelector(':root');\n\n style.setProperty(`${domain}${variable}`, value);\n\n // ! TODO: Should revisit this \"algo\"\n // Theme.shadeColors();\n },\n\n shadeColors: () => {\n const theme = Theme.get();\n\n COLORS.filter((color) => theme[color] !== undefined).forEach((color) =>\n MAGNITUDES.forEach((magnitude) =>\n Theme.setVariable(`${color}-${magnitude}`, colorShade(theme[color], magnitude)),\n ),\n );\n },\n\n getDirection: () => {\n const { textDirection } = Theme.get();\n\n return textDirection !== DIRECTION[DIRECTION_TYPE.RIGHT]['text-direction']\n ? DIRECTION_TYPE.LEFT\n : DIRECTION_TYPE.RIGHT;\n },\n\n setDirection: (direction = DIRECTION_TYPE.LEFT) => {\n if (!Object.values(DIRECTION_TYPE).includes(direction)) return;\n\n const variables = DIRECTION[direction] || {};\n Object.entries(variables).map(([key, value]) => Theme.setVariable(key, value));\n\n return direction;\n },\n};\n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AC1B,CAAC;EAEDE,YAAY,EAAE,wBAAqC;IAAA,IAApCC,SAAS,uEAAGJ,qBAAc,CAACE,IAAI;IAC5C,IAAI,CAACG,MAAM,CAACC,MAAM,CAACN,qBAAc,CAAC,CAACO,QAAQ,CAACH,SAAS,CAAC,EAAE;IAExD,IAAMzC,SAAS,GAAGoC,gBAAS,CAACK,SAAS,CAAC,IAAI,CAAC,CAAC;IAC5CC,MAAM,CAACG,OAAO,CAAC7C,SAAS,CAAC,CAAC8C,GAAG,CAAC;MAAA;QAAE5B,GAAG;QAAEJ,KAAK;MAAA,OAAMtB,KAAK,CAAC+B,WAAW,CAACL,GAAG,EAAEJ,KAAK,CAAC;IAAA,EAAC;IAE9E,OAAO2B,SAAS;EAClB;AACF,CAAC;AAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mirai/ui",
3
- "version": "1.0.118",
3
+ "version": "1.0.120",
4
4
  "repository": "git@gitlab.com:miraicorp/dev/frontend/ui.git",
5
5
  "author": "JΛVI <hello@soyjavi.com>",
6
6
  "license": "MIT",