@vinyasa/navigation 1.0.26

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 (98) hide show
  1. package/README.md +45 -0
  2. package/dist/cjs/breadcrumbs.cjs +240 -0
  3. package/dist/cjs/breadcrumbs.css +58 -0
  4. package/dist/cjs/command-navigation.cjs +215 -0
  5. package/dist/cjs/command-navigation.css +46 -0
  6. package/dist/cjs/index.cjs +2681 -0
  7. package/dist/cjs/index.css +1162 -0
  8. package/dist/cjs/navigation-menu.cjs +302 -0
  9. package/dist/cjs/navigation-menu.css +197 -0
  10. package/dist/cjs/pagination.cjs +462 -0
  11. package/dist/cjs/pagination.css +79 -0
  12. package/dist/cjs/sidebar.cjs +476 -0
  13. package/dist/cjs/sidebar.css +171 -0
  14. package/dist/cjs/stepper.cjs +270 -0
  15. package/dist/cjs/stepper.css +153 -0
  16. package/dist/cjs/tabs.cjs +260 -0
  17. package/dist/cjs/tabs.css +122 -0
  18. package/dist/cjs/top-navigation.cjs +363 -0
  19. package/dist/cjs/top-navigation.css +127 -0
  20. package/dist/cjs/tree-view.cjs +373 -0
  21. package/dist/cjs/tree-view.css +109 -0
  22. package/dist/cjs/workspace-switcher.cjs +249 -0
  23. package/dist/cjs/workspace-switcher.css +100 -0
  24. package/dist/esm/217.css +79 -0
  25. package/dist/esm/217.js +202 -0
  26. package/dist/esm/294.css +100 -0
  27. package/dist/esm/294.js +114 -0
  28. package/dist/esm/375.css +153 -0
  29. package/dist/esm/375.js +120 -0
  30. package/dist/esm/555.css +171 -0
  31. package/dist/esm/555.js +232 -0
  32. package/dist/esm/655.css +58 -0
  33. package/dist/esm/655.js +87 -0
  34. package/dist/esm/66.css +46 -0
  35. package/dist/esm/66.js +92 -0
  36. package/dist/esm/694.css +109 -0
  37. package/dist/esm/694.js +227 -0
  38. package/dist/esm/814.css +197 -0
  39. package/dist/esm/814.js +146 -0
  40. package/dist/esm/862.css +127 -0
  41. package/dist/esm/862.js +130 -0
  42. package/dist/esm/913.css +119 -0
  43. package/dist/esm/913.js +121 -0
  44. package/dist/esm/953.js +87 -0
  45. package/dist/esm/breadcrumbs.d.ts +2 -0
  46. package/dist/esm/breadcrumbs.js +1 -0
  47. package/dist/esm/command-navigation.d.ts +2 -0
  48. package/dist/esm/command-navigation.js +1 -0
  49. package/dist/esm/components/breadcrumbs/Breadcrumbs.css.d.ts +6 -0
  50. package/dist/esm/components/breadcrumbs/Breadcrumbs.d.ts +58 -0
  51. package/dist/esm/components/breadcrumbs/index.d.ts +1 -0
  52. package/dist/esm/components/command-navigation/CommandNavigation.css.d.ts +4 -0
  53. package/dist/esm/components/command-navigation/CommandNavigation.d.ts +50 -0
  54. package/dist/esm/components/command-navigation/index.d.ts +1 -0
  55. package/dist/esm/components/navigation-menu/NavigationMenu.css.d.ts +13 -0
  56. package/dist/esm/components/navigation-menu/NavigationMenu.d.ts +69 -0
  57. package/dist/esm/components/navigation-menu/index.d.ts +1 -0
  58. package/dist/esm/components/pagination/Pagination.css.d.ts +13 -0
  59. package/dist/esm/components/pagination/Pagination.d.ts +69 -0
  60. package/dist/esm/components/pagination/getPaginationRange.d.ts +15 -0
  61. package/dist/esm/components/pagination/index.d.ts +2 -0
  62. package/dist/esm/components/sidebar/Sidebar.css.d.ts +60 -0
  63. package/dist/esm/components/sidebar/Sidebar.d.ts +82 -0
  64. package/dist/esm/components/sidebar/index.d.ts +1 -0
  65. package/dist/esm/components/stepper/Stepper.css.d.ts +10 -0
  66. package/dist/esm/components/stepper/Stepper.d.ts +57 -0
  67. package/dist/esm/components/stepper/index.d.ts +1 -0
  68. package/dist/esm/components/tabs/Tabs.css.d.ts +6 -0
  69. package/dist/esm/components/tabs/Tabs.d.ts +39 -0
  70. package/dist/esm/components/tabs/index.d.ts +1 -0
  71. package/dist/esm/components/top-navigation/TopNavigation.css.d.ts +13 -0
  72. package/dist/esm/components/top-navigation/TopNavigation.d.ts +67 -0
  73. package/dist/esm/components/top-navigation/index.d.ts +1 -0
  74. package/dist/esm/components/tree-view/TreeView.css.d.ts +8 -0
  75. package/dist/esm/components/tree-view/TreeView.d.ts +43 -0
  76. package/dist/esm/components/tree-view/index.d.ts +1 -0
  77. package/dist/esm/components/workspace-switcher/WorkspaceSwitcher.css.d.ts +9 -0
  78. package/dist/esm/components/workspace-switcher/WorkspaceSwitcher.d.ts +43 -0
  79. package/dist/esm/components/workspace-switcher/index.d.ts +1 -0
  80. package/dist/esm/index.d.ts +10 -0
  81. package/dist/esm/index.js +10 -0
  82. package/dist/esm/navigation-menu.d.ts +2 -0
  83. package/dist/esm/navigation-menu.js +1 -0
  84. package/dist/esm/pagination.d.ts +2 -0
  85. package/dist/esm/pagination.js +1 -0
  86. package/dist/esm/sidebar.d.ts +2 -0
  87. package/dist/esm/sidebar.js +1 -0
  88. package/dist/esm/stepper.d.ts +2 -0
  89. package/dist/esm/stepper.js +1 -0
  90. package/dist/esm/tabs.d.ts +2 -0
  91. package/dist/esm/tabs.js +1 -0
  92. package/dist/esm/top-navigation.d.ts +2 -0
  93. package/dist/esm/top-navigation.js +1 -0
  94. package/dist/esm/tree-view.d.ts +2 -0
  95. package/dist/esm/tree-view.js +1 -0
  96. package/dist/esm/workspace-switcher.d.ts +2 -0
  97. package/dist/esm/workspace-switcher.js +1 -0
  98. package/package.json +146 -0
