@hitachivantara/uikit-react-core 5.9.1 → 5.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/dist/cjs/components/ActionsGeneric/ActionsGeneric.cjs.map +1 -1
  2. package/dist/cjs/components/BaseInput/BaseInput.cjs +18 -1
  3. package/dist/cjs/components/BaseInput/BaseInput.cjs.map +1 -1
  4. package/dist/cjs/components/BreadCrumb/BreadCrumb.cjs +3 -3
  5. package/dist/cjs/components/BreadCrumb/BreadCrumb.cjs.map +1 -1
  6. package/dist/cjs/components/BreadCrumb/Page/Page.cjs +22 -12
  7. package/dist/cjs/components/BreadCrumb/Page/Page.cjs.map +1 -1
  8. package/dist/cjs/components/BreadCrumb/Page/Page.styles.cjs +19 -44
  9. package/dist/cjs/components/BreadCrumb/Page/Page.styles.cjs.map +1 -1
  10. package/dist/cjs/components/Calendar/CalendarHeader/CalendarHeader.styles.cjs +4 -8
  11. package/dist/cjs/components/Calendar/CalendarHeader/CalendarHeader.styles.cjs.map +1 -1
  12. package/dist/cjs/components/Calendar/SingleCalendar/CalendarCell.cjs +5 -17
  13. package/dist/cjs/components/Calendar/SingleCalendar/CalendarCell.cjs.map +1 -1
  14. package/dist/cjs/components/Calendar/utils.cjs +0 -8
  15. package/dist/cjs/components/Calendar/utils.cjs.map +1 -1
  16. package/dist/cjs/components/DropDownMenu/DropDownMenu.cjs +24 -29
  17. package/dist/cjs/components/DropDownMenu/DropDownMenu.cjs.map +1 -1
  18. package/dist/cjs/components/DropDownMenu/DropDownMenu.styles.cjs +27 -75
  19. package/dist/cjs/components/DropDownMenu/DropDownMenu.styles.cjs.map +1 -1
  20. package/dist/cjs/components/DropDownMenu/dropDownMenuClasses.cjs +1 -1
  21. package/dist/cjs/components/DropDownMenu/dropDownMenuClasses.cjs.map +1 -1
  22. package/dist/cjs/components/FileUploader/DropZone/DropZone.cjs +5 -4
  23. package/dist/cjs/components/FileUploader/DropZone/DropZone.cjs.map +1 -1
  24. package/dist/cjs/components/Pagination/Pagination.styles.cjs +10 -14
  25. package/dist/cjs/components/Pagination/Pagination.styles.cjs.map +1 -1
  26. package/dist/cjs/components/Table/TableCell/TableCell.cjs +4 -4
  27. package/dist/cjs/components/Table/TableCell/TableCell.cjs.map +1 -1
  28. package/dist/cjs/components/Table/TableCell/TableCell.styles.cjs +2 -14
  29. package/dist/cjs/components/Table/TableCell/TableCell.styles.cjs.map +1 -1
  30. package/dist/cjs/components/Table/TableRow/TableRow.cjs +6 -6
  31. package/dist/cjs/components/Table/TableRow/TableRow.cjs.map +1 -1
  32. package/dist/cjs/components/Table/utils/utils.cjs +0 -5
  33. package/dist/cjs/components/Table/utils/utils.cjs.map +1 -1
  34. package/dist/cjs/components/Tooltip/Tooltip.cjs.map +1 -1
  35. package/dist/cjs/components/Tooltip/Tooltip.styles.cjs +23 -37
  36. package/dist/cjs/components/Tooltip/Tooltip.styles.cjs.map +1 -1
  37. package/dist/cjs/components/VerticalNavigation/Actions/Actions.cjs +2 -2
  38. package/dist/cjs/components/VerticalNavigation/Actions/Actions.cjs.map +1 -1
  39. package/dist/cjs/components/VerticalNavigation/Header/Header.cjs +2 -2
  40. package/dist/cjs/components/VerticalNavigation/Header/Header.cjs.map +1 -1
  41. package/dist/cjs/components/VerticalNavigation/Navigation/Navigation.cjs +15 -8
  42. package/dist/cjs/components/VerticalNavigation/Navigation/Navigation.cjs.map +1 -1
  43. package/dist/cjs/components/VerticalNavigation/NavigationPopup/NavigationPopup.cjs +1 -0
  44. package/dist/cjs/components/VerticalNavigation/NavigationPopup/NavigationPopup.cjs.map +1 -1
  45. package/dist/cjs/components/VerticalNavigation/TreeView/TreeViewItem.cjs +5 -5
  46. package/dist/cjs/components/VerticalNavigation/TreeView/TreeViewItem.cjs.map +1 -1
  47. package/dist/cjs/components/VerticalNavigation/VerticalNavigation.cjs +7 -3
  48. package/dist/cjs/components/VerticalNavigation/VerticalNavigation.cjs.map +1 -1
  49. package/dist/cjs/components/VerticalNavigation/VerticalNavigationContext.cjs +1 -1
  50. package/dist/cjs/components/VerticalNavigation/VerticalNavigationContext.cjs.map +1 -1
  51. package/dist/cjs/hooks/useUniqueId.cjs +1 -1
  52. package/dist/cjs/hooks/useUniqueId.cjs.map +1 -1
  53. package/dist/cjs/index.cjs +2 -3
  54. package/dist/cjs/index.cjs.map +1 -1
  55. package/dist/cjs/utils/checkValidHexColorValue.cjs +9 -0
  56. package/dist/cjs/utils/checkValidHexColorValue.cjs.map +1 -0
  57. package/dist/esm/components/ActionsGeneric/ActionsGeneric.js.map +1 -1
  58. package/dist/esm/components/BaseInput/BaseInput.js +18 -1
  59. package/dist/esm/components/BaseInput/BaseInput.js.map +1 -1
  60. package/dist/esm/components/BreadCrumb/BreadCrumb.js +3 -3
  61. package/dist/esm/components/BreadCrumb/BreadCrumb.js.map +1 -1
  62. package/dist/esm/components/BreadCrumb/Page/Page.js +23 -13
  63. package/dist/esm/components/BreadCrumb/Page/Page.js.map +1 -1
  64. package/dist/esm/components/BreadCrumb/Page/Page.styles.js +19 -42
  65. package/dist/esm/components/BreadCrumb/Page/Page.styles.js.map +1 -1
  66. package/dist/esm/components/Calendar/CalendarHeader/CalendarHeader.styles.js +4 -8
  67. package/dist/esm/components/Calendar/CalendarHeader/CalendarHeader.styles.js.map +1 -1
  68. package/dist/esm/components/Calendar/SingleCalendar/CalendarCell.js +6 -18
  69. package/dist/esm/components/Calendar/SingleCalendar/CalendarCell.js.map +1 -1
  70. package/dist/esm/components/Calendar/utils.js +1 -9
  71. package/dist/esm/components/Calendar/utils.js.map +1 -1
  72. package/dist/esm/components/DropDownMenu/DropDownMenu.js +25 -30
  73. package/dist/esm/components/DropDownMenu/DropDownMenu.js.map +1 -1
  74. package/dist/esm/components/DropDownMenu/DropDownMenu.styles.js +27 -73
  75. package/dist/esm/components/DropDownMenu/DropDownMenu.styles.js.map +1 -1
  76. package/dist/esm/components/DropDownMenu/dropDownMenuClasses.js +1 -1
  77. package/dist/esm/components/DropDownMenu/dropDownMenuClasses.js.map +1 -1
  78. package/dist/esm/components/FileUploader/DropZone/DropZone.js +5 -4
  79. package/dist/esm/components/FileUploader/DropZone/DropZone.js.map +1 -1
  80. package/dist/esm/components/Pagination/Pagination.styles.js +10 -14
  81. package/dist/esm/components/Pagination/Pagination.styles.js.map +1 -1
  82. package/dist/esm/components/Table/TableCell/TableCell.js +2 -2
  83. package/dist/esm/components/Table/TableCell/TableCell.js.map +1 -1
  84. package/dist/esm/components/Table/TableCell/TableCell.styles.js +2 -14
  85. package/dist/esm/components/Table/TableCell/TableCell.styles.js.map +1 -1
  86. package/dist/esm/components/Table/TableRow/TableRow.js +2 -2
  87. package/dist/esm/components/Table/TableRow/TableRow.js.map +1 -1
  88. package/dist/esm/components/Table/utils/utils.js +0 -5
  89. package/dist/esm/components/Table/utils/utils.js.map +1 -1
  90. package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
  91. package/dist/esm/components/Tooltip/Tooltip.styles.js +24 -38
  92. package/dist/esm/components/Tooltip/Tooltip.styles.js.map +1 -1
  93. package/dist/esm/components/VerticalNavigation/Actions/Actions.js +2 -2
  94. package/dist/esm/components/VerticalNavigation/Actions/Actions.js.map +1 -1
  95. package/dist/esm/components/VerticalNavigation/Header/Header.js +2 -2
  96. package/dist/esm/components/VerticalNavigation/Header/Header.js.map +1 -1
  97. package/dist/esm/components/VerticalNavigation/Navigation/Navigation.js +15 -8
  98. package/dist/esm/components/VerticalNavigation/Navigation/Navigation.js.map +1 -1
  99. package/dist/esm/components/VerticalNavigation/NavigationPopup/NavigationPopup.js +1 -0
  100. package/dist/esm/components/VerticalNavigation/NavigationPopup/NavigationPopup.js.map +1 -1
  101. package/dist/esm/components/VerticalNavigation/TreeView/TreeViewItem.js +5 -5
  102. package/dist/esm/components/VerticalNavigation/TreeView/TreeViewItem.js.map +1 -1
  103. package/dist/esm/components/VerticalNavigation/VerticalNavigation.js +7 -3
  104. package/dist/esm/components/VerticalNavigation/VerticalNavigation.js.map +1 -1
  105. package/dist/esm/components/VerticalNavigation/VerticalNavigationContext.js +1 -1
  106. package/dist/esm/components/VerticalNavigation/VerticalNavigationContext.js.map +1 -1
  107. package/dist/esm/hooks/useUniqueId.js +2 -2
  108. package/dist/esm/hooks/useUniqueId.js.map +1 -1
  109. package/dist/esm/index.js +5 -6
  110. package/dist/esm/utils/checkValidHexColorValue.js +9 -0
  111. package/dist/esm/utils/checkValidHexColorValue.js.map +1 -0
  112. package/dist/types/index.d.ts +41 -45
  113. package/package.json +5 -5
  114. package/dist/cjs/hocs/withId.cjs +0 -31
  115. package/dist/cjs/hocs/withId.cjs.map +0 -1
  116. package/dist/esm/hocs/withId.js +0 -28
  117. package/dist/esm/hocs/withId.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"CalendarCell.cjs","sources":["../../../../../src/components/Calendar/SingleCalendar/CalendarCell.tsx"],"sourcesContent":["import { SyntheticEvent, useRef } from \"react\";\nimport { clsx } from \"clsx\";\nimport { HvTooltip, HvTypography } from \"@core/components\";\nimport { useComputation } from \"@core/hooks\";\nimport {\n getDateISO,\n getFormattedDate,\n isSameDay,\n isSameMonth,\n dateInProvidedValueRange,\n checkIfDateIsDisabled,\n isDateRangeProp,\n} from \"../utils\";\nimport { DateRangeProp } from \"../Calendar\";\nimport calendarCellClasses, {\n HvCalendarCellClasses,\n} from \"./calendarCellClasses\";\nimport {\n StyledCalendarDate,\n StyledCellContainer,\n StyledDateWrapper,\n} from \"./CalendarCell.styles\";\nimport CalendarModel from \"../model\";\n\nexport const HvCalendarCell = ({\n classes,\n onChange,\n onKeyDown,\n calendarValue,\n firstDayOfCurrentMonth,\n value,\n isDateSelectionMode,\n today,\n locale,\n minimumDate,\n maximumDate,\n rangeMode = false,\n ...others\n}: HvCalendarCellProps) => {\n const buttonEl = useRef<HTMLButtonElement>(null);\n const [title, computeTitle] = useComputation(() =>\n getFormattedDate(value, locale)\n );\n\n const startDate = isDateRangeProp(calendarValue)\n ? calendarValue.startDate\n : undefined;\n const endDate = isDateRangeProp(calendarValue)\n ? calendarValue.endDate\n : undefined;\n const isCellToday = isSameDay(value, today);\n const isCellSelected = isSameDay(calendarValue, value);\n const inMonth = isSameMonth(value, firstDayOfCurrentMonth);\n const isCellAfterStartingDate =\n rangeMode && value && startDate ? value >= startDate : false;\n const isCellStartingDate = rangeMode ? isSameDay(value, startDate) : false;\n const isDateInSelectionRange =\n calendarValue && rangeMode\n ? dateInProvidedValueRange(value, calendarValue)\n : false;\n const isDateDisabled = checkIfDateIsDisabled(value, minimumDate, maximumDate);\n const startBookend = isSameDay(startDate, value);\n const endBookend = isSameDay(endDate, value);\n const isSelecting = isDateSelectionMode && isCellAfterStartingDate;\n\n const handleClick = (event: SyntheticEvent) => {\n if (value) {\n onChange?.(event, value);\n if (buttonEl.current) setTimeout(() => buttonEl?.current?.focus());\n }\n };\n\n const handleKeyDown = (event) => {\n onKeyDown?.(event);\n };\n\n const renderDate = () => (\n <StyledCellContainer\n ref={buttonEl}\n type=\"button\"\n className={clsx(\n calendarCellClasses.cellContainer,\n classes?.cellContainer,\n inMonth &&\n clsx(calendarCellClasses.focusSelection, classes?.focusSelection)\n )}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n disabled={isDateDisabled || !inMonth}\n data-in-month={inMonth}\n {...others}\n >\n <StyledCalendarDate\n variant={isCellToday ? \"label\" : \"body\"}\n className={clsx(\n calendarCellClasses.calendarDate,\n classes?.calendarDate,\n inMonth &&\n isCellSelected &&\n clsx(\n calendarCellClasses.calendarDateSelected,\n classes?.calendarDateSelected\n ),\n !inMonth &&\n clsx(\n calendarCellClasses.calendarDateNotInMonth,\n classes?.calendarDateNotInMonth\n ),\n inMonth &&\n rangeMode &&\n isDateInSelectionRange &&\n clsx(\n calendarCellClasses.calendarDateInSelectionRange,\n classes?.calendarDateInSelectionRange\n ),\n isDateDisabled &&\n clsx(\n calendarCellClasses.calendarDateDisabled,\n classes?.calendarDateDisabled\n ),\n inMonth &&\n ((startBookend && rangeMode) ||\n (isCellStartingDate && isDateSelectionMode)) &&\n clsx(calendarCellClasses.startBookend, classes?.startBookend),\n inMonth &&\n endBookend &&\n rangeMode &&\n clsx(calendarCellClasses.endBookend, classes?.endBookend)\n )}\n >\n {value && value.getDate()}\n </StyledCalendarDate>\n </StyledCellContainer>\n );\n\n return (\n <HvTooltip\n key={getDateISO(value)}\n enterDelay={600}\n onOpen={computeTitle}\n title={title ? <HvTypography noWrap>{title}</HvTypography> : \"\"}\n >\n <StyledDateWrapper\n className={clsx(\n calendarCellClasses.dateWrapper,\n classes?.dateWrapper,\n inMonth &&\n rangeMode &&\n isSelecting &&\n clsx(calendarCellClasses.cellsInRange, classes?.cellsInRange),\n rangeMode &&\n !isSelecting &&\n clsx(\n calendarCellClasses.cellsOutsideRange,\n classes?.cellsOutsideRange\n )\n )}\n data-calendar-cell=\"calendarCell\"\n >\n {renderDate()}\n </StyledDateWrapper>\n </HvTooltip>\n );\n};\n\nexport interface HvCalendarCellProps {\n /**\n * A Jss Object used to override or extend the component styles.\n */\n classes?: HvCalendarCellClasses;\n /**\n * Identifier.\n */\n id?: string;\n /**\n * The text to be shown on the main part of the header.\n */\n calendarValue?: string | Date | DateRangeProp;\n /**\n * The text to be shown on the main part of the header.\n */\n value?: Date;\n /**\n * Locale to be used by the calendar.\n */\n locale?: string;\n /**\n * Callback to define the input date.\n */\n onChange?: (event: SyntheticEvent, value: Date | DateRangeProp) => void;\n /**\n * Callback to handle input onFocus.\n */\n onFocus?: React.FocusEventHandler<any>;\n\n calendarModel?: CalendarModel;\n onKeyDown?: (event: KeyboardEvent) => void;\n\n today?: Date;\n minimumDate?: Date;\n maximumDate?: Date;\n firstDayOfCurrentMonth?: Date;\n isDateSelectionMode?: boolean;\n rangeMode?: boolean;\n tabIndex?: number;\n}\n\nexport default HvCalendarCell;\n"],"names":["HvCalendarCell","classes","onChange","onKeyDown","calendarValue","firstDayOfCurrentMonth","value","isDateSelectionMode","today","locale","minimumDate","maximumDate","rangeMode","others","buttonEl","useRef","title","computeTitle","useComputation","getFormattedDate","startDate","isDateRangeProp","undefined","endDate","isCellToday","isSameDay","isCellSelected","inMonth","isSameMonth","isCellAfterStartingDate","isCellStartingDate","isDateInSelectionRange","dateInProvidedValueRange","isDateDisabled","checkIfDateIsDisabled","startBookend","endBookend","isSelecting","handleClick","event","current","setTimeout","focus","handleKeyDown","renderDate","_jsx","StyledCellContainer","ref","type","className","clsx","calendarCellClasses","cellContainer","focusSelection","onClick","disabled","children","StyledCalendarDate","variant","calendarDate","calendarDateSelected","calendarDateNotInMonth","calendarDateInSelectionRange","calendarDateDisabled","getDate","HvTooltip","enterDelay","onOpen","HvTypography","noWrap","StyledDateWrapper","dateWrapper","cellsInRange","cellsOutsideRange","getDateISO"],"mappings":";;;;;;;;;;;AAwBO,MAAMA,iBAAiBA,CAAC;AAAA,EAC7BC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,YAAY;AAAA,EACZ,GAAGC;AACgB,MAAM;AACnBC,QAAAA,WAAWC,aAA0B,IAAI;AACzC,QAAA,CAACC,OAAOC,YAAY,IAAIC,eAAAA,QAAe,MAC3CC,uBAAiBb,OAAOG,MAAM,CAAC;AAGjC,QAAMW,YAAYC,MAAAA,gBAAgBjB,aAAa,IAC3CA,cAAcgB,YACdE;AACJ,QAAMC,UAAUF,MAAAA,gBAAgBjB,aAAa,IACzCA,cAAcmB,UACdD;AACEE,QAAAA,cAAcC,MAAAA,UAAUnB,OAAOE,KAAK;AACpCkB,QAAAA,iBAAiBD,MAAAA,UAAUrB,eAAeE,KAAK;AAC/CqB,QAAAA,UAAUC,MAAAA,YAAYtB,OAAOD,sBAAsB;AACzD,QAAMwB,0BACJjB,aAAaN,SAASc,YAAYd,SAASc,YAAY;AACzD,QAAMU,qBAAqBlB,YAAYa,MAAAA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,WACEf,aACAmB,0BACAmB,UACEC,oBAAAA,QAAoBW,8BACpB7D,mCAAS6D,4BAA4B,GAEzC7B,kBACEiB,KAAAA,KACEC,oBAAoBY,QAAAA,sBACpB9D,mCAAS8D,oBAAoB,GAEjCpC,YACIQ,gBAAgBvB,aACfkB,sBAAsBvB,wBACzB2C,UAAKC,oBAAAA,QAAoBhB,cAAclC,mCAASkC,YAAY,GAC9DR,WACES,cACAxB,aACAsC,KAAAA,KAAKC,oBAAoBf,QAAAA,YAAYnC,mCAASmC,UAAU,CAAC;AAAA,MAC3DoB,UAEDlD,SAASA,MAAM0D,QAAO;AAAA,IAAA,CAAE;AAAA,EAAA,CAG9B;AAED,wCACGC,QAAAA,WAAS;AAAA,IAERC,YAAY;AAAA,IACZC,QAAQlD;AAAAA,IACRD,OAAOA,QAAQ6B,2BAAAA,IAACuB,yBAAY;AAAA,MAACC,QAAM;AAAA,MAAAb,UAAExC;AAAAA,IAAK,CAAA,IAAmB;AAAA,IAAGwC,yCAE/Dc,uCAAiB;AAAA,MAChBrB,WAAWC,UACTC,4BAAoBoB,aACpBtE,mCAASsE,aACT5C,WACEf,aACAyB,eACAa,KAAAA,KAAKC,oBAAAA,QAAoBqB,cAAcvE,mCAASuE,YAAY,GAC9D5D,aACE,CAACyB,eACDa,UACEC,oBAAAA,QAAoBsB,mBACpBxE,mCAASwE,iBAAiB,CAC3B;AAAA,MAEL,sBAAmB;AAAA,MAAcjB,UAEhCZ,WAAU;AAAA,IAAA,CAAE;AAAA,EAAA,GAtBV8B,MAAWpE,WAAAA,KAAK,CAAC;AA0B5B;;;"}
