@zenkigen-inc/component-ui 1.3.0 → 1.3.1
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/dist/index.d.ts +1 -0
- package/dist/index.esm.js +114 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +105 -13
- package/dist/index.js.map +1 -1
- package/dist/pagination/index.d.ts +1 -0
- package/dist/pagination/pagination-button.d.ts +7 -0
- package/dist/pagination/pagination-context.d.ts +7 -0
- package/dist/pagination/pagination.d.ts +13 -0
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
package/dist/index.esm.js
CHANGED
|
@@ -31581,6 +31581,108 @@ function NotificationInline(_ref) {
|
|
|
31581
31581
|
});
|
|
31582
31582
|
}
|
|
31583
31583
|
|
|
31584
|
+
var PaginationContext = /*#__PURE__*/createContext({
|
|
31585
|
+
currentPage: 0
|
|
31586
|
+
});
|
|
31587
|
+
|
|
31588
|
+
function PaginationButton(_ref) {
|
|
31589
|
+
var page = _ref.page,
|
|
31590
|
+
_onClick = _ref.onClick;
|
|
31591
|
+
var _useContext = useContext(PaginationContext),
|
|
31592
|
+
currentPage = _useContext.currentPage;
|
|
31593
|
+
return /*#__PURE__*/jsx(Button, {
|
|
31594
|
+
variant: page === currentPage ? 'outline' : 'text',
|
|
31595
|
+
onClick: function onClick() {
|
|
31596
|
+
return _onClick(page);
|
|
31597
|
+
},
|
|
31598
|
+
children: page
|
|
31599
|
+
});
|
|
31600
|
+
}
|
|
31601
|
+
|
|
31602
|
+
var START_PAGE = 1;
|
|
31603
|
+
function Pagination(_ref) {
|
|
31604
|
+
var currentPage = _ref.currentPage,
|
|
31605
|
+
totalPage = _ref.totalPage,
|
|
31606
|
+
_ref$sideNumPagesToSh = _ref.sideNumPagesToShow,
|
|
31607
|
+
sideNumPagesToShow = _ref$sideNumPagesToSh === void 0 ? 3 : _ref$sideNumPagesToSh,
|
|
31608
|
+
_onClick = _ref.onClick;
|
|
31609
|
+
var center = Math.max(currentPage, START_PAGE + 1);
|
|
31610
|
+
center = Math.min(center, totalPage - 1);
|
|
31611
|
+
var start = Math.max(center - sideNumPagesToShow, START_PAGE + 1);
|
|
31612
|
+
var end = Math.min(center + sideNumPagesToShow, totalPage - 1);
|
|
31613
|
+
var offsetStart = center + sideNumPagesToShow >= totalPage ? totalPage - center - sideNumPagesToShow : 0;
|
|
31614
|
+
var offsetEnd = center <= sideNumPagesToShow ? sideNumPagesToShow - center + 1 : 0;
|
|
31615
|
+
var pageList = [];
|
|
31616
|
+
for (var i = start + offsetStart; i <= end + offsetEnd; i++) {
|
|
31617
|
+
pageList.push(i);
|
|
31618
|
+
}
|
|
31619
|
+
var threeDotIconClasses = 'flex h-8 w-8 items-center justify-center gap-1 fill-icon-icon01';
|
|
31620
|
+
return /*#__PURE__*/jsx(PaginationContext.Provider, {
|
|
31621
|
+
value: {
|
|
31622
|
+
currentPage: currentPage
|
|
31623
|
+
},
|
|
31624
|
+
children: /*#__PURE__*/jsxs("ul", {
|
|
31625
|
+
className: "flex gap-2",
|
|
31626
|
+
children: [/*#__PURE__*/jsx("li", {
|
|
31627
|
+
children: /*#__PURE__*/jsx(IconButton, {
|
|
31628
|
+
isDisabled: currentPage === START_PAGE,
|
|
31629
|
+
variant: "text",
|
|
31630
|
+
icon: "angle-left",
|
|
31631
|
+
size: "medium",
|
|
31632
|
+
onClick: function onClick() {
|
|
31633
|
+
return _onClick(currentPage - 1);
|
|
31634
|
+
}
|
|
31635
|
+
})
|
|
31636
|
+
}), /*#__PURE__*/jsx("li", {
|
|
31637
|
+
children: /*#__PURE__*/jsx(PaginationButton, {
|
|
31638
|
+
onClick: function onClick() {
|
|
31639
|
+
return _onClick(START_PAGE);
|
|
31640
|
+
},
|
|
31641
|
+
page: START_PAGE
|
|
31642
|
+
})
|
|
31643
|
+
}), pageList.length !== 0 && pageList[0] !== 2 && /*#__PURE__*/jsx("li", {
|
|
31644
|
+
className: threeDotIconClasses,
|
|
31645
|
+
children: /*#__PURE__*/jsx(Icon, {
|
|
31646
|
+
name: "more",
|
|
31647
|
+
size: "small"
|
|
31648
|
+
})
|
|
31649
|
+
}), pageList.map(function (page, index) {
|
|
31650
|
+
return /*#__PURE__*/jsx("li", {
|
|
31651
|
+
children: /*#__PURE__*/jsx(PaginationButton, {
|
|
31652
|
+
onClick: function onClick() {
|
|
31653
|
+
return _onClick(page);
|
|
31654
|
+
},
|
|
31655
|
+
page: page
|
|
31656
|
+
})
|
|
31657
|
+
}, index);
|
|
31658
|
+
}), pageList.length !== 0 && pageList[pageList.length - 1] !== totalPage - 1 && /*#__PURE__*/jsx("li", {
|
|
31659
|
+
className: threeDotIconClasses,
|
|
31660
|
+
children: /*#__PURE__*/jsx(Icon, {
|
|
31661
|
+
name: "more",
|
|
31662
|
+
size: "small"
|
|
31663
|
+
})
|
|
31664
|
+
}), /*#__PURE__*/jsx("li", {
|
|
31665
|
+
children: /*#__PURE__*/jsx(PaginationButton, {
|
|
31666
|
+
onClick: function onClick() {
|
|
31667
|
+
return _onClick(totalPage);
|
|
31668
|
+
},
|
|
31669
|
+
page: totalPage
|
|
31670
|
+
})
|
|
31671
|
+
}), /*#__PURE__*/jsx("li", {
|
|
31672
|
+
children: /*#__PURE__*/jsx(IconButton, {
|
|
31673
|
+
isDisabled: currentPage === totalPage,
|
|
31674
|
+
variant: "text",
|
|
31675
|
+
icon: "angle-right",
|
|
31676
|
+
size: "medium",
|
|
31677
|
+
onClick: function onClick() {
|
|
31678
|
+
return _onClick(currentPage + 1);
|
|
31679
|
+
}
|
|
31680
|
+
})
|
|
31681
|
+
})]
|
|
31682
|
+
})
|
|
31683
|
+
});
|
|
31684
|
+
}
|
|
31685
|
+
|
|
31584
31686
|
var SelectContext = /*#__PURE__*/createContext({
|
|
31585
31687
|
size: 'medium',
|
|
31586
31688
|
setIsOptionListOpen: function setIsOptionListOpen() {
|
|
@@ -32207,21 +32309,23 @@ function Tag(_ref) {
|
|
|
32207
32309
|
});
|
|
32208
32310
|
}
|
|
32209
32311
|
|
|
32210
|
-
var _excluded = ["size"];
|
|
32312
|
+
var _excluded = ["size", "isError", "onClickClearButton"];
|
|
32211
32313
|
var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
32212
32314
|
var _clsx;
|
|
32213
32315
|
var _ref$size = _ref.size,
|
|
32214
32316
|
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
32317
|
+
isError = _ref.isError,
|
|
32318
|
+
onClickClearButton = _ref.onClickClearButton,
|
|
32215
32319
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
32216
32320
|
var inputWrapClasses = clsx('flex items-center gap-2 overflow-hidden rounded border pl-2 pr-3', {
|
|
32217
|
-
'border-border-uiBorder01': !
|
|
32218
|
-
'border-support-supportError':
|
|
32219
|
-
'hover:border-hover-hoverInput': !props.disabled && !
|
|
32220
|
-
'hover:focus-within:border-active-activeInput': !
|
|
32221
|
-
'focus-within:border-active-activeInput': !
|
|
32321
|
+
'border-border-uiBorder01': !isError,
|
|
32322
|
+
'border-support-supportError': isError && !props.disabled,
|
|
32323
|
+
'hover:border-hover-hoverInput': !props.disabled && !isError,
|
|
32324
|
+
'hover:focus-within:border-active-activeInput': !isError,
|
|
32325
|
+
'focus-within:border-active-activeInput': !isError,
|
|
32222
32326
|
'bg-disabled-disabled02 border-disabled-disabled02': props.disabled
|
|
32223
32327
|
});
|
|
32224
|
-
var inputClasses = clsx('flex-1 outline-0 placeholder:text-text-textPlaceholder disabled:text-text-
|
|
32328
|
+
var inputClasses = clsx('flex-1 outline-0 placeholder:text-text-textPlaceholder disabled:text-text-textPlaceholder', (_clsx = {}, _clsx[typography.label.label2regular + " pt-1.5 pb-2"] = size === 'medium', _clsx[typography.label.label1regular + " py-2.5"] = size === 'large', _clsx['text-text-text01'] = !isError, _clsx['text-support-supportError'] = isError, _clsx));
|
|
32225
32329
|
return /*#__PURE__*/jsxs("div", {
|
|
32226
32330
|
className: inputWrapClasses,
|
|
32227
32331
|
children: [/*#__PURE__*/jsx("input", _extends({
|
|
@@ -32229,12 +32333,12 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
32229
32333
|
size: 1,
|
|
32230
32334
|
className: inputClasses,
|
|
32231
32335
|
onChange: props.onChange
|
|
32232
|
-
}, props)),
|
|
32336
|
+
}, props)), onClickClearButton && props.value && props.value.length !== 0 && !props.disabled && /*#__PURE__*/jsx(IconButton, {
|
|
32233
32337
|
variant: "text",
|
|
32234
32338
|
icon: "close",
|
|
32235
32339
|
size: "small",
|
|
32236
32340
|
isNoPadding: true,
|
|
32237
|
-
onClick:
|
|
32341
|
+
onClick: onClickClearButton
|
|
32238
32342
|
})]
|
|
32239
32343
|
});
|
|
32240
32344
|
});
|
|
@@ -32517,5 +32621,5 @@ function Tooltip(_ref) {
|
|
|
32517
32621
|
});
|
|
32518
32622
|
}
|
|
32519
32623
|
|
|
32520
|
-
export { Avatar, Breadcrumb, Button, Checkbox, Dropdown, EvaluationStar, Heading, Icon, IconButton, Loading, Modal, NotificationInline, PaginationSelect, Radio, Search, Select, SelectSort, Tab, TabItem, Table, TableCell, TableRow, Tag, TextInput, Toast, ToastProvider, Toggle, Tooltip, useToast };
|
|
32624
|
+
export { Avatar, Breadcrumb, Button, Checkbox, Dropdown, EvaluationStar, Heading, Icon, IconButton, Loading, Modal, NotificationInline, Pagination, PaginationSelect, Radio, Search, Select, SelectSort, Tab, TabItem, Table, TableCell, TableRow, Tag, TextInput, Toast, ToastProvider, Toggle, Tooltip, useToast };
|
|
32521
32625
|
//# sourceMappingURL=index.esm.js.map
|