krl-alfred 2.23.19 → 2.23.21

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 (24) hide show
  1. package/dist/components/DescriptionCard/DescriptionCard.d.ts +1 -1
  2. package/dist/components/DescriptionCard/DescriptionCard.js +4 -3
  3. package/dist/components/DescriptionCard/DescriptionCard.styled.d.ts +3 -3
  4. package/dist/components/DescriptionCard/DescriptionCard.styled.js +13 -11
  5. package/dist/components/DescriptionCard/DescriptionCard.test.d.ts +1 -0
  6. package/dist/components/DescriptionCard/DescriptionCard.test.js +54 -0
  7. package/dist/components/DescriptionCard/props.d.ts +4 -0
  8. package/dist/components/DescriptionCard/props.js +1 -0
  9. package/dist/components/DescriptionCard/stories/DescriptionCard.stories.d.ts +51 -1
  10. package/dist/components/DescriptionCard/stories/DescriptionCard.stories.js +9 -1
  11. package/dist/components/Input/Input.d.ts +2 -2
  12. package/dist/components/Input/Input.js +50 -137
  13. package/dist/components/Input/Input.test.d.ts +1 -0
  14. package/dist/components/Input/Input.test.js +118 -0
  15. package/dist/components/Input/hooks/useDatePickerCalendar.d.ts +36 -0
  16. package/dist/components/Input/hooks/useDatePickerCalendar.js +87 -0
  17. package/dist/components/Input/hooks/useDatePickerCalendar.test.d.ts +1 -0
  18. package/dist/components/Input/hooks/useDatePickerCalendar.test.js +46 -0
  19. package/dist/components/Input/utils/datePicker.d.ts +7 -0
  20. package/dist/components/Input/utils/datePicker.js +60 -0
  21. package/dist/components/Input/utils/datePicker.test.d.ts +1 -0
  22. package/dist/components/Input/utils/datePicker.test.js +17 -0
  23. package/dist/components/ShoppingCartProduct/ShoppingCartProduct.styled.d.ts +3 -7
  24. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { DescriptionCardProps } from "./props";
3
- declare const DescriptionCard: ({ title, titleSize, headerSize, headerAlignItems, headerDescription, headerButtonText, hasHeaderDropdown, hasHeaderBackButton, list, hasBadge, badgeText, hasHeader, hasHeaderBackground, hasHeaderBorder, hasRounded, hasBorder, headerImage, headerRightContent, dropdownList, dropdownWidth, accordionList, boxSize, hasHeaderButton, headerButtonWidth, hasHeaderPrimaryButton, headerPrimaryButtonAction, headerPrimaryButtonText, headerPrimaryButtonIcon, headerPrimaryButtonSize, content, hasNoContentSidePadding, middleTitle, status, subcategoryList, hasCategoryLayout, hasTwoColumnHeader, headerButtonAction, onHeaderBack, onHeaderClick, customColumnSpan }: DescriptionCardProps) => import("react").JSX.Element;
3
+ declare const DescriptionCard: ({ title, titleSize, headerSize, headerAlignItems, headerDescription, headerButtonText, hasHeaderDropdown, hasHeaderBackButton, list, hasBadge, badgeText, hasTitleBadgeBetween, hasHeader, hasHeaderBackground, hasHeaderBorder, hasRounded, hasBorder, headerImage, headerRightContent, dropdownList, dropdownWidth, accordionList, boxSize, hasHeaderButton, headerButtonWidth, hasHeaderPrimaryButton, headerPrimaryButtonAction, headerPrimaryButtonText, headerPrimaryButtonIcon, headerPrimaryButtonSize, content, hasNoContentSidePadding, middleTitle, status, subcategoryList, hasCategoryLayout, hasTwoColumnHeader, headerButtonAction, onHeaderBack, onHeaderClick, customColumnSpan }: DescriptionCardProps) => import("react").JSX.Element;
4
4
  export default DescriptionCard;
@@ -38,17 +38,18 @@ var SubcategoryRow = function (_a) {
38
38
  return ((0, jsx_runtime_1.jsxs)(DescriptionCard_styled_1.SubcategoryRowStyled, __assign({ "$hasCategoryLayout": hasCategoryLayout, "$isClickable": isClickable, onClick: item.onClick }, { children: [(0, jsx_runtime_1.jsxs)(DescriptionCard_styled_1.SubcategoryNameWrapper, { children: [(0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.SubcategoryIconWrapper, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "Subcategory", width: "24", height: "24", color: "var(--dark)" }) }), (0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.SubcategoryNameStyled, { children: item.name })] }), (hasCategoryLayout || item.middleTitle) && ((0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.RowMiddleTitleStyled, { children: item.middleTitle })), (hasCategoryLayout || item.status) && ((0, jsx_runtime_1.jsx)(CategoryStatusCell, { status: item.status })), (0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.SubcategoryActionWrapper, __assign({ "$hasCategoryLayout": hasCategoryLayout, onClick: function (e) { return e.stopPropagation(); } }, { children: hasButton && ((0, jsx_runtime_1.jsxs)(DropdownComponent, { children: [(0, jsx_runtime_1.jsx)(Button_1.default, __assign({ width: (_e = (_d = item.buttonWidth) !== null && _d !== void 0 ? _d : defaultButtonWidth) !== null && _e !== void 0 ? _e : null, onClick: item.buttonAction, size: "xsmall", variant: "inverted", icon: item.hasDropdown ? "ArrowSmallDown" : null }, { children: buttonText })), item.hasDropdown && ((_f = item.dropdownList) === null || _f === void 0 ? void 0 : _f.length) > 0 && ((0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.SubMenu, { children: (0, jsx_runtime_1.jsx)(OptionMenu_1.default, { hasActiveItem: false, data: item.dropdownList, rowLength: 20, gridItemWidth: item.dropdownWidth }) }))] })) }))] })));
39
39
  };
