@clubmed/trident-ui 1.3.0-beta.5 → 1.3.0-beta.7

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 (108) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/chunks/_commonjsHelpers.js +24 -4
  3. package/chunks/_commonjsHelpers.js.map +1 -1
  4. package/chunks/index.js.map +1 -1
  5. package/chunks/plugin.js.map +1 -1
  6. package/contexts/Device.d.ts +2 -22
  7. package/contexts/Device.js +5 -59
  8. package/contexts/Device.js.map +1 -1
  9. package/contexts/Devices/Device.d.ts +11 -0
  10. package/contexts/Devices/Device.js +23 -0
  11. package/contexts/Devices/Device.js.map +1 -0
  12. package/contexts/Devices/hooks/useQueries.d.ts +6 -0
  13. package/contexts/Devices/hooks/useQueries.js +24 -0
  14. package/contexts/Devices/hooks/useQueries.js.map +1 -0
  15. package/contexts/Devices/reducers/reducer.d.ts +25 -0
  16. package/contexts/Devices/reducers/reducer.js +50 -0
  17. package/contexts/Devices/reducers/reducer.js.map +1 -0
  18. package/contexts/TridentUIConfig.js +228 -228
  19. package/contexts/TridentUIConfig.js.map +1 -1
  20. package/hooks/keyboard.constants.js.map +1 -1
  21. package/hooks/useInternalStatus.js.map +1 -1
  22. package/hooks/useKeyboardControls.js.map +1 -1
  23. package/hooks/useSafeBoop.js.map +1 -1
  24. package/hooks/useValue.js.map +1 -1
  25. package/molecules/Arrows/Arrows.js.map +1 -1
  26. package/molecules/Avatar.js.map +1 -1
  27. package/molecules/Backdrop.js.map +1 -1
  28. package/molecules/Breadcrumb.js +8 -9
  29. package/molecules/Breadcrumb.js.map +1 -1
  30. package/molecules/Buttons/ArrowButton.js +3 -3
  31. package/molecules/Buttons/ArrowButton.js.map +1 -1
  32. package/molecules/Buttons/Button.d.ts +1 -1
  33. package/molecules/Buttons/Button.js.map +1 -1
  34. package/molecules/Buttons/ButtonAnchor.js +3 -3
  35. package/molecules/Buttons/ButtonAnchor.js.map +1 -1
  36. package/molecules/Buttons/ButtonContent.d.ts +1 -1
  37. package/molecules/Buttons/ButtonContent.js +7 -8
  38. package/molecules/Buttons/ButtonContent.js.map +1 -1
  39. package/molecules/Buttons/{v2/FakeButton.d.ts → FakeButton.d.ts} +2 -2
  40. package/molecules/Buttons/{v2/FakeButton.js → FakeButton.js} +4 -4
  41. package/molecules/Buttons/FakeButton.js.map +1 -0
  42. package/molecules/Buttons/InertButton.js +4 -4
  43. package/molecules/Buttons/InertButton.js.map +1 -1
  44. package/molecules/Buttons/v2/Button.js.map +1 -1
  45. package/molecules/Buttons/v2/Button.type.d.ts +1 -1
  46. package/molecules/Buttons/v2/Button.type.js.map +1 -1
  47. package/molecules/Buttons/v2/ButtonAnchor.js.map +1 -1
  48. package/molecules/Card.d.ts +1 -1
  49. package/molecules/Card.js +7 -8
  50. package/molecules/Card.js.map +1 -1
  51. package/molecules/ElasticHeight.js.map +1 -1
  52. package/molecules/Forms/Checkboxes/Checkbox.js +12 -13
  53. package/molecules/Forms/Checkboxes/Checkbox.js.map +1 -1
  54. package/molecules/Forms/Checkboxes/Checkboxes.js.map +1 -1
  55. package/molecules/Forms/DateField.d.ts +1 -1
  56. package/molecules/Forms/DateField.js +142 -116
  57. package/molecules/Forms/DateField.js.map +1 -1
  58. package/molecules/Forms/Filter.js +12 -13
  59. package/molecules/Forms/Filter.js.map +1 -1
  60. package/molecules/Forms/FormControl.js +15 -16
  61. package/molecules/Forms/FormControl.js.map +1 -1
  62. package/molecules/Forms/FormLabel.js.map +1 -1
  63. package/molecules/Forms/NumberField.d.ts +1 -1
  64. package/molecules/Forms/NumberField.js.map +1 -1
  65. package/molecules/Forms/Password/Password.js +10 -11
  66. package/molecules/Forms/Password/Password.js.map +1 -1
  67. package/molecules/Forms/Password/ValidationMessage.js +8 -9
  68. package/molecules/Forms/Password/ValidationMessage.js.map +1 -1
  69. package/molecules/Forms/Radios/Radio.js.map +1 -1
  70. package/molecules/Forms/Radios/RadioGroup.js +2 -2
  71. package/molecules/Forms/Radios/RadioGroup.js.map +1 -1
  72. package/molecules/Forms/Range.js.map +1 -1
  73. package/molecules/Forms/Select.d.ts +1 -1
  74. package/molecules/Forms/Select.js +3 -4
  75. package/molecules/Forms/Select.js.map +1 -1
  76. package/molecules/Forms/Switch.js.map +1 -1
  77. package/molecules/Forms/TextField.d.ts +1 -1
  78. package/molecules/Forms/TextField.js +7 -8
  79. package/molecules/Forms/TextField.js.map +1 -1
  80. package/molecules/HamburgerIcon.js.map +1 -1
  81. package/molecules/Link.d.ts +1 -1
  82. package/molecules/Link.js +8 -9
  83. package/molecules/Link.js.map +1 -1
  84. package/molecules/Loader.js.map +1 -1
  85. package/molecules/Pagination.helper.js.map +1 -1
  86. package/molecules/Pagination.js +3 -3
  87. package/molecules/Pagination.js.map +1 -1
  88. package/molecules/Popin.js.map +1 -1
  89. package/molecules/Spinner.js.map +1 -1
  90. package/molecules/Tabs/Tab.js.map +1 -1
  91. package/molecules/Tabs/TabList.js.map +1 -1
  92. package/molecules/Tabs/TabPanel.js.map +1 -1
  93. package/molecules/Tabs/Tabs.js.map +1 -1
  94. package/molecules/Tabs/TabsBody.js.map +1 -1
  95. package/molecules/Tabs/context/TabControl.js.map +1 -1
  96. package/molecules/Tabs/hooks/tabControl.js.map +1 -1
  97. package/molecules/Tabs/theme.js.map +1 -1
  98. package/package.json +6 -6
  99. package/tailwind/plugins/animationDelay.js.map +1 -1
  100. package/tailwind/plugins/lineClampFix.js.map +1 -1
  101. package/tailwind/plugins/transitionBehavior.js.map +1 -1
  102. package/tailwind/tailwind.preset.js.map +1 -1
  103. package/types/Devices.d.ts +8 -0
  104. package/types/Devices.js +11 -0
  105. package/types/Devices.js.map +1 -0
  106. package/types/Direction.d.js +2 -0
  107. package/types/Direction.d.js.map +1 -0
  108. package/molecules/Buttons/v2/FakeButton.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # ClubMed React UI components changelog
