@hitachivantara/uikit-react-core 5.46.2 → 5.47.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/cjs/ColorPicker/ColorPicker.cjs +3 -3
  2. package/dist/cjs/ColorPicker/ColorPicker.cjs.map +1 -1
  3. package/dist/cjs/DatePicker/DatePicker.cjs +5 -1
  4. package/dist/cjs/DatePicker/DatePicker.cjs.map +1 -1
  5. package/dist/cjs/Dropdown/Dropdown.cjs +6 -0
  6. package/dist/cjs/Dropdown/Dropdown.cjs.map +1 -1
  7. package/dist/cjs/Dropdown/List/List.cjs.map +1 -1
  8. package/dist/cjs/Dropdown/utils.cjs.map +1 -1
  9. package/dist/cjs/FilterGroup/FilterContent/FilterContent.cjs.map +1 -1
  10. package/dist/cjs/FilterGroup/FilterGroup.cjs +7 -0
  11. package/dist/cjs/FilterGroup/FilterGroup.cjs.map +1 -1
  12. package/dist/cjs/Input/Input.cjs +5 -0
  13. package/dist/cjs/Input/Input.cjs.map +1 -1
  14. package/dist/cjs/Kpi/Kpi.cjs +12 -8
  15. package/dist/cjs/Kpi/Kpi.cjs.map +1 -1
  16. package/dist/cjs/ListContainer/ListItem/ListItem.cjs +27 -32
  17. package/dist/cjs/ListContainer/ListItem/ListItem.cjs.map +1 -1
  18. package/dist/cjs/Pagination/Pagination.cjs +14 -1
  19. package/dist/cjs/Pagination/Pagination.cjs.map +1 -1
  20. package/dist/cjs/Panel/Panel.cjs +13 -11
  21. package/dist/cjs/Panel/Panel.cjs.map +1 -1
  22. package/dist/cjs/Section/Section.cjs +32 -20
  23. package/dist/cjs/Section/Section.cjs.map +1 -1
  24. package/dist/cjs/Section/Section.styles.cjs +13 -3
  25. package/dist/cjs/Section/Section.styles.cjs.map +1 -1
  26. package/dist/cjs/TableSection/TableSection.cjs +24 -0
  27. package/dist/cjs/TableSection/TableSection.cjs.map +1 -0
  28. package/dist/cjs/TableSection/TableSection.styles.cjs +81 -0
  29. package/dist/cjs/TableSection/TableSection.styles.cjs.map +1 -0
  30. package/dist/cjs/hooks/useLabels.cjs +1 -4
  31. package/dist/cjs/hooks/useLabels.cjs.map +1 -1
  32. package/dist/cjs/index.cjs +4 -0
  33. package/dist/cjs/index.cjs.map +1 -1
  34. package/dist/esm/ColorPicker/ColorPicker.js +3 -3
  35. package/dist/esm/ColorPicker/ColorPicker.js.map +1 -1
  36. package/dist/esm/DatePicker/DatePicker.js +5 -1
  37. package/dist/esm/DatePicker/DatePicker.js.map +1 -1
  38. package/dist/esm/Dropdown/Dropdown.js +6 -0
  39. package/dist/esm/Dropdown/Dropdown.js.map +1 -1
  40. package/dist/esm/Dropdown/List/List.js.map +1 -1
  41. package/dist/esm/Dropdown/utils.js.map +1 -1
  42. package/dist/esm/FilterGroup/FilterContent/FilterContent.js.map +1 -1
  43. package/dist/esm/FilterGroup/FilterGroup.js +7 -0
  44. package/dist/esm/FilterGroup/FilterGroup.js.map +1 -1
  45. package/dist/esm/Input/Input.js +5 -0
  46. package/dist/esm/Input/Input.js.map +1 -1
  47. package/dist/esm/Kpi/Kpi.js +12 -8
  48. package/dist/esm/Kpi/Kpi.js.map +1 -1
  49. package/dist/esm/ListContainer/ListItem/ListItem.js +27 -32
  50. package/dist/esm/ListContainer/ListItem/ListItem.js.map +1 -1
  51. package/dist/esm/Pagination/Pagination.js +14 -1
  52. package/dist/esm/Pagination/Pagination.js.map +1 -1
  53. package/dist/esm/Panel/Panel.js +13 -11
  54. package/dist/esm/Panel/Panel.js.map +1 -1
  55. package/dist/esm/Section/Section.js +32 -20
  56. package/dist/esm/Section/Section.js.map +1 -1
  57. package/dist/esm/Section/Section.styles.js +13 -3
  58. package/dist/esm/Section/Section.styles.js.map +1 -1
  59. package/dist/esm/TableSection/TableSection.js +25 -0
  60. package/dist/esm/TableSection/TableSection.js.map +1 -0
  61. package/dist/esm/TableSection/TableSection.styles.js +81 -0
  62. package/dist/esm/TableSection/TableSection.styles.js.map +1 -0
  63. package/dist/esm/hooks/useLabels.js +2 -3
  64. package/dist/esm/hooks/useLabels.js.map +1 -1
  65. package/dist/esm/index.js +4 -0
  66. package/dist/esm/index.js.map +1 -1
  67. package/dist/types/index.d.ts +161 -128
  68. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"Pagination.cjs","sources":["../../../src/Pagination/Pagination.tsx"],"sourcesContent":["import { HTMLAttributes, useCallback, useEffect } from \"react\";\n\nimport Hidden from \"@mui/material/Hidden\";\n\nimport {\n Start,\n End,\n Backwards,\n Forwards,\n} from \"@hitachivantara/uikit-react-icons\";\n\nimport { useDefaultProps } from \"../hooks/useDefaultProps\";\n\nimport { HvInput, HvInputProps } from \"../Input\";\nimport { HvTypography } from \"../Typography\";\nimport { HvBaseProps } from \"../types/generic\";\nimport { setId } from \"../utils/setId\";\nimport { isKey } from \"../utils/keyboardUtils\";\nimport { ExtractNames } from \"../utils/classes\";\nimport { IconButton } from \"../utils/IconButton\";\nimport { useLabels } from \"../hooks/useLabels\";\n\nimport HvSelect, { Option } from \"./Select\";\nimport { staticClasses, useClasses } from \"./Pagination.styles\";\nimport { usePageInput, getSafePage, setColor } from \"./utils\";\n\nexport { staticClasses as paginationClasses };\n\nexport type HvPaginationClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvPaginationLabels {\n /** The show label. */\n pageSizePrev?: string;\n /** Indicate the units of the page size selection. */\n pageSizeEntryName?: string;\n /** Used for the aria-label of the selection of number of unit.s */\n pageSizeSelectorDescription?: string;\n /** Separator of current page and total pages. */\n pagesSeparator?: string;\n /** Title of button `firstPage`. @deprecated Use `firstPage` instead. */\n paginationFirstPageTitle?: string;\n /** Title of button `previousPage`. @deprecated Use `previousPage` instead. */\n paginationPreviousPageTitle?: string;\n /** Title of button `nextPage`. @deprecated Use `nextPage` instead. */\n paginationNextPageTitle?: string;\n /** Title of button `lastPage`. @deprecated Use `lastPage` instead. */\n paginationLastPageTitle?: string;\n /** Aria-label passed to the page input. */\n paginationInputLabel?: string;\n /** Label of the first page button */\n firstPage?: string;\n /** Label of the previous page button */\n previousPage?: string;\n /** Label of the next page button */\n nextPage?: string;\n /** Label of the last page button */\n lastPage?: string;\n}\n\nexport interface HvPaginationProps extends HvBaseProps {\n /** The number of pages the component has. */\n pages?: number;\n /** The currently selected page (0-indexed). */\n page?: number;\n /** Controls whether the left page size mechanism should be visible. */\n showPageSizeOptions?: boolean;\n /** The array of possible page sizes for the dropdown. */\n pageSizeOptions?: number[];\n /** The currently selected page size. */\n pageSize?: number;\n /** Controls whether the central page changing mechanism should be visible. */\n showPageJump?: boolean;\n /** Controls whether the previous/first page buttons are enabled. */\n canPrevious?: boolean;\n /** Controls whether the next/last page buttons are enabled. */\n canNext?: boolean;\n /** Function called when the page changes. */\n onPageChange?: (page: number) => void;\n /** Function called when the page size changes. */\n onPageSizeChange?: (pageSize: number) => void;\n /** An object containing all the labels for the component. */\n labels?: HvPaginationLabels;\n /** Other props to show page component. */\n showPageProps?: HTMLAttributes<HTMLDivElement>;\n /** Other props to pagination component. */\n navigationProps?: HTMLAttributes<HTMLDivElement>;\n /** Extra properties passed to the input component representing the current pages. */\n currentPageInputProps?: HvInputProps;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvPaginationClasses;\n}\n\nconst DEFAULT_LABELS: HvPaginationLabels = {\n pageSizePrev: \"Show\",\n pageSizeEntryName: \"rows\",\n pageSizeSelectorDescription: \"Select how many to display\",\n pagesSeparator: \"/\",\n paginationFirstPageTitle: \"First page\",\n paginationPreviousPageTitle: \"Previous page\",\n paginationNextPageTitle: \"Next page\",\n paginationLastPageTitle: \"Last page\",\n paginationInputLabel: \"Current page\",\n firstPage: \"First Page\",\n previousPage: \"Previous Page\",\n nextPage: \"Next Page\",\n lastPage: \"Last Page\",\n};\n\nconst defaultPageSizeOptions = [5, 10, 20, 25, 50, 100];\n\n/**\n * Pagination is the process of dividing a document into discrete pages. It relates to how users interact\n * with structured content on a website or application.\n */\nexport const HvPagination = (props: HvPaginationProps) => {\n const {\n classes: classesProp,\n className,\n id,\n pages = 1,\n page = 0,\n showPageSizeOptions = true,\n pageSizeOptions = defaultPageSizeOptions,\n pageSize = defaultPageSizeOptions[1],\n showPageJump = true,\n canPrevious = false,\n canNext = false,\n onPageChange,\n onPageSizeChange,\n labels: labelsProp,\n showPageProps,\n navigationProps,\n currentPageInputProps,\n ...others\n } = useDefaultProps(\"HvPagination\", props);\n\n const labels = useLabels(DEFAULT_LABELS, labelsProp);\n const [pageInput, handleInputChange] = usePageInput(page);\n const { classes, cx } = useClasses(classesProp);\n\n const changePage = useCallback(\n (newPage: number) => {\n const safePage: number = getSafePage(newPage, page, pages);\n\n onPageChange?.(safePage);\n handleInputChange(null, safePage + 1);\n },\n [page, pages, onPageChange, handleInputChange]\n );\n\n useEffect(() => {\n if (page >= pages && pages > 0) {\n changePage(page);\n }\n }, [changePage, page, pages]);\n\n useEffect(() => {\n if (pageInput !== page + 1) {\n handleInputChange(null, page + 1);\n }\n\n // we only want to \"fix\" the input's display value when `page` property changed\n // (either externally or when internally committed - onBlur or Enter),\n // not while editing the input.\n // breaking a rule of hooks isn't ideal and it's just a hack for fixing\n // a bug preventing properly controlling of the `page` property.\n // fixing it some other way would potentially introduce a breaking change.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [handleInputChange, page]);\n\n const renderPageJump = () => (\n <div className={classes.pageJump}>\n <HvInput\n id={setId(id, \"currentPage\")}\n labels={labels}\n inputProps={{\n \"aria-label\": labels?.paginationInputLabel,\n // We really want the native number input\n type: \"number\",\n }}\n classes={{\n root: classes?.pageSizeInputContainer,\n input: classes?.pageSizeInput,\n inputRoot: classes?.pageSizeInputRoot,\n }}\n onChange={(event, value) => handleInputChange(event, Number(value))}\n value={String(pageInput)}\n onBlur={(evt, value) => changePage(Number(value) - 1)}\n onKeyDown={(evt, value) =>\n isKey(evt, \"Enter\") && changePage(Number(value) - 1)\n }\n disabled={pageSize === 0}\n disableClear\n {...currentPageInputProps}\n />\n </div>\n );\n\n return (\n <div id={id} className={cx(classes.root, className)} {...others}>\n <div className={classes.pageSizeOptions} {...showPageProps}>\n {showPageSizeOptions && (\n <>\n <Hidden xsDown>\n <HvTypography\n component=\"span\"\n className={classes?.pageSizeTextContainer}\n >\n {labels?.pageSizePrev}\n </HvTypography>\n </Hidden>\n <HvSelect\n id={setId(id, \"pageSize\")}\n disabled={pageSize === 0}\n className={classes.pageSizeOptionsSelect}\n aria-label={labels?.pageSizeSelectorDescription}\n onChange={(_: any, val: number) => onPageSizeChange?.(val)}\n value={pageSize}\n classes={{ header: classes.pageSizeHeader }}\n >\n {pageSizeOptions.map((option) => (\n <Option key={option} value={option}>\n {option}\n </Option>\n ))}\n </HvSelect>\n <Hidden xsDown>\n <HvTypography\n component=\"span\"\n className={classes.pageSizeTextContainer}\n >\n {labels?.pageSizeEntryName}\n </HvTypography>\n </Hidden>\n </>\n )}\n </div>\n <div className={classes.pageNavigator} {...navigationProps}>\n <IconButton\n id={setId(id, \"firstPage-button\")}\n className={classes.iconContainer}\n disabled={!canPrevious}\n onClick={() => changePage(0)}\n title={labels?.firstPage || labels?.paginationFirstPageTitle}\n >\n <Start\n role=\"none\"\n className={classes.icon}\n color={setColor(!canPrevious)}\n iconSize=\"XS\"\n />\n </IconButton>\n <IconButton\n id={setId(id, \"previousPage-button\")}\n className={classes.iconContainer}\n disabled={!canPrevious}\n onClick={() => changePage(page - 1)}\n title={labels?.previousPage || labels?.paginationPreviousPageTitle}\n >\n <Backwards\n role=\"none\"\n className={classes.icon}\n color={setColor(!canPrevious)}\n iconSize=\"XS\"\n />\n </IconButton>\n <div className={classes.pageInfo}>\n {showPageJump ? (\n renderPageJump()\n ) : (\n <HvTypography variant=\"caption2\" component=\"span\">{`${\n page + 1\n }`}</HvTypography>\n )}\n <HvTypography component=\"span\">{`${labels?.pagesSeparator} `}</HvTypography>\n <HvTypography\n component=\"span\"\n id={setId(id, \"totalPages\")}\n className={classes.totalPagesTextContainer}\n >\n {pages}\n </HvTypography>\n </div>\n <IconButton\n id={setId(id, \"nextPage-button\")}\n className={classes.iconContainer}\n disabled={!canNext}\n onClick={() => changePage(page + 1)}\n title={labels?.nextPage || labels?.paginationNextPageTitle}\n >\n <Forwards\n role=\"none\"\n className={classes.icon}\n color={setColor(!canNext)}\n iconSize=\"XS\"\n />\n </IconButton>\n <IconButton\n id={setId(id, \"lastPage-button\")}\n className={classes.iconContainer}\n disabled={!canNext}\n onClick={() => changePage(pages - 1)}\n title={labels?.lastPage || labels?.paginationLastPageTitle}\n >\n <End\n className={classes.icon}\n color={setColor(!canNext)}\n iconSize=\"XS\"\n />\n </IconButton>\n </div>\n </div>\n );\n};\n"],"names":["useDefaultProps","useLabels","usePageInput","useClasses","useCallback","getSafePage","useEffect","jsx","HvInput","setId","isKey","jsxs","Fragment","Hidden","HvTypography","HvSelect","Option","IconButton","Start","setColor","Backwards","Forwards","End"],"mappings":";;;;;;;;;;;;;;;;;;AA4FA,MAAM,iBAAqC;AAAA,EACzC,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,6BAA6B;AAAA,EAC7B,gBAAgB;AAAA,EAChB,0BAA0B;AAAA,EAC1B,6BAA6B;AAAA,EAC7B,yBAAyB;AAAA,EACzB,yBAAyB;AAAA,EACzB,sBAAsB;AAAA,EACtB,WAAW;AAAA,EACX,cAAc;AAAA,EACd,UAAU;AAAA,EACV,UAAU;AACZ;AAEA,MAAM,yBAAyB,CAAC,GAAG,IAAI,IAAI,IAAI,IAAI,GAAG;AAMzC,MAAA,eAAe,CAAC,UAA6B;AAClD,QAAA;AAAA,IACJ,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,sBAAsB;AAAA,IACtB,kBAAkB;AAAA,IAClB,WAAW,uBAAuB,CAAC;AAAA,IACnC,eAAe;AAAA,IACf,cAAc;AAAA,IACd,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR;AAAA,IACA;AAAA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KAAI;AAAA,QAC7DP,2BAAA;AAAA,UAACO,WAAA;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,IAAIL,MAAAA,MAAM,IAAI,YAAY;AAAA,YAC1B,WAAW,QAAQ;AAAA,YAElB,UAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA,GACF;AAAA,MACAF,2BAAA;AAAA,QAACU,WAAA;AAAA,QAAA;AAAA,UACC,IAAIR,MAAAA,MAAM,IAAI,iBAAiB;AAAA,UAC/B,WAAW,QAAQ;AAAA,UACnB,UAAU,CAAC;AAAA,UACX,SAAS,MAAM,WAAW,OAAO,CAAC;AAAA,UAClC,OAAO,QAAQ,YAAY,QAAQ;AAAA,UAEnC,UAAAF,2BAAA;AAAA,YAACc,gBAAA;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,WAAW,QAAQ;AAAA,cACnB,OAAOF,MAAAA,SAAS,CAAC,OAAO;AAAA,cACxB,UAAS;AAAA,YAAA;AAAA,UACX;AAAA,QAAA;AAAA,MACF;AAAA,MACAZ,2BAAA;AAAA,QAACU,WAAA;AAAA,QAAA;AAAA,UACC,IAAIR,MAAAA,MAAM,IAAI,iBAAiB;AAAA,UAC/B,WAAW,QAAQ;AAAA,UACnB,UAAU,CAAC;AAAA,UACX,SAAS,MAAM,WAAW,QAAQ,CAAC;AAAA,UACnC,OAAO,QAAQ,YAAY,QAAQ;AAAA,UAEnC,UAAAF,2BAAA;AAAA,YAACe,gBAAA;AAAA,YAAA;AAAA,cACC,WAAW,QAAQ;AAAA,cACnB,OAAOH,MAAAA,SAAS,CAAC,OAAO;AAAA,cACxB,UAAS;AAAA,YAAA;AAAA,UACX;AAAA,QAAA;AAAA,MACF;AAAA,IAAA,GACF;AAAA,EACF,EAAA,CAAA;AAEJ;;;"}