1
+ {"version":3,"file":"CalendarCell.cjs","sources":["../../../../../src/components/Calendar/SingleCalendar/CalendarCell.tsx"],"sourcesContent":["import { SyntheticEvent, useRef } from \"react\";\nimport { clsx } from \"clsx\";\nimport {\n isSameDay,\n isSameMonth,\n dateInProvidedValueRange,\n checkIfDateIsDisabled,\n isDateRangeProp,\n} from \"../utils\";\nimport { DateRangeProp } from \"../Calendar\";\nimport calendarCellClasses, {\n HvCalendarCellClasses,\n} from \"./calendarCellClasses\";\nimport {\n StyledCalendarDate,\n StyledCellContainer,\n StyledDateWrapper,\n} from \"./CalendarCell.styles\";\nimport CalendarModel from \"../model\";\n\nexport const HvCalendarCell = ({\n classes,\n onChange,\n onKeyDown,\n calendarValue,\n firstDayOfCurrentMonth,\n value,\n isDateSelectionMode,\n today,\n locale,\n minimumDate,\n maximumDate,\n rangeMode = false,\n ...others\n}: HvCalendarCellProps) => {\n const buttonEl = useRef<HTMLButtonElement>(null);\n\n const startDate = isDateRangeProp(calendarValue)\n ? calendarValue.startDate\n : undefined;\n const endDate = isDateRangeProp(calendarValue)\n ? calendarValue.endDate\n : undefined;\n const isCellToday = isSameDay(value, today);\n const isCellSelected = isSameDay(calendarValue, value);\n const inMonth = isSameMonth(value, firstDayOfCurrentMonth);\n const isCellAfterStartingDate =\n rangeMode && value && startDate ? value >= startDate : false;\n const isCellStartingDate = rangeMode ? isSameDay(value, startDate) : false;\n const isDateInSelectionRange =\n calendarValue && rangeMode\n ? dateInProvidedValueRange(value, calendarValue)\n : false;\n const isDateDisabled = checkIfDateIsDisabled(value, minimumDate, maximumDate);\n const startBookend = isSameDay(startDate, value);\n const endBookend = isSameDay(endDate, value);\n const isSelecting = isDateSelectionMode && isCellAfterStartingDate;\n\n const handleClick = (event: SyntheticEvent) => {\n if (value) {\n onChange?.(event, value);\n if (buttonEl.current) setTimeout(() => buttonEl?.current?.focus());\n }\n };\n\n const handleKeyDown = (event) => {\n onKeyDown?.(event);\n };\n\n const renderDate = () => (\n <StyledCellContainer\n ref={buttonEl}\n type=\"button\"\n className={clsx(\n calendarCellClasses.cellContainer,\n classes?.cellContainer,\n inMonth &&\n clsx(calendarCellClasses.focusSelection, classes?.focusSelection)\n )}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n disabled={isDateDisabled || !inMonth}\n data-in-month={inMonth}\n {...others}\n >\n <StyledCalendarDate\n variant={isCellToday ? \"label\" : \"body\"}\n className={clsx(\n calendarCellClasses.calendarDate,\n classes?.calendarDate,\n inMonth &&\n isCellSelected &&\n clsx(\n calendarCellClasses.calendarDateSelected,\n classes?.calendarDateSelected\n ),\n !inMonth &&\n clsx(\n calendarCellClasses.calendarDateNotInMonth,\n classes?.calendarDateNotInMonth\n ),\n inMonth &&\n rangeMode &&\n isDateInSelectionRange &&\n clsx(\n calendarCellClasses.calendarDateInSelectionRange,\n classes?.calendarDateInSelectionRange\n ),\n isDateDisabled &&\n clsx(\n calendarCellClasses.calendarDateDisabled,\n classes?.calendarDateDisabled\n ),\n inMonth &&\n ((startBookend && rangeMode) ||\n (isCellStartingDate && isDateSelectionMode)) &&\n clsx(calendarCellClasses.startBookend, classes?.startBookend),\n inMonth &&\n endBookend &&\n rangeMode &&\n clsx(calendarCellClasses.endBookend, classes?.endBookend)\n )}\n >\n {value && value.getDate()}\n </StyledCalendarDate>\n </StyledCellContainer>\n );\n\n return (\n <StyledDateWrapper\n className={clsx(\n calendarCellClasses.dateWrapper,\n classes?.dateWrapper,\n inMonth &&\n rangeMode &&\n isSelecting &&\n clsx(calendarCellClasses.cellsInRange, classes?.cellsInRange),\n rangeMode &&\n !isSelecting &&\n clsx(\n calendarCellClasses.cellsOutsideRange,\n classes?.cellsOutsideRange\n )\n )}\n data-calendar-cell=\"calendarCell\"\n >\n {renderDate()}\n </StyledDateWrapper>\n );\n};\n\nexport interface HvCalendarCellProps {\n /**\n * A Jss Object used to override or extend the component styles.\n */\n classes?: HvCalendarCellClasses;\n /**\n * Identifier.\n */\n id?: string;\n /**\n * The text to be shown on the main part of the header.\n */\n calendarValue?: string | Date | DateRangeProp;\n /**\n * The text to be shown on the main part of the header.\n */\n value?: Date;\n /**\n * Locale to be used by the calendar.\n */\n locale?: string;\n /**\n * Callback to define the input date.\n */\n onChange?: (event: SyntheticEvent, value: Date | DateRangeProp) => void;\n /**\n * Callback to handle input onFocus.\n */\n onFocus?: React.FocusEventHandler<any>;\n\n calendarModel?: CalendarModel;\n onKeyDown?: (event: KeyboardEvent) => void;\n\n today?: Date;\n minimumDate?: Date;\n maximumDate?: Date;\n firstDayOfCurrentMonth?: Date;\n isDateSelectionMode?: boolean;\n rangeMode?: boolean;\n tabIndex?: number;\n}\n\nexport default HvCalendarCell;\n"],"names":["HvCalendarCell","classes","onChange","onKeyDown","calendarValue","firstDayOfCurrentMonth","value","isDateSelectionMode","today","locale","minimumDate","maximumDate","rangeMode","others","buttonEl","useRef","startDate","isDateRangeProp","undefined","endDate","isCellToday","isSameDay","isCellSelected","inMonth","isSameMonth","isCellAfterStartingDate","isCellStartingDate","isDateInSelectionRange","dateInProvidedValueRange","isDateDisabled","checkIfDateIsDisabled","startBookend","endBookend","isSelecting","handleClick","event","current","setTimeout","focus","handleKeyDown","renderDate","_jsx","StyledCellContainer","ref","type","className","clsx","calendarCellClasses","cellContainer","focusSelection","onClick","disabled","children","StyledCalendarDate","variant","calendarDate","calendarDateSelected","calendarDateNotInMonth","calendarDateInSelectionRange","calendarDateDisabled","getDate","StyledDateWrapper","dateWrapper","cellsInRange","cellsOutsideRange"],"mappings":";;;;;;;;AAoBO,MAAMA,iBAAiBA,CAAC;AAAA,EAC7BC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,YAAY;AAAA,EACZ,GAAGC;AACgB,MAAM;AACnBC,QAAAA,WAAWC,aAA0B,IAAI;AAE/C,QAAMC,YAAYC,MAAAA,gBAAgBb,aAAa,IAC3CA,cAAcY,YACdE;AACJ,QAAMC,UAAUF,MAAAA,gBAAgBb,aAAa,IACzCA,cAAce,UACdD;AACEE,QAAAA,cAAcC,MAAAA,UAAUf,OAAOE,KAAK;AACpCc,QAAAA,iBAAiBD,MAAAA,UAAUjB,eAAeE,KAAK;AAC/CiB,QAAAA,UAAUC,MAAAA,YAAYlB,OAAO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,oBAAoB,GAEjC,CAACjC,WACCuB,KAAAA,KACEC,oBAAAA,QAAoBU,wBACpBxD,mCAASwD,sBAAsB,GAEnClC,WACEX,aACAe,0BACAmB,UACEC,oBAAAA,QAAoBW,8BACpBzD,mCAASyD,4BAA4B,GAEzC7B,kBACEiB,KAAAA,KACEC,oBAAoBY,QAAAA,sBACpB1D,mCAAS0D,oBAAoB,GAEjCpC,YACIQ,gBAAgBnB,aACfc,sBAAsBnB,wBACzBuC,UAAKC,oBAAAA,QAAoBhB,cAAc9B,mCAAS8B,YAAY,GAC9DR,WACES,cACApB,aACAkC,KAAAA,KAAKC,oBAAoBf,QAAAA,YAAY/B,mCAAS+B,UAAU,CAAC;AAAA,MAC3DoB,UAED9C,SAASA,MAAMsD,QAAO;AAAA,IAAA,CAAE;AAAA,EAAA,CAG9B;AAED,wCACGC,oBAAAA,mBAAiB;AAAA,IAChBhB,WAAWC,UACTC,4BAAoBe,aACpB7D,mCAAS6D,aACTvC,WACEX,aACAqB,eACAa,KAAAA,KAAKC,oBAAAA,QAAoBgB,cAAc9D,mCAAS8D,YAAY,GAC9DnD,aACE,CAACqB,eACDa,UACEC,oBAAAA,QAAoBiB,mBACpB/D,mCAAS+D,iBAAiB,CAC3B;AAAA,IAEL,sBAAmB;AAAA,IAAcZ,UAEhCZ,WAAU;AAAA,EAAA,CACO;AAExB;;;"}
@@ -8,7 +8,6 @@ const dayjs__default = /* @__PURE__ */ _interopDefault(dayjs);
8
8
  const isNil__default = /* @__PURE__ */ _interopDefault(isNil);