2
2
 
3
+ # [1.3.0-beta.7](https://scm.clubmed.com/clubmed/ui/trident-ui/compare/v1.3.0-beta.6...v1.3.0-beta.7) (2025-08-04)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **icons:** migrate icon imports to @clubmed/trident-icons package ([cc803d8](https://scm.clubmed.com/clubmed/ui/trident-ui/-/commit/cc803d87cbad892df50093167fc25fc7c1a229bb))
9
+
10
+ # [1.3.0-beta.6](https://scm.clubmed.com/clubmed/ui/trident-ui/compare/v1.3.0-beta.5...v1.3.0-beta.6) (2025-08-04)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **molecule:** prevent DateField keyboard input outside min/max range ([2fab688](https://scm.clubmed.com/clubmed/ui/trident-ui/-/commit/2fab6887cbdde445e8842a0a11f61c185596d737))
16
+
3
17
  # [1.3.0-beta.5](https://scm.clubmed.com/clubmed/ui/trident-ui/compare/v1.3.0-beta.4...v1.3.0-beta.5) (2025-07-25)
4
18
 
5
19
 
@@ -1,9 +1,29 @@
1
- var o = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
2
- function l(e) {
1
+ var u = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
2
+ function f(e) {
3
3
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
4
4
  }
5
+ function l(e) {
6
+ if (e.__esModule) return e;
7
+ var r = e.default;
8
+ if (typeof r == "function") {
9
+ var t = function o() {
10
+ return this instanceof o ? Reflect.construct(r, arguments, this.constructor) : r.apply(this, arguments);
11
+ };
12
+ t.prototype = r.prototype;
13
+ } else t = {};
14
+ return Object.defineProperty(t, "__esModule", { value: !0 }), Object.keys(e).forEach(function(o) {
15
+ var n = Object.getOwnPropertyDescriptor(e, o);
16
+ Object.defineProperty(t, o, n.get ? n : {
17
+ enumerable: !0,
18
+ get: function() {
19
+ return e[o];
20
+ }
21
+ });
22
+ }), t;
23
+ }
5
24
  export {
6
- o as c,
7
- l as g
25
+ l as a,
26
+ u as c,
27
+ f as g
8
28
  };
9
29
  //# sourceMappingURL=_commonjsHelpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"_commonjsHelpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
1
+ {"version":3,"file":"_commonjsHelpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../node_modules/classnames/index.js"],"sourcesContent":["/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = '';\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (arg) {\n\t\t\t\tclasses = appendClass(classes, parseValue(arg));\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction parseValue (arg) {\n\t\tif (typeof arg === 'string' || typeof arg === 'number') {\n\t\t\treturn arg;\n\t\t}\n\n\t\tif (typeof arg !== 'object') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (Array.isArray(arg)) {\n\t\t\treturn classNames.apply(null, arg);\n\t\t}\n\n\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\treturn arg.toString();\n\t\t}\n\n\t\tvar classes = '';\n\n\t\tfor (var key in arg) {\n\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\tclasses = appendClass(classes, key);\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction appendClass (value, newClass) {\n\t\tif (!newClass) {\n\t\t\treturn value;\n\t\t}\n\t\n\t\tif (value) {\n\t\t\treturn value + ' ' + newClass;\n\t\t}\n\t\n\t\treturn value + newClass;\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n"],"names":["hasOwn","classNames","classes","i","arg","appendClass","parseValue","key","value","newClass","module"],"mappings":";;;;;;;;AAOA,GAAC,WAAY;AAGZ,QAAIA,IAAS,CAAE,EAAC;AAEhB,aAASC,IAAc;AAGtB,eAFIC,IAAU,IAELC,IAAI,GAAGA,IAAI,UAAU,QAAQA,KAAK;AAC1C,YAAIC,IAAM,UAAUD,CAAC;AACrB,QAAIC,MACHF,IAAUG,EAAYH,GAASI,EAAWF,CAAG,CAAC;AAAA,MAE/C;AAED,aAAOF;AAAA,IACP;AAED,aAASI,EAAYF,GAAK;AACzB,UAAI,OAAOA,KAAQ,YAAY,OAAOA,KAAQ;AAC7C,eAAOA;AAGR,UAAI,OAAOA,KAAQ;AAClB,eAAO;AAGR,UAAI,MAAM,QAAQA,CAAG;AACpB,eAAOH,EAAW,MAAM,MAAMG,CAAG;AAGlC,UAAIA,EAAI,aAAa,OAAO,UAAU,YAAY,CAACA,EAAI,SAAS,SAAQ,EAAG,SAAS,eAAe;AAClG,eAAOA,EAAI;AAGZ,UAAIF,IAAU;AAEd,eAASK,KAAOH;AACf,QAAIJ,EAAO,KAAKI,GAAKG,CAAG,KAAKH,EAAIG,CAAG,MACnCL,IAAUG,EAAYH,GAASK,CAAG;AAIpC,aAAOL;AAAA,IACP;AAED,aAASG,EAAaG,GAAOC,GAAU;AACtC,aAAKA,IAIDD,IACIA,IAAQ,MAAMC,IAGfD,IAAQC,IAPPD;AAAA,IAQR;AAED,IAAqCE,EAAO,WAC3CT,EAAW,UAAUA,GACrBS,EAAA,UAAiBT,KAOjB,OAAO,aAAaA;AAAA,EAEtB;;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.js","sources":["../../node_modules/classnames/index.js"],"sourcesContent":["/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = '';\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (arg) {\n\t\t\t\tclasses = appendClass(classes, parseValue(arg));\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction parseValue (arg) {\n\t\tif (typeof arg === 'string' || typeof arg === 'number') {\n\t\t\treturn arg;\n\t\t}\n\n\t\tif (typeof arg !== 'object') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (Array.isArray(arg)) {\n\t\t\treturn classNames.apply(null, arg);\n\t\t}\n\n\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\treturn arg.toString();\n\t\t}\n\n\t\tvar classes = '';\n\n\t\tfor (var key in arg) {\n\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\tclasses = appendClass(classes, key);\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction appendClass (value, newClass) {\n\t\tif (!newClass) {\n\t\t\treturn value;\n\t\t}\n\t\n\t\tif (value) {\n\t\t\treturn value + ' ' + newClass;\n\t\t}\n\t\n\t\treturn value + newClass;\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n"],"names":["hasOwn","classNames","classes","i","arg","appendClass","parseValue","key","value","newClass","module"],"mappings":";;;;;;;;AAOA,GAAC,WAAY;AAGZ,QAAIA,IAAS,CAAA,EAAG;AAEhB,aAASC,IAAc;AAGtB,eAFIC,IAAU,IAELC,IAAI,GAAGA,IAAI,UAAU,QAAQA,KAAK;AAC1C,YAAIC,IAAM,UAAUD,CAAC;AACrB,QAAIC,MACHF,IAAUG,EAAYH,GAASI,EAAWF,CAAG,CAAC;AAAA,MAElD;AAEE,aAAOF;AAAA,IACT;AAEC,aAASI,EAAYF,GAAK;AACzB,UAAI,OAAOA,KAAQ,YAAY,OAAOA,KAAQ;AAC7C,eAAOA;AAGR,UAAI,OAAOA,KAAQ;AAClB,eAAO;AAGR,UAAI,MAAM,QAAQA,CAAG;AACpB,eAAOH,EAAW,MAAM,MAAMG,CAAG;AAGlC,UAAIA,EAAI,aAAa,OAAO,UAAU,YAAY,CAACA,EAAI,SAAS,SAAQ,EAAG,SAAS,eAAe;AAClG,eAAOA,EAAI,SAAQ;AAGpB,UAAIF,IAAU;AAEd,eAASK,KAAOH;AACf,QAAIJ,EAAO,KAAKI,GAAKG,CAAG,KAAKH,EAAIG,CAAG,MACnCL,IAAUG,EAAYH,GAASK,CAAG;AAIpC,aAAOL;AAAA,IACT;AAEC,aAASG,EAAaG,GAAOC,GAAU;AACtC,aAAKA,IAIDD,IACIA,IAAQ,MAAMC,IAGfD,IAAQC,IAPPD;AAAA,IAQV;AAEC,IAAqCE,EAAO,WAC3CT,EAAW,UAAUA,GACrBS,EAAA,UAAiBT,KAOjB,OAAO,aAAaA;AAAA,EAEtB;;;;","x_google_ignoreList":[0]}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["../../node_modules/tailwindcss/lib/util/createPlugin.js","../../node_modules/tailwindcss/lib/public/create-plugin.js","../../node_modules/tailwindcss/plugin.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function() {\n return _default;\n }\n});\nfunction createPlugin(plugin, config) {\n return {\n handler: plugin,\n config\n };\n}\ncreatePlugin.withOptions = function(pluginFunction, configFunction = ()=>({})) {\n const optionsFunction = function(options) {\n return {\n __options: options,\n handler: pluginFunction(options),\n config: configFunction(options)\n };\n };\n optionsFunction.__isOptionsFunction = true;\n // Expose plugin dependencies so that `object-hash` returns a different\n // value if anything here changes, to ensure a rebuild is triggered.\n optionsFunction.__pluginFunction = pluginFunction;\n optionsFunction.__configFunction = configFunction;\n return optionsFunction;\n};\nconst _default = createPlugin;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function() {\n return _default;\n }\n});\nconst _createPlugin = /*#__PURE__*/ _interop_require_default(require(\"../util/createPlugin\"));\nfunction _interop_require_default(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n}\nconst _default = _createPlugin.default;\n","let createPlugin = require('./lib/public/create-plugin')\nmodule.exports = (createPlugin.__esModule ? createPlugin : { default: createPlugin }).default\n"],"names":["exports","_default","createPlugin","plugin","config","pluginFunction","configFunction","optionsFunction","options","_createPlugin","_interop_require_default","require$$0","obj"],"mappings":";;;AACA,SAAO,eAAwBA,GAAA,cAAc;AAAA,IACzC,OAAO;AAAA,EACX,CAAC,GACD,OAAO,eAAeA,GAAS,WAAW;AAAA,IACtC,YAAY;AAAA,IACZ,KAAK,WAAW;AACZ,aAAOC;AAAA,IACV;AAAA,EACL,CAAC;AACD,WAASC,EAAaC,GAAQC,GAAQ;AAClC,WAAO;AAAA,MACH,SAASD;AAAA,MACT,QAAAC;AAAA,IACR;AAAA,EACC;AACD,EAAAF,EAAa,cAAc,SAASG,GAAgBC,IAAiB,OAAK,CAAE,IAAG;AAC3E,UAAMC,IAAkB,SAASC,GAAS;AACtC,aAAO;AAAA,QACH,WAAWA;AAAA,QACX,SAASH,EAAeG,CAAO;AAAA,QAC/B,QAAQF,EAAeE,CAAO;AAAA,MAC1C;AAAA,IACA;AACI,WAAAD,EAAgB,sBAAsB,IAGtCA,EAAgB,mBAAmBF,GACnCE,EAAgB,mBAAmBD,GAC5BC;AAAA,EACX;AACA,QAAMN,IAAWC;;;AC9BjB,SAAO,eAAwBF,GAAA,cAAc;AAAA,IACzC,OAAO;AAAA,EACX,CAAC,GACD,OAAO,eAAeA,GAAS,WAAW;AAAA,IACtC,YAAY;AAAA,IACZ,KAAK,WAAW;AACZ,aAAOC;AAAA,IACV;AAAA,EACL,CAAC;AACD,QAAMQ,IAA8B,gBAAAC,EAAyBC,CAA+B;AAC5F,WAASD,EAAyBE,GAAK;AACnC,WAAOA,KAAOA,EAAI,aAAaA,IAAM;AAAA,MACjC,SAASA;AAAA,IACjB;AAAA,EACC;AACD,QAAMX,IAAWQ,EAAc;;AChB/B,IAAIP,IAAeS;AACnB,IAAAR,KAAkBD,EAAa,aAAaA,IAAe,EAAE,SAASA,EAAY,GAAI;;","x_google_ignoreList":[0,1,2]}
1
+ {"version":3,"file":"plugin.js","sources":["../../node_modules/tailwindcss/lib/util/createPlugin.js","../../node_modules/tailwindcss/lib/public/create-plugin.js","../../node_modules/tailwindcss/plugin.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function() {\n return _default;\n }\n});\nfunction createPlugin(plugin, config) {\n return {\n handler: plugin,\n config\n };\n}\ncreatePlugin.withOptions = function(pluginFunction, configFunction = ()=>({})) {\n const optionsFunction = function(options) {\n return {\n __options: options,\n handler: pluginFunction(options),\n config: configFunction(options)\n };\n };\n optionsFunction.__isOptionsFunction = true;\n // Expose plugin dependencies so that `object-hash` returns a different\n // value if anything here changes, to ensure a rebuild is triggered.\n optionsFunction.__pluginFunction = pluginFunction;\n optionsFunction.__configFunction = configFunction;\n return optionsFunction;\n};\nconst _default = createPlugin;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"default\", {\n enumerable: true,\n get: function() {\n return _default;\n }\n});\nconst _createPlugin = /*#__PURE__*/ _interop_require_default(require(\"../util/createPlugin\"));\nfunction _interop_require_default(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n}\nconst _default = _createPlugin.default;\n","let createPlugin = require('./lib/public/create-plugin')\nmodule.exports = (createPlugin.__esModule ? createPlugin : { default: createPlugin }).default\n"],"names":["exports","_default","createPlugin","plugin","config","pluginFunction","configFunction","optionsFunction","options","_createPlugin","_interop_require_default","require$$0","obj"],"mappings":";;;AACA,SAAO,eAAcA,GAAU,cAAc;AAAA,IACzC,OAAO;AAAA,EACX,CAAC,GACD,OAAO,eAAeA,GAAS,WAAW;AAAA,IACtC,YAAY;AAAA,IACZ,KAAK,WAAW;AACZ,aAAOC;AAAA,IACf;AAAA,EACA,CAAC;AACD,WAASC,EAAaC,GAAQC,GAAQ;AAClC,WAAO;AAAA,MACH,SAASD;AAAA,MACT,QAAAC;AAAA,IACR;AAAA,EACA;AACA,EAAAF,EAAa,cAAc,SAASG,GAAgBC,IAAiB,OAAK,CAAA,IAAK;AAC3E,UAAMC,IAAkB,SAASC,GAAS;AACtC,aAAO;AAAA,QACH,WAAWA;AAAA,QACX,SAASH,EAAeG,CAAO;AAAA,QAC/B,QAAQF,EAAeE,CAAO;AAAA,MAC1C;AAAA,IACA;AACI,WAAAD,EAAgB,sBAAsB,IAGtCA,EAAgB,mBAAmBF,GACnCE,EAAgB,mBAAmBD,GAC5BC;AAAA,EACX;AACA,QAAMN,IAAWC;;;AC9BjB,SAAO,eAAcF,GAAU,cAAc;AAAA,IACzC,OAAO;AAAA,EACX,CAAC,GACD,OAAO,eAAeA,GAAS,WAAW;AAAA,IACtC,YAAY;AAAA,IACZ,KAAK,WAAW;AACZ,aAAOC;AAAA,IACf;AAAA,EACA,CAAC;AACD,QAAMQ,IAA8B,gBAAAC,EAAyBC,CAA+B;AAC5F,WAASD,EAAyBE,GAAK;AACnC,WAAOA,KAAOA,EAAI,aAAaA,IAAM;AAAA,MACjC,SAASA;AAAA,IACjB;AAAA,EACA;AACA,QAAMX,IAAWQ,EAAc;;AChB/B,IAAIP,IAAeS;AACnB,IAAAR,KAAkBD,EAAa,aAAaA,IAAe,EAAE,SAASA,KAAgB;;","x_google_ignoreList":[0,1,2]}
@@ -1,22 +1,2 @@
1
- import { type FunctionComponent, type PropsWithChildren } from 'react';
2
- declare const QUERIES: {
3
- MOBILE: string;
4
- TABLET: string;
5
- DESKTOP: string;
6
- };
7
- type Devices = Lowercase<keyof typeof QUERIES>;
8
- type Direction = 'ltr' | 'rtl';
9
- interface Props {
10
- device: Devices;
11
- direction?: Direction;
12
- }
13
- export interface DeviceContext {
14
- desktop: boolean;
15
- mobile: boolean;
16
- tablet: boolean;
17
- direction: Direction;
18
- }
19
- export declare const DeviceProvider: FunctionComponent<PropsWithChildren<Props>>;
20
- export declare function useDevice(device: Devices): boolean;
21
- export declare function useDevice(direction: 'direction'): Direction;
22
- export {};
1
+ export * from '../types/Devices';
2
+ export * from './Devices/Device';
@@ -1,62 +1,8 @@
1
- "use client";
2
- import { jsx as p } from "react/jsx-runtime";
3
- import { createContext as m, useReducer as h, useEffect as w, useContext as v } from "react";
4
- const n = {
5
- MOBILE: "(min-width: 0)",
6
- TABLET: "(min-width: 640px)",
7
- DESKTOP: "(min-width: 768px)"
8
- }, c = m(null), E = (e, t) => {
9
- switch (t.type) {
10
- case "mobile":
11
- return e;
12
- case "desktop":
13
- return {
14
- ...e,
15
- desktop: t.payload
16
- };
17
- case "tablet":
18
- return {
19
- ...e,
20
- tablet: t.payload
21
- };
22
- default:
23
- return e;
24
- }
25
- }, b = ({ device: e, direction: t }) => typeof window < "u" ? {
26
- direction: t,
27
- desktop: window.matchMedia(n.DESKTOP).matches,
28
- mobile: !0,
29
- tablet: window.matchMedia(n.TABLET).matches
30
- } : {
31
- direction: t,
32
- desktop: e === "desktop",
33
- mobile: !0,
34
- tablet: e === "tablet" || e === "desktop"
35
- }, D = ({
36
- children: e,
37
- device: t,
38
- direction: l = "ltr"
39
- }) => {
40
- const [u, o] = h(E, { device: t, direction: l }, b);
41
- return w(() => {
42
- const s = window.matchMedia(n.DESKTOP), i = window.matchMedia(n.TABLET), a = ({ matches: r }) => {
43
- o({ type: "desktop", payload: r });
44
- }, d = ({ matches: r }) => {
45
- o({ type: "tablet", payload: r });
46
- };
47
- return s.addEventListener("change", a, { passive: !0 }), i.addEventListener("change", d, { passive: !0 }), () => {
48
- s.removeEventListener("change", a), i.removeEventListener("change", d);
49
- };
50
- }, []), /* @__PURE__ */ p(c.Provider, { value: u, children: e });
51
- };
52
- function k(e) {
53
- const t = v(c);
54
- if (t === null)
55
- throw new Error("useDevice(string) should be used in DeviceContext.Provider");
56
- return t[e];
57
- }
1
+ import { QUERIES as o } from "../types/Devices.js";
2
+ import { DeviceProvider as v, useDevice as c } from "./Devices/Device.js";
58
3
  export {
59
- D as DeviceProvider,
60
- k as useDevice
4
+ v as DeviceProvider,
5
+ o as QUERIES,
6
+ c as useDevice
61
7
  };