1
+ {"version":3,"file":"Pagination.cjs","sources":["../../../src/Pagination/Pagination.tsx"],"sourcesContent":["import { HTMLAttributes, useCallback, useEffect } from \"react\";\n\nimport Hidden from \"@mui/material/Hidden\";\n\nimport {\n Start,\n End,\n Backwards,\n Forwards,\n} from \"@hitachivantara/uikit-react-icons\";\n\nimport { useDefaultProps } from \"../hooks/useDefaultProps\";\n\nimport { HvInput, HvInputProps } from \"../Input\";\nimport { HvTypography } from \"../Typography\";\nimport { HvBaseProps } from \"../types/generic\";\nimport { setId } from \"../utils/setId\";\nimport { isKey } from \"../utils/keyboardUtils\";\nimport { ExtractNames } from \"../utils/classes\";\nimport { IconButton } from \"../utils/IconButton\";\nimport { useLabels } from \"../hooks/useLabels\";\n\nimport HvSelect, { Option } from \"./Select\";\nimport { staticClasses, useClasses } from \"./Pagination.styles\";\nimport { usePageInput, getSafePage, setColor } from \"./utils\";\n\nexport { staticClasses as paginationClasses };\n\nexport type HvPaginationClasses = ExtractNames<typeof useClasses>;\n\nconst defaultPageSizeOptions = [5, 10, 20, 25, 50, 100];\n\nconst DEFAULT_LABELS = {\n /** The show label. */\n pageSizePrev: \"Show\",\n /** Indicate the units of the page size selection. */\n pageSizeEntryName: \"rows\",\n /** Used for the aria-label of the selection of number of unit.s */\n pageSizeSelectorDescription: \"Select how many to display\",\n /** Separator of current page and total pages. */\n pagesSeparator: \"/\",\n /** Title of button `firstPage`. @deprecated Use `firstPage` instead. */\n paginationFirstPageTitle: \"First page\",\n /** Title of button `previousPage`. @deprecated Use `previousPage` instead. */\n paginationPreviousPageTitle: \"Previous page\",\n /** Title of button `nextPage`. @deprecated Use `nextPage` instead. */\n paginationNextPageTitle: \"Next page\",\n /** Title of button `lastPage`. @deprecated Use `lastPage` instead. */\n paginationLastPageTitle: \"Last page\",\n /** Aria-label passed to the page input. */\n paginationInputLabel: \"Current page\",\n /** Label of the first page button */\n firstPage: \"First Page\",\n /** Label of the previous page button */\n previousPage: \"Previous Page\",\n /** Label of the next page button */\n nextPage: \"Next Page\",\n /** Label of the last page button */\n lastPage: \"Last Page\",\n};\n\nexport type HvPaginationLabels = Partial<typeof DEFAULT_LABELS>;\n\nexport interface HvPaginationProps extends HvBaseProps {\n /** The number of pages the component has. */\n pages?: number;\n /** The currently selected page (0-indexed). */\n page?: number;\n /** Controls whether the left page size mechanism should be visible. */\n showPageSizeOptions?: boolean;\n /** The array of possible page sizes for the dropdown. */\n pageSizeOptions?: number[];\n /** The currently selected page size. */\n pageSize?: number;\n /** Controls whether the central page changing mechanism should be visible. */\n showPageJump?: boolean;\n /** Controls whether the previous/first page buttons are enabled. */\n canPrevious?: boolean;\n /** Controls whether the next/last page buttons are enabled. */\n canNext?: boolean;\n /** Function called when the page changes. */\n onPageChange?: (page: number) => void;\n /** Function called when the page size changes. */\n onPageSizeChange?: (pageSize: number) => void;\n /** An object containing all the labels for the component. */\n labels?: HvPaginationLabels;\n /** Other props to show page component. */\n showPageProps?: HTMLAttributes<HTMLDivElement>;\n /** Other props to pagination component. */\n navigationProps?: HTMLAttributes<HTMLDivElement>;\n /** Extra properties passed to the input component representing the current pages. */\n currentPageInputProps?: HvInputProps;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvPaginationClasses;\n}\n\n/**\n * Pagination is the process of dividing a document into discrete pages. It relates to how users interact\n * with structured content on a website or application.\n */\nexport const HvPagination = (props: HvPaginationProps) => {\n const {\n classes: classesProp,\n className,\n id,\n pages = 1,\n page = 0,\n showPageSizeOptions = true,\n pageSizeOptions = defaultPageSizeOptions,\n pageSize = defaultPageSizeOptions[1],\n showPageJump = true,\n canPrevious = false,\n canNext = false,\n onPageChange,\n onPageSizeChange,\n labels: labelsProp,\n showPageProps,\n navigationProps,\n currentPageInputProps,\n ...others\n } = useDefaultProps(\"HvPagination\", props);\n\n const labels = useLabels(DEFAULT_LABELS, labelsProp);\n const [pageInput, handleInputChange] = usePageInput(page);\n const { classes, cx } = useClasses(classesProp);\n\n const changePage = useCallback(\n (newPage: number) => {\n const safePage: number = getSafePage(newPage, page, pages);\n\n onPageChange?.(safePage);\n handleInputChange(null, safePage + 1);\n },\n [page, pages, onPageChange, handleInputChange]\n );\n\n useEffect(() => {\n if (page >= pages && pages > 0) {\n changePage(page);\n }\n }, [changePage, page, pages]);\n\n useEffect(() => {\n if (pageInput !== page + 1) {\n handleInputChange(null, page + 1);\n }\n\n // we only want to \"fix\" the input's display value when `page` property changed\n // (either externally or when internally committed - onBlur or Enter),\n // not while editing the input.\n // breaking a rule of hooks isn't ideal and it's just a hack for fixing\n // a bug preventing properly controlling of the `page` property.\n // fixing it some other way would potentially introduce a breaking change.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [handleInputChange, page]);\n\n const renderPageJump = () => (\n <div className={classes.pageJump}>\n <HvInput\n id={setId(id, \"currentPage\")}\n labels={labels}\n inputProps={{\n \"aria-label\": labels?.paginationInputLabel,\n // We really want the native number input\n type: \"number\",\n }}\n classes={{\n root: classes?.pageSizeInputContainer,\n input: classes?.pageSizeInput,\n inputRoot: classes?.pageSizeInputRoot,\n }}\n onChange={(event, value) => handleInputChange(event, Number(value))}\n value={String(pageInput)}\n onBlur={(evt, value) => changePage(Number(value) - 1)}\n onKeyDown={(evt, value) =>\n isKey(evt, \"Enter\") && changePage(Number(value) - 1)\n }\n disabled={pageSize === 0}\n disableClear\n {...currentPageInputProps}\n />\n </div>\n );\n\n return (\n <div id={id} className={cx(classes.root, className)} {...others}>\n <div className={classes.pageSizeOptions} {...showPageProps}>\n {showPageSizeOptions && (\n <>\n <Hidden xsDown>\n <HvTypography\n component=\"span\"\n className={classes?.pageSizeTextContainer}\n >\n {labels?.pageSizePrev}\n </HvTypography>\n </Hidden>\n <HvSelect\n id={setId(id, \"pageSize\")}\n disabled={pageSize === 0}\n className={classes.pageSizeOptionsSelect}\n aria-label={labels?.pageSizeSelectorDescription}\n onChange={(_: any, val: number) => onPageSizeChange?.(val)}\n value={pageSize}\n classes={{ header: classes.pageSizeHeader }}\n >\n {pageSizeOptions.map((option) => (\n <Option key={option} value={option}>\n {option}\n </Option>\n ))}\n </HvSelect>\n <Hidden xsDown>\n <HvTypography\n component=\"span\"\n className={classes.pageSizeTextContainer}\n >\n {labels?.pageSizeEntryName}\n </HvTypography>\n </Hidden>\n </>\n )}\n </div>\n <div className={classes.pageNavigator} {...navigationProps}>\n <IconButton\n id={setId(id, \"firstPage-button\")}\n className={classes.iconContainer}\n disabled={!canPrevious}\n onClick={() => changePage(0)}\n title={labels?.firstPage || labels?.paginationFirstPageTitle}\n >\n <Start\n role=\"none\"\n className={classes.icon}\n color={setColor(!canPrevious)}\n iconSize=\"XS\"\n />\n </IconButton>\n <IconButton\n id={setId(id, \"previousPage-button\")}\n className={classes.iconContainer}\n disabled={!canPrevious}\n onClick={() => changePage(page - 1)}\n title={labels?.previousPage || labels?.paginationPreviousPageTitle}\n >\n <Backwards\n role=\"none\"\n className={classes.icon}\n color={setColor(!canPrevious)}\n iconSize=\"XS\"\n />\n </IconButton>\n <div className={classes.pageInfo}>\n {showPageJump ? (\n renderPageJump()\n ) : (\n <HvTypography variant=\"caption2\" component=\"span\">{`${\n page + 1\n }`}</HvTypography>\n )}\n <HvTypography component=\"span\">{`${labels?.pagesSeparator} `}</HvTypography>\n <HvTypography\n component=\"span\"\n id={setId(id, \"totalPages\")}\n className={classes.totalPagesTextContainer}\n >\n {pages}\n </HvTypography>\n </div>\n <IconButton\n id={setId(id, \"nextPage-button\")}\n className={classes.iconContainer}\n disabled={!canNext}\n onClick={() => changePage(page + 1)}\n title={labels?.nextPage || labels?.paginationNextPageTitle}\n >\n <Forwards\n role=\"none\"\n className={classes.icon}\n color={setColor(!canNext)}\n iconSize=\"XS\"\n />\n </IconButton>\n <IconButton\n id={setId(id, \"lastPage-button\")}\n className={classes.iconContainer}\n disabled={!canNext}\n onClick={() => changePage(pages - 1)}\n title={labels?.lastPage || labels?.paginationLastPageTitle}\n >\n <End\n className={classes.icon}\n color={setColor(!canNext)}\n iconSize=\"XS\"\n />\n </IconButton>\n </div>\n </div>\n );\n};\n"],"names":["useDefaultProps","useLabels","usePageInput","useClasses","useCallback","getSafePage","useEffect","jsx","HvInput","setId","isKey","jsxs","Fragment","Hidden","HvTypography","H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AQ;AAAA,UAEnC,UAAAF,2BAAA;AAAA,YAACc,gBAAA;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,WAAW,QAAQ;AAAA,cACnB,OAAOF,MAAAA,SAAS,CAAC,OAAO;AAAA,cACxB,UAAS;AAAA,YAAA;AAAA,UACX;AAAA,QAAA;AAAA,MACF;AAAA,MACAZ,2BAAA;AAAA,QAACU,WAAA;AAAA,QAAA;AAAA,UACC,IAAIR,MAAAA,MAAM,IAAI,iBAAiB;AAAA,UAC/B,WAAW,QAAQ;AAAA,UACnB,UAAU,CAAC;AAAA,UACX,SAAS,MAAM,WAAW,QAAQ,CAAC;AAAA,UACnC,OAAO,QAAQ,YAAY,QAAQ;AAAA,UAEnC,UAAAF,2BAAA;AAAA,YAACe,gBAAA;AAAA,YAAA;AAAA,cACC,WAAW,QAAQ;AAAA,cACnB,OAAOH,MAAAA,SAAS,CAAC,OAAO;AAAA,cACxB,UAAS;AAAA,YAAA;AAAA,UACX;AAAA,QAAA;AAAA,MACF;AAAA,IAAA,GACF;AAAA,EACF,EAAA,CAAA;AAEJ;;;"}
@@ -1,19 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("@emotion/react/jsx-runtime");
4
+ const React = require("react");
4
5
  const useDefaultProps = require("../hooks/useDefaultProps.cjs");
5
6
  const Panel_styles = require("./Panel.styles.cjs");
6
- const HvPanel = (props) => {
7
- const {
8
- id,
9
- className,
10
- classes: classesProp,
11
- children,
12
- ...others
13
- } = useDefaultProps.useDefaultProps("HvPanel", props);
14
- const { classes, cx } = Panel_styles.useClasses(classesProp);
15
- return /* @__PURE__ */ jsxRuntime.jsx("div", { id, className: cx(classes.root, className), ...others, children });
16
- };
7
+ const HvPanel = React.forwardRef(
8
+ (props, ref) => {
9
+ const {
10
+ className,
11
+ classes: classesProp,
12
+ children,
13
+ ...others
14
+ } = useDefaultProps.useDefaultProps("HvPanel", props);
15
+ const { classes, cx } = Panel_styles.useClasses(classesProp);
16
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cx(classes.root, className), ...others, children });
17
+ }
18
+ );
17
19
  exports.panelClasses = Panel_styles.staticClasses;
