@hitachivantara/uikit-react-core 5.10.0 → 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.
- package/dist/cjs/components/ActionsGeneric/ActionsGeneric.cjs.map +1 -1
- package/dist/cjs/components/BaseInput/BaseInput.cjs +18 -1
- package/dist/cjs/components/BaseInput/BaseInput.cjs.map +1 -1
- package/dist/cjs/components/BreadCrumb/BreadCrumb.cjs +3 -3
- package/dist/cjs/components/BreadCrumb/BreadCrumb.cjs.map +1 -1
- package/dist/cjs/components/BreadCrumb/Page/Page.cjs +22 -12
- package/dist/cjs/components/BreadCrumb/Page/Page.cjs.map +1 -1
- package/dist/cjs/components/BreadCrumb/Page/Page.styles.cjs +19 -44
- package/dist/cjs/components/BreadCrumb/Page/Page.styles.cjs.map +1 -1
- package/dist/cjs/components/Calendar/CalendarHeader/CalendarHeader.styles.cjs +4 -8
- package/dist/cjs/components/Calendar/CalendarHeader/CalendarHeader.styles.cjs.map +1 -1
- package/dist/cjs/components/Calendar/SingleCalendar/CalendarCell.cjs +5 -17
- package/dist/cjs/components/Calendar/SingleCalendar/CalendarCell.cjs.map +1 -1
- package/dist/cjs/components/Calendar/utils.cjs +0 -8
- package/dist/cjs/components/Calendar/utils.cjs.map +1 -1
- package/dist/cjs/components/DropDownMenu/DropDownMenu.cjs +4 -3
- package/dist/cjs/components/DropDownMenu/DropDownMenu.cjs.map +1 -1
- package/dist/cjs/components/FileUploader/DropZone/DropZone.cjs +5 -4
- package/dist/cjs/components/FileUploader/DropZone/DropZone.cjs.map +1 -1
- package/dist/cjs/components/Pagination/Pagination.styles.cjs +10 -14
- package/dist/cjs/components/Pagination/Pagination.styles.cjs.map +1 -1
- package/dist/cjs/components/Tooltip/Tooltip.cjs.map +1 -1
- package/dist/cjs/components/Tooltip/Tooltip.styles.cjs +23 -37
- package/dist/cjs/components/Tooltip/Tooltip.styles.cjs.map +1 -1
- package/dist/cjs/components/VerticalNavigation/Navigation/Navigation.cjs +7 -0
- package/dist/cjs/components/VerticalNavigation/Navigation/Navigation.cjs.map +1 -1
- package/dist/cjs/components/VerticalNavigation/VerticalNavigation.cjs +2 -1
- package/dist/cjs/components/VerticalNavigation/VerticalNavigation.cjs.map +1 -1
- package/dist/cjs/components/VerticalNavigation/VerticalNavigationContext.cjs.map +1 -1
- package/dist/cjs/hooks/useUniqueId.cjs +1 -1
- package/dist/cjs/hooks/useUniqueId.cjs.map +1 -1
- package/dist/cjs/index.cjs +0 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/components/ActionsGeneric/ActionsGeneric.js.map +1 -1
- package/dist/esm/components/BaseInput/BaseInput.js +18 -1
- package/dist/esm/components/BaseInput/BaseInput.js.map +1 -1
- package/dist/esm/components/BreadCrumb/BreadCrumb.js +3 -3
- package/dist/esm/components/BreadCrumb/BreadCrumb.js.map +1 -1
- package/dist/esm/components/BreadCrumb/Page/Page.js +23 -13
- package/dist/esm/components/BreadCrumb/Page/Page.js.map +1 -1
- package/dist/esm/components/BreadCrumb/Page/Page.styles.js +19 -42
- package/dist/esm/components/BreadCrumb/Page/Page.styles.js.map +1 -1
- package/dist/esm/components/Calendar/CalendarHeader/CalendarHeader.styles.js +4 -8
- package/dist/esm/components/Calendar/CalendarHeader/CalendarHeader.styles.js.map +1 -1
- package/dist/esm/components/Calendar/SingleCalendar/CalendarCell.js +6 -18
- package/dist/esm/components/Calendar/SingleCalendar/CalendarCell.js.map +1 -1
- package/dist/esm/components/Calendar/utils.js +1 -9
- package/dist/esm/components/Calendar/utils.js.map +1 -1
- package/dist/esm/components/DropDownMenu/DropDownMenu.js +4 -3
- package/dist/esm/components/DropDownMenu/DropDownMenu.js.map +1 -1
- package/dist/esm/components/FileUploader/DropZone/DropZone.js +5 -4
- package/dist/esm/components/FileUploader/DropZone/DropZone.js.map +1 -1
- package/dist/esm/components/Pagination/Pagination.styles.js +10 -14
- package/dist/esm/components/Pagination/Pagination.styles.js.map +1 -1
- package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/components/Tooltip/Tooltip.styles.js +24 -38
- package/dist/esm/components/Tooltip/Tooltip.styles.js.map +1 -1
- package/dist/esm/components/VerticalNavigation/Navigation/Navigation.js +7 -0
- package/dist/esm/components/VerticalNavigation/Navigation/Navigation.js.map +1 -1
- package/dist/esm/components/VerticalNavigation/VerticalNavigation.js +2 -1
- package/dist/esm/components/VerticalNavigation/VerticalNavigation.js.map +1 -1
- package/dist/esm/components/VerticalNavigation/VerticalNavigationContext.js.map +1 -1
- package/dist/esm/hooks/useUniqueId.js +2 -2
- package/dist/esm/hooks/useUniqueId.js.map +1 -1
- package/dist/esm/index.js +0 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/types/index.d.ts +26 -42
- package/package.json +2 -2
- package/dist/cjs/hocs/withId.cjs +0 -31
- package/dist/cjs/hocs/withId.cjs.map +0 -1
- package/dist/esm/hocs/withId.js +0 -28
- package/dist/esm/hocs/withId.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VerticalNavigation.js","sources":["../../../../src/components/VerticalNavigation/VerticalNavigation.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { useEffect, useMemo, useState } from \"react\";\nimport { StyledRoot } from \"./VerticalNavigation.styles\";\nimport verticalNavigationClasses, {\n HvVerticalNavigationClasses,\n} from \"./verticalNavigationClasses\";\nimport { NavigationData, VerticalNavigationContext } from \".\";\nimport {\n fillDataWithParentId,\n getNavigationItemById,\n getParentItemById,\n} from \"./NavigationSlider/utils\";\nimport { hasChildNavigationItems } from \"./utils/VerticalNavigation.utils\";\n\nexport interface HvVerticalNavigationProps {\n /**\n * Id to be applied to the root node.\n */\n id?: string;\n /**\n * Class names to be applied.\n */\n className?: string;\n /**\n * A Jss Object used to override or extend the styles applied to the component.\n */\n classes?: HvVerticalNavigationClasses;\n /**\n * Current State of the Vertical Navigation Collapse\n */\n open?: boolean;\n /**\n * Collpased Mode for the Vertical Navigation, the default value is \"simple\".\n *\n * @deprecated - `useIcons` property should be used instead.\n */\n collapsedMode?: HvVerticalNavigationMode;\n /**\n * Boolean to determine if treeview is in slider mode (for mobile navigation), the default value is false.\n */\n slider?: boolean;\n /**\n * The content inside the actions container.\n */\n children?: React.ReactNode;\n /**\n * Boolean to determine if icons should be displayed in the navigation menu.\n * When `true` a icon will always be displayed, if no icon is provided the first letter of the label will be\n * displayed inside an Avatar component.\n * When `false` no icons will be shown, even if an icon is provided.\n */\n useIcons?: boolean;\n}\n\n/**\n * Navigation enables users to move through an app to complete tasks.\n *\n * It is recommended to use vertical navigation when your application requires global navigation that is displayed on the left.\n * While vertical navigation menus generally consume more space than their horizontal counterparts, they have become more popular as desktop monitors move to wide-screen formats.\n *\n * Although both the hierarchically organized data and the visual style resemble a treeview-like structure, the [Treeview Design Pattern](https://w3c.github.io/aria-practices/#TreeView)\n * isn't necessarily the most appropriate.\n *\n * The tree role provides complex functionality that is not needed for typical site navigation, and changes the most common keyboard navigation using TAB.\n *\n * The [Disclosure Design Pattern](https://w3c.github.io/aria-practices/#disclosure) is more suited for typical site navigation, with expandable groups of links.\n * However it can be tedious to TAB through all navigation items to reach the actions panel.\n *\n * Both modes are available via the `mode` property and each app should choose the most appropriate.\n */\nexport const HvVerticalNavigation = ({\n id,\n className,\n classes,\n\n children,\n\n open = true,\n\n slider = false,\n\n useIcons = false,\n\n ...others\n}: HvVerticalNavigationProps) => {\n if (others.collapsedMode) {\n console.warn(\"`collaspedMode` is deprecated. Please use 'useIcons'.\");\n }\n const [parentData, setParentData] = useState<NavigationData[]>([]);\n\n const [parentSelected, setParentSelected] = useState();\n\n const [headerTitle, setHeaderTitle] = useState<string | undefined>();\n\n // navigationSlider\n const withParentData = useMemo(\n () => fillDataWithParentId(parentData),\n [parentData]\n );\n\n const initialParentItem = useMemo(\n () => getParentItemById(withParentData, parentSelected),\n [withParentData, parentSelected]\n );\n\n const [parentItem, setParentItem] = useState(initialParentItem);\n\n const hasAnyChildWithData = useMemo(\n () => hasChildNavigationItems(parentData),\n [parentData]\n );\n\n useEffect(\n () => setHeaderTitle(parentItem?.label),\n [parentItem, setParentItem]\n );\n\n const navigateToParentHandler = () => {\n setParentItem(getParentItemById(withParentData, parentItem.id));\n };\n\n const navigateToChildHandler = (event, item) => {\n setParentItem(getNavigationItemById(withParentData, item.id));\n event.stopPropagation();\n };\n\n const value = useMemo(\n () => ({\n isOpen: open,\n useIcons,\n slider,\n headerTitle,\n setHeaderTitle,\n\n parentItem,\n withParentData,\n navigateToChildHandler,\n navigateToParentHandler,\n\n parentData,\n setParentData,\n parentSelected,\n setParentSelected,\n hasAnyChildWithData,\n }),\n [\n open,\n useIcons,\n slider,\n headerTitle,\n setHeaderTitle,\n parentItem,\n withParentData,\n navigateToChildHandler,\n navigateToParentHandler,\n hasAnyChildWithData,\n ]\n );\n\n const content = (\n <VerticalNavigationContext.Provider value={value}>\n <StyledRoot\n id={id}\n className={clsx(\n className,\n verticalNavigationClasses.root,\n classes?.root,\n !open && verticalNavigationClasses.collapsed,\n slider && verticalNavigationClasses.slider,\n classes?.collapsed\n )}\n hasAnyChildWithData={hasAnyChildWithData}\n {...others}\n >\n {children}\n </StyledRoot>\n </VerticalNavigationContext.Provider>\n );\n\n return content;\n};\n\nexport type HvVerticalNavigationMode = \"icon\" | \"simple\";\n\nexport type HvVerticalNavigationPosition =\n | \"static\"\n | \"relative\"\n | \"fixed\"\n | \"absolute\";\n"],"names":["HvVerticalNavigation","id","className","classes","children","open","slider","useIcons","others","collapsedMode","console","warn","parentData","setParentData","useState","parentSelected","setParentSelected","headerTitle","setHeaderTitle","withParentData","useMemo","fillDataWithParentId","initialParentItem","getParentItemById","parentItem","setParentItem","hasAnyChildWithData","hasChildNavigationItems","label","navigateToParentHandler","navigateToChildHandler","event","item","getNavigationItemById","stopPropagation","value","isOpen","content","VerticalNavigationContext","Provider","StyledRoot","clsx","verticalNavigationClasses","root","collapsed"],"mappings":";;;;;;;;AAsEO,MAAMA,uBAAuBA,CAAC;AAAA,EACnCC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EAEAC;AAAAA,EAEAC,OAAO;AAAA,EAEPC,SAAS;AAAA,EAETC,WAAW;AAAA,EAEX,GAAGC;AACsB,MAAM;AAC/B,MAAIA,OAAOC,eAAe;AACxBC,YAAQC,KAAK,uDAAuD;AAAA,EACtE;AACA,QAAM,CAACC,YAAYC,aAAa,IAAIC,SAA2B,CAAE,CAAA;AAEjE,QAAM,CAACC,gBAAgBC,iBAAiB,IAAIF,SAAU;AAEtD,QAAM,CAACG,aAAaC,cAAc,IAAIJ,SAA8B;AAG9DK,QAAAA,iBAAiBC,QACrB,MAAMC,qBAAqBT,UAAU,GACrC,CAACA,UAAU,CAAC;AAGRU,QAAAA,oBAAoBF,QACxB,MAAMG,kBAAkBJ,gBAAgBJ,cAAc,GACtD,CAACI,gBAAgBJ,cAAc,CAAC;AAGlC,QAAM,CAACS,YAAYC,aAAa,IAAIX,SAASQ,iBAAiB;AAExDI,QAAAA,sBAAsBN,QAC1B,MAAMO,wBAAwBf,UAAU,GACxC,CAACA,UAAU,CAAC;AAIZ,YAAA,MAAMM,eAAeM,yCAAYI,KAAK,GACtC,CAACJ,YAAYC,aAAa,CAAC;AAG7B,QAAMI,0BAA0BA,MAAM;AACpCJ,kBAAcF,kBAAkBJ,gBAAgBK,WAAWvB,EAAE,CAAC;AAAA,EAAA;AAG1D6B,QAAAA,yBAAyBA,CAACC,OAAOC,SAAS;AAC9CP,kBAAcQ,sBAAsBd,gBAAgBa,KAAK/B,EAAE,CAAC;AAC5D8B,UAAMG,gBAAiB;AAAA,EAAA;AAGnBC,QAAAA,QAAQf,QACZ,OAAO;AAAA,IACLgB,QAAQ/B;AAAAA,IACRE;AAAAA,IACAD;AAAAA,IACAW;AAAAA,IACAC;AAAAA,IAEAM;AAAAA,
|
|
1
|
+
{"version":3,"file":"VerticalNavigation.js","sources":["../../../../src/components/VerticalNavigation/VerticalNavigation.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { useEffect, useMemo, useState } from \"react\";\nimport { StyledRoot } from \"./VerticalNavigation.styles\";\nimport verticalNavigationClasses, {\n HvVerticalNavigationClasses,\n} from \"./verticalNavigationClasses\";\nimport { NavigationData, VerticalNavigationContext } from \".\";\nimport {\n fillDataWithParentId,\n getNavigationItemById,\n getParentItemById,\n} from \"./NavigationSlider/utils\";\nimport { hasChildNavigationItems } from \"./utils/VerticalNavigation.utils\";\n\nexport interface HvVerticalNavigationProps {\n /**\n * Id to be applied to the root node.\n */\n id?: string;\n /**\n * Class names to be applied.\n */\n className?: string;\n /**\n * A Jss Object used to override or extend the styles applied to the component.\n */\n classes?: HvVerticalNavigationClasses;\n /**\n * Current State of the Vertical Navigation Collapse\n */\n open?: boolean;\n /**\n * Collpased Mode for the Vertical Navigation, the default value is \"simple\".\n *\n * @deprecated - `useIcons` property should be used instead.\n */\n collapsedMode?: HvVerticalNavigationMode;\n /**\n * Boolean to determine if treeview is in slider mode (for mobile navigation), the default value is false.\n */\n slider?: boolean;\n /**\n * The content inside the actions container.\n */\n children?: React.ReactNode;\n /**\n * Boolean to determine if icons should be displayed in the navigation menu.\n * When `true` a icon will always be displayed, if no icon is provided the first letter of the label will be\n * displayed inside an Avatar component.\n * When `false` no icons will be shown, even if an icon is provided.\n */\n useIcons?: boolean;\n}\n\n/**\n * Navigation enables users to move through an app to complete tasks.\n *\n * It is recommended to use vertical navigation when your application requires global navigation that is displayed on the left.\n * While vertical navigation menus generally consume more space than their horizontal counterparts, they have become more popular as desktop monitors move to wide-screen formats.\n *\n * Although both the hierarchically organized data and the visual style resemble a treeview-like structure, the [Treeview Design Pattern](https://w3c.github.io/aria-practices/#TreeView)\n * isn't necessarily the most appropriate.\n *\n * The tree role provides complex functionality that is not needed for typical site navigation, and changes the most common keyboard navigation using TAB.\n *\n * The [Disclosure Design Pattern](https://w3c.github.io/aria-practices/#disclosure) is more suited for typical site navigation, with expandable groups of links.\n * However it can be tedious to TAB through all navigation items to reach the actions panel.\n *\n * Both modes are available via the `mode` property and each app should choose the most appropriate.\n */\nexport const HvVerticalNavigation = ({\n id,\n className,\n classes,\n\n children,\n\n open = true,\n\n slider = false,\n\n useIcons = false,\n\n ...others\n}: HvVerticalNavigationProps) => {\n if (others.collapsedMode) {\n console.warn(\"`collaspedMode` is deprecated. Please use 'useIcons'.\");\n }\n const [parentData, setParentData] = useState<NavigationData[]>([]);\n\n const [parentSelected, setParentSelected] = useState();\n\n const [headerTitle, setHeaderTitle] = useState<string | undefined>();\n\n // navigationSlider\n const withParentData = useMemo(\n () => fillDataWithParentId(parentData),\n [parentData]\n );\n\n const initialParentItem = useMemo(\n () => getParentItemById(withParentData, parentSelected),\n [withParentData, parentSelected]\n );\n\n const [parentItem, setParentItem] = useState(initialParentItem);\n\n const hasAnyChildWithData = useMemo(\n () => hasChildNavigationItems(parentData),\n [parentData]\n );\n\n useEffect(\n () => setHeaderTitle(parentItem?.label),\n [parentItem, setParentItem]\n );\n\n const navigateToParentHandler = () => {\n setParentItem(getParentItemById(withParentData, parentItem.id));\n };\n\n const navigateToChildHandler = (event, item) => {\n setParentItem(getNavigationItemById(withParentData, item.id));\n event.stopPropagation();\n };\n\n const value = useMemo(\n () => ({\n isOpen: open,\n useIcons,\n slider,\n headerTitle,\n setHeaderTitle,\n\n parentItem,\n setParentItem,\n withParentData,\n navigateToChildHandler,\n navigateToParentHandler,\n\n parentData,\n setParentData,\n parentSelected,\n setParentSelected,\n hasAnyChildWithData,\n }),\n [\n open,\n useIcons,\n slider,\n headerTitle,\n setHeaderTitle,\n parentItem,\n setParentItem,\n withParentData,\n navigateToChildHandler,\n navigateToParentHandler,\n hasAnyChildWithData,\n ]\n );\n\n const content = (\n <VerticalNavigationContext.Provider value={value}>\n <StyledRoot\n id={id}\n className={clsx(\n className,\n verticalNavigationClasses.root,\n classes?.root,\n !open && verticalNavigationClasses.collapsed,\n slider && verticalNavigationClasses.slider,\n classes?.collapsed\n )}\n hasAnyChildWithData={hasAnyChildWithData}\n {...others}\n >\n {children}\n </StyledRoot>\n </VerticalNavigationContext.Provider>\n );\n\n return content;\n};\n\nexport type HvVerticalNavigationMode = \"icon\" | \"simple\";\n\nexport type HvVerticalNavigationPosition =\n | \"static\"\n | \"relative\"\n | \"fixed\"\n | \"absolute\";\n"],"names":["HvVerticalNavigation","id","className","classes","children","open","slider","useIcons","others","collapsedMode","console","warn","parentData","setParentData","useState","parentSelected","setParentSelected","headerTitle","setHeaderTitle","withParentData","useMemo","fillDataWithParentId","initialParentItem","getParentItemById","parentItem","setParentItem","hasAnyChildWithData","hasChildNavigationItems","label","navigateToParentHandler","navigateToChildHandler","event","item","getNavigationItemById","stopPropagation","value","isOpen","content","VerticalNavigationContext","Provider","StyledRoot","clsx","verticalNavigationClasses","root","collapsed"],"mappings":";;;;;;;;AAsEO,MAAMA,uBAAuBA,CAAC;AAAA,EACnCC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EAEAC;AAAAA,EAEAC,OAAO;AAAA,EAEPC,SAAS;AAAA,EAETC,WAAW;AAAA,EAEX,GAAGC;AACsB,MAAM;AAC/B,MAAIA,OAAOC,eAAe;AACxBC,YAAQC,KAAK,uDAAuD;AAAA,EACtE;AACA,QAAM,CAACC,YAAYC,aAAa,IAAIC,SAA2B,CAAE,CAAA;AAEjE,QAAM,CAACC,gBAAgBC,iBAAiB,IAAIF,SAAU;AAEtD,QAAM,CAACG,aAAaC,cAAc,IAAIJ,SAA8B;AAG9DK,QAAAA,iBAAiBC,QACrB,MAAMC,qBAAqBT,UAAU,GACrC,CAACA,UAAU,CAAC;AAGRU,QAAAA,oBAAoBF,QACxB,MAAMG,kBAAkBJ,gBAAgBJ,cAAc,GACtD,CAACI,gBAAgBJ,cAAc,CAAC;AAGlC,QAAM,CAACS,YAAYC,aAAa,IAAIX,SAASQ,iBAAiB;AAExDI,QAAAA,sBAAsBN,QAC1B,MAAMO,wBAAwBf,UAAU,GACxC,CAACA,UAAU,CAAC;AAIZ,YAAA,MAAMM,eAAeM,yCAAYI,KAAK,GACtC,CAACJ,YAAYC,aAAa,CAAC;AAG7B,QAAMI,0BAA0BA,MAAM;AACpCJ,kBAAcF,kBAAkBJ,gBAAgBK,WAAWvB,EAAE,CAAC;AAAA,EAAA;AAG1D6B,QAAAA,yBAAyBA,CAACC,OAAOC,SAAS;AAC9CP,kBAAcQ,sBAAsBd,gBAAgBa,KAAK/B,EAAE,CAAC;AAC5D8B,UAAMG,gBAAiB;AAAA,EAAA;AAGnBC,QAAAA,QAAQf,QACZ,OAAO;AAAA,IACLgB,QAAQ/B;AAAAA,IACRE;AAAAA,IACAD;AAAAA,IACAW;AAAAA,IACAC;AAAAA,IAEAM;AAAAA,IACAC;AAAAA,IACAN;AAAAA,IACAW;AAAAA,IACAD;AAAAA,IAEAjB;AAAAA,IACAC;AAAAA,IACAE;AAAAA,IACAC;AAAAA,IACAU;AAAAA,EAEF,IAAA,CACErB,MACAE,UACAD,QACAW,aACAC,gBACAM,YACAC,eACAN,gBACAW,wBACAD,yBACAH,mBAAmB,CACpB;AAGGW,QAAAA,UACHC,oBAAAA,0BAA0BC,UAAQ;AAAA,IAACJ;AAAAA,IAAa/B,8BAC9CoC,YAAU;AAAA,MACTvC;AAAAA,MACAC,WAAWuC,KACTvC,WACAwC,0BAA0BC,MAC1BxC,mCAASwC,MACT,CAACtC,QAAQqC,0BAA0BE,WACnCtC,UAAUoC,0BAA0BpC,QACpCH,mCAASyC,SAAS;AAAA,MAEpBlB;AAAAA,MAAyC,GACrClB;AAAAA,MAAMJ;AAAAA,IAAAA,CAED;AAAA,EAAA,CAGd;AAEMiC,SAAAA;AACT;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VerticalNavigationContext.js","sources":["../../../../src/components/VerticalNavigation/VerticalNavigationContext.tsx"],"sourcesContent":["import { createContext } from \"react\";\nimport { NavigationData } from \".\";\n\ninterface VerticalNavigationContextValue {\n isOpen: boolean;\n useIcons: boolean;\n slider?: boolean;\n headerTitle?: string;\n setHeaderTitle?: React.Dispatch<React.SetStateAction<string | undefined>>;\n\n parentItem?;\n withParentData?;\n navigateToChildHandler?: (event, item) => void;\n navigateToParentHandler?: () => void;\n\n parentData?: NavigationData[];\n setParentData?: React.Dispatch<React.SetStateAction<any>>;\n parentSelected?;\n setParentSelected?: React.Dispatch<React.SetStateAction<any>>;\n\n hasAnyChildWithData?: boolean;\n}\n\nconst VerticalNavigationContext = createContext<VerticalNavigationContextValue>(\n {\n isOpen: true,\n useIcons: false,\n slider: false,\n }\n);\n\nexport { VerticalNavigationContext };\n"],"names":["VerticalNavigationContext","createContext","isOpen","useIcons","slider"],"mappings":";
|
|
1
|
+
{"version":3,"file":"VerticalNavigationContext.js","sources":["../../../../src/components/VerticalNavigation/VerticalNavigationContext.tsx"],"sourcesContent":["import { createContext } from \"react\";\nimport { NavigationData } from \".\";\n\ninterface VerticalNavigationContextValue {\n isOpen: boolean;\n useIcons: boolean;\n slider?: boolean;\n headerTitle?: string;\n setHeaderTitle?: React.Dispatch<React.SetStateAction<string | undefined>>;\n\n parentItem?;\n setParentItem?: React.Dispatch<React.SetStateAction<any>>;\n withParentData?;\n navigateToChildHandler?: (event, item) => void;\n navigateToParentHandler?: () => void;\n\n parentData?: NavigationData[];\n setParentData?: React.Dispatch<React.SetStateAction<any>>;\n parentSelected?;\n setParentSelected?: React.Dispatch<React.SetStateAction<any>>;\n\n hasAnyChildWithData?: boolean;\n}\n\nconst VerticalNavigationContext = createContext<VerticalNavigationContextValue>(\n {\n isOpen: true,\n useIcons: false,\n slider: false,\n }\n);\n\nexport { VerticalNavigationContext };\n"],"names":["VerticalNavigationContext","createContext","isOpen","useIcons","slider"],"mappings":";AAwBA,MAAMA,4BAA4BC,cAChC;AAAA,EACEC,QAAQ;AAAA,EACRC,UAAU;AAAA,EACVC,QAAQ;AACV,CAAC;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useMemo } from "react";
|
|
2
2
|
import uniqueId from "lodash/uniqueId";
|
|
3
|
-
const useUniqueId = (id, idPrefix) =>
|
|
3
|
+
const useUniqueId = (id, idPrefix) => useMemo(() => id || uniqueId(idPrefix), [id, idPrefix]);
|
|
4
4
|
export {
|
|
5
5
|
useUniqueId as default
|
|
6
6
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUniqueId.js","sources":["../../../src/hooks/useUniqueId.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"useUniqueId.js","sources":["../../../src/hooks/useUniqueId.ts"],"sourcesContent":["import { useMemo } from \"react\";\nimport uniqueId from \"lodash/uniqueId\";\n\nexport default (id?: string, idPrefix?: string) =>\n useMemo(() => id || uniqueId(idPrefix), [id, idPrefix]);\n"],"names":["id","idPrefix","useMemo","uniqueId"],"mappings":";;AAGA,MAAe,cAAA,CAACA,IAAaC,aAC3BC,QAAQ,MAAMF,MAAMG,SAASF,QAAQ,GAAG,CAACD,IAAIC,QAAQ,CAAC;"}
|
package/dist/esm/index.js
CHANGED
|
@@ -281,7 +281,6 @@ import { getFirstAndLastFocus, getFocusableList, getPrevNextFocus } from "./util
|
|
|
281
281
|
import { wrapperTooltip } from "./utils/wrapperTooltip.js";
|
|
282
282
|
import { useSavedState } from "./utils/useSavedState.js";
|
|
283
283
|
import { default as default137 } from "./hocs/withTooltip.js";
|
|
284
|
-
import { default as default138 } from "./hocs/withId.js";
|
|
285
284
|
export {
|
|
286
285
|
CellWithCheckBox,
|
|
287
286
|
CellWithExpandButton,
|
|
@@ -613,7 +612,6 @@ export {
|
|
|
613
612
|
default115 as verticalNavigationTreeClasses,
|
|
614
613
|
default122 as verticalScrollListItemClasses,
|
|
615
614
|
default16 as warningTextClasses,
|
|
616
|
-
default138 as withId,
|
|
617
615
|
default137 as withTooltip,
|
|
618
616
|
wrapperTooltip
|
|
619
617
|
};
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -85,7 +85,6 @@ import { theme } from '@hitachivantara/uikit-styles';
|
|
|
85
85
|
import { themes } from '@hitachivantara/uikit-styles';
|
|
86
86
|
import type { ThHTMLAttributes } from 'react';
|
|
87
87
|
import { TooltipProps } from '@mui/material';
|
|
88
|
-
import { TransitionProps } from '@mui/material/transitions';
|
|
89
88
|
import { UseColumnOrderInstanceProps } from 'react-table';
|
|
90
89
|
import { UseColumnOrderState } from 'react-table';
|
|
91
90
|
import { useEffect } from 'react';
|
|
@@ -137,8 +136,8 @@ declare type Accessor<D extends object> = (originalRow: D, index: number, sub: {
|
|
|
137
136
|
}) => CellValue;
|
|
138
137
|
|
|
139
138
|
export declare const accordionClasses: {
|
|
140
|
-
label: "HvAccordion-label";
|
|
141
139
|
hidden: "HvAccordion-hidden";
|
|
140
|
+
label: "HvAccordion-label";
|
|
142
141
|
container: "HvAccordion-container";
|
|
143
142
|
disabled: "HvAccordion-disabled";
|
|
144
143
|
root: "HvAccordion-root";
|
|
@@ -275,10 +274,10 @@ export declare const baseCheckBoxClasses: {
|
|
|
275
274
|
};
|
|
276
275
|
|
|
277
276
|
export declare const baseDropdownClasses: {
|
|
278
|
-
header: "HvBaseDropdown-header";
|
|
279
277
|
placeholder: "HvBaseDropdown-placeholder";
|
|
280
278
|
arrow: "HvBaseDropdown-arrow";
|
|
281
279
|
anchor: "HvBaseDropdown-anchor";
|
|
280
|
+
header: "HvBaseDropdown-header";
|
|
282
281
|
container: "HvBaseDropdown-container";
|
|
283
282
|
root: "HvBaseDropdown-root";
|
|
284
283
|
rootDisabled: "HvBaseDropdown-rootDisabled";
|
|
@@ -336,8 +335,8 @@ export declare const baseSwitchClasses: {
|
|
|
336
335
|
};
|
|
337
336
|
|
|
338
337
|
export declare const breadCrumbClasses: {
|
|
339
|
-
a: "HvBreadCrumb-a";
|
|
340
338
|
link: "HvBreadCrumb-link";
|
|
339
|
+
a: "HvBreadCrumb-a";
|
|
341
340
|
root: "HvBreadCrumb-root";
|
|
342
341
|
orderedList: "HvBreadCrumb-orderedList";
|
|
343
342
|
currentPage: "HvBreadCrumb-currentPage";
|
|
@@ -435,8 +434,8 @@ export declare const cardMediaClasses: {
|
|
|
435
434
|
};
|
|
436
435
|
|
|
437
436
|
export declare const carouselClasses: {
|
|
438
|
-
main: "HvCarousel-main";
|
|
439
437
|
title: "HvCarousel-title";
|
|
438
|
+
main: "HvCarousel-main";
|
|
440
439
|
dot: "HvCarousel-dot";
|
|
441
440
|
controls: "HvCarousel-controls";
|
|
442
441
|
xs: "HvCarousel-xs";
|
|
@@ -638,9 +637,9 @@ export declare const dotPaginationClasses: {
|
|
|
638
637
|
};
|
|
639
638
|
|
|
640
639
|
export declare const dropdownClasses: {
|
|
641
|
-
label: "HvDropdown-label";
|
|
642
640
|
placeholder: "HvDropdown-placeholder";
|
|
643
641
|
arrow: "HvDropdown-arrow";
|
|
642
|
+
label: "HvDropdown-label";
|
|
644
643
|
error: "HvDropdown-error";
|
|
645
644
|
dropdown: "HvDropdown-dropdown";
|
|
646
645
|
root: "HvDropdown-root";
|
|
@@ -1897,7 +1896,7 @@ export declare interface HvBreadCrumbClasses {
|
|
|
1897
1896
|
a?: string;
|
|
1898
1897
|
}
|
|
1899
1898
|
|
|
1900
|
-
export declare interface HvBreadCrumbPathElement {
|
|
1899
|
+
export declare interface HvBreadCrumbPathElement extends Record<string, any> {
|
|
1901
1900
|
label: string;
|
|
1902
1901
|
path: string;
|
|
1903
1902
|
}
|
|
@@ -1912,7 +1911,7 @@ export declare interface HvBreadCrumbProps extends HvBaseProps<HTMLDivElement, "
|
|
|
1912
1911
|
/** The component used for the link node. Either a string to use a DOM element or a component. */
|
|
1913
1912
|
component?: React.ElementType;
|
|
1914
1913
|
/** Function passed to the component. If defined the component prop is used as the link node. */
|
|
1915
|
-
onClick?: (event:
|
|
1914
|
+
onClick?: (event: MouseEvent_2<HTMLElement>, data: any) => void;
|
|
1916
1915
|
/** Props passed down to the DropDownMenu sub-menu component. */
|
|
1917
1916
|
dropDownMenuProps?: HvDropDownMenuProps;
|
|
1918
1917
|
/** A Jss Object used to override or extend the styles applied to the component. */
|
|
@@ -3254,10 +3253,10 @@ declare interface HvDropdownListProps {
|
|
|
3254
3253
|
virtualized?: boolean;
|
|
3255
3254
|
}
|
|
3256
3255
|
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
};
|
|
3256
|
+
/**
|
|
3257
|
+
* 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.
|
|
3258
|
+
*/
|
|
3259
|
+
export declare const HvDropDownMenu: ({ id: idProp, classes, className, icon, placement, dataList, disablePortal, onToggle, onClick, keepOpened, disabled, expanded, defaultExpanded, category, ...others }: HvDropDownMenuProps) => JSX_2.Element;
|
|
3261
3260
|
|
|
3262
3261
|
export declare interface HvDropDownMenuClasses {
|
|
3263
3262
|
/** Styles applied to the root. */
|
|
@@ -7222,6 +7221,7 @@ export declare interface HvToggleButtonProps extends HvBaseProps<HTMLButtonEleme
|
|
|
7222
7221
|
|
|
7223
7222
|
/**
|
|
7224
7223
|
* Tooltips display informative text when users hover over, focus on, or tap an element.
|
|
7224
|
+
* Accessibility-wise, the tooltip automatically labels the `children` content.
|
|
7225
7225
|
*/
|
|
7226
7226
|
export declare const HvTooltip: ForwardRefExoticComponent<Omit<HvTooltipProps, "ref"> & RefAttributes<unknown>>;
|
|
7227
7227
|
|
|
@@ -7250,9 +7250,9 @@ export declare interface HvTooltipClasses {
|
|
|
7250
7250
|
valueWrapper?: string;
|
|
7251
7251
|
}
|
|
7252
7252
|
|
|
7253
|
-
export declare type HvTooltipPlacementType = "
|
|
7253
|
+
export declare type HvTooltipPlacementType = TooltipProps["placement"];
|
|
7254
7254
|
|
|
7255
|
-
export declare interface HvTooltipProps extends Omit<TooltipProps, "classes"
|
|
7255
|
+
export declare interface HvTooltipProps extends Omit<TooltipProps, "classes"> {
|
|
7256
7256
|
/**
|
|
7257
7257
|
* Class names to be applied.
|
|
7258
7258
|
*/
|
|
@@ -7274,20 +7274,12 @@ export declare interface HvTooltipProps extends Omit<TooltipProps, "classes" | "
|
|
|
7274
7274
|
* This property won't impact the enter touch delay (enterTouchDelay).
|
|
7275
7275
|
*/
|
|
7276
7276
|
enterDelay?: number;
|
|
7277
|
-
/**
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
|
|
7281
|
-
/**
|
|
7282
|
-
|
|
7283
|
-
*/
|
|
7284
|
-
TransitionComponent?: React.JSXElementConstructor<TransitionProps & {
|
|
7285
|
-
children: React.ReactElement<any, any>;
|
|
7286
|
-
}>;
|
|
7287
|
-
/**
|
|
7288
|
-
* Properties applied to the Transition element.
|
|
7289
|
-
*/
|
|
7290
|
-
TransitionProps?: TransitionProps;
|
|
7277
|
+
/** @inheritdoc */
|
|
7278
|
+
title: TooltipProps["title"];
|
|
7279
|
+
/** @inheritdoc */
|
|
7280
|
+
TransitionComponent?: TooltipProps["TransitionComponent"];
|
|
7281
|
+
/** @inheritdoc */
|
|
7282
|
+
TransitionProps?: TooltipProps["TransitionProps"];
|
|
7291
7283
|
/**
|
|
7292
7284
|
* Defines if should use a single or multiline tooltip.
|
|
7293
7285
|
*/
|
|
@@ -8165,9 +8157,9 @@ export declare const listItemClasses: {
|
|
|
8165
8157
|
};
|
|
8166
8158
|
|
|
8167
8159
|
export declare const loadingClasses: {
|
|
8168
|
-
label: "HvLoading-label";
|
|
8169
|
-
small: "HvLoading-small";
|
|
8170
8160
|
hidden: "HvLoading-hidden";
|
|
8161
|
+
small: "HvLoading-small";
|
|
8162
|
+
label: "HvLoading-label";
|
|
8171
8163
|
overlay: "HvLoading-overlay";
|
|
8172
8164
|
blur: "HvLoading-blur";
|
|
8173
8165
|
root: "HvLoading-root";
|
|
@@ -8949,9 +8941,9 @@ export declare const treeViewClasses: {
|
|
|
8949
8941
|
};
|
|
8950
8942
|
|
|
8951
8943
|
export declare const treeViewItemClasses: {
|
|
8952
|
-
link: "HvVerticalNavigationTreeViewItem-link";
|
|
8953
8944
|
content: "HvVerticalNavigationTreeViewItem-content";
|
|
8954
8945
|
unselectable: "HvVerticalNavigationTreeViewItem-unselectable";
|
|
8946
|
+
link: "HvVerticalNavigationTreeViewItem-link";
|
|
8955
8947
|
group: "HvVerticalNavigationTreeViewItem-group";
|
|
8956
8948
|
hide: "HvVerticalNavigationTreeViewItem-hide";
|
|
8957
8949
|
expanded: "HvVerticalNavigationTreeViewItem-expanded";
|
|
@@ -8967,9 +8959,9 @@ export declare const treeViewItemClasses: {
|
|
|
8967
8959
|
};
|
|
8968
8960
|
|
|
8969
8961
|
export declare const typographyClasses: {
|
|
8962
|
+
link: "HvTypography-link";
|
|
8970
8963
|
body: "HvTypography-body";
|
|
8971
8964
|
label: "HvTypography-label";
|
|
8972
|
-
link: "HvTypography-link";
|
|
8973
8965
|
display: "HvTypography-display";
|
|
8974
8966
|
noWrap: "HvTypography-noWrap";
|
|
8975
8967
|
title1: "HvTypography-title1";
|
|
@@ -9309,7 +9301,7 @@ export declare type UseTableStylesProps = (<D extends object = Record<string, un
|
|
|
9309
9301
|
|
|
9310
9302
|
export declare const useTheme: () => HvThemeContextValue;
|
|
9311
9303
|
|
|
9312
|
-
export declare const useUniqueId: (id
|
|
9304
|
+
export declare const useUniqueId: (id?: string, idPrefix?: string) => string;
|
|
9313
9305
|
|
|
9314
9306
|
export declare const useWidth: () => string;
|
|
9315
9307
|
|
|
@@ -9330,6 +9322,7 @@ declare interface VerticalNavigationContextValue {
|
|
|
9330
9322
|
headerTitle?: string;
|
|
9331
9323
|
setHeaderTitle?: React.Dispatch<React.SetStateAction<string | undefined>>;
|
|
9332
9324
|
parentItem?: any;
|
|
9325
|
+
setParentItem?: React.Dispatch<React.SetStateAction<any>>;
|
|
9333
9326
|
withParentData?: any;
|
|
9334
9327
|
navigateToChildHandler?: (event: any, item: any) => void;
|
|
9335
9328
|
navigateToParentHandler?: () => void;
|
|
@@ -9378,15 +9371,6 @@ export declare const warningTextClasses: {
|
|
|
9378
9371
|
topBorder: "HvWarningText-topBorder";
|
|
9379
9372
|
};
|
|
9380
9373
|
|
|
9381
|
-
export declare const withId: (Component: any) => {
|
|
9382
|
-
({ id, ...others }: WithIdProps): JSX_2.Element;
|
|
9383
|
-
Naked: any;
|
|
9384
|
-
};
|
|
9385
|
-
|
|
9386
|
-
declare interface WithIdProps extends HvExtraProps {
|
|
9387
|
-
id?: string;
|
|
9388
|
-
}
|
|
9389
|
-
|
|
9390
9374
|
export declare const withTooltip: (Component: React.FunctionComponent, label: string | undefined, placement: HvTooltipPlacementType, hideTooltip?: ((event: React.MouseEvent<HTMLDivElement>) => boolean) | undefined, tooltipProps?: HvTooltipProps, tooltipContainerProps?: HvBaseProps) => (props: any) => JSX_2.Element;
|
|
9391
9375
|
|
|
9392
9376
|
export declare const wrapperTooltip: (hasTooltips: any, Component: any, label: any) => ((props: any) => JSX_2.Element) | (() => any);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hitachivantara/uikit-react-core",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.11.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Hitachi Vantara UI Kit Team",
|
|
6
6
|
"description": "Core React components for the NEXT Design System.",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"access": "public",
|
|
59
59
|
"directory": "package"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "f089170f43c957eb52d3d482b996f262c93a91c1",
|
|
62
62
|
"main": "dist/cjs/index.cjs",
|
|
63
63
|
"exports": {
|
|
64
64
|
".": {
|
package/dist/cjs/hocs/withId.cjs
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const React = require("react");
|
|
4
|
-
const hoistNonReactStatics = require("hoist-non-react-statics");
|
|
5
|
-
const uniqueId = require("lodash/uniqueId");
|
|
6
|
-
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
7
|
-
const getComponentName = require("../utils/getComponentName.cjs");
|
|
8
|
-
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
9
|
-
const hoistNonReactStatics__default = /* @__PURE__ */ _interopDefault(hoistNonReactStatics);
|
|
10
|
-
const uniqueId__default = /* @__PURE__ */ _interopDefault(uniqueId);
|
|
11
|
-
const pascalToKebab = (string = "") => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
12
|
-
const withId = (Component) => {
|
|
13
|
-
const WithId = ({
|
|
14
|
-
id,
|
|
15
|
-
...others
|
|
16
|
-
}) => {
|
|
17
|
-
const [internalId] = React.useState(id || uniqueId__default.default(`${pascalToKebab(getComponentName.default(Component))}-`));
|
|
18
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Component, {
|
|
19
|
-
id: internalId,
|
|
20
|
-
...others
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
hoistNonReactStatics__default.default(WithId, Component);
|
|
24
|
-
if (process.env.NODE_ENV !== "production") {
|
|
25
|
-
WithId.Naked = Component;
|
|
26
|
-
}
|
|
27
|
-
return WithId;
|
|
28
|
-
};
|
|
29
|
-
const withId$1 = withId;
|
|
30
|
-
exports.default = withId$1;
|
|
31
|
-
//# sourceMappingURL=withId.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"withId.cjs","sources":["../../../src/hocs/withId.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport hoistNonReactStatics from \"hoist-non-react-statics\";\nimport uniqueId from \"lodash/uniqueId\";\nimport { HvExtraProps } from \"@core/types\";\nimport { getComponentName } from \"@core/utils\";\n\nconst pascalToKebab = (string = \"\") =>\n string.replace(/([a-z0-9])([A-Z])/g, \"$1-$2\").toLowerCase();\n\nexport interface WithIdProps extends HvExtraProps {\n id?: string;\n}\n\nconst withId = (Component) => {\n const WithId = ({ id, ...others }: WithIdProps) => {\n const [internalId] = useState(\n id || uniqueId(`${pascalToKebab(getComponentName(Component))}-`)\n );\n\n return <Component id={internalId} {...others} />;\n };\n\n // https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over\n hoistNonReactStatics(WithId, Component);\n\n if (process.env.NODE_ENV !== \"production\") {\n WithId.Naked = Component;\n }\n\n return WithId;\n};\n\nexport default withId;\n"],"names":["pascalToKebab","string","replace","toLowerCase","withId","Component","WithId","id","others","internalId","useState","uniqueId","getComponentName","hoistNonReactStatics","process","env","NODE_ENV","Naked"],"mappings":";;;;;;;;;;AAMA,MAAMA,gBAAgBA,CAACC,SAAS,OAC9BA,OAAOC,QAAQ,sBAAsB,OAAO,EAAEC;AAMhD,MAAMC,SAAUC,CAAc,cAAA;AAC5B,QAAMC,SAASA,CAAC;AAAA,IAAEC;AAAAA,IAAI,GAAGC;AAAAA,EAAAA,MAA0B;AACjD,UAAM,CAACC,UAAU,IAAIC,eACnBH,MAAMI,kBAAAA,QAAU,GAAEX,cAAcY,iBAAiBP,QAAAA,SAAS,CAAC,IAAI,CAAC;AAGlE,0CAAQA,WAAS;AAAA,MAACE,IAAIE;AAAAA,MAAW,GAAKD;AAAAA,IAAAA,CAAU;AAAA,EAAA;AAIlDK,wCAAqBP,QAAQD,SAAS;AAElCS,MAAAA,QAAQC,IAAIC,aAAa,cAAc;AACzCV,WAAOW,QAAQZ;AAAAA,EACjB;AAEOC,SAAAA;AACT;AAEA,MAAA,WAAeF;;"}
|
package/dist/esm/hocs/withId.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
import hoistNonReactStatics from "hoist-non-react-statics";
|
|
3
|
-
import uniqueId from "lodash/uniqueId";
|
|
4
|
-
import { jsx } from "@emotion/react/jsx-runtime";
|
|
5
|
-
import getComponentName from "../utils/getComponentName.js";
|
|
6
|
-
const pascalToKebab = (string = "") => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
7
|
-
const withId = (Component) => {
|
|
8
|
-
const WithId = ({
|
|
9
|
-
id,
|
|
10
|
-
...others
|
|
11
|
-
}) => {
|
|
12
|
-
const [internalId] = useState(id || uniqueId(`${pascalToKebab(getComponentName(Component))}-`));
|
|
13
|
-
return /* @__PURE__ */ jsx(Component, {
|
|
14
|
-
id: internalId,
|
|
15
|
-
...others
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
hoistNonReactStatics(WithId, Component);
|
|
19
|
-
if (process.env.NODE_ENV !== "production") {
|
|
20
|
-
WithId.Naked = Component;
|
|
21
|
-
}
|
|
22
|
-
return WithId;
|
|
23
|
-
};
|
|
24
|
-
const withId$1 = withId;
|
|
25
|
-
export {
|
|
26
|
-
withId$1 as default
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=withId.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"withId.js","sources":["../../../src/hocs/withId.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport hoistNonReactStatics from \"hoist-non-react-statics\";\nimport uniqueId from \"lodash/uniqueId\";\nimport { HvExtraProps } from \"@core/types\";\nimport { getComponentName } from \"@core/utils\";\n\nconst pascalToKebab = (string = \"\") =>\n string.replace(/([a-z0-9])([A-Z])/g, \"$1-$2\").toLowerCase();\n\nexport interface WithIdProps extends HvExtraProps {\n id?: string;\n}\n\nconst withId = (Component) => {\n const WithId = ({ id, ...others }: WithIdProps) => {\n const [internalId] = useState(\n id || uniqueId(`${pascalToKebab(getComponentName(Component))}-`)\n );\n\n return <Component id={internalId} {...others} />;\n };\n\n // https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over\n hoistNonReactStatics(WithId, Component);\n\n if (process.env.NODE_ENV !== \"production\") {\n WithId.Naked = Component;\n }\n\n return WithId;\n};\n\nexport default withId;\n"],"names":["pascalToKebab","string","replace","toLowerCase","withId","Component","WithId","id","others","internalId","useState","uniqueId","getComponentName","hoistNonReactStatics","process","env","NODE_ENV","Naked"],"mappings":";;;;;AAMA,MAAMA,gBAAgBA,CAACC,SAAS,OAC9BA,OAAOC,QAAQ,sBAAsB,OAAO,EAAEC;AAMhD,MAAMC,SAAUC,CAAc,cAAA;AAC5B,QAAMC,SAASA,CAAC;AAAA,IAAEC;AAAAA,IAAI,GAAGC;AAAAA,EAAAA,MAA0B;AACjD,UAAM,CAACC,UAAU,IAAIC,SACnBH,MAAMI,SAAU,GAAEX,cAAcY,iBAAiBP,SAAS,CAAC,IAAI,CAAC;AAGlE,+BAAQA,WAAS;AAAA,MAACE,IAAIE;AAAAA,MAAW,GAAKD;AAAAA,IAAAA,CAAU;AAAA,EAAA;AAIlDK,uBAAqBP,QAAQD,SAAS;AAElCS,MAAAA,QAAQC,IAAIC,aAAa,cAAc;AACzCV,WAAOW,QAAQZ;AAAAA,EACjB;AAEOC,SAAAA;AACT;AAEA,MAAA,WAAeF;"}
|