9
9
  const capitalize__default = /* @__PURE__ */ _interopDefault(capitalize);
10
10
  const CALENDAR_WEEKS = 6;
11
- const zeroPad = (value, length) => `${value}`.padStart(length, "0");
12
11
  const getMonthDays = (month, year) => new Date(year, month, 0).getDate();
13
12
  const getMonthFirstWeekday = (month, year) => new Date(year, month - 1, 1).getDay();
14
13
  const makeUTCDate = (year, monthIndex, day, hour = 1) => new Date(Date.UTC(year, monthIndex, day, hour));
@@ -24,11 +23,6 @@ const isSameDay = (date1, date2) => {
24
23
  return false;
25
24
  return date1.getDate() === date2.getDate() && date1.getMonth() === date2.getMonth() && date1.getFullYear() === date2.getFullYear();
26
25
  };
27
- const getDateISO = (date) => {
28
- if (!isDate(date))
29
- return null;
30
- return [date.getFullYear(), zeroPad(date.getMonth() + 1, 2), zeroPad(date.getDate(), 2)].join("-");
31
- };
32
26
  const getPreviousMonth = (month, year) => {
33
27
  const prevMonth = month > 1 ? month - 1 : 12;
34
28
  const prevMonthYear = month > 1 ? year : year - 1;
@@ -126,7 +120,6 @@ exports.checkIfDateIsDisabled = checkIfDateIsDisabled;
126
120
  exports.createDatesArray = createDatesArray;
127
121
  exports.dateInProvidedValueRange = dateInProvidedValueRange;
128
122
  exports.formatToLocale = formatToLocale;
129
- exports.getDateISO = getDateISO;
130
123
  exports.getFormattedDate = getFormattedDate;
131
124
  exports.getMonthDays = getMonthDays;
132
125
  exports.getMonthFirstWeekday = getMonthFirstWeekday;
@@ -141,5 +134,4 @@ exports.isRange = isRange;
141
134
  exports.isSameDay = isSameDay;
142
135
  exports.isSameMonth = isSameMonth;
143
136
  exports.makeUTCDate = makeUTCDate;
144
- exports.zeroPad = zeroPad;
145
137
  //# sourceMappingURL=utils.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.cjs","sources":["../../../../src/components/Calendar/utils.tsx"],"sourcesContent":["import dayjs from \"dayjs\";\nimport isNil from \"lodash/isNil\";\nimport capitalize from \"lodash/capitalize\";\nimport { DateRangeProp } from \".\";\n\n/**\n * Constant with the number of weeks to be displayed on the calendar.\n */\nexport const CALENDAR_WEEKS = 6;\n\n/**\n * Constant with the default locale that should be used as the default.\n */\nexport const DEFAULT_LOCALE = \"en\";\n\n/**\n * Pads a string value with leading zeroes(0) until length is reached.\n *\n * @param value - Value to be padded.\n * @param length - Length of the value after the padding is added.\n * @returns The value as a string with the received amount of padding.\n *\n * @example zeroPad(5, 2) => \"05\"\n */\nexport const zeroPad = (value: number, length: number) =>\n `${value}`.padStart(length, \"0\");\n\n/**\n * Returns the number of days in the month given a month and year.\n *\n * @param month - Number of the month (1 to 12).\n * @param year - Number of the year.\n * @returns The number of days in a month for the received year.\n */\nexport const getMonthDays = (month: number, year: number) =>\n new Date(year, month, 0).getDate();\n\n/**\n * Gets the week day of the first day of a given month and year.\n * From 0 (Sunday) to 6 (Saturday).\n *\n * @param month - Number of the month (1 to 12).\n * @param year - Number of the year.\n * @returns The zero indexed week day where 0 is Sunday (0 to 6).\n */\nexport const getMonthFirstWeekday = (month: number, year: number) =>\n new Date(year, month - 1, 1).getDay();\n\n/**\n * Creates a `Date` instance in UTC timezone.\n *\n * @param year - The year of the date.\n * @param monthIndex - The zero indexed month of the year (0 to 11).\n * @param day - The day of the month.\n * @param [hour=1] - The hour of the day.\n * @returns A `Date` instance in UTC timezone.\n */\nexport const makeUTCDate = (\n year: number,\n monthIndex: number,\n day: number,\n hour = 1\n) => new Date(Date.UTC(year, monthIndex, day, hour));\n\n/**\n * Checks if the received date is a valid date.\n *\n * @param date - The date to be validated.\n * @returns A flag stating if the date is valid or not.\n */\nexport const isDate = (date: any): date is Date =>\n Object.prototype.toString.call(date) === \"[object Date]\" &&\n !Number.isNaN(date.valueOf());\n\nexport const isDateRangeProp = (date: any): date is DateRangeProp =>\n \"startDate\" in date;\n\n/**\n * Checks if two dates are in the same month and year.\n *\n * @param date1 - First date.\n * @param date2 - Second date.\n * @returns A flag stating if the dates are in the same month and year or not.\n */\nexport const isSameMonth = (date1: any, date2: any) => {\n if (!(isDate(date1) && isDate(date2))) return false;\n\n return (\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear()\n );\n};\n\n/**\n * Checks if two dates are on the same day.\n *\n * @param date1 - First date.\n * @param date2 - Second date.\n * @returns A flag stating if the dates are in the same day or not.\n */\nexport const isSameDay = (date1: any, date2: any) => {\n if (!(isDate(date1) && isDate(date2))) return false;\n\n return (\n date1.getDate() === date2.getDate() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear()\n );\n};\n\n/**\n * Formats the received date using the ISO format (YYYY-MM-DD).\n *\n * @param date - The date to be formatted.\n * @returns The formatted date in ISO format.\n */\nexport const getDateISO = (date?: Date) => {\n if (!isDate(date)) return null;\n\n return [\n date.getFullYear(),\n zeroPad(date.getMonth() + 1, 2),\n zeroPad(date.getDate(), 2),\n ].join(\"-\");\n};\n\n/**\n * Returns an object with the previous month taking also into consideration the year.\n * For example the previous month of January 2000 will be December 1999.\n *\n * @param month - Number of the month.\n * @param year - Number of the year.\n * @returns Object with new month and year defined.\n */\nexport const getPreviousMonth = (month: number, year: number) => {\n const prevMonth = month > 1 ? month - 1 : 12;\n const prevMonthYear = month > 1 ? year : year - 1;\n\n return { month: prevMonth, year: prevMonthYear };\n};\n\n/**\n * Returns an object with the next month taking also into consideration the year.\n * For example the next month of December 2000 will be January 2001.\n *\n * @param month - Number of the month.\n * @param year - Number of the year.\n * @returns Object with new month and year defined.\n */\nexport const getNextMonth = (month: number, year: number) => {\n const nextMonth = month < 12 ? month + 1 : 1;\n const nextMonthYear = month < 12 ? year : year + 1;\n\n return { month: nextMonth, year: nextMonthYear };\n};\n\n/**\n * Returns a list with the names of all the months localized in the received locale and representation value.\n *\n * @param locale - The locale to be applied to the Intl format.\n * @param representationValue - The representation value for the month.\n * @returns An array with all the months names.\n */\nexport const getMonthNamesList = (\n locale: string | undefined,\n representationValue: Intl.DateTimeFormatOptions[\"month\"] = \"long\"\n) => {\n const options = { month: representationValue, timeZone: \"UTC\" };\n\n return [...new Array(12)].map((n, index) => {\n const auxDate = makeUTCDate(1970, index, 1);\n return capitalize(Intl.DateTimeFormat(locale, options).format(auxDate));\n });\n};\n\n/**\n * Returns a list with the names of all the weekdays localized in the received locale and representation value.\n *\n * @param locale - The locale to be applied.\n * @param dateTimeFormatValue - The representation value for the weekday.\n * @returns An array with all the weekday names.\n */\nexport const getWeekdayNamesList = (\n locale: string,\n dateTimeFormatValue: Intl.DateTimeFormatOptions[\"weekday\"] = \"long\"\n) => {\n const options = { weekday: dateTimeFormatValue, timeZone: \"UTC\" };\n const weekdayNames: string[] = [];\n\n for (let day = 4; day <= 10; day += 1) {\n const auxDate = makeUTCDate(1970, 0, day);\n weekdayNames.push(Intl.DateTimeFormat(locale, options).format(auxDate));\n }\n return weekdayNames;\n};\n\n/**\n * Returns the name of the month for the supplied month localized in the received locale and representation value.\n *\n * @param date - The date from which the month name is extracted.\n * @param locale - The locale to be applied to the Intl format.\n * @param representationValue - The locale to be applied to the Intl format.\n * @returns The name of the month.\n */\nexport const getMonthName = (\n date: Date,\n locale: string,\n representationValue: Intl.DateTimeFormatOptions[\"month\"] = \"long\"\n) =>\n new Intl.DateTimeFormat(locale, { month: representationValue }).format(date);\n\n/**\n * Formats the received date according to Design System specifications.\n * Currently: day month, year => `14 Aug, 2019`.\n *\n * @param date - UTC date to be formatted.\n * @param locale - The locale to be applied to the Intl format.\n * @returns The formatted date as a string.\n */\nexport const getFormattedDate = (\n // TODO: fix this\n date: any,\n locale: any,\n rep: Intl.DateTimeFormatOptions[\"month\"] = \"short\"\n) =>\n `${date.getDate()} ${getMonthName(date, locale, rep)} ${date.getFullYear()}`;\n\n/**\n * Creates an array of 42 days. The complete current month and enough days from the previous and next months to fill\n * the 42 positions.\n *\n * @param month - The number of the month (1 to 12).\n * @param year - The number of the year.\n * @returns The array of dates.\n */\nexport const createDatesArray = (month: number, year: number) => {\n // Initializes the variables needed to calculate the dates for the received month and year\n const monthDays = getMonthDays(month, year);\n const daysFromPrevMonth = getMonthFirstWeekday(month, year);\n const daysFromNextMonth =\n CALENDAR_WEEKS * 7 - (daysFromPrevMonth + monthDays);\n const prevMonthYear = getPreviousMonth(month, year);\n const nextMonthYear = getNextMonth(month, year);\n const prevMonthDays = getMonthDays(prevMonthYear.month, prevMonthYear.year);\n\n // Creates the arrays for the dates for previous, current and next months\n const prevMonthDates = [...new Array(daysFromPrevMonth)].map((n, index) => {\n const day = index + 1 + (prevMonthDays - daysFromPrevMonth);\n return new Date(prevMonthYear.year, prevMonthYear.month - 1, day);\n });\n const currentMonthDates = [...new Array(monthDays)].map((n, index) => {\n const day = index + 1;\n return new Date(year, month - 1, day);\n });\n const nextMonthDates = [...new Array(daysFromNextMonth)].map((n, index) => {\n const day = index + 1;\n return new Date(nextMonthYear.year, nextMonthYear.month - 1, day);\n });\n\n return [...prevMonthDates, ...currentMonthDates, ...nextMonthDates];\n};\n\n/**\n * Checks if the received locale is valid according to Intl.\n *\n * @param locale - The locale to be checked\n * @returns True if the locale is valid, false otherwise.\n */\nexport const isValidLocale = (locale: string) => {\n try {\n if (Intl.DateTimeFormat.supportedLocalesOf(locale).length > 0) {\n return true;\n }\n // eslint-disable-next-line no-console\n console.warn(`${locale} is not supported. Falling back to a known locale.`);\n return false;\n } catch (error) {\n if (\n error != null &&\n typeof error === \"object\" &&\n \"name\" in error &&\n error?.name === \"RangeError\"\n ) {\n // eslint-disable-next-line no-console\n console.error(`Invalid locale: ${locale}`);\n return false;\n }\n if (error != null && typeof error === \"object\" && \"message\" in error) {\n // eslint-disable-next-line no-console\n console.error(error?.message);\n return false;\n }\n\n return false;\n }\n};\n\nexport const isRange = (date): date is DateRangeProp =>\n date != null && typeof date === \"object\" && \"startDate\" in date;\n\n/**\n * Checks if the date falls within a specified date range.\n *\n * @param date - The date to be evaluated.\n * @param providedValueRange - Provided selection range.\n * @returns - True if the date falls within the range, false otherwise.\n */\nexport const dateInProvidedValueRange = (\n date: any,\n providedValueRange: any\n) => {\n const { startDate, endDate } = providedValueRange;\n\n if (!isRange(providedValueRange) || isNil(endDate)) return false;\n const localEndDate = endDate;\n\n const modStartDate = dayjs(startDate).format(\"YYYY-MM-DD\");\n const modEndDate = dayjs(localEndDate).format(\"YYYY-MM-DD\");\n\n const convertedDate = dayjs(date).format(\"YYYY-MM-DD\");\n\n return convertedDate >= modStartDate && convertedDate <= modEndDate;\n};\n\nexport const checkIfDateIsDisabled = (\n date?: string | number | Date | dayjs.Dayjs,\n minimumDate?: string | number | Date | dayjs.Dayjs,\n maximumDate?: string | number | Date | dayjs.Dayjs\n) => {\n if (!minimumDate && !maximumDate) return false;\n const modStartDate = minimumDate\n ? dayjs(minimumDate).format(\"YYYY-MM-DD\")\n : undefined;\n const modEndDate = maximumDate\n ? dayjs(maximumDate).format(\"YYYY-MM-DD\")\n : undefined;\n\n const convertedDate = dayjs(date).format(\"YYYY-MM-DD\");\n\n return (\n (modStartDate !== undefined && convertedDate < modStartDate) ||\n (modEndDate !== undefined && convertedDate > modEndDate)\n );\n};\n\nexport const formatToLocale = (date, locale) => {\n return new Intl.DateTimeFormat(locale, {\n day: \"numeric\",\n month: \"short\",\n year: \"numeric\",\n }).format(date);\n};\n"],"names":["CALENDAR_WEEKS","zeroPad","value","length","padStart","getMonthDays","month","year","Date","getDate","getMonthFirstWeekday","getDay","makeUTCDate","monthIndex","day","hour","UTC","isDate","date","Object","prototype","toString","call","Number","isNaN","valueOf","isDateRangeProp","isSameMonth","date1","date2","getMonth","getFullYear","isSameDay","getDateISO","join","getPreviousMonth","prevMonth","prevMonthYear","getNextMonth","nextMonth","nextMonthYear","getMonthNamesList","locale","representationValue","options","timeZone","Array","map","n","index","auxDate","capitalize","Intl","DateTimeFormat","format","getWeekdayNamesList","dateTimeFormatValue","weekday","weekdayNames","push","getMonthName","getFormattedDate","rep","createDatesArray","monthDays","daysFromPrevMonth","daysFromNextMonth","prevMonthDays","prevMonthDates","currentMonthDates","nextMonthDates","isRange","dateInProvidedValueRange","providedValueRange","startDate","endDate","isNil","localEndDate","modStartDate","dayjs","modEndDate","convertedDate","checkIfDateIsDisabled","minimumDate","maximumDate","undefined","formatToLocale"],"mappings":";;;;;;;;;AAQO,MAAMA,iBAAiB;AAgBjBC,MAAAA,UAAUA,CAACC,OAAeC,WACpC,GAAED,QAAQE,SAASD,QAAQ,GAAG;AASpBE,MAAAA,eAAeA,CAACC,OAAeC,SAC1C,IAAIC,KAAKD,MAAMD,OAAO,CAAC,EAAEG,Q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AeA;AAShDsD,MAAAA,2BAA2BA,CACtCtD,MACAuD,uBACG;AACG,QAAA;AAAA,IAAEC;AAAAA,IAAWC;AAAAA,EAAYF,IAAAA;AAE/B,MAAI,CAACF,QAAQE,kBAAkB,KAAKG,eAAAA,QAAMD,OAAO;AAAU,WAAA;AAC3D,QAAME,eAAeF;AAErB,QAAMG,eAAeC,eAAAA,QAAML,SAAS,EAAEpB,OAAO,YAAY;AACzD,QAAM0B,aAAaD,eAAAA,QAAMF,YAAY,EAAEvB,OAAO,YAAY;AAE1D,QAAM2B,gBAAgBF,eAAAA,QAAM7D,IAAI,EAAEoC,OAAO,YAAY;AAE9C2B,SAAAA,iBAAiBH,gBAAgBG,iBAAiBD;AAC3D;AAEO,MAAME,wBAAwBA,CACnChE,MACAiE,aACAC,gBACG;AACC,MAAA,CAACD,eAAe,CAACC;AAAoB,WAAA;AACzC,QAAMN,eAAeK,cACjBJ,uBAAMI,WAAW,EAAE7B,OAAO,YAAY,IACtC+B;AACJ,QAAML,aAAaI,cACfL,uBAAMK,WAAW,EAAE9B,OAAO,YAAY,IACtC+B;AAEJ,QAAMJ,gBAAgBF,eAAAA,QAAM7D,IAAI,EAAEoC,OAAO,YAAY;AAErD,SACGwB,iBAAiBO,UAAaJ,gBAAgBH,gBAC9CE,eAAeK,UAAaJ,gBAAgBD;AAEjD;AAEaM,MAAAA,iBAAiBA,CAACpE,MAAMwB,WAAW;AACvC,SAAA,IAAIU,KAAKC,eAAeX,QAAQ;AAAA,IACrC5B,KAAK;AAAA,IACLR,OAAO;AAAA,IACPC,MAAM;AAAA,EAAA,CACP,EAAE+C,OAAOpC,IAAI;AAChB;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"utils.cjs","sources":["../../../../src/components/Calendar/utils.tsx"],"sourcesContent":["import dayjs from \"dayjs\";\nimport isNil from \"lodash/isNil\";\nimport capitalize from \"lodash/capitalize\";\nimport { DateRangeProp } from \".\";\n\n/**\n * Constant with the number of weeks to be displayed on the calendar.\n */\nexport const CALENDAR_WEEKS = 6;\n\n/**\n * Constant with the default locale that should be used as the default.\n */\nexport const DEFAULT_LOCALE = \"en\";\n\n/**\n * Pads a string value with leading zeroes(0) until length is reached.\n *\n * @param value - Value to be padded.\n * @param length - Length of the value after the padding is added.\n * @returns The value as a string with the received amount of padding.\n *\n * @example zeroPad(5, 2) => \"05\"\n */\nexport const zeroPad = (value: number, length: number) =>\n `${value}`.padStart(length, \"0\");\n\n/**\n * Returns the number of days in the month given a month and year.\n *\n * @param month - Number of the month (1 to 12).\n * @param year - Number of the year.\n * @returns The number of days in a month for the received year.\n */\nexport const getMonthDays = (month: number, year: number) =>\n new Date(year, month, 0).getDate();\n\n/**\n * Gets the week day of the first day of a given month and year.\n * From 0 (Sunday) to 6 (Saturday).\n *\n * @param month - Number of the month (1 to 12).\n * @param year - Number of the year.\n * @returns The zero indexed week day where 0 is Sunday (0 to 6).\n */\nexport const getMonthFirstWeekday = (month: number, year: number) =>\n new Date(year, month - 1, 1).getDay();\n\n/**\n * Creates a `Date` instance in UTC timezone.\n *\n * @param year - The year of the date.\n * @param monthIndex - The zero indexed month of the year (0 to 11).\n * @param day - The day of the month.\n * @param [hour=1] - The hour of the day.\n * @returns A `Date` instance in UTC timezone.\n */\nexport const makeUTCDate = (\n year: number,\n monthIndex: number,\n day: number,\n hour = 1\n) => new Date(Date.UTC(year, monthIndex, day, hour));\n\n/**\n * Checks if the received date is a valid date.\n *\n * @param date - The date to be validated.\n * @returns A flag stating if the date is valid or not.\n */\nexport const isDate = (date: any): date is Date =>\n Object.prototype.toString.call(date) === \"[object Date]\" &&\n !Number.isNaN(date.valueOf());\n\nexport const isDateRangeProp = (date: any): date is DateRangeProp =>\n \"startDate\" in date;\n\n/**\n * Checks if two dates are in the same month and year.\n *\n * @param date1 - First date.\n * @param date2 - Second date.\n * @returns A flag stating if the dates are in the same month and year or not.\n */\nexport const isSameMonth = (date1: any, date2: any) => {\n if (!(isDate(date1) && isDate(date2))) return false;\n\n return (\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear()\n );\n};\n\n/**\n * Checks if two dates are on the same day.\n *\n * @param date1 - First date.\n * @param date2 - Second date.\n * @returns A flag stating if the dates are in the same day or not.\n */\nexport const isSameDay = (date1: any, date2: any) => {\n if (!(isDate(date1) && isDate(date2))) return false;\n\n return (\n date1.getDate() === date2.getDate() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear()\n );\n};\n\n/**\n * Formats the received date using the ISO format (YYYY-MM-DD).\n *\n * @param date - The date to be formatted.\n * @returns The formatted date in ISO format.\n */\nexport const getDateISO = (date?: Date) => {\n if (!isDate(date)) return null;\n\n return [\n date.getFullYear(),\n zeroPad(date.getMonth() + 1, 2),\n zeroPad(date.getDate(), 2),\n ].join(\"-\");\n};\n\n/**\n * Returns an object with the previous month taking also into consideration the year.\n * For example the previous month of January 2000 will be December 1999.\n *\n * @param month - Number of the month.\n * @param year - Number of the year.\n * @returns Object with new month and year defined.\n */\nexport const getPreviousMonth = (month: number, year: number) => {\n const prevMonth = month > 1 ? month - 1 : 12;\n const prevMonthYear = month > 1 ? year : year - 1;\n\n return { month: prevMonth, year: prevMonthYear };\n};\n\n/**\n * Returns an object with the next month taking also into consideration the year.\n * For example the next month of December 2000 will be January 2001.\n *\n * @param month - Number of the month.\n * @param year - Number of the year.\n * @returns Object with new month and year defined.\n */\nexport const getNextMonth = (month: number, year: number) => {\n const nextMonth = month < 12 ? month + 1 : 1;\n const nextMonthYear = month < 12 ? year : year + 1;\n\n return { month: nextMonth, year: nextMonthYear };\n};\n\n/**\n * Returns a list with the names of all the months localized in the received locale and representation value.\n *\n * @param locale - The locale to be applied to the Intl format.\n * @param representationValue - The representation value for the month.\n * @returns An array with all the months names.\n */\nexport const getMonthNamesList = (\n locale: string | undefined,\n representationValue: Intl.DateTimeFormatOptions[\"month\"] = \"long\"\n) => {\n const options = { month: representationValue, timeZone: \"UTC\" };\n\n return [...new Array(12)].map((n, index) => {\n const auxDate = makeUTCDate(1970, index, 1);\n return capitalize(Intl.DateTimeFormat(locale, options).format(auxDate));\n });\n};\n\n/**\n * Returns a list with the names of all the weekdays localized in the received locale and representation value.\n *\n * @param locale - The locale to be applied.\n * @param dateTimeFormatValue - The representation value for the weekday.\n * @returns An array with all the weekday names.\n */\nexport const getWeekdayNamesList = (\n locale: string,\n dateTimeFormatValue: Intl.DateTimeFormatOptions[\"weekday\"] = \"long\"\n) => {\n const options = { weekday: dateTimeFormatValue, timeZone: \"UTC\" };\n const weekdayNames: string[] = [];\n\n for (let day = 4; day <= 10; day += 1) {\n const auxDate = makeUTCDate(1970, 0, day);\n weekdayNames.push(Intl.DateTimeFormat(locale, options).format(auxDate));\n }\n return weekdayNames;\n};\n\n/**\n * Returns the name of the month for the supplied month localized in the received locale and representation value.\n *\n * @param date - The date from which the month name is extracted.\n * @param locale - The locale to be applied to the Intl format.\n * @param representationValue - The locale to be applied to the Intl format.\n * @returns The name of the month.\n */\nexport const getMonthName = (\n date: Date,\n locale: string,\n representationValue: Intl.DateTimeFormatOptions[\"month\"] = \"long\"\n) =>\n new Intl.DateTimeFormat(locale, { month: representationValue }).format(date);\n\n/**\n * Formats the received date according to Design System specifications.\n * Currently: day month, year => `14 Aug, 2019`.\n *\n * @param date - UTC date to be formatted.\n * @param locale - The locale to be applied to the Intl format.\n * @returns The formatted date as a string.\n */\nexport const getFormattedDate = (\n // TODO: fix this\n date: any,\n locale: any,\n rep: Intl.DateTimeFormatOptions[\"month\"] = \"short\"\n) =>\n `${date.getDate()} ${getMonthName(date, locale, rep)} ${date.getFullYear()}`;\n\n/**\n * Creates an array of 42 days. The complete current month and enough days from the previous and next months to fill\n * the 42 positions.\n *\n * @param month - The number of the month (1 to 12).\n * @param year - The number of the year.\n * @returns The array of dates.\n */\nexport const createDatesArray = (month: number, year: number) => {\n // Initializes the variables needed to calculate the dates for the received month and year\n const monthDays = getMonthDays(month, year);\n const daysFromPrevMonth = getMonthFirstWeekday(month, year);\n const daysFromNextMonth =\n CALENDAR_WEEKS * 7 - (daysFromPrevMonth + monthDays);\n const prevMonthYear = getPreviousMonth(month, year);\n const nextMonthYear = getNextMonth(month, year);\n const prevMonthDays = getMonthDays(prevMonthYear.month, prevMonthYear.year);\n\n // Creates the arrays for the dates for previous, current and next months\n const prevMonthDates = [...new Array(daysFromPrevMonth)].map((n, index) => {\n const day = index + 1 + (prevMonthDays - daysFromPrevMonth);\n return new Date(prevMonthYear.year, prevMonthYear.month - 1, day);\n });\n const currentMonthDates = [...new Array(monthDays)].map((n, index) => {\n const day = index + 1;\n return new Date(year, month - 1, day);\n });\n const nextMonthDates = [...new Array(daysFromNextMonth)].map((n, index) => {\n const day = index + 1;\n return new Date(nextMonthYear.year, nextMonthYear.month - 1, day);\n });\n\n return [...prevMonthDates, ...currentMonthDates, ...nextMonthDates];\n};\n\n/**\n * Checks if the received locale is valid according to Intl.\n *\n * @param locale - The locale to be checked\n * @returns True if the locale is valid, false otherwise.\n */\nexport const isValidLocale = (locale: string) => {\n try {\n if (Intl.DateTimeFormat.supportedLocalesOf(locale).length > 0) {\n return true;\n }\n // eslint-disable-next-line no-console\n console.warn(`${locale} is not supported. Falling back to a known locale.`);\n return false;\n } catch (error) {\n if (\n error != null &&\n typeof error === \"object\" &&\n \"name\" in error &&\n error?.name === \"RangeError\"\n ) {\n // eslint-disable-next-line no-console\n console.error(`Invalid locale: ${locale}`);\n return false;\n }\n if (error != null && typeof error === \"object\" && \"message\" in error) {\n // eslint-disable-next-line no-console\n console.error(error?.message);\n return false;\n }\n\n return false;\n }\n};\n\nexport const isRange = (date): date is DateRangeProp =>\n date != null && typeof date === \"object\" && \"startDate\" in date;\n\n/**\n * Checks if the date falls within a specified date range.\n *\n * @param date - The date to be evaluated.\n * @param providedValueRange - Provided selection range.\n * @returns - True if the date falls within the range, false otherwise.\n */\nexport const dateInProvidedValueRange = (\n date: any,\n providedValueRange: any\n) => {\n const { startDate, endDate } = providedValueRange;\n\n if (!isRange(providedValueRange) || isNil(endDate)) return false;\n const localEndDate = endDate;\n\n const modStartDate = dayjs(startDate).format(\"YYYY-MM-DD\");\n const modEndDate = dayjs(localEndDate).format(\"YYYY-MM-DD\");\n\n const convertedDate = dayjs(date).format(\"YYYY-MM-DD\");\n\n return convertedDate >= modStartDate && convertedDate <= modEndDate;\n};\n\nexport const checkIfDateIsDisabled = (\n date?: string | number | Date | dayjs.Dayjs,\n minimumDate?: string | number | Date | dayjs.Dayjs,\n maximumDate?: string | number | Date | dayjs.Dayjs\n) => {\n if (!minimumDate && !maximumDate) return false;\n const modStartDate = minimumDate\n ? dayjs(minimumDate).format(\"YYYY-MM-DD\")\n : undefined;\n const modEndDate = maximumDate\n ? dayjs(maximumDate).format(\"YYYY-MM-DD\")\n : undefined;\n\n const convertedDate = dayjs(date).format(\"YYYY-MM-DD\");\n\n return (\n (modStartDate !== undefined && convertedDate < modStartDate) ||\n (modEndDate !== undefined && convertedDate > modEndDate)\n );\n};\n\nexport const formatToLocale = (date, locale) => {\n return new Intl.DateTimeFormat(locale, {\n day: \"numeric\",\n month: \"short\",\n year: \"numeric\",\n }).format(date);\n};\n"],"names":["CALENDAR_WEEKS","getMonthDays","month","year","Date","getDate","getMonthFirstWeekday","getDay","makeUTCDate","monthIndex","day","hour","UTC","isDate","date","Object","prototype","toString","call","Number","isNaN","valueOf","isDateRangeProp","isSameMonth","date1","date2","getMonth","getFullYear","isSameDay","getPreviousMonth","prevMonth","prevMonthYear","getNextMonth","nextMonth","nextMonthYear","getMonthNamesList","locale","representationValue","options","timeZone","Array","map","n","index","auxDate","capitalize","Intl","DateTimeFormat","format","getWeekdayNamesList","dateTimeFormatValue","weekday","weekdayNames","push","getMonthName","getFormattedDate","rep","createDatesArray","monthDays","daysFromPrevMonth","daysFromNextMonth","prevMonthDays","prevMonthDates","currentMonthDates","nextMonthDates","isRange","dateInProvidedValueRange","providedValueRange","startDate","endDate","isNil","localEndDate","modStartDate","dayjs","modEndDate","convertedDate","checkIfDate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;AAAA,IAAEC;AAAAA,IAAWC;AAAAA,EAAYF,IAAAA;AAE/B,MAAI,CAACF,QAAQE,kBAAkB,KAAKG,eAAAA,QAAMD,OAAO;AAAU,WAAA;AAC3D,QAAME,eAAeF;AAErB,QAAMG,eAAeC,eAAAA,QAAML,SAAS,EAAEpB,OAAO,YAAY;AACzD,QAAM0B,aAAaD,eAAAA,QAAMF,YAAY,EAAEvB,OAAO,YAAY;AAE1D,QAAM2B,gBAAgBF,eAAAA,QAAM3D,IAAI,EAAEkC,OAAO,YAAY;AAE9C2B,SAAAA,iBAAiBH,gBAAgBG,iBAAiBD;AAC3D;AAEO,MAAME,wBAAwBA,CACnC9D,MACA+D,aACAC,gBACG;AACC,MAAA,CAACD,eAAe,CAACC;AAAoB,WAAA;AACzC,QAAMN,eAAeK,cACjBJ,uBAAMI,WAAW,EAAE7B,OAAO,YAAY,IACtC+B;AACJ,QAAML,aAAaI,cACfL,uBAAMK,WAAW,EAAE9B,OAAO,YAAY,IACtC+B;AAEJ,QAAMJ,gBAAgBF,eAAAA,QAAM3D,IAAI,EAAEkC,OAAO,YAAY;AAErD,SACGwB,iBAAiBO,UAAaJ,gBAAgBH,gBAC9CE,eAAeK,UAAaJ,gBAAgBD;AAEjD;AAEaM,MAAAA,iBAAiBA,CAAClE,MAAMsB,WAAW;AACvC,SAAA,IAAIU,KAAKC,eAAeX,QAAQ;AAAA,IACrC1B,KAAK;AAAA,IACLR,OAAO;AAAA,IACPC,MAAM;AAAA,EAAA,CACP,EAAE6C,OAAOlC,IAAI;AAChB;;;;;;;;;;;;;;;;;;;;"}
@@ -1,23 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const clsx = require("clsx");
4
3
  const React = require("react");
5
4
  const react = require("@emotion/react");
6
5
  const uikitStyles = require("@hitachivantara/uikit-styles");
7
6
  const uikitReactIcons = require("@hitachivantara/uikit-react-icons");
8
- const withId = require("../../hocs/withId.cjs");
9
7
  const DropDownMenu_styles = require("./DropDownMenu.styles.cjs");
10
8
  const dropDownMenuClasses = require("./dropDownMenuClasses.cjs");
11
9
  const jsxRuntime = require("@emotion/react/jsx-runtime");
10
+ const useUniqueId = require("../../hooks/useUniqueId.cjs");
12
11
  const focusableElementFinder = require("../../utils/focusableElementFinder.cjs");
12
+ const BaseDropdown = require("../BaseDropdown/BaseDropdown.cjs");
13
+ const Panel = require("../Panel/Panel.cjs");
13
14
  const List = require("../List/List.cjs");
14
15
  const useControlled = require("../../hooks/useControlled.cjs");
15
16
  const setId = require("../../utils/setId.cjs");
16
- const focusUtils = require("../../utils/focusUtils.cjs");
17
+ const Button = require("../Button/Button.cjs");
17
18
  const keyCheck = require("../../utils/keyboardUtils/keyCheck.cjs");
18
19
  const keyboardCodes = require("../../utils/keyboardUtils/keyboardCodes.cjs");
19
20
  const HvDropDownMenu = ({
20
- id,
21
+ id: idProp,
21
22
  classes,
22
23
  className,
23
24
  icon,
@@ -34,6 +35,7 @@ const HvDropDownMenu = ({
34
35
  ...others
35
36
  }) => {
36
37
  const [open, setOpen] = useControlled.useControlled(expanded, Boolean(defaultExpanded));
38
+ const id = useUniqueId.default(idProp, "dropdown-menu");
37
39
  const focusNodes = focusableElementFinder.getPrevNextFocus(setId.setId(id, "icon-button"));
38
40
  const listId = setId.setId(id, "list");
39
41
  const handleClose = (event) => {
@@ -53,19 +55,6 @@ const HvDropDownMenu = ({
53
55
  var _a;
54
56
  (_a = containerRef == null ? void 0 : containerRef.getElementsByTagName("li")[0]) == null ? void 0 : _a.focus();
55
57
  };
56
- const headerComponent = /* @__PURE__ */ jsxRuntime.jsx(DropDownMenu_styles.StyledButton, {
57
- icon: true,
58
- variant: category,
59
- id: setId.setId(id, "icon-button"),
60
- className: clsx.clsx(dropDownMenuClasses.default.icon, classes == null ? void 0 : classes.icon, open && clsx.clsx(dropDownMenuClasses.default.iconSelected, classes == null ? void 0 : classes.iconSelected)),
61
- "aria-expanded": open,
62
- disabled,
63
- "aria-label": "Dropdown menu",
64
- $open: open,
65
- children: icon || /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.MoreOptionsVertical, {
66
- color: disabled ? "secondary_60" : void 0
67
- })
68
- });
69
58
  const condensed = React.useMemo(() => dataList.every((el) => !el.icon), [dataList]);
70
59
  const popperStyle = {
71
60
  style: {
@@ -78,21 +67,26 @@ const HvDropDownMenu = ({
78
67
  children: ({
79
68
  css,
80
69
  cx
81
- }) => /* @__PURE__ */ jsxRuntime.jsx(DropDownMenu_styles.StyledBaseDropDown, {
70
+ }) => /* @__PURE__ */ jsxRuntime.jsx(BaseDropdown.HvBaseDropdown, {
82
71
  id,
83
- className: cx(dropDownMenuClasses.default.container, className, classes == null ? void 0 : classes.container),
72
+ className: cx(dropDownMenuClasses.default.container, css(DropDownMenu_styles.styles.container), className, classes == null ? void 0 : classes.container),
84
73
  classes: {
85
- root: cx(dropDownMenuClasses.default.root, css({
86
- display: "inline-block",
87
- width: "auto",
88
- "&.focus-visible $icon": {
89
- ...focusUtils.outlineStyles
90
- }
91
- }), classes == null ? void 0 : classes.root),
74
+ root: cx(dropDownMenuClasses.default.root, css(DropDownMenu_styles.styles.root), classes == null ? void 0 : classes.root),
92
75
  container: cx(dropDownMenuClasses.default.baseContainer, classes == null ? void 0 : classes.baseContainer)
93
76
  },
94
77
  expanded: open && !disabled,
95
- component: headerComponent,
78
+ component: /* @__PURE__ */ jsxRuntime.jsx(Button.HvButton, {
79
+ icon: true,
80
+ variant: category,
81
+ id: setId.setId(id, "icon-button"),
82
+ className: cx(dropDownMenuClasses.default.icon, open && dropDownMenuClasses.default.iconSelected, css(DropDownMenu_styles.styles.icon), open && css(DropDownMenu_styles.styles.iconSelected), classes == null ? void 0 : classes.icon, open && (classes == null ? void 0 : classes.iconSelected)),
83
+ "aria-expanded": open,
84
+ disabled,
85
+ "aria-label": "Dropdown menu",
86
+ children: icon || /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.MoreOptionsVertical, {
87
+ color: disabled ? "secondary_60" : void 0
88
+ })
89
+ }),
96
90
  "aria-haspopup": "menu",
97
91
  placement,
98
92
  variableWidth: true,
@@ -105,7 +99,8 @@ const HvDropDownMenu = ({
105
99
  onContainerCreation: setFocusToContent,
106
100
  popperProps: popperStyle,
107
101
  ...others,
108
- children: /* @__PURE__ */ jsxRuntime.jsx(DropDownMenu_styles.StyledPanel, {
102
+ children: /* @__PURE__ */ jsxRuntime.jsx(Panel.HvPanel, {
103
+ className: cx(dropDownMenuClasses.default.menuListRoot, css(DropDownMenu_styles.styles.menuListRoot), classes == null ? void 0 : classes.menuListRoot),
109
104
  children: /* @__PURE__ */ jsxRuntime.jsx(List.HvList, {
110
105
  id: listId,
111
106
  values: dataList,
@@ -125,6 +120,6 @@ const HvDropDownMenu = ({
125
120
  })
126
121
  });
127
122
  };
128
- const HvDropDownMenu$1 = withId.default(HvDropDownMenu);
123
+ const HvDropDownMenu$1 = HvDropDownMenu;
129
124
  exports.default = HvDropDownMenu$1;
130
125
  //# sourceMappingURL=DropDownMenu.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"DropDownMenu.cjs","sources":["../../../../src/components/DropDownMenu/DropDownMenu.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { useMemo } from \"react\";\nimport { ClassNames } from \"@emotion/react\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\nimport { MoreOptionsVertical } from \"@hitachivantara/uikit-react-icons\";\nimport { useControlled } from \"@core/hooks\";\nimport { HvBaseProps } from \"@core/types\";\nimport withId from \"@core/hocs/withId\";\nimport {\n isKeypress,\n keyboardCodes,\n outlineStyles,\n setId,\n getPrevNextFocus,\n} from \"@core/utils\";\n\nimport {\n HvBaseDropdownProps,\n HvButtonVariant,\n HvList,\n HvListValue,\n} from \"@core/components\";\nimport {\n StyledBaseDropDown,\n StyledButton,\n StyledPanel,\n} from \"./DropDownMenu.styles\";\nimport dropDownMenuClasses, {\n HvDropDownMenuClasses,\n} from \"./dropDownMenuClasses\";\n\nexport interface HvDropDownMenuProps\n extends HvBaseProps<HTMLDivElement, \"onClick\"> {\n /** Icon. */\n icon?: React.ReactElement;\n /**\n * A list containing the elements to be rendered.\n *\n * - label: The label of the element to be rendered.\n * - selected: The selection state of the element.\n * - disabled: The disabled state of the element.\n * - icon: The icon node to be rendered on the left.\n * - showNavIcon: If true renders the navigation icon on the right.\n */\n dataList: HvListValue[];\n /** Placement of the dropdown. */\n placement?: \"left\" | \"right\";\n /** Disable the portal behavior. The children stay within it's parent DOM hierarchy. */\n disablePortal?: boolean;\n /** Function executed on toggle of the dropdown. Should receive the open status. */\n onToggle?: (event: Event, open: boolean) => void;\n /** Function executed in each onClick. Should received the clicked element. */\n onClick?: (\n event: React.ChangeEvent<HTMLLIElement>,\n value: HvListValue\n ) => void;\n /** Keep the Dropdown Menu opened after clicking one option */\n keepOpened?: boolean;\n /** Defines if the component is disabled. */\n disabled?: boolean;\n /** If true it should be displayed open. */\n expanded?: boolean;\n /** When uncontrolled, defines the initial expanded state. */\n defaultExpanded?: boolean;\n /** The variant to be used in the header. */\n category?: HvButtonVariant;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvDropDownMenuClasses;\n}\n\n/**\n * A drop-down menu is a graphical control element, similar to a list box, that allows the user to choose a value from a list.\n */\nconst HvDropDownMenu = ({\n id,\n classes,\n className,\n icon,\n placement = \"right\",\n dataList,\n disablePortal = false,\n onToggle,\n onClick,\n keepOpened = true,\n disabled = false,\n expanded,\n defaultExpanded = false,\n category = \"secondaryGhost\",\n ...others\n}: HvDropDownMenuProps) => {\n const [open, setOpen] = useControlled(expanded, Boolean(defaultExpanded));\n const focusNodes = getPrevNextFocus(setId(id, \"icon-button\"));\n\n const listId = setId(id, \"list\");\n\n const handleClose = (event) => {\n // this will only run if uncontrolled\n setOpen(false);\n onToggle?.(event, false);\n };\n\n // If the ESCAPE key is pressed inside the list, the close handler must be called.\n const handleKeyDown = (event) => {\n if (isKeypress(event, keyboardCodes.Tab)) {\n const node = event.shiftKey ? focusNodes.prevFocus : focusNodes.nextFocus;\n if (node) setTimeout(() => node.focus(), 0);\n handleClose(event);\n }\n event.preventDefault();\n };\n\n const setFocusToContent = (containerRef) => {\n containerRef?.getElementsByTagName(\"li\")[0]?.focus();\n };\n\n const headerComponent = (\n <StyledButton\n icon\n variant={category}\n id={setId(id, \"icon-button\")}\n className={clsx(\n dropDownMenuClasses.icon,\n classes?.icon,\n open && clsx(dropDownMenuClasses.iconSelected, classes?.iconSelected)\n )}\n aria-expanded={open}\n disabled={disabled}\n aria-label=\"Dropdown menu\"\n $open={open}\n >\n {icon || (\n <MoreOptionsVertical color={disabled ? \"secondary_60\" : undefined} />\n )}\n </StyledButton>\n );\n\n const condensed = useMemo(() => dataList.every((el) => !el.icon), [dataList]);\n const popperStyle: HvBaseDropdownProps[\"popperProps\"] = {\n style: {\n zIndex: theme.zIndices.tooltip,\n width: \"auto\",\n position: \"relative\",\n },\n };\n\n return (\n <ClassNames>\n {({ css, cx }) => (\n <StyledBaseDropDown\n id={id}\n className={cx(\n dropDownMenuClasses.container,\n className,\n classes?.container\n )}\n classes={{\n root: cx(\n dropDownMenuClasses.root,\n css({\n display: \"inline-block\",\n width: \"auto\",\n \"&.focus-visible $icon\": {\n ...outlineStyles,\n },\n }),\n classes?.root\n ),\n container: cx(\n dropDownMenuClasses.baseContainer,\n classes?.baseContainer\n ),\n }}\n expanded={open && !disabled}\n component={headerComponent}\n aria-haspopup=\"menu\"\n placement={placement}\n variableWidth\n disablePortal={disablePortal}\n onToggle={(e, s) => {\n // this will only run if uncontrolled\n setOpen(s);\n onToggle?.(e, s);\n }}\n disabled={disabled}\n onContainerCreation={setFocusToContent}\n popperProps={popperStyle}\n {...others}\n >\n <StyledPanel>\n <HvList\n id={listId}\n values={dataList}\n selectable={false}\n condensed={condensed}\n onClick={(event, item) => {\n if (!keepOpened) handleClose(event);\n onClick?.(event, item);\n }}\n onKeyDown={handleKeyDown}\n classes={{\n root: cx(dropDownMenuClasses.menuList, classes?.menuList),\n }}\n />\n </StyledPanel>\n </StyledBaseDropDown>\n )}\n </ClassNames>\n );\n};\n\nexport default withId(HvDropDownMenu);\n"],"names":["HvDropDownMenu","id","classes","className","icon","placement","dataList","disablePortal","onToggle","onClick","keepOpened","disabled","expanded","defaultExpanded","category","others","open","setOpen","useControlled","Boolean","focusNodes","getPrevNextFocus","setId","listId","handleClose","event","handleKeyDown","isKeypress","keyboardCodes","Tab","node","shiftKey","prevFocus","nextFocus","setTimeout","focus","preventDefault","setFocusToContent","containerRef","getElementsByTagName","headerComponent","StyledButton","variant","clsx","dropDownMenuClasses","iconSelected","$open","children","_jsx","MoreOptionsVertical","color","undefined","condensed","useMemo","every","el","popperStyle","style","zIndex","theme","zIndices","tooltip","width","position","ClassNames","css","cx","StyledBaseDropDown","container","root","display","outlineStyles","baseContainer","component","variableWidth","e","s","onContainerCreation","popperProps","StyledPanel","HvList","values","selectable","item","onKeyDown","menuList","withId"],"mappings":";;;;;;;;;;;;;;;;;;AAyEA,MAAMA,iBAAiBA,CAAC;AAAA,EACtBC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,YAAY;AAAA,EACZC;AAAAA,EACAC,gBAAgB;AAAA,EAChBC;AAAAA,EACAC;AAAAA,EACAC,aAAa;AAAA,EACbC,WAAW;AAAA,EACXC;AAAAA,EACAC,kBAAkB;AAAA,EAClBC,WAAW;AAAA,EACX,GAAGC;AACgB,MAAM;AACnB,QAAA,CAACC,MAAMC,OAAO,IAAIC,cAAAA,cAAcN,UAAUO,QAAQN,eAAe,CAAC;AACxE,QAAMO,aAAaC,uBAAAA,iBAAiBC,MAAAA,MAAMrB,IAAI,aAAa,CAAC;AAEtDsB,QAAAA,SAASD,MAAAA,MAAMrB,IAAI,MAAM;AAE/B,QAAMuB,cAAeC,CAAU,UAAA;AAE7BR,YAAQ,KAAK;AACbT,yCAAWiB,OAAO;AAAA,EAAK;AAIzB,QAAMC,gBAAiBD,CAA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/DropDownMenu.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport { ClassNames } from \"@emotion/react\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\nimport { MoreOptionsVertical } from \"@hitachivantara/uikit-react-icons\";\nimport { useControlled, useUniqueId } from \"@core/hooks\";\nimport { HvBaseProps } from \"@core/types\";\nimport {\n isKeypress,\n keyboardCodes,\n setId,\n getPrevNextFocus,\n} from \"@core/utils\";\nimport {\n HvBaseDropdown,\n HvBaseDropdownProps,\n HvButton,\n HvButtonVariant,\n HvList,\n HvListValue,\n HvPanel,\n} from \"@core/components\";\nimport { styles } from \"./DropDownMenu.styles\";\nimport dropDownMenuClasses, {\n HvDropDownMenuClasses,\n} from \"./dropDownMenuClasses\";\n\nexport interface HvDropDownMenuProps\n extends HvBaseProps<HTMLDivElement, \"onClick\"> {\n /** Icon. */\n icon?: React.ReactElement;\n /**\n * A list containing the elements to be rendered.\n *\n * - label: The label of the element to be rendered.\n * - selected: The selection state of the element.\n * - disabled: The disabled state of the element.\n * - icon: The icon node to be rendered on the left.\n * - showNavIcon: If true renders the navigation icon on the right.\n */\n dataList: HvListValue[];\n /** Placement of the dropdown. */\n placement?: \"left\" | \"right\";\n /** Disable the portal behavior. The children stay within it's parent DOM hierarchy. */\n disablePortal?: boolean;\n /** Function executed on toggle of the dropdown. Should receive the open status. */\n onToggle?: (event: Event, open: boolean) => void;\n /** Function executed in each onClick. Should received the clicked element. */\n onClick?: (\n event: React.ChangeEvent<HTMLLIElement>,\n value: HvListValue\n ) => void;\n /** Keep the Dropdown Menu opened after clicking one option */\n keepOpened?: boolean;\n /** Defines if the component is disabled. */\n disabled?: boolean;\n /** If true it should be displayed open. */\n expanded?: boolean;\n /** When uncontrolled, defines the initial expanded state. */\n defaultExpanded?: boolean;\n /** The variant to be used in the header. */\n category?: HvButtonVariant;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvDropDownMenuClasses;\n}\n\n/**\n * A drop-down menu is a graphical control element, similar to a list box, that allows the user to choose a value from a list.\n */\nconst HvDropDownMenu = ({\n id: idProp,\n classes,\n className,\n icon,\n placement = \"right\",\n dataList,\n disablePortal = false,\n onToggle,\n onClick,\n keepOpened = true,\n disabled = false,\n expanded,\n defaultExpanded = false,\n category = \"secondaryGhost\",\n ...others\n}: HvDropDownMenuProps) => {\n const [open, setOpen] = useControlled(expanded, Boolean(defaultExpanded));\n const id = useUniqueId(idProp, \"dropdown-menu\");\n const focusNodes = getPrevNextFocus(setId(id, \"icon-button\"));\n\n const listId = setId(id, \"list\");\n\n const handleClose = (event) => {\n // this will only run if uncontrolled\n setOpen(false);\n onToggle?.(event, false);\n };\n\n // If the ESCAPE key is pressed inside the list, the close handler must be called.\n const handleKeyDown = (event) => {\n if (isKeypress(event, keyboardCodes.Tab)) {\n const node = event.shiftKey ? focusNodes.prevFocus : focusNodes.nextFocus;\n if (node) setTimeout(() => node.focus(), 0);\n handleClose(event);\n }\n event.preventDefault();\n };\n\n const setFocusToContent = (containerRef) => {\n containerRef?.getElementsByTagName(\"li\")[0]?.focus();\n };\n\n const condensed = useMemo(() => dataList.every((el) => !el.icon), [dataList]);\n const popperStyle: HvBaseDropdownProps[\"popperProps\"] = {\n style: {\n zIndex: theme.zIndices.tooltip,\n width: \"auto\",\n position: \"relative\",\n },\n };\n\n return (\n <ClassNames>\n {({ css, cx }) => (\n <HvBaseDropdown\n id={id}\n className={cx(\n dropDownMenuClasses.container,\n css(styles.container),\n className,\n classes?.container\n )}\n classes={{\n root: cx(dropDownMenuClasses.root, css(styles.root), classes?.root),\n container: cx(\n dropDownMenuClasses.baseContainer,\n classes?.baseContainer\n ),\n }}\n expanded={open && !disabled}\n component={\n <HvButton\n icon\n variant={category}\n id={setId(id, \"icon-button\")}\n className={cx(\n dropDownMenuClasses.icon,\n open && dropDownMenuClasses.iconSelected,\n css(styles.icon),\n open && css(styles.iconSelected),\n classes?.icon,\n open && classes?.iconSelected\n )}\n aria-expanded={open}\n disabled={disabled}\n aria-label=\"Dropdown menu\"\n >\n {icon || (\n <MoreOptionsVertical\n color={disabled ? \"secondary_60\" : undefined}\n />\n )}\n </HvButton>\n }\n aria-haspopup=\"menu\"\n placement={placement}\n variableWidth\n disablePortal={disablePortal}\n onToggle={(e, s) => {\n // this will only run if uncontrolled\n setOpen(s);\n onToggle?.(e, s);\n }}\n disabled={disabled}\n onContainerCreation={setFocusToContent}\n popperProps={popperStyle}\n {...others}\n >\n <HvPanel\n className={cx(\n dropDownMenuClasses.menuListRoot,\n css(styles.menuListRoot),\n classes?.menuListRoot\n )}\n >\n <HvList\n id={listId}\n values={dataList}\n selectable={false}\n condensed={condensed}\n onClick={(event, item) => {\n if (!keepOpened) handleClose(event);\n onClick?.(event, item);\n }}\n onKeyDown={handleKeyDown}\n classes={{\n root: cx(dropDownMenuClasses.menuList, classes?.menuList),\n }}\n />\n </HvPanel>\n </HvBaseDropdown>\n )}\n </ClassNames>\n );\n};\n\nexport default HvDropDownMenu;\n"],"names":["HvDropDownMenu","id","idProp","classes","className","icon","placement","dataList","disablePortal","onToggle","onClick","keepOpened","disabled","expanded","defaultExpanded","category","others","open","setOpen","useControlled","Boolean","useUniqueId","focusNodes","getPrevNextFocus","setId","listId","handleClose","event","handleKeyDown","isKeypress","keyboardCodes","Tab","node","shiftKey","prevFocus","nextFocus","setTimeout","focus","preventDefault","setFocusToContent","containerRef","getElementsByTagName","condensed","useMemo","every","el","popperStyle","style","zIndex","theme","zIndices","tooltip","width","position","ClassNames","children","css","cx","HvBaseDropdown","dropDownMenuClasses","container","styles","root","baseContainer","component","HvButton","variant","iconSelected","_jsx","MoreOptionsVertical","color","undefined","variableWidth","e","s","onContainerCreation","popperProps","HvPanel","menuListRoot","HvList","values","selectable","item","onKeyDown","menuList"],"mappings":";;;;;;;;;;;;;;;;;;;AAoEA,MAAMA,iBAAiBA,CAAC;AAAA,EACtBC,IAAIC;AAAAA,EACJC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,YAAY;AAAA,EACZC;AAA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A,OAAOiB,YAAY,GACvB3E,mCAAS2E,YAAY;AAAA,QACrBvB,yCAEDwB,aAAM;AAAA,UACL9E,IAAIwB;AAAAA,UACJuD,QAAQzE;AAAAA,UACR0E,YAAY;AAAA,UACZvC;AAAAA,UACAhC,SAASA,CAACiB,OAAOuD,SAAS;AACxB,gBAAI,CAACvE;AAAYe,0BAAYC,KAAK;AAClCjB,+CAAUiB,OAAOuD;AAAAA,UACnB;AAAA,UACAC,WAAWvD;AAAAA,UACXzB,SAAS;AAAA,YACP2D,MAAML,GAAGE,oBAAAA,QAAoByB,UAAUjF,mCAASiF,QAAQ;AAAA,UAC1D;AAAA,QAAA,CAAE;AAAA,MAAA,CACF;AAAA,IAAA,CACM;AAAA,EAAA,CAGH;AAEjB;AAEA,MAAA,mBAAepF;;"}
@@ -1,67 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const _styled = require("@emotion/styled/base");
4
- const transientOptions = require("../../utils/transientOptions.cjs");
5
3
  const uikitStyles = require("@hitachivantara/uikit-styles");
6
- const React = require("react");
7
- const jsxRuntime = require("@emotion/react/jsx-runtime");
8
- const BaseDropdown = require("../BaseDropdown/BaseDropdown.cjs");
9
- const Panel = require("../Panel/Panel.cjs");
10
- const Button = require("../Button/Button.cjs");
11
- const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
12
- const _styled__default = /* @__PURE__ */ _interopDefault(_styled);
13
- function _EMOTION_STRINGIFIED_CSS_ERROR__() {
14
- return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).";
15
- }
16
- function _extends() {
17
- _extends = Object.assign ? Object.assign.bind() : function(target) {
18
- for (var i = 1; i < arguments.length; i++) {
19
- var source = arguments[i];
20
- for (var key in source) {
21
- if (Object.prototype.hasOwnProperty.call(source, key)) {
22
- target[key] = source[key];
23
- }
24
- }
4
+ const dropDownMenuClasses = require("./dropDownMenuClasses.cjs");
5
+ const focusUtils = require("../../utils/focusUtils.cjs");
6
+ const styles = {
7
+ container: {
8
+ width: 32
9
+ },
10
+ root: {
11
+ display: "inline-block",
12
+ width: "auto",
13
+ [`&.focus-visible .${dropDownMenuClasses.default.icon}`]: {
14
+ ...focusUtils.outlineStyles
25
15
  }
26
- return target;
27
- };
28
- return _extends.apply(this, arguments);
29
- }
30
- const StyledBaseDropDown = /* @__PURE__ */ _styled__default.default((props) => /* @__PURE__ */ jsxRuntime.jsx(BaseDropdown.HvBaseDropdown, {
31
- ...props
32
- }), process.env.NODE_ENV === "production" ? {
33
- target: "e13q7myz2"
34
- } : {
35
- target: "e13q7myz2",
36
- label: "StyledBaseDropDown"
37
- })(process.env.NODE_ENV === "production" ? {
38
- name: "1p2i2oq",
39
- styles: "width:32px"
40
- } : {
41
- name: "1p2i2oq",
42
- styles: "width:32px",
43
- map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9ob21lL3J1bm5lci93b3JrL2h2LXVpa2l0LXJlYWN0L2h2LXVpa2l0LXJlYWN0L3BhY2thZ2VzL2NvcmUvc3JjL2NvbXBvbmVudHMvRHJvcERvd25NZW51L0Ryb3BEb3duTWVudS5zdHlsZXMudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWNrQyIsImZpbGUiOiIvaG9tZS9ydW5uZXIvd29yay9odi11aWtpdC1yZWFjdC9odi11aWtpdC1yZWFjdC9wYWNrYWdlcy9jb3JlL3NyYy9jb21wb25lbnRzL0Ryb3BEb3duTWVudS9Ecm9wRG93bk1lbnUuc3R5bGVzLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBzdHlsZWQgZnJvbSBcIkBlbW90aW9uL3N0eWxlZFwiO1xuaW1wb3J0IHtcbiAgSHZCYXNlRHJvcGRvd24sXG4gIEh2QmFzZURyb3Bkb3duUHJvcHMsXG4gIEh2QnV0dG9uL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2xvc2VkLFxuXG4gIC4uLigkb3BlbiAmJiB7XG4gICAgYmFja2dyb3VuZENvbG9yOiB0aGVtZS5jb2xvcnMuYXRtbzEsXG4gICAgYm94U2hhZG93OiB0aGVtZS5jb2xvcnMuc2hhZG93LFxuXG4gICAgXCImOmhvdmVyXCI6IHtcbiAgICAgIGJhY2tncm91bmRDb2xvcjogdGhlbWUuY29sb3JzLmF0bW8xLFxuICAgIH0sXG5cbiAgICBcIiYgc3ZnIC5jb2xvcjBcIjoge1xuICAgICAgZmlsbDogdGhlbWUuY29sb3JzLnNlY29uZGFyeSxcbiAgICB9LFxuXG4gICAgYm9yZGVyUmFkaXVzOiBgJHt0aGVtZS5yYWRpaS5iYXNlfSAke3RoZW1lLnJhZGlpLmJhc2V9IDBweCAwcHhgLFxuICAgIGJvcmRlcjogdGhlbWUuZHJvcERvd25NZW51LmJvcmRlck9wZW5lZCxcbiAgfSksXG59KSk7XG5cbmV4cG9ydCBjb25zdCBTdHlsZWRQYW5lbCA9IHN0eWxlZCgocHJvcHM6IEh2UGFuZWxQcm9wcykgPT4gKFxuICA8SHZQYW5lbCB7Li4ucHJvcHN9IC8+XG4pKSh7XG4gIGJvcmRlcjogdGhlbWUuZHJvcERvd25NZW51LmJvcmRlck9wZW5lZCxcbiAgYm9yZGVyUmFkaXVzOiB0aGVtZS5kcm9wRG93bk1lbnUuYm9yZGVyUmFkaXVzLFxufSk7XG4iXX0= */",
44
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
45
- });
46
- const StyledButton = /* @__PURE__ */ _styled__default.default(React.forwardRef((props, ref) => {
47
- return /* @__PURE__ */ jsxRuntime.jsx(Button.HvButton, {
48
- ...props,
49
- ref
50
- });
51
- }), process.env.NODE_ENV === "production" ? _extends({}, {
52
- target: "e13q7myz1"
53
- }, transientOptions.transientOptions) : _extends({}, {
54
- target: "e13q7myz1",
55
- label: "StyledButton"
56
- }, transientOptions.transientOptions))(({
57
- $open
58
- }) => ({
59
- position: "relative",
60
- boxSizing: "content-box",
61
- padding: 0,
62
- borderRadius: uikitStyles.theme.dropDownMenu.borderRadius,
63
- border: uikitStyles.theme.dropDownMenu.borderClosed,
64
- ...$open && {
16
+ },
17
+ icon: {
18
+ position: "relative",
19
+ width: 32,
20
+ boxSizing: "border-box",
21
+ padding: 0,
22
+ borderRadius: uikitStyles.theme.dropDownMenu.borderRadius,
23
+ border: uikitStyles.theme.dropDownMenu.borderClosed
24
+ },
25
+ iconSelected: {
65
26
  backgroundColor: uikitStyles.theme.colors.atmo1,
66
27
  boxShadow: uikitStyles.theme.colors.shadow,
67
28
  "&:hover": {
@@ -72,20 +33,11 @@ const StyledButton = /* @__PURE__ */ _styled__default.default(React.forwardRef((
72
33
  },
73
34
  borderRadius: `${uikitStyles.theme.radii.base} ${uikitStyles.theme.radii.base} 0px 0px`,
74
35
  border: uikitStyles.theme.dropDownMenu.borderOpened
36
+ },
37
+ menuListRoot: {
38
+ border: uikitStyles.theme.dropDownMenu.borderOpened,
39
+ borderRadius: uikitStyles.theme.dropDownMenu.borderRadius
75
40
  }
76
- }), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9ob21lL3J1bm5lci93b3JrL2h2LXVpa2l0LXJlYWN0L2h2LXVpa2l0LXJlYWN0L3BhY2thZ2VzL2NvcmUvc3JjL2NvbXBvbmVudHMvRHJvcERvd25NZW51L0Ryb3BEb3duTWVudS5zdHlsZXMudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQW9CNEIiLCJmaWxlIjoiL2hvbWUvcnVubmVyL3dvcmsvaHYtdWlraXQtcmVhY3QvaHYtdWlraXQtcmVhY3QvcGFja2FnZXMvY29yZS9zcmMvY29tcG9uZW50cy9Ecm9wRG93bk1lbnUvRHJvcERvd25NZW51LnN0eWxlcy50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgc3R5bGVkIGZyb20gX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blxuICBib3JkZXJSYWRpdXM6IHRoZW1lLmRyb3BEb3duTWVudS5ib3JkZXJSYWRpdXMsXG4gIGJvcmRlcjogdGhlbWUuZHJvcERvd25NZW51LmJvcmRlckNsb3NlZCxcblxuICAuLi4oJG9wZW4gJiYge1xuICAgIGJhY2tncm91bmRDb2xvcjogdGhlbWUuY29sb3JzLmF0bW8xLFxuICAgIGJveFNoYWRvdzogdGhlbWUuY29sb3JzLnNoYWRvdyxcblxuICAgIFwiJjpob3ZlclwiOiB7XG4gICAgICBiYWNrZ3JvdW5kQ29sb3I6IHRoZW1lLmNvbG9ycy5hdG1vMSxcbiAgICB9LFxuXG4gICAgXCImIHN2ZyAuY29sb3IwXCI6IHtcbiAgICAgIGZpbGw6IHRoZW1lLmNvbG9ycy5zZWNvbmRhcnksXG4gICAgfSxcblxuICAgIGJvcmRlclJhZGl1czogYCR7dGhlbWUucmFkaWkuYmFzZX0gJHt0aGVtZS5yYWRpaS5iYXNlfSAwcHggMHB4YCxcbiAgICBib3JkZXI6IHRoZW1lLmRyb3BEb3duTWVudS5ib3JkZXJPcGVuZWQsXG4gIH0pLFxufSkpO1xuXG5leHBvcnQgY29uc3QgU3R5bGVkUGFuZWwgPSBzdHlsZWQoKHByb3BzOiBIdlBhbmVsUHJvcHMpID0+IChcbiAgPEh2UGFuZWwgey4uLnByb3BzfSAvPlxuKSkoe1xuICBib3JkZXI6IHRoZW1lLmRyb3BEb3duTWVudS5ib3JkZXJPcGVuZWQsXG4gIGJvcmRlclJhZGl1czogdGhlbWUuZHJvcERvd25NZW51LmJvcmRlclJhZGl1cyxcbn0pO1xuIl19 */");
77
- const StyledPanel = /* @__PURE__ */ _styled__default.default((props) => /* @__PURE__ */ jsxRuntime.jsx(Panel.HvPanel, {
78
- ...props
79
- }), process.env.NODE_ENV === "production" ? {
80
- target: "e13q7myz0"
81
- } : {
82
- target: "e13q7myz0",
83
- label: "StyledPanel"
84
- })({
85
- border: uikitStyles.theme.dropDownMenu.borderOpened,
86
- borderRadius: uikitStyles.theme.dropDownMenu.borderRadius
87
- }, process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9ob21lL3J1bm5lci93b3JrL2h2LXVpa2l0LXJlYWN0L2h2LXVpa2l0LXJlYWN0L3BhY2thZ2VzL2NvcmUvc3JjL2NvbXBvbmVudHMvRHJvcERvd25NZW51L0Ryb3BEb3duTWVudS5zdHlsZXMudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWtEMkIiLCJmaWxlIjoiL2hvbWUvcnVubmVyL3dvcmsvaHYtdWlraXQtcmVhY3QvaHYtdWlraXQtcmVhY3QvcGFja2FnZXMvY29yZS9zcmMvY29tcG9uZW50cy9Ecm9wRG93bk1lbnUvRHJvcERvd25NZW51LnN0eWxlcy50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgc3R5bGVkIGZyb20gXCJAZW1vdGlvbi9zdHlsZWRcIjtcbmltcG9ydCB7XG4gIEh2QmFzZURyb3Bkb3duLFxuICBIdkJhc2VEcm9wZG93blByb3BzLFxuICBIdkJ1dHRvbixcbiAgSHZCdXR0b25Qcm9wcyxcbiAgSHZQYW5lbCxcbiAgSHZQYW5lbFByb3BzLFxufSBmcm9tIFwiQGNvcmUvY29tcG9uZW50c1wiO1xuaW1wb3J0IHsgdHJhbnNpZW50T3B0aW9ucyB9IGZyb20gXCJAY29yZS91dGlscy90cmFuc2llbnRPcHRpb25zXCI7XG5pbXBvcnQgeyB0aGVtZSB9IGZyb20gXCJAaGl0YWNoaXZhbnRhcmEvdWlraXQtc3R5bGVzXCI7XG5pbXBvcnQgeyBmb3J3YXJkUmVmIH0gZnJvbSBcInJlYWN0XCI7XG5pbXBvcnQgeyBQb2x5bW9ycGhpY1JlZiB9IGZyb20gXCJAY29yZS90eXBlc1wiO1xuXG5leHBvcnQgY29uc3QgU3R5bGVkQmFzZURyb3BEb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gICBib3JkZXI6IHRoZW1lLmRyb3BEb3duTWVudS5ib3JkZXJPcGVuZWQsXG4gIH0pLFxufSkpO1xuXG5leHBvcnQgY29uc3QgU3R5bGVkUGFuZWwgPSBzdHlsZWQoKHByb3BzOiBIdlBhbmVsUHJvcHMpID0+IChcbiAgPEh2UGFuZWwgey4uLnByb3BzfSAvPlxuKSkoe1xuICBib3JkZXI6IHRoZW1lLmRyb3BEb3duTWVudS5ib3JkZXJPcGVuZWQsXG4gIGJvcmRlclJhZGl1czogdGhlbWUuZHJvcERvd25NZW51LmJvcmRlclJhZGl1cyxcbn0pO1xuIl19 */");
88
- exports.StyledBaseDropDown = StyledBaseDropDown;
89
- exports.StyledButton = StyledButton;
90
- exports.StyledPanel = StyledPanel;
41
+ };
42
+ exports.styles = styles;
91
43
  //# sourceMappingURL=DropDownMenu.styles.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"DropDownMenu.styles.cjs","sources":["../../../../src/components/DropDownMenu/DropDownMenu.styles.tsx"],"sourcesContent":["import styled from \"@emotion/styled\";\nimport {\n HvBaseDropdown,\n HvBaseDropdownProps,\n HvButton,\n HvButtonProps,\n HvPanel,\n HvPanelProps,\n} from \"@core/components\";\nimport { transientOptions } from \"@core/utils/transientOptions\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\nimport { forwardRef } from \"react\";\nimport { PolymorphicRef } from \"@core/types\";\n\nexport const StyledBaseDropDown = styled((props: HvBaseDropdownProps) => (\n <HvBaseDropdown {...props} />\n))({\n width: 32,\n});\n\nexport const StyledButton = styled(\n forwardRef((props: HvButtonProps, ref?: PolymorphicRef<\"button\">) => {\n return <HvButton {...props} ref={ref} />;\n }),\n transientOptions\n)(({ $open }: { $open: boolean }) => ({\n position: \"relative\",\n boxSizing: \"content-box\",\n padding: 0,\n\n borderRadius: theme.dropDownMenu.borderRadius,\n border: theme.dropDownMenu.borderClosed,\n\n ...($open && {\n backgroundColor: theme.colors.atmo1,\n boxShadow: theme.colors.shadow,\n\n \"&:hover\": {\n backgroundColor: theme.colors.atmo1,\n },\n\n \"& svg .color0\": {\n fill: theme.colors.secondary,\n },\n\n borderRadius: `${theme.radii.base} ${theme.radii.base} 0px 0px`,\n border: theme.dropDownMenu.borderOpened,\n }),\n}));\n\nexport const StyledPanel = styled((props: HvPanelProps) => (\n <HvPanel {...props} />\n))({\n border: theme.dropDownMenu.borderOpened,\n borderRadius: theme.dropDownMenu.borderRadius,\n});\n"],"names":["StyledBaseDropDown","_styled","props","HvBaseDropdown","process","env","NODE_ENV","target","label","name","styles","map","toString","_EMOTION_STRINGIFIED_CSS_ERROR__","StyledButton","forwardRef","ref","HvButton","_extends","transientOptions","$open","position","boxSizing","padding","borderRadius","theme","dropDownMenu","border","borderClosed","backgroundColor","colors","atmo1","boxShadow","shadow","fill","secondary","radii","base","borderOpened","StyledPanel","HvPanel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcO,MAAMA,qBAAqBC,iCAAAA,QAAO,CAACC,yCACvCC,aAAAA,gBAAc;AAAA,EAAA,GAAKD;AAAK,CAAA,GAC1BE,QAAAC,IAAAC,aAAA,eAAA;AAAA,EAAAC,QAAA;AAAA,IAAA;AAAA,EAAAA,QAAA;AAAA,EAAAC,OAAA;AAAA,CAAA,EAACJ,QAAAC,IAAAC,aAAA,eAAA;AAAA,EAAAG,MAAA;AAAA,EAAAC,QAAA;AAAA,IAAA;AAAA,EAAAD,MAAA;AAAA,EAAAC,QAAA;AAAA,EAAAC,KAAA;AAAA,EAAAC,UAAAC;AAAA,CAEA;AAEK,MAAMC,eAAeb,iCAAAA,QAC1Bc,MAAAA,WAAW,CAACb,OAAsBc,QAAmC;AACnE,wCAAQC,OAAAA,UAAQ;AAAA,IAAA,GAAKf;AAAAA,IAAOc;AAAAA,EAAAA,CAAY;AAC1C,CAAC,GAACZ,QAAAC,IAAAC,4BAAAY,SAAA,IAAA;AAAA,EAAAX,QAAA;AAAA,GACFY,iBAAgB,gBAAA,IAAAD,SAAA,IAAA;AAAA,EAAAX,QAAA;AAAA,EAAAC,OAAA;AAAA,GAAhBW,iBAAAA,gBAAgB,CACjB,EAAC,CAAC;AAAA,EAAEC;AAA0B,OAAO;AAAA,EACpCC,UAAU;AAAA,EACVC,WAAW;AAAA,EACXC,SAAS;AAAA,EAETC,cAAcC,YAAAA,MAAMC,aAAaF;AAAAA,EACjCG,QAAQF,YAAAA,MAAMC,aAAaE;AAAAA,EAE3B,GAAIR,SAAS;AAAA,IACXS,iBAAiBJ,YAAAA,MAAMK,OAAOC;AAAAA,IAC9BC,WAAWP,YAAAA,MAAMK,OAAOG;AAAAA,IAExB,WAAW;AAAA,MACTJ,iBAAiBJ,YAAAA,MAAMK,OAAOC;AAAAA,IAChC;AAAA,IAEA,iBAAiB;AAAA,MACfG,MAAMT,YAAAA,MAAMK,OAAOK;AAAAA,IACrB;AAAA,IAEAX,cAAe,GAAEC,YAAAA,MAAMW,MAAMC,QAAQZ,kBAAMW,MAAMC;AAAAA,IACjDV,QAAQF,YAAAA,MAAMC,aAAaY;AAAAA,EAC7B;AACF,IAAElC,QAAAC,IAAAC,aAAC,eAAA,KAAA,i8EAAA;AAEI,MAAMiC,cAActC,iCAAAA,QAAO,CAACC,yCAChCsC,MAAAA,SAAO;AAAA,EAAA,GAAKtC;AAAK,CAAA,GACnBE,QAAAC,IAAAC,aAAA,eAAA;AAAA,EAAAC,QAAA;AAAA,IAAA;AAAA,EAAAA,QAAA;AAAA,EAAAC,OAAA;AAAA,CAAA,EAAE;AAAA,EACDmB,QAAQF,YAAAA,MAAMC,aAAaY;AAAAA,EAC3Bd,cAAcC,YAAAA,MAAMC,aAAaF;AACnC,GAACpB,QAAAC,IAAAC,aAAC,eAAA,KAAA,i8EAAA;;;;"}
1
+ {"version":3,"file":"DropDownMenu.styles.cjs","sources":["../../../../src/components/DropDownMenu/DropDownMenu.styles.tsx"],"sourcesContent":["import { theme } from \"@hitachivantara/uikit-styles\";\nimport { outlineStyles } from \"@core/utils\";\nimport { CSSInterpolation } from \"@emotion/serialize\";\nimport dropDownMenuClasses, {\n HvDropDownMenuClasses,\n} from \"./dropDownMenuClasses\";\n\nexport const styles: Partial<\n Record<keyof HvDropDownMenuClasses, CSSInterpolation>\n> = {\n container: {\n width: 32,\n },\n root: {\n display: \"inline-block\",\n width: \"auto\",\n [`&.focus-visible .${dropDownMenuClasses.icon}`]: {\n ...outlineStyles,\n },\n },\n icon: {\n position: \"relative\",\n width: 32,\n boxSizing: \"border-box\",\n padding: 0,\n borderRadius: theme.dropDownMenu.borderRadius,\n border: theme.dropDownMenu.borderClosed,\n },\n iconSelected: {\n backgroundColor: theme.colors.atmo1,\n boxShadow: theme.colors.shadow,\n\n \"&:hover\": {\n backgroundColor: theme.colors.atmo1,\n },\n\n \"& svg .color0\": {\n fill: theme.colors.secondary,\n },\n\n borderRadius: `${theme.radii.base} ${theme.radii.base} 0px 0px`,\n border: theme.dropDownMenu.borderOpened,\n },\n menuListRoot: {\n border: theme.dropDownMenu.borderOpened,\n borderRadius: theme.dropDownMenu.borderRadius,\n },\n};\n"],"names":["styles","container","width","root","display","dropDownMenuClasses","icon","outlineStyles","position","boxSizing","padding","borderRadius","theme","dropDownMenu","border","borderClosed","iconSelected","backgroundColor","colors","atmo1","boxShadow","shadow","fill","secondary","radii","base","borderOpened","menuListRoot"],"mappings":";;;;;AAOO,MAAMA,SAET;AAAA,EACFC,WAAW;AAAA,IACTC,OAAO;AAAA,EACT;AAAA,EACAC,MAAM;AAAA,IACJC,SAAS;AAAA,IACTF,OAAO;AAAA,IACP,CAAE,oBAAmBG,4BAAoBC,MAAM,GAAG;AAAA,MAChD,GAAGC,WAAAA;AAAAA,IACL;AAAA,EACF;AAAA,EACAD,MAAM;AAAA,IACJE,UAAU;AAAA,IACVN,OAAO;AAAA,IACPO,WAAW;AAAA,IACXC,SAAS;AAAA,IACTC,cAAcC,YAAAA,MAAMC,aAAaF;AAAAA,IACjCG,QAAQF,YAAAA,MAAMC,aAAaE;AAAAA,EAC7B;AAAA,EACAC,cAAc;AAAA,IACZC,iBAAiBL,YAAAA,MAAMM,OAAOC;AAAAA,IAC9BC,WAAWR,YAAAA,MAAMM,OAAOG;AAAAA,IAExB,WAAW;AAAA,MACTJ,iBAAiBL,YAAAA,MAAMM,OAAOC;AAAAA,IAChC;AAAA,IAEA,iBAAiB;AAAA,MACfG,MAAMV,YAAAA,MAAMM,OAAOK;AAAAA,IACrB;AAAA,IAEAZ,cAAe,GAAEC,YAAAA,MAAMY,MAAMC,QAAQb,kBAAMY,MAAMC;AAAAA,IACjDX,QAAQF,YAAAA,MAAMC,aAAaa;AAAAA,EAC7B;AAAA,EACAC,cAAc;AAAA,IACZb,QAAQF,YAAAA,MAAMC,aAAaa;AAAAA,IAC3Bf,cAAcC,YAAAA,MAAMC,aAAaF;AAAAA,EACnC;AACF;;"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
3
  const classes = require("../../utils/classes.cjs");
4
- const classKeys = ["root", "container", "baseContainer", "icon", "iconSelected", "menuList"];
4
+ const classKeys = ["root", "container", "baseContainer", "icon", "iconSelected", "menuList", "menuListRoot"];
5
5
  const dropDownMenuClasses = classes.getClasses(classKeys, "HvDropDownMenu");
6
6
  const dropDownMenuClasses$1 = dropDownMenuClasses;
7
7
  exports.default = dropDownMenuClasses$1;
@@ -1 +1 @@
1
- {"version":3,"file":"dropDownMenuClasses.cjs","sources":["../../../../src/components/DropDownMenu/dropDownMenuClasses.ts"],"sourcesContent":["import { getClasses } from \"@core/utils\";\n\nexport interface HvDropDownMenuClasses {\n /** Styles applied to the root. */\n root?: string;\n /** Styles applied to the container. */\n container?: string;\n /** Styles applied to the BaseDropdown container. */\n baseContainer?: string;\n /** Styles applied to the icon. */\n icon?: string;\n /** Styles applied to the icon when selected. */\n iconSelected?: string;\n /** Styles applied to the list. */\n menuList?: string;\n}\n\nconst classKeys: (keyof HvDropDownMenuClasses)[] = [\n \"root\",\n \"container\",\n \"baseContainer\",\n \"icon\",\n \"iconSelected\",\n \"menuList\",\n];\n\nconst dropDownMenuClasses = getClasses(classKeys, \"HvDropDownMenu\");\n\nexport default dropDownMenuClasses;\n"],"names":["classKeys","dropDownMenuClasses","getClasses"],"mappings":";;;AAiBA,MAAMA,YAA6C,CACjD,QACA,aACA,iBACA,QACA,gBACA,UAAU;AAGZ,MAAMC,sBAAsBC,QAAWF,WAAAA,WAAW,gBAAgB;AAElE,MAAA,wBAAeC;;"}
1
+ {"version":3,"file":"dropDownMenuClasses.cjs","sources":["../../../../src/components/DropDownMenu/dropDownMenuClasses.ts"],"sourcesContent":["import { getClasses } from \"@core/utils\";\n\nexport interface HvDropDownMenuClasses {\n /** Styles applied to the root. */\n root?: string;\n /** Styles applied to the container. */\n container?: string;\n /** Styles applied to the BaseDropdown container. */\n baseContainer?: string;\n /** Styles applied to the icon. */\n icon?: string;\n /** Styles applied to the icon when selected. */\n iconSelected?: string;\n /** Styles applied to the list root. */\n menuListRoot?: string;\n /** Styles applied to the list. */\n menuList?: string;\n}\n\nconst classKeys: (keyof HvDropDownMenuClasses)[] = [\n \"root\",\n \"container\",\n \"baseContainer\",\n \"icon\",\n \"iconSelected\",\n \"menuList\",\n \"menuListRoot\",\n];\n\nconst dropDownMenuClasses = getClasses(classKeys, \"HvDropDownMenu\");\n\nexport default dropDownMenuClasses;\n"],"names":["classKeys","dropDownMenuClasses","getClasses"],"mappings":";;;AAmBA,MAAMA,YAA6C,CACjD,QACA,aACA,iBACA,QACA,gBACA,YACA,cAAc;AAGhB,MAAMC,sBAAsBC,QAAWF,WAAAA,WAAW,gBAAgB;AAElE,MAAA,wBAAeC;;"}
@@ -4,19 +4,19 @@ const React = require("react");
4
4
  const uniqueId = require("lodash/uniqueId");
5
5
  const accept = require("attr-accept");
6
6
  const clsx = require("clsx");
7
- const withId = require("../../../hocs/withId.cjs");
8
7
  const utils = require("../utils.cjs");
9
8
  const DropZone_styles = require("./DropZone.styles.cjs");
10
9
  const dropZoneClasses = require("./dropZoneClasses.cjs");
11
10
  const jsxRuntime = require("@emotion/react/jsx-runtime");
11
+ const useUniqueId = require("../../../hooks/useUniqueId.cjs");
12
12
  const setId = require("../../../utils/setId.cjs");
13
13
  const keyCheck = require("../../../utils/keyboardUtils/keyCheck.cjs");
14
14
  const keyboardCodes = require("../../../utils/keyboardUtils/keyboardCodes.cjs");
15
15
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
16
16
  const uniqueId__default = /* @__PURE__ */ _interopDefault(uniqueId);
17
17
  const accept__default = /* @__PURE__ */ _interopDefault(accept);
18
- const HvDropZone = withId.default(({
19
- id,
18
+ const HvDropZone = ({
19
+ id: idProp,
20
20
  classes,
21
21
  labels,
22
22
  acceptedFiles,
@@ -27,6 +27,7 @@ const HvDropZone = withId.default(({
27
27
  disabled = false,
28
28
  onFilesAdded
29
29
  }) => {
30
+ const id = useUniqueId.default(idProp, "dropzone");
30
31
  const [dragState, setDrag] = React.useState(false);
31
32
  const inputRef = React.useRef(null);
32
33
  const leaveDropArea = () => {
@@ -163,6 +164,6 @@ const HvDropZone = withId.default(({
163
164
  })]
164
165
  })]
165
166
  });
166
- });
167
+ };
167
168
  exports.HvDropZone = HvDropZone;
168
169
  //# sourceMappingURL=DropZone.cjs.map