@websolutespa/bom-mixer-ui 1.5.2 → 1.5.3
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.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/index.js +59 -33
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/components/pagination/pagination-context.js +6 -3
- package/dist/esm/components/pagination/pagination-context.js.map +1 -1
- package/dist/esm/components/pagination/pagination-item.js +134 -4
- package/dist/esm/components/pagination/pagination-item.js.map +1 -1
- package/dist/esm/components/pagination/pagination-next.js +5 -2
- package/dist/esm/components/pagination/pagination-next.js.map +1 -1
- package/dist/esm/components/pagination/pagination-pages.js +7 -0
- package/dist/esm/components/pagination/pagination-pages.js.map +1 -1
- package/dist/esm/components/pagination/pagination-previous.js +5 -2
- package/dist/esm/components/pagination/pagination-previous.js.map +1 -1
- package/dist/esm/components/pagination/pagination.js +8 -5
- package/dist/esm/components/pagination/pagination.js.map +1 -1
- package/dist/types/components/breadcrumb/breadcrumb.d.ts +1 -1
- package/dist/types/components/pagination/pagination-context.d.ts +2 -0
- package/dist/types/components/pagination/pagination-context.d.ts.map +1 -1
- package/dist/types/components/pagination/pagination-item.d.ts +2 -1
- package/dist/types/components/pagination/pagination-item.d.ts.map +1 -1
- package/dist/types/components/pagination/pagination-next.d.ts.map +1 -1
- package/dist/types/components/pagination/pagination-pages.d.ts.map +1 -1
- package/dist/types/components/pagination/pagination-previous.d.ts.map +1 -1
- package/dist/types/components/pagination/pagination.d.ts +6 -4
- package/dist/types/components/pagination/pagination.d.ts.map +1 -1
- package/dist/types/forms/custom-select/custom-select.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/pagination/pagination-context.ts +9 -3
- package/src/components/pagination/pagination-item.tsx +8 -2
- package/src/components/pagination/pagination-next.tsx +2 -1
- package/src/components/pagination/pagination-pages.tsx +5 -0
- package/src/components/pagination/pagination-previous.tsx +2 -1
- package/src/components/pagination/pagination.tsx +10 -6
package/CHANGELOG.md
CHANGED
package/dist/cjs/index.js
CHANGED
|
@@ -5419,29 +5419,12 @@ const Page = styled__default.default.div`
|
|
|
5419
5419
|
${props => getCssResponsive(props)}
|
|
5420
5420
|
`;
|
|
5421
5421
|
|
|
5422
|
-
const
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
return args;
|
|
5427
|
-
};
|
|
5428
|
-
const tupleNumber = function () {
|
|
5429
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
5430
|
-
args[_key2] = arguments[_key2];
|
|
5422
|
+
const defaultContext$5 = {
|
|
5423
|
+
currentPage: 1,
|
|
5424
|
+
resolveUrl: () => {
|
|
5425
|
+
return undefined;
|
|
5431
5426
|
}
|
|
5432
|
-
return args;
|
|
5433
5427
|
};
|
|
5434
|
-
tuple('default', 'secondary', 'success', 'warning', 'error', 'abort', 'secondary-light', 'success-light', 'warning-light', 'error-light');
|
|
5435
|
-
tuple('default', 'secondary', 'success', 'warning', 'error');
|
|
5436
|
-
tuple('default', 'secondary', 'success', 'warning', 'error', 'dark', 'lite');
|
|
5437
|
-
tuple('default', 'secondary', 'success', 'warning', 'error', 'dark', 'lite', 'alert', 'purple', 'violet', 'cyan');
|
|
5438
|
-
tuple('default', 'silent', 'prevent');
|
|
5439
|
-
tuple('hover', 'click');
|
|
5440
|
-
tuple('top', 'topStart', 'topEnd', 'left', 'leftStart', 'leftEnd', 'bottom', 'bottomStart', 'bottomEnd', 'right', 'rightStart', 'rightEnd');
|
|
5441
|
-
tuple('start', 'center', 'end', 'left', 'right');
|
|
5442
|
-
|
|
5443
|
-
tuple('prev', 'next', 'click');
|
|
5444
|
-
const defaultContext$5 = {};
|
|
5445
5428
|
const PaginationContext = /*#__PURE__*/React__default.default.createContext(defaultContext$5);
|
|
5446
5429
|
const usePaginationContext = () => React__default.default.useContext(PaginationContext);
|
|
5447
5430
|
|
|
@@ -5449,7 +5432,7 @@ const StyledPaginationItem$1 = styled__default.default.li`
|
|
|
5449
5432
|
margin-right: 0.428em;
|
|
5450
5433
|
display: inline-block;
|
|
5451
5434
|
|
|
5452
|
-
button {
|
|
5435
|
+
button, a {
|
|
5453
5436
|
box-sizing: border-box;
|
|
5454
5437
|
display: inline-flex;
|
|
5455
5438
|
align-items: center;
|
|
@@ -5504,14 +5487,18 @@ const StyledPaginationItem$1 = styled__default.default.li`
|
|
|
5504
5487
|
`;
|
|
5505
5488
|
const PaginationItem = _a => {
|
|
5506
5489
|
var {
|
|
5490
|
+
href,
|
|
5507
5491
|
className,
|
|
5508
5492
|
children,
|
|
5509
5493
|
active,
|
|
5510
5494
|
disabled,
|
|
5511
5495
|
onClick
|
|
5512
5496
|
} = _a,
|
|
5513
|
-
props = __rest(_a, ["className", "children", "active", "disabled", "onClick"]);
|
|
5497
|
+
props = __rest(_a, ["href", "className", "children", "active", "disabled", "onClick"]);
|
|
5514
5498
|
const onClick_ = event => {
|
|
5499
|
+
if (href) {
|
|
5500
|
+
event.preventDefault();
|
|
5501
|
+
}
|
|
5515
5502
|
if (disabled) {
|
|
5516
5503
|
return;
|
|
5517
5504
|
}
|
|
@@ -5526,7 +5513,10 @@ const PaginationItem = _a => {
|
|
|
5526
5513
|
"aria-label": props['aria-label'],
|
|
5527
5514
|
className: classNames,
|
|
5528
5515
|
onClick: onClick_
|
|
5529
|
-
},
|
|
5516
|
+
}, href ? {
|
|
5517
|
+
as: 'a',
|
|
5518
|
+
href
|
|
5519
|
+
} : {}, props, {
|
|
5530
5520
|
children: children
|
|
5531
5521
|
}))
|
|
5532
5522
|
});
|
|
@@ -5539,15 +5529,18 @@ const PaginationNext = _a => {
|
|
|
5539
5529
|
} = _a,
|
|
5540
5530
|
props = __rest(_a, ["children"]);
|
|
5541
5531
|
const {
|
|
5532
|
+
currentPage,
|
|
5533
|
+
isLast,
|
|
5542
5534
|
update,
|
|
5543
|
-
|
|
5535
|
+
resolveUrl
|
|
5544
5536
|
} = usePaginationContext();
|
|
5545
5537
|
return jsxRuntime.jsx(PaginationItem, Object.assign({
|
|
5546
5538
|
className: "pagination-next",
|
|
5547
5539
|
disabled: isLast,
|
|
5548
5540
|
"aria-disabled": isLast,
|
|
5549
5541
|
"aria-label": "next page",
|
|
5550
|
-
onClick: () => update && update('next')
|
|
5542
|
+
onClick: () => update && update('next'),
|
|
5543
|
+
href: resolveUrl(currentPage + 1)
|
|
5551
5544
|
}, props, {
|
|
5552
5545
|
children: children
|
|
5553
5546
|
}));
|
|
@@ -5643,6 +5636,9 @@ const PaginationPages = _ref => {
|
|
|
5643
5636
|
current,
|
|
5644
5637
|
setPage
|
|
5645
5638
|
} = _ref;
|
|
5639
|
+
const {
|
|
5640
|
+
resolveUrl
|
|
5641
|
+
} = usePaginationContext();
|
|
5646
5642
|
const showPages = React.useMemo(() => {
|
|
5647
5643
|
const oddLimit = limit % 2 === 0 ? limit - 1 : limit;
|
|
5648
5644
|
return oddLimit - 2;
|
|
@@ -5657,6 +5653,7 @@ const PaginationPages = _ref => {
|
|
|
5657
5653
|
"aria-label": `page ${value}`,
|
|
5658
5654
|
active: value === active,
|
|
5659
5655
|
onClick: () => setPage(value),
|
|
5656
|
+
href: resolveUrl(value),
|
|
5660
5657
|
children: value
|
|
5661
5658
|
}, `pagination-item-${value}`), [setPage]);
|
|
5662
5659
|
const renderStartItems = pagesArray.map((_, index) => {
|
|
@@ -5670,6 +5667,7 @@ const PaginationPages = _ref => {
|
|
|
5670
5667
|
"aria-label": `page ${value}`,
|
|
5671
5668
|
active: index + 1 === middleNumber,
|
|
5672
5669
|
onClick: () => setPage(value),
|
|
5670
|
+
href: resolveUrl(value),
|
|
5673
5671
|
children: value
|
|
5674
5672
|
}, `pagination-middle-${index}`);
|
|
5675
5673
|
});
|
|
@@ -5686,6 +5684,7 @@ const PaginationPages = _ref => {
|
|
|
5686
5684
|
"aria-label": `page ${value}`,
|
|
5687
5685
|
active: value === current,
|
|
5688
5686
|
onClick: () => setPage(value),
|
|
5687
|
+
href: resolveUrl(value),
|
|
5689
5688
|
children: value
|
|
5690
5689
|
}, `pagination-item-${value}`);
|
|
5691
5690
|
})
|
|
@@ -5712,8 +5711,10 @@ const PaginationPrevious = _a => {
|
|
|
5712
5711
|
} = _a,
|
|
5713
5712
|
props = __rest(_a, ["children"]);
|
|
5714
5713
|
const {
|
|
5714
|
+
currentPage,
|
|
5715
|
+
isFirst,
|
|
5715
5716
|
update,
|
|
5716
|
-
|
|
5717
|
+
resolveUrl
|
|
5717
5718
|
} = usePaginationContext();
|
|
5718
5719
|
return jsxRuntime.jsx(PaginationItem, Object.assign({
|
|
5719
5720
|
className: "pagination-previous",
|
|
@@ -5721,7 +5722,8 @@ const PaginationPrevious = _a => {
|
|
|
5721
5722
|
"aria-disabled": isFirst,
|
|
5722
5723
|
"aria-label": "previous page",
|
|
5723
5724
|
title: "previous page",
|
|
5724
|
-
onClick: () => update && update('prev')
|
|
5725
|
+
onClick: () => update && update('prev'),
|
|
5726
|
+
href: resolveUrl(currentPage - 1)
|
|
5725
5727
|
}, props, {
|
|
5726
5728
|
children: children
|
|
5727
5729
|
}));
|
|
@@ -5753,7 +5755,7 @@ const StyledNav = styled__default.default.ul`
|
|
|
5753
5755
|
margin-right: 0;
|
|
5754
5756
|
}
|
|
5755
5757
|
`;
|
|
5756
|
-
|
|
5758
|
+
function PaginationBase(_a) {
|
|
5757
5759
|
var {
|
|
5758
5760
|
className = '',
|
|
5759
5761
|
initialPage = 1,
|
|
@@ -5761,9 +5763,10 @@ const PaginationBase = _a => {
|
|
|
5761
5763
|
limit = 7,
|
|
5762
5764
|
page: customPage,
|
|
5763
5765
|
children,
|
|
5764
|
-
onChange
|
|
5766
|
+
onChange,
|
|
5767
|
+
urlResolver
|
|
5765
5768
|
} = _a,
|
|
5766
|
-
props = __rest(_a, ["className", "initialPage", "count", "limit", "page", "children", "onChange"]);
|
|
5769
|
+
props = __rest(_a, ["className", "initialPage", "count", "limit", "page", "children", "onChange", "urlResolver"]);
|
|
5767
5770
|
const label = bomMixerHooks.useLabel();
|
|
5768
5771
|
const [page, setPage, pageRef] = bomMixerHooks.useCurrentState(initialPage);
|
|
5769
5772
|
const [, prevChildren] = pickChild(children, PaginationPrevious);
|
|
@@ -5788,9 +5791,11 @@ const PaginationBase = _a => {
|
|
|
5788
5791
|
};
|
|
5789
5792
|
const values = React.useMemo(() => {
|
|
5790
5793
|
return {
|
|
5794
|
+
currentPage: page,
|
|
5791
5795
|
isFirst: page <= 1,
|
|
5792
5796
|
isLast: page >= count,
|
|
5793
|
-
update
|
|
5797
|
+
update,
|
|
5798
|
+
resolveUrl: page => urlResolver ? urlResolver(page) : undefined
|
|
5794
5799
|
};
|
|
5795
5800
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5796
5801
|
}, [page, count]);
|
|
@@ -5822,7 +5827,7 @@ const PaginationBase = _a => {
|
|
|
5822
5827
|
})
|
|
5823
5828
|
}))
|
|
5824
5829
|
});
|
|
5825
|
-
}
|
|
5830
|
+
}
|
|
5826
5831
|
const Pagination = bomCore.withSchema(PaginationBase, {
|
|
5827
5832
|
Previous: PaginationPrevious,
|
|
5828
5833
|
Next: PaginationNext,
|
|
@@ -9157,6 +9162,27 @@ const radioVariants = {
|
|
|
9157
9162
|
default: CssRadioDefault
|
|
9158
9163
|
};
|
|
9159
9164
|
|
|
9165
|
+
const tuple = function () {
|
|
9166
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
9167
|
+
args[_key] = arguments[_key];
|
|
9168
|
+
}
|
|
9169
|
+
return args;
|
|
9170
|
+
};
|
|
9171
|
+
const tupleNumber = function () {
|
|
9172
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
9173
|
+
args[_key2] = arguments[_key2];
|
|
9174
|
+
}
|
|
9175
|
+
return args;
|
|
9176
|
+
};
|
|
9177
|
+
tuple('default', 'secondary', 'success', 'warning', 'error', 'abort', 'secondary-light', 'success-light', 'warning-light', 'error-light');
|
|
9178
|
+
tuple('default', 'secondary', 'success', 'warning', 'error');
|
|
9179
|
+
tuple('default', 'secondary', 'success', 'warning', 'error', 'dark', 'lite');
|
|
9180
|
+
tuple('default', 'secondary', 'success', 'warning', 'error', 'dark', 'lite', 'alert', 'purple', 'violet', 'cyan');
|
|
9181
|
+
tuple('default', 'silent', 'prevent');
|
|
9182
|
+
tuple('hover', 'click');
|
|
9183
|
+
tuple('top', 'topStart', 'topEnd', 'left', 'leftStart', 'leftEnd', 'bottom', 'bottomStart', 'bottomEnd', 'right', 'rightStart', 'rightEnd');
|
|
9184
|
+
tuple('start', 'center', 'end', 'left', 'right');
|
|
9185
|
+
|
|
9160
9186
|
const RatingSvg = props => jsxRuntime.jsx("svg", {
|
|
9161
9187
|
viewBox: "0 0 24 24",
|
|
9162
9188
|
/*
|