@optimum-intelligence/opti-ui 0.9.2 → 1.0.0

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 (100) hide show
  1. package/CHANGELOG.md +92 -0
  2. package/README.md +5 -1
  3. package/dist/components/app-shell/AppShell.d.ts +30 -1
  4. package/dist/components/app-shell/AppShell.js +387 -236
  5. package/dist/components/app-shell/AppShell.js.map +1 -1
  6. package/dist/components/avatar/Avatar.d.ts +1 -1
  7. package/dist/components/avatar/Avatar.js +64 -52
  8. package/dist/components/avatar/Avatar.js.map +1 -1
  9. package/dist/components/calendar/Calendar.js +6 -4
  10. package/dist/components/calendar/Calendar.js.map +1 -1
  11. package/dist/components/calendar/date-utils.js +1 -1
  12. package/dist/components/calendar/date-utils.js.map +1 -1
  13. package/dist/components/card/Card.d.ts +24 -5
  14. package/dist/components/card/Card.js +36 -23
  15. package/dist/components/card/Card.js.map +1 -1
  16. package/dist/components/collapsible/Collapsible.d.ts +8 -1
  17. package/dist/components/collapsible/Collapsible.js +32 -25
  18. package/dist/components/collapsible/Collapsible.js.map +1 -1
  19. package/dist/components/data-table/DataTable.d.ts +21 -4
  20. package/dist/components/data-table/DataTable.js +310 -100
  21. package/dist/components/data-table/DataTable.js.map +1 -1
  22. package/dist/components/data-table/DataTableContent.d.ts +1 -7
  23. package/dist/components/data-table/DataTableContent.js +209 -243
  24. package/dist/components/data-table/DataTableContent.js.map +1 -1
  25. package/dist/components/data-table/DataTableFilters.js +47 -57
  26. package/dist/components/data-table/DataTableFilters.js.map +1 -1
  27. package/dist/components/data-table/DataTableRow.js +105 -90
  28. package/dist/components/data-table/DataTableRow.js.map +1 -1
  29. package/dist/components/data-table/layout.d.ts +0 -5
  30. package/dist/components/data-table/layout.js +1 -23
  31. package/dist/components/data-table/layout.js.map +1 -1
  32. package/dist/components/data-table/types.d.ts +5 -2
  33. package/dist/components/data-table/useDataTable.js +249 -221
  34. package/dist/components/data-table/useDataTable.js.map +1 -1
  35. package/dist/components/date-picker/DateRangePicker.js +1 -0
  36. package/dist/components/date-picker/DateRangePicker.js.map +1 -1
  37. package/dist/components/date-picker/PickerField.js +98 -101
  38. package/dist/components/date-picker/PickerField.js.map +1 -1
  39. package/dist/components/description-list/DescriptionList.d.ts +3 -1
  40. package/dist/components/description-list/DescriptionList.js +3 -1
  41. package/dist/components/description-list/DescriptionList.js.map +1 -1
  42. package/dist/components/drawer/Drawer.d.ts +1 -1
  43. package/dist/components/drawer/Drawer.js +173 -87
  44. package/dist/components/drawer/Drawer.js.map +1 -1
  45. package/dist/components/file-upload/FileUpload.js +7 -0
  46. package/dist/components/file-upload/FileUpload.js.map +1 -1
  47. package/dist/components/link/Link.d.ts +1 -1
  48. package/dist/components/link/Link.js +57 -74
  49. package/dist/components/link/Link.js.map +1 -1
  50. package/dist/components/map/Map.d.ts +14 -2
  51. package/dist/components/map/Map.js +194 -153
  52. package/dist/components/map/Map.js.map +1 -1
  53. package/dist/components/pagination/Pagination.js +2 -0
  54. package/dist/components/pagination/Pagination.js.map +1 -1
  55. package/dist/components/scroll-area/ScrollArea.d.ts +18 -2
  56. package/dist/components/scroll-area/ScrollArea.js +89 -61
  57. package/dist/components/scroll-area/ScrollArea.js.map +1 -1
  58. package/dist/components/spinner/Spinner.js +34 -26
  59. package/dist/components/spinner/Spinner.js.map +1 -1
  60. package/dist/components/stat-card/StatCard.js +36 -22
  61. package/dist/components/stat-card/StatCard.js.map +1 -1
  62. package/dist/components/table/Table.d.ts +9 -2
  63. package/dist/components/table/Table.js +87 -63
  64. package/dist/components/table/Table.js.map +1 -1
  65. package/dist/components/tag/Tag.js +79 -103
  66. package/dist/components/tag/Tag.js.map +1 -1
  67. package/dist/components/toolbar/Toolbar.d.ts +2 -1
  68. package/dist/components/toolbar/Toolbar.js +23 -15
  69. package/dist/components/toolbar/Toolbar.js.map +1 -1
  70. package/dist/components/typography/Typography.d.ts +7 -1
  71. package/dist/components/typography/Typography.js +21 -18
  72. package/dist/components/typography/Typography.js.map +1 -1
  73. package/dist/components.json +134 -26
  74. package/dist/fonts/Montserrat-OFL.txt +93 -0
  75. package/dist/fonts/Poppins-OFL.txt +93 -0
  76. package/dist/fonts/montserrat-latin-ext.woff2 +0 -0
  77. package/dist/fonts/montserrat-latin.woff2 +0 -0
  78. package/dist/fonts/poppins-latin-400.woff2 +0 -0
  79. package/dist/fonts/poppins-latin-500.woff2 +0 -0
  80. package/dist/fonts/poppins-latin-600.woff2 +0 -0
  81. package/dist/fonts/poppins-latin-700.woff2 +0 -0
  82. package/dist/fonts/poppins-latin-ext-400.woff2 +0 -0
  83. package/dist/fonts/poppins-latin-ext-500.woff2 +0 -0
  84. package/dist/fonts/poppins-latin-ext-600.woff2 +0 -0
  85. package/dist/fonts/poppins-latin-ext-700.woff2 +0 -0
  86. package/dist/fonts.css +104 -4
  87. package/dist/index.js +2 -2
  88. package/dist/labels/Labels.d.ts +12 -0
  89. package/dist/labels/Labels.js +6 -0
  90. package/dist/labels/Labels.js.map +1 -1
  91. package/dist/labels/hu.js +9 -3
  92. package/dist/labels/hu.js.map +1 -1
  93. package/dist/llms-full.txt +103 -20
  94. package/dist/llms.txt +15 -10
  95. package/dist/opti-ui.css +566 -197
  96. package/dist/reset.css +33 -0
  97. package/dist/utils/focus.d.ts +8 -0
  98. package/dist/utils/focus.js +39 -0
  99. package/dist/utils/focus.js.map +1 -0
  100. package/package.json +2 -1