@@ -0,0 +1,249 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, getters, values)=>{
5
+ var define = (defs, kind)=>{
6
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
+ enumerable: true,
8
+ [kind]: defs[key]
9
+ });
10
+ };
11
+ define(getters, "get");
12
+ define(values, "value");
13
+ };
14
+ })();
15
+ (()=>{
16
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
+ })();
18
+ (()=>{
19
+ __webpack_require__.r = (exports1)=>{
20
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
+ value: 'Module'
22
+ });
23
+ Object.defineProperty(exports1, '__esModule', {
24
+ value: true
25
+ });
26
+ };
27
+ })();
28
+ var __webpack_exports__ = {};
29
+ __webpack_require__.r(__webpack_exports__);
30
+ __webpack_require__.d(__webpack_exports__, {
31
+ WorkspaceSwitcher: ()=>WorkspaceSwitcher,
32
+ avatarImage: ()=>avatarImage
33
+ });
34
+ var avatar = '_1glbv700';
35
+ var avatarImage = '_1glbv701';
36
+ var item = '_1glbv707';
37
+ var itemCheck = '_1glbv708';
38
+ var trigger = '_1glbv702';
39
+ var triggerDescription = '_1glbv705';
40
+ var triggerIcon = '_1glbv706';
41
+ var triggerName = '_1glbv704';
42
+ var triggerText = '_1glbv703';
43
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
44
+ const icons_namespaceObject = require("@vinyasa/icons");
45
+ const dropdown_menu_namespaceObject = require("@vinyasa/overlay/dropdown-menu");
46
+ const external_react_namespaceObject = require("react");
47
+ function _define_property(obj, key, value) {
48
+ if (key in obj) Object.defineProperty(obj, key, {
49
+ value: value,
50
+ enumerable: true,
51
+ configurable: true,
52
+ writable: true
53
+ });
54
+ else obj[key] = value;
55
+ return obj;
56
+ }
57
+ function _object_spread(target) {
58
+ for(var i = 1; i < arguments.length; i++){
59
+ var source = null != arguments[i] ? arguments[i] : {};
60
+ var ownKeys = Object.keys(source);
61
+ if ("function" == typeof Object.getOwnPropertySymbols) ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
62
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
63
+ }));
64
+ ownKeys.forEach(function(key) {
65
+ _define_property(target, key, source[key]);
66
+ });
67
+ }
68
+ return target;
69
+ }
70
+ function WorkspaceSwitcher_ownKeys(object, enumerableOnly) {
71
+ var keys = Object.keys(object);
72
+ if (Object.getOwnPropertySymbols) {
73
+ var symbols = Object.getOwnPropertySymbols(object);
74
+ if (enumerableOnly) symbols = symbols.filter(function(sym) {
75
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
76
+ });
77
+ keys.push.apply(keys, symbols);
78
+ }
79
+ return keys;
80
+ }
81
+ function _object_spread_props(target, source) {
82
+ source = null != source ? source : {};
83
+ if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
84
+ else WorkspaceSwitcher_ownKeys(Object(source)).forEach(function(key) {
85
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
86
+ });
87
+ return target;
88
+ }
89
+ function _object_without_properties(source, excluded) {
90
+ if (null == source) return {};
91
+ var target = {}, sourceKeys, key, i;
92
+ if ("u" > typeof Reflect && Reflect.ownKeys) {
93
+ sourceKeys = Reflect.ownKeys(Object(source));
94
+ for(i = 0; i < sourceKeys.length; i++){
95
+ key = sourceKeys[i];
96
+ if (!(excluded.indexOf(key) >= 0)) {
97
+ if (Object.prototype.propertyIsEnumerable.call(source, key)) target[key] = source[key];
98
+ }
99
+ }
100
+ return target;
101
+ }
102
+ target = _object_without_properties_loose(source, excluded);
103
+ if (Object.getOwnPropertySymbols) {
104
+ sourceKeys = Object.getOwnPropertySymbols(source);
105
+ for(i = 0; i < sourceKeys.length; i++){
106
+ key = sourceKeys[i];
107
+ if (!(excluded.indexOf(key) >= 0)) {
108
+ if (Object.prototype.propertyIsEnumerable.call(source, key)) target[key] = source[key];
109
+ }
110
+ }
111
+ }
112
+ return target;
113
+ }
114
+ function _object_without_properties_loose(source, excluded) {
115
+ if (null == source) return {};
116
+ var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
117
+ for(i = 0; i < sourceKeys.length; i++){
118
+ key = sourceKeys[i];
119
+ if (!(excluded.indexOf(key) >= 0)) {
120
+ if (Object.prototype.propertyIsEnumerable.call(source, key)) target[key] = source[key];
121
+ }
122
+ }
123
+ return target;
124
+ }
125
+ const initials = (name)=>name.trim().split(/\s+/).slice(0, 2).map((word)=>word[0]).join('').toUpperCase();
126
+ const WorkspaceAvatar = (_0)=>{
127
+ let { workspace, className } = _0, rest = _object_without_properties(_0, [
128
+ "workspace",
129
+ "className"
130
+ ]);
131
+ var _workspace_avatar;
132
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", _object_spread_props(_object_spread({
133
+ className: className ? `${avatar} ${className}` : avatar,
134
+ "aria-hidden": "true"
135
+ }, rest), {
136
+ children: null != (_workspace_avatar = workspace.avatar) ? _workspace_avatar : initials(workspace.name)
137
+ }));
138
+ };
139
+ WorkspaceAvatar.displayName = 'WorkspaceAvatar';
140
+ const WorkspaceSwitcherTrigger = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)((_0, _1)=>{
141
+ let _ref = [
142
+ _0,
143
+ _1
144
+ ], [_ref1, ..._rest] = _ref, { workspace, className } = _ref1, rest = _object_without_properties(_ref1, [
145
+ "workspace",
146
+ "className"
147
+ ]), [ref] = _rest;
148
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("button", _object_spread_props(_object_spread({
149
+ ref: ref,
150
+ type: "button",
151
+ className: className ? `${trigger} ${className}` : trigger
152
+ }, rest), {
153
+ children: [
154
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(WorkspaceAvatar, {
155
+ workspace: workspace
156
+ }),
157
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
158
+ className: triggerText,
159
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
160
+ className: triggerName,
161
+ children: workspace.name
162
+ })
163
+ }),
164
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_namespaceObject.ChevronDownIcon, {
165
+ className: triggerIcon
166
+ })
167
+ ]
168
+ }));
169
+ });
170
+ WorkspaceSwitcherTrigger.displayName = 'WorkspaceSwitcherTrigger';
171
+ const WorkspaceSwitcherItem = ({ workspace, active })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
172
+ className: item,
173
+ children: [
174
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(WorkspaceAvatar, {
175
+ workspace: workspace
176
+ }),
177
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
178
+ className: triggerText,
179
+ children: [
180
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
181
+ className: triggerName,
182
+ children: workspace.name
183
+ }),
184
+ workspace.description ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
185
+ className: triggerDescription,
186
+ children: workspace.description
187
+ }) : null
188
+ ]
189
+ }),
190
+ active ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_namespaceObject.CheckIcon, {
191
+ className: itemCheck,
192
+ "aria-hidden": "true"
193
+ }) : null
194
+ ]
195
+ });
196
+ WorkspaceSwitcherItem.displayName = 'WorkspaceSwitcherItem';
197
+ const WorkspaceSwitcherImpl = ({ workspaces, activeWorkspaceId, onWorkspaceChange, onCreateWorkspace, createWorkspaceLabel = 'Create workspace' })=>{
198
+ var _workspaces_find;
199
+ if (0 === workspaces.length) return null;
200
+ const activeWorkspace = null != (_workspaces_find = workspaces.find((workspace)=>workspace.id === activeWorkspaceId)) ? _workspaces_find : workspaces[0];
201
+ const entries = [
202
+ ...workspaces.map((workspace)=>({
203
+ type: 'item',
204
+ key: workspace.id,
205
+ label: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(WorkspaceSwitcherItem, {
206
+ workspace: workspace,
207
+ active: workspace.id === activeWorkspaceId
208
+ }),
209
+ onSelect: ()=>{
210
+ onWorkspaceChange(workspace.id);
211
+ }
212
+ })),
213
+ ...onCreateWorkspace ? [
214
+ {
215
+ type: 'separator',
216
+ key: 'create-workspace-separator'
217
+ },
218
+ {
219
+ type: 'item',
220
+ key: 'create-workspace',
221
+ label: createWorkspaceLabel,
222
+ icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_namespaceObject.PlusIcon, {}),
223
+ onSelect: onCreateWorkspace
224
+ }
225
+ ] : []
226
+ ];
227
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(dropdown_menu_namespaceObject.DropdownMenu, {
228
+ trigger: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(WorkspaceSwitcherTrigger, {
229
+ workspace: activeWorkspace
230
+ }),
231
+ items: entries,
232
+ align: "start"
233
+ });
234
+ };
235
+ WorkspaceSwitcherImpl.displayName = 'WorkspaceSwitcher';
236
+ const WorkspaceSwitcher = Object.assign(WorkspaceSwitcherImpl, {
237
+ Trigger: WorkspaceSwitcherTrigger,
238
+ Item: WorkspaceSwitcherItem,
239
+ Avatar: WorkspaceAvatar
240
+ });
241
+ exports.WorkspaceSwitcher = __webpack_exports__.WorkspaceSwitcher;
242
+ exports.avatarImage = __webpack_exports__.avatarImage;
243
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
244
+ "WorkspaceSwitcher",
245
+ "avatarImage"
246
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
247
+ Object.defineProperty(exports, '__esModule', {
248
+ value: true
249
+ });
@@ -0,0 +1,100 @@
1
+ ._1glbv700 {
2
+ border-radius: var(--vinyasa-radius-sm);
3
+ background-color: var(--vinyasa-primary);
4
+ width: 1.75rem;
5
+ height: 1.75rem;
6
+ color: var(--vinyasa-on-primary);
7
+ font-family: var(--vinyasa-font-family-sans);
8
+ font-size: var(--vinyasa-font-size-xs);
9
+ font-weight: var(--vinyasa-font-weight-semibold);
10
+ flex-shrink: 0;
11
+ justify-content: center;
12
+ align-items: center;
13
+ display: inline-flex;
14
+ overflow: hidden;
15
+ }
16
+
17
+ ._1glbv701 {
18
+ object-fit: cover;
19
+ width: 100%;
20
+ height: 100%;
21
+ }
22
+
23
+ ._1glbv702 {
24
+ align-items: center;
25
+ gap: var(--vinyasa-space2);
26
+ max-width: 16rem;
27
+ padding: var(--vinyasa-space2);
28
+ border-radius: var(--vinyasa-radius-sm);
29
+ color: var(--vinyasa-text-default);
30
+ cursor: pointer;
31
+ transition: background-color var(--vinyasa-motion-duration-fast) var(--vinyasa-motion-easing-standard);
32
+ background-color: rgba(0, 0, 0, 0);
33
+ border: none;
34
+ display: inline-flex;
35
+ }
36
+
37
+ ._1glbv702:hover {
38
+ background-color: var(--vinyasa-secondary);
39
+ }
40
+
41
+ ._1glbv702:focus-visible {
42
+ outline: 2px solid var(--vinyasa-focus);
43
+ outline-offset: 2px;
44
+ }
45
+
46
+ ._1glbv702[data-state="open"] {
47
+ background-color: var(--vinyasa-secondary);
48
+ }
49
+
50
+ ._1glbv703 {
51
+ flex-direction: column;
52
+ flex: 1;
53
+ align-items: flex-start;
54
+ min-width: 0;
55
+ display: flex;
56
+ }
57
+
58
+ ._1glbv704 {
59
+ white-space: nowrap;
60
+ text-overflow: ellipsis;
61
+ max-width: 100%;
62
+ font-family: var(--vinyasa-font-family-sans);
63
+ font-size: var(--vinyasa-font-size-sm);
64
+ font-weight: var(--vinyasa-font-weight-medium);
65
+ display: block;
66
+ overflow: hidden;
67
+ }
68
+
69
+ ._1glbv705 {
70
+ white-space: nowrap;
71
+ text-overflow: ellipsis;
72
+ max-width: 100%;
73
+ font-family: var(--vinyasa-font-family-sans);
74
+ font-size: var(--vinyasa-font-size-xs);
75
+ color: var(--vinyasa-text-muted);
76
+ display: block;
77
+ overflow: hidden;
78
+ }
79
+
80
+ ._1glbv706 {
81
+ color: var(--vinyasa-text-muted);
82
+ flex-shrink: 0;
83
+ font-size: 1rem;
84
+ display: inline-flex;
85
+ }
86
+
87
+ ._1glbv707 {
88
+ align-items: center;
89
+ gap: var(--vinyasa-space2);
90
+ min-width: 14rem;
91
+ display: flex;
92
+ }
93
+
94
+ ._1glbv708 {
95
+ color: var(--vinyasa-primary);
96
+ flex-shrink: 0;
97
+ margin-left: auto;
98
+ font-size: 1rem;
99
+ }
100
+
@@ -0,0 +1,79 @@
1
+ .oewhtx0 {
2
+ align-items: center;
3
+ gap: var(--vinyasa-space1);
4
+ margin: 0;
5
+ padding: 0;
6
+ list-style: none;
7
+ display: flex;
8
+ position: relative;
9
+ }
10
+
11
+ .oewhtx1 {
12
+ display: flex;
13
+ }
14
+
15
+ .oewhtx2 {
16
+ z-index: 0;
17
+ border-radius: var(--vinyasa-radius-sm);
18
+ background-color: var(--vinyasa-tertiary);
19
+ opacity: 0;
20
+ transition: transform var(--vinyasa-motion-duration-fast) var(--vinyasa-motion-easing-standard), width var(--vinyasa-motion-duration-fast) var(--vinyasa-motion-easing-standard), height var(--vinyasa-motion-duration-fast) var(--vinyasa-motion-easing-standard), opacity var(--vinyasa-motion-duration-fast) var(--vinyasa-motion-easing-standard);
21
+ position: absolute;
22
+ top: 0;
23
+ left: 0;
24
+ }
25
+
26
+ .oewhtx3 {
27
+ z-index: 1;
28
+ min-width: 2.25rem;
29
+ height: 2.25rem;
30
+ padding: 0 var(--vinyasa-space2);
31
+ border-radius: var(--vinyasa-radius-sm);
32
+ color: var(--vinyasa-text-muted);
33
+ font-family: var(--vinyasa-font-family-sans);
34
+ font-size: var(--vinyasa-font-size-sm);
35
+ cursor: pointer;
36
+ transition: color var(--vinyasa-motion-duration-fast) var(--vinyasa-motion-easing-standard);
37
+ background-color: #0000;
38
+ border: none;
39
+ justify-content: center;
40
+ align-items: center;
41
+ text-decoration: none;
42
+ display: inline-flex;
43
+ position: relative;
44
+ }
45
+
46
+ .oewhtx3:hover:not(:disabled) {
47
+ background-color: var(--vinyasa-secondary);
48
+ }
49
+
50
+ .oewhtx3:focus-visible {
51
+ outline: 2px solid var(--vinyasa-focus);
52
+ outline-offset: 2px;
53
+ }
54
+
55
+ .oewhtx3:disabled {
56
+ opacity: var(--vinyasa-opacity-disabled);
57
+ cursor: not-allowed;
58
+ }
59
+
60
+ .oewhtx4 {
61
+ color: var(--vinyasa-on-tertiary);
62
+ font-weight: var(--vinyasa-font-weight-medium);
63
+ }
64
+
65
+ .oewhtx5 {
66
+ min-width: 2.25rem;
67
+ height: 2.25rem;
68
+ color: var(--vinyasa-text-muted);
69
+ font-size: var(--vinyasa-font-size-sm);
70
+ justify-content: center;
71
+ align-items: center;
72
+ display: inline-flex;
73
+ }
74
+
75
+ .oewhtx6 {
76
+ font-size: 1rem;
77
+ display: inline-flex;
78
+ }
79
+
@@ -0,0 +1,202 @@
1
+ import "./217.css";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { ChevronLeftIcon, ChevronRightIcon } from "@vinyasa/icons";
4
+ import { useThemedRef } from "@vinyasa/tokens";
5
+ import { forwardRef, useCallback, useLayoutEffect, useRef } from "react";
6
+ import { createRuntimeFn } from "./953.js";
7
+ const ELLIPSIS = 'ellipsis';
8
+ const range = (start, end)=>Array.from({
9
+ length: Math.max(0, end - start + 1)
10
+ }, (_, index)=>start + index);
11
+ const getPaginationRange = (page, totalPages, siblingCount = 1, boundaryCount = 1)=>{
12
+ const startPages = range(1, Math.min(boundaryCount, totalPages));
13
+ const endPages = range(Math.max(totalPages - boundaryCount + 1, boundaryCount + 1), totalPages);
14
+ const siblingsStart = Math.max(Math.min(page - siblingCount, totalPages - boundaryCount - 2 * siblingCount - 1), boundaryCount + 2);
15
+ const siblingsEnd = Math.min(Math.max(page + siblingCount, boundaryCount + 2 * siblingCount + 2), endPages.length > 0 ? endPages[0] - 2 : totalPages - 1);
16
+ return [
17
+ ...startPages,
18
+ ...siblingsStart > boundaryCount + 2 ? [
19
+ ELLIPSIS
20
+ ] : boundaryCount + 1 < totalPages - boundaryCount ? [
21
+ boundaryCount + 1
22
+ ] : [],
23
+ ...range(siblingsStart, siblingsEnd),
24
+ ...siblingsEnd < totalPages - boundaryCount - 1 ? [
25
+ ELLIPSIS
26
+ ] : totalPages - boundaryCount > boundaryCount ? [
27
+ totalPages - boundaryCount
28
+ ] : [],
29
+ ...endPages
30
+ ];
31
+ };
32
+ var boundaryIcon = 'oewhtx6';
33
+ var ellipsis = 'oewhtx5';
34
+ var indicator = 'oewhtx2';
35
+ var item = 'oewhtx1';
36
+ var Pagination_css_link = createRuntimeFn({
37
+ defaultClassName: 'oewhtx3',
38
+ variantClassNames: {
39
+ active: {
40
+ true: 'oewhtx4'
41
+ }
42
+ },
43
+ defaultVariants: {},
44
+ compoundVariants: []
45
+ });
46
+ var list = 'oewhtx0';
47
+ const PaginationRoot = /*#__PURE__*/ forwardRef(({ ...rest }, ref)=>{
48
+ const themedRef = useThemedRef(ref);
49
+ return /*#__PURE__*/ jsx("nav", {
50
+ ref: themedRef,
51
+ "aria-label": "Pagination",
52
+ ...rest
53
+ });
54
+ });
55
+ PaginationRoot.displayName = 'PaginationRoot';
56
+ const PaginationList = ({ className, children, ...rest })=>{
57
+ const listRef = useRef(null);
58
+ const indicatorRef = useRef(null);
59
+ const updateIndicator = useCallback(()=>{
60
+ const listEl = listRef.current;
61
+ const indicatorEl = indicatorRef.current;
62
+ if (!listEl || !indicatorEl) return;
63
+ const activeLink = listEl.querySelector('[aria-current="page"]');
64
+ if (!activeLink) {
65
+ indicatorEl.style.opacity = '0';
66
+ return;
67
+ }
68
+ indicatorEl.style.opacity = '1';
69
+ indicatorEl.style.transform = `translate(${String(activeLink.offsetLeft)}px, ${String(activeLink.offsetTop)}px)`;
70
+ indicatorEl.style.width = `${String(activeLink.offsetWidth)}px`;
71
+ indicatorEl.style.height = `${String(activeLink.offsetHeight)}px`;
72
+ }, []);
73
+ useLayoutEffect(()=>{
74
+ updateIndicator();
75
+ const listEl = listRef.current;
76
+ if (!listEl) return;
77
+ const mutationObserver = new MutationObserver(updateIndicator);
78
+ mutationObserver.observe(listEl, {
79
+ attributes: true,
80
+ attributeFilter: [
81
+ 'aria-current'
82
+ ],
83
+ subtree: true
84
+ });
85
+ const resizeObserver = new ResizeObserver(updateIndicator);
86
+ resizeObserver.observe(listEl);
87
+ return ()=>{
88
+ mutationObserver.disconnect();
89
+ resizeObserver.disconnect();
90
+ };
91
+ }, [
92
+ updateIndicator
93
+ ]);
94
+ return /*#__PURE__*/ jsxs("ul", {
95
+ ref: listRef,
96
+ className: className ? `${list} ${className}` : list,
97
+ ...rest,
98
+ children: [
99
+ /*#__PURE__*/ jsx("li", {
100
+ ref: indicatorRef,
101
+ "aria-hidden": "true",
102
+ className: indicator
103
+ }),
104
+ children
105
+ ]
106
+ });
107
+ };
108
+ PaginationList.displayName = 'PaginationList';
109
+ const PaginationItem = ({ className, ...rest })=>/*#__PURE__*/ jsx("li", {
110
+ className: className ? `${item} ${className}` : item,
111
+ ...rest
112
+ });
113
+ PaginationItem.displayName = 'PaginationItem';
114
+ const PaginationLink = /*#__PURE__*/ forwardRef(({ as: Component = 'button', active, className, ...rest }, ref)=>/*#__PURE__*/ jsx(Component, {
115
+ ref: ref,
116
+ className: className ? `${Pagination_css_link({
117
+ active
118
+ })} ${className}` : Pagination_css_link({
119
+ active
120
+ }),
121
+ "aria-current": active ? 'page' : void 0,
122
+ ...rest
123
+ }));
124
+ PaginationLink.displayName = 'PaginationLink';
125
+ const PaginationEllipsis = ({ className, children, ...rest })=>/*#__PURE__*/ jsx("span", {
126
+ "aria-hidden": "true",
127
+ className: className ? `${ellipsis} ${className}` : ellipsis,
128
+ ...rest,
129
+ children: children ?? '…'
130
+ });
131
+ PaginationEllipsis.displayName = 'PaginationEllipsis';
132
+ const PaginationPrevious = ({ children, ...rest })=>/*#__PURE__*/ jsx(PaginationLink, {
133
+ "aria-label": "Previous page",
134
+ ...rest,
135
+ children: children ?? /*#__PURE__*/ jsx(ChevronLeftIcon, {
136
+ className: boundaryIcon
137
+ })
138
+ });
139
+ PaginationPrevious.displayName = 'PaginationPrevious';
140
+ const PaginationNext = ({ children, ...rest })=>/*#__PURE__*/ jsx(PaginationLink, {
141
+ "aria-label": "Next page",
142
+ ...rest,
143
+ children: children ?? /*#__PURE__*/ jsx(ChevronRightIcon, {
144
+ className: boundaryIcon
145
+ })
146
+ });
147
+ PaginationNext.displayName = 'PaginationNext';
148
+ const PaginationImpl = ({ page, totalPages, onPageChange, siblingCount = 1, boundaryCount = 1, getHref, linkComponent, ...rest })=>{
149
+ const pageRange = getPaginationRange(page, totalPages, siblingCount, boundaryCount);
150
+ const asProp = getHref ? linkComponent ?? 'a' : 'button';
151
+ return /*#__PURE__*/ jsx(PaginationRoot, {
152
+ ...rest,
153
+ children: /*#__PURE__*/ jsxs(PaginationList, {
154
+ children: [
155
+ /*#__PURE__*/ jsx(PaginationItem, {
156
+ children: /*#__PURE__*/ jsx(PaginationPrevious, {
157
+ as: asProp,
158
+ href: getHref && page > 1 ? getHref(page - 1) : void 0,
159
+ disabled: page <= 1,
160
+ onClick: ()=>{
161
+ if (page > 1) onPageChange(page - 1);
162
+ }
163
+ })
164
+ }),
165
+ pageRange.map((pageNumber, index)=>pageNumber === ELLIPSIS ? /*#__PURE__*/ jsx(PaginationItem, {
166
+ children: /*#__PURE__*/ jsx(PaginationEllipsis, {})
167
+ }, `ellipsis-${String(index)}`) : /*#__PURE__*/ jsx(PaginationItem, {
168
+ children: /*#__PURE__*/ jsx(PaginationLink, {
169
+ as: asProp,
170
+ href: getHref?.(pageNumber),
171
+ active: pageNumber === page,
172
+ onClick: ()=>{
173
+ onPageChange(pageNumber);
174
+ },
175
+ children: pageNumber
176
+ })
177
+ }, pageNumber)),
178
+ /*#__PURE__*/ jsx(PaginationItem, {
179
+ children: /*#__PURE__*/ jsx(PaginationNext, {
180
+ as: asProp,
181
+ href: getHref && page < totalPages ? getHref(page + 1) : void 0,
182
+ disabled: page >= totalPages,
183
+ onClick: ()=>{
184
+ if (page < totalPages) onPageChange(page + 1);
185
+ }
186
+ })
187
+ })
188
+ ]
189
+ })
190
+ });
191
+ };
192
+ PaginationImpl.displayName = 'Pagination';
193
+ const Pagination = Object.assign(PaginationImpl, {
194
+ Root: PaginationRoot,
195
+ List: PaginationList,
196
+ Item: PaginationItem,
197
+ Link: PaginationLink,
198
+ Previous: PaginationPrevious,
199
+ Next: PaginationNext,
200
+ Ellipsis: PaginationEllipsis
201
+ });
202
+ export { ELLIPSIS, Pagination, getPaginationRange };