@hitachivantara/uikit-react-core 5.24.6 → 5.25.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/Badge/Badge.cjs +0 -1
- package/dist/cjs/components/Badge/Badge.cjs.map +1 -1
- package/dist/cjs/components/ColorPicker/ColorPicker.cjs +12 -1
- package/dist/cjs/components/ColorPicker/ColorPicker.cjs.map +1 -1
- package/dist/cjs/components/EmptyState/EmptyState.styles.cjs +1 -5
- package/dist/cjs/components/EmptyState/EmptyState.styles.cjs.map +1 -1
- package/dist/esm/components/Badge/Badge.js +0 -1
- package/dist/esm/components/Badge/Badge.js.map +1 -1
- package/dist/esm/components/ColorPicker/ColorPicker.js +12 -1
- package/dist/esm/components/ColorPicker/ColorPicker.js.map +1 -1
- package/dist/esm/components/EmptyState/EmptyState.styles.js +1 -5
- package/dist/esm/components/EmptyState/EmptyState.styles.js.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/package.json +5 -5
|
@@ -28,7 +28,6 @@ const HvBadge = (props) => {
|
|
|
28
28
|
children: text
|
|
29
29
|
});
|
|
30
30
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
31
|
-
"aria-label": renderedCountOrLabel == null ? void 0 : renderedCountOrLabel.toString(),
|
|
32
31
|
className: cx(classes.root, className),
|
|
33
32
|
...others,
|
|
34
33
|
children: [Component, /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.cjs","sources":["../../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import {\n HvTypography,\n HvTypographyVariants,\n} from \"@core/components/Typography\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { staticClasses, useClasses } from \"./Badge.styles\";\n\nexport { staticClasses as badgeClasses };\n\nexport type HvBadgeClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvBadgeProps extends HvBaseProps {\n /**\n * Count is the number of unread notifications.\n * Note count and label are mutually exclusive.\n * count is ignored when label is specified at the same time.\n */\n count?: number;\n /**\n * True if count should be displayed.\n * Note showCount and label are mutually exclusive.\n * showCount is ignored when label is specified at the same time.\n */\n showCount?: boolean;\n /** The maximum number of unread notifications to be displayed */\n maxCount?: number;\n /**\n * Custom text to show in place of count.\n * Note showCount and label are mutually exclusive.\n * showCount is ignored when label is specified at the same time.\n */\n label?: string;\n /** Icon which the notification will be attached. */\n icon?: React.ReactNode;\n /** Text which the notification will be attached. */\n text?: string;\n /** Text variant. */\n textVariant?: HvTypographyVariants;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvBadgeClasses;\n}\n\n/**\n * The badge is a component used to notify the user that something has occurred, in the app context.\n */\nexport const HvBadge = (props: HvBadgeProps) => {\n const {\n classes: classesProp,\n className,\n showCount = false,\n count = 0,\n maxCount = 99,\n label = null,\n icon = null,\n text = null,\n textVariant = undefined,\n ...others\n } = useDefaultProps(\"HvBadge\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const renderedCount = count > maxCount ? `${maxCount}+` : count;\n // If label is specified and non-empty, render it.\n // If showCount is specified and count > 0, render the count.\n // Otherwise, render nothing on the badge.\n // (Note count=0 should not be rendered to avoid ghosty 0.)\n const renderedCountOrLabel =\n label || (showCount && count > 0 && renderedCount) || null;\n const Component =\n icon || (text && <HvTypography variant={textVariant}>{text}</HvTypography>);\n\n return (\n <div
|
|
1
|
+
{"version":3,"file":"Badge.cjs","sources":["../../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import {\n HvTypography,\n HvTypographyVariants,\n} from \"@core/components/Typography\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { staticClasses, useClasses } from \"./Badge.styles\";\n\nexport { staticClasses as badgeClasses };\n\nexport type HvBadgeClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvBadgeProps extends HvBaseProps {\n /**\n * Count is the number of unread notifications.\n * Note count and label are mutually exclusive.\n * count is ignored when label is specified at the same time.\n */\n count?: number;\n /**\n * True if count should be displayed.\n * Note showCount and label are mutually exclusive.\n * showCount is ignored when label is specified at the same time.\n */\n showCount?: boolean;\n /** The maximum number of unread notifications to be displayed */\n maxCount?: number;\n /**\n * Custom text to show in place of count.\n * Note showCount and label are mutually exclusive.\n * showCount is ignored when label is specified at the same time.\n */\n label?: string;\n /** Icon which the notification will be attached. */\n icon?: React.ReactNode;\n /** Text which the notification will be attached. */\n text?: string;\n /** Text variant. */\n textVariant?: HvTypographyVariants;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvBadgeClasses;\n}\n\n/**\n * The badge is a component used to notify the user that something has occurred, in the app context.\n */\nexport const HvBadge = (props: HvBadgeProps) => {\n const {\n classes: classesProp,\n className,\n showCount = false,\n count = 0,\n maxCount = 99,\n label = null,\n icon = null,\n text = null,\n textVariant = undefined,\n ...others\n } = useDefaultProps(\"HvBadge\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const renderedCount = count > maxCount ? `${maxCount}+` : count;\n // If label is specified and non-empty, render it.\n // If showCount is specified and count > 0, render the count.\n // Otherwise, render nothing on the badge.\n // (Note count=0 should not be rendered to avoid ghosty 0.)\n const renderedCountOrLabel =\n label || (showCount && count > 0 && renderedCount) || null;\n const Component =\n icon || (text && <HvTypography variant={textVariant}>{text}</HvTypography>);\n\n return (\n <div className={cx(classes.root, className)} {...others}>\n {Component}\n <div className={Component ? classes.badgeContainer : undefined}>\n <div\n className={cx(classes.badgePosition, {\n [classes.badge]: !!(count > 0 || renderedCountOrLabel),\n [classes.showCount]: !!(!label && renderedCountOrLabel),\n [classes.showLabel]: !!label,\n [classes.badgeIcon]: !!icon,\n [classes.badgeOneDigit]: String(renderedCountOrLabel).length === 1,\n })}\n >\n {renderedCountOrLabel}\n </div>\n </div>\n </div>\n );\n};\n"],"names":["HvBadge","props","classes","classesProp","className","showCount","count","maxCount","label","icon","text","textVariant","undefined","others","useDefaultProps","cx","useClasses","renderedCount","renderedCountOrLabel","Component","_jsx","HvTypography","variant","children","root","badgeContainer","badgePosition","badge","showLabel","badgeIcon","badgeOneDigit","String","length"],"mappings":";;;;;;AAgDaA,MAAAA,UAAUA,CAACC,UAAwB;AACxC,QAAA;AAAA,IACJC,SAASC;AAAAA,IACTC;AAAAA,IACAC,YAAY;AAAA,IACZC,QAAQ;AAAA,IACRC,WAAW;AAAA,IACXC,QAAQ;AAAA,IACRC,OAAO;AAAA,IACPC,OAAO;AAAA,IACPC,cAAcC;AAAAA,IACd,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,gBAAA,WAAWb,KAAK;AAE9B,QAAA;AAAA,IAAEC;AAAAA,IAASa;AAAAA,EAAAA,IAAOC,aAAAA,WAAWb,WAAW;AAE9C,QAAMc,gBAAgBX,QAAQC,WAAY,GAAEA,cAAcD;AAK1D,QAAMY,uBACJV,SAAUH,aAAaC,QAAQ,KAAKW,iBAAkB;AACxD,QAAME,YACJV,QAASC,QAAQU,2BAAAA,IAACC,WAAAA,cAAY;AAAA,IAACC,SAASX;AAAAA,IAAYY,UAAEb;AAAAA,EAAAA,CAAmB;AAE3E,yCACE,OAAA;AAAA,IAAKN,WAAWW,GAAGb,QAAQsB,MAAMpB,SAAS;AAAA,IAAE,GAAKS;AAAAA,IAAMU,UAAA,CACpDJ,WACDC,2BAAAA,IAAA,OAAA;AAAA,MAAKhB,WAAWe,YAAYjB,QAAQuB,iBAAiBb;AAAAA,MAAUW,yCAC7D,OAAA;AAAA,QACEnB,WAAWW,GAAGb,QAAQwB,eAAe;AAAA,UACnC,CAACxB,QAAQyB,KAAK,GAAG,CAAC,EAAErB,QAAQ,KAAKY;AAAAA,UACjC,CAAChB,QAAQG,SAAS,GAAG,CAAC,EAAE,CAACG,SAASU;AAAAA,UAClC,CAAChB,QAAQ0B,SAAS,GAAG,CAAC,CAACpB;AAAAA,UACvB,CAACN,QAAQ2B,SAAS,GAAG,CAAC,CAACpB;AAAAA,UACvB,CAACP,QAAQ4B,aAAa,GAAGC,OAAOb,oBAAoB,EAAEc,WAAW;AAAA,QAAA,CAClE;AAAA,QAAET,UAEFL;AAAAA,MAAAA,CACE;AAAA,IAAA,CACF,CAAC;AAAA,EAAA,CACH;AAET;;;"}
|
|
@@ -37,6 +37,7 @@ const HvColorPicker = (props) => {
|
|
|
37
37
|
classes: classesProp,
|
|
38
38
|
value,
|
|
39
39
|
onChange,
|
|
40
|
+
onChangeComplete,
|
|
40
41
|
defaultValue = "",
|
|
41
42
|
expanded,
|
|
42
43
|
defaultExpanded = false,
|
|
@@ -75,6 +76,15 @@ const HvColorPicker = (props) => {
|
|
|
75
76
|
};
|
|
76
77
|
const handleSelect = (val) => {
|
|
77
78
|
onChange == null ? void 0 : onChange(val.hex);
|
|
79
|
+
onChangeComplete == null ? void 0 : onChangeComplete(val.hex);
|
|
80
|
+
setColor(val.hex);
|
|
81
|
+
};
|
|
82
|
+
const handleOnChange = (val) => {
|
|
83
|
+
onChange == null ? void 0 : onChange(val.hex);
|
|
84
|
+
setColor(val.hex);
|
|
85
|
+
};
|
|
86
|
+
const handleOnChangeComplete = (val) => {
|
|
87
|
+
onChangeComplete == null ? void 0 : onChangeComplete(val.hex);
|
|
78
88
|
setColor(val.hex);
|
|
79
89
|
};
|
|
80
90
|
const handleAddColor = () => {
|
|
@@ -165,7 +175,8 @@ const HvColorPicker = (props) => {
|
|
|
165
175
|
},
|
|
166
176
|
title: showLabels ? labels == null ? void 0 : labels.customColorsLabel : void 0,
|
|
167
177
|
color,
|
|
168
|
-
onChange:
|
|
178
|
+
onChange: handleOnChange,
|
|
179
|
+
onChangeComplete: handleOnChangeComplete
|
|
169
180
|
}), showSavedColors && /* @__PURE__ */ jsxRuntime.jsx(SavedColors.SavedColors, {
|
|
170
181
|
colors: savedColors,
|
|
171
182
|
onAddColor: handleAddColor,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPicker.cjs","sources":["../../../../src/components/ColorPicker/ColorPicker.tsx"],"sourcesContent":["import { Checkbox, ColorPicker } from \"@hitachivantara/uikit-react-icons\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\n\nimport { ColorState } from \"react-color\";\n\nimport { useControlled } from \"@core/hooks/useControlled\";\nimport { useUniqueId } from \"@core/hooks/useUniqueId\";\nimport { useLabels } from \"@core/hooks/useLabels\";\nimport { useTheme } from \"@core/hooks/useTheme\";\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { setId } from \"@core/utils/setId\";\nimport { HvTypography } from \"@core/components/Typography\";\nimport { HvPanel } from \"@core/components/Panel\";\nimport { HvFormElement, HvInfoMessage, HvLabel } from \"@core/components/Forms\";\nimport { HvBaseDropdown } from \"@core/components/BaseDropdown\";\nimport { HvDropdownProps } from \"@core/components/Dropdown\";\n\nimport { Picker } from \"./Picker\";\nimport { staticClasses, useClasses } from \"./ColorPicker.styles\";\nimport { PresetColors } from \"./PresetColors\";\nimport { SavedColors } from \"./SavedColors\";\n\nexport { staticClasses as colorPickerClasses };\n\nexport type HvColorPickerClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvColorPickerProps {\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n \"aria-describedby\"?: string;\n /** Class names to be applied. */\n className?: string;\n /** Id to be applied to the form element root node. */\n id?: string;\n /** The form element name. */\n name?: string;\n /**\n * The label of the form element.\n *\n * The form element must be labeled for accessibility reasons.\n * If not provided, an aria-label or aria-labelledby must be provided instead.\n */\n label?: React.ReactNode;\n /** Provide additional descriptive text for the form element. */\n description?: React.ReactNode;\n /** Indicates that user input is required on the form element. */\n required?: boolean;\n /** The value color, in HEX format. */\n value?: string;\n /** The default value color, in HEX format. */\n defaultValue?: string;\n /** If `true` the dropdown is disabled unable to be interacted, if `false` it is enabled. */\n disabled?: boolean;\n /** If `true` the dropdown starts opened if `false` it starts closed. */\n expanded?: boolean;\n /** When uncontrolled, defines the initial expanded state. */\n defaultExpanded?: boolean;\n /** A function to be executed whenever the color changes. */\n onChange?: (color: string) => void;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvColorPickerClasses;\n /** The placeholder value when nothing is selected. */\n placeholder?: string;\n /** Recommended colors. The colors are HEX values. */\n recommendedColors?: string[];\n /** Recommended colors position. */\n recommendedColorsPosition?: \"top\" | \"bottom\";\n /** If `true`, the labels are shown. If `false`, they are not shown. */\n showLabels?: boolean;\n /** An object containing all the labels. */\n labels?: {\n recommendedColorsLabel?: string;\n customColorsLabel?: string;\n };\n /** Icon type for the input's end adornment. */\n dropdownIcon?: \"arrow\" | \"colorPicker\";\n /** If `true`, the input only shows an icon. If `false`, the input shows text and icons. */\n iconOnly?: boolean;\n /** If `true`, the saved colors area is shown. If `false`, it is not shown. */\n showSavedColors?: boolean;\n /** If `true`, the custom colors area is shown. If `false`, it is not shown. */\n showCustomColors?: boolean;\n /** The saved colors. The colors are HEX values. */\n savedColorsValue?: string[];\n /** The default saved colors. The colors are HEX values. */\n defaultSavedColorsValue?: string[];\n /** Callback fired when a new saved color is added. */\n onSavedColorAdded?: (color?: string) => void;\n /** Callback fired when a new saved color is removed. */\n onSavedColorRemoved?: (color?: string) => void;\n /** Aria label to apply to delete saved color button. */\n deleteSavedColorButtonArialLabel?: string;\n}\n\nconst DEFAULT_LABELS: HvColorPickerProps[\"labels\"] = {\n recommendedColorsLabel: \"Recommended colors:\",\n customColorsLabel: \"Custom colors:\",\n};\n\n/**\n * A color picker component which allows the user to select a color from a list of pre-defined colors or freely select one color via the Hue and Saturation.\n * It receives a color string in HEX format and outputs an HEX formatted color.\n */\nexport const HvColorPicker = (props: HvColorPickerProps) => {\n const {\n id,\n name,\n required = false,\n disabled = false,\n label,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n description,\n \"aria-describedby\": ariaDescribedBy,\n className,\n classes: classesProp,\n value,\n onChange,\n defaultValue = \"\",\n expanded,\n defaultExpanded = false,\n recommendedColorsPosition = \"top\",\n recommendedColors = [\n \"#95AFE8\",\n \"#E89E5D\",\n \"#83B8A6\",\n \"#70759C\",\n \"#C57E7E\",\n \"#FADA95\",\n \"#ADBFE8\",\n \"#E3B386\",\n \"#9AC6B7\",\n \"#8B90AF\",\n \"#CF9797\",\n \"#FAE1AA\",\n ],\n showLabels = true,\n labels: labelsProp,\n dropdownIcon = \"colorPicker\",\n placeholder = \"Select color...\",\n iconOnly = false,\n showSavedColors = true,\n showCustomColors = true,\n savedColorsValue,\n defaultSavedColorsValue = [],\n onSavedColorAdded,\n onSavedColorRemoved,\n deleteSavedColorButtonArialLabel = \"Delete saved color\",\n } = useDefaultProps(\"HvColorPicker\", props);\n\n const { classes, css, cx } = useClasses(classesProp);\n const { activeTheme } = useTheme();\n\n const labels = useLabels(DEFAULT_LABELS, labelsProp);\n\n const [isOpen, setIsOpen] = useControlled(expanded, Boolean(defaultExpanded));\n const [color, setColor] = useControlled(value, defaultValue);\n const [savedColors, setSavedColors] = useControlled(\n savedColorsValue,\n defaultSavedColorsValue\n );\n const elementId = useUniqueId(id, \"hvdropdown\");\n const hasLabel = label != null;\n const hasDescription = description != null;\n\n const handleToggle: HvDropdownProps[\"onToggle\"] = (_, open) => {\n setIsOpen(open);\n };\n\n const handleSelect = (val: ColorState | { hex: string; source: string }) => {\n onChange?.(val.hex);\n setColor(val.hex);\n };\n\n const handleAddColor = () => {\n // When no color is provided, react-color sets the picker to #000000.\n // This is the color that should be added in this case.\n const colorToAdd = color || \"#000000\";\n\n onSavedColorAdded?.(colorToAdd);\n setSavedColors([...savedColors, colorToAdd]);\n };\n\n const handleRemoveColor = (val: string, position: number) => {\n if (savedColors[position] === val) {\n const sColors = [...savedColors];\n sColors.splice(position, 1);\n onSavedColorRemoved?.(val);\n setSavedColors(sColors);\n }\n };\n\n const setFocusToContent = (containerRef: HTMLElement | null) => {\n const inputs = containerRef?.getElementsByTagName(\"input\");\n if (inputs && inputs.length > 0) {\n inputs[0].focus();\n }\n };\n\n return (\n <HvFormElement\n id={id}\n name={name}\n disabled={disabled}\n required={required}\n className={cx(classes.root, className)}\n >\n {(hasLabel || hasDescription) && (\n <div className={classes.labelContainer}>\n {hasLabel && (\n <HvLabel\n id={setId(elementId, \"label\")}\n label={label}\n className={classes.label}\n />\n )}\n\n {hasDescription && (\n <HvInfoMessage\n id={setId(elementId, \"description\")}\n className={classes.description}\n >\n {description}\n </HvInfoMessage>\n )}\n </div>\n )}\n <HvBaseDropdown\n variableWidth\n className={className}\n expanded={isOpen}\n onToggle={handleToggle}\n onContainerCreation={setFocusToContent}\n classes={{\n root: cx({ [classes.dropdownRootIconOnly]: iconOnly }),\n selection: cx(iconOnly && css({ padding: 0 })),\n }}\n adornment={\n iconOnly && color ? (\n <Checkbox\n className={classes.headerColorIconOnly}\n color={[color, \"transparent\"]}\n />\n ) : dropdownIcon === \"colorPicker\" ? (\n <ColorPicker className={classes.colorPickerIcon} />\n ) : undefined\n }\n placeholder={\n iconOnly ? undefined : color ? (\n <>\n <Checkbox\n className={classes.headerColorIcon}\n color={[color, \"transparent\"]}\n />\n <HvTypography\n className={classes.headerColorValue}\n variant={activeTheme?.colorPicker.inputValueVariant}\n >\n {color}\n </HvTypography>\n </>\n ) : (\n placeholder\n )\n }\n aria-label={ariaLabel}\n aria-labelledby={\n [label && setId(elementId, \"label\"), ariaLabelledBy]\n .join(\" \")\n .trim() || undefined\n }\n aria-describedby={\n [description && setId(elementId, \"description\"), ariaDescribedBy]\n .join(\" \")\n .trim() || undefined\n }\n >\n <HvPanel className={classes.panel}>\n <div className={classes.colorPicker}>\n {recommendedColorsPosition === \"top\" && (\n <PresetColors\n className={cx(\n (showCustomColors || showSavedColors) &&\n css({\n paddingBottom:\n activeTheme?.colorPicker.recommendedColorsBottomPadding,\n }),\n classes.recommendedColorsRoot\n )}\n colors={recommendedColors}\n onClick={handleSelect}\n title={showLabels ? labels?.recommendedColorsLabel : undefined}\n />\n )}\n {showCustomColors && (\n <Picker\n classes={{\n fields: cx({\n [classes.pickerFields]:\n recommendedColorsPosition === \"bottom\" || showSavedColors,\n }),\n }}\n title={showLabels ? labels?.customColorsLabel : undefined}\n color={color}\n onChange={handleSelect}\n />\n )}\n {showSavedColors && (\n <SavedColors\n colors={savedColors}\n onAddColor={handleAddColor}\n onClickColor={handleSelect}\n onRemoveColor={handleRemoveColor}\n deleteButtonArialLabel={deleteSavedColorButtonArialLabel}\n />\n )}\n {recommendedColorsPosition === \"bottom\" && (\n <PresetColors\n colors={recommendedColors}\n onClick={handleSelect}\n title={showLabels ? labels?.recommendedColorsLabel : undefined}\n />\n )}\n </div>\n </HvPanel>\n </HvBaseDropdown>\n </HvFormElement>\n );\n};\n"],"names":["DEFAULT_LABELS","recommendedColorsLabel","customColorsLabel","HvColorPicker","props","id","name","required","disabled","label","ariaLabel","ariaLabelledBy","description","ariaDescribedBy","className","classes","classesProp","value","onChange","defaultValue","expanded","defaultExpanded","recommendedColorsPosition","recommendedColors","showLabels","labels","labelsProp","dropdownIcon","placeholder","iconOnly","showSavedColors","showCustomColors","savedColorsValue","defaultSavedColorsValue","onSavedColorAdded","onSavedColorRemoved","deleteSavedColorButtonArialLabel","useDefaultProps","css","cx","useClasses","activeTheme","useTheme","useLabels","isOpen","setIsOpen","useControlled","Boolean","color","setColor","savedColors","setSavedColors","elementId","useUniqueId","hasLabel","hasDescription","handleToggle","_","open","handleSelect","val","hex","handleAddColor","colorToAdd","handleRemoveColor","position","sColors","splice","setFocusToContent","containerRef","inputs","getElementsByTagName","length","focus","HvFormElement","root","children","labelContainer","_jsx","HvLabel","setId","HvInfoMessage","HvBaseDropdown","variableWidth","onToggle","onContainerCreation","dropdownRootIconOnly","selection","padding","adornment","Checkbox","headerColorIconOnly","ColorPicker","colorPickerIcon","undefined","_Fragment","headerColorIcon","HvTypography","headerColorValue","variant","colorPicker","inputValueVariant","join","trim","HvPanel","panel","PresetColors","paddingBottom","recommendedColorsBottomPadding","recommendedColorsRoot","colors","onClick","title","Picker","fields","pickerFields","SavedColors","onAddColor","onClickColor","onRemoveColor","deleteButtonArialLabel"],"mappings":";;;;;;;;;;;;;;;;;;;;AA8FA,MAAMA,iBAA+C;AAAA,EACnDC,wBAAwB;AAAA,EACxBC,mBAAmB;AACrB;AAMaC,MAAAA,gBAAgBA,CAACC,UAA8B;AACpD,QAAA;AAAA,IACJC;AAAAA,IACAC;AAAAA,IACAC,WAAW;AAAA,IACXC,WAAW;AAAA,IACXC;AAAAA,IACA,cAAcC;AAAAA,IACd,mBAAmBC;AAAAA,IACnBC;AAAAA,IACA,oBAAoBC;AAAAA,IACpBC;AAAAA,IACAC,SAASC;AAAAA,IACTC;AAAAA,IACAC;AAAAA,IACAC,eAAe;AAAA,IACfC;AAAAA,IACAC,kBAAkB;AAAA,IAClBC,4BAA4B;AAAA,IAC5BC,oBAAoB,CAClB,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,SAAS;AAAA,IAEXC,aAAa;AAAA,IACbC,QAAQC;AAAAA,IACRC,eAAe;AAAA,IACfC,cAAc;AAAA,IACdC,WAAW;AAAA,IACXC,kBAAkB;AAAA,IAClBC,mBAAmB;AAAA,IACnBC;AAAAA,IACAC,0BAA0B,CAAE;AAAA,IAC5BC;AAAAA,IACAC;AAAAA,IACAC,mCAAmC;AAAA,EAAA,IACjCC,gBAAgB,gBAAA,iBAAiBjC,KAAK;AAEpC,QAAA;AAAA,IAAEW;AAAAA,IAASuB;AAAAA,IAAKC;AAAAA,EAAAA,IAAOC,mBAAAA,WAAWxB,WAAW;AAC7C,QAAA;AAAA,IAAEyB;AAAAA,MAAgBC,SAAS,SAAA;AAE3BjB,QAAAA,SAASkB,UAAAA,UAAU3C,gBAAgB0B,UAAU;AAE7C,QAAA,CAACkB,QAAQC,SAAS,IAAIC,cAAAA,cAAc1B,UAAU2B,QAAQ1B,eAAe,CAAC;AAC5E,QAAM,CAAC2B,OAAOC,QAAQ,IAAIH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F;AAAAA,UAAAA,CACtD,CACF;AAAA,QAAA,CACE;AAAA,MAAA,CACE;AAAA,IAAA,CACK,CAAC;AAAA,EAAA,CACJ;AAEnB;;;"}
|
|
1
|
+
{"version":3,"file":"ColorPicker.cjs","sources":["../../../../src/components/ColorPicker/ColorPicker.tsx"],"sourcesContent":["import { Checkbox, ColorPicker } from \"@hitachivantara/uikit-react-icons\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\n\nimport { ColorState } from \"react-color\";\n\nimport { useControlled } from \"@core/hooks/useControlled\";\nimport { useUniqueId } from \"@core/hooks/useUniqueId\";\nimport { useLabels } from \"@core/hooks/useLabels\";\nimport { useTheme } from \"@core/hooks/useTheme\";\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { setId } from \"@core/utils/setId\";\nimport { HvTypography } from \"@core/components/Typography\";\nimport { HvPanel } from \"@core/components/Panel\";\nimport { HvFormElement, HvInfoMessage, HvLabel } from \"@core/components/Forms\";\nimport { HvBaseDropdown } from \"@core/components/BaseDropdown\";\nimport { HvDropdownProps } from \"@core/components/Dropdown\";\n\nimport { Picker } from \"./Picker\";\nimport { staticClasses, useClasses } from \"./ColorPicker.styles\";\nimport { PresetColors } from \"./PresetColors\";\nimport { SavedColors } from \"./SavedColors\";\n\nexport { staticClasses as colorPickerClasses };\n\nexport type HvColorPickerClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvColorPickerProps {\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n \"aria-describedby\"?: string;\n /** Class names to be applied. */\n className?: string;\n /** Id to be applied to the form element root node. */\n id?: string;\n /** The form element name. */\n name?: string;\n /**\n * The label of the form element.\n *\n * The form element must be labeled for accessibility reasons.\n * If not provided, an aria-label or aria-labelledby must be provided instead.\n */\n label?: React.ReactNode;\n /** Provide additional descriptive text for the form element. */\n description?: React.ReactNode;\n /** Indicates that user input is required on the form element. */\n required?: boolean;\n /** The value color, in HEX format. */\n value?: string;\n /** The default value color, in HEX format. */\n defaultValue?: string;\n /** If `true` the dropdown is disabled unable to be interacted, if `false` it is enabled. */\n disabled?: boolean;\n /** If `true` the dropdown starts opened if `false` it starts closed. */\n expanded?: boolean;\n /** When uncontrolled, defines the initial expanded state. */\n defaultExpanded?: boolean;\n /** A function to be executed whenever the color changes. */\n onChange?: (color: string) => void;\n /** A function to be executed whenever the color change is complete. */\n onChangeComplete?: (color: string) => void;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvColorPickerClasses;\n /** The placeholder value when nothing is selected. */\n placeholder?: string;\n /** Recommended colors. The colors are HEX values. */\n recommendedColors?: string[];\n /** Recommended colors position. */\n recommendedColorsPosition?: \"top\" | \"bottom\";\n /** If `true`, the labels are shown. If `false`, they are not shown. */\n showLabels?: boolean;\n /** An object containing all the labels. */\n labels?: {\n recommendedColorsLabel?: string;\n customColorsLabel?: string;\n };\n /** Icon type for the input's end adornment. */\n dropdownIcon?: \"arrow\" | \"colorPicker\";\n /** If `true`, the input only shows an icon. If `false`, the input shows text and icons. */\n iconOnly?: boolean;\n /** If `true`, the saved colors area is shown. If `false`, it is not shown. */\n showSavedColors?: boolean;\n /** If `true`, the custom colors area is shown. If `false`, it is not shown. */\n showCustomColors?: boolean;\n /** The saved colors. The colors are HEX values. */\n savedColorsValue?: string[];\n /** The default saved colors. The colors are HEX values. */\n defaultSavedColorsValue?: string[];\n /** Callback fired when a new saved color is added. */\n onSavedColorAdded?: (color?: string) => void;\n /** Callback fired when a new saved color is removed. */\n onSavedColorRemoved?: (color?: string) => void;\n /** Aria label to apply to delete saved color button. */\n deleteSavedColorButtonArialLabel?: string;\n}\n\nconst DEFAULT_LABELS: HvColorPickerProps[\"labels\"] = {\n recommendedColorsLabel: \"Recommended colors:\",\n customColorsLabel: \"Custom colors:\",\n};\n\n/**\n * A color picker component which allows the user to select a color from a list of pre-defined colors or freely select one color via the Hue and Saturation.\n * It receives a color string in HEX format and outputs an HEX formatted color.\n */\nexport const HvColorPicker = (props: HvColorPickerProps) => {\n const {\n id,\n name,\n required = false,\n disabled = false,\n label,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n description,\n \"aria-describedby\": ariaDescribedBy,\n className,\n classes: classesProp,\n value,\n onChange,\n onChangeComplete,\n defaultValue = \"\",\n expanded,\n defaultExpanded = false,\n recommendedColorsPosition = \"top\",\n recommendedColors = [\n \"#95AFE8\",\n \"#E89E5D\",\n \"#83B8A6\",\n \"#70759C\",\n \"#C57E7E\",\n \"#FADA95\",\n \"#ADBFE8\",\n \"#E3B386\",\n \"#9AC6B7\",\n \"#8B90AF\",\n \"#CF9797\",\n \"#FAE1AA\",\n ],\n showLabels = true,\n labels: labelsProp,\n dropdownIcon = \"colorPicker\",\n placeholder = \"Select color...\",\n iconOnly = false,\n showSavedColors = true,\n showCustomColors = true,\n savedColorsValue,\n defaultSavedColorsValue = [],\n onSavedColorAdded,\n onSavedColorRemoved,\n deleteSavedColorButtonArialLabel = \"Delete saved color\",\n } = useDefaultProps(\"HvColorPicker\", props);\n\n const { classes, css, cx } = useClasses(classesProp);\n const { activeTheme } = useTheme();\n\n const labels = useLabels(DEFAULT_LABELS, labelsProp);\n\n const [isOpen, setIsOpen] = useControlled(expanded, Boolean(defaultExpanded));\n const [color, setColor] = useControlled(value, defaultValue);\n const [savedColors, setSavedColors] = useControlled(\n savedColorsValue,\n defaultSavedColorsValue\n );\n const elementId = useUniqueId(id, \"hvdropdown\");\n const hasLabel = label != null;\n const hasDescription = description != null;\n\n const handleToggle: HvDropdownProps[\"onToggle\"] = (_, open) => {\n setIsOpen(open);\n };\n\n const handleSelect = (val: ColorState | { hex: string; source: string }) => {\n onChange?.(val.hex);\n onChangeComplete?.(val.hex);\n setColor(val.hex);\n };\n\n const handleOnChange = (\n val: ColorState | { hex: string; source: string }\n ) => {\n onChange?.(val.hex);\n setColor(val.hex);\n };\n\n const handleOnChangeComplete = (\n val: ColorState | { hex: string; source: string }\n ) => {\n onChangeComplete?.(val.hex);\n setColor(val.hex);\n };\n\n const handleAddColor = () => {\n // When no color is provided, react-color sets the picker to #000000.\n // This is the color that should be added in this case.\n const colorToAdd = color || \"#000000\";\n\n onSavedColorAdded?.(colorToAdd);\n setSavedColors([...savedColors, colorToAdd]);\n };\n\n const handleRemoveColor = (val: string, position: number) => {\n if (savedColors[position] === val) {\n const sColors = [...savedColors];\n sColors.splice(position, 1);\n onSavedColorRemoved?.(val);\n setSavedColors(sColors);\n }\n };\n\n const setFocusToContent = (containerRef: HTMLElement | null) => {\n const inputs = containerRef?.getElementsByTagName(\"input\");\n if (inputs && inputs.length > 0) {\n inputs[0].focus();\n }\n };\n\n return (\n <HvFormElement\n id={id}\n name={name}\n disabled={disabled}\n required={required}\n className={cx(classes.root, className)}\n >\n {(hasLabel || hasDescription) && (\n <div className={classes.labelContainer}>\n {hasLabel && (\n <HvLabel\n id={setId(elementId, \"label\")}\n label={label}\n className={classes.label}\n />\n )}\n\n {hasDescription && (\n <HvInfoMessage\n id={setId(elementId, \"description\")}\n className={classes.description}\n >\n {description}\n </HvInfoMessage>\n )}\n </div>\n )}\n <HvBaseDropdown\n variableWidth\n className={className}\n expanded={isOpen}\n onToggle={handleToggle}\n onContainerCreation={setFocusToContent}\n classes={{\n root: cx({ [classes.dropdownRootIconOnly]: iconOnly }),\n selection: cx(iconOnly && css({ padding: 0 })),\n }}\n adornment={\n iconOnly && color ? (\n <Checkbox\n className={classes.headerColorIconOnly}\n color={[color, \"transparent\"]}\n />\n ) : dropdownIcon === \"colorPicker\" ? (\n <ColorPicker className={classes.colorPickerIcon} />\n ) : undefined\n }\n placeholder={\n iconOnly ? undefined : color ? (\n <>\n <Checkbox\n className={classes.headerColorIcon}\n color={[color, \"transparent\"]}\n />\n <HvTypography\n className={classes.headerColorValue}\n variant={activeTheme?.colorPicker.inputValueVariant}\n >\n {color}\n </HvTypography>\n </>\n ) : (\n placeholder\n )\n }\n aria-label={ariaLabel}\n aria-labelledby={\n [label && setId(elementId, \"label\"), ariaLabelledBy]\n .join(\" \")\n .trim() || undefined\n }\n aria-describedby={\n [description && setId(elementId, \"description\"), ariaDescribedBy]\n .join(\" \")\n .trim() || undefined\n }\n >\n <HvPanel className={classes.panel}>\n <div className={classes.colorPicker}>\n {recommendedColorsPosition === \"top\" && (\n <PresetColors\n className={cx(\n (showCustomColors || showSavedColors) &&\n css({\n paddingBottom:\n activeTheme?.colorPicker.recommendedColorsBottomPadding,\n }),\n classes.recommendedColorsRoot\n )}\n colors={recommendedColors}\n onClick={handleSelect}\n title={showLabels ? labels?.recommendedColorsLabel : undefined}\n />\n )}\n {showCustomColors && (\n <Picker\n classes={{\n fields: cx({\n [classes.pickerFields]:\n recommendedColorsPosition === \"bottom\" || showSavedColors,\n }),\n }}\n title={showLabels ? labels?.customColorsLabel : undefined}\n color={color}\n onChange={handleOnChange}\n onChangeComplete={handleOnChangeComplete}\n />\n )}\n {showSavedColors && (\n <SavedColors\n colors={savedColors}\n onAddColor={handleAddColor}\n onClickColor={handleSelect}\n onRemoveColor={handleRemoveColor}\n deleteButtonArialLabel={deleteSavedColorButtonArialLabel}\n />\n )}\n {recommendedColorsPosition === \"bottom\" && (\n <PresetColors\n colors={recommendedColors}\n onClick={handleSelect}\n title={showLabels ? labels?.recommendedColorsLabel : undefined}\n />\n )}\n </div>\n </HvPanel>\n </HvBaseDropdown>\n </HvFormElement>\n );\n};\n"],"names":["DEFAULT_LABELS","recommendedColorsLabel","customColorsLabel","HvColorPicker","props","id","name","required","disabled","label","ariaLabel","ariaLabelledBy","description","ariaDescribedBy","className","classes","classesProp","value","onChange","onChangeComplete","defaultValue","expanded","defaultExpanded","recommendedColorsPosition","recommendedColors","showLabels","labels","labelsProp","dropdownIcon","placeholder","iconOnly","showSavedColors","showCustomColors","savedColorsValue","defaultSavedColorsValue","onSavedColorAdded","onSavedColorRemoved","deleteSavedColorButtonArialLabel","useDefaultProps","css","cx","useClasses","activeTheme","useTheme","useLabels","isOpen","setIsOpen","useControlled","Boolean","color","setColor","savedColors","setSavedColors","elementId","useUniqueId","hasLabel","hasDescription","handleToggle","_","open","handleSelect","val","hex","handleOnChange","handleOnChangeComplete","handleAddColor","colorToAdd","handleRemoveColor","position","sColors","splice","setFocusToContent","containerRef","inputs","getElementsByTagName","length","focus","HvFormElement","root","children","labelContainer","_jsx","HvLabel","setId","HvInfoMessage","HvBaseDropdown","variableWidth","onToggle","onContainerCreation","dropdownRootIconOnly","selection","padding","adornment","Checkbox","headerColorIconOnly","ColorPicker","colorPickerIcon","undefined","_Fragment","headerColorIcon","HvTypography","headerColorValue","variant","colorPicker","inputValueVariant","join","trim","HvPanel","panel","PresetColors","paddingBottom","recommendedColorsBottomPadding","recommendedColorsRoot","colors","onClick","title","Picker","fields","pickerFields","SavedColors","onAddColor","onClickColor","onRemoveColor","deleteButtonArialLabel"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgGA,MAAMA,iBAA+C;AAAA,EACnDC,wBAAwB;AAAA,EACxBC,mBAAmB;AACrB;AAMaC,MAAAA,gBAAgBA,CAACC,UAA8B;AACpD,QAAA;AAAA,IACJC;AAAAA,IACAC;AAAAA,IACAC,WAAW;AAAA,IACXC,WAAW;AAAA,IACXC;AAAAA,IACA,cAAcC;AAAAA,IACd,mBAAmBC;AAAAA,IACnBC;AAAAA,IACA,oBAAoBC;AAAAA,IACpBC;AAAAA,IACAC,SAASC;AAAAA,IACTC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,eAAe;AAAA,IACfC;AAAAA,IACAC,kBAAkB;AAAA,IAClBC,4BAA4B;AAAA,IAC5BC,oBAAoB,CAClB,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,SAAS;AAAA,IAEXC,aAAa;AAAA,IACbC,QAAQC;AAAAA,IACRC,eAAe;AAAA,IACfC,cAAc;AAAA,IACdC,WAAW;AAAA,IACXC,kBAAkB;AAAA,IAClBC,mBAAmB;AAAA,IACnBC;AAAAA,IACAC,0BAA0B,CAAE;AAAA,IAC5BC;AAAAA,IACAC;AAA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1F,aAAaC,iCAAQzB,yBAAyBgG;AAAAA,UAAAA,CACtD,GAEFjE,oBACCiD,2BAAAA,IAACmC,eAAM;AAAA,YACLrG,SAAS;AAAA,cACPsG,QAAQ7E,GAAG;AAAA,gBACT,CAACzB,QAAQuG,YAAY,GACnB/F,8BAA8B,YAAYQ;AAAAA,cAAAA,CAC7C;AAAA,YACH;AAAA,YACAoF,OAAO1F,aAAaC,iCAAQxB,oBAAoB+F;AAAAA,YAChDhD;AAAAA,YACA/B,UAAU6C;AAAAA,YACV5C,kBAAkB6C;AAAAA,UAAAA,CACnB,GAEFjC,mBACCkD,2BAAAA,IAACsC,yBAAW;AAAA,YACVN,QAAQ9D;AAAAA,YACRqE,YAAYvD;AAAAA,YACZwD,cAAc7D;AAAAA,YACd8D,eAAevD;AAAAA,YACfwD,wBAAwBtF;AAAAA,UACzB,CAAA,GAEFd,8BAA8B,2CAC5BsF,aAAAA,cAAY;AAAA,YACXI,QAAQzF;AAAAA,YACR0F,SAAStD;AAAAA,YACTuD,OAAO1F,aAAaC,iCAAQzB,yBAAyBgG;AAAAA,UAAAA,CACtD,CACF;AAAA,QAAA,CACE;AAAA,MAAA,CACE;AAAA,IAAA,CACK,CAAC;AAAA,EAAA,CACJ;AAEnB;;;"}
|
|
@@ -30,11 +30,7 @@ const {
|
|
|
30
30
|
textContainer: {
|
|
31
31
|
background: "transparent",
|
|
32
32
|
maxWidth: "510px",
|
|
33
|
-
overflow: "hidden"
|
|
34
|
-
"& a": {
|
|
35
|
-
color: uikitStyles.theme.colors.primary,
|
|
36
|
-
textDecoration: "none"
|
|
37
|
-
}
|
|
33
|
+
overflow: "hidden"
|
|
38
34
|
},
|
|
39
35
|
messageContainer: {},
|
|
40
36
|
actionContainer: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmptyState.styles.cjs","sources":["../../../../src/components/EmptyState/EmptyState.styles.tsx"],"sourcesContent":["import { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { createClasses } from \"@core/utils/classes\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvEmptyState\", {\n root: {\n width: \"100%\",\n height: \"100%\",\n display: \"flex\",\n justifyContent: \"center\",\n },\n container: { display: \"flex\", flexDirection: \"row\" },\n containerMessageOnly: {\n alignItems: \"center\",\n \"& $textContainer\": {\n marginLeft: 0,\n },\n },\n iconContainer: {},\n titleContainer: {\n marginTop: theme.emptyState.titleMarginTop,\n marginBottom: theme.space.sm,\n },\n textContainer: {\n background: \"transparent\",\n maxWidth: \"510px\",\n overflow: \"hidden\",\n
|
|
1
|
+
{"version":3,"file":"EmptyState.styles.cjs","sources":["../../../../src/components/EmptyState/EmptyState.styles.tsx"],"sourcesContent":["import { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { createClasses } from \"@core/utils/classes\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvEmptyState\", {\n root: {\n width: \"100%\",\n height: \"100%\",\n display: \"flex\",\n justifyContent: \"center\",\n },\n container: { display: \"flex\", flexDirection: \"row\" },\n containerMessageOnly: {\n alignItems: \"center\",\n \"& $textContainer\": {\n marginLeft: 0,\n },\n },\n iconContainer: {},\n titleContainer: {\n marginTop: theme.emptyState.titleMarginTop,\n marginBottom: theme.space.sm,\n },\n textContainer: {\n background: \"transparent\",\n maxWidth: \"510px\",\n overflow: \"hidden\",\n },\n messageContainer: {},\n actionContainer: { marginTop: theme.space.sm },\n});\n"],"names":["staticClasses","useClasses","createClasses","root","width","height","display","justifyContent","container","flexDirection","containerMessageOnly","alignItems","marginLeft","iconContainer","titleContainer","marginTop","theme","emptyState","titleMarginTop","marginBottom","space","sm","textContainer","background","maxWidth","overflow","messageContainer","actionContainer"],"mappings":";;;;AAIa,MAAA;AAAA,EAAEA;AAAAA,EAAeC;AAAW,IAAIC,QAAAA,cAAc,gBAAgB;AAAA,EACzEC,MAAM;AAAA,IACJC,OAAO;AAAA,IACPC,QAAQ;AAAA,IACRC,SAAS;AAAA,IACTC,gBAAgB;AAAA,EAClB;AAAA,EACAC,WAAW;AAAA,IAAEF,SAAS;AAAA,IAAQG,eAAe;AAAA,EAAM;AAAA,EACnDC,sBAAsB;AAAA,IACpBC,YAAY;AAAA,IACZ,oBAAoB;AAAA,MAClBC,YAAY;AAAA,IACd;AAAA,EACF;AAAA,EACAC,eAAe,CAAC;AAAA,EAChBC,gBAAgB;AAAA,IACdC,WAAWC,YAAAA,MAAMC,WAAWC;AAAAA,IAC5BC,cAAcH,YAAAA,MAAMI,MAAMC;AAAAA,EAC5B;AAAA,EACAC,eAAe;AAAA,IACbC,YAAY;AAAA,IACZC,UAAU;AAAA,IACVC,UAAU;AAAA,EACZ;AAAA,EACAC,kBAAkB,CAAC;AAAA,EACnBC,iBAAiB;AAAA,IAAEZ,WAAWC,YAAAA,MAAMI,MAAMC;AAAAA,EAAG;AAC/C,CAAC;;;"}
|
|
@@ -27,7 +27,6 @@ const HvBadge = (props) => {
|
|
|
27
27
|
children: text
|
|
28
28
|
});
|
|
29
29
|
return /* @__PURE__ */ jsxs("div", {
|
|
30
|
-
"aria-label": renderedCountOrLabel == null ? void 0 : renderedCountOrLabel.toString(),
|
|
31
30
|
className: cx(classes.root, className),
|
|
32
31
|
...others,
|
|
33
32
|
children: [Component, /* @__PURE__ */ jsx("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.js","sources":["../../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import {\n HvTypography,\n HvTypographyVariants,\n} from \"@core/components/Typography\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { staticClasses, useClasses } from \"./Badge.styles\";\n\nexport { staticClasses as badgeClasses };\n\nexport type HvBadgeClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvBadgeProps extends HvBaseProps {\n /**\n * Count is the number of unread notifications.\n * Note count and label are mutually exclusive.\n * count is ignored when label is specified at the same time.\n */\n count?: number;\n /**\n * True if count should be displayed.\n * Note showCount and label are mutually exclusive.\n * showCount is ignored when label is specified at the same time.\n */\n showCount?: boolean;\n /** The maximum number of unread notifications to be displayed */\n maxCount?: number;\n /**\n * Custom text to show in place of count.\n * Note showCount and label are mutually exclusive.\n * showCount is ignored when label is specified at the same time.\n */\n label?: string;\n /** Icon which the notification will be attached. */\n icon?: React.ReactNode;\n /** Text which the notification will be attached. */\n text?: string;\n /** Text variant. */\n textVariant?: HvTypographyVariants;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvBadgeClasses;\n}\n\n/**\n * The badge is a component used to notify the user that something has occurred, in the app context.\n */\nexport const HvBadge = (props: HvBadgeProps) => {\n const {\n classes: classesProp,\n className,\n showCount = false,\n count = 0,\n maxCount = 99,\n label = null,\n icon = null,\n text = null,\n textVariant = undefined,\n ...others\n } = useDefaultProps(\"HvBadge\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const renderedCount = count > maxCount ? `${maxCount}+` : count;\n // If label is specified and non-empty, render it.\n // If showCount is specified and count > 0, render the count.\n // Otherwise, render nothing on the badge.\n // (Note count=0 should not be rendered to avoid ghosty 0.)\n const renderedCountOrLabel =\n label || (showCount && count > 0 && renderedCount) || null;\n const Component =\n icon || (text && <HvTypography variant={textVariant}>{text}</HvTypography>);\n\n return (\n <div
|
|
1
|
+
{"version":3,"file":"Badge.js","sources":["../../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import {\n HvTypography,\n HvTypographyVariants,\n} from \"@core/components/Typography\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { staticClasses, useClasses } from \"./Badge.styles\";\n\nexport { staticClasses as badgeClasses };\n\nexport type HvBadgeClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvBadgeProps extends HvBaseProps {\n /**\n * Count is the number of unread notifications.\n * Note count and label are mutually exclusive.\n * count is ignored when label is specified at the same time.\n */\n count?: number;\n /**\n * True if count should be displayed.\n * Note showCount and label are mutually exclusive.\n * showCount is ignored when label is specified at the same time.\n */\n showCount?: boolean;\n /** The maximum number of unread notifications to be displayed */\n maxCount?: number;\n /**\n * Custom text to show in place of count.\n * Note showCount and label are mutually exclusive.\n * showCount is ignored when label is specified at the same time.\n */\n label?: string;\n /** Icon which the notification will be attached. */\n icon?: React.ReactNode;\n /** Text which the notification will be attached. */\n text?: string;\n /** Text variant. */\n textVariant?: HvTypographyVariants;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvBadgeClasses;\n}\n\n/**\n * The badge is a component used to notify the user that something has occurred, in the app context.\n */\nexport const HvBadge = (props: HvBadgeProps) => {\n const {\n classes: classesProp,\n className,\n showCount = false,\n count = 0,\n maxCount = 99,\n label = null,\n icon = null,\n text = null,\n textVariant = undefined,\n ...others\n } = useDefaultProps(\"HvBadge\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const renderedCount = count > maxCount ? `${maxCount}+` : count;\n // If label is specified and non-empty, render it.\n // If showCount is specified and count > 0, render the count.\n // Otherwise, render nothing on the badge.\n // (Note count=0 should not be rendered to avoid ghosty 0.)\n const renderedCountOrLabel =\n label || (showCount && count > 0 && renderedCount) || null;\n const Component =\n icon || (text && <HvTypography variant={textVariant}>{text}</HvTypography>);\n\n return (\n <div className={cx(classes.root, className)} {...others}>\n {Component}\n <div className={Component ? classes.badgeContainer : undefined}>\n <div\n className={cx(classes.badgePosition, {\n [classes.badge]: !!(count > 0 || renderedCountOrLabel),\n [classes.showCount]: !!(!label && renderedCountOrLabel),\n [classes.showLabel]: !!label,\n [classes.badgeIcon]: !!icon,\n [classes.badgeOneDigit]: String(renderedCountOrLabel).length === 1,\n })}\n >\n {renderedCountOrLabel}\n </div>\n </div>\n </div>\n );\n};\n"],"names":["HvBadge","props","classes","classesProp","className","showCount","count","maxCount","label","icon","text","textVariant","undefined","others","useDefaultProps","cx","useClasses","renderedCount","renderedCountOrLabel","Component","_jsx","HvTypography","variant","children","root","badgeContainer","badgePosition","badge","showLabel","badgeIcon","badgeOneDigit","String","length"],"mappings":";;;;;AAgDaA,MAAAA,UAAUA,CAACC,UAAwB;AACxC,QAAA;AAAA,IACJC,SAASC;AAAAA,IACTC;AAAAA,IACAC,YAAY;AAAA,IACZC,QAAQ;AAAA,IACRC,WAAW;AAAA,IACXC,QAAQ;AAAA,IACRC,OAAO;AAAA,IACPC,OAAO;AAAA,IACPC,cAAcC;AAAAA,IACd,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,WAAWb,KAAK;AAE9B,QAAA;AAAA,IAAEC;AAAAA,IAASa;AAAAA,EAAAA,IAAOC,WAAWb,WAAW;AAE9C,QAAMc,gBAAgBX,QAAQC,WAAY,GAAEA,cAAcD;AAK1D,QAAMY,uBACJV,SAAUH,aAAaC,QAAQ,KAAKW,iBAAkB;AACxD,QAAME,YACJV,QAASC,QAAQU,oBAACC,cAAY;AAAA,IAACC,SAASX;AAAAA,IAAYY,UAAEb;AAAAA,EAAAA,CAAmB;AAE3E,8BACE,OAAA;AAAA,IAAKN,WAAWW,GAAGb,QAAQsB,MAAMpB,SAAS;AAAA,IAAE,GAAKS;AAAAA,IAAMU,UAAA,CACpDJ,WACDC,oBAAA,OAAA;AAAA,MAAKhB,WAAWe,YAAYjB,QAAQuB,iBAAiBb;AAAAA,MAAUW,8BAC7D,OAAA;AAAA,QACEnB,WAAWW,GAAGb,QAAQwB,eAAe;AAAA,UACnC,CAACxB,QAAQyB,KAAK,GAAG,CAAC,EAAErB,QAAQ,KAAKY;AAAAA,UACjC,CAAChB,QAAQG,SAAS,GAAG,CAAC,EAAE,CAACG,SAASU;AAAAA,UAClC,CAAChB,QAAQ0B,SAAS,GAAG,CAAC,CAACpB;AAAAA,UACvB,CAACN,QAAQ2B,SAAS,GAAG,CAAC,CAACpB;AAAAA,UACvB,CAACP,QAAQ4B,aAAa,GAAGC,OAAOb,oBAAoB,EAAEc,WAAW;AAAA,QAAA,CAClE;AAAA,QAAET,UAEFL;AAAAA,MAAAA,CACE;AAAA,IAAA,CACF,CAAC;AAAA,EAAA,CACH;AAET;"}
|
|
@@ -36,6 +36,7 @@ const HvColorPicker = (props) => {
|
|
|
36
36
|
classes: classesProp,
|
|
37
37
|
value,
|
|
38
38
|
onChange,
|
|
39
|
+
onChangeComplete,
|
|
39
40
|
defaultValue = "",
|
|
40
41
|
expanded,
|
|
41
42
|
defaultExpanded = false,
|
|
@@ -74,6 +75,15 @@ const HvColorPicker = (props) => {
|
|
|
74
75
|
};
|
|
75
76
|
const handleSelect = (val) => {
|
|
76
77
|
onChange == null ? void 0 : onChange(val.hex);
|
|
78
|
+
onChangeComplete == null ? void 0 : onChangeComplete(val.hex);
|
|
79
|
+
setColor(val.hex);
|
|
80
|
+
};
|
|
81
|
+
const handleOnChange = (val) => {
|
|
82
|
+
onChange == null ? void 0 : onChange(val.hex);
|
|
83
|
+
setColor(val.hex);
|
|
84
|
+
};
|
|
85
|
+
const handleOnChangeComplete = (val) => {
|
|
86
|
+
onChangeComplete == null ? void 0 : onChangeComplete(val.hex);
|
|
77
87
|
setColor(val.hex);
|
|
78
88
|
};
|
|
79
89
|
const handleAddColor = () => {
|
|
@@ -164,7 +174,8 @@ const HvColorPicker = (props) => {
|
|
|
164
174
|
},
|
|
165
175
|
title: showLabels ? labels == null ? void 0 : labels.customColorsLabel : void 0,
|
|
166
176
|
color,
|
|
167
|
-
onChange:
|
|
177
|
+
onChange: handleOnChange,
|
|
178
|
+
onChangeComplete: handleOnChangeComplete
|
|
168
179
|
}), showSavedColors && /* @__PURE__ */ jsx(SavedColors, {
|
|
169
180
|
colors: savedColors,
|
|
170
181
|
onAddColor: handleAddColor,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPicker.js","sources":["../../../../src/components/ColorPicker/ColorPicker.tsx"],"sourcesContent":["import { Checkbox, ColorPicker } from \"@hitachivantara/uikit-react-icons\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\n\nimport { ColorState } from \"react-color\";\n\nimport { useControlled } from \"@core/hooks/useControlled\";\nimport { useUniqueId } from \"@core/hooks/useUniqueId\";\nimport { useLabels } from \"@core/hooks/useLabels\";\nimport { useTheme } from \"@core/hooks/useTheme\";\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { setId } from \"@core/utils/setId\";\nimport { HvTypography } from \"@core/components/Typography\";\nimport { HvPanel } from \"@core/components/Panel\";\nimport { HvFormElement, HvInfoMessage, HvLabel } from \"@core/components/Forms\";\nimport { HvBaseDropdown } from \"@core/components/BaseDropdown\";\nimport { HvDropdownProps } from \"@core/components/Dropdown\";\n\nimport { Picker } from \"./Picker\";\nimport { staticClasses, useClasses } from \"./ColorPicker.styles\";\nimport { PresetColors } from \"./PresetColors\";\nimport { SavedColors } from \"./SavedColors\";\n\nexport { staticClasses as colorPickerClasses };\n\nexport type HvColorPickerClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvColorPickerProps {\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n \"aria-describedby\"?: string;\n /** Class names to be applied. */\n className?: string;\n /** Id to be applied to the form element root node. */\n id?: string;\n /** The form element name. */\n name?: string;\n /**\n * The label of the form element.\n *\n * The form element must be labeled for accessibility reasons.\n * If not provided, an aria-label or aria-labelledby must be provided instead.\n */\n label?: React.ReactNode;\n /** Provide additional descriptive text for the form element. */\n description?: React.ReactNode;\n /** Indicates that user input is required on the form element. */\n required?: boolean;\n /** The value color, in HEX format. */\n value?: string;\n /** The default value color, in HEX format. */\n defaultValue?: string;\n /** If `true` the dropdown is disabled unable to be interacted, if `false` it is enabled. */\n disabled?: boolean;\n /** If `true` the dropdown starts opened if `false` it starts closed. */\n expanded?: boolean;\n /** When uncontrolled, defines the initial expanded state. */\n defaultExpanded?: boolean;\n /** A function to be executed whenever the color changes. */\n onChange?: (color: string) => void;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvColorPickerClasses;\n /** The placeholder value when nothing is selected. */\n placeholder?: string;\n /** Recommended colors. The colors are HEX values. */\n recommendedColors?: string[];\n /** Recommended colors position. */\n recommendedColorsPosition?: \"top\" | \"bottom\";\n /** If `true`, the labels are shown. If `false`, they are not shown. */\n showLabels?: boolean;\n /** An object containing all the labels. */\n labels?: {\n recommendedColorsLabel?: string;\n customColorsLabel?: string;\n };\n /** Icon type for the input's end adornment. */\n dropdownIcon?: \"arrow\" | \"colorPicker\";\n /** If `true`, the input only shows an icon. If `false`, the input shows text and icons. */\n iconOnly?: boolean;\n /** If `true`, the saved colors area is shown. If `false`, it is not shown. */\n showSavedColors?: boolean;\n /** If `true`, the custom colors area is shown. If `false`, it is not shown. */\n showCustomColors?: boolean;\n /** The saved colors. The colors are HEX values. */\n savedColorsValue?: string[];\n /** The default saved colors. The colors are HEX values. */\n defaultSavedColorsValue?: string[];\n /** Callback fired when a new saved color is added. */\n onSavedColorAdded?: (color?: string) => void;\n /** Callback fired when a new saved color is removed. */\n onSavedColorRemoved?: (color?: string) => void;\n /** Aria label to apply to delete saved color button. */\n deleteSavedColorButtonArialLabel?: string;\n}\n\nconst DEFAULT_LABELS: HvColorPickerProps[\"labels\"] = {\n recommendedColorsLabel: \"Recommended colors:\",\n customColorsLabel: \"Custom colors:\",\n};\n\n/**\n * A color picker component which allows the user to select a color from a list of pre-defined colors or freely select one color via the Hue and Saturation.\n * It receives a color string in HEX format and outputs an HEX formatted color.\n */\nexport const HvColorPicker = (props: HvColorPickerProps) => {\n const {\n id,\n name,\n required = false,\n disabled = false,\n label,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n description,\n \"aria-describedby\": ariaDescribedBy,\n className,\n classes: classesProp,\n value,\n onChange,\n defaultValue = \"\",\n expanded,\n defaultExpanded = false,\n recommendedColorsPosition = \"top\",\n recommendedColors = [\n \"#95AFE8\",\n \"#E89E5D\",\n \"#83B8A6\",\n \"#70759C\",\n \"#C57E7E\",\n \"#FADA95\",\n \"#ADBFE8\",\n \"#E3B386\",\n \"#9AC6B7\",\n \"#8B90AF\",\n \"#CF9797\",\n \"#FAE1AA\",\n ],\n showLabels = true,\n labels: labelsProp,\n dropdownIcon = \"colorPicker\",\n placeholder = \"Select color...\",\n iconOnly = false,\n showSavedColors = true,\n showCustomColors = true,\n savedColorsValue,\n defaultSavedColorsValue = [],\n onSavedColorAdded,\n onSavedColorRemoved,\n deleteSavedColorButtonArialLabel = \"Delete saved color\",\n } = useDefaultProps(\"HvColorPicker\", props);\n\n const { classes, css, cx } = useClasses(classesProp);\n const { activeTheme } = useTheme();\n\n const labels = useLabels(DEFAULT_LABELS, labelsProp);\n\n const [isOpen, setIsOpen] = useControlled(expanded, Boolean(defaultExpanded));\n const [color, setColor] = useControlled(value, defaultValue);\n const [savedColors, setSavedColors] = useControlled(\n savedColorsValue,\n defaultSavedColorsValue\n );\n const elementId = useUniqueId(id, \"hvdropdown\");\n const hasLabel = label != null;\n const hasDescription = description != null;\n\n const handleToggle: HvDropdownProps[\"onToggle\"] = (_, open) => {\n setIsOpen(open);\n };\n\n const handleSelect = (val: ColorState | { hex: string; source: string }) => {\n onChange?.(val.hex);\n setColor(val.hex);\n };\n\n const handleAddColor = () => {\n // When no color is provided, react-color sets the picker to #000000.\n // This is the color that should be added in this case.\n const colorToAdd = color || \"#000000\";\n\n onSavedColorAdded?.(colorToAdd);\n setSavedColors([...savedColors, colorToAdd]);\n };\n\n const handleRemoveColor = (val: string, position: number) => {\n if (savedColors[position] === val) {\n const sColors = [...savedColors];\n sColors.splice(position, 1);\n onSavedColorRemoved?.(val);\n setSavedColors(sColors);\n }\n };\n\n const setFocusToContent = (containerRef: HTMLElement | null) => {\n const inputs = containerRef?.getElementsByTagName(\"input\");\n if (inputs && inputs.length > 0) {\n inputs[0].focus();\n }\n };\n\n return (\n <HvFormElement\n id={id}\n name={name}\n disabled={disabled}\n required={required}\n className={cx(classes.root, className)}\n >\n {(hasLabel || hasDescription) && (\n <div className={classes.labelContainer}>\n {hasLabel && (\n <HvLabel\n id={setId(elementId, \"label\")}\n label={label}\n className={classes.label}\n />\n )}\n\n {hasDescription && (\n <HvInfoMessage\n id={setId(elementId, \"description\")}\n className={classes.description}\n >\n {description}\n </HvInfoMessage>\n )}\n </div>\n )}\n <HvBaseDropdown\n variableWidth\n className={className}\n expanded={isOpen}\n onToggle={handleToggle}\n onContainerCreation={setFocusToContent}\n classes={{\n root: cx({ [classes.dropdownRootIconOnly]: iconOnly }),\n selection: cx(iconOnly && css({ padding: 0 })),\n }}\n adornment={\n iconOnly && color ? (\n <Checkbox\n className={classes.headerColorIconOnly}\n color={[color, \"transparent\"]}\n />\n ) : dropdownIcon === \"colorPicker\" ? (\n <ColorPicker className={classes.colorPickerIcon} />\n ) : undefined\n }\n placeholder={\n iconOnly ? undefined : color ? (\n <>\n <Checkbox\n className={classes.headerColorIcon}\n color={[color, \"transparent\"]}\n />\n <HvTypography\n className={classes.headerColorValue}\n variant={activeTheme?.colorPicker.inputValueVariant}\n >\n {color}\n </HvTypography>\n </>\n ) : (\n placeholder\n )\n }\n aria-label={ariaLabel}\n aria-labelledby={\n [label && setId(elementId, \"label\"), ariaLabelledBy]\n .join(\" \")\n .trim() || undefined\n }\n aria-describedby={\n [description && setId(elementId, \"description\"), ariaDescribedBy]\n .join(\" \")\n .trim() || undefined\n }\n >\n <HvPanel className={classes.panel}>\n <div className={classes.colorPicker}>\n {recommendedColorsPosition === \"top\" && (\n <PresetColors\n className={cx(\n (showCustomColors || showSavedColors) &&\n css({\n paddingBottom:\n activeTheme?.colorPicker.recommendedColorsBottomPadding,\n }),\n classes.recommendedColorsRoot\n )}\n colors={recommendedColors}\n onClick={handleSelect}\n title={showLabels ? labels?.recommendedColorsLabel : undefined}\n />\n )}\n {showCustomColors && (\n <Picker\n classes={{\n fields: cx({\n [classes.pickerFields]:\n recommendedColorsPosition === \"bottom\" || showSavedColors,\n }),\n }}\n title={showLabels ? labels?.customColorsLabel : undefined}\n color={color}\n onChange={handleSelect}\n />\n )}\n {showSavedColors && (\n <SavedColors\n colors={savedColors}\n onAddColor={handleAddColor}\n onClickColor={handleSelect}\n onRemoveColor={handleRemoveColor}\n deleteButtonArialLabel={deleteSavedColorButtonArialLabel}\n />\n )}\n {recommendedColorsPosition === \"bottom\" && (\n <PresetColors\n colors={recommendedColors}\n onClick={handleSelect}\n title={showLabels ? labels?.recommendedColorsLabel : undefined}\n />\n )}\n </div>\n </HvPanel>\n </HvBaseDropdown>\n </HvFormElement>\n );\n};\n"],"names":["DEFAULT_LABELS","recommendedColorsLabel","customColorsLabel","HvColorPicker","props","id","name","required","disabled","label","ariaLabel","ariaLabelledBy","description","ariaDescribedBy","className","classes","classesProp","value","onChange","defaultValue","expanded","defaultExpanded","recommendedColorsPosition","recommendedColors","showLabels","labels","labelsProp","dropdownIcon","placeholder","iconOnly","showSavedColors","showCustomColors","savedColorsValue","defaultSavedColorsValue","onSavedColorAdded","onSavedColorRemoved","deleteSavedColorButtonArialLabel","useDefaultProps","css","cx","useClasses","activeTheme","useTheme","useLabels","isOpen","setIsOpen","useControlled","Boolean","color","setColor","savedColors","setSavedColors","elementId","useUniqueId","hasLabel","hasDescription","handleToggle","_","open","handleSelect","val","hex","handleAddColor","colorToAdd","handleRemoveColor","position","sColors","splice","setFocusToContent","containerRef","inputs","getElementsByTagName","length","focus","HvFormElement","root","children","labelContainer","_jsx","HvLabel","setId","HvInfoMessage","HvBaseDropdown","variableWidth","onToggle","onContainerCreation","dropdownRootIconOnly","selection","padding","adornment","Checkbox","headerColorIconOnly","ColorPicker","colorPickerIcon","undefined","_Fragment","headerColorIcon","HvTypography","headerColorValue","variant","colorPicker","inputValueVariant","join","trim","HvPanel","panel","PresetColors","paddingBottom","recommendedColorsBottomPadding","recommendedColorsRoot","colors","onClick","title","Picker","fields","pickerFields","SavedColors","onAddColor","onClickColor","onRemoveColor","deleteButtonArialLabel"],"mappings":";;;;;;;;;;;;;;;;;;;AA8FA,MAAMA,iBAA+C;AAAA,EACnDC,wBAAwB;AAAA,EACxBC,mBAAmB;AAC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F;AAAAA,UAAYxB,WACjCtD,8BAA8B,6BAC5BoF,cAAY;AAAA,YACX5F,WAAWyB,IACRR,oBAAoBD,oBACnBQ,IAAI;AAAA,cACFqE,eACElE,2CAAa2D,YAAYQ;AAAAA,YAAAA,CAC5B,GACH7F,QAAQ8F,qBACV;AAAA,YACAC,QAAQvF;AAAAA,YACRwF,SAASpD;AAAAA,YACTqD,OAAOxF,aAAaC,iCAAQxB,yBAAyB6F;AAAAA,UAAAA,CACtD,GAEF/D,oBACC+C,oBAACmC,QAAM;AAAA,YACLlG,SAAS;AAAA,cACPmG,QAAQ3E,GAAG;AAAA,gBACT,CAACxB,QAAQoG,YAAY,GACnB7F,8BAA8B,YAAYQ;AAAAA,cAAAA,CAC7C;AAAA,YACH;AAAA,YACAkF,OAAOxF,aAAaC,iCAAQvB,oBAAoB4F;AAAAA,YAChD9C;AAAAA,YACA9B,UAAUyC;AAAAA,UAAAA,CACX,GAEF7B,mBACCgD,oBAACsC,aAAW;AAAA,YACVN,QAAQ5D;AAAAA,YACRmE,YAAYvD;AAAAA,YACZwD,cAAc3D;AAAAA,YACd4D,eAAevD;AAAAA,YACfwD,wBAAwBpF;AAAAA,UACzB,CAAA,GAEFd,8BAA8B,gCAC5BoF,cAAY;AAAA,YACXI,QAAQvF;AAAAA,YACRwF,SAASpD;AAAAA,YACTqD,OAAOxF,aAAaC,iCAAQxB,yBAAyB6F;AAAAA,UAAAA,CACtD,CACF;AAAA,QAAA,CACE;AAAA,MAAA,CACE;AAAA,IAAA,CACK,CAAC;AAAA,EAAA,CACJ;AAEnB;"}
|
|
1
|
+
{"version":3,"file":"ColorPicker.js","sources":["../../../../src/components/ColorPicker/ColorPicker.tsx"],"sourcesContent":["import { Checkbox, ColorPicker } from \"@hitachivantara/uikit-react-icons\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\n\nimport { ColorState } from \"react-color\";\n\nimport { useControlled } from \"@core/hooks/useControlled\";\nimport { useUniqueId } from \"@core/hooks/useUniqueId\";\nimport { useLabels } from \"@core/hooks/useLabels\";\nimport { useTheme } from \"@core/hooks/useTheme\";\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { setId } from \"@core/utils/setId\";\nimport { HvTypography } from \"@core/components/Typography\";\nimport { HvPanel } from \"@core/components/Panel\";\nimport { HvFormElement, HvInfoMessage, HvLabel } from \"@core/components/Forms\";\nimport { HvBaseDropdown } from \"@core/components/BaseDropdown\";\nimport { HvDropdownProps } from \"@core/components/Dropdown\";\n\nimport { Picker } from \"./Picker\";\nimport { staticClasses, useClasses } from \"./ColorPicker.styles\";\nimport { PresetColors } from \"./PresetColors\";\nimport { SavedColors } from \"./SavedColors\";\n\nexport { staticClasses as colorPickerClasses };\n\nexport type HvColorPickerClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvColorPickerProps {\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n \"aria-describedby\"?: string;\n /** Class names to be applied. */\n className?: string;\n /** Id to be applied to the form element root node. */\n id?: string;\n /** The form element name. */\n name?: string;\n /**\n * The label of the form element.\n *\n * The form element must be labeled for accessibility reasons.\n * If not provided, an aria-label or aria-labelledby must be provided instead.\n */\n label?: React.ReactNode;\n /** Provide additional descriptive text for the form element. */\n description?: React.ReactNode;\n /** Indicates that user input is required on the form element. */\n required?: boolean;\n /** The value color, in HEX format. */\n value?: string;\n /** The default value color, in HEX format. */\n defaultValue?: string;\n /** If `true` the dropdown is disabled unable to be interacted, if `false` it is enabled. */\n disabled?: boolean;\n /** If `true` the dropdown starts opened if `false` it starts closed. */\n expanded?: boolean;\n /** When uncontrolled, defines the initial expanded state. */\n defaultExpanded?: boolean;\n /** A function to be executed whenever the color changes. */\n onChange?: (color: string) => void;\n /** A function to be executed whenever the color change is complete. */\n onChangeComplete?: (color: string) => void;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvColorPickerClasses;\n /** The placeholder value when nothing is selected. */\n placeholder?: string;\n /** Recommended colors. The colors are HEX values. */\n recommendedColors?: string[];\n /** Recommended colors position. */\n recommendedColorsPosition?: \"top\" | \"bottom\";\n /** If `true`, the labels are shown. If `false`, they are not shown. */\n showLabels?: boolean;\n /** An object containing all the labels. */\n labels?: {\n recommendedColorsLabel?: string;\n customColorsLabel?: string;\n };\n /** Icon type for the input's end adornment. */\n dropdownIcon?: \"arrow\" | \"colorPicker\";\n /** If `true`, the input only shows an icon. If `false`, the input shows text and icons. */\n iconOnly?: boolean;\n /** If `true`, the saved colors area is shown. If `false`, it is not shown. */\n showSavedColors?: boolean;\n /** If `true`, the custom colors area is shown. If `false`, it is not shown. */\n showCustomColors?: boolean;\n /** The saved colors. The colors are HEX values. */\n savedColorsValue?: string[];\n /** The default saved colors. The colors are HEX values. */\n defaultSavedColorsValue?: string[];\n /** Callback fired when a new saved color is added. */\n onSavedColorAdded?: (color?: string) => void;\n /** Callback fired when a new saved color is removed. */\n onSavedColorRemoved?: (color?: string) => void;\n /** Aria label to apply to delete saved color button. */\n deleteSavedColorButtonArialLabel?: string;\n}\n\nconst DEFAULT_LABELS: HvColorPickerProps[\"labels\"] = {\n recommendedColorsLabel: \"Recommended colors:\",\n customColorsLabel: \"Custom colors:\",\n};\n\n/**\n * A color picker component which allows the user to select a color from a list of pre-defined colors or freely select one color via the Hue and Saturation.\n * It receives a color string in HEX format and outputs an HEX formatted color.\n */\nexport const HvColorPicker = (props: HvColorPickerProps) => {\n const {\n id,\n name,\n required = false,\n disabled = false,\n label,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n description,\n \"aria-describedby\": ariaDescribedBy,\n className,\n classes: classesProp,\n value,\n onChange,\n onChangeComplete,\n defaultValue = \"\",\n expanded,\n defaultExpanded = false,\n recommendedColorsPosition = \"top\",\n recommendedColors = [\n \"#95AFE8\",\n \"#E89E5D\",\n \"#83B8A6\",\n \"#70759C\",\n \"#C57E7E\",\n \"#FADA95\",\n \"#ADBFE8\",\n \"#E3B386\",\n \"#9AC6B7\",\n \"#8B90AF\",\n \"#CF9797\",\n \"#FAE1AA\",\n ],\n showLabels = true,\n labels: labelsProp,\n dropdownIcon = \"colorPicker\",\n placeholder = \"Select color...\",\n iconOnly = false,\n showSavedColors = true,\n showCustomColors = true,\n savedColorsValue,\n defaultSavedColorsValue = [],\n onSavedColorAdded,\n onSavedColorRemoved,\n deleteSavedColorButtonArialLabel = \"Delete saved color\",\n } = useDefaultProps(\"HvColorPicker\", props);\n\n const { classes, css, cx } = useClasses(classesProp);\n const { activeTheme } = useTheme();\n\n const labels = useLabels(DEFAULT_LABELS, labelsProp);\n\n const [isOpen, setIsOpen] = useControlled(expanded, Boolean(defaultExpanded));\n const [color, setColor] = useControlled(value, defaultValue);\n const [savedColors, setSavedColors] = useControlled(\n savedColorsValue,\n defaultSavedColorsValue\n );\n const elementId = useUniqueId(id, \"hvdropdown\");\n const hasLabel = label != null;\n const hasDescription = description != null;\n\n const handleToggle: HvDropdownProps[\"onToggle\"] = (_, open) => {\n setIsOpen(open);\n };\n\n const handleSelect = (val: ColorState | { hex: string; source: string }) => {\n onChange?.(val.hex);\n onChangeComplete?.(val.hex);\n setColor(val.hex);\n };\n\n const handleOnChange = (\n val: ColorState | { hex: string; source: string }\n ) => {\n onChange?.(val.hex);\n setColor(val.hex);\n };\n\n const handleOnChangeComplete = (\n val: ColorState | { hex: string; source: string }\n ) => {\n onChangeComplete?.(val.hex);\n setColor(val.hex);\n };\n\n const handleAddColor = () => {\n // When no color is provided, react-color sets the picker to #000000.\n // This is the color that should be added in this case.\n const colorToAdd = color || \"#000000\";\n\n onSavedColorAdded?.(colorToAdd);\n setSavedColors([...savedColors, colorToAdd]);\n };\n\n const handleRemoveColor = (val: string, position: number) => {\n if (savedColors[position] === val) {\n const sColors = [...savedColors];\n sColors.splice(position, 1);\n onSavedColorRemoved?.(val);\n setSavedColors(sColors);\n }\n };\n\n const setFocusToContent = (containerRef: HTMLElement | null) => {\n const inputs = containerRef?.getElementsByTagName(\"input\");\n if (inputs && inputs.length > 0) {\n inputs[0].focus();\n }\n };\n\n return (\n <HvFormElement\n id={id}\n name={name}\n disabled={disabled}\n required={required}\n className={cx(classes.root, className)}\n >\n {(hasLabel || hasDescription) && (\n <div className={classes.labelContainer}>\n {hasLabel && (\n <HvLabel\n id={setId(elementId, \"label\")}\n label={label}\n className={classes.label}\n />\n )}\n\n {hasDescription && (\n <HvInfoMessage\n id={setId(elementId, \"description\")}\n className={classes.description}\n >\n {description}\n </HvInfoMessage>\n )}\n </div>\n )}\n <HvBaseDropdown\n variableWidth\n className={className}\n expanded={isOpen}\n onToggle={handleToggle}\n onContainerCreation={setFocusToContent}\n classes={{\n root: cx({ [classes.dropdownRootIconOnly]: iconOnly }),\n selection: cx(iconOnly && css({ padding: 0 })),\n }}\n adornment={\n iconOnly && color ? (\n <Checkbox\n className={classes.headerColorIconOnly}\n color={[color, \"transparent\"]}\n />\n ) : dropdownIcon === \"colorPicker\" ? (\n <ColorPicker className={classes.colorPickerIcon} />\n ) : undefined\n }\n placeholder={\n iconOnly ? undefined : color ? (\n <>\n <Checkbox\n className={classes.headerColorIcon}\n color={[color, \"transparent\"]}\n />\n <HvTypography\n className={classes.headerColorValue}\n variant={activeTheme?.colorPicker.inputValueVariant}\n >\n {color}\n </HvTypography>\n </>\n ) : (\n placeholder\n )\n }\n aria-label={ariaLabel}\n aria-labelledby={\n [label && setId(elementId, \"label\"), ariaLabelledBy]\n .join(\" \")\n .trim() || undefined\n }\n aria-describedby={\n [description && setId(elementId, \"description\"), ariaDescribedBy]\n .join(\" \")\n .trim() || undefined\n }\n >\n <HvPanel className={classes.panel}>\n <div className={classes.colorPicker}>\n {recommendedColorsPosition === \"top\" && (\n <PresetColors\n className={cx(\n (showCustomColors || showSavedColors) &&\n css({\n paddingBottom:\n activeTheme?.colorPicker.recommendedColorsBottomPadding,\n }),\n classes.recommendedColorsRoot\n )}\n colors={recommendedColors}\n onClick={handleSelect}\n title={showLabels ? labels?.recommendedColorsLabel : undefined}\n />\n )}\n {showCustomColors && (\n <Picker\n classes={{\n fields: cx({\n [classes.pickerFields]:\n recommendedColorsPosition === \"bottom\" || showSavedColors,\n }),\n }}\n title={showLabels ? labels?.customColorsLabel : undefined}\n color={color}\n onChange={handleOnChange}\n onChangeComplete={handleOnChangeComplete}\n />\n )}\n {showSavedColors && (\n <SavedColors\n colors={savedColors}\n onAddColor={handleAddColor}\n onClickColor={handleSelect}\n onRemoveColor={handleRemoveColor}\n deleteButtonArialLabel={deleteSavedColorButtonArialLabel}\n />\n )}\n {recommendedColorsPosition === \"bottom\" && (\n <PresetColors\n colors={recommendedColors}\n onClick={handleSelect}\n title={showLabels ? labels?.recommendedColorsLabel : undefined}\n />\n )}\n </div>\n </HvPanel>\n </HvBaseDropdown>\n </HvFormElement>\n );\n};\n"],"names":["DEFAULT_LABELS","recommendedColorsLabel","customColorsLabel","HvColorPicker","props","id","name","required","disabled","label","ariaLabel","ariaLabelledBy","description","ariaDescribedBy","className","classes","classesProp","value","onChange","onChangeComplete","defaultValue","expanded","defaultExpanded","recommendedColorsPosition","recommendedColors","showLabels","labels","labelsProp","dropdownIcon","placeholder","iconOnly","showSavedColors","showCustomColors","savedColorsValue","defaultSavedColorsValue","onSavedColorAdded","onSavedColorRemoved","deleteSavedColorButtonArialLabel","useDefaultProps","css","cx","useClasses","activeTheme","useTheme","useLabels","isOpen","setIsOpen","useControlled","Boolean","color","setColor","savedColors","setSavedColors","elementId","useUniqueId","hasLabel","hasDescription","handleToggle","_","open","handleSelect","val","hex","handleOnChange","handleOnChangeComplete","handleAddColor","colorToAdd","handleRemoveColor","position","sColors","splice","setFocusToContent","containerRef","inputs","getElementsByTagName","length","focus","HvFormElement","root","children","labelContainer","_jsx","HvLabel","setId","HvInfoMessage","HvBaseDropdown","variableWidth","onToggle","onContainerCreation","dropdownRootIconOnly","selection","padding","adornment","Checkbox","headerColorIconOnly","ColorPicker","colorPickerIcon","undefined","_Fragment","headerColorIcon","HvTypography","headerColorValue","variant","colorPicker","inputValueVariant","join","trim","HvPanel","panel","PresetColors","paddingBottom","recommendedColorsBottomPadding","recommendedColorsRoot","colors","onClick","title","Picker","fields","pickerFields","SavedColors","onAddColor","onClickColor","onRemoveColor","deleteButtonArialLabel"],"mappings":";;;;;;;;;;;;;;;;;;;AAgGA,MAAMA,iBAA+C;AAAA,EACnDC,wBAAwB;AAAA,EACxBC,mBAAmB;AACrB;AAMaC,MAAAA,gBAAgBA,CAACC,UAA8B;AACpD,QAAA;AAAA,IACJC;AAAAA,IACAC;AAAAA,IACAC,WAAW;AAAA,IACXC,WAAW;AAAA,IACXC;AAAAA,IACA,cAAcC;AAAAA,IACd,mBAAmBC;AAAAA,IACnBC;AAAAA,IACA,oBAAoBC;AAAAA,IACpBC;AAAAA,IACAC,SAASC;AAAAA,IACTC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,eAAe;AAAA,IACfC;AAAAA,IACAC,kBAAkB;AAAA,IAClBC,4BAA4B;AAAA,IAC5BC,oBAAoB,CAClB,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,SAAS;AAAA,IAEXC,aAAa;AAAA,IACbC,QAAQC;AAAAA,IACRC,eAAe;AAAA,IACfC,cAAc;AAAA,IACdC,WAAW;AAAA,IACXC,kBAAkB;AAAA,IAClBC,mBAAmB;AAAA,IACnBC;AAAAA,IACAC,0BAA0B,CAAE;AAAA,IAC5BC;AAAAA,IACAC;AAAAA,IACAC,mCAAmC;AAAA,EAAA,IACjCC,gBAAgB,iBAAiBlC,KAAK;AAEpC,QAAA;AAAA,IAAEW;AAAAA,IAASwB;AAAAA,IAAKC;AAAAA,EAAAA,IAAOC,WAAWzB,WAAW;AAC7C,QAAA;AAAA,IAAE0B;AAAAA,MAAgBC,SAAS;AAE3BjB,QAAAA,SAASkB,UAAU5C,gBAAgB2B,UAAU;AAE7C,QAAA,CAACkB,QAAQC,SAAS,IAAIC,cAAc1B,UAAU2B,QAAQ1B,eAAe,CAAC;AAC5E,QAAM,CAAC2B,OAAOC,QAAQ,IAAI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AA8B,gCAC5BsF,cAAY;AAAA,YACXI,QAAQzF;AAAAA,YACR0F,SAAStD;AAAAA,YACTuD,OAAO1F,aAAaC,iCAAQzB,yBAAyBgG;AAAAA,UAAAA,CACtD,CACF;AAAA,QAAA,CACE;AAAA,MAAA,CACE;AAAA,IAAA,CACK,CAAC;AAAA,EAAA,CACJ;AAEnB;"}
|
|
@@ -28,11 +28,7 @@ const {
|
|
|
28
28
|
textContainer: {
|
|
29
29
|
background: "transparent",
|
|
30
30
|
maxWidth: "510px",
|
|
31
|
-
overflow: "hidden"
|
|
32
|
-
"& a": {
|
|
33
|
-
color: theme.colors.primary,
|
|
34
|
-
textDecoration: "none"
|
|
35
|
-
}
|
|
31
|
+
overflow: "hidden"
|
|
36
32
|
},
|
|
37
33
|
messageContainer: {},
|
|
38
34
|
actionContainer: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmptyState.styles.js","sources":["../../../../src/components/EmptyState/EmptyState.styles.tsx"],"sourcesContent":["import { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { createClasses } from \"@core/utils/classes\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvEmptyState\", {\n root: {\n width: \"100%\",\n height: \"100%\",\n display: \"flex\",\n justifyContent: \"center\",\n },\n container: { display: \"flex\", flexDirection: \"row\" },\n containerMessageOnly: {\n alignItems: \"center\",\n \"& $textContainer\": {\n marginLeft: 0,\n },\n },\n iconContainer: {},\n titleContainer: {\n marginTop: theme.emptyState.titleMarginTop,\n marginBottom: theme.space.sm,\n },\n textContainer: {\n background: \"transparent\",\n maxWidth: \"510px\",\n overflow: \"hidden\",\n
|
|
1
|
+
{"version":3,"file":"EmptyState.styles.js","sources":["../../../../src/components/EmptyState/EmptyState.styles.tsx"],"sourcesContent":["import { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { createClasses } from \"@core/utils/classes\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvEmptyState\", {\n root: {\n width: \"100%\",\n height: \"100%\",\n display: \"flex\",\n justifyContent: \"center\",\n },\n container: { display: \"flex\", flexDirection: \"row\" },\n containerMessageOnly: {\n alignItems: \"center\",\n \"& $textContainer\": {\n marginLeft: 0,\n },\n },\n iconContainer: {},\n titleContainer: {\n marginTop: theme.emptyState.titleMarginTop,\n marginBottom: theme.space.sm,\n },\n textContainer: {\n background: \"transparent\",\n maxWidth: \"510px\",\n overflow: \"hidden\",\n },\n messageContainer: {},\n actionContainer: { marginTop: theme.space.sm },\n});\n"],"names":["staticClasses","useClasses","createClasses","root","width","height","display","justifyContent","container","flexDirection","containerMessageOnly","alignItems","marginLeft","iconContainer","titleContainer","marginTop","theme","emptyState","titleMarginTop","marginBottom","space","sm","textContainer","background","maxWidth","overflow","messageContainer","actionContainer"],"mappings":";;AAIa,MAAA;AAAA,EAAEA;AAAAA,EAAeC;AAAW,IAAIC,cAAc,gBAAgB;AAAA,EACzEC,MAAM;AAAA,IACJC,OAAO;AAAA,IACPC,QAAQ;AAAA,IACRC,SAAS;AAAA,IACTC,gBAAgB;AAAA,EAClB;AAAA,EACAC,WAAW;AAAA,IAAEF,SAAS;AAAA,IAAQG,eAAe;AAAA,EAAM;AAAA,EACnDC,sBAAsB;AAAA,IACpBC,YAAY;AAAA,IACZ,oBAAoB;AAAA,MAClBC,YAAY;AAAA,IACd;AAAA,EACF;AAAA,EACAC,eAAe,CAAC;AAAA,EAChBC,gBAAgB;AAAA,IACdC,WAAWC,MAAMC,WAAWC;AAAAA,IAC5BC,cAAcH,MAAMI,MAAMC;AAAAA,EAC5B;AAAA,EACAC,eAAe;AAAA,IACbC,YAAY;AAAA,IACZC,UAAU;AAAA,IACVC,UAAU;AAAA,EACZ;AAAA,EACAC,kBAAkB,CAAC;AAAA,EACnBC,iBAAiB;AAAA,IAAEZ,WAAWC,MAAMI,MAAMC;AAAAA,EAAG;AAC/C,CAAC;"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2383,6 +2383,8 @@ export declare interface HvColorPickerProps {
|
|
|
2383
2383
|
defaultExpanded?: boolean;
|
|
2384
2384
|
/** A function to be executed whenever the color changes. */
|
|
2385
2385
|
onChange?: (color: string) => void;
|
|
2386
|
+
/** A function to be executed whenever the color change is complete. */
|
|
2387
|
+
onChangeComplete?: (color: string) => void;
|
|
2386
2388
|
/** A Jss Object used to override or extend the styles applied to the component. */
|
|
2387
2389
|
classes?: HvColorPickerClasses;
|
|
2388
2390
|
/** The placeholder value when nothing is selected. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hitachivantara/uikit-react-core",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.25.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Hitachi Vantara UI Kit Team",
|
|
6
6
|
"description": "Core React components for the NEXT Design System.",
|
|
@@ -33,9 +33,9 @@
|
|
|
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.
|
|
37
|
-
"@hitachivantara/uikit-react-shared": "^5.1.
|
|
38
|
-
"@hitachivantara/uikit-styles": "^5.10.
|
|
36
|
+
"@hitachivantara/uikit-react-icons": "^5.6.0",
|
|
37
|
+
"@hitachivantara/uikit-react-shared": "^5.1.6",
|
|
38
|
+
"@hitachivantara/uikit-styles": "^5.10.3",
|
|
39
39
|
"@internationalized/date": "^3.2.0",
|
|
40
40
|
"@mui/base": "^5.0.0-beta.4",
|
|
41
41
|
"@popperjs/core": "^2.11.8",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"access": "public",
|
|
65
65
|
"directory": "package"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "ee184b661ce461dd23e979c41864deccb07d2d43",
|
|
68
68
|
"main": "dist/cjs/index.cjs",
|
|
69
69
|
"exports": {
|
|
70
70
|
".": {
|