package/dist/reset.css ADDED
@@ -0,0 +1,33 @@
1
+ /*
2
+ * Optional element reset: import '@optimum-intelligence/opti-ui/reset.css'. Its rules sit in the `oui-reset`
3
+ * layer, ordered before the library's layers, so components and any app CSS win over it. If your app declares
4
+ * its own layer order before importing opti-ui, list `oui-reset` first there too.
5
+ */
6
+ @layer oui-reset, maplibre, oui.tokens, oui.base, oui.components;
7
+
8
+ @layer oui-reset {
9
+ *,
10
+ *::before,
11
+ *::after {
12
+ box-sizing: border-box;
13
+ margin: 0;
14
+ padding: 0;
15
+ }
16
+
17
+ /* The app's own root element (#root, #app…) needs `height: 100%` too for a full-height layout. */
18
+ html,
19
+ body {
20
+ height: 100%;
21
+ }
22
+
23
+ body {
24
+ line-height: 1.5;
25
+ }
26
+
27
+ button,
28
+ input,
29
+ select,
30
+ textarea {
31
+ font: inherit;
32
+ }
33
+ }
@@ -0,0 +1,8 @@
1
+ /** Whether the focus has fallen back to the page, as it does when the focused element is removed. */
2
+ export declare function focusLost(): boolean;
3
+ /**
4
+ * Call when pressing `element` (a remove or delete button) will remove its item from a list, now or once an async
5
+ * update lands. When the item is gone and the focus fell with it, the focus moves to the item that took its place,
6
+ * else the one before it (`target` inside it, or the item itself when it matches), else to `fallback`.
7
+ */
8
+ export declare function refocusOnRemoval(element: HTMLElement, scope: HTMLElement, item: string, target: string, fallback?: () => HTMLElement | null | undefined): void;
@@ -0,0 +1,39 @@
1
+ "use client";
2
+ //#region src/utils/focus.ts
3
+ /** Whether the focus has fallen back to the page, as it does when the focused element is removed. */
4
+ function focusLost() {
5
+ const active = document.activeElement;
6
+ return !active || active === document.body;
7
+ }
8
+ /**
9
+ * Call when pressing `element` (a remove or delete button) will remove its item from a list, now or once an async
10
+ * update lands. When the item is gone and the focus fell with it, the focus moves to the item that took its place,
11
+ * else the one before it (`target` inside it, or the item itself when it matches), else to `fallback`.
12
+ */
13
+ function refocusOnRemoval(element, scope, item, target, fallback) {
14
+ const items = () => Array.from(scope.querySelectorAll(item));
15
+ const removed = element.closest(item);
16
+ const index = removed ? items().indexOf(removed) : -1;
17
+ if (index < 0 || typeof MutationObserver === "undefined") return;
18
+ const observer = new MutationObserver(() => {
19
+ if (removed.isConnected) return;
20
+ stop();
21
+ if (!focusLost()) return;
22
+ const rest = items();
23
+ const next = rest[index] ?? rest[index - 1];
24
+ ((next && (next.matches(target) ? next : next.querySelector(target))) ?? fallback?.())?.focus();
25
+ });
26
+ const timer = setTimeout(() => stop(), 3e4);
27
+ const stop = () => {
28
+ observer.disconnect();
29
+ clearTimeout(timer);
30
+ };
31
+ observer.observe(scope, {
32
+ childList: true,
33
+ subtree: true
34
+ });
35
+ }
36
+ //#endregion
37
+ export { focusLost, refocusOnRemoval };
38
+
39
+ //# sourceMappingURL=focus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focus.js","names":["focusLost","active","document","activeElement","body","refocusOnRemoval","element","HTMLElement","scope","item","target","fallback","items","Array","from","querySelectorAll","removed","closest","index","indexOf","MutationObserver","observer","isConnected","stop","rest","next","focusable","matches","querySelector","focus","timer","setTimeout","disconnect","clearTimeout","observe","childList","subtree"],"sources":["../../src/utils/focus.ts"],"sourcesContent":["/** Whether the focus has fallen back to the page, as it does when the focused element is removed. */\nexport function focusLost() {\n const active = document.activeElement;\n return !active || active === document.body;\n}\n\n/**\n * Call when pressing `element` (a remove or delete button) will remove its item from a list, now or once an async\n * update lands. When the item is gone and the focus fell with it, the focus moves to the item that took its place,\n * else the one before it (`target` inside it, or the item itself when it matches), else to `fallback`.\n */\nexport function refocusOnRemoval(\n element: HTMLElement,\n scope: HTMLElement,\n item: string,\n target: string,\n fallback?: () => HTMLElement | null | undefined,\n) {\n const items = () => Array.from(scope.querySelectorAll<HTMLElement>(item));\n const removed = element.closest<HTMLElement>(item);\n const index = removed ? items().indexOf(removed) : -1;\n if (index < 0 || typeof MutationObserver === 'undefined') return;\n\n const observer = new MutationObserver(() => {\n if (removed!.isConnected) return;\n stop();\n if (!focusLost()) return;\n const rest = items();\n const next = rest[index] ?? rest[index - 1];\n const focusable = next && (next.matches(target) ? next : next.querySelector<HTMLElement>(target));\n (focusable ?? fallback?.())?.focus();\n });\n // Removals that never happen (a cancelled confirm, a failed request) stop being watched.\n const timer = setTimeout(() => stop(), 30_000);\n const stop = () => {\n observer.disconnect();\n clearTimeout(timer);\n };\n observer.observe(scope, { childList: true, subtree: true });\n}\n"],"mappings":";;;AACA,SAAgBA,YAAY;CAC1B,MAAMC,SAASC,SAASC;CACxB,OAAO,CAACF,UAAUA,WAAWC,SAASE;AACxC;;;;;;AAOA,SAAgBC,iBACdC,SACAE,OACAC,MACAC,QACAC,UACA;CACA,MAAMC,cAAcC,MAAMC,KAAKN,MAAMO,iBAA8BN,IAAI,CAAC;CACxE,MAAMO,UAAUV,QAAQW,QAAqBR,IAAI;CACjD,MAAMS,QAAQF,UAAUJ,MAAM,CAAC,CAACO,QAAQH,OAAO,IAAI;CACnD,IAAIE,QAAQ,KAAK,OAAOE,qBAAqB,aAAa;CAE1D,MAAMC,WAAW,IAAID,uBAAuB;EAC1C,IAAIJ,QAASM,aAAa;EAC1BC,KAAK;EACL,IAAI,CAACvB,UAAU,GAAG;EAClB,MAAMwB,OAAOZ,MAAM;EACnB,MAAMa,OAAOD,KAAKN,UAAUM,KAAKN,QAAQ;EAEzC,EADkBO,SAASA,KAAKE,QAAQjB,MAAM,IAAIe,OAAOA,KAAKG,cAA2BlB,MAAM,OACjFC,WAAW,EAAA,EAAIkB,MAAM;CACrC,CAAC;CAED,MAAMC,QAAQC,iBAAiBR,KAAK,GAAG,GAAM;CAC7C,MAAMA,aAAa;EACjBF,SAASW,WAAW;EACpBC,aAAaH,KAAK;CACpB;CACAT,SAASa,QAAQ1B,OAAO;EAAE2B,WAAW;EAAMC,SAAS;CAAK,CAAC;AAC5D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optimum-intelligence/opti-ui",
3
- "version": "0.9.2",
3
+ "version": "1.0.0",
4
4
  "description": "Optimum's customizable React component library, built on Base UI.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "Optimum Intelligence",
@@ -38,6 +38,7 @@
38
38
  "./styles.css": "./dist/opti-ui.css",
39
39
  "./map.css": "./dist/map.css",
40
40
  "./fonts.css": "./dist/fonts.css",
41
+ "./reset.css": "./dist/reset.css",
41
42
  "./components.json": "./dist/components.json",
42
43
  "./llms.txt": "./dist/llms.txt",
43
44
  "./llms-full.txt": "./dist/llms-full.txt"