62
8
  //# sourceMappingURL=Device.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Device.js","sources":["../../lib/contexts/Device.tsx"],"sourcesContent":["'use client';\n\nimport {\n createContext,\n useContext,\n useEffect,\n useReducer,\n type FunctionComponent,\n type PropsWithChildren,\n} from 'react';\n\nconst QUERIES = {\n MOBILE: '(min-width: 0)',\n TABLET: '(min-width: 640px)',\n DESKTOP: '(min-width: 768px)',\n}; // this is all so incredibly temporary don't sue me\n\ntype Devices = Lowercase<keyof typeof QUERIES>;\n\ntype Direction = 'ltr' | 'rtl';\n\ninterface Props {\n device: Devices;\n direction?: Direction;\n}\nexport interface DeviceContext {\n desktop: boolean;\n mobile: boolean;\n tablet: boolean;\n direction: Direction;\n}\n\nconst DeviceContext = createContext<DeviceContext | null>(null);\n\nconst reducer = (state: DeviceContext, action: { type: string; payload: boolean }) => {\n switch (action.type) {\n case 'mobile':\n return state;\n case 'desktop':\n return {\n ...state,\n desktop: action.payload,\n };\n case 'tablet':\n return {\n ...state,\n tablet: action.payload,\n };\n default:\n return state;\n }\n};\n\nconst getInitialState = ({ device, direction }: { device: Devices; direction: Direction }) => {\n if (typeof window !== 'undefined') {\n return {\n direction,\n desktop: window.matchMedia(QUERIES.DESKTOP).matches,\n mobile: true,\n tablet: window.matchMedia(QUERIES.TABLET).matches,\n };\n }\n\n return {\n direction,\n desktop: device === 'desktop',\n mobile: true,\n tablet: device === 'tablet' || device === 'desktop',\n };\n};\n\nexport const DeviceProvider: FunctionComponent<PropsWithChildren<Props>> = ({\n children,\n device,\n direction = 'ltr',\n}) => {\n const [state, dispatch] = useReducer(reducer, { device, direction }, getInitialState);\n\n useEffect(() => {\n const mqlDesktop = window.matchMedia(QUERIES.DESKTOP);\n const mqlTablet = window.matchMedia(QUERIES.TABLET);\n\n const listenerDesktop = ({ matches }: MediaQueryListEventMap['change']) => {\n dispatch({ type: 'desktop', payload: matches });\n };\n const listenerTablet = ({ matches }: MediaQueryListEventMap['change']) => {\n dispatch({ type: 'tablet', payload: matches });\n };\n\n mqlDesktop.addEventListener('change', listenerDesktop, { passive: true });\n mqlTablet.addEventListener('change', listenerTablet, { passive: true });\n\n return () => {\n mqlDesktop.removeEventListener('change', listenerDesktop);\n mqlTablet.removeEventListener('change', listenerTablet);\n };\n }, []);\n\n return <DeviceContext.Provider value={state}>{children}</DeviceContext.Provider>;\n};\n\nexport function useDevice(device: Devices): boolean;\nexport function useDevice(direction: 'direction'): Direction;\nexport function useDevice(device: Devices | 'direction') {\n const context = useContext(DeviceContext);\n\n if (context === null) {\n throw new Error('useDevice(string) should be used in DeviceContext.Provider');\n }\n\n return context[device];\n}\n"],"names":["QUERIES","DeviceContext","createContext","reducer","state","action","getInitialState","device","direction","DeviceProvider","children","dispatch","useReducer","useEffect","mqlDesktop","mqlTablet","listenerDesktop","matches","listenerTablet","useDevice","context","useContext"],"mappings":";;;AAWA,MAAMA,IAAU;AAAA,EACd,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AACX,GAiBMC,IAAgBC,EAAoC,IAAI,GAExDC,IAAU,CAACC,GAAsBC,MAA+C;AACpF,UAAQA,EAAO,MAAM;AAAA,IACnB,KAAK;AACI,aAAAD;AAAA,IACT,KAAK;AACI,aAAA;AAAA,QACL,GAAGA;AAAA,QACH,SAASC,EAAO;AAAA,MAAA;AAAA,IAEpB,KAAK;AACI,aAAA;AAAA,QACL,GAAGD;AAAA,QACH,QAAQC,EAAO;AAAA,MAAA;AAAA,IAEnB;AACS,aAAAD;AAAA,EACX;AACF,GAEME,IAAkB,CAAC,EAAE,QAAAC,GAAQ,WAAAC,QAC7B,OAAO,SAAW,MACb;AAAA,EACL,WAAAA;AAAA,EACA,SAAS,OAAO,WAAWR,EAAQ,OAAO,EAAE;AAAA,EAC5C,QAAQ;AAAA,EACR,QAAQ,OAAO,WAAWA,EAAQ,MAAM,EAAE;AAAA,IAIvC;AAAA,EACL,WAAAQ;AAAA,EACA,SAASD,MAAW;AAAA,EACpB,QAAQ;AAAA,EACR,QAAQA,MAAW,YAAYA,MAAW;AAAA,GAIjCE,IAA8D,CAAC;AAAA,EAC1E,UAAAC;AAAA,EACA,QAAAH;AAAA,EACA,WAAAC,IAAY;AACd,MAAM;AACE,QAAA,CAACJ,GAAOO,CAAQ,IAAIC,EAAWT,GAAS,EAAE,QAAAI,GAAQ,WAAAC,KAAaF,CAAe;AAEpF,SAAAO,EAAU,MAAM;AACd,UAAMC,IAAa,OAAO,WAAWd,EAAQ,OAAO,GAC9Ce,IAAY,OAAO,WAAWf,EAAQ,MAAM,GAE5CgB,IAAkB,CAAC,EAAE,SAAAC,QAAgD;AACzE,MAAAN,EAAS,EAAE,MAAM,WAAW,SAASM,EAAS,CAAA;AAAA,IAAA,GAE1CC,IAAiB,CAAC,EAAE,SAAAD,QAAgD;AACxE,MAAAN,EAAS,EAAE,MAAM,UAAU,SAASM,EAAS,CAAA;AAAA,IAAA;AAG/C,WAAAH,EAAW,iBAAiB,UAAUE,GAAiB,EAAE,SAAS,IAAM,GACxED,EAAU,iBAAiB,UAAUG,GAAgB,EAAE,SAAS,IAAM,GAE/D,MAAM;AACA,MAAAJ,EAAA,oBAAoB,UAAUE,CAAe,GAC9CD,EAAA,oBAAoB,UAAUG,CAAc;AAAA,IAAA;AAAA,EAE1D,GAAG,CAAE,CAAA,qBAEGjB,EAAc,UAAd,EAAuB,OAAOG,GAAQ,UAAAM,EAAS,CAAA;AACzD;AAIO,SAASS,EAAUZ,GAA+B;AACjD,QAAAa,IAAUC,EAAWpB,CAAa;AAExC,MAAImB,MAAY;AACR,UAAA,IAAI,MAAM,4DAA4D;AAG9E,SAAOA,EAAQb,CAAM;AACvB;"}
