@perses-dev/components 0.54.0-beta.4 → 0.54.0-beta.6
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/ColorPicker/OptionsColorPicker.d.ts +2 -1
- package/dist/ColorPicker/OptionsColorPicker.d.ts.map +1 -1
- package/dist/ColorPicker/OptionsColorPicker.js +2 -2
- package/dist/ColorPicker/OptionsColorPicker.js.map +1 -1
- package/dist/cjs/ColorPicker/OptionsColorPicker.js +2 -2
- package/package.json +3 -3
|
@@ -2,8 +2,9 @@ import { ReactElement } from 'react';
|
|
|
2
2
|
export interface OptionsColorPickerProps {
|
|
3
3
|
label: string;
|
|
4
4
|
color: string;
|
|
5
|
+
size?: 'small' | 'medium' | 'large';
|
|
5
6
|
onColorChange: (color: string) => void;
|
|
6
7
|
onClear?: () => void;
|
|
7
8
|
}
|
|
8
|
-
export declare function OptionsColorPicker({ label, color, onColorChange, onClear }: OptionsColorPickerProps): ReactElement;
|
|
9
|
+
export declare function OptionsColorPicker({ label, color, size, onColorChange, onClear, }: OptionsColorPickerProps): ReactElement;
|
|
9
10
|
//# sourceMappingURL=OptionsColorPicker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptionsColorPicker.d.ts","sourceRoot":"","sources":["../../src/ColorPicker/OptionsColorPicker.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAwB,MAAM,OAAO,CAAC;AAM3D,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,kBAAkB,CAAC,
|
|
1
|
+
{"version":3,"file":"OptionsColorPicker.d.ts","sourceRoot":"","sources":["../../src/ColorPicker/OptionsColorPicker.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAwB,MAAM,OAAO,CAAC;AAM3D,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,KAAK,EACL,IAAc,EACd,aAAa,EACb,OAAO,GACR,EAAE,uBAAuB,GAAG,YAAY,CA8CxC"}
|
|
@@ -16,7 +16,7 @@ import { styled, IconButton, Popover } from '@mui/material';
|
|
|
16
16
|
import CircleIcon from 'mdi-material-ui/Circle';
|
|
17
17
|
import { useChartsTheme } from '../context';
|
|
18
18
|
import { ColorPicker } from './ColorPicker';
|
|
19
|
-
export function OptionsColorPicker({ label, color, onColorChange, onClear }) {
|
|
19
|
+
export function OptionsColorPicker({ label, color, size = 'small', onColorChange, onClear }) {
|
|
20
20
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
21
21
|
const isOpen = Boolean(anchorEl);
|
|
22
22
|
const openColorPicker = (event)=>{
|
|
@@ -29,7 +29,7 @@ export function OptionsColorPicker({ label, color, onColorChange, onClear }) {
|
|
|
29
29
|
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
30
30
|
children: [
|
|
31
31
|
/*#__PURE__*/ _jsx(ColorIconButton, {
|
|
32
|
-
size:
|
|
32
|
+
size: size,
|
|
33
33
|
"aria-label": `change ${label} color`,
|
|
34
34
|
isSelected: isOpen,
|
|
35
35
|
iconColor: color,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ColorPicker/OptionsColorPicker.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, useState, MouseEvent } from 'react';\nimport { styled, IconButton, Popover } from '@mui/material';\nimport CircleIcon from 'mdi-material-ui/Circle';\nimport { useChartsTheme } from '../context';\nimport { ColorPicker } from './ColorPicker';\n\nexport interface OptionsColorPickerProps {\n label: string;\n color: string;\n onColorChange: (color: string) => void;\n onClear?: () => void;\n}\n\nexport function OptionsColorPicker({
|
|
1
|
+
{"version":3,"sources":["../../src/ColorPicker/OptionsColorPicker.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, useState, MouseEvent } from 'react';\nimport { styled, IconButton, Popover } from '@mui/material';\nimport CircleIcon from 'mdi-material-ui/Circle';\nimport { useChartsTheme } from '../context';\nimport { ColorPicker } from './ColorPicker';\n\nexport interface OptionsColorPickerProps {\n label: string;\n color: string;\n size?: 'small' | 'medium' | 'large';\n onColorChange: (color: string) => void;\n onClear?: () => void;\n}\n\nexport function OptionsColorPicker({\n label,\n color,\n size = 'small',\n onColorChange,\n onClear,\n}: OptionsColorPickerProps): ReactElement {\n const [anchorEl, setAnchorEl] = useState<HTMLButtonElement | null>(null);\n const isOpen = Boolean(anchorEl);\n\n const openColorPicker = (event: MouseEvent<HTMLButtonElement>): void => {\n setAnchorEl(event.currentTarget);\n };\n\n const closeColorPicker = (): void => {\n setAnchorEl(null);\n };\n\n const {\n thresholds: { defaultColor, palette },\n } = useChartsTheme();\n\n return (\n <>\n <ColorIconButton\n size={size}\n aria-label={`change ${label} color`}\n isSelected={isOpen}\n iconColor={color}\n onClick={openColorPicker}\n >\n <CircleIcon />\n </ColorIconButton>\n <Popover\n data-testid=\"options color picker\"\n open={isOpen}\n anchorEl={anchorEl}\n onClose={closeColorPicker}\n slotProps={{ paper: { sx: { padding: (theme) => theme.spacing(2) } } }}\n anchorOrigin={{\n vertical: 'top',\n horizontal: 'left',\n }}\n transformOrigin={{\n vertical: 'top',\n horizontal: 'right',\n }}\n >\n <ColorPicker color={color} palette={[defaultColor, ...palette]} onChange={onColorChange} onClear={onClear} />\n </Popover>\n </>\n );\n}\n\nconst ColorIconButton = styled(IconButton, {\n shouldForwardProp: (props) => props !== 'isSelected' && props !== 'iconColor',\n})<{\n iconColor?: string;\n isSelected?: boolean;\n}>(({ iconColor, isSelected }) => ({\n backgroundColor: isSelected && iconColor ? `${iconColor}3F` : 'undefined', // 3F represents 25% opacity\n color: iconColor,\n}));\n"],"names":["useState","styled","IconButton","Popover","CircleIcon","useChartsTheme","ColorPicker","OptionsColorPicker","label","color","size","onColorChange","onClear","anchorEl","setAnchorEl","isOpen","Boolean","openColorPicker","event","currentTarget","closeColorPicker","thresholds","defaultColor","palette","ColorIconButton","aria-label","isSelected","iconColor","onClick","data-testid","open","onClose","slotProps","paper","sx","padding","theme","spacing","anchorOrigin","vertical","horizontal","transformOrigin","onChange","shouldForwardProp","props","backgroundColor"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAAuBA,QAAQ,QAAoB,QAAQ;AAC3D,SAASC,MAAM,EAAEC,UAAU,EAAEC,O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GAAG;QAC9DlB,OAAOkB;IACT,CAAA"}
|
|
@@ -31,7 +31,7 @@ function _interop_require_default(obj) {
|
|
|
31
31
|
default: obj
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
function OptionsColorPicker({ label, color, onColorChange, onClear }) {
|
|
34
|
+
function OptionsColorPicker({ label, color, size = 'small', onColorChange, onClear }) {
|
|
35
35
|
const [anchorEl, setAnchorEl] = (0, _react.useState)(null);
|
|
36
36
|
const isOpen = Boolean(anchorEl);
|
|
37
37
|
const openColorPicker = (event)=>{
|
|
@@ -44,7 +44,7 @@ function OptionsColorPicker({ label, color, onColorChange, onClear }) {
|
|
|
44
44
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
45
45
|
children: [
|
|
46
46
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(ColorIconButton, {
|
|
47
|
-
size:
|
|
47
|
+
size: size,
|
|
48
48
|
"aria-label": `change ${label} color`,
|
|
49
49
|
isSelected: isOpen,
|
|
50
50
|
iconColor: color,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perses-dev/components",
|
|
3
|
-
"version": "0.54.0-beta.
|
|
3
|
+
"version": "0.54.0-beta.6",
|
|
4
4
|
"description": "Common UI components used across Perses features",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/perses/perses/blob/main/README.md",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"@date-fns/tz": "^1.4.1",
|
|
35
35
|
"@fontsource/inter": "^5.0.0",
|
|
36
36
|
"@mui/x-date-pickers": "^7.23.1",
|
|
37
|
-
"@perses-dev/spec": "0.2.0-beta.
|
|
38
|
-
"@perses-dev/client": "0.54.0-beta.
|
|
37
|
+
"@perses-dev/spec": "0.2.0-beta.2",
|
|
38
|
+
"@perses-dev/client": "0.54.0-beta.6",
|
|
39
39
|
"numbro": "^2.3.6",
|
|
40
40
|
"@tanstack/match-sorter-utils": "^8.19.4",
|
|
41
41
|
"@tanstack/react-table": "^8.20.5",
|