18
20
  exports.HvPanel = HvPanel;
19
21
  //# sourceMappingURL=Panel.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Panel.cjs","sources":["../../../src/Panel/Panel.tsx"],"sourcesContent":["import { useDefaultProps } from \"../hooks/useDefaultProps\";\n\nimport { HvBaseProps } from \"../types/generic\";\n\nimport { ExtractNames } from \"../utils/classes\";\n\nimport { staticClasses, useClasses } from \"./Panel.styles\";\n\nexport { staticClasses as panelClasses };\n\nexport type HvPanelClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvPanelProps extends HvBaseProps {\n /** A Jss Object used to override or extend the styles applied. */\n classes?: HvPanelClasses;\n}\n\n/**\n * A panel is a container used in a variety of patterns (e.g. dropdown, filter group, details section).\n * It can be horizontal or vertical and its size is defined by its content and how it relates to surrounding patterns.\n * Regardless of its content, a panel look and feel should be consistent.\n */\nexport const HvPanel = (props: HvPanelProps) => {\n const {\n id,\n className,\n classes: classesProp,\n children,\n ...others\n } = useDefaultProps(\"HvPanel\", props);\n const { classes, cx } = useClasses(classesProp);\n\n return (\n <div id={id} className={cx(classes.root, className)} {...others}>\n {children}\n </div>\n );\n};\n"],"names":["useDefaultProps","useClasses","jsx"],"mappings":";;;;;AAsBa,MAAA,UAAU,CAAC,UAAwB;AACxC,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IACA,GAAG;AAAA,EAAA,IACDA,gBAAgB,gBAAA,WAAW,KAAK;AACpC,QAAM,EAAE,SAAS,GAAG,IAAIC,wBAAW,WAAW;AAG5C,SAAAC,2BAAA,IAAC,OAAI,EAAA,IAAQ,WAAW,GAAG,QAAQ,MAAM,SAAS,GAAI,GAAG,QACtD,SACH,CAAA;AAEJ;;;"}
1
+ {"version":3,"file":"Panel.cjs","sources":["../../../src/Panel/Panel.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\n\nimport { useDefaultProps } from \"../hooks/useDefaultProps\";\n\nimport { HvBaseProps } from \"../types/generic\";\n\nimport { ExtractNames } from \"../utils/classes\";\n\nimport { staticClasses, useClasses } from \"./Panel.styles\";\n\nexport { staticClasses as panelClasses };\n\nexport type HvPanelClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvPanelProps extends HvBaseProps {\n /** A Jss Object used to override or extend the styles applied. */\n classes?: HvPanelClasses;\n}\n\n/**\n * A panel is a container used in a variety of patterns (e.g. dropdown, filter group, details section).\n * It can be horizontal or vertical and its size is defined by its content and how it relates to surrounding patterns.\n * Regardless of its content, a panel look and feel should be consistent.\n */\nexport const HvPanel = forwardRef<HTMLDivElement, HvPanelProps>(\n (props, ref) => {\n const {\n className,\n classes: classesProp,\n children,\n ...others\n } = useDefaultProps(\"HvPanel\", props);\n const { classes, cx } = useClasses(classesProp);\n\n return (\n <div ref={ref} className={cx(classes.root, className)} {...others}>\n {children}\n </div>\n );\n }\n);\n"],"names":["forwardRef","useDefaultProps","useClasses","jsx"],"mappings":";;;;;;AAwBO,MAAM,UAAUA,MAAA;AAAA,EACrB,CAAC,OAAO,QAAQ;AACR,UAAA;AAAA,MACJ;AAAA,MACA,SAAS;AAAA,MACT;AAAA,MACA,GAAG;AAAA,IAAA,IACDC,gBAAgB,gBAAA,WAAW,KAAK;AACpC,UAAM,EAAE,SAAS,GAAG,IAAIC,wBAAW,WAAW;AAG5C,WAAAC,2BAAA,IAAC,OAAI,EAAA,KAAU,WAAW,GAAG,QAAQ,MAAM,SAAS,GAAI,GAAG,QACxD,SACH,CAAA;AAAA,EAEJ;AACF;;;"}
@@ -22,6 +22,7 @@ const HvSection = React.forwardRef(
22
22
  actions,
23
23
  onToggle,
24
24
  expandButtonProps,
25
+ raisedHeader,
25
26
  children,
26
27
  ...others
27
28
  } = useDefaultProps.useDefaultProps("HvSection", props);
@@ -41,31 +42,42 @@ const HvSection = React.forwardRef(
41
42
  className: cx(classes.root, className),
42
43
  ...others,
43
44
  children: [
44
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes.header, children: [
45
- expandable && /* @__PURE__ */ jsxRuntime.jsx(
46
- Button.HvButton,
47
- {
48
- icon: true,
49
- onClick: (event) => {
50
- setIsOpen((o) => !o);
51
- onToggle?.(event, !isOpen);
52
- },
53
- "aria-expanded": isOpen,
54
- "aria-controls": contentId,
55
- "aria-label": isOpen ? "Collapse" : "Expand",
56
- ...expandButtonProps,
57
- children: isOpen ? /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.Up, {}) : /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.Down, {})
58
- }
59
- ),
60
- title,
61
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: classes.actions, children: actions })
62
- ] }),
45
+ (title || actions || expandable) && /* @__PURE__ */ jsxRuntime.jsxs(
46
+ "div",
47
+ {
48
+ className: cx(classes.header, {
49
+ [classes.raisedHeader]: raisedHeader && isOpen
50
+ }),
51
+ children: [
52
+ expandable && /* @__PURE__ */ jsxRuntime.jsx(
53
+ Button.HvButton,
54
+ {
55
+ icon: true,
56
+ onClick: (event) => {
57
+ setIsOpen((o) => !o);
58
+ onToggle?.(event, !isOpen);
59
+ },
60
+ "aria-expanded": isOpen,
61
+ "aria-controls": contentId,
62
+ "aria-label": isOpen ? "Collapse" : "Expand",
63
+ ...expandButtonProps,
64
+ children: isOpen ? /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.Up, {}) : /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.Down, {})
65
+ }
66
+ ),
67
+ title,
68
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: classes.actions, children: actions })
69
+ ]
70
+ }
71
+ ),
63
72
  /* @__PURE__ */ jsxRuntime.jsx(
64
73
  "div",
65
74
  {
66
75
  id: contentId,
67
76
  hidden: !isOpen,
68
- className: cx(classes.content, { [classes.hidden]: !showContent }),
77
+ className: cx(classes.content, {
78
+ [classes.hidden]: !showContent,
79
+ [classes.spaceTop]: !(title || actions || expandable)
80
+ }),
69
81
  children
70
82
  }
71
83
  )