1
+ {"version":3,"file":"Device.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -0,0 +1,11 @@
1
+ import { type FunctionComponent, type PropsWithChildren } from 'react';
2
+ import type { Direction } from '../../types/Direction';
3
+ import type { Devices } from '../Device';
4
+ interface Props {
5
+ device: Devices;
6
+ direction?: Direction;
7
+ }
8
+ export declare const DeviceProvider: FunctionComponent<PropsWithChildren<Props>>;
9
+ export declare function useDevice(device: Devices): device is Devices;
10
+ export declare function useDevice(direction: 'direction'): Direction;
11
+ export {};
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ import { jsx as i } from "react/jsx-runtime";
3
+ import { createContext as s, useContext as u } from "react";
4
+ import { useQueries as c } from "./hooks/useQueries.js";
5
+ const r = s(null), m = ({
6
+ children: t,
7
+ device: e,
8
+ direction: o = "ltr"
9
+ }) => {
10
+ const n = c({ device: e, direction: o });
11
+ return /* @__PURE__ */ i(r.Provider, { value: n, children: t });
12
+ };
13
+ function d(t) {
14
+ const e = u(r);
15
+ if (e === null)
16
+ throw new Error("useDevice(string) should be used in DeviceContext.Provider");
17
+ return e[t];
18
+ }
19
+ export {
20
+ m as DeviceProvider,
21
+ d as useDevice
22
+ };
23
+ //# sourceMappingURL=Device.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Device.js","sources":["../../../lib/contexts/Devices/Device.tsx"],"sourcesContent":["'use client';\n\nimport { createContext, type FunctionComponent, type PropsWithChildren, useContext } from 'react';\nimport type { Direction } from '@/types/Direction';\nimport { useQueries } from '@/contexts/Devices/hooks/useQueries';\nimport type { Devices } from '../Device';\nimport type { DeviceState } from './reducers/reducer';\n\ninterface Props {\n device: Devices;\n direction?: Direction;\n}\n\nconst DeviceContext = createContext<DeviceState | null>(null);\n\nexport const DeviceProvider: FunctionComponent<PropsWithChildren<Props>> = ({\n children,\n device,\n direction = 'ltr',\n}) => {\n const state = useQueries({ device: device, direction: direction });\n\n return <DeviceContext.Provider value={state}>{children}</DeviceContext.Provider>;\n};\n\nexport function useDevice(device: Devices): device is Devices;\nexport function useDevice(direction: 'direction'): Direction;\nexport function useDevice(device: Devices | 'direction') {\n const context = useContext(DeviceContext);\n\n if (context === null) {\n throw new Error('useDevice(string) should be used in DeviceContext.Provider');\n }\n\n return context[device];\n}\n"],"names":["DeviceContext","createContext","DeviceProvider","children","device","direction","state","useQueries","useDevice","context","useContext"],"mappings":";;;;AAaA,MAAMA,IAAgBC,EAAkC,IAAI,GAE/CC,IAA8D,CAAC;AAAA,EAC1E,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,WAAAC,IAAY;AACd,MAAM;AACJ,QAAMC,IAAQC,EAAW,EAAE,QAAAH,GAAgB,WAAAC,GAAsB;AAEjE,2BAAQL,EAAc,UAAd,EAAuB,OAAOM,GAAQ,UAAAH,GAAS;AACzD;AAIO,SAASK,EAAUJ,GAA+B;AACvD,QAAMK,IAAUC,EAAWV,CAAa;AAExC,MAAIS,MAAY;AACd,UAAM,IAAI,MAAM,4DAA4D;AAG9E,SAAOA,EAAQL,CAAM;AACvB;"}
@@ -0,0 +1,6 @@
1
+ import type { Direction } from '../../../types/Direction';
2
+ import { type Devices } from '../../../types/Devices';
3
+ export declare function useQueries({ device, direction }: {
4
+ device: Devices;
5
+ direction: Direction;
6
+ }): import('../reducers/reducer').DeviceState;
@@ -0,0 +1,24 @@
1
+ import { useReducer as v, useEffect as L } from "react";
2
+ import { reducer as g, getInitialState as E } from "../reducers/reducer.js";
3
+ import { QUERIES as n } from "../../../types/Devices.js";
4
+ function y({ device: l, direction: p }) {
5
+ const [u, t] = v(g, { device: l, direction: p }, E);
6
+ return L(() => {
7
+ const a = window.matchMedia(n.SMALL), r = window.matchMedia(n.MEDIUM), s = window.matchMedia(n.LARGE), i = window.matchMedia(n.XLARGE), o = ({ matches: e }) => {
8
+ t({ type: "small", payload: e });
9
+ }, c = ({ matches: e }) => {
10
+ t({ type: "medium", payload: e });
11
+ }, d = ({ matches: e }) => {
12
+ t({ type: "large", payload: e });
13
+ }, m = ({ matches: e }) => {
14
+ t({ type: "xlarge", payload: e });
15
+ };
16
+ return a.addEventListener("change", o, { passive: !0 }), r.addEventListener("change", c, { passive: !0 }), s.addEventListener("change", d, { passive: !0 }), i.addEventListener("change", m, { passive: !0 }), () => {
17
+ a.removeEventListener("change", o), r.removeEventListener("change", c), s.removeEventListener("change", d), i.removeEventListener("change", m);
18
+ };
19
+ }, []), u;
20
+ }
21
+ export {
22
+ y as useQueries
23
+ };
24
+ //# sourceMappingURL=useQueries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useQueries.js","sources":["../../../../lib/contexts/Devices/hooks/useQueries.ts"],"sourcesContent":["import type { Direction } from '@/types/Direction';\nimport { useEffect, useReducer } from 'react';\nimport { getInitialState, reducer } from '@/contexts/Devices/reducers/reducer';\nimport { QUERIES, type Devices } from '@/types/Devices';\n\nexport function useQueries({ device, direction }: { device: Devices; direction: Direction }) {\n const [state, dispatch] = useReducer(reducer, { device, direction }, getInitialState);\n\n useEffect(() => {\n const mqlSmall = window.matchMedia(QUERIES.SMALL);\n const mqlMedium = window.matchMedia(QUERIES.MEDIUM);\n const mqlLarge = window.matchMedia(QUERIES.LARGE);\n const mqlXLarge = window.matchMedia(QUERIES.XLARGE);\n\n const listenerSmall = ({ matches }: MediaQueryListEventMap['change']) => {\n dispatch({ type: 'small', payload: matches });\n };\n const listenerMedium = ({ matches }: MediaQueryListEventMap['change']) => {\n dispatch({ type: 'medium', payload: matches });\n };\n const listenerLarge = ({ matches }: MediaQueryListEventMap['change']) => {\n dispatch({ type: 'large', payload: matches });\n };\n const listenerXLarge = ({ matches }: MediaQueryListEventMap['change']) => {\n dispatch({ type: 'xlarge', payload: matches });\n };\n\n mqlSmall.addEventListener('change', listenerSmall, { passive: true });\n mqlMedium.addEventListener('change', listenerMedium, { passive: true });\n mqlLarge.addEventListener('change', listenerLarge, { passive: true });\n mqlXLarge.addEventListener('change', listenerXLarge, { passive: true });\n\n return () => {\n mqlSmall.removeEventListener('change', listenerSmall);\n mqlMedium.removeEventListener('change', listenerMedium);\n mqlLarge.removeEventListener('change', listenerLarge);\n mqlXLarge.removeEventListener('change', listenerXLarge);\n };\n }, []);\n return state;\n}\n"],"names":["useQueries","device","direction","state","dispatch","useReducer","reducer","getInitialState","useEffect","mqlSmall","QUERIES","mqlMedium","mqlLarge","mqlXLarge","listenerSmall","matches","listenerMedium","listenerLarge","listenerXLarge"],"mappings":";;;AAKO,SAASA,EAAW,EAAE,QAAAC,GAAQ,WAAAC,KAAwD;AAC3F,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAAWC,GAAS,EAAE,QAAAL,GAAQ,WAAAC,EAAA,GAAaK,CAAe;AAEpF,SAAAC,EAAU,MAAM;AACd,UAAMC,IAAW,OAAO,WAAWC,EAAQ,KAAK,GAC1CC,IAAY,OAAO,WAAWD,EAAQ,MAAM,GAC5CE,IAAW,OAAO,WAAWF,EAAQ,KAAK,GAC1CG,IAAY,OAAO,WAAWH,EAAQ,MAAM,GAE5CI,IAAgB,CAAC,EAAE,SAAAC,QAAgD;AACvE,MAAAX,EAAS,EAAE,MAAM,SAAS,SAASW,GAAS;AAAA,IAC9C,GACMC,IAAiB,CAAC,EAAE,SAAAD,QAAgD;AACxE,MAAAX,EAAS,EAAE,MAAM,UAAU,SAASW,GAAS;AAAA,IAC/C,GACME,IAAgB,CAAC,EAAE,SAAAF,QAAgD;AACvE,MAAAX,EAAS,EAAE,MAAM,SAAS,SAASW,GAAS;AAAA,IAC9C,GACMG,IAAiB,CAAC,EAAE,SAAAH,QAAgD;AACxE,MAAAX,EAAS,EAAE,MAAM,UAAU,SAASW,GAAS;AAAA,IAC/C;AAEA,WAAAN,EAAS,iBAAiB,UAAUK,GAAe,EAAE,SAAS,IAAM,GACpEH,EAAU,iBAAiB,UAAUK,GAAgB,EAAE,SAAS,IAAM,GACtEJ,EAAS,iBAAiB,UAAUK,GAAe,EAAE,SAAS,IAAM,GACpEJ,EAAU,iBAAiB,UAAUK,GAAgB,EAAE,SAAS,IAAM,GAE/D,MAAM;AACX,MAAAT,EAAS,oBAAoB,UAAUK,CAAa,GACpDH,EAAU,oBAAoB,UAAUK,CAAc,GACtDJ,EAAS,oBAAoB,UAAUK,CAAa,GACpDJ,EAAU,oBAAoB,UAAUK,CAAc;AAAA,IACxD;AAAA,EACF,GAAG,CAAA,CAAE,GACEf;AACT;"}
@@ -0,0 +1,25 @@
1
+ import type { Direction } from '../../../types/Direction';
2
+ import { type Devices } from '../../../types/Devices';
3
+ export interface DeviceState {
4
+ all: boolean;
5
+ small: boolean;
6
+ medium: boolean;
7
+ large: boolean;
8
+ xlarge: boolean;
9
+ direction: Direction;
10
+ }
11
+ export declare const reducer: (state: DeviceState, action: {
12
+ type: string;
13
+ payload: boolean;
14
+ }) => DeviceState;
15
+ export declare const getInitialState: ({ device, direction, }: {
16
+ device: Devices;
17
+ direction: Direction;
18
+ }) => {
19
+ direction: Direction;
20
+ all: boolean;
21
+ small: boolean;
22
+ medium: boolean;
23
+ large: boolean;
24
+ xlarge: boolean;
25
+ };
@@ -0,0 +1,50 @@
1
+ import { QUERIES as r } from "../../../types/Devices.js";
2
+ const m = (a, l) => {
3
+ switch (l.type) {
4
+ case "small":
5
+ return {
6
+ ...a,
7
+ small: l.payload
8
+ };
9
+ case "medium":
10
+ return {
11
+ ...a,
12
+ medium: l.payload
13
+ };
14
+ case "large":
15
+ return {
16
+ ...a,
17
+ large: l.payload
18
+ };
19
+ case "xlarge":
20
+ return {
21
+ ...a,
22
+ xlarge: l.payload
23
+ };
24
+ case "all":
25
+ default:
26
+ return a;
27
+ }
28
+ }, u = ({
29
+ device: a,
30
+ direction: l
31
+ }) => typeof window < "u" ? {
32
+ direction: l,
33
+ all: !0,
34
+ small: window.matchMedia(r.SMALL).matches,
35
+ medium: window.matchMedia(r.MEDIUM).matches,
36
+ large: window.matchMedia(r.LARGE).matches,
37
+ xlarge: window.matchMedia(r.XLARGE).matches
38
+ } : {
39
+ direction: l,
40
+ all: !0,
41
+ small: a === "small" || a === "medium" || a === "large" || a === "xlarge",
42
+ medium: a === "medium" || a === "large" || a === "xlarge",
43
+ large: a === "large" || a === "xlarge",
44
+ xlarge: a === "xlarge"
45
+ };
46
+ export {
47
+ u as getInitialState,
48
+ m as reducer
49
+ };
50
+ //# sourceMappingURL=reducer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reducer.js","sources":["../../../../lib/contexts/Devices/reducers/reducer.ts"],"sourcesContent":["import type { Direction } from '@/types/Direction';\nimport { type Devices, QUERIES } from '@/types/Devices';\n\nexport interface DeviceState {\n all: boolean;\n small: boolean;\n medium: boolean;\n large: boolean;\n xlarge: boolean;\n direction: Direction;\n}\n\nexport const reducer = (state: DeviceState, action: { type: string; payload: boolean }) => {\n switch (action.type) {\n case 'small':\n return {\n ...state,\n small: action.payload,\n };\n case 'medium':\n return {\n ...state,\n medium: action.payload,\n };\n case 'large':\n return {\n ...state,\n large: action.payload,\n };\n case 'xlarge':\n return {\n ...state,\n xlarge: action.payload,\n };\n case 'all':\n default:\n return state;\n }\n};\n\nexport const getInitialState = ({\n device,\n direction,\n}: {\n device: Devices;\n direction: Direction;\n}) => {\n if (typeof window !== 'undefined') {\n return {\n direction,\n all: true,\n small: window.matchMedia(QUERIES.SMALL).matches,\n medium: window.matchMedia(QUERIES.MEDIUM).matches,\n large: window.matchMedia(QUERIES.LARGE).matches,\n xlarge: window.matchMedia(QUERIES.XLARGE).matches,\n };\n }\n\n return {\n direction,\n all: true,\n small: device === 'small' || device === 'medium' || device === 'large' || device === 'xlarge',\n medium: device === 'medium' || device === 'large' || device === 'xlarge',\n large: device === 'large' || device === 'xlarge',\n xlarge: device === 'xlarge',\n };\n};\n"],"names":["reducer","state","action","getInitialState","device","direction","QUERIES"],"mappings":";AAYO,MAAMA,IAAU,CAACC,GAAoBC,MAA+C;AACzF,UAAQA,EAAO,MAAA;AAAA,IACb,KAAK;AACH,aAAO;AAAA,QACL,GAAGD;AAAA,QACH,OAAOC,EAAO;AAAA,MAAA;AAAA,IAElB,KAAK;AACH,aAAO;AAAA,QACL,GAAGD;AAAA,QACH,QAAQC,EAAO;AAAA,MAAA;AAAA,IAEnB,KAAK;AACH,aAAO;AAAA,QACL,GAAGD;AAAA,QACH,OAAOC,EAAO;AAAA,MAAA;AAAA,IAElB,KAAK;AACH,aAAO;AAAA,QACL,GAAGD;AAAA,QACH,QAAQC,EAAO;AAAA,MAAA;AAAA,IAEnB,KAAK;AAAA,IACL;AACE,aAAOD;AAAA,EAAA;AAEb,GAEaE,IAAkB,CAAC;AAAA,EAC9B,QAAAC;AAAA,EACA,WAAAC;AACF,MAIM,OAAO,SAAW,MACb;AAAA,EACL,WAAAA;AAAA,EACA,KAAK;AAAA,EACL,OAAO,OAAO,WAAWC,EAAQ,KAAK,EAAE;AAAA,EACxC,QAAQ,OAAO,WAAWA,EAAQ,MAAM,EAAE;AAAA,EAC1C,OAAO,OAAO,WAAWA,EAAQ,KAAK,EAAE;AAAA,EACxC,QAAQ,OAAO,WAAWA,EAAQ,MAAM,EAAE;AAAA,IAIvC;AAAA,EACL,WAAAD;AAAA,EACA,KAAK;AAAA,EACL,OAAOD,MAAW,WAAWA,MAAW,YAAYA,MAAW,WAAWA,MAAW;AAAA,EACrF,QAAQA,MAAW,YAAYA,MAAW,WAAWA,MAAW;AAAA,EAChE,OAAOA,MAAW,WAAWA,MAAW;AAAA,EACxC,QAAQA,MAAW;AAAA;"}