40
40
  var DescriptionCard = function (_a) {
41
- var _b = _a.title, title = _b === void 0 ? props_1.DescriptionCardDefault.title : _b, _c = _a.titleSize, titleSize = _c === void 0 ? props_1.DescriptionCardDefault.titleSize : _c, _d = _a.headerSize, headerSize = _d === void 0 ? props_1.DescriptionCardDefault.headerSize : _d, _e = _a.headerAlignItems, headerAlignItems = _e === void 0 ? props_1.DescriptionCardDefault.headerAlignItems : _e, _f = _a.headerDescription, headerDescription = _f === void 0 ? props_1.DescriptionCardDefault.headerDescription : _f, _g = _a.headerButtonText, headerButtonText = _g === void 0 ? props_1.DescriptionCardDefault.headerButtonText : _g, _h = _a.hasHeaderDropdown, hasHeaderDropdown = _h === void 0 ? props_1.DescriptionCardDefault.hasHeaderDropdown : _h, _j = _a.hasHeaderBackButton, hasHeaderBackButton = _j === void 0 ? props_1.DescriptionCardDefault.hasHeaderBackButton : _j, _k = _a.list, list = _k === void 0 ? props_1.DescriptionCardDefault.list : _k, _l = _a.hasBadge, hasBadge = _l === void 0 ? props_1.DescriptionCardDefault.hasBadge : _l, _m = _a.badgeText, badgeText = _m === void 0 ? props_1.DescriptionCardDefault.badgeText : _m, _o = _a.hasHeader, hasHeader = _o === void 0 ? props_1.DescriptionCardDefault.hasHeader : _o, _p = _a.hasHeaderBackground, hasHeaderBackground = _p === void 0 ? props_1.DescriptionCardDefault.hasHeaderBackground : _p, _q = _a.hasHeaderBorder, hasHeaderBorder = _q === void 0 ? props_1.DescriptionCardDefault.hasHeaderBorder : _q, _r = _a.hasRounded, hasRounded = _r === void 0 ? props_1.DescriptionCardDefault.hasRounded : _r, _s = _a.hasBorder, hasBorder = _s === void 0 ? props_1.DescriptionCardDefault.hasBorder : _s, _t = _a.headerImage, headerImage = _t === void 0 ? props_1.DescriptionCardDefault.headerImage : _t, _u = _a.headerRightContent, headerRightContent = _u === void 0 ? props_1.DescriptionCardDefault.headerRightContent : _u, _v = _a.dropdownList, dropdownList = _v === void 0 ? props_1.DescriptionCardDefault.dropdownList : _v, _w = _a.dropdownWidth, dropdownWidth = _w === void 0 ? props_1.DescriptionCardDefault.dropdownWidth : _w, _x = _a.accordionList, accordionList = _x === void 0 ? props_1.DescriptionCardDefault.accordionList : _x, _y = _a.boxSize, boxSize = _y === void 0 ? props_1.DescriptionCardDefault.boxSize : _y, _z = _a.hasHeaderButton, hasHeaderButton = _z === void 0 ? props_1.DescriptionCardDefault.hasHeaderButton : _z, _0 = _a.headerButtonWidth, headerButtonWidth = _0 === void 0 ? props_1.DescriptionCardDefault.headerButtonWidth : _0, _1 = _a.hasHeaderPrimaryButton, hasHeaderPrimaryButton = _1 === void 0 ? props_1.DescriptionCardDefault.hasHeaderPrimaryButton : _1, _2 = _a.headerPrimaryButtonAction, headerPrimaryButtonAction = _2 === void 0 ? props_1.DescriptionCardDefault.headerPrimaryButtonAction : _2, _3 = _a.headerPrimaryButtonText, headerPrimaryButtonText = _3 === void 0 ? props_1.DescriptionCardDefault.headerPrimaryButtonText : _3, _4 = _a.headerPrimaryButtonIcon, headerPrimaryButtonIcon = _4 === void 0 ? props_1.DescriptionCardDefault.headerPrimaryButtonIcon : _4, _5 = _a.headerPrimaryButtonSize, headerPrimaryButtonSize = _5 === void 0 ? props_1.DescriptionCardDefault.headerPrimaryButtonSize : _5, _6 = _a.content, content = _6 === void 0 ? props_1.DescriptionCardDefault.content : _6, _7 = _a.hasNoContentSidePadding, hasNoContentSidePadding = _7 === void 0 ? props_1.DescriptionCardDefault.hasNoContentSidePadding : _7, _8 = _a.middleTitle, middleTitle = _8 === void 0 ? props_1.DescriptionCardDefault.middleTitle : _8, _9 = _a.status, status = _9 === void 0 ? props_1.DescriptionCardDefault.status : _9, _10 = _a.subcategoryList, subcategoryList = _10 === void 0 ? props_1.DescriptionCardDefault.subcategoryList : _10, _11 = _a.hasCategoryLayout, hasCategoryLayout = _11 === void 0 ? props_1.DescriptionCardDefault.hasCategoryLayout : _11, _12 = _a.hasTwoColumnHeader, hasTwoColumnHeader = _12 === void 0 ? props_1.DescriptionCardDefault.hasTwoColumnHeader : _12, headerButtonAction = _a.headerButtonAction, onHeaderBack = _a.onHeaderBack, onHeaderClick = _a.onHeaderClick, _13 = _a.customColumnSpan, customColumnSpan = _13 === void 0 ? props_1.DescriptionCardDefault.customColumnSpan : _13;
41
+ var _b = _a.title, title = _b === void 0 ? props_1.DescriptionCardDefault.title : _b, _c = _a.titleSize, titleSize = _c === void 0 ? props_1.DescriptionCardDefault.titleSize : _c, _d = _a.headerSize, headerSize = _d === void 0 ? props_1.DescriptionCardDefault.headerSize : _d, _e = _a.headerAlignItems, headerAlignItems = _e === void 0 ? props_1.DescriptionCardDefault.headerAlignItems : _e, _f = _a.headerDescription, headerDescription = _f === void 0 ? props_1.DescriptionCardDefault.headerDescription : _f, _g = _a.headerButtonText, headerButtonText = _g === void 0 ? props_1.DescriptionCardDefault.headerButtonText : _g, _h = _a.hasHeaderDropdown, hasHeaderDropdown = _h === void 0 ? props_1.DescriptionCardDefault.hasHeaderDropdown : _h, _j = _a.hasHeaderBackButton, hasHeaderBackButton = _j === void 0 ? props_1.DescriptionCardDefault.hasHeaderBackButton : _j, _k = _a.list, list = _k === void 0 ? props_1.DescriptionCardDefault.list : _k, _l = _a.hasBadge, hasBadge = _l === void 0 ? props_1.DescriptionCardDefault.hasBadge : _l, _m = _a.badgeText, badgeText = _m === void 0 ? props_1.DescriptionCardDefault.badgeText : _m, _o = _a.hasTitleBadgeBetween, hasTitleBadgeBetween = _o === void 0 ? props_1.DescriptionCardDefault.hasTitleBadgeBetween : _o, _p = _a.hasHeader, hasHeader = _p === void 0 ? props_1.DescriptionCardDefault.hasHeader : _p, _q = _a.hasHeaderBackground, hasHeaderBackground = _q === void 0 ? props_1.DescriptionCardDefault.hasHeaderBackground : _q, _r = _a.hasHeaderBorder, hasHeaderBorder = _r === void 0 ? props_1.DescriptionCardDefault.hasHeaderBorder : _r, _s = _a.hasRounded, hasRounded = _s === void 0 ? props_1.DescriptionCardDefault.hasRounded : _s, _t = _a.hasBorder, hasBorder = _t === void 0 ? props_1.DescriptionCardDefault.hasBorder : _t, _u = _a.headerImage, headerImage = _u === void 0 ? props_1.DescriptionCardDefault.headerImage : _u, _v = _a.headerRightContent, headerRightContent = _v === void 0 ? props_1.DescriptionCardDefault.headerRightContent : _v, _w = _a.dropdownList, dropdownList = _w === void 0 ? props_1.DescriptionCardDefault.dropdownList : _w, _x = _a.dropdownWidth, dropdownWidth = _x === void 0 ? props_1.DescriptionCardDefault.dropdownWidth : _x, _y = _a.accordionList, accordionList = _y === void 0 ? props_1.DescriptionCardDefault.accordionList : _y, _z = _a.boxSize, boxSize = _z === void 0 ? props_1.DescriptionCardDefault.boxSize : _z, _0 = _a.hasHeaderButton, hasHeaderButton = _0 === void 0 ? props_1.DescriptionCardDefault.hasHeaderButton : _0, _1 = _a.headerButtonWidth, headerButtonWidth = _1 === void 0 ? props_1.DescriptionCardDefault.headerButtonWidth : _1, _2 = _a.hasHeaderPrimaryButton, hasHeaderPrimaryButton = _2 === void 0 ? props_1.DescriptionCardDefault.hasHeaderPrimaryButton : _2, _3 = _a.headerPrimaryButtonAction, headerPrimaryButtonAction = _3 === void 0 ? props_1.DescriptionCardDefault.headerPrimaryButtonAction : _3, _4 = _a.headerPrimaryButtonText, headerPrimaryButtonText = _4 === void 0 ? props_1.DescriptionCardDefault.headerPrimaryButtonText : _4, _5 = _a.headerPrimaryButtonIcon, headerPrimaryButtonIcon = _5 === void 0 ? props_1.DescriptionCardDefault.headerPrimaryButtonIcon : _5, _6 = _a.headerPrimaryButtonSize, headerPrimaryButtonSize = _6 === void 0 ? props_1.DescriptionCardDefault.headerPrimaryButtonSize : _6, _7 = _a.content, content = _7 === void 0 ? props_1.DescriptionCardDefault.content : _7, _8 = _a.hasNoContentSidePadding, hasNoContentSidePadding = _8 === void 0 ? props_1.DescriptionCardDefault.hasNoContentSidePadding : _8, _9 = _a.middleTitle, middleTitle = _9 === void 0 ? props_1.DescriptionCardDefault.middleTitle : _9, _10 = _a.status, status = _10 === void 0 ? props_1.DescriptionCardDefault.status : _10, _11 = _a.subcategoryList, subcategoryList = _11 === void 0 ? props_1.DescriptionCardDefault.subcategoryList : _11, _12 = _a.hasCategoryLayout, hasCategoryLayout = _12 === void 0 ? props_1.DescriptionCardDefault.hasCategoryLayout : _12, _13 = _a.hasTwoColumnHeader, hasTwoColumnHeader = _13 === void 0 ? props_1.DescriptionCardDefault.hasTwoColumnHeader : _13, headerButtonAction = _a.headerButtonAction, onHeaderBack = _a.onHeaderBack, onHeaderClick = _a.onHeaderClick, _14 = _a.customColumnSpan, customColumnSpan = _14 === void 0 ? props_1.DescriptionCardDefault.customColumnSpan : _14;
42
42
  var hasSubcategories = (subcategoryList === null || subcategoryList === void 0 ? void 0 : subcategoryList.length) > 0;
43
43
  var HeaderDropdownComponent = hasCategoryLayout ? DescriptionCard_styled_1.CategoryDropdownWrapper : DescriptionCard_styled_1.DropdownWrapper;
44
44
  var hasHeaderRightContent = !!headerRightContent;
45
+ var hasHeaderRight = hasHeaderRightContent || hasHeaderPrimaryButton || hasHeaderButton;
45
46
  var isHeaderClickable = !!onHeaderClick && !hasHeaderBackButton;
46
47
  var handleBackTitleClick = onHeaderClick !== null && onHeaderClick !== void 0 ? onHeaderClick : (onHeaderBack ? function () { onHeaderBack(); } : undefined);
47
48
  var isBackTitleClickable = hasHeaderBackButton && !!handleBackTitleClick;
48
- return ((0, jsx_runtime_1.jsxs)(DescriptionCard_styled_1.DescriptionCardStyled, __assign({ "$hasRounded": hasRounded, "$hasBorder": hasBorder }, { children: [hasHeader && ((0, jsx_runtime_1.jsxs)(DescriptionCard_styled_1.DescriptionCardHeaderStyled, __assign({ "$hasCategoryLayout": hasCategoryLayout, "$hasTwoColumnHeader": hasTwoColumnHeader, "$hasHeaderRightContent": hasHeaderRightContent, "$hasMiddleTitle": (!hasTwoColumnHeader && !!middleTitle) || hasCategoryLayout, "$headerImage": headerImage, "$hasHeaderBackground": hasHeaderBackground, "$hasHeaderBorder": hasHeaderBorder, "$hasHeaderDescription": Boolean(headerDescription), "$headerSize": headerSize, "$headerAlignItems": headerAlignItems }, { children: [(0, jsx_runtime_1.jsxs)(DescriptionCard_styled_1.HeaderLeftStyled, { children: [headerImage && ((0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.HeaderImageWrapperStyled, { children: headerImage })), hasHeaderBackButton && ((0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.HeaderBackButtonStyled, __assign({ type: "button", onClick: function (e) {
49
+ return ((0, jsx_runtime_1.jsxs)(DescriptionCard_styled_1.DescriptionCardStyled, __assign({ "$hasRounded": hasRounded, "$hasBorder": hasBorder }, { children: [hasHeader && ((0, jsx_runtime_1.jsxs)(DescriptionCard_styled_1.DescriptionCardHeaderStyled, __assign({ "$hasCategoryLayout": hasCategoryLayout, "$hasTwoColumnHeader": hasTwoColumnHeader, "$hasHeaderRightContent": hasHeaderRightContent, "$hasHeaderRight": hasHeaderRight, "$hasMiddleTitle": (!hasTwoColumnHeader && !!middleTitle) || hasCategoryLayout, "$headerImage": headerImage, "$hasHeaderBackground": hasHeaderBackground, "$hasHeaderBorder": hasHeaderBorder, "$hasHeaderDescription": Boolean(headerDescription), "$headerSize": headerSize, "$headerAlignItems": headerAlignItems }, { children: [(0, jsx_runtime_1.jsxs)(DescriptionCard_styled_1.HeaderLeftStyled, { children: [headerImage && ((0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.HeaderImageWrapperStyled, { children: headerImage })), hasHeaderBackButton && ((0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.HeaderBackButtonStyled, __assign({ type: "button", onClick: function (e) {
49
50
  e.stopPropagation();
50
51
  onHeaderBack === null || onHeaderBack === void 0 ? void 0 : onHeaderBack();
51
- }, "aria-label": "Geri" }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "ArrowLeft", width: "24", height: "24" }) }))), (0, jsx_runtime_1.jsxs)(DescriptionCard_styled_1.HeaderTitleWrapperStyled, __assign({ "$isClickable": isHeaderClickable, onClick: isHeaderClickable ? onHeaderClick : undefined }, { children: [(0, jsx_runtime_1.jsxs)(DescriptionCard_styled_1.HeaderTitleTopStyled, { children: [(0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.HeaderTitleStyled, __assign({ "$titleSize": titleSize, "$isClickable": isBackTitleClickable, onClick: isBackTitleClickable ? handleBackTitleClick : undefined }, { children: title })), hasBadge && ((0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.BadgeWrapper, { children: (0, jsx_runtime_1.jsx)(Badges_1.default, { layout: "text", variant: "secondary", title: badgeText }) }))] }), headerDescription && ((0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.HeaderTitleDescriptionStyled, { children: headerDescription }))] }))] }), (hasCategoryLayout || middleTitle) && ((0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.HeaderMiddleTitleStyled, __assign({ "$isClickable": isHeaderClickable, onClick: isHeaderClickable ? onHeaderClick : undefined }, { children: middleTitle }))), (hasCategoryLayout || status) && ((0, jsx_runtime_1.jsx)(CategoryStatusCell, { status: status })), (0, jsx_runtime_1.jsxs)(DescriptionCard_styled_1.HeaderRightStyled, __assign({ "$hasCategoryLayout": hasCategoryLayout, "$hasHeaderRightContent": hasHeaderRightContent, onClick: function (e) { return e.stopPropagation(); } }, { children: [headerRightContent && ((0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.HeaderRightContentStyled, { children: headerRightContent })), hasHeaderPrimaryButton && ((0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.HeaderActionWrapperStyled, { children: (0, jsx_runtime_1.jsx)(Button_1.default, __assign({ onClick: headerPrimaryButtonAction, size: headerPrimaryButtonSize, variant: "primary", icon: headerPrimaryButtonIcon }, { children: headerPrimaryButtonText })) })), hasHeaderButton && ((0, jsx_runtime_1.jsxs)(HeaderDropdownComponent, { children: [(0, jsx_runtime_1.jsx)(Button_1.default, __assign({ width: headerButtonWidth, onClick: headerButtonAction, size: "xsmall", variant: "inverted", icon: hasHeaderDropdown ? "ArrowSmallDown" : null }, { children: headerButtonText })), hasHeaderDropdown && ((0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.SubMenu, { children: (0, jsx_runtime_1.jsx)(OptionMenu_1.default, { hasActiveItem: false, data: dropdownList, rowLength: 20, gridItemWidth: dropdownWidth }) }))] }))] }))] }))), content && (0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.ContentWrapper, __assign({ "$hasNoContentSidePadding": hasNoContentSidePadding }, { children: content })), hasSubcategories && ((0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.CategoryContentWrapper, { children: (0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.SubcategoryListWrapper, __assign({ "$hasCategoryLayout": hasCategoryLayout }, { children: subcategoryList.map(function (item, key) { return ((0, jsx_runtime_1.jsx)(SubcategoryRow, { item: item, defaultButtonText: headerButtonText, defaultButtonWidth: headerButtonWidth, hasCategoryLayout: hasCategoryLayout }, key)); }) })) })), list.length > 0 && ((0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.ListStyled, __assign({ "$boxSize": boxSize, "$hasHeader": hasHeader, "$hasAccordion": (accordionList === null || accordionList === void 0 ? void 0 : accordionList.length) > 0 }, { children: list.map(function (listItem, key) {
52
+ }, "aria-label": "Geri" }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "ArrowLeft", width: "24", height: "24" }) }))), (0, jsx_runtime_1.jsxs)(DescriptionCard_styled_1.HeaderTitleWrapperStyled, __assign({ "$isClickable": isHeaderClickable, onClick: isHeaderClickable ? onHeaderClick : undefined }, { children: [(0, jsx_runtime_1.jsxs)(DescriptionCard_styled_1.HeaderTitleTopStyled, __assign({ "$hasTitleBadgeBetween": hasTitleBadgeBetween }, { children: [(0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.HeaderTitleStyled, __assign({ "$titleSize": titleSize, "$isClickable": isBackTitleClickable, onClick: isBackTitleClickable ? handleBackTitleClick : undefined }, { children: title })), hasBadge && ((0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.BadgeWrapper, __assign({ "$hasTitleBadgeBetween": hasTitleBadgeBetween }, { children: (0, jsx_runtime_1.jsx)(Badges_1.default, { layout: "text", variant: "secondary", title: badgeText }) })))] })), headerDescription && ((0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.HeaderTitleDescriptionStyled, { children: headerDescription }))] }))] }), (hasCategoryLayout || middleTitle) && ((0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.HeaderMiddleTitleStyled, __assign({ "$isClickable": isHeaderClickable, onClick: isHeaderClickable ? onHeaderClick : undefined }, { children: middleTitle }))), (hasCategoryLayout || status) && ((0, jsx_runtime_1.jsx)(CategoryStatusCell, { status: status })), (0, jsx_runtime_1.jsxs)(DescriptionCard_styled_1.HeaderRightStyled, __assign({ "$hasCategoryLayout": hasCategoryLayout, "$hasHeaderRightContent": hasHeaderRightContent, "$hasHeaderRight": hasHeaderRight, onClick: function (e) { return e.stopPropagation(); } }, { children: [headerRightContent && ((0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.HeaderRightContentStyled, { children: headerRightContent })), hasHeaderPrimaryButton && ((0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.HeaderActionWrapperStyled, { children: (0, jsx_runtime_1.jsx)(Button_1.default, __assign({ onClick: headerPrimaryButtonAction, size: headerPrimaryButtonSize, variant: "primary", icon: headerPrimaryButtonIcon }, { children: headerPrimaryButtonText })) })), hasHeaderButton && ((0, jsx_runtime_1.jsxs)(HeaderDropdownComponent, { children: [(0, jsx_runtime_1.jsx)(Button_1.default, __assign({ width: headerButtonWidth, onClick: headerButtonAction, size: "xsmall", variant: "inverted", icon: hasHeaderDropdown ? "ArrowSmallDown" : null }, { children: headerButtonText })), hasHeaderDropdown && ((0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.SubMenu, { children: (0, jsx_runtime_1.jsx)(OptionMenu_1.default, { hasActiveItem: false, data: dropdownList, rowLength: 20, gridItemWidth: dropdownWidth }) }))] }))] }))] }))), content && (0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.ContentWrapper, __assign({ "$hasNoContentSidePadding": hasNoContentSidePadding }, { children: content })), hasSubcategories && ((0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.CategoryContentWrapper, { children: (0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.SubcategoryListWrapper, __assign({ "$hasCategoryLayout": hasCategoryLayout }, { children: subcategoryList.map(function (item, key) { return ((0, jsx_runtime_1.jsx)(SubcategoryRow, { item: item, defaultButtonText: headerButtonText, defaultButtonWidth: headerButtonWidth, hasCategoryLayout: hasCategoryLayout }, key)); }) })) })), list.length > 0 && ((0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.ListStyled, __assign({ "$boxSize": boxSize, "$hasHeader": hasHeader, "$hasAccordion": (accordionList === null || accordionList === void 0 ? void 0 : accordionList.length) > 0 }, { children: list.map(function (listItem, key) {
52
53
  var _a;
53
54
  var span = (_a = customColumnSpan[key]) !== null && _a !== void 0 ? _a : 1;
54
55
  return ((0, jsx_runtime_1.jsxs)(DescriptionCard_styled_1.ListItemStyled, __assign({ "$columnSpan": span }, { children: [(0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.DisplayTitleStyled, { children: listItem.title }), (0, jsx_runtime_1.jsx)(DescriptionCard_styled_1.DisplayValueStyled, { children: listItem.display || "-" })] }), key));
@@ -16,7 +16,7 @@ export declare const CategoryDropdownWrapper: import("styled-components/dist/typ
16
16
  }, "ref"> & {
17
17
  ref?: import("react").Ref<HTMLDivElement>;
18
18
  }, "style"> & {
19
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | (import("styled-components").CSSProperties & {
19
+ style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | (import("react").CSSProperties & {
20
20
  [key: `--${string}`]: string | number;
21
21
  });
22
22
  }> & string;
@@ -44,9 +44,9 @@ export declare const HeaderRightContentStyled: import("styled-components/dist/ty
44
44
  export declare const HeaderTitleWrapperStyled: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
45
45
  style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars;
46
46
  }, DescriptionCardStyledProps>> & string;
47
- export declare const HeaderTitleTopStyled: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
47
+ export declare const HeaderTitleTopStyled: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
48
48
  style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars;
49
- }> & string;
49
+ }, DescriptionCardStyledProps>> & string;
50
50
  export declare const HeaderTitleDescriptionStyled: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "style"> & {
51
51
  style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars;
52
52
  }> & string;
@@ -27,29 +27,31 @@ exports.DescriptionCardHeaderStyled = styled_components_1.default.div(templateOb
27
27
  return '1rem 0';
28
28
  return reduceBottomPadding ? '1.5rem 0 1rem' : '1.5rem 0';
29
29
  }, function (props) { return props.$headerSize === 'medium' ? '88px' : 'auto'; }, function (props) {
30
+ var hasRight = props.$hasHeaderRight;
30
31
  if (props.$hasTwoColumnHeader)
31
- return '1fr auto';
32
- if (props.$hasCategoryLayout)
33
- return exports.categoryRowGridColumns;
34
- if (props.$hasHeaderRightContent && !props.$hasMiddleTitle)
35
- return 'minmax(0, 1fr) auto';
32
+ return hasRight ? '1fr auto' : '1fr';
33
+ if (props.$hasCategoryLayout) {
34
+ return hasRight ? exports.categoryRowGridColumns : 'minmax(0, 1fr) 6.5rem 9.5rem';
35
+ }
36
36
  if (props.$hasMiddleTitle)
37
- return '1fr 1fr auto';
38
- return '1fr auto';
37
+ return hasRight ? '1fr 1fr auto' : '1fr 1fr';
38
+ if (hasRight)
39
+ return 'minmax(0, 1fr) auto';
40
+ return '1fr';
39
41
  }, function (props) { return props.$headerAlignItems || 'center'; }, function (props) { return props.$hasCategoryLayout ? '3.5rem' : '1.5rem'; }, function (props) { return props.$hasHeaderBackground ? 'var(--dark-opacity-3)' : 'transparent'; }, function (props) { return props.$hasHeaderBorder ? '1px solid var(--dark-opacity-10)' : 'none'; }, function (props) { return props.$hasCategoryLayout && "\n &:hover ".concat(exports.CategoryDropdownWrapper, ",\n ").concat(exports.CategoryDropdownWrapper, ":hover,\n ").concat(exports.CategoryDropdownWrapper, ":focus-within {\n opacity: 1;\n visibility: visible;\n }\n "); });
40
42
  exports.HeaderLeftStyled = styled_components_1.default.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: flex-start;\n min-width: 0;\n"], ["\n display: flex;\n align-items: center;\n justify-content: flex-start;\n min-width: 0;\n"])));
41
43
  exports.HeaderBackButtonStyled = styled_components_1.default.button(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n margin: 0 1rem 0 0;\n padding: 0;\n border: 0;\n background: transparent;\n cursor: pointer;\n color: var(--primary);\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n margin: 0 1rem 0 0;\n padding: 0;\n border: 0;\n background: transparent;\n cursor: pointer;\n color: var(--primary);\n"])));
42
- exports.HeaderRightStyled = styled_components_1.default.div(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: ", ";\n width: ", ";\n min-width: 0;\n\n > div + div {\n margin-left: 1rem;\n }\n"], ["\n display: flex;\n align-items: center;\n justify-content: ", ";\n width: ", ";\n min-width: 0;\n\n > div + div {\n margin-left: 1rem;\n }\n"])), function (props) { return props.$hasCategoryLayout || props.$hasHeaderRightContent ? 'flex-end' : 'flex-start'; }, function (props) { return props.$hasCategoryLayout ? '100%' : 'auto'; });
44
+ exports.HeaderRightStyled = styled_components_1.default.div(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n display: ", ";\n align-items: center;\n justify-content: ", ";\n width: ", ";\n min-width: 0;\n\n > div + div {\n margin-left: 1rem;\n }\n"], ["\n display: ", ";\n align-items: center;\n justify-content: ", ";\n width: ", ";\n min-width: 0;\n\n > div + div {\n margin-left: 1rem;\n }\n"])), function (props) { return props.$hasHeaderRight ? 'flex' : 'none'; }, function (props) { return props.$hasCategoryLayout || props.$hasHeaderRightContent ? 'flex-end' : 'flex-start'; }, function (props) { return props.$hasCategoryLayout ? '100%' : 'auto'; });
43
45
  exports.HeaderActionWrapperStyled = styled_components_1.default.div(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n display: block;\n"], ["\n display: block;\n"])));
44
46
  exports.HeaderRightContentStyled = styled_components_1.default.div(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n display: block;\n min-width: 0;\n"], ["\n display: block;\n min-width: 0;\n"])));
45
- exports.HeaderTitleWrapperStyled = styled_components_1.default.div(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n min-width: 0;\n cursor: ", ";\n"], ["\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n min-width: 0;\n cursor: ", ";\n"])), function (props) { return props.$isClickable ? 'pointer' : 'default'; });
46
- exports.HeaderTitleTopStyled = styled_components_1.default.div(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n min-width: 0;\n"], ["\n display: flex;\n align-items: center;\n min-width: 0;\n"])));
47
+ exports.HeaderTitleWrapperStyled = styled_components_1.default.div(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n min-width: 0;\n cursor: ", ";\n width: 100%;\n"], ["\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n min-width: 0;\n cursor: ", ";\n width: 100%;\n"])), function (props) { return props.$isClickable ? 'pointer' : 'default'; });
48
+ exports.HeaderTitleTopStyled = styled_components_1.default.div(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n min-width: 0;\n width: ", ";\n justify-content: ", ";\n"], ["\n display: flex;\n align-items: center;\n min-width: 0;\n width: ", ";\n justify-content: ", ";\n"])), function (props) { return props.$hasTitleBadgeBetween ? '100%' : 'auto'; }, function (props) { return props.$hasTitleBadgeBetween ? 'space-between' : 'flex-start'; });
47
49
  exports.HeaderTitleDescriptionStyled = styled_components_1.default.p(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n margin: 1rem 0 0;\n font: var(--body-regular-14-17);\n color: var(--dark);\n"], ["\n margin: 1rem 0 0;\n font: var(--body-regular-14-17);\n color: var(--dark);\n"])));
48
50
  exports.HeaderTitleStyled = styled_components_1.default.strong(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n font: ", ";\n display: inline-block;\n cursor: ", ";\n"], ["\n font: ", ";\n display: inline-block;\n cursor: ", ";\n"])), function (props) { return props.$titleSize === 'lg'
49
51
  ? 'var(--headline-semi-bold-20-24)'
50
52
  : 'var(--headline-semi-bold-18-22)'; }, function (props) { return props.$isClickable ? 'pointer' : 'inherit'; });
51
53
  exports.HeaderImageWrapperStyled = styled_components_1.default.div(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n display: block;\n border: 1px solid var(--dark-opacity-5);\n width: 64px;\n height: 64px;\n border-radius: 0.5rem;\n position: relative;\n overflow: hidden;\n margin-right: 1.5rem;\n background-color: white;\n *{\n width: 100%;\n height: 100%;\n object-fit: contain;\n display: block;\n padding: 0.5rem;\n box-sizing: border-box;\n }\n"], ["\n display: block;\n border: 1px solid var(--dark-opacity-5);\n width: 64px;\n height: 64px;\n border-radius: 0.5rem;\n position: relative;\n overflow: hidden;\n margin-right: 1.5rem;\n background-color: white;\n *{\n width: 100%;\n height: 100%;\n object-fit: contain;\n display: block;\n padding: 0.5rem;\n box-sizing: border-box;\n }\n"])));
52
- exports.BadgeWrapper = styled_components_1.default.div(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n display: block;\n margin-left: 1.5rem;\n"], ["\n display: block;\n margin-left: 1.5rem;\n"])));
54
+ exports.BadgeWrapper = styled_components_1.default.div(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n display: block;\n margin-left: ", ";\n flex-shrink: 0;\n"], ["\n display: block;\n margin-left: ", ";\n flex-shrink: 0;\n"])), function (props) { return props.$hasTitleBadgeBetween ? '0' : '1.5rem'; });
53
55
  exports.ContentWrapper = styled_components_1.default.div(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\n display: block;\n padding: ", ";\n"], ["\n display: block;\n padding: ", ";\n"])), function (props) { return props.$hasNoContentSidePadding ? '0' : '0 1.5rem'; });
54
56
  exports.ListStyled = styled_components_1.default.ul(templateObject_18 || (templateObject_18 = __makeTemplateObject(["\n display: grid;\n grid-template-columns: repeat(", ",1fr);\n padding: 0;\n margin: 0;\n position: relative;\n overflow: hidden;\n border-top-left-radius: ", ";\n border-top-right-radius: ", ";\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n &:before{\n content: \"\";\n position: absolute;\n inset: 0;\n border: 1px solid var(--dark-opacity-10);\n border-radius: inherit;\n user-select: none;\n pointer-events: none;\n }\n"], ["\n display: grid;\n grid-template-columns: repeat(", ",1fr);\n padding: 0;\n margin: 0;\n position: relative;\n overflow: hidden;\n border-top-left-radius: ", ";\n border-top-right-radius: ", ";\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n &:before{\n content: \"\";\n position: absolute;\n inset: 0;\n border: 1px solid var(--dark-opacity-10);\n border-radius: inherit;\n user-select: none;\n pointer-events: none;\n }\n"])), function (props) { return props.$boxSize; }, function (props) { return props.$hasHeader ? '0' : 'inherit'; }, function (props) { return props.$hasHeader ? '0' : 'inherit'; }, function (props) { return props.$hasAccordion ? '0' : 'inherit'; }, function (props) { return props.$hasAccordion ? '0' : 'inherit'; });
55
57
  exports.ListItemStyled = styled_components_1.default.li(templateObject_19 || (templateObject_19 = __makeTemplateObject(["\n display: block;\n padding: 1.5rem;\n border-right: 1px solid var(--dark-opacity-10);\n border-bottom: 1px solid var(--dark-opacity-10);\n word-break: break-word;\n grid-column: span ", ";\n\n &:is(:last-child){\n border-right: 0;\n }\n"], ["\n display: block;\n padding: 1.5rem;\n border-right: 1px solid var(--dark-opacity-10);\n border-bottom: 1px solid var(--dark-opacity-10);\n word-break: break-word;\n grid-column: span ", ";\n\n &:is(:last-child){\n border-right: 0;\n }\n"])), function (props) { var _a; return (_a = props.$columnSpan) !== null && _a !== void 0 ? _a : 1; });
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ var jsx_runtime_1 = require("react/jsx-runtime");
18
+ var react_1 = require("@testing-library/react");
19
+ var DescriptionCard_1 = __importDefault(require("./DescriptionCard"));
20
+ var props_1 = require("./props");
21
+ var renderDescriptionCard = function (props) {
22
+ var _a, _b;
23
+ if (props === void 0) { props = {}; }
24
+ var view = (0, react_1.render)((0, jsx_runtime_1.jsx)(DescriptionCard_1.default, __assign({}, props_1.DescriptionCardDefault, { list: [] }, props)));
25
+ var headerRightSection = (_b = (_a = view.container.firstElementChild) === null || _a === void 0 ? void 0 : _a.firstElementChild) === null || _b === void 0 ? void 0 : _b.lastElementChild;
26
+ return __assign({ headerRightSection: headerRightSection }, view);
27
+ };
28
+ describe('DescriptionCard', function () {
29
+ it('hides header right section when it has no content', function () {
30
+ var headerRightSection = renderDescriptionCard({
31
+ hasHeaderButton: false,
32
+ hasHeaderPrimaryButton: false,
33
+ headerRightContent: null,
34
+ }).headerRightSection;
35
+ expect(headerRightSection).toHaveStyle({ display: 'none' });
36
+ });
37
+ it('shows header right section when header button exists', function () {
38
+ var headerRightSection = renderDescriptionCard({
39
+ hasHeaderButton: true,
40
+ }).headerRightSection;
41
+ expect(headerRightSection).toHaveStyle({ display: 'flex' });
42
+ });
43
+ it('renders title and badge when hasTitleBadgeBetween is true', function () {
44
+ renderDescriptionCard({
45
+ title: 'Product Name',
46
+ hasBadge: true,
47
+ badgeText: 'Yeni',
48
+ hasTitleBadgeBetween: true,
49
+ headerImage: null,
50
+ });
51
+ expect(react_1.screen.getByText('Product Name')).toBeInTheDocument();
52
+ expect(react_1.screen.getByText('Yeni')).toBeInTheDocument();
53
+ });
54
+ });
@@ -24,6 +24,8 @@ export interface DescriptionCard {
24
24
  headerDescription?: string;
25
25
  hasBadge?: boolean;
26
26
  badgeText?: string;
27
+ /** true ise başlık solda, badge sağda space-between hizalanır */
28
+ hasTitleBadgeBetween?: boolean;
27
29
  /** Header alanını gösterir/gizler */
28
30
  hasHeader?: boolean;
29
31
  /** Header arka planı (var / yok) */
@@ -81,6 +83,8 @@ export interface DescriptionCardStyledProps {
81
83
  $hasHeaderPrimaryButton?: boolean;
82
84
  $hasMiddleTitle?: boolean;
83
85
  $hasHeaderRightContent?: boolean;
86
+ $hasHeaderRight?: boolean;
87
+ $hasTitleBadgeBetween?: boolean;
84
88
  $hasCategoryLayout?: boolean;
85
89
  $hasTwoColumnHeader?: boolean;
86
90
  $hasNoContentSidePadding?: boolean;
@@ -14,6 +14,7 @@ exports.DescriptionCardDefault = {
14
14
  headerAlignItems: "center",
15
15
  headerDescription: null,
16
16
  hasBadge: false,
17
+ hasTitleBadgeBetween: false,
17
18
  hasHeader: true,
18
19
  hasHeaderBackground: false,
19
20
  hasHeaderBorder: false,
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  declare const _default: {
3
3
  title: string;
4
- component: ({ title, titleSize, headerSize, headerAlignItems, headerDescription, headerButtonText, hasHeaderDropdown, hasHeaderBackButton, list, hasBadge, badgeText, hasHeader, hasHeaderBackground, hasHeaderBorder, hasRounded, hasBorder, headerImage, headerRightContent, dropdownList, dropdownWidth, accordionList, boxSize, hasHeaderButton, headerButtonWidth, hasHeaderPrimaryButton, headerPrimaryButtonAction, headerPrimaryButtonText, headerPrimaryButtonIcon, headerPrimaryButtonSize, content, hasNoContentSidePadding, middleTitle, status, subcategoryList, hasCategoryLayout, hasTwoColumnHeader, headerButtonAction, onHeaderBack, onHeaderClick, customColumnSpan }: import("../props").DescriptionCard) => React.JSX.Element;
4
+ component: ({ title, titleSize, headerSize, headerAlignItems, headerDescription, headerButtonText, hasHeaderDropdown, hasHeaderBackButton, list, hasBadge, badgeText, hasTitleBadgeBetween, hasHeader, hasHeaderBackground, hasHeaderBorder, hasRounded, hasBorder, headerImage, headerRightContent, dropdownList, dropdownWidth, accordionList, boxSize, hasHeaderButton, headerButtonWidth, hasHeaderPrimaryButton, headerPrimaryButtonAction, headerPrimaryButtonText, headerPrimaryButtonIcon, headerPrimaryButtonSize, content, hasNoContentSidePadding, middleTitle, status, subcategoryList, hasCategoryLayout, hasTwoColumnHeader, headerButtonAction, onHeaderBack, onHeaderClick, customColumnSpan }: import("../props").DescriptionCard) => React.JSX.Element;
5
5
  tags: string[];
6
6
  argTypes: {
7
7
  title: {
@@ -26,6 +26,10 @@ declare const _default: {
26
26
  hasBadge: {
27
27
  control: string;
28
28
  };
29
+ hasTitleBadgeBetween: {
30
+ control: string;
31
+ description: string;
32
+ };
29
33
  badgeText: {
30
34
  control: string;
31
35
  };
@@ -178,6 +182,52 @@ export declare const WithBadge: {
178
182
  hasTwoColumnHeader: boolean;
179
183
  };
180
184
  };
185
+ export declare const WithTitleBadgeBetween: {
186
+ name: string;
187
+ args: {
188
+ headerImage: any;
189
+ list: any[];
190
+ hasBadge: boolean;
191
+ badgeText: string;
192
+ hasTitleBadgeBetween: boolean;
193
+ title: string;
194
+ titleSize: "md";
195
+ headerSize: "small";
196
+ headerAlignItems: "center";
197
+ hasHeaderDropdown: boolean;
198
+ hasHeaderBackButton: boolean;
199
+ headerButtonText: string;
200
+ hasHeader: boolean;
201
+ hasHeaderBackground: boolean;
202
+ hasHeaderBorder: boolean;
203
+ hasRounded: boolean;
204
+ hasBorder: boolean;
205
+ hasHeaderButton: boolean;
206
+ headerButtonWidth: any;
207
+ hasHeaderPrimaryButton: boolean;
208
+ headerPrimaryButtonText: string;
209
+ headerPrimaryButtonIcon: any;
210
+ headerPrimaryButtonSize: "xsmall";
211
+ headerPrimaryButtonAction: () => void;
212
+ headerButtonAction: () => void;
213
+ boxSize: number;
214
+ customColumnSpan: {
215
+ 0: number;
216
+ };
217
+ dropdownList: {
218
+ name: string;
219
+ component: ({ children }: any) => React.JSX.Element;
220
+ }[];
221
+ dropdownWidth: string;
222
+ content: any;
223
+ hasNoContentSidePadding: boolean;
224
+ middleTitle: any;
225
+ status: any;
226
+ subcategoryList: any[];
227
+ hasCategoryLayout: boolean;
228
+ hasTwoColumnHeader: boolean;
229
+ };
230
+ };
181
231
  export declare const WithHeaderDescription: {
182
232
  name: string;
183
233
  args: {
@@ -18,7 +18,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
18
18
  return (mod && mod.__esModule) ? mod : { "default": mod };
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.Complete = exports.HeaderAndContentOnly = exports.NoContentSidePadding = exports.WithPrimaryButtonIcon = exports.WithSubcategories = exports.StatusInactive = exports.WithMiddleTitleAndStatus = exports.WithHeaderRightContent = exports.WithHeaderBackButton = exports.HeaderAlignFlexStart = exports.TitleSizeLg = exports.AddProductToCategory = exports.CategoryStructure = exports.SubscriptionRules = exports.WithContent = exports.HasAccordion = exports.CustomColumnSpan = exports.WithoutHeaderImage = exports.EmptyList = exports.MinimalList = exports.WithoutRounded = exports.WithoutBorder = exports.WithoutHeader = exports.WithHeaderDropdown = exports.WithHeaderPrimaryButton = exports.WithHeaderButton = exports.WithoutHeaderBorder = exports.WithHeaderBackground = exports.WithHeaderDescription = exports.WithBadge = exports.Default = void 0;
21
+ exports.Complete = exports.HeaderAndContentOnly = exports.NoContentSidePadding = exports.WithPrimaryButtonIcon = exports.WithSubcategories = exports.StatusInactive = exports.WithMiddleTitleAndStatus = exports.WithHeaderRightContent = exports.WithHeaderBackButton = exports.HeaderAlignFlexStart = exports.TitleSizeLg = exports.AddProductToCategory = exports.CategoryStructure = exports.SubscriptionRules = exports.WithContent = exports.HasAccordion = exports.CustomColumnSpan = exports.WithoutHeaderImage = exports.EmptyList = exports.MinimalList = exports.WithoutRounded = exports.WithoutBorder = exports.WithoutHeader = exports.WithHeaderDropdown = exports.WithHeaderPrimaryButton = exports.WithHeaderButton = exports.WithoutHeaderBorder = exports.WithHeaderBackground = exports.WithHeaderDescription = exports.WithTitleBadgeBetween = exports.WithBadge = exports.Default = void 0;
22
22
  var jsx_runtime_1 = require("react/jsx-runtime");
23
23
  var styled_components_1 = __importDefault(require("styled-components"));
24
24
  var DescriptionCard_1 = __importDefault(require("../DescriptionCard"));
@@ -90,6 +90,10 @@ exports.default = {
90
90
  description: 'Header dikey hizalama',
91
91
  },
92
92
  hasBadge: { control: 'boolean' },
93
+ hasTitleBadgeBetween: {
94
+ control: 'boolean',
95
+ description: 'Başlık solda, badge sağda space-between hizalama',
96
+ },
93
97
  badgeText: { control: 'text' },
94
98
  hasHeader: { control: 'boolean' },
95
99
  hasHeaderBackground: { control: 'boolean' },
@@ -121,6 +125,10 @@ exports.Default = {
121
125
  exports.WithBadge = {
122
126
  args: __assign(__assign({}, defaultArgs), { hasBadge: true, badgeText: "Yeni" }),
123
127
  };
128
+ exports.WithTitleBadgeBetween = {
129
+ name: 'Title Badge Between',
130
+ args: __assign(__assign({}, defaultArgs), { headerImage: null, list: [], hasBadge: true, badgeText: "Yeni", hasTitleBadgeBetween: true }),
131
+ };
124
132
  exports.WithHeaderDescription = {
125
133
  name: 'Header Description',
126
134
  args: __assign(__assign({}, defaultArgs), { headerImage: null, headerDescription: "Bu alan başlığın altında gösterilen açıklama metnidir.", hasTwoColumnHeader: true, hasHeaderBorder: true, headerSize: "medium" }),
@@ -1,4 +1,4 @@
1
- import React from "react";
2
- import { InputProps } from "./props";
1
+ import React from 'react';
2
+ import { InputProps } from './props';
3
3
  declare const Input: ({ hasError, disabled, label, customLinkText, customLinkHref, onCustomLinkClick, onChange, errorMessage, type, name, width, mask, placeholder, hasCopyButton, readOnly, autoFocus, value, format, visible, infoText, id, isClearable, onClear, hasNumericFormat, inline, minDate, maxDate, filterDate, onCalendarOpen, maxLength, showMaxLengthCounter, description, ...other }: InputProps) => React.JSX.Element;
4
4
  export default Input;
@@ -37,172 +37,85 @@ var Tooltip_1 = __importDefault(require("../Tooltip"));
37
37
  var react_datepicker_1 = __importDefault(require("react-datepicker"));
38
38
  var i18n_1 = __importDefault(require("../../i18n/i18n"));
39
39
  var locale_1 = require("date-fns/locale");
40
- var date_fns_1 = require("date-fns");
40
+ var useDatePickerCalendar_1 = require("./hooks/useDatePickerCalendar");
41
+ var datePicker_1 = require("./utils/datePicker");
41
42
  var Input = function (_a) {
42
43
  var _b = _a.hasError, hasError = _b === void 0 ? props_1.InputDefault.hasError : _b, _c = _a.disabled, disabled = _c === void 0 ? props_1.InputDefault.disabled : _c, _d = _a.label, label = _d === void 0 ? props_1.InputDefault.label : _d, _e = _a.customLinkText, customLinkText = _e === void 0 ? props_1.InputDefault.customLinkText : _e, _f = _a.customLinkHref, customLinkHref = _f === void 0 ? props_1.InputDefault.customLinkHref : _f, _g = _a.onCustomLinkClick, onCustomLinkClick = _g === void 0 ? props_1.InputDefault.onCustomLinkClick : _g, _h = _a.onChange, onChange = _h === void 0 ? props_1.InputDefault.onChange : _h, _j = _a.errorMessage, errorMessage = _j === void 0 ? props_1.InputDefault.errorMessage : _j, _k = _a.type, type = _k === void 0 ? props_1.InputDefault.type : _k, _l = _a.name, name = _l === void 0 ? props_1.InputDefault.name : _l, _m = _a.width, width = _m === void 0 ? props_1.InputDefault.width : _m, _o = _a.mask, mask = _o === void 0 ? props_1.InputDefault.mask : _o, _p = _a.placeholder, placeholder = _p === void 0 ? props_1.InputDefault.placeholder : _p, _q = _a.hasCopyButton, hasCopyButton = _q === void 0 ? props_1.InputDefault.hasCopyButton : _q, _r = _a.readOnly, readOnly = _r === void 0 ? props_1.InputDefault.readOnly : _r, _s = _a.autoFocus, autoFocus = _s === void 0 ? props_1.InputDefault.autoFocus : _s, value = _a.value, _t = _a.format, format = _t === void 0 ? props_1.InputDefault.format : _t, _u = _a.visible, visible = _u === void 0 ? props_1.InputDefault.visible : _u, _v = _a.infoText, infoText = _v === void 0 ? props_1.InputDefault.infoText : _v, _w = _a.id, id = _w === void 0 ? props_1.InputDefault.id : _w, _x = _a.isClearable, isClearable = _x === void 0 ? props_1.InputDefault.isClearable : _x, _y = _a.onClear, onClear = _y === void 0 ? props_1.InputDefault.onClear : _y, _z = _a.hasNumericFormat, hasNumericFormat = _z === void 0 ? props_1.InputDefault.hasNumericFormat : _z, _0 = _a.inline, inline = _0 === void 0 ? props_1.InputDefault.inline : _0, _1 = _a.minDate, minDate = _1 === void 0 ? props_1.InputDefault.minDate : _1, _2 = _a.maxDate, maxDate = _2 === void 0 ? props_1.InputDefault.maxDate : _2, _3 = _a.filterDate, filterDate = _3 === void 0 ? props_1.InputDefault.filterDate : _3, _4 = _a.onCalendarOpen, onCalendarOpen = _4 === void 0 ? props_1.InputDefault.onCalendarOpen : _4, _5 = _a.maxLength, maxLength = _5 === void 0 ? props_1.InputDefault.maxLength : _5, _6 = _a.showMaxLengthCounter, showMaxLengthCounter = _6 === void 0 ? props_1.InputDefault.showMaxLengthCounter : _6, _7 = _a.description, description = _7 === void 0 ? props_1.InputDefault.description : _7, other = __rest(_a, ["hasError", "disabled", "label", "customLinkText", "customLinkHref", "onCustomLinkClick", "onChange", "errorMessage", "type", "name", "width", "mask", "placeholder", "hasCopyButton", "readOnly", "autoFocus", "value", "format", "visible", "infoText", "id", "isClearable", "onClear", "hasNumericFormat", "inline", "minDate", "maxDate", "filterDate", "onCalendarOpen", "maxLength", "showMaxLengthCounter", "description"]);
43
44
  var _8 = (0, react_1.useState)(type), inputType = _8[0], setInputType = _8[1];
44
45
  var _9 = (0, react_1.useState)(false), alert = _9[0], setAlert = _9[1];
45
46
  var _10 = (0, react_1.useState)(value), inputValue = _10[0], setInputValue = _10[1];
46
- var _11 = (0, react_1.useState)(false), isCalendarOpen = _11[0], setIsCalendarOpen = _11[1];
47
- var _12 = (0, react_1.useState)(function () {
48
- if (!value)
49
- return null;
50
- // Eğer format "dd.MM.yyyy" gibi bir format ise, parse et
51
- if (format && format.includes('dd') && format.includes('MM') && format.includes('yyyy')) {
52
- try {
53
- return (0, date_fns_1.parse)(value, format, new Date());
54
- }
55
- catch (_a) {
56
- return new Date(value);
57
- }
58
- }
59
- return new Date(value);
60
- }), startDate = _12[0], setStartDate = _12[1];
47
+ var _11 = (0, react_1.useState)(function () { return (0, datePicker_1.parseDateValue)(value, format); }), startDate = _11[0], setStartDate = _11[1];
61
48
  var inputRef = (0, react_1.useRef)(null);
62
- var datePickerRef = (0, react_1.useRef)(null);
63
- var dateInputRef = (0, react_1.useRef)(null);
64
- var dateBlurTimeoutRef = (0, react_1.useRef)([]);
65
49
  var t = (0, react_i18next_1.useTranslation)().t;
66
50
  var language = i18n_1.default.language;
51
+ var _12 = (0, useDatePickerCalendar_1.useDatePickerCalendar)({
52
+ disabled: disabled,
53
+ inline: inline,
54
+ onCalendarOpen: onCalendarOpen,
55
+ readOnly: readOnly,
56
+ }), calendarControlProps = _12.calendarControlProps, dateInputRef = _12.dateInputRef, datePickerRef = _12.datePickerRef, isCalendarOpen = _12.isCalendarOpen;
67
57
  (0, react_1.useEffect)(function () {
68
58
  setInputType(type);
69
59
  }, [type]);
70
60
  (0, react_1.useEffect)(function () {
71
61
  setInputValue(value);
72
- if (!value) {
73
- setStartDate(null);
74
- }
75
- else {
76
- // Eğer format "dd.MM.yyyy" gibi bir format ise, parse et
77
- if (format && format.includes('dd') && format.includes('MM') && format.includes('yyyy')) {
78
- try {
79
- setStartDate((0, date_fns_1.parse)(value, format, new Date()));
80
- }
81
- catch (_a) {
82
- setStartDate(new Date(value));
83
- }
84
- }
85
- else {
86
- setStartDate(new Date(value));
87
- }
88
- }
89
- }, [value, format]);
62
+ setStartDate((0, datePicker_1.parseDateValue)(value, format));
63
+ }, [format, value]);
90
64
  (0, react_1.useEffect)(function () {
91
- if (alert) {
92
- setTimeout(function () {
93
- setAlert(false);
94
- }, 2000);
95
- }
65
+ if (!alert)
66
+ return;
67
+ var timeoutId = window.setTimeout(function () { return setAlert(false); }, 2000);
68
+ return function () { return window.clearTimeout(timeoutId); };
96
69
  }, [alert]);
97
70
  var toggleInputType = function () {
98
- var newType = inputType === 'password' ? 'text' : 'password';
99
- setInputType(newType);
71
+ setInputType(function (currentType) { return (currentType === 'password' ? 'text' : 'password'); });
100
72
  };
101
- var copyToClipboard = function (e) {
73
+ var copyToClipboard = function () {
74
+ if (!inputRef.current)
75
+ return;
102
76
  inputRef.current.select();
103
77
  document.execCommand('copy');
104
78
  setAlert(true);
105
79
  inputRef.current.blur();
106
80
  };
107
- var mergeInputRefs = function () {
108
- var refs = [];
109
- for (var _i = 0; _i < arguments.length; _i++) {
110
- refs[_i] = arguments[_i];
81
+ var handleDateChange = function (date) {
82
+ if (!date) {
83
+ setStartDate(null);
84
+ setInputValue('');
85
+ onChange === null || onChange === void 0 ? void 0 : onChange(null);
86
+ return;
111
87
  }
112
- return function (node) {
113
- refs.forEach(function (ref) {
114
- if (!ref)
115
- return;
116
- if (typeof ref === "function") {
117
- ref(node);
118
- }
119
- else {
120
- ref.current = node;
121
- }
122
- });
123
- };
88
+ var formattedValue = format ? (0, datePicker_1.formatDateValue)(date, format) : date.toISOString();
89
+ setStartDate(date);
90
+ setInputValue(formattedValue);
91
+ onChange === null || onChange === void 0 ? void 0 : onChange(formattedValue);
124
92
  };
125
- var clearScheduledDateBlur = function () {
126
- dateBlurTimeoutRef.current.forEach(function (timeoutId) { return window.clearTimeout(timeoutId); });
127
- dateBlurTimeoutRef.current = [];
128
- };
129
- var blurDateInputAfterSelect = (0, react_1.useCallback)(function () {
130
- if (inline)
131
- return;
132
- clearScheduledDateBlur();
133
- var blur = function () {
134
- var _a, _b, _c, _d, _e, _f;
135
- (_b = (_a = datePickerRef.current) === null || _a === void 0 ? void 0 : _a.setBlur) === null || _b === void 0 ? void 0 : _b.call(_a);
136
- (_c = dateInputRef.current) === null || _c === void 0 ? void 0 : _c.blur();
137
- (_f = (_e = (_d = datePickerRef.current) === null || _d === void 0 ? void 0 : _d.input) === null || _e === void 0 ? void 0 : _e.blur) === null || _f === void 0 ? void 0 : _f.call(_e);
138
- };
139
- [0, 10, 50].forEach(function (delay) {
140
- var timeoutId = window.setTimeout(blur, delay);
141
- dateBlurTimeoutRef.current.push(timeoutId);
142
- });
143
- }, [inline]);
144
- (0, react_1.useEffect)(function () { return function () { return clearScheduledDateBlur(); }; }, []);
145
93
  var CustomDateInput = (0, react_1.useMemo)(function () {
146
- return (0, react_1.forwardRef)(function (props, ref) {
147
- var displayValue = '';
148
- if (props.value && format) {
149
- try {
150
- var date = (0, date_fns_1.parse)(props.value, "yyyy-MM-dd", new Date());
151
- displayValue = (0, date_fns_1.format)(date, format);
152
- }
153
- catch (_a) {
154
- displayValue = inputValue || '';
155
- }
156
- }
157
- else {
158
- displayValue = inputValue || '';
159
- }
160
- return ((0, jsx_runtime_1.jsx)(Input_styled_1.InputStyled, __assign({ ref: mergeInputRefs(ref, dateInputRef), "$hasError": hasError, "$hasIcon": (isClearable && inputValue) || ["password", "date"].includes(type) || hasCopyButton || infoText, "$isCalendarOpen": isCalendarOpen }, props, { value: displayValue })));
161
- });
162
- }, [format, hasCopyButton, hasError, infoText, inputValue, isCalendarOpen, isClearable, type]);
94
+ return (0, react_1.forwardRef)(function (props, ref) { return ((0, jsx_runtime_1.jsx)(Input_styled_1.InputStyled, __assign({ ref: (0, datePicker_1.mergeInputRefs)(ref, dateInputRef), "$hasError": hasError, "$hasIcon": (isClearable && inputValue) || ['password', 'date'].includes(type) || hasCopyButton || infoText, "$isCalendarOpen": isCalendarOpen, id: id }, props, { value: (0, datePicker_1.getDateDisplayValue)(props.value, format, inputValue) }))); });
95
+ }, [dateInputRef, format, hasCopyButton, hasError, id, infoText, inputValue, isCalendarOpen, isClearable, type]);
163
96
  var handleClearValue = function () {
164
- setInputValue(null);
165
- inputRef.current.value = null;
166
- setStartDate(null);
167
- onChange(null);
168
- if (onClear)
169
- onClear();
97
+ var _a, _b;
98
+ setInputValue('');
99
+ if (type === 'date') {
100
+ setStartDate(null);
101
+ (_b = (_a = datePickerRef.current) === null || _a === void 0 ? void 0 : _a.clear) === null || _b === void 0 ? void 0 : _b.call(_a);
102
+ }
103
+ else if (inputRef.current) {
104
+ inputRef.current.value = '';
105
+ }
106
+ onChange === null || onChange === void 0 ? void 0 : onChange(null);
107
+ onClear === null || onClear === void 0 ? void 0 : onClear();
170
108
  };
171
109
  var currentLength = (inputValue !== null && inputValue !== void 0 ? inputValue : '').length;
172
110
  var showCharCount = showMaxLengthCounter && maxLength != null;
173
111
  var showTopRow = Boolean(label || customLinkText || showCharCount);
174
- return (0, jsx_runtime_1.jsxs)(Input_styled_1.Container, __assign({ "$width": width }, { children: [showTopRow && ((0, jsx_runtime_1.jsxs)(Input_styled_1.FieldTop, { children: [label ? (0, jsx_runtime_1.jsx)(Input_styled_1.FieldLabel, __assign({ htmlFor: id }, { children: label })) : (0, jsx_runtime_1.jsx)("span", {}), (0, jsx_runtime_1.jsxs)(Input_styled_1.FieldTopActions, { children: [showCharCount && ((0, jsx_runtime_1.jsxs)(Input_styled_1.CharCount, { children: [currentLength, "/", maxLength] })), customLinkText && ((0, jsx_runtime_1.jsx)(TextLink_1.default, __assign({}, (customLinkHref && { href: customLinkHref }), { onClick: onCustomLinkClick }, { children: customLinkText })))] })] })), (0, jsx_runtime_1.jsxs)("div", __assign({ className: "input" }, { children: [hasNumericFormat ? ((0, jsx_runtime_1.jsx)(react_number_format_1.NumericFormat, __assign({ "$hasError": hasError, disabled: disabled, onChange: onChange, name: name, placeholder: placeholder, readOnly: readOnly, autoFocus: autoFocus, value: inputValue, maxLength: maxLength }, other, { customInput: Input_styled_1.InputStyled, id: id }))) : ((mask && format) ? ((0, jsx_runtime_1.jsx)(react_number_format_1.PatternFormat, __assign({ "$hasError": hasError, disabled: disabled, onChange: onChange, name: name, placeholder: placeholder, readOnly: readOnly, autoFocus: autoFocus, value: inputValue, maxLength: maxLength }, other, { format: format, mask: mask, customInput: Input_styled_1.InputStyled, id: id })))
175
- : type === 'date' ? ((0, jsx_runtime_1.jsx)(Input_styled_1.DatePickerWrapperStyled, __assign({ "$inline": inline }, { children: (0, jsx_runtime_1.jsx)(react_datepicker_1.default, { placeholderText: placeholder, disabled: disabled, name: name, readOnly: readOnly, autoFocus: autoFocus, onChange: function (date) {
176
- if (date) {
177
- setStartDate(date);
178
- // DatePicker'dan gelen Date objesini format'a göre formatla
179
- var formattedValue = (0, date_fns_1.format)(date, format);
180
- setInputValue(formattedValue);
181
- onChange(formattedValue);
182
- }
183
- else {
184
- setStartDate(null);
185
- setInputValue(null);
186
- onChange(null);
187
- }
188
- }, onSelect: function () {
189
- blurDateInputAfterSelect();
190
- }, selected: startDate, ref: datePickerRef, dateFormat: "yyyy-MM-dd", locale: language === "tr" ? locale_1.tr : locale_1.enGB, customInput: (0, jsx_runtime_1.jsx)(CustomDateInput, {}),
191
- //customInput={<InputStyled $hasError={hasError} id={id}/>}
192
- inline: inline, minDate: minDate, maxDate: maxDate, filterDate: filterDate, onCalendarOpen: function () {
193
- setIsCalendarOpen(true);
194
- if (onCalendarOpen) {
195
- onCalendarOpen();
196
- }
197
- }, onCalendarClose: function () {
198
- setIsCalendarOpen(false);
199
- blurDateInputAfterSelect();
200
- }, onBlur: function () { return setIsCalendarOpen(false); }, renderCustomHeader: function (_a) {
201
- var monthDate = _a.monthDate, customHeaderCount = _a.customHeaderCount, decreaseMonth = _a.decreaseMonth, increaseMonth = _a.increaseMonth, decreaseYear = _a.decreaseYear, increaseYear = _a.increaseYear, prevMonthButtonDisabled = _a.prevMonthButtonDisabled, nextMonthButtonDisabled = _a.nextMonthButtonDisabled, prevYearButtonDisabled = _a.prevYearButtonDisabled, nextYearButtonDisabled = _a.nextYearButtonDisabled;
202
- return ((0, jsx_runtime_1.jsxs)("div", __assign({ className: "headerTopContent" }, { children: [(0, jsx_runtime_1.jsxs)("div", __assign({ className: "leftButtons" }, { children: [(0, jsx_runtime_1.jsx)("button", __assign({ "aria-label": "Previous Year", className: "react-datepicker__navigation react-datepicker__navigation--previous", onClick: decreaseYear, type: "button", disabled: prevYearButtonDisabled }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "CalenderArrowleftsmall" }) })), (0, jsx_runtime_1.jsx)("button", __assign({ "aria-label": "Previous Month", className: "react-datepicker__navigation react-datepicker__navigation--previous", onClick: decreaseMonth, type: "button", disabled: prevMonthButtonDisabled }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "ArrowSmallLeft" }) }))] })), (0, jsx_runtime_1.jsxs)("span", __assign({ className: "react-datepicker__current-month" }, { children: [monthDate.toLocaleString(language === "tr" ? "tr-TR" : "en-GB", { month: "long" }), ", ", monthDate.toLocaleString(language === "tr" ? "tr-TR" : "en-GB", { year: "numeric" })] })), (0, jsx_runtime_1.jsxs)("div", __assign({ className: "rightButtons" }, { children: [(0, jsx_runtime_1.jsx)("button", __assign({ "aria-label": "Next Month", className: "react-datepicker__navigation react-datepicker__navigation--next", onClick: increaseMonth, type: "button", disabled: nextMonthButtonDisabled }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "ArrowSmallRight" }) })), (0, jsx_runtime_1.jsx)("button", __assign({ "aria-label": "Next Year", className: "react-datepicker__navigation react-datepicker__navigation--next", onClick: increaseYear, type: "button", disabled: nextYearButtonDisabled }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "Calenderarrowrightsmall" }) }))] }))] })));
203
- } }) }))) : ((0, jsx_runtime_1.jsx)(Input_styled_1.InputStyled, __assign({ ref: inputRef, type: inputType, "$hasError": hasError, disabled: disabled, onChange: function (e) {
204
- onChange(e);
205
- setInputValue(e.currentTarget.value);
206
- }, name: name, placeholder: placeholder, readOnly: readOnly, autoFocus: autoFocus, value: inputValue, id: id, maxLength: maxLength, "$hasIcon": (isClearable && inputValue) || ["password", "date"].includes(type) || hasCopyButton || infoText }, other)))), (isClearable && inputValue) ? ((0, jsx_runtime_1.jsx)("div", __assign({ onClick: handleClearValue, className: "removeIcon" }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { color: "var(--dark)", name: "Closebig" }) }))) : (type === 'password' ? ((0, jsx_runtime_1.jsx)("div", __assign({ onClick: toggleInputType, className: "inputIcon hasNoBg" }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { color: "var(--dark-opacity-50)", name: inputType === 'password' ? 'Show' : 'Hide' }) }))) : (type === 'date' && !inline ? ((0, jsx_runtime_1.jsx)("div", __assign({ className: "inputIcon hasNoBg hasNoCursor" }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { color: "var(--grey-50)", name: "Calendar" }) }))) : (hasCopyButton && ((0, jsx_runtime_1.jsx)("div", __assign({ onClick: copyToClipboard, className: "inputIcon" }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { color: "var(--primary)", name: 'Copy' }) })))))), infoText && ((0, jsx_runtime_1.jsx)("div", __assign({ className: "inputIcon hasNoBg" }, { children: (0, jsx_runtime_1.jsx)(Tooltip_1.default, __assign({ popupSize: "small", position: "topRight", popupWidth: "160px", popupRight: "-10px", iconWidth: "24px", iconHeight: "24px" }, { children: (0, jsx_runtime_1.jsx)("div", { className: "popupText", dangerouslySetInnerHTML: { __html: infoText } }) })) }))), (0, jsx_runtime_1.jsx)(Input_styled_1.AlertStyled, __assign({ "$visible": alert }, { children: t('copied') }))] })), hasError && errorMessage && (0, jsx_runtime_1.jsxs)("div", __assign({ className: "error" }, { children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { name: "SwitchPassive" }), (0, jsx_runtime_1.jsx)("p", { children: errorMessage })] })), description && (0, jsx_runtime_1.jsx)(Input_styled_1.FieldDescription, { children: description })] }));
112
+ var hasInputIcon = (isClearable && inputValue) || ['password', 'date'].includes(type) || hasCopyButton || infoText;
113
+ return ((0, jsx_runtime_1.jsxs)(Input_styled_1.Container, __assign({ "$width": width }, { children: [showTopRow && ((0, jsx_runtime_1.jsxs)(Input_styled_1.FieldTop, { children: [label ? (0, jsx_runtime_1.jsx)(Input_styled_1.FieldLabel, __assign({ htmlFor: id }, { children: label })) : (0, jsx_runtime_1.jsx)("span", {}), (0, jsx_runtime_1.jsxs)(Input_styled_1.FieldTopActions, { children: [showCharCount && ((0, jsx_runtime_1.jsxs)(Input_styled_1.CharCount, { children: [currentLength, "/", maxLength] })), customLinkText && ((0, jsx_runtime_1.jsx)(TextLink_1.default, __assign({}, (customLinkHref && { href: customLinkHref }), { onClick: onCustomLinkClick }, { children: customLinkText })))] })] })), (0, jsx_runtime_1.jsxs)("div", __assign({ className: "input" }, { children: [hasNumericFormat ? ((0, jsx_runtime_1.jsx)(react_number_format_1.NumericFormat, __assign({ "$hasError": hasError, disabled: disabled, onChange: onChange, name: name, placeholder: placeholder, readOnly: readOnly, autoFocus: autoFocus, value: inputValue, maxLength: maxLength }, other, { customInput: Input_styled_1.InputStyled, id: id }))) : mask && format ? ((0, jsx_runtime_1.jsx)(react_number_format_1.PatternFormat, __assign({ "$hasError": hasError, disabled: disabled, onChange: onChange, name: name, placeholder: placeholder, readOnly: readOnly, autoFocus: autoFocus, value: inputValue, maxLength: maxLength }, other, { format: format, mask: mask, customInput: Input_styled_1.InputStyled, id: id }))) : type === 'date' ? ((0, jsx_runtime_1.jsx)(Input_styled_1.DatePickerWrapperStyled, __assign({ "$inline": inline }, { children: (0, jsx_runtime_1.jsx)(react_datepicker_1.default, __assign({ placeholderText: placeholder, disabled: disabled, name: name, readOnly: readOnly, autoFocus: autoFocus, onChange: handleDateChange, selected: startDate, ref: datePickerRef, id: id, dateFormat: "yyyy-MM-dd", locale: language === 'tr' ? locale_1.tr : locale_1.enGB, customInput: (0, jsx_runtime_1.jsx)(CustomDateInput, {}), inline: inline, minDate: minDate, maxDate: maxDate, filterDate: filterDate, renderCustomHeader: function (_a) {
114
+ var monthDate = _a.monthDate, decreaseMonth = _a.decreaseMonth, increaseMonth = _a.increaseMonth, decreaseYear = _a.decreaseYear, increaseYear = _a.increaseYear, prevMonthButtonDisabled = _a.prevMonthButtonDisabled, nextMonthButtonDisabled = _a.nextMonthButtonDisabled, prevYearButtonDisabled = _a.prevYearButtonDisabled, nextYearButtonDisabled = _a.nextYearButtonDisabled;
115
+ return ((0, jsx_runtime_1.jsxs)("div", __assign({ className: "headerTopContent" }, { children: [(0, jsx_runtime_1.jsxs)("div", __assign({ className: "leftButtons" }, { children: [(0, jsx_runtime_1.jsx)("button", __assign({ "aria-label": "Previous Year", className: "react-datepicker__navigation react-datepicker__navigation--previous", onClick: decreaseYear, type: "button", disabled: prevYearButtonDisabled }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "CalenderArrowleftsmall" }) })), (0, jsx_runtime_1.jsx)("button", __assign({ "aria-label": "Previous Month", className: "react-datepicker__navigation react-datepicker__navigation--previous", onClick: decreaseMonth, type: "button", disabled: prevMonthButtonDisabled }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "ArrowSmallLeft" }) }))] })), (0, jsx_runtime_1.jsxs)("span", __assign({ className: "react-datepicker__current-month" }, { children: [monthDate.toLocaleString(language === 'tr' ? 'tr-TR' : 'en-GB', { month: 'long' }), ",", ' ', monthDate.toLocaleString(language === 'tr' ? 'tr-TR' : 'en-GB', { year: 'numeric' })] })), (0, jsx_runtime_1.jsxs)("div", __assign({ className: "rightButtons" }, { children: [(0, jsx_runtime_1.jsx)("button", __assign({ "aria-label": "Next Month", className: "react-datepicker__navigation react-datepicker__navigation--next", onClick: increaseMonth, type: "button", disabled: nextMonthButtonDisabled }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "ArrowSmallRight" }) })), (0, jsx_runtime_1.jsx)("button", __assign({ "aria-label": "Next Year", className: "react-datepicker__navigation react-datepicker__navigation--next", onClick: increaseYear, type: "button", disabled: nextYearButtonDisabled }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "Calenderarrowrightsmall" }) }))] }))] })));
116
+ } }, calendarControlProps)) }))) : ((0, jsx_runtime_1.jsx)(Input_styled_1.InputStyled, __assign({ ref: inputRef, type: inputType, "$hasError": hasError, disabled: disabled, onChange: function (e) {
117
+ onChange === null || onChange === void 0 ? void 0 : onChange(e);
118
+ setInputValue(e.currentTarget.value);
119
+ }, name: name, placeholder: placeholder, readOnly: readOnly, autoFocus: autoFocus, value: inputValue, id: id, maxLength: maxLength, "$hasIcon": hasInputIcon }, other))), isClearable && inputValue ? ((0, jsx_runtime_1.jsx)("div", __assign({ onClick: handleClearValue, className: "removeIcon" }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { color: "var(--dark)", name: "Closebig" }) }))) : type === 'password' ? ((0, jsx_runtime_1.jsx)("div", __assign({ onClick: toggleInputType, className: "inputIcon hasNoBg" }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { color: "var(--dark-opacity-50)", name: inputType === 'password' ? 'Show' : 'Hide' }) }))) : type === 'date' && !inline ? ((0, jsx_runtime_1.jsx)("div", __assign({ className: "inputIcon hasNoBg hasNoCursor" }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { color: "var(--grey-50)", name: "Calendar" }) }))) : (hasCopyButton && ((0, jsx_runtime_1.jsx)("div", __assign({ onClick: copyToClipboard, className: "inputIcon" }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { color: "var(--primary)", name: "Copy" }) })))), infoText && ((0, jsx_runtime_1.jsx)("div", __assign({ className: "inputIcon hasNoBg" }, { children: (0, jsx_runtime_1.jsx)(Tooltip_1.default, __assign({ popupSize: "small", position: "topRight", popupWidth: "160px", popupRight: "-10px", iconWidth: "24px", iconHeight: "24px" }, { children: (0, jsx_runtime_1.jsx)("div", { className: "popupText", dangerouslySetInnerHTML: { __html: infoText } }) })) }))), (0, jsx_runtime_1.jsx)(Input_styled_1.AlertStyled, __assign({ "$visible": alert }, { children: t('copied') }))] })), hasError && errorMessage && ((0, jsx_runtime_1.jsxs)("div", __assign({ className: "error" }, { children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { name: "SwitchPassive" }), (0, jsx_runtime_1.jsx)("p", { children: errorMessage })] }))), description && (0, jsx_runtime_1.jsx)(Input_styled_1.FieldDescription, { children: description })] })));
207
120
  };
