@hitachivantara/uikit-react-core 5.38.0 → 5.38.2
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/Banner/Banner.cjs.map +1 -1
- package/dist/cjs/components/Banner/BannerContent/BannerContent.cjs.map +1 -1
- package/dist/cjs/components/BaseCheckBox/BaseCheckBox.cjs.map +1 -1
- package/dist/cjs/components/BaseInput/BaseInput.cjs +1 -1
- package/dist/cjs/components/BaseInput/BaseInput.cjs.map +1 -1
- package/dist/cjs/components/BaseRadio/BaseRadio.cjs.map +1 -1
- package/dist/cjs/components/BaseSwitch/BaseSwitch.cjs.map +1 -1
- package/dist/cjs/components/Button/Button.styles.cjs +7 -18
- package/dist/cjs/components/Button/Button.styles.cjs.map +1 -1
- package/dist/cjs/components/Card/Content/Content.cjs.map +1 -1
- package/dist/cjs/components/Card/Header/Header.cjs.map +1 -1
- package/dist/cjs/components/Container/Container.cjs.map +1 -1
- package/dist/cjs/components/Dialog/Actions/Actions.cjs.map +1 -1
- package/dist/cjs/components/Dialog/Content/Content.cjs.map +1 -1
- package/dist/cjs/components/Dialog/Dialog.cjs.map +1 -1
- package/dist/cjs/components/Drawer/Drawer.cjs +2 -5
- package/dist/cjs/components/Drawer/Drawer.cjs.map +1 -1
- package/dist/cjs/components/Drawer/Drawer.styles.cjs +0 -2
- package/dist/cjs/components/Drawer/Drawer.styles.cjs.map +1 -1
- package/dist/cjs/components/Grid/Grid.cjs.map +1 -1
- package/dist/cjs/components/ListContainer/ListItem/ListItem.cjs.map +1 -1
- package/dist/cjs/components/Pagination/Pagination.cjs +5 -5
- package/dist/cjs/components/Pagination/Pagination.cjs.map +1 -1
- package/dist/cjs/components/QueryBuilder/Rule/Rule.cjs +3 -5
- package/dist/cjs/components/QueryBuilder/Rule/Rule.cjs.map +1 -1
- package/dist/cjs/components/QueryBuilder/RuleGroup/RuleGroup.cjs +6 -7
- package/dist/cjs/components/QueryBuilder/RuleGroup/RuleGroup.cjs.map +1 -1
- package/dist/cjs/components/Radio/Radio.cjs.map +1 -1
- package/dist/cjs/components/Snackbar/Snackbar.cjs.map +1 -1
- package/dist/cjs/components/Snackbar/SnackbarContent/SnackbarContent.cjs.map +1 -1
- package/dist/cjs/components/Switch/Switch.cjs.map +1 -1
- package/dist/cjs/components/Tab/Tab.cjs.map +1 -1
- package/dist/cjs/utils/IconButton.cjs +12 -0
- package/dist/cjs/utils/IconButton.cjs.map +1 -0
- package/dist/esm/components/Banner/Banner.js.map +1 -1
- package/dist/esm/components/Banner/BannerContent/BannerContent.js.map +1 -1
- package/dist/esm/components/BaseCheckBox/BaseCheckBox.js.map +1 -1
- package/dist/esm/components/BaseInput/BaseInput.js +1 -1
- package/dist/esm/components/BaseInput/BaseInput.js.map +1 -1
- package/dist/esm/components/BaseRadio/BaseRadio.js.map +1 -1
- package/dist/esm/components/BaseSwitch/BaseSwitch.js.map +1 -1
- package/dist/esm/components/Button/Button.styles.js +7 -18
- package/dist/esm/components/Button/Button.styles.js.map +1 -1
- package/dist/esm/components/Card/Content/Content.js.map +1 -1
- package/dist/esm/components/Card/Header/Header.js.map +1 -1
- package/dist/esm/components/Container/Container.js.map +1 -1
- package/dist/esm/components/Dialog/Actions/Actions.js.map +1 -1
- package/dist/esm/components/Dialog/Content/Content.js.map +1 -1
- package/dist/esm/components/Dialog/Dialog.js.map +1 -1
- package/dist/esm/components/Drawer/Drawer.js +2 -5
- package/dist/esm/components/Drawer/Drawer.js.map +1 -1
- package/dist/esm/components/Drawer/Drawer.styles.js +0 -2
- package/dist/esm/components/Drawer/Drawer.styles.js.map +1 -1
- package/dist/esm/components/Grid/Grid.js.map +1 -1
- package/dist/esm/components/ListContainer/ListItem/ListItem.js.map +1 -1
- package/dist/esm/components/Pagination/Pagination.js +5 -5
- package/dist/esm/components/Pagination/Pagination.js.map +1 -1
- package/dist/esm/components/QueryBuilder/Rule/Rule.js +4 -6
- package/dist/esm/components/QueryBuilder/Rule/Rule.js.map +1 -1
- package/dist/esm/components/QueryBuilder/RuleGroup/RuleGroup.js +6 -7
- package/dist/esm/components/QueryBuilder/RuleGroup/RuleGroup.js.map +1 -1
- package/dist/esm/components/Radio/Radio.js.map +1 -1
- package/dist/esm/components/Snackbar/Snackbar.js.map +1 -1
- package/dist/esm/components/Snackbar/SnackbarContent/SnackbarContent.js.map +1 -1
- package/dist/esm/components/Switch/Switch.js.map +1 -1
- package/dist/esm/components/Tab/Tab.js.map +1 -1
- package/dist/esm/utils/IconButton.js +12 -0
- package/dist/esm/utils/IconButton.js.map +1 -0
- package/dist/types/index.d.ts +38 -49
- package/package.json +3 -3
- package/dist/cjs/components/Pagination/ButtonIconTooltip.cjs +0 -16
- package/dist/cjs/components/Pagination/ButtonIconTooltip.cjs.map +0 -1
- package/dist/esm/components/Pagination/ButtonIconTooltip.js +0 -16
- package/dist/esm/components/Pagination/ButtonIconTooltip.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuleGroup.js","sources":["../../../../../src/components/QueryBuilder/RuleGroup/RuleGroup.tsx"],"sourcesContent":["import { useCallback } from \"react\";\nimport { Add, Delete, Info } from \"@hitachivantara/uikit-react-icons\";\n\nimport { HvButton } from \"@core/components/Button\";\nimport { HvEmptyState } from \"@core/components/EmptyState\";\nimport { HvMultiButton } from \"@core/components/MultiButton\";\nimport { HvTypography } from \"@core/components/Typography\";\nimport { withTooltip } from \"@core/hocs/withTooltip\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { Rule } from \"../Rule\";\nimport { useQueryBuilderContext } from \"../Context\";\nimport { useClasses } from \"../QueryBuilder.styles\";\nimport { HvQueryBuilderQuery, HvQueryBuilderQueryCombinator } from \"../types\";\n\nexport interface RuleGroupProps {\n id: React.Key;\n level?: number;\n combinator?: string;\n rules?: HvQueryBuilderQuery[\"rules\"];\n classes?: ExtractNames<typeof useClasses>;\n}\n\nexport const RuleGroup = ({\n level = 0,\n id,\n combinator = \"and\",\n rules = [],\n classes: classesProp,\n}: RuleGroupProps) => {\n const { classes, cx } = useClasses(classesProp);\n\n const {\n dispatchAction,\n askAction,\n maxDepth,\n combinators,\n labels,\n readOnly,\n disableConfirmation,\n } = useQueryBuilderContext();\n\n const normalizedMaxDepth = maxDepth - 1;\n\n const actionButtons = (\n <>\n <div className={classes.buttonBackground}>\n <HvButton\n variant=\"secondarySubtle\"\n onClick={() => {\n dispatchAction({ type: \"add-rule\", id });\n }}\n disabled={readOnly}\n startIcon={<Add />}\n >\n {level === 0 && labels.query?.addRule?.label != null\n ? labels.query?.addRule?.label\n : labels.group.addRule.label}\n </HvButton>\n </div>\n {level <= normalizedMaxDepth && (\n <div className={classes.buttonBackground}>\n <HvButton\n variant=\"secondarySubtle\"\n onClick={() => {\n dispatchAction({ type: \"add-group\", id });\n }}\n disabled={readOnly}\n startIcon={<Add />}\n >\n {level === 0 && labels.query?.addGroup?.label != null\n ? labels.query?.addGroup?.label\n : labels.group.addGroup.label}\n </HvButton>\n </div>\n )}\n </>\n );\n\n const DeleteIcon = withTooltip(\n () => (\n <Delete className={cx({ [classes.topRemoveButtonDisabled]: readOnly })} />\n ),\n level === 0 && labels.query?.delete?.tooltip\n ? labels.query?.delete?.tooltip\n : labels.group.delete.tooltip,\n \"top\"\n );\n\n const onClickCombinator = useCallback(\n (item: HvQueryBuilderQueryCombinator) => {\n dispatchAction({\n type: \"set-combinator\",\n id,\n combinator: item.operand,\n });\n },\n [dispatchAction, id]\n );\n\n return (\n <div\n className={cx(classes.root, {\n [classes.topGroup]: level === 0,\n [classes.subGroup]: level > 0,\n })}\n >\n <HvMultiButton\n className={cx(classes.combinator, classes.topCombinator)}\n disabled={readOnly}\n >\n {combinators &&\n combinators.map((item) => (\n <HvButton\n key={item.operand}\n className={classes.combinatorButton}\n selected={item.operand === combinator}\n onClick={() => item.operand && onClickCombinator(item)}\n disabled={readOnly}\n size=\"xs\"\n >\n {item.label}\n </HvButton>\n ))}\n </HvMultiButton>\n <div className={cx(classes.buttonBackground, classes.topRemoveButton)}>\n <HvButton\n icon\n className={classes.removeButton}\n onClick={() =>\n disableConfirmation\n ? dispatchAction({ type: \"remove-node\", id })\n : askAction({\n actions: [{ type: \"remove-node\", id }],\n dialog:\n level === 0 && labels.query?.delete != null\n ? labels.query.delete\n : labels.group.delete,\n })\n }\n aria-label={\n level === 0 && labels.query?.delete?.ariaLabel\n ? labels.query?.delete?.ariaLabel\n : labels.group.delete.ariaLabel\n }\n disabled={readOnly}\n >\n <DeleteIcon />\n </HvButton>\n </div>\n {rules?.length > 0 && (\n <div\n className={cx(classes.rulesContainer, {\n [classes.subRulesContainer]: level > 0,\n [classes.topRulesContainer]: level === 0,\n })}\n >\n {rules.map((rule, index) => {\n if (\"combinator\" in rule) {\n return (\n <RuleGroup\n key={rule.id}\n level={level + 1}\n {...rule}\n id={rule.id}\n classes={classes}\n />\n );\n }\n\n const isInvalid =\n combinator === \"and\" &&\n rules.some((r, i) => {\n if (\"attribute\" in r) {\n if (\n r.attribute === rule.attribute &&\n r.id !== rule.id &&\n i < index\n ) {\n return true;\n }\n }\n return false;\n });\n\n return (\n <Rule\n key={rule.id}\n {...rule}\n isInvalid={isInvalid}\n id={rule.id}\n combinator={combinator}\n />\n );\n })}\n </div>\n )}\n {rules?.length === 0 && (\n <HvEmptyState\n title={labels.empty?.title}\n message={\n <>\n <HvTypography\n link\n component=\"button\"\n onClick={() => {\n dispatchAction({ type: \"add-rule\", id });\n }}\n className={classes.createConditionButton}\n >\n {`${labels.empty?.createCondition}`}\n </HvTypography>\n {level <= normalizedMaxDepth && (\n <>\n {`${labels.empty?.spacer}`}\n <HvTypography\n link\n component=\"button\"\n onClick={() => {\n dispatchAction({ type: \"add-group\", id });\n }}\n className={classes.createGroupButton}\n >\n {`${labels.empty?.createGroup}`}\n </HvTypography>\n </>\n )}\n </>\n }\n icon={<Info />}\n />\n )}\n <div\n className={cx(\n classes.actionButtonContainer,\n classes.topActionButtonContainer\n )}\n >\n {actionButtons}\n </div>\n </div>\n );\n};\n"],"names":["RuleGroup","level","id","combinator","rules","classes","classesProp","cx","useClasses","dispatchAction","askAction","maxDepth","combinators","labels","readOnly","disableConfirmation","useQueryBuilderContext","normalizedMaxDepth","actionButtons","buttonBackground","type","query","addRule","label","group","addGroup","DeleteIcon","withTooltip","topRemoveButtonDisabled","delete","tooltip","onClickCombinator","useCallback","item","operand","root","topGroup","subGroup","topCombinator","map","combinatorButton","topRemoveButton","removeButton","actions","dialog","ariaLabel","length","rulesContainer","subRulesContainer","topRulesContainer","rule","index","isInvalid","some","r","i","attribute","empty","title","createConditionButton","createCondition","spacer","createGroupButton","createGroup","actionButtonContainer","topActionButtonContainer"],"mappings":";;;;;;;;;;;AAuBO,MAAMA,YAAYA,CAAC;AAAA,EACxBC,QAAQ;AAAA,EACRC;AAAAA,EACAC,aAAa;AAAA,EACbC,QAAQ,CAAE;AAAA,EACVC,SAASC;AACK,MAAM;AACd,QAAA;AAAA,IAAED;AAAAA,IAASE;AAAAA,EAAAA,IAAOC,WAAWF,WAAW;AAExC,QAAA;AAAA,IACJG;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,MACEC,uBAAuB;AAE3B,QAAMC,qBAAqBN,WAAW;AAEtC,QAAMO,gBAEF,qBAAA,UAAA,EAAA,UAAA;AAAA,IAAC,oBAAA,OAAA,EAAI,WAAWb,QAAQc,kBACtB,8BAAC,UACC,EAAA,SAAQ,mBACR,SAAS,MAAM;AACE,qBAAA;AAAA,QAAEC,MAAM;AAAA,QAAYlB;AAAAA,MAAAA,CAAI;AAAA,IACzC,GACA,UAAUY,UACV,+BAAY,UAEXb,UAAU,UAAA,KAAKY,OAAOQ,OAAOC,SAASC,SAAS,OAC5CV,OAAOQ,OAAOC,SAASC,QACvBV,OAAOW,MAAMF,QAAQC,MAAAA,CAC3B,EACF,CAAA;AAAA,IACCtB,SAASgB,sBACP,oBAAA,OAAA,EAAI,WAAWZ,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IJ,OACJ;AACO,mBAAA;AAAA,UACT;AAAA,QACF;AACO,eAAA;AAAA,MAAA,CACR;AAGD,aAAA,oBAAC,MAEC,EAAA,GAAID,MACJ,WACA,IAAIA,KAAKhD,IACT,WAJKgD,GAAAA,KAAKhD,EAKV;AAAA,IAEL,CAAA,GACH;AAAA,IAEDE,OAAO0C,WAAW,KAChB,oBAAA,cAAA,EACC,OAAOjC,OAAO4C,OAAOC,OACrB,SAEI,qBAAA,UAAA,EAAA,UAAA;AAAA,MAAA,oBAAC,gBACC,MAAI,MACJ,WAAU,UACV,SAAS,MAAM;AACE,uBAAA;AAAA,UAAEtC,MAAM;AAAA,UAAYlB;AAAAA,QAAAA,CAAI;AAAA,MAAA,GAEzC,WAAWG,QAAQsD,uBAEjB,aAAE9C,OAAO4C,OAAOG,eAAgB,IACpC;AAAA,MACC3D,SAASgB,sBAEJ,qBAAA,UAAA,EAAA,UAAA;AAAA,QAAEJ,GAAAA,OAAO4C,OAAOI,MAAO;AAAA,4BACxB,cACC,EAAA,MAAI,MACJ,WAAU,UACV,SAAS,MAAM;AACE,yBAAA;AAAA,YAAEzC,MAAM;AAAA,YAAalB;AAAAA,UAAAA,CAAI;AAAA,QAAA,GAE1C,WAAWG,QAAQyD,mBAEjB,aAAEjD,OAAO4C,OAAOM,WAAY,IAChC;AAAA,MAAA,GACF;AAAA,IAAA,EAEJ,CAAA,GAEF,MAAO,oBAAA,MAAA,CAAA,CAAO,EAEjB,CAAA;AAAA,IACD,oBAAC,SACC,WAAWxD,GACTF,QAAQ2D,uBACR3D,QAAQ4D,wBACV,GAEC/C,UACH,cAAA,CAAA;AAAA,EACF,EAAA,CAAA;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"RuleGroup.js","sources":["../../../../../src/components/QueryBuilder/RuleGroup/RuleGroup.tsx"],"sourcesContent":["import { useCallback } from \"react\";\nimport { Add, Delete, Info } from \"@hitachivantara/uikit-react-icons\";\n\nimport { HvButton } from \"@core/components/Button\";\nimport { HvEmptyState } from \"@core/components/EmptyState\";\nimport { HvMultiButton } from \"@core/components/MultiButton\";\nimport { HvTypography } from \"@core/components/Typography\";\nimport { IconButton } from \"@core/utils/IconButton\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { Rule } from \"../Rule\";\nimport { useQueryBuilderContext } from \"../Context\";\nimport { useClasses } from \"../QueryBuilder.styles\";\nimport { HvQueryBuilderQuery, HvQueryBuilderQueryCombinator } from \"../types\";\n\nexport interface RuleGroupProps {\n id: React.Key;\n level?: number;\n combinator?: string;\n rules?: HvQueryBuilderQuery[\"rules\"];\n classes?: ExtractNames<typeof useClasses>;\n}\n\nexport const RuleGroup = ({\n level = 0,\n id,\n combinator = \"and\",\n rules = [],\n classes: classesProp,\n}: RuleGroupProps) => {\n const { classes, cx } = useClasses(classesProp);\n\n const {\n dispatchAction,\n askAction,\n maxDepth,\n combinators,\n labels,\n readOnly,\n disableConfirmation,\n } = useQueryBuilderContext();\n\n const normalizedMaxDepth = maxDepth - 1;\n\n const actionButtons = (\n <>\n <div className={classes.buttonBackground}>\n <HvButton\n variant=\"secondarySubtle\"\n onClick={() => {\n dispatchAction({ type: \"add-rule\", id });\n }}\n disabled={readOnly}\n startIcon={<Add />}\n >\n {level === 0 && labels.query?.addRule?.label != null\n ? labels.query?.addRule?.label\n : labels.group.addRule.label}\n </HvButton>\n </div>\n {level <= normalizedMaxDepth && (\n <div className={classes.buttonBackground}>\n <HvButton\n variant=\"secondarySubtle\"\n onClick={() => {\n dispatchAction({ type: \"add-group\", id });\n }}\n disabled={readOnly}\n startIcon={<Add />}\n >\n {level === 0 && labels.query?.addGroup?.label != null\n ? labels.query?.addGroup?.label\n : labels.group.addGroup.label}\n </HvButton>\n </div>\n )}\n </>\n );\n\n const onClickCombinator = useCallback(\n (item: HvQueryBuilderQueryCombinator) => {\n dispatchAction({\n type: \"set-combinator\",\n id,\n combinator: item.operand,\n });\n },\n [dispatchAction, id]\n );\n\n return (\n <div\n className={cx(classes.root, {\n [classes.topGroup]: level === 0,\n [classes.subGroup]: level > 0,\n })}\n >\n <HvMultiButton\n className={cx(classes.combinator, classes.topCombinator)}\n disabled={readOnly}\n >\n {combinators?.map((item) => (\n <HvButton\n key={item.operand}\n className={classes.combinatorButton}\n selected={item.operand === combinator}\n onClick={() => item.operand && onClickCombinator(item)}\n disabled={readOnly}\n size=\"xs\"\n >\n {item.label}\n </HvButton>\n ))}\n </HvMultiButton>\n <div className={cx(classes.buttonBackground, classes.topRemoveButton)}>\n <IconButton\n className={classes.removeButton}\n onClick={() =>\n disableConfirmation\n ? dispatchAction({ type: \"remove-node\", id })\n : askAction({\n actions: [{ type: \"remove-node\", id }],\n dialog:\n level === 0 && labels.query?.delete != null\n ? labels.query.delete\n : labels.group.delete,\n })\n }\n title={\n (level === 0 && labels.query?.delete?.tooltip) ||\n labels.group.delete.tooltip ||\n (level === 0 && labels.query?.delete?.ariaLabel) ||\n labels.group.delete.ariaLabel\n }\n disabled={readOnly}\n >\n <Delete\n role=\"none\"\n className={cx({ [classes.topRemoveButtonDisabled]: readOnly })}\n />\n </IconButton>\n </div>\n {rules?.length > 0 && (\n <div\n className={cx(classes.rulesContainer, {\n [classes.subRulesContainer]: level > 0,\n [classes.topRulesContainer]: level === 0,\n })}\n >\n {rules.map((rule, index) => {\n if (\"combinator\" in rule) {\n return (\n <RuleGroup\n key={rule.id}\n level={level + 1}\n {...rule}\n id={rule.id}\n classes={classes}\n />\n );\n }\n\n const isInvalid =\n combinator === \"and\" &&\n rules.some((r, i) => {\n if (\"attribute\" in r) {\n if (\n r.attribute === rule.attribute &&\n r.id !== rule.id &&\n i < index\n ) {\n return true;\n }\n }\n return false;\n });\n\n return (\n <Rule\n key={rule.id}\n {...rule}\n isInvalid={isInvalid}\n id={rule.id}\n combinator={combinator}\n />\n );\n })}\n </div>\n )}\n {rules?.length === 0 && (\n <HvEmptyState\n title={labels.empty?.title}\n message={\n <>\n <HvTypography\n link\n component=\"button\"\n onClick={() => {\n dispatchAction({ type: \"add-rule\", id });\n }}\n className={classes.createConditionButton}\n >\n {`${labels.empty?.createCondition}`}\n </HvTypography>\n {level <= normalizedMaxDepth && (\n <>\n {`${labels.empty?.spacer}`}\n <HvTypography\n link\n component=\"button\"\n onClick={() => {\n dispatchAction({ type: \"add-group\", id });\n }}\n className={classes.createGroupButton}\n >\n {`${labels.empty?.createGroup}`}\n </HvTypography>\n </>\n )}\n </>\n }\n icon={<Info />}\n />\n )}\n <div\n className={cx(\n classes.actionButtonContainer,\n classes.topActionButtonContainer\n )}\n >\n {actionButtons}\n </div>\n </div>\n );\n};\n"],"names":["RuleGroup","level","id","combinator","rules","classes","classesProp","cx","useClasses","dispatchAction","askAction","maxDepth","combinators","labels","readOnly","disableConfirmation","useQueryBuilderContext","normalizedMaxDepth","actionButtons","buttonBackground","type","query","addRule","label","group","addGroup","onClickCombinator","useCallback","item","operand","root","topGroup","subGroup","topCombinator","map","combinatorButton","topRemoveButton","removeButton","actions","dialog","delete","tooltip","ariaLabel","topRemoveButtonDisabled","length","rulesContainer","subRulesContainer","topRulesContainer","rule","index","isInvalid","some","r","i","attribute","empty","title","createConditionButton","createCondition","spacer","createGroupButton","createGroup","actionButtonContainer","topActionButtonContainer"],"mappings":";;;;;;;;;;;AAuBO,MAAMA,YAAYA,CAAC;AAAA,EACxBC,QAAQ;AAAA,EACRC;AAAAA,EACAC,aAAa;AAAA,EACbC,QAAQ,CAAE;AAAA,EACVC,SAASC;AACK,MAAM;AACd,QAAA;AAAA,IAAED;AAAAA,IAASE;AAAAA,EAAAA,IAAOC,WAAWF,WAAW;AAExC,QAAA;AAAA,IACJG;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,MACEC,uBAAuB;AAE3B,QAAMC,qBAAqBN,WAAW;AAEtC,QAAMO,gBAEF,qBAAA,UAAA,EAAA,UAAA;AAAA,IAAC,oBAAA,OAAA,EAAI,WAAWb,QAAQc,kBACtB,8BAAC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}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.js","sources":["../../../../src/components/Radio/Radio.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useState } from \"react\";\n\nimport { RadioProps as MuiRadioProps } from \"@mui/material\";\n\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { HvBaseRadio } from \"@core/components/BaseRadio\";\nimport {\n HvWarningText,\n HvLabelProps,\n isInvalid,\n HvFormElement,\n HvLabel,\n} from \"@core/components/Forms\";\nimport { useUniqueId } from \"@core/hooks/useUniqueId\";\nimport { useControlled } from \"@core/hooks/useControlled\";\nimport { setId } from \"@core/utils/setId\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { staticClasses, useClasses } from \"./Radio.styles\";\n\nexport { staticClasses as radioClasses };\n\nexport type HvRadioClasses = ExtractNames<typeof useClasses>;\n\nexport type HvRadioStatus = \"standBy\" | \"valid\" | \"invalid\";\n\nexport interface HvRadioProps\n extends Omit<MuiRadioProps, \"onChange\" | \"classes\">,\n HvBaseProps<HTMLButtonElement, \"onChange\" | \"color\"> {\n /**\n * A Jss Object used to override or extend the styles applied to the radio button.\n */\n classes?: HvRadioClasses;\n /**\n * The form element name.\n */\n name?: string;\n /**\n * The value of the form element.\n *\n * The default value is \"on\".\n */\n value?: any;\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.\n */\n label?: React.ReactNode;\n /**\n * Properties passed on to the label element.\n */\n labelProps?: HvLabelProps;\n /**\n * Indicates that user input is required on the form element.\n *\n * If a single radio button in a group has the required attribute, a radio button in\n * that group must be check, though it doesn't have to be the one with the attribute is applied.\n *\n * For that reason, the component doesn't make any uncontrolled changes to its validation status.\n * That should ideally be managed in the context of a radio button group.\n */\n required?: boolean;\n /**\n * Indicates that the form element is not editable.\n */\n readOnly?: boolean;\n /**\n * Indicates that the form element is disabled.\n */\n disabled?: boolean;\n /**\n * If `true` the radio button is selected, if set to `false` the radio button is not selected.\n *\n * When defined the radio button state becomes controlled.\n */\n checked?: boolean;\n /**\n * When uncontrolled, defines the initial checked state.\n */\n defaultChecked?: boolean;\n /**\n * The status of the form element.\n *\n * Valid is correct, invalid is incorrect and standBy means no validations have run.\n */\n status?: HvRadioStatus;\n /**\n * The error message to show when `status` is \"invalid\".\n */\n statusMessage?: string;\n /**\n * Identifies the element that provides an error message for the radio button.\n *\n * Will only be used when the validation status is invalid.\n */\n \"aria-errormessage\"?: string;\n /**\n * The callback fired when the radio button is pressed.\n */\n onChange?: (\n event: React.ChangeEvent<HTMLInputElement>,\n checked: boolean,\n value: any\n ) => void;\n /**\n * Whether the selector should use semantic colors.\n */\n semantic?: boolean;\n /**\n * Properties passed on to the input element.\n */\n inputProps?: React.InputHTMLAttributes<HTMLInputElement>;\n /**\n * Callback fired when the component is focused with a keyboard.\n * We trigger a `onFocus` callback too.\n */\n onFocusVisible?: (event: React.FocusEvent<any>) => void;\n /** @ignore */\n ref?: MuiRadioProps[\"ref\"];\n /** @ignore */\n component?: MuiRadioProps[\"component\"];\n}\n\n/**\n * A Radio Button is a mechanism that allows user to select just an option from a group of options.\n *\n * It should used in a Radio Button Group to present the user with a range of options from\n * which the user <b>may select just one option</b> to complete their task.\n *\n * Individual use of radio buttons, at least uncontrolled, is unadvised as React state management doesn't\n * respond to the browser's native management of radio inputs checked state.\n */\nexport const HvRadio = forwardRef<HTMLButtonElement, HvRadioProps>(\n (props, ref) => {\n const {\n classes: classesProp,\n className,\n id,\n name,\n value = \"on\",\n required = false,\n readOnly = false,\n disabled = false,\n label,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n labelProps,\n checked,\n defaultChecked = false,\n onChange,\n status = \"standBy\",\n statusMessage,\n \"aria-errormessage\": ariaErrorMessage,\n semantic = false,\n inputProps,\n onFocusVisible,\n onBlur,\n ...others\n } = useDefaultProps(\"HvRadio\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const elementId = useUniqueId(id, \"hvradio\");\n\n const [focusVisible, setFocusVisible] = useState(false);\n\n const onFocusVisibleCallback = useCallback(\n (evt: React.FocusEvent<any>) => {\n setFocusVisible(true);\n onFocusVisible?.(evt);\n },\n [onFocusVisible]\n );\n\n const onBlurCallback = useCallback(\n (evt: React.FocusEvent<any>) => {\n setFocusVisible(false);\n onBlur?.(evt);\n },\n [onBlur]\n );\n\n const [isChecked, setIsChecked] = useControlled(\n checked,\n Boolean(defaultChecked)\n );\n\n const onLocalChange = useCallback(\n (evt: React.ChangeEvent<HTMLInputElement>, newChecked: boolean) => {\n setIsChecked(newChecked);\n\n onChange?.(evt, newChecked, value);\n },\n [onChange, setIsChecked, value]\n );\n\n // the error message area will only be created if:\n // - an external element that provides an error message isn't identified via aria-errormessage AND\n // - both status and statusMessage properties are being controlled\n const canShowError =\n ariaErrorMessage == null &&\n status !== undefined &&\n statusMessage !== undefined;\n\n const hasLabel = label != null;\n\n const isStateInvalid = isInvalid(status);\n\n let errorMessageId: string | undefined;\n if (isStateInvalid) {\n errorMessageId = canShowError\n ? setId(elementId, \"error\")\n : ariaErrorMessage;\n }\n\n const radio = (\n <HvBaseRadio\n ref={ref}\n id={label ? setId(elementId, \"input\") : setId(id, \"input\")}\n name={name}\n className={cx(classes.radio, {\n [classes.invalidRadio]: isStateInvalid,\n })}\n disabled={disabled}\n readOnly={readOnly}\n onChange={onLocalChange}\n value={value}\n checked={isChecked}\n semantic={semantic}\n inputProps={{\n \"aria-invalid\": isStateInvalid ? true : undefined,\n \"aria-errormessage\": errorMessageId,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n ...inputProps,\n }}\n onFocusVisible={onFocusVisibleCallback}\n onBlur={onBlurCallback}\n {...others}\n />\n );\n\n return (\n <HvFormElement\n id={id}\n name={name}\n status={status || \"standBy\"}\n disabled={disabled}\n required={required}\n readOnly={readOnly}\n className={cx(classes.root, className)}\n >\n {hasLabel ? (\n <div\n className={cx(classes.container, {\n [classes.disabled]: disabled,\n [classes.focusVisible]: !!(focusVisible && label),\n [classes.invalidContainer]: isStateInvalid,\n })}\n >\n {radio}\n <HvLabel\n id={setId(elementId, \"label\")}\n htmlFor={setId(elementId, \"input\")}\n label={label}\n className={classes.label}\n {...labelProps}\n />\n </div>\n ) : (\n radio\n )}\n {canShowError && (\n <HvWarningText id={setId(elementId, \"error\")} disableBorder>\n {statusMessage}\n </HvWarningText>\n )}\n </HvFormElement>\n );\n }\n);\n"],"names":["HvRadio","forwardRef","props","ref","classes","classesProp","className","id","name","value","required","readOnly","disabled","label","ariaLabel","ariaLabelledBy","ariaDescribedBy","labelProps","checked","defaultChecked","onChange","status","statusMessage","ariaErrorMessage","semantic","inputProps","onFocusVisible","onBlur","others","useDefaultProps","cx","useClasses","elementId","useUniqueId","focusVisible","setFocusVisible","useState","onFocusVisibleCallback","useCallback","evt","onBlurCallback","isChecked","setIsChecked","useControlled","Boolean","onLocalChange","newChecked","canShowError","undefined","hasLabel","isStateInvalid","isInvalid","errorMessageId","setId","radio","invalidRadio","root","container","invalidContainer"],"mappings":";;;;;;;;;;;;;AAuIO,MAAMA,UAAUC,WACrB,CAACC,OAAOC,QAAQ;AACR,QAAA;AAAA,IACJC,SAASC;AAAAA,IACTC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,QAAQ;AAAA,IACRC,WAAW;AAAA,IACXC,WAAW;AAAA,IACXC,WAAW;AAAA,IACXC;AAAAA,IACA,cAAcC;AAAAA,IACd,mBAAmBC;AAAAA,IACnB,oBAAoBC;AAAAA,IACpBC;AAAAA,IACAC;AAAAA,IACAC,iBAAiB;AAAA,IACjBC;AAAAA,IACAC,SAAS;AAAA,IACTC;AAAAA,IACA,qBAAqBC;AAAAA,IACrBC,WAAW;AAAA,IACXC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACA,GAAGC;AAAAA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iB,OAAOF;AAAAA,IACxC,qBAAqBI;AAAAA,IACrB,cAActC;AAAAA,IACd,mBAAmBC;AAAAA,IACnB,oBAAoBC;AAAAA,IACpB,GAAGS;AAAAA,EAAAA,GAEL,gBAAgBY,wBAChB,QAAQG,gBACJZ,GAAAA,OAEP,CAAA;AAED,SACG,qBAAA,eAAA,EACC,IACA,MACA,QAAQP,UAAU,WAClB,UACA,UACA,UACA,WAAWS,GAAG1B,QAAQoD,MAAMlD,SAAS,GAEpC2C,UAAAA;AAAAA,IAAAA,WACE,qBAAA,OAAA,EACC,WAAWnB,GAAG1B,QAAQqD,WAAW;AAAA,MAC/B,CAACrD,QAAQQ,QAAQ,GAAGA;AAAAA,MACpB,CAACR,QAAQ8B,YAAY,GAAG,CAAC,EAAEA,gBAAgBrB;AAAAA,MAC3C,CAACT,QAAQsD,gBAAgB,GAAGR;AAAAA,IAC7B,CAAA,GAEAI,UAAAA;AAAAA,MAAAA;AAAAA,0BACA,SACC,EAAA,IAAID,MAAMrB,WAAW,OAAO,GAC5B,SAASqB,MAAMrB,WAAW,OAAO,GACjC,OACA,WAAW5B,QAAQS,OACnB,GAAII,YAAW;AAAA,IAAA,EAAA,CAEnB,IAEAqC;AAAAA,IAEDP,gBACE,oBAAA,eAAA,EAAc,IAAIM,MAAMrB,WAAW,OAAO,GAAG,eAAa,MACxDV,UACH,cAAA,CAAA;AAAA,EAEJ,EAAA,CAAA;AAEJ,CACF;"}
|
|
1
|
+
{"version":3,"file":"Radio.js","sources":["../../../../src/components/Radio/Radio.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useState } from \"react\";\n\nimport { RadioProps as MuiRadioProps } from \"@mui/material\";\n\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { HvBaseRadio } from \"@core/components/BaseRadio\";\nimport {\n HvWarningText,\n HvLabelProps,\n isInvalid,\n HvFormElement,\n HvLabel,\n} from \"@core/components/Forms\";\nimport { useUniqueId } from \"@core/hooks/useUniqueId\";\nimport { useControlled } from \"@core/hooks/useControlled\";\nimport { setId } from \"@core/utils/setId\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { staticClasses, useClasses } from \"./Radio.styles\";\n\nexport { staticClasses as radioClasses };\n\nexport type HvRadioClasses = ExtractNames<typeof useClasses>;\n\nexport type HvRadioStatus = \"standBy\" | \"valid\" | \"invalid\";\n\nexport interface HvRadioProps\n extends Omit<MuiRadioProps, \"onChange\" | \"classes\"> {\n /**\n * A Jss Object used to override or extend the styles applied to the radio button.\n */\n classes?: HvRadioClasses;\n /**\n * The form element name.\n */\n name?: string;\n /**\n * The value of the form element.\n *\n * The default value is \"on\".\n */\n value?: any;\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.\n */\n label?: React.ReactNode;\n /**\n * Properties passed on to the label element.\n */\n labelProps?: HvLabelProps;\n /**\n * Indicates that user input is required on the form element.\n *\n * If a single radio button in a group has the required attribute, a radio button in\n * that group must be check, though it doesn't have to be the one with the attribute is applied.\n *\n * For that reason, the component doesn't make any uncontrolled changes to its validation status.\n * That should ideally be managed in the context of a radio button group.\n */\n required?: boolean;\n /**\n * Indicates that the form element is not editable.\n */\n readOnly?: boolean;\n /**\n * Indicates that the form element is disabled.\n */\n disabled?: boolean;\n /**\n * If `true` the radio button is selected, if set to `false` the radio button is not selected.\n *\n * When defined the radio button state becomes controlled.\n */\n checked?: boolean;\n /**\n * When uncontrolled, defines the initial checked state.\n */\n defaultChecked?: boolean;\n /**\n * The status of the form element.\n *\n * Valid is correct, invalid is incorrect and standBy means no validations have run.\n */\n status?: HvRadioStatus;\n /**\n * The error message to show when `status` is \"invalid\".\n */\n statusMessage?: string;\n /**\n * Identifies the element that provides an error message for the radio button.\n *\n * Will only be used when the validation status is invalid.\n */\n \"aria-errormessage\"?: string;\n /**\n * The callback fired when the radio button is pressed.\n */\n onChange?: (\n event: React.ChangeEvent<HTMLInputElement>,\n checked: boolean,\n value: any\n ) => void;\n /**\n * Whether the selector should use semantic colors.\n */\n semantic?: boolean;\n /**\n * Properties passed on to the input element.\n */\n inputProps?: React.InputHTMLAttributes<HTMLInputElement>;\n /**\n * Callback fired when the component is focused with a keyboard.\n * We trigger a `onFocus` callback too.\n */\n onFocusVisible?: (event: React.FocusEvent<any>) => void;\n /** @ignore */\n ref?: MuiRadioProps[\"ref\"];\n /** @ignore */\n component?: MuiRadioProps[\"component\"];\n}\n\n/**\n * A Radio Button is a mechanism that allows user to select just an option from a group of options.\n *\n * It should used in a Radio Button Group to present the user with a range of options from\n * which the user <b>may select just one option</b> to complete their task.\n *\n * Individual use of radio buttons, at least uncontrolled, is unadvised as React state management doesn't\n * respond to the browser's native management of radio inputs checked state.\n */\nexport const HvRadio = forwardRef<HTMLButtonElement, HvRadioProps>(\n (props, ref) => {\n const {\n classes: classesProp,\n className,\n id,\n name,\n value = \"on\",\n required = false,\n readOnly = false,\n disabled = false,\n label,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n labelProps,\n checked,\n defaultChecked = false,\n onChange,\n status = \"standBy\",\n statusMessage,\n \"aria-errormessage\": ariaErrorMessage,\n semantic = false,\n inputProps,\n onFocusVisible,\n onBlur,\n ...others\n } = useDefaultProps(\"HvRadio\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const elementId = useUniqueId(id, \"hvradio\");\n\n const [focusVisible, setFocusVisible] = useState(false);\n\n const onFocusVisibleCallback = useCallback(\n (evt: React.FocusEvent<any>) => {\n setFocusVisible(true);\n onFocusVisible?.(evt);\n },\n [onFocusVisible]\n );\n\n const onBlurCallback = useCallback(\n (evt: React.FocusEvent<any>) => {\n setFocusVisible(false);\n onBlur?.(evt);\n },\n [onBlur]\n );\n\n const [isChecked, setIsChecked] = useControlled(\n checked,\n Boolean(defaultChecked)\n );\n\n const onLocalChange = useCallback(\n (evt: React.ChangeEvent<HTMLInputElement>, newChecked: boolean) => {\n setIsChecked(newChecked);\n\n onChange?.(evt, newChecked, value);\n },\n [onChange, setIsChecked, value]\n );\n\n // the error message area will only be created if:\n // - an external element that provides an error message isn't identified via aria-errormessage AND\n // - both status and statusMessage properties are being controlled\n const canShowError =\n ariaErrorMessage == null &&\n status !== undefined &&\n statusMessage !== undefined;\n\n const hasLabel = label != null;\n\n const isStateInvalid = isInvalid(status);\n\n let errorMessageId: string | undefined;\n if (isStateInvalid) {\n errorMessageId = canShowError\n ? setId(elementId, \"error\")\n : ariaErrorMessage;\n }\n\n const radio = (\n <HvBaseRadio\n ref={ref}\n id={label ? setId(elementId, \"input\") : setId(id, \"input\")}\n name={name}\n className={cx(classes.radio, {\n [classes.invalidRadio]: isStateInvalid,\n })}\n disabled={disabled}\n readOnly={readOnly}\n onChange={onLocalChange}\n value={value}\n checked={isChecked}\n semantic={semantic}\n inputProps={{\n \"aria-invalid\": isStateInvalid ? true : undefined,\n \"aria-errormessage\": errorMessageId,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n ...inputProps,\n }}\n onFocusVisible={onFocusVisibleCallback}\n onBlur={onBlurCallback}\n {...others}\n />\n );\n\n return (\n <HvFormElement\n id={id}\n name={name}\n status={status || \"standBy\"}\n disabled={disabled}\n required={required}\n readOnly={readOnly}\n className={cx(classes.root, className)}\n >\n {hasLabel ? (\n <div\n className={cx(classes.container, {\n [classes.disabled]: disabled,\n [classes.focusVisible]: !!(focusVisible && label),\n [classes.invalidContainer]: isStateInvalid,\n })}\n >\n {radio}\n <HvLabel\n id={setId(elementId, \"label\")}\n htmlFor={setId(elementId, \"input\")}\n label={label}\n className={classes.label}\n {...labelProps}\n />\n </div>\n ) : (\n radio\n )}\n {canShowError && (\n <HvWarningText id={setId(elementId, \"error\")} disableBorder>\n {statusMessage}\n </HvWarningText>\n )}\n </HvFormElement>\n );\n }\n);\n"],"names":["HvRadio","forwardRef","props","ref","classes","classesProp","className","id","name","value","required","readOnly","disabled","label","ariaLabel","ariaLabelledBy","ariaDescribedBy","labelProps","checked","defaultChecked","onChange","status","statusMessage","ariaErrorMessage","semantic","inputProps","onFocusVisible","onBlur","others","useDefaultProps","cx","useClasses","elementId","useUniqueId","focusVisible","setFocusVisible","useState","onFocusVisibleCallback","useCallback","evt","onBlurCallback","isChecked","setIsChecked","useControlled","Boolean","onLocalChange","newChecked","canShowError","undefined","hasLabel","isStateInvalid","isInvalid","errorMessageId","setId","radio","invalidRadio","root","container","invalidContainer"],"mappings":";;;;;;;;;;;;;AAqIO,MAAMA,UAAUC,WACrB,CAACC,OAAOC,QAAQ;AACR,QAAA;AAAA,IACJC,SAASC;AAAAA,IACTC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,QAAQ;AAAA,IACRC,WAAW;AAAA,IACXC,WAAW;AAAA,IACXC,WAAW;AAAA,IACXC;AAAAA,IACA,cAAcC;AAAAA,IACd,mBAAmBC;AAAAA,IACnB,oBAAoBC;AAAAA,IACpBC;AAAAA,IACAC;AAAAA,IACAC,iBAAiB;AAAA,IACjBC;AAAAA,IACAC,SAAS;AAAA,IACTC;AAAAA,IACA,qBAAqBC;AAAAA,IACrBC,WAAW;AAAA,IACXC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACA,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,WAAW3B,KAAK;AAE9B,QAAA;AAAA,IAAEE;AAAAA,IAAS0B;AAAAA,EAAAA,IAAOC,WAAW1B,WAAW;AAExC2B,QAAAA,YAAYC,YAAY1B,IAAI,SAAS;AAE3C,QAAM,CAAC2B,cAAcC,eAAe,IAAIC,SAAS,KAAK;AAEhDC,QAAAA,yBAAyBC,YAC7B,CAACC,QAA+B;AAC9BJ,oBAAgB,IAAI;AACpBT,qBAAiBa,GAAG;AAAA,EAAA,GAEtB,CAACb,cAAc,CACjB;AAEMc,QAAAA,iBAAiBF,YACrB,CAACC,QAA+B;AAC9BJ,oBAAgB,KAAK;AACrBR,aAASY,GAAG;AA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AA,MACpB,CAACR,QAAQ8B,YAAY,GAAG,CAAC,EAAEA,gBAAgBrB;AAAAA,MAC3C,CAACT,QAAQsD,gBAAgB,GAAGR;AAAAA,IAC7B,CAAA,GAEAI,UAAAA;AAAAA,MAAAA;AAAAA,0BACA,SACC,EAAA,IAAID,MAAMrB,WAAW,OAAO,GAC5B,SAASqB,MAAMrB,WAAW,OAAO,GACjC,OACA,WAAW5B,QAAQS,OACnB,GAAII,YAAW;AAAA,IAAA,EAAA,CAEnB,IAEAqC;AAAAA,IAEDP,gBACE,oBAAA,eAAA,EAAc,IAAIM,MAAMrB,WAAW,OAAO,GAAG,eAAa,MACxDV,UACH,cAAA,CAAA;AAAA,EAEJ,EAAA,CAAA;AAEJ,CACF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Snackbar.js","sources":["../../../../src/components/Snackbar/Snackbar.tsx"],"sourcesContent":["import { SyntheticEvent } from \"react\";\nimport Slide from \"@mui/material/Slide\";\nimport {\n SnackbarCloseReason,\n SnackbarOrigin,\n SnackbarProps as MuiSnackbarProps,\n} from \"@mui/material/Snackbar\";\nimport { Snackbar as MuiSnackbar } from \"@mui/material\";\n\nimport capitalize from \"lodash/capitalize\";\n\nimport {
|
|
1
|
+
{"version":3,"file":"Snackbar.js","sources":["../../../../src/components/Snackbar/Snackbar.tsx"],"sourcesContent":["import { SyntheticEvent } from \"react\";\nimport Slide from \"@mui/material/Slide\";\nimport {\n SnackbarCloseReason,\n SnackbarOrigin,\n SnackbarProps as MuiSnackbarProps,\n} from \"@mui/material/Snackbar\";\nimport { Snackbar as MuiSnackbar } from \"@mui/material\";\n\nimport capitalize from \"lodash/capitalize\";\n\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { setId } from \"@core/utils/setId\";\nimport { HvActionGeneric } from \"@core/components/ActionsGeneric\";\n\nimport { HvSnackbarContentProps, HvSnackbarContent } from \"./SnackbarContent\";\nimport { staticClasses, useClasses } from \"./Snackbar.styles\";\nimport { HvSnackbarVariant } from \"./types\";\n\nexport { staticClasses as snackbarClasses };\n\nexport type HvSnackbarClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvSnackbarProps\n extends Omit<MuiSnackbarProps, \"action\" | \"classes\" | \"children\"> {\n /** If true, Snackbar is open. */\n open?: boolean;\n /** Callback fired when the component requests to be closed. Typically onClose is used to set state in the parent component, which is used to control the Snackbar open prop. The reason parameter can optionally be used to control the response to onClose, for example ignoring clickaway. */\n onClose?:\n | ((\n event: Event | SyntheticEvent<any, Event>,\n reason: SnackbarCloseReason\n ) => void)\n | undefined;\n /** The message to display. */\n label?: React.ReactNode;\n /** The anchor of the Snackbar. vertical: \"top\", \"bottom\" | horizontal: \"left\",\"center\",\"right. It defines where the snackbar will end his animation */\n anchorOrigin?: SnackbarOrigin;\n /** The number of milliseconds to wait before automatically calling the onClose function. onClose should then set the state of the open prop to hide the Snackbar */\n autoHideDuration?: number;\n /** Variant of the snackbar. */\n variant?: HvSnackbarVariant;\n /** Custom icon to replace the variant default. */\n customIcon?: React.ReactNode;\n /** Controls if the associated icon to the variant should be shown. */\n showIcon?: boolean;\n /** Action to display. */\n action?: React.ReactNode | HvActionGeneric;\n /** The callback function ran when an action is triggered, receiving `action` as param */\n actionCallback?: (\n event: React.SyntheticEvent,\n id: string,\n action: HvActionGeneric\n ) => void;\n /** Duration of transition in milliseconds. */\n transitionDuration?: number;\n /** Direction of slide transition. */\n transitionDirection?: \"up\" | \"down\" | \"left\" | \"right\";\n /** Custom offset from top/bottom of the page, in px. */\n offset?: number;\n /** Others applied to the content of the snackbar. */\n snackbarContentProps?: HvSnackbarContentProps;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvSnackbarClasses;\n /** @ignore */\n ref?: MuiSnackbarProps[\"ref\"];\n}\n\nconst transLeft = (props) => <Slide {...props} direction=\"left\" />;\nconst transRight = (props) => <Slide {...props} direction=\"right\" />;\nconst transUp = (props) => <Slide {...props} direction=\"up\" />;\nconst transDown = (props) => <Slide {...props} direction=\"down\" />;\n\nconst snackBarDirComponent = (direction) => {\n switch (direction) {\n case \"right\":\n return transRight;\n case \"up\":\n return transUp;\n case \"down\":\n return transDown;\n case \"left\":\n default:\n return transLeft;\n }\n};\n\n/**\n * A Snackbar provides brief messages about app processes.\n * It is dismissed automatically after a given interval.\n *\n * Snackbar can be built with two different components.\n * One is the HvSnackbar, which wraps all the positioning, transition, auto hide, etc.\n * The other is the HvSnackbarContent, which allows a finer control and customization of the content of the Snackbar.\n */\nexport const HvSnackbar = ({\n classes: classesProp,\n className,\n id,\n open = false,\n onClose,\n label = \"\",\n anchorOrigin = { vertical: \"top\", horizontal: \"right\" },\n autoHideDuration = 5000,\n variant = \"default\",\n showIcon = false,\n customIcon = null,\n action = null,\n actionCallback,\n transitionDuration = 300,\n transitionDirection = \"left\",\n offset = 60,\n snackbarContentProps,\n ...others\n}: HvSnackbarProps) => {\n const { classes } = useClasses(classesProp);\n\n const anchorOriginOffset = {\n anchorOriginTop: {\n top: `${offset}px`,\n },\n anchorOriginBottom: {\n bottom: `${offset}px`,\n },\n };\n\n return (\n <MuiSnackbar\n style={\n anchorOriginOffset[`anchorOrigin${capitalize(anchorOrigin.vertical)}`]\n }\n classes={classes}\n className={className}\n id={id}\n anchorOrigin={anchorOrigin}\n open={open}\n onClose={onClose}\n autoHideDuration={autoHideDuration}\n transitionDuration={transitionDuration}\n TransitionComponent={snackBarDirComponent(transitionDirection)}\n {...others}\n >\n <HvSnackbarContent\n id={setId(id, \"content\")}\n label={label}\n variant={variant}\n customIcon={customIcon}\n showIcon={showIcon}\n action={action}\n actionCallback={actionCallback}\n {...snackbarContentProps}\n />\n </MuiSnackbar>\n );\n};\n"],"names":["transLeft","props","transRight","transUp","transDown","snackBarDirComponent","direction","HvSnackbar","classes","classesProp","className","id","open","onClose","label","anchorOrigin","vertical","horizontal","autoHideDuration","variant","showIcon","customIcon","action","actionCallback","transitionDuration","transitionDirection","offset","snackbarContentProps","others","useClasses","anchorOriginOffset","anchorOri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ACC,EAAA,OACEL,mBAAoB,eAAcM,WAAWrB,aAAaC,QAAQ,CAAE,EAAC,GAEvE,SACA,WACA,IACA,cACA,MACA,SACA,kBACA,oBACA,qBAAqBX,qBAAqBoB,mBAAmB,GAC7D,GAAIG,QAEJ,8BAAC,mBACC,EAAA,IAAIS,MAAM1B,IAAI,SAAS,GACvB,OACA,SACA,YACA,UACA,QACA,gBACIgB,GAAAA,sBAAqB,EAE7B,CAAA;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SnackbarContent.js","sources":["../../../../../src/components/Snackbar/SnackbarContent/SnackbarContent.tsx"],"sourcesContent":["import { forwardRef, isValidElement } from \"react\";\n\nimport SnackbarContent, {\n SnackbarContentProps as MuiSnackbarContentProps,\n} from \"@mui/material/SnackbarContent\";\n\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { setId } from \"@core/utils/setId\";\nimport { iconVariant } from \"@core/utils/iconVariant\";\nimport {
|
|
1
|
+
{"version":3,"file":"SnackbarContent.js","sources":["../../../../../src/components/Snackbar/SnackbarContent/SnackbarContent.tsx"],"sourcesContent":["import { forwardRef, isValidElement } from \"react\";\n\nimport SnackbarContent, {\n SnackbarContentProps as MuiSnackbarContentProps,\n} from \"@mui/material/SnackbarContent\";\n\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { setId } from \"@core/utils/setId\";\nimport { iconVariant } from \"@core/utils/iconVariant\";\nimport {\n HvActionsGeneric,\n HvActionGeneric,\n} from \"@core/components/ActionsGeneric\";\nimport { HvButtonVariant } from \"@core/components/Button\";\nimport { useTheme } from \"@core/hooks/useTheme\";\n\nimport { useDefaultProps } from \"@core/hooks\";\n\nimport { staticClasses, useClasses } from \"./SnackbarContent.styles\";\nimport { HvSnackbarVariant } from \"../types\";\n\nexport { staticClasses as snackbarContentClasses };\n\nexport type HvSnackbarContentClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvSnackbarContentProps\n extends Omit<MuiSnackbarContentProps, \"variant\" | \"action\" | \"classes\"> {\n /** The message to display. */\n label?: React.ReactNode;\n /** Variant of the snackbar. */\n variant?: HvSnackbarVariant;\n /** Controls if the associated icon to the variant should be shown. */\n showIcon?: boolean;\n /** Custom icon to replace the variant default. */\n customIcon?: React.ReactNode;\n /** Action to display. */\n action?: React.ReactNode | HvActionGeneric;\n /** The callback function ran when an action is triggered, receiving `action` as param */\n actionCallback?: (\n event: React.SyntheticEvent,\n id: string,\n action: HvActionGeneric\n ) => void;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvSnackbarContentClasses;\n}\n\nexport const HvSnackbarContent = forwardRef<\n HTMLDivElement,\n HvSnackbarContentProps\n>((props: HvSnackbarContentProps, ref) => {\n const {\n className,\n id,\n classes: classesProp,\n label,\n variant = \"default\",\n showIcon,\n customIcon,\n action,\n actionCallback,\n ...others\n } = useDefaultProps(\"HvSnackbarContent\", props);\n\n const icon = customIcon || (showIcon && iconVariant(variant, \"base_dark\"));\n const innerAction: any = isValidElement(action) ? action : [action];\n\n const { classes, cx } = useClasses(classesProp);\n const { activeTheme } = useTheme();\n\n return (\n <SnackbarContent\n ref={ref}\n id={id}\n classes={{\n root: classes.root,\n message: classes.message,\n }}\n className={cx(classes?.[variant], className)}\n message={\n <div id={setId(id, \"message\")} className={classes.messageSpan}>\n {icon && <div className={classes.iconVariant}>{icon}</div>}\n <div className={classes.messageText}>{label}</div>\n {action && (\n <div id={setId(id, \"action\")} className={classes.action}>\n <HvActionsGeneric\n id={id}\n category={\n activeTheme?.snackbar.actionButtonVariant as HvButtonVariant\n }\n actions={innerAction}\n actionsCallback={actionCallback}\n />\n </div>\n )}\n </div>\n }\n {...others}\n />\n );\n});\n"],"names":["HvSnackbarContent","forwardRef","props","ref","className","id","classes","classesProp","label","variant","showIcon","customIcon","action","actionCallback","others","useDefaultProps","icon","iconVariant","innerAction","isValidElement","cx","useClasses","activeTheme","useTheme","root","message","setId","messageSpan","messageText","snackbar","actionButtonVariant"],"mappings":";;;;;;;;;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],"sourcesContent":["import React, { forwardRef, useCallback } from \"react\";\n\nimport { SwitchProps as MuiSwitchProps } from \"@mui/material\";\n\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { useUniqueId } from \"@core/hooks/useUniqueId\";\nimport { useControlled } from \"@core/hooks/useControlled\";\nimport { setId } from \"@core/utils/setId\";\nimport {\n HvWarningText,\n HvLabelProps,\n HvFormStatus,\n HvFormElement,\n HvLabel,\n} from \"@core/components/Forms\";\nimport { HvBaseSwitch } from \"@core/components/BaseSwitch\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { isInvalid } from \"@core/components/Forms/FormElement/validationStates\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { staticClasses, useClasses } from \"./Switch.styles\";\n\nexport { staticClasses as switchClasses };\n\nexport type HvSwitchClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvSwitchProps\n extends Omit<MuiSwitchProps, \"onChange\" | \"classes\">,\n HvBaseProps<HTMLButtonElement, \"onChange\" | \"color\"> {\n /**\n * A Jss Object used to override or extend the styles applied to the switch.\n */\n classes?: HvSwitchClasses;\n /**\n * The form element name.\n */\n name?: string;\n /**\n * The value of the form element.\n *\n * Is up to the application's logic when to consider the submission of this value.\n * Generally it should be used only when the switch is neither unchecked nor indeterminate.\n *\n * The default value is \"on\".\n */\n value?: any;\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 inputted via inputProps.\n */\n label?: React.ReactNode;\n /**\n * Properties passed on to the label element.\n */\n labelProps?: HvLabelProps;\n /**\n * Indicates that the form element is disabled.\n */\n disabled?: boolean;\n /**\n * Indicates that the form element is not editable.\n */\n readOnly?: boolean;\n /**\n * Indicates that user input is required on the form element.\n */\n required?: boolean;\n /**\n * If `true` the switch is selected, if set to `false` the switch is not selected.\n *\n * When defined the switch state becomes controlled.\n */\n checked?: boolean;\n /**\n * When uncontrolled, defines the initial checked state.\n */\n defaultChecked?: boolean;\n /**\n * The status of the form element.\n *\n * Valid is correct, invalid is incorrect and standBy means no validations have run.\n *\n * When uncontrolled and unspecified it will default to \"standBy\" and change to either \"valid\"\n * or \"invalid\" after any change to `checked`, depending of the values of both `required` and `checked`.\n */\n status?: HvFormStatus;\n /**\n * The error message to show when the validation status is \"invalid\".\n *\n * Defaults to \"Required\" when the status is uncontrolled and no `aria-errormessage` is provided.\n */\n statusMessage?: string;\n /**\n * Identifies the element that provides an error message for the switch.\n *\n * Will only be used when the validation status is invalid.\n */\n \"aria-errormessage\"?: string;\n /**\n * The callback fired when the switch is pressed.\n */\n onChange?: (event: React.ChangeEvent, checked: boolean, value: any) => void;\n /**\n * Properties passed on to the input element.\n */\n inputProps?: React.InputHTMLAttributes<HTMLInputElement>;\n /** @ignore */\n ref?: MuiSwitchProps[\"ref\"];\n /** @ignore */\n component?: MuiSwitchProps[\"component\"];\n}\n\n/**\n * A Switch is <b>binary</b> and work as a digital on/off button.\n *\n * Use when two states are <b>opposite</b> and to trigger immediate\n * changes in the system.\n */\nexport const HvSwitch = forwardRef<HTMLButtonElement, HvSwitchProps>(\n (props, ref) => {\n const {\n classes: classesProp,\n className,\n\n id,\n name,\n value = \"on\",\n required = false,\n readOnly = false,\n disabled = false,\n\n label,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n labelProps,\n\n checked,\n defaultChecked = false,\n\n onChange,\n\n status,\n statusMessage,\n \"aria-errormessage\": ariaErrorMessage,\n\n inputProps,\n\n ...others\n } = useDefaultProps(\"HvSwitch\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const elementId = useUniqueId(id, \"hvswitch\");\n\n const [isChecked, setIsChecked] = useControlled(\n checked,\n Boolean(defaultChecked)\n );\n\n const [validationState, setValidationState] = useControlled(\n status,\n \"standBy\"\n );\n\n const [validationMessage] = useControlled(statusMessage, \"Required\");\n\n const onLocalChange = useCallback(\n (evt, newChecked) => {\n setIsChecked(() => {\n // this will only run if uncontrolled\n if (required && !newChecked) {\n setValidationState(\"invalid\");\n } else {\n setValidationState(\"valid\");\n }\n\n return newChecked;\n });\n\n onChange?.(evt, newChecked, value);\n },\n [onChange, required, setIsChecked, setValidationState, value]\n );\n\n // the error message area will only be created if:\n // - an external element that provides an error message isn't identified via aria-errormessage AND\n // - both status and statusMessage properties are being controlled OR\n // - status is uncontrolled and required is true\n const canShowError =\n ariaErrorMessage == null &&\n ((status !== undefined && statusMessage !== undefined) ||\n (status === undefined && required));\n\n const isStateInvalid = isInvalid(validationState);\n\n let errorMessageId: string | undefined;\n if (isStateInvalid) {\n errorMessageId = canShowError\n ? setId(elementId, \"error\")\n : ariaErrorMessage;\n }\n\n return (\n <HvFormElement\n id={id}\n name={name}\n status={validationState}\n disabled={disabled}\n required={required}\n readOnly={readOnly}\n className={cx(classes.root, className)}\n >\n {label && (\n <HvLabel\n id={setId(elementId, \"label\")}\n htmlFor={setId(elementId, \"input\")}\n label={label}\n className={classes.label}\n {...labelProps}\n />\n )}\n <div\n className={cx(classes.switchContainer, {\n [classes.invalidSwitch]: isStateInvalid,\n })}\n >\n <HvBaseSwitch\n ref={ref}\n id={label ? setId(elementId, \"input\") : setId(id, \"input\")}\n name={name}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n onChange={onLocalChange}\n value={value}\n checked={isChecked}\n inputProps={{\n \"aria-invalid\": isStateInvalid ? true : undefined,\n \"aria-errormessage\": errorMessageId,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n ...inputProps,\n }}\n {...others}\n />\n </div>\n {canShowError && (\n <HvWarningText\n id={setId(elementId, \"error\")}\n className={classes.error}\n disableBorder\n disableAdornment\n hideText\n >\n {validationMessage}\n </HvWarningText>\n )}\n </HvFormElement>\n );\n }\n);\n"],"names":["HvSwitch","forwardRef","props","ref","classes","classesProp","className","id","name","value","required","readOnly","disabled","label","ariaLabel","ariaLabelledBy","ariaDescribedBy","labelProps","checked","defaultChecked","onChange","status","statusMessage","ariaErrorMessage","inputProps","others","useDefaultProps","cx","useClasses","elementId","useUniqueId","isChecked","setIsChecked","useControlled","Boolean","validationState","setValidationState","validationMessage","onLocalChange","useCallback","evt","newChecked","canShowError","undefined","isStateInvalid","isInvalid","errorMessageId","setId","root","switchContainer","invalidSwitch","error"],"mappings":";;;;;;;;;;;;;AAwHO,MAAMA,WAAWC,WACtB,CAACC,OAAOC,QAAQ;AACR,QAAA;AAAA,IACJC,SAASC;AAAAA,IACTC;AAAAA,IAEAC;AAAAA,IACAC;AAAAA,IACAC,QAAQ;AAAA,IACRC,WAAW;AAAA,IACXC,WAAW;AAAA,IACXC,WAAW;AAAA,IAEXC;AAAAA,IACA,cAAcC;AAAAA,IACd,mBAAmBC;AAAAA,IACnB,oBAAoBC;AAAAA,IACpBC;AAAAA,IAEAC;AAAAA,IACAC,iBAAiB;AAAA,IAEjBC;AAAAA,IAEAC;AAAAA,IACAC;AAAAA,IACA,qBAAqBC;AAAAA,IAErBC;AAAAA,IAEA,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,YAAYxB,KAAK;AAE/B,QAAA;AAAA,IAAEE;AAAAA,IAASuB;AAAAA,EAAAA,IAAOC,WAAWvB,WAAW;AAExCwB,QAAAA,YAAYC,YAAYvB,IAAI,UAAU;AAEtC,QAAA,CAACwB,WAAWC,YAAY,IAAIC,cAChCf,SACAgB,QAAQf,cAAc,CACxB;AAEA,QAAM,CAACgB,iBAAiBC,kBAAkB,IAAIH,cAC5CZ,QACA,SACF;AAEA,QAAM,CAACgB,iBAAiB,IAAIJ,cAAcX,eAAe,UAAU;AAEnE,QAAMgB,gBAAgBC,YACpB,CAACC,KAAKC,eAAe;AACnBT,iBAAa,MAAM;AAEbtB,UAAAA,YAAY,CAAC+B,YAAY;AAC3BL,2BAAmB,SAAS;AAAA,MAAA,OACvB;AACLA,2BAAmB,OAAO;AAAA,MAC5B;AAEOK,aAAAA;AAAAA,IAAAA,CACR;A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AEJ,EAAA,CAAA;AAEJ,CACF;"}
|
|
1
|
+
{"version":3,"file":"Switch.js","sources":["../../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import React, { forwardRef, useCallback } from \"react\";\n\nimport { SwitchProps as MuiSwitchProps } from \"@mui/material\";\n\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { useUniqueId } from \"@core/hooks/useUniqueId\";\nimport { useControlled } from \"@core/hooks/useControlled\";\nimport { setId } from \"@core/utils/setId\";\nimport {\n HvWarningText,\n HvLabelProps,\n HvFormStatus,\n HvFormElement,\n HvLabel,\n} from \"@core/components/Forms\";\nimport { HvBaseSwitch } from \"@core/components/BaseSwitch\";\nimport { isInvalid } from \"@core/components/Forms/FormElement/validationStates\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { staticClasses, useClasses } from \"./Switch.styles\";\n\nexport { staticClasses as switchClasses };\n\nexport type HvSwitchClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvSwitchProps\n extends Omit<MuiSwitchProps, \"onChange\" | \"classes\"> {\n /**\n * A Jss Object used to override or extend the styles applied to the switch.\n */\n classes?: HvSwitchClasses;\n /**\n * The form element name.\n */\n name?: string;\n /**\n * The value of the form element.\n *\n * Is up to the application's logic when to consider the submission of this value.\n * Generally it should be used only when the switch is neither unchecked nor indeterminate.\n *\n * The default value is \"on\".\n */\n value?: any;\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 inputted via inputProps.\n */\n label?: React.ReactNode;\n /**\n * Properties passed on to the label element.\n */\n labelProps?: HvLabelProps;\n /**\n * Indicates that the form element is disabled.\n */\n disabled?: boolean;\n /**\n * Indicates that the form element is not editable.\n */\n readOnly?: boolean;\n /**\n * Indicates that user input is required on the form element.\n */\n required?: boolean;\n /**\n * If `true` the switch is selected, if set to `false` the switch is not selected.\n *\n * When defined the switch state becomes controlled.\n */\n checked?: boolean;\n /**\n * When uncontrolled, defines the initial checked state.\n */\n defaultChecked?: boolean;\n /**\n * The status of the form element.\n *\n * Valid is correct, invalid is incorrect and standBy means no validations have run.\n *\n * When uncontrolled and unspecified it will default to \"standBy\" and change to either \"valid\"\n * or \"invalid\" after any change to `checked`, depending of the values of both `required` and `checked`.\n */\n status?: HvFormStatus;\n /**\n * The error message to show when the validation status is \"invalid\".\n *\n * Defaults to \"Required\" when the status is uncontrolled and no `aria-errormessage` is provided.\n */\n statusMessage?: string;\n /**\n * Identifies the element that provides an error message for the switch.\n *\n * Will only be used when the validation status is invalid.\n */\n \"aria-errormessage\"?: string;\n /**\n * The callback fired when the switch is pressed.\n */\n onChange?: (event: React.ChangeEvent, checked: boolean, value: any) => void;\n /**\n * Properties passed on to the input element.\n */\n inputProps?: React.InputHTMLAttributes<HTMLInputElement>;\n /** @ignore */\n ref?: MuiSwitchProps[\"ref\"];\n /** @ignore */\n component?: MuiSwitchProps[\"component\"];\n}\n\n/**\n * A Switch is <b>binary</b> and work as a digital on/off button.\n *\n * Use when two states are <b>opposite</b> and to trigger immediate\n * changes in the system.\n */\nexport const HvSwitch = forwardRef<HTMLButtonElement, HvSwitchProps>(\n (props, ref) => {\n const {\n classes: classesProp,\n className,\n\n id,\n name,\n value = \"on\",\n required = false,\n readOnly = false,\n disabled = false,\n\n label,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n labelProps,\n\n checked,\n defaultChecked = false,\n\n onChange,\n\n status,\n statusMessage,\n \"aria-errormessage\": ariaErrorMessage,\n\n inputProps,\n\n ...others\n } = useDefaultProps(\"HvSwitch\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const elementId = useUniqueId(id, \"hvswitch\");\n\n const [isChecked, setIsChecked] = useControlled(\n checked,\n Boolean(defaultChecked)\n );\n\n const [validationState, setValidationState] = useControlled(\n status,\n \"standBy\"\n );\n\n const [validationMessage] = useControlled(statusMessage, \"Required\");\n\n const onLocalChange = useCallback(\n (evt, newChecked) => {\n setIsChecked(() => {\n // this will only run if uncontrolled\n if (required && !newChecked) {\n setValidationState(\"invalid\");\n } else {\n setValidationState(\"valid\");\n }\n\n return newChecked;\n });\n\n onChange?.(evt, newChecked, value);\n },\n [onChange, required, setIsChecked, setValidationState, value]\n );\n\n // the error message area will only be created if:\n // - an external element that provides an error message isn't identified via aria-errormessage AND\n // - both status and statusMessage properties are being controlled OR\n // - status is uncontrolled and required is true\n const canShowError =\n ariaErrorMessage == null &&\n ((status !== undefined && statusMessage !== undefined) ||\n (status === undefined && required));\n\n const isStateInvalid = isInvalid(validationState);\n\n let errorMessageId: string | undefined;\n if (isStateInvalid) {\n errorMessageId = canShowError\n ? setId(elementId, \"error\")\n : ariaErrorMessage;\n }\n\n return (\n <HvFormElement\n id={id}\n name={name}\n status={validationState}\n disabled={disabled}\n required={required}\n readOnly={readOnly}\n className={cx(classes.root, className)}\n >\n {label && (\n <HvLabel\n id={setId(elementId, \"label\")}\n htmlFor={setId(elementId, \"input\")}\n label={label}\n className={classes.label}\n {...labelProps}\n />\n )}\n <div\n className={cx(classes.switchContainer, {\n [classes.invalidSwitch]: isStateInvalid,\n })}\n >\n <HvBaseSwitch\n ref={ref}\n id={label ? setId(elementId, \"input\") : setId(id, \"input\")}\n name={name}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n onChange={onLocalChange}\n value={value}\n checked={isChecked}\n inputProps={{\n \"aria-invalid\": isStateInvalid ? true : undefined,\n \"aria-errormessage\": errorMessageId,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n ...inputProps,\n }}\n {...others}\n />\n </div>\n {canShowError && (\n <HvWarningText\n id={setId(elementId, \"error\")}\n className={classes.error}\n disableBorder\n disableAdornment\n hideText\n >\n {validationMessage}\n </HvWarningText>\n )}\n </HvFormElement>\n );\n }\n);\n"],"names":["HvSwitch","forwardRef","props","ref","classes","classesProp","className","id","name","value","required","readOnly","disabled","label","ariaLabel","ariaLabelledBy","ariaDescribedBy","labelProps","checked","defaultChecked","onChange","status","statusMessage","ariaErrorMessage","inputProps","others","useDefaultProps","cx","useClasses","elementId","useUniqueId","isChecked","setIsChecked","useControlled","Boolean","validationState","setValidationState","validationMessage","onLocalChange","useCallback","evt","newChecked","canShowError","undefined","isStateInvalid","isInvalid","errorMessageId","setId","root","switchContainer","invalidSwitch","error"],"mappings":";;;;;;;;;;;;;AAsHO,MAAMA,WAAWC,WACtB,CAACC,OAAOC,QAAQ;AACR,QAAA;AAAA,IACJC,SAASC;AAAAA,IACTC;AAAAA,IAEAC;AAAAA,IACAC;AAAAA,IACAC,QAAQ;AAAA,IACRC,WAAW;AAAA,IACXC,WAAW;AAAA,IACXC,WAAW;AAAA,IAEXC;AAAAA,IACA,cAAcC;AAAAA,IACd,mBAAmBC;AAAAA,IACnB,oBAAoBC;AAAAA,IACpBC;AAAAA,IAEAC;AAAAA,IACAC,iBAAiB;AAAA,IAEjBC;AAAAA,IAEAC;AAAAA,IACAC;AAAAA,IACA,qBAAqBC;AAAAA,IAErBC;AAAAA,IAEA,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,YAAYxB,KAAK;AAE/B,QAAA;AAAA,IAAEE;AAAAA,IAASuB;AAAAA,EAAAA,IAAOC,WAAWvB,WAAW;AAExCwB,QAAAA,YAAYC,YAAYvB,IAAI,UAAU;AAEtC,QAAA,CAACwB,WAAWC,YAAY,IAAIC,cAChCf,SACAgB,QAAQf,cAAc,CACxB;AAEA,QAAM,CAACgB,iBAAiBC,kBAAkB,IAAIH,cAC5CZ,QACA,SACF;AAEA,QAAM,CAACgB,iBAAiB,IAAIJ,cAAcX,eAAe,UAAU;AAEnE,QAAMgB,gBAAgBC,YACpB,CAACC,KAAKC,eAAe;AACnBT,iBAAa,MAAM;AAEbtB,UAAAA,YAAY,CAAC+B,YAAY;AAC3BL,2BAAmB,SAAS;AAAA,MAAA,OACvB;AACLA,2BAAmB,OAAO;AAAA,MAC5B;AAEOK,aAAA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Pd,UACH,mBAAA;AAAA,EAEJ,EAAA,CAAA;AAEJ,CACF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tab.js","sources":["../../../../src/components/Tab/Tab.tsx"],"sourcesContent":["import { Tab, TabProps as MuiTabProps } from \"@mui/material\";\n\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport {
|
|
1
|
+
{"version":3,"file":"Tab.js","sources":["../../../../src/components/Tab/Tab.tsx"],"sourcesContent":["import { Tab, TabProps as MuiTabProps } from \"@mui/material\";\n\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { staticClasses, useClasses } from \"./Tab.styles\";\n\nexport { staticClasses as tabClasses };\n\nexport type HvTabClasses = ExtractNames<typeof useClasses>;\n\n// Mui Tab props: https://mui.com/material-ui/api/tab/#props\nexport interface HvTabProps extends Omit<MuiTabProps, \"children\"> {\n /** If `true`, the tab will be disabled. */\n disabled?: boolean;\n /** The icon element. */\n icon?: React.ReactElement | string;\n /** The label element. */\n label?: React.ReactNode;\n /** The position of the icon relative to the label. */\n iconPosition?: \"bottom\" | \"end\" | \"start\" | \"top\";\n /** A Jss Object used to override or extend the component styles. */\n classes?: HvTabClasses;\n}\n\nexport const HvTab = (props: HvTabProps) => {\n const {\n classes: classesProp,\n iconPosition = \"top\",\n disabled = false,\n ...others\n } = useDefaultProps(\"HvTab\", props);\n const { classes, cx } = useClasses(classesProp);\n\n return (\n <Tab\n classes={{\n root: classes.root,\n selected: classes.selected,\n disabled: classes.disabled,\n }}\n disableRipple\n disableTouchRipple\n // expose the global class HvIsFocusVisible as a marker\n // not to be styled directly, only as helper in specific css queries\n focusVisibleClassName={cx(\"HvIsFocusVisible\", classes.focusVisible)}\n disabled={disabled}\n iconPosition={iconPosition}\n {...others}\n />\n );\n};\n"],"names":["HvTab","props","classes","classesProp","iconPosition","disabled","others","useDefaultProps","cx","useClasses","root","selected","focusVisible"],"mappings":";;;;;AAyBaA,MAAAA,QAAQA,CAACC,UAAsB;AACpC,QAAA;AAAA,IACJC,SAASC;AAAAA,IACTC,eAAe;AAAA,IACfC,WAAW;AAAA,IACX,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,SAASN,KAAK;AAC5B,QAAA;AAAA,IAAEC;AAAAA,IAASM;AAAAA,EAAAA,IAAOC,WAAWN,WAAW;AAG5C,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAS;AAAA,QACPO,MAAMR,QAAQQ;AAAAA,QACdC,UAAUT,QAAQS;AAAAA,QAClBN,UAAUH,QAAQG;AAAAA,MACpB;AAAA,MACA,eAAa;AAAA,MACb,oBAAA;AAAA,MAGA,uBAAuBG,GAAG,oBAAoBN,QAAQU,YAAY;AAAA,MAClE;AAAA,MACA;AAAA,MACA,GAAIN;AAAAA,IAAAA;AAAAA,EAAAA;AAGV;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { HvButton } from "../components/Button/Button.js";
|
|
3
|
+
import { HvTooltip } from "../components/Tooltip/Tooltip.js";
|
|
4
|
+
const IconButton = ({
|
|
5
|
+
title,
|
|
6
|
+
placement = "top",
|
|
7
|
+
...others
|
|
8
|
+
}) => /* @__PURE__ */ jsx(HvTooltip, { enterDelay: 500, title, placement, children: /* @__PURE__ */ jsx(HvButton, { icon: true, ...others }) });
|
|
9
|
+
export {
|
|
10
|
+
IconButton
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=IconButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconButton.js","sources":["../../../src/utils/IconButton.tsx"],"sourcesContent":["import { HvButton, HvButtonProps } from \"@core/components/Button\";\nimport { HvTooltip, HvTooltipProps } from \"@core/components/Tooltip\";\n\nexport interface IconButtonProps extends Omit<HvButtonProps, \"icon\" | \"title\"> {\n title: React.ReactNode;\n placement?: HvTooltipProps[\"placement\"];\n onClick?: HvButtonProps[\"onClick\"];\n}\n\n/** An `HvButton` of type icon wrapped in a tooltip */\nexport const IconButton = ({\n title,\n placement = \"top\",\n ...others\n}: IconButtonProps) => (\n <HvTooltip enterDelay={500} title={title} placement={placement}>\n <HvButton icon {...others} />\n </HvTooltip>\n);\n"],"names":["IconButton","title","placement","others"],"mappings":";;;AAUO,MAAMA,aAAaA,CAAC;AAAA,EACzBC;AAAAA,EACAC,YAAY;AAAA,EACZ,GAAGC;AACY,MACd,oBAAA,WAAA,EAAU,YAAY,KAAK,OAAc,WACxC,UAAC,oBAAA,UAAA,EAAS,MAAI,MAAC,GAAIA,OAAAA,CAAO,EAC5B,CAAA;"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -182,6 +182,13 @@ export declare const actionClasses: {
|
|
|
182
182
|
noIcon: "HvVerticalNavigationAction-noIcon";
|
|
183
183
|
};
|
|
184
184
|
|
|
185
|
+
/** @private label structure action icon buttons */
|
|
186
|
+
declare interface ActionIconLabels extends DialogLabels {
|
|
187
|
+
/** @deprecated use `tooltip` label instead */
|
|
188
|
+
ariaLabel: string;
|
|
189
|
+
tooltip?: string;
|
|
190
|
+
}
|
|
191
|
+
|
|
185
192
|
export declare const actionsClasses: {
|
|
186
193
|
root: "HvVerticalNavigationActions-root";
|
|
187
194
|
hide: "HvVerticalNavigationActions-hide";
|
|
@@ -1313,7 +1320,7 @@ export declare const HvBannerContent: ForwardRefExoticComponent<Omit<HvBannerCon
|
|
|
1313
1320
|
|
|
1314
1321
|
export declare type HvBannerContentClasses = ExtractNames<typeof useClasses_75>;
|
|
1315
1322
|
|
|
1316
|
-
export declare interface HvBannerContentProps extends Omit<SnackbarContentProps, "variant" | "classes" | "onClose"
|
|
1323
|
+
export declare interface HvBannerContentProps extends Omit<SnackbarContentProps, "variant" | "classes" | "onClose"> {
|
|
1317
1324
|
/** The message to display. */
|
|
1318
1325
|
content?: string;
|
|
1319
1326
|
/** Variant of the snackbar. */
|
|
@@ -1336,7 +1343,7 @@ export declare interface HvBannerContentProps extends Omit<SnackbarContentProps,
|
|
|
1336
1343
|
classes?: HvBannerContentClasses;
|
|
1337
1344
|
}
|
|
1338
1345
|
|
|
1339
|
-
export declare interface HvBannerProps extends Omit<SnackbarProps, "anchorOrigin" | "classes" | "onClose"
|
|
1346
|
+
export declare interface HvBannerProps extends Omit<SnackbarProps, "anchorOrigin" | "classes" | "onClose"> {
|
|
1340
1347
|
/** If true, the snackbar is open. */
|
|
1341
1348
|
open: boolean;
|
|
1342
1349
|
/** Callback fired when the component requests to be closed. Typically onClose is used to set state in the parent component, which is used to control the Snackbar open prop. The reason parameter can optionally be used to control the response to onClose, for example ignoring clickaway. */
|
|
@@ -1383,7 +1390,7 @@ export declare const HvBaseCheckBox: React_2.ForwardRefExoticComponent<Omit<HvBa
|
|
|
1383
1390
|
|
|
1384
1391
|
export declare type HvBaseCheckBoxClasses = ExtractNames<typeof useClasses_52>;
|
|
1385
1392
|
|
|
1386
|
-
export declare interface HvBaseCheckBoxProps extends Omit<CheckboxProps, "onChange" | "classes"
|
|
1393
|
+
export declare interface HvBaseCheckBoxProps extends Omit<CheckboxProps, "onChange" | "classes"> {
|
|
1387
1394
|
/**
|
|
1388
1395
|
* The input name.
|
|
1389
1396
|
*/
|
|
@@ -1555,7 +1562,7 @@ export declare const HvBaseInput: (props: HvBaseInputProps) => JSX_2.Element;
|
|
|
1555
1562
|
|
|
1556
1563
|
export declare type HvBaseInputClasses = ExtractNames<typeof useClasses_13>;
|
|
1557
1564
|
|
|
1558
|
-
export declare interface HvBaseInputProps extends Omit<InputProps, "onChange" | "classes"
|
|
1565
|
+
export declare interface HvBaseInputProps extends Omit<InputProps, "onChange" | "classes"> {
|
|
1559
1566
|
/** The input name. */
|
|
1560
1567
|
name?: string;
|
|
1561
1568
|
/** The value of the input, when controlled. */
|
|
@@ -1602,7 +1609,7 @@ export declare const HvBaseRadio: React_2.ForwardRefExoticComponent<Omit<HvBaseR
|
|
|
1602
1609
|
|
|
1603
1610
|
export declare type HvBaseRadioClasses = ExtractNames<typeof useClasses_53>;
|
|
1604
1611
|
|
|
1605
|
-
export declare interface HvBaseRadioProps extends Omit<RadioProps, "onChange" | "classes"
|
|
1612
|
+
export declare interface HvBaseRadioProps extends Omit<RadioProps, "onChange" | "classes"> {
|
|
1606
1613
|
/**
|
|
1607
1614
|
* Class names to be applied.
|
|
1608
1615
|
*/
|
|
@@ -1680,7 +1687,7 @@ export declare const HvBaseSwitch: React_2.ForwardRefExoticComponent<Omit<HvBase
|
|
|
1680
1687
|
|
|
1681
1688
|
export declare type HvBaseSwitchClasses = ExtractNames<typeof useClasses_56>;
|
|
1682
1689
|
|
|
1683
|
-
export declare interface HvBaseSwitchProps extends Omit<SwitchProps, "onChange" | "classes"
|
|
1690
|
+
export declare interface HvBaseSwitchProps extends Omit<SwitchProps, "onChange" | "classes"> {
|
|
1684
1691
|
/**
|
|
1685
1692
|
* Class names to be applied.
|
|
1686
1693
|
*/
|
|
@@ -2042,9 +2049,7 @@ export declare const HvCardContent: ({ id, classes: classesProp, className, chil
|
|
|
2042
2049
|
|
|
2043
2050
|
export declare type HvCardContentClasses = ExtractNames<typeof useClasses_22>;
|
|
2044
2051
|
|
|
2045
|
-
export declare interface HvCardContentProps extends Omit<CardContentProps, "classes"
|
|
2046
|
-
/** Id to be applied to the root node. */
|
|
2047
|
-
id?: string;
|
|
2052
|
+
export declare interface HvCardContentProps extends Omit<CardContentProps, "classes"> {
|
|
2048
2053
|
/** The function that will be executed when this section is clicked. */
|
|
2049
2054
|
onClick?: (event: React.SyntheticEvent) => void;
|
|
2050
2055
|
/** A Jss Object used to override or extend the styles applied to the component. */
|
|
@@ -2055,7 +2060,7 @@ export declare const HvCardHeader: (props: HvCardHeaderProps) => JSX_2.Element;
|
|
|
2055
2060
|
|
|
2056
2061
|
export declare type HvCardHeaderClasses = ExtractNames<typeof useClasses_21>;
|
|
2057
2062
|
|
|
2058
|
-
export declare interface HvCardHeaderProps extends Omit<CardHeaderProps, "classes"
|
|
2063
|
+
export declare interface HvCardHeaderProps extends Omit<CardHeaderProps, "classes"> {
|
|
2059
2064
|
/** The renderable content inside the title slot of the header. */
|
|
2060
2065
|
title: React.ReactNode;
|
|
2061
2066
|
/** The renderable content inside the subheader slot of the header. */
|
|
@@ -2506,7 +2511,7 @@ export declare const HvContainer: ForwardRefExoticComponent<Omit<HvContainerProp
|
|
|
2506
2511
|
|
|
2507
2512
|
export declare type HvContainerClasses = ExtractNames<typeof useClasses_24>;
|
|
2508
2513
|
|
|
2509
|
-
export declare interface HvContainerProps extends Omit<ContainerProps, "classes"
|
|
2514
|
+
export declare interface HvContainerProps extends Omit<ContainerProps, "classes"> {
|
|
2510
2515
|
/**
|
|
2511
2516
|
* The component used for the root node.
|
|
2512
2517
|
* Either a string to use a DOM element or a component.
|
|
@@ -2725,7 +2730,7 @@ export declare type HvDialogActionClasses = ExtractNames<typeof useClasses_27>;
|
|
|
2725
2730
|
|
|
2726
2731
|
export declare const HvDialogActions: (props: HvDialogActionsProps) => JSX_2.Element;
|
|
2727
2732
|
|
|
2728
|
-
export declare interface HvDialogActionsProps extends Omit<DialogActionsProps, "classes"
|
|
2733
|
+
export declare interface HvDialogActionsProps extends Omit<DialogActionsProps, "classes"> {
|
|
2729
2734
|
/** Set the dialog to fullscreen mode. @deprecated set `fullscreen` in `HvDialog` */
|
|
2730
2735
|
fullscreen?: boolean;
|
|
2731
2736
|
/** A Jss Object used to override or extend the styles applied to the component. */
|
|
@@ -2738,14 +2743,14 @@ export declare const HvDialogContent: (props: HvDialogContentProps) => JSX_2.Ele
|
|
|
2738
2743
|
|
|
2739
2744
|
export declare type HvDialogContentClasses = ExtractNames<typeof useClasses_26>;
|
|
2740
2745
|
|
|
2741
|
-
export declare interface HvDialogContentProps extends Omit<DialogContentProps, "classes"
|
|
2746
|
+
export declare interface HvDialogContentProps extends Omit<DialogContentProps, "classes"> {
|
|
2742
2747
|
/** Content should be indented in relationship to the Dialog title. */
|
|
2743
2748
|
indentContent?: boolean;
|
|
2744
2749
|
/** A Jss Object used to override or extend the styles applied to the component. */
|
|
2745
2750
|
classes?: HvDialogContentClasses;
|
|
2746
2751
|
}
|
|
2747
2752
|
|
|
2748
|
-
export declare interface HvDialogProps extends Omit<DialogProps, "fullScreen" | "classes" | "open"
|
|
2753
|
+
export declare interface HvDialogProps extends Omit<DialogProps, "fullScreen" | "classes" | "open"> {
|
|
2749
2754
|
/** Current state of the Dialog. */
|
|
2750
2755
|
open?: boolean;
|
|
2751
2756
|
/** Callback fired when the component requests to be closed. */
|
|
@@ -2845,7 +2850,7 @@ export declare const HvDrawer: (props: HvDrawerProps) => JSX_2.Element;
|
|
|
2845
2850
|
|
|
2846
2851
|
export declare type HvDrawerClasses = ExtractNames<typeof useClasses_29>;
|
|
2847
2852
|
|
|
2848
|
-
export declare interface HvDrawerProps extends
|
|
2853
|
+
export declare interface HvDrawerProps extends Omit<DrawerProps, "classes"> {
|
|
2849
2854
|
/**
|
|
2850
2855
|
* Class names to be applied.
|
|
2851
2856
|
*/
|
|
@@ -3777,7 +3782,7 @@ export declare type HvGridClasses = ExtractNames<typeof useClasses_32>;
|
|
|
3777
3782
|
|
|
3778
3783
|
export declare type HvGridDirection = "row" | "row-reverse" | "column" | "column-reverse";
|
|
3779
3784
|
|
|
3780
|
-
export declare interface HvGridProps extends Omit<GridProps, "classes" | "columns"
|
|
3785
|
+
export declare interface HvGridProps extends Omit<GridProps, "classes" | "columns"> {
|
|
3781
3786
|
/**
|
|
3782
3787
|
* If `true`, the component will have the flex *container* behavior.
|
|
3783
3788
|
* You should be wrapping *items* with a *container*.
|
|
@@ -4340,10 +4345,6 @@ export declare const HvListItem: React_2.ForwardRefExoticComponent<HvListItemPro
|
|
|
4340
4345
|
export declare type HvListItemClasses = ExtractNames<typeof useClasses_4>;
|
|
4341
4346
|
|
|
4342
4347
|
export declare interface HvListItemProps extends HvBaseProps<HTMLLIElement> {
|
|
4343
|
-
/**
|
|
4344
|
-
* Overrides the implicit list item role.
|
|
4345
|
-
*/
|
|
4346
|
-
role?: HvBaseProps<HTMLLIElement>["role"];
|
|
4347
4348
|
/** Indicates if the list item is selected. */
|
|
4348
4349
|
selected?: boolean;
|
|
4349
4350
|
/** If true, the list item will be disabled. */
|
|
@@ -4578,23 +4579,23 @@ export declare interface HvPaginationLabels {
|
|
|
4578
4579
|
pageSizeSelectorDescription?: string;
|
|
4579
4580
|
/** Separator of current page and total pages. */
|
|
4580
4581
|
pagesSeparator?: string;
|
|
4581
|
-
/** Title of button `firstPage`. */
|
|
4582
|
+
/** Title of button `firstPage`. @deprecated Use `firstPage` instead. */
|
|
4582
4583
|
paginationFirstPageTitle?: string;
|
|
4583
|
-
/** Title of button `previousPage`. */
|
|
4584
|
+
/** Title of button `previousPage`. @deprecated Use `previousPage` instead. */
|
|
4584
4585
|
paginationPreviousPageTitle?: string;
|
|
4585
|
-
/** Title of button `nextPage`. */
|
|
4586
|
+
/** Title of button `nextPage`. @deprecated Use `nextPage` instead. */
|
|
4586
4587
|
paginationNextPageTitle?: string;
|
|
4587
|
-
/** Title of button `lastPage`. */
|
|
4588
|
+
/** Title of button `lastPage`. @deprecated Use `lastPage` instead. */
|
|
4588
4589
|
paginationLastPageTitle?: string;
|
|
4589
4590
|
/** Aria-label passed to the page input. */
|
|
4590
4591
|
paginationInputLabel?: string;
|
|
4591
|
-
/**
|
|
4592
|
+
/** Label of the first page button */
|
|
4592
4593
|
firstPage?: string;
|
|
4593
|
-
/**
|
|
4594
|
+
/** Label of the previous page button */
|
|
4594
4595
|
previousPage?: string;
|
|
4595
|
-
/**
|
|
4596
|
+
/** Label of the next page button */
|
|
4596
4597
|
nextPage?: string;
|
|
4597
|
-
/**
|
|
4598
|
+
/** Label of the last page button */
|
|
4598
4599
|
lastPage?: string;
|
|
4599
4600
|
}
|
|
4600
4601
|
|
|
@@ -4955,10 +4956,7 @@ export declare const hvQueryBuilderDefaultOperators: {
|
|
|
4955
4956
|
|
|
4956
4957
|
export declare interface HvQueryBuilderLabels {
|
|
4957
4958
|
query?: {
|
|
4958
|
-
delete?:
|
|
4959
|
-
ariaLabel: string;
|
|
4960
|
-
tooltip?: string;
|
|
4961
|
-
} & DialogLabels;
|
|
4959
|
+
delete?: ActionIconLabels;
|
|
4962
4960
|
addRule?: {
|
|
4963
4961
|
label: string;
|
|
4964
4962
|
};
|
|
@@ -5032,20 +5030,11 @@ export declare interface HvQueryBuilderLabels {
|
|
|
5032
5030
|
};
|
|
5033
5031
|
};
|
|
5034
5032
|
};
|
|
5035
|
-
delete:
|
|
5036
|
-
ariaLabel: string;
|
|
5037
|
-
tooltip?: string;
|
|
5038
|
-
} & DialogLabels;
|
|
5033
|
+
delete: ActionIconLabels;
|
|
5039
5034
|
};
|
|
5040
5035
|
group: {
|
|
5041
|
-
delete:
|
|
5042
|
-
|
|
5043
|
-
tooltip?: string;
|
|
5044
|
-
} & DialogLabels;
|
|
5045
|
-
reset: {
|
|
5046
|
-
ariaLabel: string;
|
|
5047
|
-
tooltip?: string;
|
|
5048
|
-
} & DialogLabels;
|
|
5036
|
+
delete: ActionIconLabels;
|
|
5037
|
+
reset: ActionIconLabels;
|
|
5049
5038
|
addRule: {
|
|
5050
5039
|
label: string;
|
|
5051
5040
|
};
|
|
@@ -5222,7 +5211,7 @@ export declare interface HvRadioGroupProps extends HvBaseProps<HTMLDivElement, "
|
|
|
5222
5211
|
classes?: HvRadioGroupClasses;
|
|
5223
5212
|
}
|
|
5224
5213
|
|
|
5225
|
-
export declare interface HvRadioProps extends Omit<RadioProps_2, "onChange" | "classes"
|
|
5214
|
+
export declare interface HvRadioProps extends Omit<RadioProps_2, "onChange" | "classes"> {
|
|
5226
5215
|
/**
|
|
5227
5216
|
* A Jss Object used to override or extend the styles applied to the radio button.
|
|
5228
5217
|
*/
|
|
@@ -5740,7 +5729,7 @@ export declare const HvSnackbarContent: ForwardRefExoticComponent<Omit<HvSnackba
|
|
|
5740
5729
|
|
|
5741
5730
|
export declare type HvSnackbarContentClasses = ExtractNames<typeof useClasses_77>;
|
|
5742
5731
|
|
|
5743
|
-
export declare interface HvSnackbarContentProps extends Omit<SnackbarContentProps, "variant" | "action" | "classes"
|
|
5732
|
+
export declare interface HvSnackbarContentProps extends Omit<SnackbarContentProps, "variant" | "action" | "classes"> {
|
|
5744
5733
|
/** The message to display. */
|
|
5745
5734
|
label?: React.ReactNode;
|
|
5746
5735
|
/** Variant of the snackbar. */
|
|
@@ -5757,7 +5746,7 @@ export declare interface HvSnackbarContentProps extends Omit<SnackbarContentProp
|
|
|
5757
5746
|
classes?: HvSnackbarContentClasses;
|
|
5758
5747
|
}
|
|
5759
5748
|
|
|
5760
|
-
export declare interface HvSnackbarProps extends Omit<SnackbarProps, "action" | "classes"
|
|
5749
|
+
export declare interface HvSnackbarProps extends Omit<SnackbarProps, "action" | "classes" | "children"> {
|
|
5761
5750
|
/** If true, Snackbar is open. */
|
|
5762
5751
|
open?: boolean;
|
|
5763
5752
|
/** Callback fired when the component requests to be closed. Typically onClose is used to set state in the parent component, which is used to control the Snackbar open prop. The reason parameter can optionally be used to control the response to onClose, for example ignoring clickaway. */
|
|
@@ -5909,7 +5898,7 @@ export declare interface HvSwitchColumnCellProp {
|
|
|
5909
5898
|
switchProps?: HvBaseSwitchProps;
|
|
5910
5899
|
}
|
|
5911
5900
|
|
|
5912
|
-
export declare interface HvSwitchProps extends Omit<SwitchProps_2, "onChange" | "classes"
|
|
5901
|
+
export declare interface HvSwitchProps extends Omit<SwitchProps_2, "onChange" | "classes"> {
|
|
5913
5902
|
/**
|
|
5914
5903
|
* A Jss Object used to override or extend the styles applied to the switch.
|
|
5915
5904
|
*/
|
|
@@ -6302,7 +6291,7 @@ export declare interface HvTableState<D extends object = Record<string, unknown>
|
|
|
6302
6291
|
|
|
6303
6292
|
export declare type HvTableVariant = "listrow" | "default";
|
|
6304
6293
|
|
|
6305
|
-
export declare interface HvTabProps extends Omit<TabProps, "children"
|
|
6294
|
+
export declare interface HvTabProps extends Omit<TabProps, "children"> {
|
|
6306
6295
|
/** If `true`, the tab will be disabled. */
|
|
6307
6296
|
disabled?: boolean;
|
|
6308
6297
|
/** The icon element. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hitachivantara/uikit-react-core",
|
|
3
|
-
"version": "5.38.
|
|
3
|
+
"version": "5.38.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Hitachi Vantara UI Kit Team",
|
|
6
6
|
"description": "Core React components for the NEXT Design System.",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@emotion/css": "^11.11.0",
|
|
34
34
|
"@emotion/serialize": "^1.1.2",
|
|
35
35
|
"@emotion/utils": "^1.2.1",
|
|
36
|
-
"@hitachivantara/uikit-react-icons": "^5.7.
|
|
36
|
+
"@hitachivantara/uikit-react-icons": "^5.7.8",
|
|
37
37
|
"@hitachivantara/uikit-react-shared": "^5.1.20",
|
|
38
38
|
"@hitachivantara/uikit-styles": "^5.16.4",
|
|
39
39
|
"@internationalized/date": "^3.2.0",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"access": "public",
|
|
65
65
|
"directory": "package"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "eb7992ae506e68e72520b06ee8c2348cec8403c3",
|
|
68
68
|
"main": "dist/cjs/index.cjs",
|
|
69
69
|
"exports": {
|
|
70
70
|
".": {
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
4
|
-
const Button = require("../Button/Button.cjs");
|
|
5
|
-
const Tooltip = require("../Tooltip/Tooltip.cjs");
|
|
6
|
-
const Typography = require("../Typography/Typography.cjs");
|
|
7
|
-
const ButtonIconTooltip = ({
|
|
8
|
-
tooltip,
|
|
9
|
-
children,
|
|
10
|
-
...buttonProps
|
|
11
|
-
}) => {
|
|
12
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Tooltip.HvTooltip, { title: /* @__PURE__ */ jsxRuntime.jsx(Typography.HvTypography, { children: tooltip }), children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(Button.HvButton, { icon: true, ...buttonProps, children }) }) });
|
|
13
|
-
};
|
|
14
|
-
const ButtonIconTooltip$1 = ButtonIconTooltip;
|
|
15
|
-
exports.default = ButtonIconTooltip$1;
|
|
16
|
-
//# sourceMappingURL=ButtonIconTooltip.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonIconTooltip.cjs","sources":["../../../../src/components/Pagination/ButtonIconTooltip.tsx"],"sourcesContent":["import { ReactNode } from \"react\";\n\nimport { HvButton, HvButtonProps } from \"@core/components/Button\";\nimport { HvTooltip } from \"@core/components/Tooltip\";\nimport { HvTypography } from \"@core/components/Typography\";\n\ninterface ButtonIconTooltipProps extends HvButtonProps {\n tooltip: ReactNode;\n children: ReactNode;\n}\n\nconst ButtonIconTooltip = ({\n tooltip,\n children,\n ...buttonProps\n}: ButtonIconTooltipProps) => {\n return (\n <HvTooltip title={<HvTypography>{tooltip}</HvTypography>}>\n <div>\n <HvButton icon {...buttonProps}>\n {children}\n </HvButton>\n </div>\n </HvTooltip>\n );\n};\nexport default ButtonIconTooltip;\n"],"names":["ButtonIconTooltip","tooltip","children","buttonProps","HvTooltip","jsx","HvTypography","HvButton"],"mappings":";;;;;;AAWA,MAAMA,oBAAoBA,CAAC;AAAA,EACzBC;AAAAA,EACAC;AAAAA,EACA,GAAGC;AACmB,MAAM;AAC5B,wCACGC,QAAAA,WAAU,EAAA,OAAQC,2BAAA,IAAAC,yBAAA,EAAcL,mBAAQ,GACvC,UAAAI,2BAAA,IAAC,OACC,EAAA,UAAAA,2BAAAA,IAACE,mBAAS,MAAI,MAAC,GAAIJ,aAChBD,SAAAA,CACH,EACF,CAAA,EACF,CAAA;AAEJ;AACA,MAAA,sBAAeF;;"}
|