@@ -1 +1 @@
1
- {"version":3,"file":"Section.cjs","sources":["../../../src/Section/Section.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport { Down, Up } from \"@hitachivantara/uikit-react-icons\";\n\nimport { HvBaseProps } from \"../types/generic\";\nimport { ExtractNames } from \"../utils/classes\";\nimport { HvButton, HvButtonProps } from \"../Button\";\nimport { useDefaultProps } from \"../hooks/useDefaultProps\";\nimport { useControlled } from \"../hooks/useControlled\";\nimport { useUniqueId } from \"../hooks/useUniqueId\";\nimport { setId } from \"../utils/setId\";\n\nimport { staticClasses, useClasses } from \"./Section.styles\";\n\nexport { staticClasses as sectionClasses };\n\nexport type HvSectionClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvSectionProps\n extends Omit<HvBaseProps<HTMLDivElement>, \"title\"> {\n /** The title of the section */\n title?: React.ReactNode;\n /** Whether or not the section is expandable. */\n expandable?: boolean;\n /** Whether the section is open or not, if this property is defined the accordion must be fully controlled. */\n expanded?: boolean;\n /** When uncontrolled, defines the initial expanded state. */\n defaultExpanded?: boolean;\n /** Section actions */\n actions?: React.ReactNode;\n /** Section onExpand callback */\n onToggle?: (\n event: React.MouseEvent<HTMLButtonElement>,\n open: boolean\n ) => void;\n /** Props to be passed to the expand button */\n expandButtonProps?: HvButtonProps;\n /** A Jss Object used to override or extend the styles applied to the empty state component. */\n classes?: HvSectionClasses;\n}\n\n/**\n * Sections allow grouping information on a page under the same topic.\n */\nexport const HvSection = forwardRef<HTMLDivElement, HvSectionProps>(\n (props, ref) => {\n const {\n id,\n classes: classesProp,\n className,\n title,\n expandable,\n expanded,\n defaultExpanded = true,\n actions,\n onToggle,\n expandButtonProps,\n children,\n ...others\n } = useDefaultProps(\"HvSection\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const [isOpen, setIsOpen] = useControlled(\n expanded,\n Boolean(defaultExpanded)\n );\n\n const elementId = useUniqueId(id, \"hvSection\");\n const contentId = setId(elementId, \"content\");\n\n const showContent = expandable ? !!isOpen : true;\n\n return (\n <div\n ref={ref}\n id={elementId}\n className={cx(classes.root, className)}\n {...others}\n >\n <div className={classes.header}>\n {expandable && (\n <HvButton\n icon\n onClick={(event) => {\n setIsOpen((o) => !o);\n onToggle?.(event, !isOpen);\n }}\n aria-expanded={isOpen}\n aria-controls={contentId}\n aria-label={isOpen ? \"Collapse\" : \"Expand\"}\n {...expandButtonProps}\n >\n {isOpen ? <Up /> : <Down />}\n </HvButton>\n )}\n {title}\n <div className={classes.actions}>{actions}</div>\n </div>\n <div\n id={contentId}\n hidden={!isOpen}\n className={cx(classes.content, { [classes.hidden]: !showContent })}\n >\n {children}\n </div>\n </div>\n );\n }\n);\n"],"names":["forwardRef","useDefaultProps","useClasses","useControlled","useUniqueId","setId","jsxs","jsx","HvButton","Up","Down"],"mappings":";;;;;;;;;;;AA2CO,MAAM,YAAYA,MAAA;AAAA,EACvB,CAAC,OAAO,QAAQ;AACR,UAAA;AAAA,MACJ;AAAA,MACA,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,kBAAkB;AAAA,MAClB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IAAA,IACDC,gBAAgB,gBAAA,aAAa,KAAK;AAEtC,UAAM,EAAE,SAAS,GAAG,IAAIC,0BAAW,WAAW;AAExC,UAAA,CAAC,QAAQ,SAAS,IAAIC,cAAA;AAAA,MAC1B;AAAA,MACA,QAAQ,eAAe;AAAA,IAAA;AAGnB,UAAA,YAAYC,YAAAA,YAAY,IAAI,WAAW;AACvC,UAAA,YAAYC,MAAAA,MAAM,WAAW,SAAS;AAE5C,UAAM,cAAc,aAAa,CAAC,CAAC,SAAS;AAG1C,WAAAC,2BAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,IAAI;AAAA,QACJ,WAAW,GAAG,QAAQ,MAAM,SAAS;AAAA,QACpC,GAAG;AAAA,QAEJ,UAAA;AAAA,UAACA,2BAAA,KAAA,OAAA,EAAI,WAAW,QAAQ,QACrB,UAAA;AAAA,YACC,cAAAC,2BAAA;AAAA,cAACC,OAAA;AAAA,cAAA;AAAA,gBACC,MAAI;AAAA,gBACJ,SAAS,CAAC,UAAU;AACR,4BAAA,CAAC,MAAM,CAAC,CAAC;AACR,6BAAA,OAAO,CAAC,MAAM;AAAA,gBAC3B;AAAA,gBACA,iBAAe;AAAA,gBACf,iBAAe;AAAA,gBACf,cAAY,SAAS,aAAa;AAAA,gBACjC,GAAG;AAAA,gBAEH,UAAS,SAAAD,2BAAAA,IAACE,gBAAG,IAAA,CAAA,CAAA,mCAAMC,gBAAK,MAAA,EAAA;AAAA,cAAA;AAAA,YAC3B;AAAA,YAED;AAAA,YACAH,2BAAA,IAAA,OAAA,EAAI,WAAW,QAAQ,SAAU,UAAQ,SAAA;AAAA,UAAA,GAC5C;AAAA,UACAA,2BAAA;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,IAAI;AAAA,cACJ,QAAQ,CAAC;AAAA,cACT,WAAW,GAAG,QAAQ,SAAS,EAAE,CAAC,QAAQ,MAAM,GAAG,CAAC,aAAa;AAAA,cAEhE;AAAA,YAAA;AAAA,UACH;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;;;"}
1
+ {"version":3,"file":"Section.cjs","sources":["../../../src/Section/Section.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport { Down, Up } from \"@hitachivantara/uikit-react-icons\";\n\nimport { HvBaseProps } from \"../types/generic\";\nimport { ExtractNames } from \"../utils/classes\";\nimport { HvButton, HvButtonProps } from \"../Button\";\nimport { useDefaultProps } from \"../hooks/useDefaultProps\";\nimport { useControlled } from \"../hooks/useControlled\";\nimport { useUniqueId } from \"../hooks/useUniqueId\";\nimport { setId } from \"../utils/setId\";\n\nimport { staticClasses, useClasses } from \"./Section.styles\";\n\nexport { staticClasses as sectionClasses };\n\nexport type HvSectionClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvSectionProps\n extends Omit<HvBaseProps<HTMLDivElement>, \"title\"> {\n /** The title of the section */\n title?: React.ReactNode;\n /** Whether or not the section is expandable. */\n expandable?: boolean;\n /** Whether the section is open or not, if this property is defined the accordion must be fully controlled. */\n expanded?: boolean;\n /** When uncontrolled, defines the initial expanded state. */\n defaultExpanded?: boolean;\n /** Section actions */\n actions?: React.ReactNode;\n /** Section onExpand callback */\n onToggle?: (\n event: React.MouseEvent<HTMLButtonElement>,\n open: boolean\n ) => void;\n /** Props to be passed to the expand button */\n expandButtonProps?: HvButtonProps;\n /** Determines whether or not the header has a shadow on the bottom border. */\n raisedHeader?: boolean;\n /** A Jss Object used to override or extend the styles applied to the empty state component. */\n classes?: HvSectionClasses;\n}\n\n/**\n * Sections allow grouping information on a page under the same topic.\n */\nexport const HvSection = forwardRef<HTMLDivElement, HvSectionProps>(\n (props, ref) => {\n const {\n id,\n classes: classesProp,\n className,\n title,\n expandable,\n expanded,\n defaultExpanded = true,\n actions,\n onToggle,\n expandButtonProps,\n raisedHeader,\n children,\n ...others\n } = useDefaultProps(\"HvSection\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const [isOpen, setIsOpen] = useControlled(\n expanded,\n Boolean(defaultExpanded)\n );\n\n const elementId = useUniqueId(id, \"hvSection\");\n const contentId = setId(elementId, \"content\");\n\n const showContent = expandable ? !!isOpen : true;\n\n return (\n <div\n ref={ref}\n id={elementId}\n className={cx(classes.root, className)}\n {...others}\n >\n {(title || actions || expandable) && (\n <div\n className={cx(classes.header, {\n [classes.raisedHeader]: raisedHeader && isOpen,\n })}\n >\n {expandable && (\n <HvButton\n icon\n onClick={(event) => {\n setIsOpen((o) => !o);\n onToggle?.(event, !isOpen);\n }}\n aria-expanded={isOpen}\n aria-controls={contentId}\n aria-label={isOpen ? \"Collapse\" : \"Expand\"}\n {...expandButtonProps}\n >\n {isOpen ? <Up /> : <Down />}\n </HvButton>\n )}\n {title}\n <div className={classes.actions}>{actions}</div>\n </div>\n )}\n <div\n id={contentId}\n hidden={!isOpen}\n className={cx(classes.content, {\n [classes.hidden]: !showContent,\n [classes.spaceTop]: !(title || actions || expandable),\n })}\n >\n {children}\n </div>\n </div>\n );\n }\n);\n"],"names":["forwardRef","useDefaultProps","useClasses","useControlled","useUniqueId","setId","jsxs","jsx","HvButton","Up","Down"],"mappings":";;;;;;;;;;;AA6CO,MAAM,YAAYA,MAAA;AAAA,EACvB,CAAC,OAAO,QAAQ;AACR,UAAA;AAAA,MACJ;AAAA,MACA,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,kBAAkB;AAAA,MAClB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IAAA,IACDC,gBAAgB,gBAAA,aAAa,KAAK;AAEtC,UAAM,EAAE,SAAS,GAAG,IAAIC,0BAAW,WAAW;AAExC,UAAA,CAAC,QAAQ,SAAS,IAAIC,cAAA;AAAA,MAC1B;AAAA,MACA,QAAQ,eAAe;AAAA,IAAA;AAGnB,UAAA,YAAYC,YAAAA,YAAY,IAAI,WAAW;AACvC,UAAA,YAAYC,MAAAA,MAAM,WAAW,SAAS;AAE5C,UAAM,cAAc,aAAa,CAAC,CAAC,SAAS;AAG1C,WAAAC,2BAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,IAAI;AAAA,QACJ,WAAW,GAAG,QAAQ,MAAM,SAAS;AAAA,QACpC,GAAG;AAAA,QAEF,UAAA;AAAA,WAAA,SAAS,WAAW,eACpBA,2BAAA;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAW,GAAG,QAAQ,QAAQ;AAAA,gBAC5B,CAAC,QAAQ,YAAY,GAAG,gBAAgB;AAAA,cAAA,CACzC;AAAA,cAEA,UAAA;AAAA,gBACC,cAAAC,2BAAA;AAAA,kBAACC,OAAA;AAAA,kBAAA;AAAA,oBACC,MAAI;AAAA,oBACJ,SAAS,CAAC,UAAU;AACR,gCAAA,CAAC,MAAM,CAAC,CAAC;AACR,iCAAA,OAAO,CAAC,MAAM;AAAA,oBAC3B;AAAA,oBACA,iBAAe;AAAA,oBACf,iBAAe;AAAA,oBACf,cAAY,SAAS,aAAa;AAAA,oBACjC,GAAG;AAAA,oBAEH,UAAS,SAAAD,2BAAAA,IAACE,gBAAG,IAAA,CAAA,CAAA,mCAAMC,gBAAK,MAAA,EAAA;AAAA,kBAAA;AAAA,gBAC3B;AAAA,gBAED;AAAA,gBACAH,2BAAA,IAAA,OAAA,EAAI,WAAW,QAAQ,SAAU,UAAQ,SAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UAC5C;AAAA,UAEFA,2BAAA;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,IAAI;AAAA,cACJ,QAAQ,CAAC;AAAA,cACT,WAAW,GAAG,QAAQ,SAAS;AAAA,gBAC7B,CAAC,QAAQ,MAAM,GAAG,CAAC;AAAA,gBACnB,CAAC,QAAQ,QAAQ,GAAG,EAAE,SAAS,WAAW;AAAA,cAAA,CAC3C;AAAA,cAEA;AAAA,YAAA;AAAA,UACH;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;;;"}
@@ -7,7 +7,6 @@ const { staticClasses, useClasses } = classes.createClasses("HvSection", {
7
7
  width: "100%",
8
8
  display: "flex",
9
9
  flexDirection: "column",
10
- padding: uikitStyles.theme.space.sm,
11
10
  backgroundColor: uikitStyles.theme.colors.atmo1,
12
11
  borderRadius: uikitStyles.theme.radii.round,
13
12
  border: `1px solid ${uikitStyles.theme.colors.atmo4}`
@@ -17,16 +16,27 @@ const { staticClasses, useClasses } = classes.createClasses("HvSection", {
17
16
  display: "flex",
18
17
  alignItems: "center",
19
18
  position: "relative",
20
- minHeight: uikitStyles.theme.sizes.sm
19
+ minHeight: uikitStyles.theme.sizes.sm,
20
+ padding: uikitStyles.theme.space.sm
21
21
  },
22
22
  content: {
23
- marginTop: uikitStyles.theme.space.sm
23
+ padding: uikitStyles.theme.spacing(0, "sm", "sm", "sm")
24
+ },
25
+ spaceTop: {
26
+ paddingTop: uikitStyles.theme.space.sm
24
27
  },
25
28
  actions: {
26
29
  display: "flex",
27
30
  gap: uikitStyles.theme.space.xs,
28
31
  position: "absolute",
29
32
  right: 0
33
+ },
34
+ raisedHeader: {
35
+ zIndex: 1,
36
+ boxShadow: uikitStyles.theme.colors.shadow,
37
+ "+ div": {
38
+ paddingTop: uikitStyles.theme.space.sm
39
+ }
30
40
  }
31
41
  });
32
42
  exports.staticClasses = staticClasses;
@@ -1 +1 @@
1
- {"version":3,"file":"Section.styles.cjs","sources":["../../../src/Section/Section.styles.tsx"],"sourcesContent":["import { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { createClasses } from \"../utils/classes\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvSection\", {\n root: {\n width: \"100%\",\n display: \"flex\",\n flexDirection: \"column\",\n padding: theme.space.sm,\n backgroundColor: theme.colors.atmo1,\n borderRadius: theme.radii.round,\n border: `1px solid ${theme.colors.atmo4}`,\n },\n hidden: { height: 0, display: \"none\" },\n header: {\n display: \"flex\",\n alignItems: \"center\",\n position: \"relative\",\n minHeight: theme.sizes.sm,\n },\n content: {\n marginTop: theme.space.sm,\n },\n actions: {\n display: \"flex\",\n gap: theme.space.xs,\n position: \"absolute\",\n right: 0,\n },\n});\n"],"names":["createClasses","theme"],"mappings":";;;;AAIO,MAAM,EAAE,eAAe,eAAeA,QAAAA,cAAc,aAAa;AAAA,EACtE,MAAM;AAAA,IACJ,OAAO;AAAA,IACP,SAAS;AAAA,IACT,eAAe;AAAA,IACf,SAASC,YAAAA,MAAM,MAAM;AAAA,IACrB,iBAAiBA,YAAAA,MAAM,OAAO;AAAA,IAC9B,cAAcA,YAAAA,MAAM,MAAM;AAAA,IAC1B,QAAQ,aAAaA,YAAM,MAAA,OAAO,KAAK;AAAA,EACzC;AAAA,EACA,QAAQ,EAAE,QAAQ,GAAG,SAAS,OAAO;AAAA,EACrC,QAAQ;AAAA,IACN,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,WAAWA,YAAAA,MAAM,MAAM;AAAA,EACzB;AAAA,EACA,SAAS;AAAA,IACP,WAAWA,YAAAA,MAAM,MAAM;AAAA,EACzB;AAAA,EACA,SAAS;AAAA,IACP,SAAS;AAAA,IACT,KAAKA,YAAAA,MAAM,MAAM;AAAA,IACjB,UAAU;AAAA,IACV,OAAO;AAAA,EACT;AACF,CAAC;;;"}
1
+ {"version":3,"file":"Section.styles.cjs","sources":["../../../src/Section/Section.styles.tsx"],"sourcesContent":["import { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { createClasses } from \"../utils/classes\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvSection\", {\n root: {\n width: \"100%\",\n display: \"flex\",\n flexDirection: \"column\",\n backgroundColor: theme.colors.atmo1,\n borderRadius: theme.radii.round,\n border: `1px solid ${theme.colors.atmo4}`,\n },\n hidden: { height: 0, display: \"none\" },\n header: {\n display: \"flex\",\n alignItems: \"center\",\n position: \"relative\",\n minHeight: theme.sizes.sm,\n padding: theme.space.sm,\n },\n content: {\n padding: theme.spacing(0, \"sm\", \"sm\", \"sm\"),\n },\n spaceTop: {\n paddingTop: theme.space.sm,\n },\n actions: {\n display: \"flex\",\n gap: theme.space.xs,\n position: \"absolute\",\n right: 0,\n },\n raisedHeader: {\n zIndex: 1,\n boxShadow: theme.colors.shadow,\n \"+ div\": {\n paddingTop: theme.space.sm,\n },\n },\n});\n"],"names":["createClasses","theme"],"mappings":";;;;AAIO,MAAM,EAAE,eAAe,eAAeA,QAAAA,cAAc,aAAa;AAAA,EACtE,MAAM;AAAA,IACJ,OAAO;AAAA,IACP,SAAS;AAAA,IACT,eAAe;AAAA,IACf,iBAAiBC,YAAAA,MAAM,OAAO;AAAA,IAC9B,cAAcA,YAAAA,MAAM,MAAM;AAAA,IAC1B,QAAQ,aAAaA,YAAM,MAAA,OAAO,KAAK;AAAA,EACzC;AAAA,EACA,QAAQ,EAAE,QAAQ,GAAG,SAAS,OAAO;AAAA,EACrC,QAAQ;AAAA,IACN,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,WAAWA,YAAAA,MAAM,MAAM;AAAA,IACvB,SAASA,YAAAA,MAAM,MAAM;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACP,SAASA,YAAM,MAAA,QAAQ,GAAG,MAAM,MAAM,IAAI;AAAA,EAC5C;AAAA,EACA,UAAU;AAAA,IACR,YAAYA,YAAAA,MAAM,MAAM;AAAA,EAC1B;AAAA,EACA,SAAS;AAAA,IACP,SAAS;AAAA,IACT,KAAKA,YAAAA,MAAM,MAAM;AAAA,IACjB,UAAU;AAAA,IACV,OAAO;AAAA,EACT;AAAA,EACA,cAAc;AAAA,IACZ,QAAQ;AAAA,IACR,WAAWA,YAAAA,MAAM,OAAO;AAAA,IACxB,SAAS;AAAA,MACP,YAAYA,YAAAA,MAAM,MAAM;AAAA,IAC1B;AAAA,EACF;AACF,CAAC;;;"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("@emotion/react/jsx-runtime");
4
+ const React = require("react");
5
+ const useDefaultProps = require("../hooks/useDefaultProps.cjs");
6
+ const useUniqueId = require("../hooks/useUniqueId.cjs");
7
+ const TableSection_styles = require("./TableSection.styles.cjs");
8
+ const Section = require("../Section/Section.cjs");
9
+ const HvTableSection = React.forwardRef(
10
+ (props, ref) => {
11
+ const {
12
+ id,
13
+ classes: classesProp,
14
+ children,
15
+ ...others
16
+ } = useDefaultProps.useDefaultProps("HvTableSection", props);
17
+ const { classes } = TableSection_styles.useClasses(classesProp);
18
+ const elementId = useUniqueId.useUniqueId(id, "hvTableSection");
19
+ return /* @__PURE__ */ jsxRuntime.jsx(Section.HvSection, { id: elementId, ref, classes, ...others, children });
20
+ }
21
+ );
22
+ exports.tableSectionClasses = TableSection_styles.staticClasses;
23
+ exports.HvTableSection = HvTableSection;
24
+ //# sourceMappingURL=TableSection.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableSection.cjs","sources":["../../../src/TableSection/TableSection.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\n\nimport { ExtractNames } from \"../utils/classes\";\nimport { useDefaultProps } from \"../hooks/useDefaultProps\";\nimport { useUniqueId } from \"../hooks/useUniqueId\";\nimport { staticClasses, useClasses } from \"./TableSection.styles\";\nimport { HvSection, HvSectionProps } from \"../Section\";\n\nexport { staticClasses as tableSectionClasses };\n\nexport type HvTableSectionClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTableSectionProps extends HvSectionProps {}\n\n/**\n * The `TableSection` component is a wrapper for the `Section` component that applies\n * specific stylings for tables that follow the latest DS specifications.\n */\nexport const HvTableSection = forwardRef<HTMLDivElement, HvTableSectionProps>(\n (props, ref) => {\n const {\n id,\n classes: classesProp,\n children,\n ...others\n } = useDefaultProps(\"HvTableSection\", props);\n\n const { classes } = useClasses(classesProp);\n const elementId = useUniqueId(id, \"hvTableSection\");\n\n return (\n <HvSection id={elementId} ref={ref} classes={classes} {...others}>\n {children}\n </HvSection>\n );\n }\n);\n"],"names":["forwardRef","useDefaultProps","useClasses","useUniqueId","jsx","HvSection"],"mappings":";;;;;;;;AAkBO,MAAM,iBAAiBA,MAAA;AAAA,EAC5B,CAAC,OAAO,QAAQ;AACR,UAAA;AAAA,MACJ;AAAA,MACA,SAAS;AAAA,MACT;AAAA,MACA,GAAG;AAAA,IAAA,IACDC,gBAAgB,gBAAA,kBAAkB,KAAK;AAE3C,UAAM,EAAE,QAAA,IAAYC,oBAAA,WAAW,WAAW;AACpC,UAAA,YAAYC,YAAAA,YAAY,IAAI,gBAAgB;AAGhD,WAAAC,+BAACC,QAAAA,aAAU,IAAI,WAAW,KAAU,SAAmB,GAAG,QACvD,SACH,CAAA;AAAA,EAEJ;AACF;;;"}
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const uikitStyles = require("@hitachivantara/uikit-styles");
4
+ const classes = require("../utils/classes.cjs");
5
+ const Section_styles = require("../Section/Section.styles.cjs");
6
+ require("../Section/Section.cjs");
7
+ const TableContainer_styles = require("../Table/TableContainer/TableContainer.styles.cjs");
8
+ require("../Table/TableContainer/TableContainer.cjs");
9
+ const TableHeader_styles = require("../Table/TableHeader/TableHeader.styles.cjs");
10
+ require("../Table/TableHeader/TableHeader.cjs");
11
+ const TableCell_styles = require("../Table/TableCell/TableCell.styles.cjs");
12
+ require("../Table/TableCell/TableCell.cjs");
13
+ const BulkActions_styles = require("../BulkActions/BulkActions.styles.cjs");
14
+ require("@emotion/react/jsx-runtime");
15
+ const Pagination_styles = require("../Pagination/Pagination.styles.cjs");
16
+ require("react");
17
+ require("@mui/material/Hidden");
18
+ require("@hitachivantara/uikit-react-icons");
19
+ const { staticClasses, useClasses } = classes.createClasses("HvTableSection", {
20
+ root: {
21
+ padding: 0
22
+ },
23
+ header: {
24
+ padding: uikitStyles.theme.spacing("xs", "xs", "xs", "sm"),
25
+ borderBottom: `1px solid ${uikitStyles.theme.colors.atmo3}`,
26
+ [`&.${Section_styles.staticClasses.raisedHeader}`]: {
27
+ "+ div": {
28
+ paddingTop: `0`
29
+ }
30
+ }
31
+ },
32
+ actions: {
33
+ right: uikitStyles.theme.space.sm
34
+ },
35
+ content: {
36
+ marginTop: 0,
37
+ padding: 0,
38
+ [`&&`]: {
39
+ paddingTop: 0
40
+ },
41
+ [`& .${TableContainer_styles.staticClasses.root}`]: {
42
+ paddingBottom: 0,
43
+ borderRadius: `${uikitStyles.theme.radii.round} ${uikitStyles.theme.radii.round} 0 0`
44
+ },
45
+ [`& .${TableHeader_styles.staticClasses.head}`]: {
46
+ backgroundColor: uikitStyles.theme.colors.atmo2,
47
+ borderBottomColor: uikitStyles.theme.colors.atmo3,
48
+ [`&.${TableHeader_styles.staticClasses.variantCheckbox}`]: {
49
+ borderRight: "none"
50
+ }
51
+ },
52
+ [`& .${TableCell_styles.staticClasses.root}`]: {
53
+ borderBottomColor: uikitStyles.theme.colors.atmo3
54
+ },
55
+ [`& .${TableCell_styles.staticClasses.variantCheckbox}`]: {
56
+ borderRight: "none"
57
+ },
58
+ [`& .${BulkActions_styles.staticClasses.root}`]: {
59
+ marginBottom: 0,
60
+ border: "none",
61
+ borderBottom: `1px solid ${uikitStyles.theme.colors.atmo3}`,
62
+ padding: uikitStyles.theme.spacing("xs", "sm"),
63
+ borderRadius: `${uikitStyles.theme.radii.round} ${uikitStyles.theme.radii.round} 0 0`
64
+ },
65
+ [`& .${Pagination_styles.staticClasses.root}`]: {
66
+ margin: 0,
67
+ backgroundColor: uikitStyles.theme.colors.atmo2,
68
+ padding: uikitStyles.theme.space.xs,
69
+ borderRadius: `0 0 ${uikitStyles.theme.radii.round} ${uikitStyles.theme.radii.round}`
70
+ },
71
+ [`& .${Pagination_styles.staticClasses.pageSizeOptions}`]: {
72
+ left: uikitStyles.theme.space.sm
73
+ }
74
+ },
75
+ hidden: {},
76
+ raisedHeader: {},
77
+ spaceTop: {}
78
+ });
79
+ exports.staticClasses = staticClasses;
80
+ exports.useClasses = useClasses;
81
+ //# sourceMappingURL=TableSection.styles.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableSection.styles.cjs","sources":["../../../src/TableSection/TableSection.styles.tsx"],"sourcesContent":["import { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { bulkActionsClasses } from \"../BulkActions\";\nimport { paginationClasses } from \"../Pagination\";\nimport { sectionClasses } from \"../Section\";\n\nimport { tableCellClasses } from \"../Table/TableCell\";\nimport { tableContainerClasses } from \"../Table/TableContainer\";\nimport { tableHeaderClasses } from \"../Table/TableHeader\";\n\nimport { createClasses } from \"../utils/classes\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvTableSection\", {\n root: {\n padding: 0,\n },\n header: {\n padding: theme.spacing(\"xs\", \"xs\", \"xs\", \"sm\"),\n borderBottom: `1px solid ${theme.colors.atmo3}`,\n [`&.${sectionClasses.raisedHeader}`]: {\n \"+ div\": {\n paddingTop: `0`,\n },\n },\n },\n actions: {\n right: theme.space.sm,\n },\n content: {\n marginTop: 0,\n padding: 0,\n [`&&`]: {\n paddingTop: 0,\n },\n [`& .${tableContainerClasses.root}`]: {\n paddingBottom: 0,\n borderRadius: `${theme.radii.round} ${theme.radii.round} 0 0`,\n },\n [`& .${tableHeaderClasses.head}`]: {\n backgroundColor: theme.colors.atmo2,\n borderBottomColor: theme.colors.atmo3,\n [`&.${tableHeaderClasses.variantCheckbox}`]: {\n borderRight: \"none\",\n },\n },\n [`& .${tableCellClasses.root}`]: {\n borderBottomColor: theme.colors.atmo3,\n },\n [`& .${tableCellClasses.variantCheckbox}`]: {\n borderRight: \"none\",\n },\n [`& .${bulkActionsClasses.root}`]: {\n marginBottom: 0,\n border: \"none\",\n borderBottom: `1px solid ${theme.colors.atmo3}`,\n padding: theme.spacing(\"xs\", \"sm\"),\n borderRadius: `${theme.radii.round} ${theme.radii.round} 0 0`,\n },\n [`& .${paginationClasses.root}`]: {\n margin: 0,\n backgroundColor: theme.colors.atmo2,\n padding: theme.space.xs,\n borderRadius: `0 0 ${theme.radii.round} ${theme.radii.round}`,\n },\n [`& .${paginationClasses.pageSizeOptions}`]: {\n left: theme.space.sm,\n },\n },\n hidden: {},\n raisedHeader: {},\n spaceTop: {},\n});\n"],"names":["createClasses","theme","sectionClasses","tableContainerClasses","tableHeaderClasses","tableCellClasses","bulkActionsClasses","paginationClasses"],"mappings":";;;;;;;;;;;;;;;;;;AAYO,MAAM,EAAE,eAAe,eAAeA,QAAAA,cAAc,kBAAkB;AAAA,EAC3E,MAAM;AAAA,IACJ,SAAS;AAAA,EACX;AAAA,EACA,QAAQ;AAAA,IACN,SAASC,Y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ACA,CAAC,MAAMM,gCAAkB,IAAI,EAAE,GAAG;AAAA,MAChC,QAAQ;AAAA,MACR,iBAAiBN,YAAAA,MAAM,OAAO;AAAA,MAC9B,SAASA,YAAAA,MAAM,MAAM;AAAA,MACrB,cAAc,OAAOA,YAAAA,MAAM,MAAM,KAAK,IAAIA,YAAA,MAAM,MAAM,KAAK;AAAA,IAC7D;AAAA,IACA,CAAC,MAAMM,gCAAkB,eAAe,EAAE,GAAG;AAAA,MAC3C,MAAMN,YAAAA,MAAM,MAAM;AAAA,IACpB;AAAA,EACF;AAAA,EACA,QAAQ,CAAC;AAAA,EACT,cAAc,CAAC;AAAA,EACf,UAAU,CAAC;AACb,CAAC;;;"}
@@ -1,13 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const React = require("react");
4
- const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
5
- const React__default = /* @__PURE__ */ _interopDefault(React);
6
4
  function useLabels(defaultLabels, labels) {
7
- const merged = React__default.default.useMemo(() => {
5
+ return React.useMemo(() => {
8
6
  return { ...defaultLabels, ...labels };
9
7
  }, [defaultLabels, labels]);
10
- return merged;
11
8
  }
12
9
  exports.useLabels = useLabels;
13
10
  //# sourceMappingURL=useLabels.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useLabels.cjs","sources":["../../../src/hooks/useLabels.ts"],"sourcesContent":["import React from \"react\";\n\nexport function useLabels<T>(defaultLabels: Partial<T>, labels: T): T {\n const merged = React.useMemo(() => {\n return { ...defaultLabels, ...labels };\n }, [defaultLabels, labels]);\n\n return merged;\n}\n"],"names":["React"],"mappings":";;;;;AAEgB,SAAA,UAAa,eAA2B,QAAc;AAC9D,QAAA,SAASA,uBAAM,QAAQ,MAAM;AACjC,WAAO,EAAE,GAAG,eAAe,GAAG;EAAO,GACpC,CAAC,eAAe,MAAM,CAAC;AAEnB,SAAA;AACT;;"}
1
+ {"version":3,"file":"useLabels.cjs","sources":["../../../src/hooks/useLabels.ts"],"sourcesContent":["import { useMemo } from \"react\";\n\nexport function useLabels<T>(defaultLabels: T, labels?: Partial<T>): T {\n return useMemo(() => {\n return { ...defaultLabels, ...labels };\n }, [defaultLabels, labels]);\n}\n"],"names":["useMemo"],"mappings":";;;AAEgB,SAAA,UAAa,eAAkB,QAAwB;AACrE,SAAOA,cAAQ,MAAM;AACnB,WAAO,EAAE,GAAG,eAAe,GAAG;EAAO,GACpC,CAAC,eAAe,MAAM,CAAC;AAC5B;;"}
@@ -302,6 +302,8 @@ const TreeView$1 = require("./VerticalNavigation/TreeView/TreeView.cjs");
302
302
  const TreeViewItem_styles = require("./VerticalNavigation/TreeView/TreeViewItem.styles.cjs");
303
303
  const TreeViewItem = require("./VerticalNavigation/TreeView/TreeViewItem.cjs");
304
304
  const VerticalNavigationContext = require("./VerticalNavigation/VerticalNavigationContext.cjs");
305
+ const TableSection_styles = require("./TableSection/TableSection.styles.cjs");
306
+ const TableSection = require("./TableSection/TableSection.cjs");
305
307
  const uikitReactShared = require("@hitachivantara/uikit-react-shared");
306
308
  Object.defineProperty(exports, "ds3", {
307
309
  enumerable: true,
@@ -673,6 +675,8 @@ exports.HvVerticalNavigationTreeView = TreeView$1.HvVerticalNavigationTreeView;
673
675
  exports.treeViewItemClasses = TreeViewItem_styles.staticClasses;
674
676
  exports.HvVerticalNavigationTreeViewItem = TreeViewItem.HvVerticalNavigationTreeViewItem;
675
677
  exports.VerticalNavigationContext = VerticalNavigationContext.VerticalNavigationContext;
678
+ exports.tableSectionClasses = TableSection_styles.staticClasses;
679
+ exports.HvTableSection = TableSection.HvTableSection;
676
680
  Object.defineProperty(exports, "EmotionContext", {
677
681
  enumerable: true,
678
682
  get: () => uikitReactShared.EmotionContext
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -193,7 +193,7 @@ const HvColorPicker = forwardRef(
193
193
  className: classes.recommendedColorsRoot,
194
194
  colors: recommendedColors,
195
195
  onClick: handleSelect,
196
- title: showLabels ? labels?.recommendedColorsLabel : void 0
196
+ title: showLabels ? labels.recommendedColorsLabel : void 0
197
197
  }
198
198
  ),
199
199
  showCustomColors && /* @__PURE__ */ jsx(
@@ -204,7 +204,7 @@ const HvColorPicker = forwardRef(
204
204
  [classes.pickerFields]: recommendedColorsPosition === "bottom" || showSavedColors
205
205
  })
206
206
  },
207
- title: showLabels ? labels?.customColorsLabel : void 0,
207
+ title: showLabels ? labels.customColorsLabel : void 0,
208
208
  color,
209
209
  onChange: handleOnChange,
210
210
  onChangeComplete: handleOnChangeComplete
@@ -226,7 +226,7 @@ const HvColorPicker = forwardRef(
226
226
  {
227
227
  colors: recommendedColors,
228
228
  onClick: handleSelect,
229
- title: showLabels ? labels?.recommendedColorsLabel : void 0
229
+ title: showLabels ? labels.recommendedColorsLabel : void 0
230
230
  }
231
231
  )
232
232
  ] }) })
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPicker.js","sources":["../../../src/ColorPicker/ColorPicker.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\n\nimport { ColorState } from \"react-color\";\n\nimport { Checkbox, ColorPicker } from \"@hitachivantara/uikit-react-icons\";\n\nimport { useDefaultProps } from \"../hooks/useDefaultProps\";\nimport { useControlled } from \"../hooks/useControlled\";\nimport { useUniqueId } from \"../hooks/useUniqueId\";\nimport { useLabels } from \"../hooks/useLabels\";\nimport { ExtractNames } from \"../utils/classes\";\nimport { setId } from \"../utils/setId\";\nimport { HvTypography } from \"../Typography\";\nimport { HvPanel } from \"../Panel\";\nimport { HvFormElement, HvInfoMessage, HvLabel } from \"../Forms\";\nimport { HvBaseDropdown } from \"../BaseDropdown\";\nimport { HvDropdownProps } from \"../Dropdown\";\n\nimport { Picker } from \"./Picker\";\nimport { staticClasses, useClasses } from \"./ColorPicker.styles\";\nimport { PresetColors } from \"./PresetColors\";\nimport { SavedColors } from \"./SavedColors\";\n\nexport { staticClasses as colorPickerClasses };\n\nexport type HvColorPickerClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvColorPickerProps {\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n \"aria-describedby\"?: string;\n /** Class names to be applied. */\n className?: string;\n /** Id to be applied to the form element root node. */\n id?: string;\n /** The form element name. */\n name?: string;\n /**\n * The label of the form element.\n *\n * The form element must be labeled for accessibility reasons.\n * If not provided, an aria-label or aria-labelledby must be provided instead.\n */\n label?: React.ReactNode;\n /** Provide additional descriptive text for the form element. */\n description?: React.ReactNode;\n /** Indicates that user input is required on the form element. */\n required?: boolean;\n /** The value color, in HEX format. */\n value?: string;\n /** The default value color, in HEX format. */\n defaultValue?: string;\n /** If `true` the dropdown is disabled unable to be interacted, if `false` it is enabled. */\n disabled?: boolean;\n /** If `true` the dropdown starts opened if `false` it starts closed. */\n expanded?: boolean;\n /** When uncontrolled, defines the initial expanded state. */\n defaultExpanded?: boolean;\n /** A function to be executed whenever the color changes. */\n onChange?: (color: string) => void;\n /** A function to be executed whenever the color change is complete. */\n onChangeComplete?: (color: string) => void;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvColorPickerClasses;\n /** The placeholder value when nothing is selected. */\n placeholder?: string;\n /** Recommended colors. The colors are HEX values. */\n recommendedColors?: string[];\n /** Recommended colors position. */\n recommendedColorsPosition?: \"top\" | \"bottom\";\n /** If `true`, the labels are shown. If `false`, they are not shown. */\n showLabels?: boolean;\n /** An object containing all the labels. */\n labels?: {\n recommendedColorsLabel?: string;\n customColorsLabel?: string;\n };\n /** Icon type for the input's end adornment. */\n dropdownIcon?: \"arrow\" | \"colorPicker\";\n /** If `true`, the input only shows an icon. If `false`, the input shows text and icons. */\n iconOnly?: boolean;\n /** If `true`, the saved colors area is shown. If `false`, it is not shown. */\n showSavedColors?: boolean;\n /** If `true`, the custom colors area is shown. If `false`, it is not shown. */\n showCustomColors?: boolean;\n /** The saved colors. The colors are HEX values. */\n savedColorsValue?: string[];\n /** The default saved colors. The colors are HEX values. */\n defaultSavedColorsValue?: string[];\n /** Callback fired when a new saved color is added. */\n onSavedColorAdded?: (color?: string) => void;\n /** Callback fired when a new saved color is removed. */\n onSavedColorRemoved?: (color?: string) => void;\n /** Aria label to apply to delete saved color button. */\n deleteSavedColorButtonArialLabel?: string; // TODO: fix typo \"ArialLabel\" in next version\n /** Aria label to apply to add saved color button. */\n addSavedColorButtonAriaLabel?: string;\n}\n\nconst DEFAULT_LABELS: HvColorPickerProps[\"labels\"] = {\n recommendedColorsLabel: \"Recommended colors:\",\n customColorsLabel: \"Custom colors:\",\n};\n\n/**\n * A color picker component which allows the user to select a color from a list of pre-defined colors or freely select one color via the Hue and Saturation.\n * It receives a color string in HEX format and outputs an HEX formatted color.\n */\nexport const HvColorPicker = forwardRef<HTMLDivElement, HvColorPickerProps>(\n (props, ref) => {\n const {\n id,\n name,\n required = false,\n disabled = false,\n label,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n description,\n \"aria-describedby\": ariaDescribedBy,\n className,\n classes: classesProp,\n value,\n onChange,\n onChangeComplete,\n defaultValue = \"\",\n expanded,\n defaultExpanded = false,\n recommendedColorsPosition = \"top\",\n recommendedColors = [\n \"#95AFE8\",\n \"#E89E5D\",\n \"#83B8A6\",\n \"#70759C\",\n \"#C57E7E\",\n \"#FADA95\",\n \"#ADBFE8\",\n \"#E3B386\",\n \"#9AC6B7\",\n \"#8B90AF\",\n \"#CF9797\",\n \"#FAE1AA\",\n ],\n showLabels = true,\n labels: labelsProp,\n dropdownIcon = \"colorPicker\",\n placeholder = \"Select color...\",\n iconOnly = false,\n showSavedColors = true,\n showCustomColors = true,\n savedColorsValue,\n defaultSavedColorsValue = [],\n onSavedColorAdded,\n onSavedColorRemoved,\n deleteSavedColorButtonArialLabel = \"Delete saved color\",\n addSavedColorButtonAriaLabel = \"Add current color to saved colors\",\n } = useDefaultProps(\"HvColorPicker\", props);\n\n const { classes, css, cx } = useClasses(classesProp);\n\n const labels = useLabels(DEFAULT_LABELS, labelsProp);\n\n const [isOpen, setIsOpen] = useControlled(\n expanded,\n Boolean(defaultExpanded)\n );\n const [color, setColor] = useControlled(value, defaultValue);\n const [savedColors, setSavedColors] = useControlled(\n savedColorsValue,\n defaultSavedColorsValue\n );\n const elementId = useUniqueId(id, \"hvdropdown\");\n const hasLabel = label != null;\n const hasDescription = description != null;\n\n const handleToggle: HvDropdownProps[\"onToggle\"] = (_, open) => {\n setIsOpen(open);\n };\n\n const handleSelect = (\n val: ColorState | { hex: string; source: string }\n ) => {\n onChange?.(val.hex);\n onChangeComplete?.(val.hex);\n setColor(val.hex);\n };\n\n const handleOnChange = (\n val: ColorState | { hex: string; source: string }\n ) => {\n onChange?.(val.hex);\n setColor(val.hex);\n };\n\n const handleOnChangeComplete = (\n val: ColorState | { hex: string; source: string }\n ) => {\n onChangeComplete?.(val.hex);\n setColor(val.hex);\n };\n\n const handleAddColor = () => {\n // When no color is provided, react-color sets the picker to #000000.\n // This is the color that should be added in this case.\n const colorToAdd = color || \"#000000\";\n\n onSavedColorAdded?.(colorToAdd);\n setSavedColors([...savedColors, colorToAdd]);\n };\n\n const handleRemoveColor = (val: string, position: number) => {\n if (savedColors[position] === val) {\n const sColors = [...savedColors];\n sColors.splice(position, 1);\n onSavedColorRemoved?.(val);\n setSavedColors(sColors);\n }\n };\n\n const setFocusToContent = (containerRef: HTMLElement | null) => {\n const inputs = containerRef?.getElementsByTagName(\"input\");\n if (inputs && inputs.length > 0) {\n inputs[0].focus();\n }\n };\n\n return (\n <HvFormElement\n id={id}\n name={name}\n disabled={disabled}\n required={required}\n className={cx(classes.root, className)}\n >\n {(hasLabel || hasDescription) && (\n <div className={classes.labelContainer}>\n {hasLabel && (\n <HvLabel\n id={setId(elementId, \"label\")}\n label={label}\n className={classes.label}\n />\n )}\n\n {hasDescription && (\n <HvInfoMessage\n id={setId(elementId, \"description\")}\n className={classes.description}\n >\n {description}\n </HvInfoMessage>\n )}\n </div>\n )}\n <HvBaseDropdown\n ref={ref}\n variableWidth\n className={className}\n expanded={isOpen}\n onToggle={handleToggle}\n onContainerCreation={setFocusToContent}\n classes={{\n root: cx({ [classes.dropdownRootIconOnly]: iconOnly }),\n selection: cx(iconOnly && css({ padding: 0 })),\n }}\n adornment={\n iconOnly && color ? (\n <Checkbox\n className={classes.headerColorIconOnly}\n color={[color, \"transparent\"]}\n />\n ) : dropdownIcon === \"colorPicker\" ? (\n <ColorPicker className={classes.colorPickerIcon} />\n ) : undefined\n }\n placeholder={\n iconOnly ? undefined : color ? (\n <>\n <Checkbox\n className={classes.headerColorIcon}\n color={[color, \"transparent\"]}\n />\n <HvTypography\n className={classes.headerColorValue}\n variant=\"label\"\n >\n {color}\n </HvTypography>\n </>\n ) : (\n placeholder\n )\n }\n aria-label={ariaLabel}\n aria-labelledby={\n [label && setId(elementId, \"label\"), ariaLabelledBy]\n .join(\" \")\n .trim() || undefined\n }\n aria-describedby={\n [description && setId(elementId, \"description\"), ariaDescribedBy]\n .join(\" \")\n .trim() || undefined\n }\n >\n <HvPanel className={classes.panel}>\n <div className={classes.colorPicker}>\n {recommendedColorsPosition === \"top\" && (\n <PresetColors\n className={classes.recommendedColorsRoot}\n colors={recommendedColors}\n onClick={handleSelect}\n title={\n showLabels ? labels?.recommendedColorsLabel : undefined\n }\n />\n )}\n {showCustomColors && (\n <Picker\n classes={{\n fields: cx({\n [classes.pickerFields]:\n recommendedColorsPosition === \"bottom\" ||\n showSavedColors,\n }),\n }}\n title={showLabels ? labels?.customColorsLabel : undefined}\n color={color}\n onChange={handleOnChange}\n onChangeComplete={handleOnChangeComplete}\n />\n )}\n {showSavedColors && (\n <SavedColors\n colors={savedColors}\n onAddColor={handleAddColor}\n onClickColor={handleSelect}\n onRemoveColor={handleRemoveColor}\n deleteButtonAriaLabel={deleteSavedColorButtonArialLabel}\n addButtonAriaLabel={addSavedColorButtonAriaLabel}\n />\n )}\n {recommendedColorsPosition === \"bottom\" && (\n <PresetColors\n colors={recommendedColors}\n onClick={handleSelect}\n title={\n showLabels ? labels?.recommendedColorsLabel : undefined\n }\n />\n )}\n </div>\n </HvPanel>\n </HvBaseDropdown>\n </HvFormElement>\n );\n }\n);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAmGA,MAAM,iBAA+C;AAAA,EACnD,wBAAwB;AAAA,EACxB,mBAAmB;AACrB;AAMO,MAAM,gBAAgB;AAAA,EAC3B,CAAC,OAAO,QAAQ;AACR,UAAA;AAAA,MACJ;AAAA,MACA;AAAA,MACA,WAAW;AAAA,MACX,WAAW;AAAA,MACX;AAAA,MACA,cAAc;AAAA,MACd,mBAAmB;AAAA,MACnB;AAAA,MACA,oBAAoB;AAAA,MACpB;AAAA,MACA,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA,eAAe;AAAA,MACf;AAAA,MACA,kBAAkB;AAAA,MAClB,4BAA4B;AAAA,MAC5B,oBAAoB;AAAA,QAClB;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MACA,aAAa;AAAA,MACb,QAAQ;AAAA,MACR,eAAe;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BACR,YAAY;AAAA,oBACZ,cAAc;AAAA,oBACd,eAAe;AAAA,oBACf,uBAAuB;AAAA,oBACvB,oBAAoB;AAAA,kBAAA;AAAA,gBACtB;AAAA,gBAED,8BAA8B,YAC7B;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,QAAQ;AAAA,oBACR,SAAS;AAAA,oBACT,OACE,aAAa,QAAQ,yBAAyB;AAAA,kBAAA;AAAA,gBAElD;AAAA,cAAA,EAAA,CAEJ,EACF,CAAA;AAAA,YAAA;AAAA,UACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;"}
1
+ {"version":3,"file":"ColorPicker.js","sources":["../../../src/ColorPicker/ColorPicker.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\n\nimport { ColorState } from \"react-color\";\n\nimport { Checkbox, ColorPicker } from \"@hitachivantara/uikit-react-icons\";\n\nimport { useDefaultProps } from \"../hooks/useDefaultProps\";\nimport { useControlled } from \"../hooks/useControlled\";\nimport { useUniqueId } from \"../hooks/useUniqueId\";\nimport { useLabels } from \"../hooks/useLabels\";\nimport { ExtractNames } from \"../utils/classes\";\nimport { setId } from \"../utils/setId\";\nimport { HvTypography } from \"../Typography\";\nimport { HvPanel } from \"../Panel\";\nimport { HvFormElement, HvInfoMessage, HvLabel } from \"../Forms\";\nimport { HvBaseDropdown } from \"../BaseDropdown\";\nimport { HvDropdownProps } from \"../Dropdown\";\n\nimport { Picker } from \"./Picker\";\nimport { staticClasses, useClasses } from \"./ColorPicker.styles\";\nimport { PresetColors } from \"./PresetColors\";\nimport { SavedColors } from \"./SavedColors\";\n\nexport { staticClasses as colorPickerClasses };\n\nexport type HvColorPickerClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvColorPickerProps {\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n \"aria-describedby\"?: string;\n /** Class names to be applied. */\n className?: string;\n /** Id to be applied to the form element root node. */\n id?: string;\n /** The form element name. */\n name?: string;\n /**\n * The label of the form element.\n *\n * The form element must be labeled for accessibility reasons.\n * If not provided, an aria-label or aria-labelledby must be provided instead.\n */\n label?: React.ReactNode;\n /** Provide additional descriptive text for the form element. */\n description?: React.ReactNode;\n /** Indicates that user input is required on the form element. */\n required?: boolean;\n /** The value color, in HEX format. */\n value?: string;\n /** The default value color, in HEX format. */\n defaultValue?: string;\n /** If `true` the dropdown is disabled unable to be interacted, if `false` it is enabled. */\n disabled?: boolean;\n /** If `true` the dropdown starts opened if `false` it starts closed. */\n expanded?: boolean;\n /** When uncontrolled, defines the initial expanded state. */\n defaultExpanded?: boolean;\n /** A function to be executed whenever the color changes. */\n onChange?: (color: string) => void;\n /** A function to be executed whenever the color change is complete. */\n onChangeComplete?: (color: string) => void;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvColorPickerClasses;\n /** The placeholder value when nothing is selected. */\n placeholder?: string;\n /** Recommended colors. The colors are HEX values. */\n recommendedColors?: string[];\n /** Recommended colors position. */\n recommendedColorsPosition?: \"top\" | \"bottom\";\n /** If `true`, the labels are shown. If `false`, they are not shown. */\n showLabels?: boolean;\n /** An object containing all the labels. */\n labels?: Partial<typeof DEFAULT_LABELS>;\n /** Icon type for the input's end adornment. */\n dropdownIcon?: \"arrow\" | \"colorPicker\";\n /** If `true`, the input only shows an icon. If `false`, the input shows text and icons. */\n iconOnly?: boolean;\n /** If `true`, the saved colors area is shown. If `false`, it is not shown. */\n showSavedColors?: boolean;\n /** If `true`, the custom colors area is shown. If `false`, it is not shown. */\n showCustomColors?: boolean;\n /** The saved colors. The colors are HEX values. */\n savedColorsValue?: string[];\n /** The default saved colors. The colors are HEX values. */\n defaultSavedColorsValue?: string[];\n /** Callback fired when a new saved color is added. */\n onSavedColorAdded?: (color?: string) => void;\n /** Callback fired when a new saved color is removed. */\n onSavedColorRemoved?: (color?: string) => void;\n /** Aria label to apply to delete saved color button. */\n deleteSavedColorButtonArialLabel?: string; // TODO: fix typo \"ArialLabel\" in next version\n /** Aria label to apply to add saved color button. */\n addSavedColorButtonAriaLabel?: string;\n}\n\nconst DEFAULT_LABELS = {\n recommendedColorsLabel: \"Recommended colors:\",\n customColorsLabel: \"Custom colors:\",\n};\n\n/**\n * A color picker component which allows the user to select a color from a list of pre-defined colors or freely select one color via the Hue and Saturation.\n * It receives a color string in HEX format and outputs an HEX formatted color.\n */\nexport const HvColorPicker = forwardRef<HTMLDivElement, HvColorPickerProps>(\n (props, ref) => {\n const {\n id,\n name,\n required = false,\n disabled = false,\n label,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n description,\n \"aria-describedby\": ariaDescribedBy,\n className,\n classes: classesProp,\n value,\n onChange,\n onChangeComplete,\n defaultValue = \"\",\n expanded,\n defaultExpanded = false,\n recommendedColorsPosition = \"top\",\n recommendedColors = [\n \"#95AFE8\",\n \"#E89E5D\",\n \"#83B8A6\",\n \"#70759C\",\n \"#C57E7E\",\n \"#FADA95\",\n \"#ADBFE8\",\n \"#E3B386\",\n \"#9AC6B7\",\n \"#8B90AF\",\n \"#CF9797\",\n \"#FAE1AA\",\n ],\n showLabels = true,\n labels: labelsProp,\n dropdownIcon = \"colorPicker\",\n placeholder = \"Select color...\",\n iconOnly = false,\n showSavedColors = true,\n showCustomColors = true,\n savedColorsValue,\n defaultSavedColorsValue = [],\n onSavedColorAdded,\n onSavedColorRemoved,\n deleteSavedColorButtonArialLabel = \"Delete saved color\",\n addSavedColorButtonAriaLabel = \"Add current color to saved colors\",\n } = useDefaultProps(\"HvColorPicker\", props);\n\n const { classes, css, cx } = useClasses(classesProp);\n\n const labels = useLabels(DEFAULT_LABELS, labelsProp);\n\n const [isOpen, setIsOpen] = useControlled(\n expanded,\n Boolean(defaultExpanded)\n );\n const [color, setColor] = useControlled(value, defaultValue);\n const [savedColors, setSavedColors] = useControlled(\n savedColorsValue,\n defaultSavedColorsValue\n );\n const elementId = useUniqueId(id, \"hvdropdown\");\n const hasLabel = label != null;\n const hasDescription = description != null;\n\n const handleToggle: HvDropdownProps[\"onToggle\"] = (_, open) => {\n setIsOpen(open);\n };\n\n const handleSelect = (\n val: ColorState | { hex: string; source: string }\n ) => {\n onChange?.(val.hex);\n onChangeComplete?.(val.hex);\n setColor(val.hex);\n };\n\n const handleOnChange = (\n val: ColorState | { hex: string; source: string }\n ) => {\n onChange?.(val.hex);\n setColor(val.hex);\n };\n\n const handleOnChangeComplete = (\n val: ColorState | { hex: string; source: string }\n ) => {\n onChangeComplete?.(val.hex);\n setColor(val.hex);\n };\n\n const handleAddColor = () => {\n // When no color is provided, react-color sets the picker to #000000.\n // This is the color that should be added in this case.\n const colorToAdd = color || \"#000000\";\n\n onSavedColorAdded?.(colorToAdd);\n setSavedColors([...savedColors, colorToAdd]);\n };\n\n const handleRemoveColor = (val: string, position: number) => {\n if (savedColors[position] === val) {\n const sColors = [...savedColors];\n sColors.splice(position, 1);\n onSavedColorRemoved?.(val);\n setSavedColors(sColors);\n }\n };\n\n const setFocusToContent = (containerRef: HTMLElement | null) => {\n const inputs = containerRef?.getElementsByTagName(\"input\");\n if (inputs && inputs.length > 0) {\n inputs[0].focus();\n }\n };\n\n return (\n <HvFormElement\n id={id}\n name={name}\n disabled={disabled}\n required={required}\n className={cx(classes.root, className)}\n >\n {(hasLabel || hasDescription) && (\n <div className={classes.labelContainer}>\n {hasLabel && (\n <HvLabel\n id={setId(elementId, \"label\")}\n label={label}\n className={classes.label}\n />\n )}\n\n {hasDescription && (\n <HvInfoMessage\n id={setId(elementId, \"description\")}\n className={classes.description}\n >\n {description}\n </HvInfoMessage>\n )}\n </div>\n )}\n <HvBaseDropdown\n ref={ref}\n variableWidth\n className={className}\n expanded={isOpen}\n onToggle={handleToggle}\n onContainerCreation={setFocusToContent}\n classes={{\n root: cx({ [classes.dropdownRootIconOnly]: iconOnly }),\n selection: cx(iconOnly && css({ padding: 0 })),\n }}\n adornment={\n iconOnly && color ? (\n <Checkbox\n className={classes.headerColorIconOnly}\n color={[color, \"transparent\"]}\n />\n ) : dropdownIcon === \"colorPicker\" ? (\n <ColorPicker className={classes.colorPickerIcon} />\n ) : undefined\n }\n placeholder={\n iconOnly ? undefined : color ? (\n <>\n <Checkbox\n className={classes.headerColorIcon}\n color={[color, \"transparent\"]}\n />\n <HvTypography\n className={classes.headerColorValue}\n variant=\"label\"\n >\n {color}\n </HvTypography>\n </>\n ) : (\n placeholder\n )\n }\n aria-label={ariaLabel}\n aria-labelledby={\n [label && setId(elementId, \"label\"), ariaLabelledBy]\n .join(\" \")\n .trim() || undefined\n }\n aria-describedby={\n [description && setId(elementId, \"description\"), ariaDescribedBy]\n .join(\" \")\n .trim() || undefined\n }\n >\n <HvPanel className={classes.panel}>\n <div className={classes.colorPicker}>\n {recommendedColorsPosition === \"top\" && (\n <PresetColors\n className={classes.recommendedColorsRoot}\n colors={recommendedColors}\n onClick={handleSelect}\n title={showLabels ? labels.recommendedColorsLabel : undefined}\n />\n )}\n {showCustomColors && (\n <Picker\n classes={{\n fields: cx({\n [classes.pickerFields]:\n recommendedColorsPosition === \"bottom\" ||\n showSavedColors,\n }),\n }}\n title={showLabels ? labels.customColorsLabel : undefined}\n color={color}\n onChange={handleOnChange}\n onChangeComplete={handleOnChangeComplete}\n />\n )}\n {showSavedColors && (\n <SavedColors\n colors={savedColors}\n onAddColor={handleAddColor}\n onClickColor={handleSelect}\n onRemoveColor={handleRemoveColor}\n deleteButtonAriaLabel={deleteSavedColorButtonArialLabel}\n addButtonAriaLabel={addSavedColorButtonAriaLabel}\n />\n )}\n {recommendedColorsPosition === \"bottom\" && (\n <PresetColors\n colors={recommendedColors}\n onClick={handleSelect}\n title={showLabels ? labels.recommendedColorsLabel : undefined}\n />\n )}\n </div>\n </HvPanel>\n </HvBaseDropdown>\n </HvFormElement>\n );\n }\n);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAgGA,MAAM,iBAAiB;AAAA,EACrB,wBAAwB;AAAA,EACxB,mBAAmB;AACrB;AAMO,MAAM,gBAAgB;AAAA,EAC3B,CAAC,OAAO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A,kBAAA;AAAA,oBACC,WAAW,QAAQ;AAAA,oBACnB,QAAQ;AAAA,oBACR,SAAS;AAAA,oBACT,OAAO,aAAa,OAAO,yBAAyB;AAAA,kBAAA;AAAA,gBACtD;AAAA,gBAED,oBACC;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,SAAS;AAAA,sBACP,QAAQ,GAAG;AAAA,wBACT,CAAC,QAAQ,YAAY,GACnB,8BAA8B,YAC9B;AAAA,sBAAA,CACH;AAAA,oBACH;AAAA,oBACA,OAAO,aAAa,OAAO,oBAAoB;AAAA,oBAC/C;AAAA,oBACA,UAAU;AAAA,oBACV,kBAAkB;AAAA,kBAAA;AAAA,gBACpB;AAAA,gBAED,mBACC;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,QAAQ;AAAA,oBACR,YAAY;AAAA,oBACZ,cAAc;AAAA,oBACd,eAAe;AAAA,oBACf,uBAAuB;AAAA,oBACvB,oBAAoB;AAAA,kBAAA;AAAA,gBACtB;AAAA,gBAED,8BAA8B,YAC7B;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,QAAQ;AAAA,oBACR,SAAS;AAAA,oBACT,OAAO,aAAa,OAAO,yBAAyB;AAAA,kBAAA;AAAA,gBACtD;AAAA,cAAA,EAAA,CAEJ,EACF,CAAA;AAAA,YAAA;AAAA,UACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;"}
@@ -24,10 +24,14 @@ import { HvWarningText } from "../Forms/WarningText/WarningText.js";
24
24
  import { HvActionBar } from "../ActionBar/ActionBar.js";
25
25
  import { HvTypography } from "../Typography/Typography.js";
26
26
  const DEFAULT_LABELS = {
27
+ /** Apply button label. */
27
28
  applyLabel: "Apply",
29
+ /** Cancel button label. */
28
30
  cancelLabel: "Cancel",
31
+ /** Clear button label. */
29
32
  clearLabel: "Clear",
30
- invalidLabel: "Invalid date"
33
+ /** Invalid Date label. */
34
+ invalidDateLabel: "Invalid date"
31
35
  };
32
36
  const HvDatePicker = forwardRef(
33
37
  (props, ref) => {