208
121
  exports.default = Input;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
49
+ var __importDefault = (this && this.__importDefault) || function (mod) {
50
+ return (mod && mod.__esModule) ? mod : { "default": mod };
51
+ };
52
+ Object.defineProperty(exports, "__esModule", { value: true });
53
+ var jsx_runtime_1 = require("react/jsx-runtime");
54
+ var react_1 = require("@testing-library/react");
55
+ var user_event_1 = __importDefault(require("@testing-library/user-event"));
56
+ var Input_1 = __importDefault(require("./Input"));
57
+ var props_1 = require("./props");
58
+ jest.mock('react-i18next', function () { return ({
59
+ useTranslation: function () { return ({
60
+ t: function (key) { return key; },
61
+ }); },
62
+ }); });
63
+ var renderInput = function (props) {
64
+ if (props === void 0) { props = {}; }
65
+ return (0, react_1.render)((0, jsx_runtime_1.jsx)(Input_1.default, __assign({}, props_1.InputDefault, { id: "input-test", label: "Label", onChange: jest.fn() }, props)));
66
+ };
67
+ describe('Input', function () {
68
+ it('renders label and placeholder', function () {
69
+ renderInput({ placeholder: 'Placeholder text' });
70
+ expect(react_1.screen.getByText('Label')).toBeInTheDocument();
71
+ expect(react_1.screen.getByPlaceholderText('Placeholder text')).toBeInTheDocument();
72
+ });
73
+ it('shows error message when hasError is true', function () {
74
+ renderInput({ hasError: true, errorMessage: 'Invalid value' });
75
+ expect(react_1.screen.getByText('Invalid value')).toBeInTheDocument();
76
+ });
77
+ it('toggles password visibility', function () { return __awaiter(void 0, void 0, void 0, function () {
78
+ var container, input;
79
+ return __generator(this, function (_a) {
80
+ switch (_a.label) {
81
+ case 0:
82
+ container = renderInput({ type: 'password', placeholder: 'Password' }).container;
83
+ input = react_1.screen.getByPlaceholderText('Password');
84
+ expect(input).toHaveAttribute('type', 'password');
85
+ return [4 /*yield*/, user_event_1.default.click(container.querySelector('.inputIcon'))];
86
+ case 1:
87
+ _a.sent();
88
+ expect(input).toHaveAttribute('type', 'text');
89
+ return [2 /*return*/];
90
+ }
91
+ });
92
+ }); });
93
+ it('calls onClear when clearable value is cleared', function () { return __awaiter(void 0, void 0, void 0, function () {
94
+ var onClear, onChange, container;
95
+ return __generator(this, function (_a) {
96
+ switch (_a.label) {
97
+ case 0:
98
+ onClear = jest.fn();
99
+ onChange = jest.fn();
100
+ container = renderInput({
101
+ isClearable: true,
102
+ value: 'Clear me',
103
+ onClear: onClear,
104
+ onChange: onChange,
105
+ }).container;
106
+ return [4 /*yield*/, user_event_1.default.click(container.querySelector('.removeIcon'))];
107
+ case 1:
108
+ _a.sent();
109
+ expect(onChange).toHaveBeenCalledWith(null);
110
+ expect(onClear).toHaveBeenCalledTimes(1);
111
+ return [2 /*return*/];
112
+ }
113
+ });
114
+ }); });
115
+ it('renders with potentially unsafe infoText without crashing', function () {
116
+ expect(function () { return renderInput({ infoText: '<script>alert(1)</script>Info' }); }).not.toThrow();
117
+ });
118
+ });
@@ -0,0 +1,36 @@
1
+ /// <reference types="react" />
2
+ import DatePicker from 'react-datepicker';
3
+ type UseDatePickerCalendarOptions = {
4
+ inline?: boolean;
5
+ disabled?: boolean;
6
+ readOnly?: boolean;
7
+ onCalendarOpen?: () => void;
8
+ };
9
+ export declare const useDatePickerCalendar: ({ inline, disabled, readOnly, onCalendarOpen, }: UseDatePickerCalendarOptions) => {
10
+ calendarControlProps: {
11
+ open?: undefined;
12
+ preventOpenOnFocus?: undefined;
13
+ shouldCloseOnSelect?: undefined;
14
+ usePointerEvent?: undefined;
15
+ onInputClick?: undefined;
16
+ onClickOutside?: undefined;
17
+ onCalendarOpen?: undefined;
18
+ onCalendarClose?: undefined;
19
+ onSelect?: undefined;
20
+ } | {
21
+ open: boolean;
22
+ preventOpenOnFocus: boolean;
23
+ shouldCloseOnSelect: boolean;
24
+ usePointerEvent: boolean;
25
+ onInputClick: () => void;
26
+ onClickOutside: () => void;
27
+ onCalendarOpen: () => void;
28
+ onCalendarClose: () => void;
29
+ onSelect: () => void;
30
+ };
31
+ closeCalendar: () => void;
32
+ dateInputRef: import("react").MutableRefObject<HTMLInputElement>;
33
+ datePickerRef: import("react").MutableRefObject<DatePicker>;
34
+ isCalendarOpen: boolean;
35
+ };
36
+ export {};
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useDatePickerCalendar = void 0;
4
+ var react_1 = require("react");
5
+ var datePicker_1 = require("../utils/datePicker");
6
+ var useDatePickerCalendar = function (_a) {
7
+ var _b = _a.inline, inline = _b === void 0 ? false : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, _d = _a.readOnly, readOnly = _d === void 0 ? false : _d, onCalendarOpen = _a.onCalendarOpen;
8
+ var datePickerRef = (0, react_1.useRef)(null);
9
+ var dateInputRef = (0, react_1.useRef)(null);
10
+ var _e = (0, react_1.useState)(false), isCalendarOpen = _e[0], setIsCalendarOpen = _e[1];
11
+ var closeCalendar = (0, react_1.useCallback)(function () {
12
+ var _a, _b;
13
+ if (inline)
14
+ return;
15
+ setIsCalendarOpen(false);
16
+ (_b = (_a = datePickerRef.current) === null || _a === void 0 ? void 0 : _a.setOpen) === null || _b === void 0 ? void 0 : _b.call(_a, false, true);
17
+ }, [inline]);
18
+ var openCalendar = (0, react_1.useCallback)(function () {
19
+ var _a, _b;
20
+ if (inline || disabled || readOnly)
21
+ return;
22
+ setIsCalendarOpen(true);
23
+ (_b = (_a = datePickerRef.current) === null || _a === void 0 ? void 0 : _a.setOpen) === null || _b === void 0 ? void 0 : _b.call(_a, true);
24
+ }, [disabled, inline, readOnly]);
25
+ var toggleCalendar = (0, react_1.useCallback)(function () {
26
+ if (isCalendarOpen) {
27
+ closeCalendar();
28
+ return;
29
+ }
30
+ openCalendar();
31
+ }, [closeCalendar, isCalendarOpen, openCalendar]);
32
+ var handleCalendarOpen = (0, react_1.useCallback)(function () {
33
+ setIsCalendarOpen(true);
34
+ onCalendarOpen === null || onCalendarOpen === void 0 ? void 0 : onCalendarOpen();
35
+ }, [onCalendarOpen]);
36
+ var handleCalendarClose = (0, react_1.useCallback)(function () {
37
+ setIsCalendarOpen(false);
38
+ }, []);
39
+ var handleInputClick = (0, react_1.useCallback)(function () {
40
+ toggleCalendar();
41
+ }, [toggleCalendar]);
42
+ var handleClickOutside = (0, react_1.useCallback)(function () {
43
+ closeCalendar();
44
+ }, [closeCalendar]);
45
+ var handleDateSelect = (0, react_1.useCallback)(function () {
46
+ closeCalendar();
47
+ }, [closeCalendar]);
48
+ (0, react_1.useEffect)(function () {
49
+ if (inline || !isCalendarOpen)
50
+ return;
51
+ var handleOutsideInteraction = function (event) {
52
+ var target = event.target;
53
+ if (!(target instanceof Node))
54
+ return;
55
+ if (!(0, datePicker_1.isOutsideDatePicker)(target, dateInputRef.current))
56
+ return;
57
+ closeCalendar();
58
+ };
59
+ document.addEventListener('mousedown', handleOutsideInteraction);
60
+ document.addEventListener('touchstart', handleOutsideInteraction, { passive: true });
61
+ return function () {
62
+ document.removeEventListener('mousedown', handleOutsideInteraction);
63
+ document.removeEventListener('touchstart', handleOutsideInteraction);
64
+ };
65
+ }, [closeCalendar, inline, isCalendarOpen]);
66
+ var calendarControlProps = inline
67
+ ? {}
68
+ : {
69
+ open: isCalendarOpen,
70
+ preventOpenOnFocus: true,
71
+ shouldCloseOnSelect: true,
72
+ usePointerEvent: true,
73
+ onInputClick: handleInputClick,
74
+ onClickOutside: handleClickOutside,
75
+ onCalendarOpen: handleCalendarOpen,
76
+ onCalendarClose: handleCalendarClose,
77
+ onSelect: handleDateSelect,
78
+ };
79
+ return {
80
+ calendarControlProps: calendarControlProps,
81
+ closeCalendar: closeCalendar,
82
+ dateInputRef: dateInputRef,
83
+ datePickerRef: datePickerRef,
84
+ isCalendarOpen: isCalendarOpen,
85
+ };
86
+ };
87
+ exports.useDatePickerCalendar = useDatePickerCalendar;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var react_1 = require("@testing-library/react");
4
+ var useDatePickerCalendar_1 = require("./useDatePickerCalendar");
5
+ describe('useDatePickerCalendar', function () {
6
+ it('toggles calendar open state through input click handler', function () {
7
+ var setOpen = jest.fn();
8
+ var result = (0, react_1.renderHook)(function () {
9
+ return (0, useDatePickerCalendar_1.useDatePickerCalendar)({
10
+ inline: false,
11
+ });
12
+ }).result;
13
+ (0, react_1.act)(function () {
14
+ var _a, _b;
15
+ result.current.datePickerRef.current = { setOpen: setOpen };
16
+ (_b = (_a = result.current.calendarControlProps).onInputClick) === null || _b === void 0 ? void 0 : _b.call(_a);
17
+ });
18
+ expect(result.current.isCalendarOpen).toBe(true);
19
+ expect(setOpen).toHaveBeenCalledWith(true);
20
+ (0, react_1.act)(function () {
21
+ var _a, _b;
22
+ (_b = (_a = result.current.calendarControlProps).onInputClick) === null || _b === void 0 ? void 0 : _b.call(_a);
23
+ });
24
+ expect(result.current.isCalendarOpen).toBe(false);
25
+ expect(setOpen).toHaveBeenCalledWith(false, true);
26
+ });
27
+ it('closes calendar on outside touch interaction', function () {
28
+ var setOpen = jest.fn();
29
+ var result = (0, react_1.renderHook)(function () {
30
+ return (0, useDatePickerCalendar_1.useDatePickerCalendar)({
31
+ inline: false,
32
+ });
33
+ }).result;
34
+ (0, react_1.act)(function () {
35
+ var _a, _b;
36
+ result.current.datePickerRef.current = { setOpen: setOpen };
37
+ (_b = (_a = result.current.calendarControlProps).onCalendarOpen) === null || _b === void 0 ? void 0 : _b.call(_a);
38
+ });
39
+ expect(result.current.isCalendarOpen).toBe(true);
40
+ (0, react_1.act)(function () {
41
+ document.dispatchEvent(new Event('touchstart', { bubbles: true }));
42
+ });
43
+ expect(result.current.isCalendarOpen).toBe(false);
44
+ expect(setOpen).toHaveBeenCalledWith(false, true);
45
+ });
46
+ });
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export declare const isFormattedDatePattern: (formatStr?: string | null) => boolean;
3
+ export declare const parseDateValue: (value?: string | null, formatStr?: string | null) => Date | null;
4
+ export declare const formatDateValue: (date: Date, formatStr: string) => string;
5
+ export declare const getDateDisplayValue: (rawValue: string | undefined, formatStr: string | null | undefined, fallbackValue?: string | null) => string;
6
+ export declare const mergeInputRefs: (...refs: Array<React.Ref<HTMLInputElement> | null | undefined>) => (node: HTMLInputElement | null) => void;
7
+ export declare const isOutsideDatePicker: (target: Node, inputNode: HTMLInputElement | null) => boolean;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isOutsideDatePicker = exports.mergeInputRefs = exports.getDateDisplayValue = exports.formatDateValue = exports.parseDateValue = exports.isFormattedDatePattern = void 0;
4
+ var date_fns_1 = require("date-fns");
5
+ var isFormattedDatePattern = function (formatStr) {
6
+ return Boolean((formatStr === null || formatStr === void 0 ? void 0 : formatStr.includes('dd')) && formatStr.includes('MM') && formatStr.includes('yyyy'));
7
+ };
8
+ exports.isFormattedDatePattern = isFormattedDatePattern;
9
+ var parseDateValue = function (value, formatStr) {
10
+ if (!value)
11
+ return null;
12
+ if ((0, exports.isFormattedDatePattern)(formatStr)) {
13
+ var parsed_1 = (0, date_fns_1.parse)(value, formatStr, new Date());
14
+ return (0, date_fns_1.isValid)(parsed_1) ? parsed_1 : null;
15
+ }
16
+ var parsed = new Date(value);
17
+ return (0, date_fns_1.isValid)(parsed) ? parsed : null;
18
+ };
19
+ exports.parseDateValue = parseDateValue;
20
+ var formatDateValue = function (date, formatStr) { return (0, date_fns_1.format)(date, formatStr); };
21
+ exports.formatDateValue = formatDateValue;
22
+ var getDateDisplayValue = function (rawValue, formatStr, fallbackValue) {
23
+ if (!rawValue)
24
+ return fallbackValue || '';
25
+ if (!formatStr)
26
+ return fallbackValue || rawValue;
27
+ try {
28
+ var date = (0, date_fns_1.parse)(rawValue, 'yyyy-MM-dd', new Date());
29
+ return (0, date_fns_1.isValid)(date) ? (0, date_fns_1.format)(date, formatStr) : (fallbackValue || '');
30
+ }
31
+ catch (_a) {
32
+ return fallbackValue || '';
33
+ }
34
+ };
35
+ exports.getDateDisplayValue = getDateDisplayValue;
36
+ var mergeInputRefs = function () {
37
+ var refs = [];
38
+ for (var _i = 0; _i < arguments.length; _i++) {
39
+ refs[_i] = arguments[_i];
40
+ }
41
+ return function (node) {
42
+ refs.forEach(function (ref) {
43
+ if (!ref)
44
+ return;
45
+ if (typeof ref === 'function') {
46
+ ref(node);
47
+ }
48
+ else {
49
+ ref.current = node;
50
+ }
51
+ });
52
+ };
53
+ };
54
+ exports.mergeInputRefs = mergeInputRefs;
55
+ var isOutsideDatePicker = function (target, inputNode) {
56
+ var wrapper = inputNode === null || inputNode === void 0 ? void 0 : inputNode.closest('.react-datepicker-wrapper');
57
+ var popper = document.querySelector('.react-datepicker-popper');
58
+ return !(wrapper === null || wrapper === void 0 ? void 0 : wrapper.contains(target)) && !(popper === null || popper === void 0 ? void 0 : popper.contains(target));
59
+ };
60
+ exports.isOutsideDatePicker = isOutsideDatePicker;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var datePicker_1 = require("./datePicker");
4
+ describe('datePicker utils', function () {
5
+ it('parses dd.MM.yyyy formatted values', function () {
6
+ var date = (0, datePicker_1.parseDateValue)('11.08.2026', 'dd.MM.yyyy');
7
+ expect(date === null || date === void 0 ? void 0 : date.getFullYear()).toBe(2026);
8
+ expect(date === null || date === void 0 ? void 0 : date.getMonth()).toBe(7);
9
+ expect(date === null || date === void 0 ? void 0 : date.getDate()).toBe(11);
10
+ });
11
+ it('returns null for invalid formatted values', function () {
12
+ expect((0, datePicker_1.parseDateValue)('not-a-date', 'dd.MM.yyyy')).toBeNull();
13
+ });
14
+ it('formats yyyy-MM-dd values for display', function () {
15
+ expect((0, datePicker_1.getDateDisplayValue)('2026-08-11', 'dd.MM.yyyy')).toBe('11.08.2026');
16
+ });
17
+ });
@@ -80,15 +80,11 @@ export declare const InsuranceQuantity: import("styled-components/dist/types").I
80
80
  export declare const InsuranceActions: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
81
81
  style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars;
82
82
  }> & string;
83
- export declare const InsuranceType2RadioInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "style"> & {
83
+ export declare const InsuranceType2RadioInput: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "style"> & {
84
84
  style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars;
85
- }, Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & {
86
- ref?: import("react").Ref<HTMLInputElement>;
87
- }>, "type"> & Partial<Pick<import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "style"> & {
85
+ }, "type"> & Partial<Pick<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "style"> & {
88
86
  style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars;
89
- }, Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & {
90
- ref?: import("react").Ref<HTMLInputElement>;
91
- }>, "type">>> & string;
87
+ }, "type">>> & string;
92
88
  export declare const InsuranceType2TooltipWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "style"> & {
93
89
  style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars;
94
90
  }> & string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "krl-alfred",
3
- "version": "2.23.19",
3
+ "version": "2.23.21",
4
4
  "files": [
5
5
  "dist"
6
6
  ],