@razorpay/blade 12.49.7 → 12.51.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/build/lib/native/components/Box/BaseBox/baseBoxStyles.js +1 -1
- package/build/lib/native/components/Box/BaseBox/baseBoxStyles.js.map +1 -1
- package/build/lib/native/components/Box/BaseBox/types/propsTypes.js.map +1 -1
- package/build/lib/native/components/Box/Box.js +1 -1
- package/build/lib/native/components/Box/Box.js.map +1 -1
- package/build/lib/native/components/Charts/CommonChartComponents/CommonChartComponents.native.js +12 -0
- package/build/lib/native/components/Charts/CommonChartComponents/CommonChartComponents.native.js.map +1 -0
- package/build/lib/native/components/Charts/LineChart/LineChart.native.js +12 -0
- package/build/lib/native/components/Charts/LineChart/LineChart.native.js.map +1 -0
- package/build/lib/native/components/index.js +2 -0
- package/build/lib/native/components/index.js.map +1 -1
- package/build/lib/native/tokens/theme/bladeTheme.js +1 -1
- package/build/lib/native/tokens/theme/bladeTheme.js.map +1 -1
- package/build/lib/native/tokens/theme/theme.js.map +1 -1
- package/build/lib/web/development/components/Box/BaseBox/baseBoxStyles.js +5 -1
- package/build/lib/web/development/components/Box/BaseBox/baseBoxStyles.js.map +1 -1
- package/build/lib/web/development/components/Box/BaseBox/types/propsTypes.js.map +1 -1
- package/build/lib/web/development/components/Box/Box.js +3 -0
- package/build/lib/web/development/components/Box/Box.js.map +1 -1
- package/build/lib/web/development/components/Charts/CommonChartComponents/CommonChartComponents.web.js +285 -0
- package/build/lib/web/development/components/Charts/CommonChartComponents/CommonChartComponents.web.js.map +1 -0
- package/build/lib/web/development/components/Charts/CommonChartComponents/index.js +2 -0
- package/build/lib/web/development/components/Charts/CommonChartComponents/index.js.map +1 -0
- package/build/lib/web/development/components/Charts/CommonChartComponents/tokens.js +15 -0
- package/build/lib/web/development/components/Charts/CommonChartComponents/tokens.js.map +1 -0
- package/build/lib/web/development/components/Charts/CommonChartComponents/utils.js +60 -0
- package/build/lib/web/development/components/Charts/CommonChartComponents/utils.js.map +1 -0
- package/build/lib/web/development/components/Charts/LineChart/LineChart.web.js +107 -0
- package/build/lib/web/development/components/Charts/LineChart/LineChart.web.js.map +1 -0
- package/build/lib/web/development/components/Charts/LineChart/componentIds.js +6 -0
- package/build/lib/web/development/components/Charts/LineChart/componentIds.js.map +1 -0
- package/build/lib/web/development/components/Charts/LineChart/index.js +2 -0
- package/build/lib/web/development/components/Charts/LineChart/index.js.map +1 -0
- package/build/lib/web/development/components/Charts/index.js +5 -0
- package/build/lib/web/development/components/Charts/index.js.map +1 -0
- package/build/lib/web/development/components/Charts/utils/index.js +2 -0
- package/build/lib/web/development/components/Charts/utils/index.js.map +1 -0
- package/build/lib/web/development/components/Charts/utils/useColorTheme.js +19 -0
- package/build/lib/web/development/components/Charts/utils/useColorTheme.js.map +1 -0
- package/build/lib/web/development/components/Input/BaseInput/AnimatedBaseInputWrapper.web.js +5 -5
- package/build/lib/web/development/components/Input/BaseInput/AnimatedBaseInputWrapper.web.js.map +1 -1
- package/build/lib/web/development/components/Tag/AnimatedTag.web.js +4 -4
- package/build/lib/web/development/components/Tag/AnimatedTag.web.js.map +1 -1
- package/build/lib/web/development/components/index.js +3 -0
- package/build/lib/web/development/components/index.js.map +1 -1
- package/build/lib/web/development/tokens/theme/bladeTheme.js +350 -0
- package/build/lib/web/development/tokens/theme/bladeTheme.js.map +1 -1
- package/build/lib/web/development/tokens/theme/theme.js.map +1 -1
- package/build/lib/web/production/components/Box/BaseBox/baseBoxStyles.js +5 -1
- package/build/lib/web/production/components/Box/BaseBox/baseBoxStyles.js.map +1 -1
- package/build/lib/web/production/components/Box/BaseBox/types/propsTypes.js.map +1 -1
- package/build/lib/web/production/components/Box/Box.js +3 -0
- package/build/lib/web/production/components/Box/Box.js.map +1 -1
- package/build/lib/web/production/components/Charts/CommonChartComponents/CommonChartComponents.web.js +285 -0
- package/build/lib/web/production/components/Charts/CommonChartComponents/CommonChartComponents.web.js.map +1 -0
- package/build/lib/web/production/components/Charts/CommonChartComponents/index.js +2 -0
- package/build/lib/web/production/components/Charts/CommonChartComponents/index.js.map +1 -0
- package/build/lib/web/production/components/Charts/CommonChartComponents/tokens.js +15 -0
- package/build/lib/web/production/components/Charts/CommonChartComponents/tokens.js.map +1 -0
- package/build/lib/web/production/components/Charts/CommonChartComponents/utils.js +60 -0
- package/build/lib/web/production/components/Charts/CommonChartComponents/utils.js.map +1 -0
- package/build/lib/web/production/components/Charts/LineChart/LineChart.web.js +107 -0
- package/build/lib/web/production/components/Charts/LineChart/LineChart.web.js.map +1 -0
- package/build/lib/web/production/components/Charts/LineChart/componentIds.js +6 -0
- package/build/lib/web/production/components/Charts/LineChart/componentIds.js.map +1 -0
- package/build/lib/web/production/components/Charts/LineChart/index.js +2 -0
- package/build/lib/web/production/components/Charts/LineChart/index.js.map +1 -0
- package/build/lib/web/production/components/Charts/index.js +5 -0
- package/build/lib/web/production/components/Charts/index.js.map +1 -0
- package/build/lib/web/production/components/Charts/utils/index.js +2 -0
- package/build/lib/web/production/components/Charts/utils/index.js.map +1 -0
- package/build/lib/web/production/components/Charts/utils/useColorTheme.js +19 -0
- package/build/lib/web/production/components/Charts/utils/useColorTheme.js.map +1 -0
- package/build/lib/web/production/components/Input/BaseInput/AnimatedBaseInputWrapper.web.js +5 -5
- package/build/lib/web/production/components/Input/BaseInput/AnimatedBaseInputWrapper.web.js.map +1 -1
- package/build/lib/web/production/components/Tag/AnimatedTag.web.js +4 -4
- package/build/lib/web/production/components/Tag/AnimatedTag.web.js.map +1 -1
- package/build/lib/web/production/components/index.js +3 -0
- package/build/lib/web/production/components/index.js.map +1 -1
- package/build/lib/web/production/tokens/theme/bladeTheme.js +350 -0
- package/build/lib/web/production/tokens/theme/bladeTheme.js.map +1 -1
- package/build/lib/web/production/tokens/theme/theme.js.map +1 -1
- package/build/types/components/index.d.ts +730 -4423
- package/build/types/components/index.native.d.ts +212 -503
- package/build/types/tokens/index.d.ts +12 -0
- package/build/types/tokens/index.native.d.ts +12 -0
- package/build/types/utils/index.d.ts +31 -0
- package/build/types/utils/index.native.d.ts +31 -0
- package/package.json +3 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommonChartComponents.web.js","sources":["../../../../../../../src/components/Charts/CommonChartComponents/CommonChartComponents.web.tsx"],"sourcesContent":["import React from 'react';\nimport {\n XAxis as RechartsXAxis,\n YAxis as RechartsYAxis,\n CartesianGrid as RechartsCartesianGrid,\n Tooltip as RechartsTooltip,\n Legend as RechartsLegend,\n ReferenceLine as RechartsReferenceLine,\n} from 'recharts';\nimport type {\n ChartReferenceLineProps,\n ChartXAxisProps,\n ChartYAxisProps,\n ChartTooltipProps,\n ChartLegendProps,\n ChartCartesianGridProps,\n} from './types';\nimport {\n RECT_HEIGHT,\n TEXT_BASELINE,\n PADDING_VERTICAL,\n PADDING_HORIZONTAL,\n X_AXIS_TEXT_BASELINE,\n Y_OFFSET,\n X_OFFSET,\n} from './tokens';\nimport { calculateTextWidth } from './utils';\nimport { Heading, Text } from '~components/Typography';\nimport { Box } from '~components/Box';\nimport { useTheme } from '~components/BladeProvider';\n\nconst ChartXAxis: React.FC<ChartXAxisProps> = (props) => {\n const { theme } = useTheme();\n\n return (\n <RechartsXAxis\n {...props}\n tick={{\n fill: theme.colors.surface.text.gray.normal,\n fontSize: theme.typography.fonts.size[75],\n fontFamily: theme.typography.fonts.family.text,\n fontWeight: theme.typography.fonts.weight.regular,\n letterSpacing: theme.typography.letterSpacings[100],\n }}\n stroke={theme.colors.surface.border.gray.muted}\n label={({ viewBox }: { viewBox: { x: number; y: number; width: number } }) => (\n <text\n x={viewBox.x + viewBox.width / 2 - X_OFFSET}\n y={viewBox.y + Y_OFFSET + X_AXIS_TEXT_BASELINE}\n textAnchor=\"middle\"\n fill={theme.colors.surface.text.gray.subtle}\n fontSize={theme.typography.fonts.size[75]}\n fontFamily={theme.typography.fonts.family.text}\n fontWeight={theme.typography.fonts.weight.medium}\n letterSpacing={theme.typography.letterSpacings[100]}\n >\n {props?.label}\n </text>\n )}\n dataKey={props?.dataKey}\n />\n );\n};\n\nconst ChartYAxis: React.FC<ChartYAxisProps> = (props) => {\n const { theme } = useTheme();\n\n return (\n <RechartsYAxis\n {...props}\n tick={{\n fill: theme.colors.surface.text.gray.normal,\n fontSize: theme.typography.fonts.size[75],\n fontFamily: theme.typography.fonts.family.text,\n fontWeight: theme.typography.fonts.weight.regular,\n letterSpacing: theme.typography.letterSpacings[100],\n }}\n stroke={theme.colors.surface.border.gray.muted}\n label={{\n value: props?.label,\n position: 'insideLeft',\n style: {\n textAnchor: 'middle',\n fill: theme.colors.surface.text.gray.subtle,\n fontSize: theme.typography.fonts.size[75],\n fontWeight: theme.typography.fonts.weight.medium,\n fontFamily: theme.typography.fonts.family.text,\n letterSpacing: theme.typography.letterSpacings[100],\n lineHeight: theme.typography.lineHeights[500],\n },\n angle: -90,\n fill: theme.colors.surface.text.gray.subtle,\n }}\n dataKey={props?.dataKey}\n />\n );\n};\n\nconst ChartCartesianGrid: React.FC<ChartCartesianGridProps> = (props) => {\n const { theme } = useTheme();\n\n return (\n <RechartsCartesianGrid\n stroke={theme.colors.surface.border.gray.muted}\n vertical={false}\n {...props}\n />\n );\n};\n\nconst ChartTooltip: React.FC<ChartTooltipProps> = (props) => {\n const { theme } = useTheme();\n\n return (\n <RechartsTooltip\n content={({ payload, label }) => {\n return (\n <div\n style={{\n backgroundColor: theme.colors.surface.icon.staticBlack.normal,\n borderRadius: theme.border.radius.large,\n border: `1px solid ${theme.colors.surface.border.gray.muted}`,\n padding: theme.spacing[4],\n }}\n >\n <Heading size=\"small\" weight=\"semibold\" color=\"surface.text.staticWhite.normal\">\n {label}\n </Heading>\n <Box paddingTop=\"spacing.4\">\n {payload.map((item) => (\n <Box\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n gap=\"spacing.4\"\n key={item.name}\n >\n <Box display=\"flex\" gap=\"spacing.3\" alignItems=\"center\" justifyContent=\"center\">\n <div\n style={{\n width: theme.spacing[4],\n height: theme.spacing[4],\n backgroundColor: item.color,\n borderRadius: theme.border.radius.small,\n }}\n />\n <Text size=\"small\" weight=\"regular\" color=\"surface.text.staticWhite.normal\">\n {item.name}\n </Text>\n </Box>\n <Text size=\"small\" weight=\"regular\" color=\"surface.text.staticWhite.normal\">\n {item.value}\n </Text>\n </Box>\n ))}\n </Box>\n </div>\n );\n }}\n cursor={{ fill: 'rgba(0, 0, 0, 0.1)', stroke: theme.colors.surface.border.gray.muted }}\n {...props}\n />\n );\n};\n\nconst CustomSquareLegend = (props: {\n payload?: Array<{\n payload: {\n legendType: 'none' | 'line';\n };\n value: string;\n color: string;\n }>;\n}): JSX.Element | null => {\n const { payload } = props;\n const { theme } = useTheme();\n\n if (!payload || payload.length === 0) {\n return null;\n }\n /*\n This is a custom legend component that is used to display the legend for the chart.\n we need to show the legend only if the legendType is not none. (for example in line chart we don't want to show the legend for the reference line)\n so we are filtering the payload and then mapping over it to display the legend.\n */\n const filteredPayload = payload.filter((entry) => entry?.payload?.legendType !== 'none');\n\n return (\n <Box display=\"flex\" justifyContent=\"center\" gap=\"spacing.5\">\n {filteredPayload.map((entry, index) => (\n <Box key={`item-${index}`} display=\"flex\" alignItems=\"center\">\n <Box display=\"flex\" gap=\"spacing.3\" justifyContent=\"center\" alignItems=\"center\">\n <span\n style={{\n backgroundColor: entry.color, // Uses the color of the line/bar\n width: theme.spacing[4], // Size of the square\n height: theme.spacing[4], // Size of the square\n display: 'inline-block',\n borderRadius: theme.border.radius.small,\n }}\n />\n {/* Legend text with custom color and size */}\n <Text size=\"medium\" color=\"surface.text.gray.muted\">\n {entry.value}\n </Text>\n </Box>\n </Box>\n ))}\n </Box>\n );\n};\n\nconst ChartLegend: React.FC<ChartLegendProps> = (props) => {\n const { theme } = useTheme();\n\n return (\n <RechartsLegend\n wrapperStyle={{\n fontFamily: theme.typography.fonts.family.text,\n fontSize: theme.typography.fonts.size[100],\n color: theme.colors.surface.text.gray.normal,\n paddingTop: theme.spacing[5],\n }}\n align=\"center\"\n content={<CustomSquareLegend />}\n {...props}\n />\n );\n};\n\nconst CustomReferenceLabel = ({\n viewBox,\n value,\n isVertical,\n}: {\n viewBox?: { x: number; y: number; width: number };\n value: string | undefined;\n isVertical: boolean;\n}): JSX.Element => {\n // Extract viewBox coordinates with fallback values to prevent undefined errors.\n // viewBox contains the positioning information for the reference line label from Recharts.\n const { x, y, width } = viewBox ?? { x: 0, y: 0, width: 0 };\n const { theme } = useTheme();\n\n // Calculate dynamic text width to ensure the background rectangle fits the text perfectly.\n // This prevents text overflow for long labels and avoids unnecessarily large rectangles for short text.\n // The function also handles text truncation with ellipsis if the text exceeds the maximum width.\n const { width: RECT_WIDTH, displayText } = value\n ? calculateTextWidth(value, theme)\n : { width: 80, displayText: value ?? '' };\n\n const rect_x = isVertical ? x + width - RECT_WIDTH / 2 : x + width - RECT_WIDTH;\n const rect_y = isVertical ? y : y - TEXT_BASELINE;\n // Text position with padding inside the rectangle\n const text_x = rect_x + PADDING_HORIZONTAL + (RECT_WIDTH - PADDING_HORIZONTAL * 2) / 2;\n const text_y = rect_y + PADDING_VERTICAL + TEXT_BASELINE; // +15 for text baseline\n\n return (\n <g>\n <rect\n x={rect_x}\n y={rect_y}\n width={RECT_WIDTH}\n height={RECT_HEIGHT}\n rx={theme.border.radius.medium}\n fill={theme.colors.surface.background.gray.subtle}\n stroke={theme.colors.surface.border.gray.muted}\n strokeWidth=\"1\"\n />\n <text\n x={text_x}\n y={text_y}\n textAnchor=\"middle\"\n fill={theme.colors.surface.text.gray.normal}\n fontSize={theme.typography.fonts.size[50]}\n fontFamily={theme.typography.fonts.family.text}\n fontWeight={theme.typography.fonts.weight.medium}\n letterSpacing={theme.typography.letterSpacings[100]}\n >\n {displayText}\n </text>\n </g>\n );\n};\n\nconst ChartReferenceLine: React.FC<ChartReferenceLineProps> = ({ label, x, y }) => {\n const { theme } = useTheme();\n return (\n <RechartsReferenceLine\n stroke={theme.colors.chart.background.categorical.gray.intense}\n strokeWidth={2}\n strokeDasharray=\"4 4\"\n label={<CustomReferenceLabel value={label} isVertical={Boolean(x)} />}\n x={x}\n y={y}\n />\n );\n};\n\nexport {\n ChartXAxis,\n ChartYAxis,\n ChartCartesianGrid,\n ChartLegend,\n ChartTooltip,\n ChartReferenceLine,\n};\n"],"names":["ChartXAxis","props","_useTheme","useTheme","theme","_jsx","RechartsXAxis","_objectSpread","tick","fill","colors","surface","text","gray","normal","fontSize","typography","fonts","size","fontFamily","family","fontWeight","weight","regular","letterSpacing","letterSpacings","stroke","border","muted","label","_ref","viewBox","x","width","X_OFFSET","y","Y_OFFSET","X_AXIS_TEXT_BASELINE","textAnchor","subtle","medium","children","dataKey","ChartYAxis","_useTheme2","RechartsYAxis","value","position","style","lineHeight","lineHeights","angle","ChartCartesianGrid","_useTheme3","RechartsCartesianGrid","vertical","ChartTooltip","_useTheme4","RechartsTooltip","content","_ref2","payload","_jsxs","backgroundColor","icon","staticBlack","borderRadius","radius","large","concat","padding","spacing","Heading","color","Box","paddingTop","map","item","display","alignItems","justifyContent","gap","height","small","Text","name","cursor","CustomSquareLegend","_useTheme5","length","filteredPayload","filter","entry","_entry$payload","legendType","index","ChartLegend","_useTheme6","RechartsLegend","wrapperStyle","align","CustomReferenceLabel","_ref3","isVertical","_ref4","_useTheme7","_ref5","calculateTextWidth","displayText","RECT_WIDTH","rect_x","rect_y","TEXT_BASELINE","text_x","PADDING_HORIZONTAL","text_y","PADDING_VERTICAL","RECT_HEIGHT","rx","background","strokeWidth","ChartReferenceLine","_ref6","_useTheme8","RechartsReferenceLine","chart","categorical","intense","strokeDasharray","Boolean"],"mappings":";;;;;;;;;;;;;;;;AA+BA,IAAMA,UAAqC,GAAG,SAAxCA,UAAqCA,CAAIC,KAAK,EAAK;AACvD,EAAA,IAAAC,SAAA,GAAkBC,QAAQ,EAAE;IAApBC,KAAK,GAAAF,SAAA,CAALE,KAAK,CAAA;EAEb,oBACEC,GAAA,CAACC,KAAa,EAAAC,aAAA,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AU,EAAE0B,OAAO,CAACjG,CAAC,CAAA;AAAE,KAAE,CAAE;AACtEA,IAAAA,CAAC,EAAEA,CAAE;AACLG,IAAAA,CAAC,EAAEA,CAAAA;AAAE,GACN,CAAC,CAAA;AAEN;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var RECT_WIDTH = 80;
|
|
2
|
+
var RECT_HEIGHT = 30;
|
|
3
|
+
var TEXT_BASELINE = 15;
|
|
4
|
+
|
|
5
|
+
// Padding for text inside the rectangle (4px vertical, 8px horizontal)
|
|
6
|
+
var PADDING_VERTICAL = 4;
|
|
7
|
+
var PADDING_HORIZONTAL = 8;
|
|
8
|
+
var X_OFFSET = 32;
|
|
9
|
+
var Y_OFFSET = 14.5;
|
|
10
|
+
var X_AXIS_TEXT_BASELINE = 24;
|
|
11
|
+
var MIN_WIDTH = RECT_WIDTH;
|
|
12
|
+
var MAX_WIDTH = 200;
|
|
13
|
+
|
|
14
|
+
export { MAX_WIDTH, MIN_WIDTH, PADDING_HORIZONTAL, PADDING_VERTICAL, RECT_HEIGHT, RECT_WIDTH, TEXT_BASELINE, X_AXIS_TEXT_BASELINE, X_OFFSET, Y_OFFSET };
|
|
15
|
+
//# sourceMappingURL=tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","sources":["../../../../../../../src/components/Charts/CommonChartComponents/tokens.ts"],"sourcesContent":["const RECT_WIDTH = 80;\nconst RECT_HEIGHT = 30;\nconst TEXT_BASELINE = 15;\n\n// Padding for text inside the rectangle (4px vertical, 8px horizontal)\nconst PADDING_VERTICAL = 4;\nconst PADDING_HORIZONTAL = 8;\n\nconst X_OFFSET = 32;\nconst Y_OFFSET = 14.5;\nconst X_AXIS_TEXT_BASELINE = 24;\n\nconst MIN_WIDTH = RECT_WIDTH;\nconst MAX_WIDTH = 200;\nexport {\n RECT_WIDTH,\n RECT_HEIGHT,\n TEXT_BASELINE,\n PADDING_VERTICAL,\n PADDING_HORIZONTAL,\n X_OFFSET,\n Y_OFFSET,\n X_AXIS_TEXT_BASELINE,\n MIN_WIDTH,\n MAX_WIDTH,\n};\n"],"names":["RECT_WIDTH","RECT_HEIGHT","TEXT_BASELINE","PADDING_VERTICAL","PADDING_HORIZONTAL","X_OFFSET","Y_OFFSET","X_AXIS_TEXT_BASELINE","MIN_WIDTH","MAX_WIDTH"],"mappings":"AAAMA,IAAAA,UAAU,GAAG,GAAE;AACfC,IAAAA,WAAW,GAAG,GAAE;AAChBC,IAAAA,aAAa,GAAG,GAAE;;AAExB;AACMC,IAAAA,gBAAgB,GAAG,EAAC;AACpBC,IAAAA,kBAAkB,GAAG,EAAC;AAEtBC,IAAAA,QAAQ,GAAG,GAAE;AACbC,IAAAA,QAAQ,GAAG,KAAI;AACfC,IAAAA,oBAAoB,GAAG,GAAE;AAEzBC,IAAAA,SAAS,GAAGR,WAAU;AACtBS,IAAAA,SAAS,GAAG;;;;"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { MAX_WIDTH, PADDING_HORIZONTAL, MIN_WIDTH } from './tokens.js';
|
|
2
|
+
|
|
3
|
+
var calculateTextWidth = function calculateTextWidth(text, theme) {
|
|
4
|
+
// Create a temporary canvas to measure text
|
|
5
|
+
var canvas = document.createElement('canvas');
|
|
6
|
+
var context = canvas.getContext('2d');
|
|
7
|
+
if (!context) return {
|
|
8
|
+
width: 80,
|
|
9
|
+
displayText: text
|
|
10
|
+
}; // fallback
|
|
11
|
+
|
|
12
|
+
// Set font properties to match the text styling
|
|
13
|
+
var fontSize = theme.typography.fonts.size[50];
|
|
14
|
+
var fontFamily = theme.typography.fonts.family.text;
|
|
15
|
+
var fontWeight = theme.typography.fonts.weight.medium;
|
|
16
|
+
context.font = "".concat(fontWeight, " ").concat(fontSize, "px ").concat(fontFamily);
|
|
17
|
+
|
|
18
|
+
// Measure the full text first
|
|
19
|
+
var fullTextWidth = context.measureText(text).width;
|
|
20
|
+
var availableWidth = MAX_WIDTH - PADDING_HORIZONTAL;
|
|
21
|
+
|
|
22
|
+
// If text fits within max width, use it as is
|
|
23
|
+
if (fullTextWidth <= availableWidth) {
|
|
24
|
+
var _finalWidth = Math.max(MIN_WIDTH, fullTextWidth + PADDING_HORIZONTAL);
|
|
25
|
+
return {
|
|
26
|
+
width: _finalWidth,
|
|
27
|
+
displayText: text
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Text is too long, need to truncate
|
|
32
|
+
var ELLIPSIS = '...';
|
|
33
|
+
var ellipsisWidth = context.measureText(ELLIPSIS).width;
|
|
34
|
+
var maxTextWidth = availableWidth - ellipsisWidth;
|
|
35
|
+
|
|
36
|
+
// Binary search to find the optimal truncation point
|
|
37
|
+
var left = 0;
|
|
38
|
+
var right = text.length;
|
|
39
|
+
var bestFit = '';
|
|
40
|
+
while (left <= right) {
|
|
41
|
+
var mid = Math.floor((left + right) / 2);
|
|
42
|
+
var testText = text.substring(0, mid);
|
|
43
|
+
var testWidth = context.measureText(testText).width;
|
|
44
|
+
if (testWidth <= maxTextWidth) {
|
|
45
|
+
bestFit = testText;
|
|
46
|
+
left = mid + 1;
|
|
47
|
+
} else {
|
|
48
|
+
right = mid - 1;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
var truncatedText = bestFit + ELLIPSIS;
|
|
52
|
+
var finalWidth = Math.max(MIN_WIDTH, MAX_WIDTH);
|
|
53
|
+
return {
|
|
54
|
+
width: finalWidth,
|
|
55
|
+
displayText: truncatedText
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export { calculateTextWidth };
|
|
60
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../../../../src/components/Charts/CommonChartComponents/utils.ts"],"sourcesContent":["import { MIN_WIDTH, MAX_WIDTH, PADDING_HORIZONTAL } from './tokens';\nimport type { Theme } from '~components/BladeProvider';\n\nconst calculateTextWidth = (text: string, theme: Theme): { width: number; displayText: string } => {\n // Create a temporary canvas to measure text\n const canvas = document.createElement('canvas');\n const context = canvas.getContext('2d');\n if (!context) return { width: 80, displayText: text }; // fallback\n\n // Set font properties to match the text styling\n const fontSize = theme.typography.fonts.size[50];\n const fontFamily = theme.typography.fonts.family.text;\n const fontWeight = theme.typography.fonts.weight.medium;\n\n context.font = `${fontWeight} ${fontSize}px ${fontFamily}`;\n\n // Measure the full text first\n const fullTextWidth = context.measureText(text).width;\n const availableWidth = MAX_WIDTH - PADDING_HORIZONTAL;\n\n // If text fits within max width, use it as is\n if (fullTextWidth <= availableWidth) {\n const finalWidth = Math.max(MIN_WIDTH, fullTextWidth + PADDING_HORIZONTAL);\n return { width: finalWidth, displayText: text };\n }\n\n // Text is too long, need to truncate\n const ELLIPSIS = '...';\n const ellipsisWidth = context.measureText(ELLIPSIS).width;\n const maxTextWidth = availableWidth - ellipsisWidth;\n\n // Binary search to find the optimal truncation point\n let left = 0;\n let right = text.length;\n let bestFit = '';\n\n while (left <= right) {\n const mid = Math.floor((left + right) / 2);\n const testText = text.substring(0, mid);\n const testWidth = context.measureText(testText).width;\n\n if (testWidth <= maxTextWidth) {\n bestFit = testText;\n left = mid + 1;\n } else {\n right = mid - 1;\n }\n }\n\n const truncatedText = bestFit + ELLIPSIS;\n const finalWidth = Math.max(MIN_WIDTH, MAX_WIDTH);\n\n return { width: finalWidth, displayText: truncatedText };\n};\n\nexport { calculateTextWidth };\n"],"names":["calculateTextWidth","text","theme","canvas","document","createElement","context","getContext","width","displayText","fontSize","typography","fonts","size","fontFamily","family","fontWeight","weight","medium","font","concat","fullTextWidth","measureText","availableWidth","MAX_WIDTH","PADDING_HORIZONTAL","finalWidth","Math","max","MIN_WIDTH","ELLIPSIS","ellipsisWidth","maxTextWidth","left","right","length","bestFit","mid","floor","testText","substring","testWidth","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ectWithoutProperties';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
import { Line as Line$1, ResponsiveContainer, LineChart } from 'recharts';
|
|
5
|
+
import '../utils/index.js';
|
|
6
|
+
import { componentIds } from './componentIds.js';
|
|
7
|
+
import '../../../utils/metaAttribute/index.js';
|
|
8
|
+
import '../../BladeProvider/index.js';
|
|
9
|
+
import '../../Box/BaseBox/index.js';
|
|
10
|
+
import getIn from '../../../utils/lodashButBetter/get.js';
|
|
11
|
+
import '../../../utils/makeAnalyticsAttribute/index.js';
|
|
12
|
+
import '../../../utils/isValidAllowedChildren/index.js';
|
|
13
|
+
import '../../../utils/assignWithoutSideEffects/index.js';
|
|
14
|
+
import { jsx } from 'react/jsx-runtime';
|
|
15
|
+
import useTheme from '../../BladeProvider/useTheme.js';
|
|
16
|
+
import useChartsColorTheme from '../utils/useColorTheme.js';
|
|
17
|
+
import { assignWithoutSideEffects } from '../../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
|
|
18
|
+
import { getComponentId } from '../../../utils/isValidAllowedChildren/isValidAllowedChildren.js';
|
|
19
|
+
import { BaseBox } from '../../Box/BaseBox/BaseBox.web.js';
|
|
20
|
+
import { metaAttribute } from '../../../utils/metaAttribute/metaAttribute.web.js';
|
|
21
|
+
import { makeAnalyticsAttribute } from '../../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
|
|
22
|
+
|
|
23
|
+
var _excluded = ["color", "strokeStyle", "type", "dot", "activeDot", "showLegend", "_index", "_colorTheme"],
|
|
24
|
+
_excluded2 = ["children", "colorTheme", "testID", "data"];
|
|
25
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
26
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
27
|
+
var Line = function Line(_ref) {
|
|
28
|
+
var color = _ref.color,
|
|
29
|
+
_ref$strokeStyle = _ref.strokeStyle,
|
|
30
|
+
strokeStyle = _ref$strokeStyle === void 0 ? 'solid' : _ref$strokeStyle,
|
|
31
|
+
_ref$type = _ref.type,
|
|
32
|
+
type = _ref$type === void 0 ? 'monotone' : _ref$type,
|
|
33
|
+
_ref$dot = _ref.dot,
|
|
34
|
+
dot = _ref$dot === void 0 ? false : _ref$dot,
|
|
35
|
+
_ref$activeDot = _ref.activeDot,
|
|
36
|
+
activeDot = _ref$activeDot === void 0 ? true : _ref$activeDot,
|
|
37
|
+
_ref$showLegend = _ref.showLegend,
|
|
38
|
+
showLegend = _ref$showLegend === void 0 ? true : _ref$showLegend,
|
|
39
|
+
_index = _ref._index,
|
|
40
|
+
_colorTheme = _ref._colorTheme,
|
|
41
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
42
|
+
var _useTheme = useTheme(),
|
|
43
|
+
theme = _useTheme.theme;
|
|
44
|
+
var themeColors = useChartsColorTheme({
|
|
45
|
+
colorTheme: _colorTheme !== null && _colorTheme !== void 0 ? _colorTheme : 'default'
|
|
46
|
+
});
|
|
47
|
+
var colorToken = color ? getIn(theme.colors, color) : themeColors[_index !== null && _index !== void 0 ? _index : 0];
|
|
48
|
+
var strokeDasharray = strokeStyle === 'dashed' ? '5 5' : strokeStyle === 'dotted' ? '2 2' : undefined;
|
|
49
|
+
var isLineDotted = strokeStyle === 'dashed';
|
|
50
|
+
var animationBegin = isLineDotted ? theme.motion.delay.gentle + theme.motion.duration.xgentle : theme.motion.delay.gentle;
|
|
51
|
+
var animationDuration = theme.motion.duration.xgentle;
|
|
52
|
+
return /*#__PURE__*/jsx(Line$1, _objectSpread({
|
|
53
|
+
stroke: colorToken,
|
|
54
|
+
strokeWidth: 3,
|
|
55
|
+
strokeDasharray: strokeDasharray,
|
|
56
|
+
type: type,
|
|
57
|
+
activeDot: activeDot,
|
|
58
|
+
dot: dot,
|
|
59
|
+
legendType: showLegend ? 'line' : 'none',
|
|
60
|
+
animationBegin: animationBegin,
|
|
61
|
+
animationDuration: animationDuration
|
|
62
|
+
}, props));
|
|
63
|
+
};
|
|
64
|
+
var ChartLine = /*#__PURE__*/assignWithoutSideEffects(Line, {
|
|
65
|
+
componentId: componentIds.ChartLine
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Main components
|
|
69
|
+
var ChartLineWrapper = function ChartLineWrapper(_ref2) {
|
|
70
|
+
var children = _ref2.children,
|
|
71
|
+
_ref2$colorTheme = _ref2.colorTheme,
|
|
72
|
+
colorTheme = _ref2$colorTheme === void 0 ? 'default' : _ref2$colorTheme,
|
|
73
|
+
testID = _ref2.testID,
|
|
74
|
+
data = _ref2.data,
|
|
75
|
+
restProps = _objectWithoutProperties(_ref2, _excluded2);
|
|
76
|
+
var lineChartModifiedChildrens = React__default.useMemo(function () {
|
|
77
|
+
var LineChartIndex = 0;
|
|
78
|
+
return React__default.Children.map(children, function (child) {
|
|
79
|
+
if (/*#__PURE__*/React__default.isValidElement(child) && getComponentId(child) === componentIds.ChartLine) {
|
|
80
|
+
return /*#__PURE__*/React__default.cloneElement(child, {
|
|
81
|
+
_index: LineChartIndex++,
|
|
82
|
+
_colorTheme: colorTheme
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return child;
|
|
86
|
+
});
|
|
87
|
+
}, [children, colorTheme]);
|
|
88
|
+
return /*#__PURE__*/jsx(BaseBox, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, metaAttribute({
|
|
89
|
+
name: 'line-chart',
|
|
90
|
+
testID: testID
|
|
91
|
+
})), makeAnalyticsAttribute(restProps)), {}, {
|
|
92
|
+
width: "100%",
|
|
93
|
+
height: "100%"
|
|
94
|
+
}, restProps), {}, {
|
|
95
|
+
children: /*#__PURE__*/jsx(ResponsiveContainer, {
|
|
96
|
+
width: "100%",
|
|
97
|
+
height: "100%",
|
|
98
|
+
children: /*#__PURE__*/jsx(LineChart, {
|
|
99
|
+
data: data,
|
|
100
|
+
children: lineChartModifiedChildrens
|
|
101
|
+
})
|
|
102
|
+
})
|
|
103
|
+
}));
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export { ChartLine, ChartLineWrapper };
|
|
107
|
+
//# sourceMappingURL=LineChart.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LineChart.web.js","sources":["../../../../../../../src/components/Charts/LineChart/LineChart.web.tsx"],"sourcesContent":["import React from 'react';\nimport {\n LineChart as RechartsLineChart,\n Line as RechartsLine,\n ResponsiveContainer as RechartsResponsiveContainer,\n} from 'recharts';\nimport { useChartsColorTheme } from '../utils';\nimport type { ChartLineProps, ChartLineWrapperProps } from './types';\nimport { componentIds } from './componentIds';\nimport { metaAttribute } from '~utils/metaAttribute';\nimport { useTheme } from '~components/BladeProvider';\nimport BaseBox from '~components/Box/BaseBox';\nimport getIn from '~utils/lodashButBetter/get';\nimport type { DataAnalyticsAttribute, TestID } from '~utils/types';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\n\nconst Line: React.FC<ChartLineProps> = ({\n color,\n strokeStyle = 'solid',\n type = 'monotone',\n dot = false,\n activeDot = true,\n showLegend = true,\n _index,\n _colorTheme,\n ...props\n}) => {\n const { theme } = useTheme();\n const themeColors = useChartsColorTheme({ colorTheme: _colorTheme ?? 'default' });\n const colorToken = color ? getIn(theme.colors, color) : themeColors[_index ?? 0];\n\n const strokeDasharray =\n strokeStyle === 'dashed' ? '5 5' : strokeStyle === 'dotted' ? '2 2' : undefined;\n\n const isLineDotted = strokeStyle === 'dashed';\n const animationBegin = isLineDotted\n ? theme.motion.delay.gentle + theme.motion.duration.xgentle\n : theme.motion.delay.gentle;\n const animationDuration = theme.motion.duration.xgentle;\n\n return (\n <RechartsLine\n stroke={colorToken}\n strokeWidth={3}\n strokeDasharray={strokeDasharray}\n type={type}\n activeDot={activeDot}\n dot={dot}\n legendType={showLegend ? 'line' : 'none'}\n animationBegin={animationBegin}\n animationDuration={animationDuration}\n {...props}\n />\n );\n};\n\nconst ChartLine = assignWithoutSideEffects(Line, {\n componentId: componentIds.ChartLine,\n});\n\n// Main components\nconst ChartLineWrapper: React.FC<ChartLineWrapperProps & TestID & DataAnalyticsAttribute> = ({\n children,\n colorTheme = 'default',\n testID,\n data,\n ...restProps\n}) => {\n const lineChartModifiedChildrens = React.useMemo(() => {\n let LineChartIndex = 0;\n return React.Children.map(children, (child) => {\n if (React.isValidElement(child) && getComponentId(child) === componentIds.ChartLine) {\n return React.cloneElement(child, {\n _index: LineChartIndex++,\n _colorTheme: colorTheme,\n } as Partial<ChartLineProps>);\n }\n return child;\n });\n }, [children, colorTheme]);\n return (\n <BaseBox\n {...metaAttribute({ name: 'line-chart', testID })}\n {...makeAnalyticsAttribute(restProps)}\n width=\"100%\"\n height=\"100%\"\n {...restProps}\n >\n <RechartsResponsiveContainer width=\"100%\" height=\"100%\">\n <RechartsLineChart data={data}>{lineChartModifiedChildrens}</RechartsLineChart>\n </RechartsResponsiveContainer>\n </BaseBox>\n );\n};\n\nexport { ChartLine, ChartLineWrapper };\n"],"names":["Line","_ref","color","_ref$strokeStyle","strokeStyle","_ref$type","type","_ref$dot","dot","_ref$activeDot","activeDot","_ref$showLegend","showLegend","_index","_colorTheme","props","_objectWithoutProperties","_excluded","_useTheme","useTheme","theme","themeColors","useChartsColorTheme","colorTheme","colorToken","getIn","colors","strokeDasharray","undefined","isLineDotted","animationBegin","motion","delay","gentle","duration","xgentle","animationDuration","_jsx","RechartsLine","_objectSpread","stroke","strokeWidth","legendType","ChartLine","assignWithoutSideEffects","componentId","componentIds","ChartLineWrapper","_ref2","children","_ref2$colorTheme","testID","data","restProps","_excluded2","lineChartModifiedChildrens","React","useMemo","LineChartIndex","Children","map","child","isValidElement","getComponentId","cloneElement","BaseBox","metaAttribute","name","makeAnalyticsAttribute","width","height","RechartsResponsiveContainer","RechartsLineChart"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,IAAMA,IAA8B,GAAG,SAAjCA,IAA8BA,CAAAC,IAAA,EAU9B;AAAA,EAAA,IATJC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAAC,gBAAA,GAAAF,IAAA,CACLG,WAAW;AAAXA,IAAAA,WAAW,GAAAD,gBAAA,KAAG,KAAA,CAAA,GAAA,OAAO,GAAAA,gBAAA;IAAAE,SAAA,GAAAJ,IAAA,CACrBK,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,UAAU,GAAAA,SAAA;IAAAE,QAAA,GAAAN,IAAA,CACjBO,GAAG;AAAHA,IAAAA,GAAG,GAAAD,QAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,QAAA;IAAAE,cAAA,GAAAR,IAAA,CACXS,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,cAAA;IAAAE,eAAA,GAAAV,IAAA,CAChBW,UAAU;AAAVA,IAAAA,UAAU,GAAAD,eAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,eAAA;IACjBE,MAAM,GAAAZ,IAAA,CAANY,MAAM;IACNC,WAAW,GAAAb,IAAA,CAAXa,WAAW;AACRC,IAAAA,KAAK,GAAAC,wBAAA,CAAAf,IAAA,EAAAgB,SAAA,CAAA,CAAA;AAER,EAAA,IAAAC,SAAA,GAAkBC,QAAQ,EAAE;IAApBC,KAAK,GAAAF,SAAA,CAALE,KAAK,CAAA;EACb,IAAMC,WAAW,GAAG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2B,aAAa,CAAC;AAAEC,IAAAA,IAAI,EAAE,YAAY;AAAEhB,IAAAA,MAAM,EAANA,MAAAA;AAAO,GAAC,CAAC,CAAA,EAC7CiB,sBAAsB,CAACf,SAAS,CAAC,CAAA,EAAA,EAAA,EAAA;AACrCgB,IAAAA,KAAK,EAAC,MAAM;AACZC,IAAAA,MAAM,EAAC,MAAA;AAAM,GAAA,EACTjB,SAAS,CAAA,EAAA,EAAA,EAAA;IAAAJ,QAAA,eAEbZ,GAAA,CAACkC,mBAA2B,EAAA;AAACF,MAAAA,KAAK,EAAC,MAAM;AAACC,MAAAA,MAAM,EAAC,MAAM;MAAArB,QAAA,eACrDZ,GAAA,CAACmC,SAAiB,EAAA;AAACpB,QAAAA,IAAI,EAAEA,IAAK;AAAAH,QAAAA,QAAA,EAAEM,0BAAAA;OAA8C,CAAA;KACnD,CAAA;AAAC,GAAA,CACvB,CAAC,CAAA;AAEd;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"componentIds.js","sources":["../../../../../../../src/components/Charts/LineChart/componentIds.ts"],"sourcesContent":["export const componentIds = {\n ChartLine: 'ChartLine',\n};\n"],"names":["componentIds","ChartLine"],"mappings":"AAAO,IAAMA,YAAY,GAAG;AAC1BC,EAAAA,SAAS,EAAE,WAAA;AACb;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../src/components/Charts/index.ts"],"sourcesContent":["// Export LineCharts (includes shared components)\nexport * from './LineChart';\nexport * from './CommonChartComponents';\n"],"names":[],"mappings":";;;AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import '../../BladeProvider/index.js';
|
|
2
|
+
import useTheme from '../../BladeProvider/useTheme.js';
|
|
3
|
+
|
|
4
|
+
var useChartsColorTheme = function useChartsColorTheme(_ref) {
|
|
5
|
+
var _ref$colorTheme = _ref.colorTheme,
|
|
6
|
+
colorTheme = _ref$colorTheme === void 0 ? 'default' : _ref$colorTheme;
|
|
7
|
+
var _useTheme = useTheme(),
|
|
8
|
+
theme = _useTheme.theme;
|
|
9
|
+
var defaultColorThemeArray = [theme.colors.chart.background.categorical.azure.subtle, theme.colors.chart.background.categorical.topaz.moderate, theme.colors.chart.background.categorical.orchid.moderate, theme.colors.chart.background.categorical.emerald.subtle, theme.colors.chart.background.categorical.cider.moderate, theme.colors.chart.background.categorical.sapphire.moderate, theme.colors.chart.background.categorical.magenta.moderate, theme.colors.chart.background.categorical.crimson.subtle, theme.colors.chart.background.categorical.azure.intense, theme.colors.chart.background.categorical.topaz.intense, theme.colors.chart.background.categorical.orchid.intense, theme.colors.chart.background.categorical.emerald.intense, theme.colors.chart.background.categorical.sapphire.intense, theme.colors.chart.background.categorical.magenta.intense, theme.colors.chart.background.categorical.cider.intense, theme.colors.chart.background.categorical.crimson.intense];
|
|
10
|
+
if (colorTheme !== 'default') {
|
|
11
|
+
console.log('Currently we only support default color theme');
|
|
12
|
+
}
|
|
13
|
+
//TODO:Currently we only have one color theme will add more color theme later.
|
|
14
|
+
|
|
15
|
+
return defaultColorThemeArray;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { useChartsColorTheme as default };
|
|
19
|
+
//# sourceMappingURL=useColorTheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useColorTheme.js","sources":["../../../../../../../src/components/Charts/utils/useColorTheme.tsx"],"sourcesContent":["import { useTheme } from '~components/BladeProvider';\n\nexport type colorTheme = 'default';\n\nconst useChartsColorTheme = ({ colorTheme = 'default' }: { colorTheme: colorTheme }): string[] => {\n const { theme } = useTheme();\n const defaultColorThemeArray = [\n theme.colors.chart.background.categorical.azure.subtle,\n theme.colors.chart.background.categorical.topaz.moderate,\n theme.colors.chart.background.categorical.orchid.moderate,\n theme.colors.chart.background.categorical.emerald.subtle,\n theme.colors.chart.background.categorical.cider.moderate,\n theme.colors.chart.background.categorical.sapphire.moderate,\n theme.colors.chart.background.categorical.magenta.moderate,\n theme.colors.chart.background.categorical.crimson.subtle,\n theme.colors.chart.background.categorical.azure.intense,\n theme.colors.chart.background.categorical.topaz.intense,\n theme.colors.chart.background.categorical.orchid.intense,\n theme.colors.chart.background.categorical.emerald.intense,\n theme.colors.chart.background.categorical.sapphire.intense,\n theme.colors.chart.background.categorical.magenta.intense,\n theme.colors.chart.background.categorical.cider.intense,\n theme.colors.chart.background.categorical.crimson.intense,\n ];\n\n if (colorTheme !== 'default') {\n console.log('Currently we only support default color theme');\n }\n //TODO:Currently we only have one color theme will add more color theme later.\n\n return defaultColorThemeArray;\n};\n\nexport default useChartsColorTheme;\n"],"names":["useChartsColorTheme","_ref","_ref$colorTheme","colorTheme","_useTheme","useTheme","theme","defaultColorThemeArray","colors","chart","background","categorical","azure","subtle","topaz","moderate","orchid","emerald","cider","sapphire","magenta","crimson","intense","console","log"],"mappings":";;;AAIA,IAAMA,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAAC,IAAA,EAAyE;AAAA,EAAA,IAAAC,eAAA,GAAAD,IAAA,CAAnEE,UAAU;AAAVA,IAAAA,UAAU,GAAAD,eAAA,KAAG,KAAA,CAAA,GAAA,SAAS,GAAAA,eAAA,CAAA;AACnD,EAAA,IAAAE,SAAA,GAAkBC,QAAQ,EAAE;IAApBC,KAAK,GAAAF,SAAA,CAALE,KAAK,CAAA;EACb,IAAMC,sBAAsB,GAAG,CAC7BD,KAAK,CAACE,MAAM,CAACC,KAAK,CAACC,UAAU,CAACC,WAAW,CAACC,KAAK,CAACC,MAAM,EACtDP,KAAK,CAACE,MAAM,CAACC,KAAK,CAACC,UAAU,CAACC,WAAW,CAACG,KAAK,CAACC,QAAQ,EACxDT,KAAK,CA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AAU,KAAK,SAAS,EAAE;AAC5BoB,IAAAA,OAAO,CAACC,GAAG,CAAC,+CAA+C,CAAC,CAAA;AAC9D,GAAA;AACA;;AAEA,EAAA,OAAOjB,sBAAsB,CAAA;AAC/B;;;;"}
|
|
@@ -62,7 +62,7 @@ var StyledAnimatedBaseInputWrapper = /*#__PURE__*/styled(StyledBaseInputWrapper)
|
|
|
62
62
|
displayName: "AnimatedBaseInputWrapperweb__StyledAnimatedBaseInputWrapper",
|
|
63
63
|
componentId: "e1vobd-1"
|
|
64
64
|
})(function (props) {
|
|
65
|
-
return props.isDropdownTrigger && !props.isTableInputCell ? css(["", ";max-height:", ";"], props.
|
|
65
|
+
return props.isDropdownTrigger && !props.isTableInputCell ? css(["", ";max-height:", ";"], props.animationProps, makeSize(getAnimatedBaseInputWrapperMaxHeight({
|
|
66
66
|
maxTagRows: props.maxTagRows,
|
|
67
67
|
showAllTags: props.showAllTags,
|
|
68
68
|
size: props.size
|
|
@@ -78,15 +78,15 @@ var _AnimatedBaseInputWrapper = function _AnimatedBaseInputWrapper(_ref, ref) {
|
|
|
78
78
|
// Define the animation keyframes
|
|
79
79
|
var expandAnimation = /*#__PURE__*/keyframes(["from{max-height:", ";}to{max-height:", ";}"], makeSize(baseInputHeight[rest.size]), makeSize(baseInputWrapperMaxHeight[rest.size]));
|
|
80
80
|
var collapseAnimation = /*#__PURE__*/keyframes(["from{max-height:", ";}to{max-height:", ";}"], makeSize(baseInputWrapperMaxHeight[rest.size]), makeSize(baseInputHeight[rest.size]));
|
|
81
|
-
var
|
|
82
|
-
var
|
|
83
|
-
var
|
|
81
|
+
var expandAnimationProps = /*#__PURE__*/css(["animation:", " ", " ", ";"], expandAnimation, makeMotionTime(motion.duration.quick), String(motion.easing.entrance));
|
|
82
|
+
var collapseAnimationProps = /*#__PURE__*/css(["animation:", " ", " ", ";"], collapseAnimation, makeMotionTime(motion.duration.quick), String(motion.easing.exit));
|
|
83
|
+
var noAnimationProps = /*#__PURE__*/css(["animation:none;"]);
|
|
84
84
|
return /*#__PURE__*/jsx(StyledAnimatedBaseInputWrapper
|
|
85
85
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
86
86
|
, _objectSpread(_objectSpread({
|
|
87
87
|
ref: ref
|
|
88
88
|
}, rest), {}, {
|
|
89
|
-
|
|
89
|
+
animationProps: maxTagRows !== 'expandable' ? noAnimationProps : showAllTags ? expandAnimationProps : collapseAnimationProps,
|
|
90
90
|
height: rest.isTextArea && isDropdownTrigger ? makeSpace(((_rest$numberOfLines = rest.numberOfLines) !== null && _rest$numberOfLines !== void 0 ? _rest$numberOfLines : 0) * baseInputHeight[rest.size]) : undefined,
|
|
91
91
|
cursor: rest.isTextArea && isDropdownTrigger ? 'text' : undefined,
|
|
92
92
|
isDropdownTrigger: isDropdownTrigger,
|
package/build/lib/web/production/components/Input/BaseInput/AnimatedBaseInputWrapper.web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimatedBaseInputWrapper.web.js","sources":["../../../../../../../src/components/Input/BaseInput/AnimatedBaseInputWrapper.web.tsx"],"sourcesContent":["import React from 'react';\nimport type { FlattenSimpleInterpolation } from 'styled-components';\nimport styled, { css, keyframes } from 'styled-components';\nimport type { BaseInputWrapperProps } from './types';\nimport {\n getAnimatedBaseInputWrapperMaxHeight,\n getInputBackgroundAndBorderStyles,\n} from './baseInputStyles';\nimport { baseInputHeight, baseInputWrapperMaxHeight } from './baseInputTokens';\nimport BaseBox from '~components/Box/BaseBox';\nimport { motion } from '~tokens/global';\nimport { castWebType, makeMotionTime, makeSize, makeSpace } from '~utils';\nimport type { BladeElementRef } from '~utils/types';\n\nconst StyledBaseInputWrapper = styled(BaseBox)<\n Pick<\n BaseInputWrapperProps,\n | 'currentInteraction'\n | 'isDisabled'\n | 'validationState'\n | 'isTextArea'\n | 'isDropdownTrigger'\n | 'maxTagRows'\n | 'isTableInputCell'\n >\n>((props) => ({\n ...getInputBackgroundAndBorderStyles({\n theme: props.theme,\n isFocused: props.currentInteraction === 'focus',\n isDisabled: props.isDisabled,\n validationState: props.validationState,\n isTextArea: props.isTextArea,\n isDropdownTrigger: props.isDropdownTrigger,\n isTableInputCell: props.isTableInputCell,\n }),\n '&:hover': {\n ...getInputBackgroundAndBorderStyles({\n theme: props.theme,\n isHovered: true,\n isFocused: props.currentInteraction === 'focus',\n isDisabled: props.isDisabled,\n validationState: props.validationState,\n isDropdownTrigger: props.isDropdownTrigger,\n isTextArea: props.isTextArea,\n isTableInputCell: props.isTableInputCell,\n }),\n transitionProperty: 'background-color',\n transitionDuration: castWebType(makeMotionTime(props.theme.motion.duration.xquick)),\n transitionTimingFunction: castWebType(props.theme.motion.easing.standard),\n },\n ':focus-within': {\n ...getInputBackgroundAndBorderStyles({\n theme: props.theme,\n isFocused: props.currentInteraction === 'focus',\n isDisabled: props.isDisabled,\n validationState: props.validationState,\n isDropdownTrigger: props.isDropdownTrigger,\n isTextArea: props.isTextArea,\n isTableInputCell: props.isTableInputCell,\n }),\n },\n}));\n\n// Styled component with animation\nconst StyledAnimatedBaseInputWrapper = styled(StyledBaseInputWrapper)<{\n transition?: FlattenSimpleInterpolation;\n maxTagRows: BaseInputWrapperProps['maxTagRows'];\n showAllTags: BaseInputWrapperProps['showAllTags'];\n isDropdownTrigger: BaseInputWrapperProps['isDropdownTrigger'];\n size: NonNullable<BaseInputWrapperProps['size']>;\n}>((props) =>\n props.isDropdownTrigger && !props.isTableInputCell\n ? css`\n ${props.transition};\n max-height: ${makeSize(\n getAnimatedBaseInputWrapperMaxHeight({\n maxTagRows: props.maxTagRows,\n showAllTags: props.showAllTags,\n size: props.size,\n }),\n )};\n `\n : undefined,\n);\n\nconst _AnimatedBaseInputWrapper: React.ForwardRefRenderFunction<\n BladeElementRef,\n BaseInputWrapperProps & {\n showAllTags?: boolean;\n }\n> = (\n { showAllTags, setShowAllTagsWithAnimation, maxTagRows, isDropdownTrigger, ...rest },\n ref,\n): React.ReactElement => {\n // Define the animation keyframes\n const expandAnimation = keyframes`\nfrom {\n max-height: ${makeSize(baseInputHeight[rest.size])};\n}\nto {\n max-height: ${makeSize(baseInputWrapperMaxHeight[rest.size])};\n}\n`;\n\n const collapseAnimation = keyframes`\nfrom {\n max-height: ${makeSize(baseInputWrapperMaxHeight[rest.size])};\n}\nto {\n max-height: ${makeSize(baseInputHeight[rest.size])};\n}\n`;\n\n const expandTransition = css`\n animation: ${expandAnimation} ${makeMotionTime(motion.duration.quick)}\n ${String(motion.easing.entrance)};\n `;\n\n const collapseTransition = css`\n animation: ${collapseAnimation} ${makeMotionTime(motion.duration.quick)}\n ${String(motion.easing.exit)};\n `;\n\n const noTransition = css`\n animation: none;\n `;\n return (\n <StyledAnimatedBaseInputWrapper\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref={ref as any}\n {...rest}\n transition={\n maxTagRows !== 'expandable'\n ? noTransition\n : showAllTags\n ? expandTransition\n : collapseTransition\n }\n height={\n rest.isTextArea && isDropdownTrigger\n ? makeSpace((rest.numberOfLines ?? 0) * baseInputHeight[rest.size])\n : undefined\n }\n cursor={rest.isTextArea && isDropdownTrigger ? 'text' : undefined}\n isDropdownTrigger={isDropdownTrigger}\n showAllTags={showAllTags}\n maxTagRows={maxTagRows}\n onAnimationEnd={(e) => {\n if (!showAllTags && e.animationName === collapseAnimation.getName()) {\n // Triggered for the collapse animation\n setShowAllTagsWithAnimation?.(false);\n }\n }}\n isTableInputCell={rest.isTableInputCell}\n className=\"__blade-base-input-wrapper\"\n />\n );\n};\n\nconst AnimatedBaseInputWrapper = React.forwardRef(_AnimatedBaseInputWrapper);\n\nexport { AnimatedBaseInputWrapper };\n"],"names":["StyledBaseInputWrapper","styled","BaseBox","withConfig","displayName","componentId","props","_objectSpread","getInputBackgroundAndBorderStyles","theme","isFocused","currentInteraction","isDisabled","validationState","isTextArea","isDropdownTrigger","isTableInputCell","isHovered","transitionProperty","transitionDuration","castWebType","makeMotionTime","motion","duration","xquick","transitionTimingFunction","easing","standard","StyledAnimatedBaseInputWrapper","css","transition","makeSize","getAnimatedBaseInputWrapperMaxHeight","maxTagRows","showAllTags","size","undefined","_AnimatedBaseInputWrapper","_ref","ref","_rest$numberOfLines","setShowAllTagsWithAnimation","rest","_objectWithoutProperties","_excluded","expandAnimation","keyframes","baseInputHeight","baseInputWrapperMaxHeight","collapseAnimation","expandTransition","quick","String","entrance","collapseTransition","exit","noTransition","_jsx","height","makeSpace","numberOfLines","cursor","onAnimationEnd","e","animationName","getName","className","AnimatedBaseInputWrapper","React","forwardRef"],"mappings":";;;;;;;;;;;;;;;;;;;;AAcA,IAAMA,sBAAsB,gBAAGC,MAAM,CAACC,OAAO,CAAC,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,qDAAA;EAAAC,WAAA,EAAA,UAAA;AAAA,CAAA,CAAA,CAW5C,UAACC,KAAK,EAAA;AAAA,EAAA,OAAAC,aAAA,CAAAA,aAAA,CAAA,EAAA,EACHC,iCAAiC,CAAC;IACnCC,KAAK,EAAEH,KAAK,CAACG,KAAK;AAClBC,IAAAA,SAAS,EAAEJ,KAAK,CAACK,kBAAkB,KAAK,OAAO;IAC/CC,UAAU,EAAEN,KAAK,CAACM,UAAU;IAC5BC,eAAe,EAAEP,KAAK,CAACO,eAAe;IACtCC,UAAU,EAAER,KAAK,CAACQ,UAAU;IAC5BC,iBAAiB,EAAET,KAAK,CAACS,iBAAiB;IAC1CC,gBAAgB,EAAEV,KAAK,CAACU,gBAAAA;AAC1B,GAAC,CAAC,CAAA,EAAA,EAAA,EAAA;AACF,IAAA,SAAS,EAAAT,aAAA,CAAAA,aAAA,CAAA,EAAA,EACJC,iCAAiC,CAAC;MACnCC,KAAK,EAAEH,KAAK,CAACG,KAAK;AAClBQ,MAAAA,SAAS,EAAE,IAAI;AACfP,MAAAA,SAAS,EAAEJ,KAAK,CAACK,kBAAkB,KAAK,OAAO;MAC/CC,UAAU,EAAEN,KAAK,CAACM,UAAU;MAC5BC,eAAe,EAAEP,KAAK,CAACO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AiB,CAACgB,OAAO,EAAE,EAAE;AACnE;AACAxB,QAAAA,2BAA2B,aAA3BA,2BAA2B,KAAA,KAAA,CAAA,IAA3BA,2BAA2B,CAAG,KAAK,CAAC,CAAA;AACtC,OAAA;KACA;IACFzB,gBAAgB,EAAE0B,IAAI,CAAC1B,gBAAiB;AACxCkD,IAAAA,SAAS,EAAC,4BAAA;AAA4B,GAAA,CACvC,CAAC,CAAA;AAEN,CAAC,CAAA;AAED,IAAMC,wBAAwB,gBAAGC,cAAK,CAACC,UAAU,CAAChC,yBAAyB;;;;"}
|
|
1
|
+
{"version":3,"file":"AnimatedBaseInputWrapper.web.js","sources":["../../../../../../../src/components/Input/BaseInput/AnimatedBaseInputWrapper.web.tsx"],"sourcesContent":["import React from 'react';\nimport type { FlattenSimpleInterpolation } from 'styled-components';\nimport styled, { css, keyframes } from 'styled-components';\nimport type { BaseInputWrapperProps } from './types';\nimport {\n getAnimatedBaseInputWrapperMaxHeight,\n getInputBackgroundAndBorderStyles,\n} from './baseInputStyles';\nimport { baseInputHeight, baseInputWrapperMaxHeight } from './baseInputTokens';\nimport BaseBox from '~components/Box/BaseBox';\nimport { motion } from '~tokens/global';\nimport { castWebType, makeMotionTime, makeSize, makeSpace } from '~utils';\nimport type { BladeElementRef } from '~utils/types';\n\nconst StyledBaseInputWrapper = styled(BaseBox)<\n Pick<\n BaseInputWrapperProps,\n | 'currentInteraction'\n | 'isDisabled'\n | 'validationState'\n | 'isTextArea'\n | 'isDropdownTrigger'\n | 'maxTagRows'\n | 'isTableInputCell'\n >\n>((props) => ({\n ...getInputBackgroundAndBorderStyles({\n theme: props.theme,\n isFocused: props.currentInteraction === 'focus',\n isDisabled: props.isDisabled,\n validationState: props.validationState,\n isTextArea: props.isTextArea,\n isDropdownTrigger: props.isDropdownTrigger,\n isTableInputCell: props.isTableInputCell,\n }),\n '&:hover': {\n ...getInputBackgroundAndBorderStyles({\n theme: props.theme,\n isHovered: true,\n isFocused: props.currentInteraction === 'focus',\n isDisabled: props.isDisabled,\n validationState: props.validationState,\n isDropdownTrigger: props.isDropdownTrigger,\n isTextArea: props.isTextArea,\n isTableInputCell: props.isTableInputCell,\n }),\n transitionProperty: 'background-color',\n transitionDuration: castWebType(makeMotionTime(props.theme.motion.duration.xquick)),\n transitionTimingFunction: castWebType(props.theme.motion.easing.standard),\n },\n ':focus-within': {\n ...getInputBackgroundAndBorderStyles({\n theme: props.theme,\n isFocused: props.currentInteraction === 'focus',\n isDisabled: props.isDisabled,\n validationState: props.validationState,\n isDropdownTrigger: props.isDropdownTrigger,\n isTextArea: props.isTextArea,\n isTableInputCell: props.isTableInputCell,\n }),\n },\n}));\n\n// Styled component with animation\nconst StyledAnimatedBaseInputWrapper = styled(StyledBaseInputWrapper)<{\n animationProps?: FlattenSimpleInterpolation;\n maxTagRows: BaseInputWrapperProps['maxTagRows'];\n showAllTags: BaseInputWrapperProps['showAllTags'];\n isDropdownTrigger: BaseInputWrapperProps['isDropdownTrigger'];\n size: NonNullable<BaseInputWrapperProps['size']>;\n}>((props) =>\n props.isDropdownTrigger && !props.isTableInputCell\n ? css`\n ${props.animationProps};\n max-height: ${makeSize(\n getAnimatedBaseInputWrapperMaxHeight({\n maxTagRows: props.maxTagRows,\n showAllTags: props.showAllTags,\n size: props.size,\n }),\n )};\n `\n : undefined,\n);\n\nconst _AnimatedBaseInputWrapper: React.ForwardRefRenderFunction<\n BladeElementRef,\n BaseInputWrapperProps & {\n showAllTags?: boolean;\n }\n> = (\n { showAllTags, setShowAllTagsWithAnimation, maxTagRows, isDropdownTrigger, ...rest },\n ref,\n): React.ReactElement => {\n // Define the animation keyframes\n const expandAnimation = keyframes`\nfrom {\n max-height: ${makeSize(baseInputHeight[rest.size])};\n}\nto {\n max-height: ${makeSize(baseInputWrapperMaxHeight[rest.size])};\n}\n`;\n\n const collapseAnimation = keyframes`\nfrom {\n max-height: ${makeSize(baseInputWrapperMaxHeight[rest.size])};\n}\nto {\n max-height: ${makeSize(baseInputHeight[rest.size])};\n}\n`;\n\n const expandAnimationProps = css`\n animation: ${expandAnimation} ${makeMotionTime(motion.duration.quick)}\n ${String(motion.easing.entrance)};\n `;\n\n const collapseAnimationProps = css`\n animation: ${collapseAnimation} ${makeMotionTime(motion.duration.quick)}\n ${String(motion.easing.exit)};\n `;\n\n const noAnimationProps = css`\n animation: none;\n `;\n return (\n <StyledAnimatedBaseInputWrapper\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref={ref as any}\n {...rest}\n animationProps={\n maxTagRows !== 'expandable'\n ? noAnimationProps\n : showAllTags\n ? expandAnimationProps\n : collapseAnimationProps\n }\n height={\n rest.isTextArea && isDropdownTrigger\n ? makeSpace((rest.numberOfLines ?? 0) * baseInputHeight[rest.size])\n : undefined\n }\n cursor={rest.isTextArea && isDropdownTrigger ? 'text' : undefined}\n isDropdownTrigger={isDropdownTrigger}\n showAllTags={showAllTags}\n maxTagRows={maxTagRows}\n onAnimationEnd={(e) => {\n if (!showAllTags && e.animationName === collapseAnimation.getName()) {\n // Triggered for the collapse animation\n setShowAllTagsWithAnimation?.(false);\n }\n }}\n isTableInputCell={rest.isTableInputCell}\n className=\"__blade-base-input-wrapper\"\n />\n );\n};\n\nconst AnimatedBaseInputWrapper = React.forwardRef(_AnimatedBaseInputWrapper);\n\nexport { AnimatedBaseInputWrapper };\n"],"names":["StyledBaseInputWrapper","styled","BaseBox","withConfig","displayName","componentId","props","_objectSpread","getInputBackgroundAndBorderStyles","theme","isFocused","currentInteraction","isDisabled","validationState","isTextArea","isDropdownTrigger","isTableInputCell","isHovered","transitionProperty","transitionDuration","castWebType","makeMotionTime","motion","duration","xquick","transitionTimingFunction","easing","standard","StyledAnimatedBaseInputWrapper","css","animationProps","makeSize","getAnimatedBaseInputWrapperMaxHeight","maxTagRows","showAllTags","size","undefined","_AnimatedBaseInputWrapper","_ref","ref","_rest$numberOfLines","setShowAllTagsWithAnimation","rest","_objectWithoutProperties","_excluded","expandAnimation","keyframes","baseInputHeight","baseInputWrapperMaxHeight","collapseAnimation","expandAnimationProps","quick","String","entrance","collapseAnimationProps","exit","noAnimationProps","_jsx","height","makeSpace","numberOfLines","cursor","onAnimationEnd","e","animationName","getName","className","AnimatedBaseInputWrapper","React","forwardRef"],"mappings":";;;;;;;;;;;;;;;;;;;;AAcA,IAAMA,sBAAsB,gBAAGC,MAAM,CAACC,OAAO,CAAC,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,qDAAA;EAAAC,WAAA,EAAA,UAAA;AAAA,CAAA,CAAA,CAW5C,UAACC,KAAK,EAAA;AAAA,EAAA,OAAAC,aAAA,CAAAA,aAAA,CAAA,EAAA,EACHC,iCAAiC,CAAC;IACnCC,KAAK,EAAEH,KAAK,CAACG,KAAK;AAClBC,IAAAA,SAAS,EAAEJ,KAAK,CAACK,kBAAkB,KAAK,OAAO;IAC/CC,UAAU,EAAEN,KAAK,CAACM,UAAU;IAC5BC,eAAe,EAAEP,KAAK,CAACO,eAAe;IACtCC,UAAU,EAAER,KAAK,CAACQ,UAAU;IAC5BC,iBAAiB,EAAET,KAAK,CAACS,iBAAiB;IAC1CC,gBAAgB,EAAEV,KAAK,CAACU,gBAAAA;AAC1B,GAAC,CAAC,CAAA,EAAA,EAAA,EAAA;AACF,IAAA,SAAS,EAAAT,aAAA,CAAAA,aAAA,CAAA,EAAA,EACJC,iCAAiC,CAAC;MACnCC,KAAK,EAAEH,KAAK,CAACG,KAAK;AAClBQ,MAAAA,SAAS,EAAE,IAAI;AACfP,MAAAA,SAAS,EAAEJ,KAAK,CAACK,kBAAkB,KAAK,OAAO;MAC/CC,UAAU,EAAEN,KAAK,CAACM,UAAU;MAC5BC,eAAe,EAAEP,KAAK,CAACO,eAAe;MACtCE,iBAAiB,EAAET,KAAK,CAACS,iBAAiB;MAC1CD,UAAU,EAAER,KAAK,CAACQ,UAAU;MAC5BE,gBAAgB,EAAEV,KAAK,CAACU,gBAAAA;AAC1B,KAAC,CAAC,CAAA,EAAA,EAAA,EAAA;AACFE,MAAAA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,CAAC1B,gBAAiB;AACxCkD,IAAAA,SAAS,EAAC,4BAAA;AAA4B,GAAA,CACvC,CAAC,CAAA;AAEN,CAAC,CAAA;AAED,IAAMC,wBAAwB,gBAAGC,cAAK,CAACC,UAAU,CAAChC,yBAAyB;;;;"}
|
|
@@ -17,7 +17,7 @@ var AnimatedTagContainer = /*#__PURE__*/styled(BaseBox).withConfig({
|
|
|
17
17
|
displayName: "AnimatedTagweb__AnimatedTagContainer",
|
|
18
18
|
componentId: "sc-1ypkpkt-0"
|
|
19
19
|
})(function (props) {
|
|
20
|
-
return css(["", ";display:inline-block;opacity:", ";max-width:", ";flex-shrink:0;"], props.
|
|
20
|
+
return css(["", ";display:inline-block;opacity:", ";max-width:", ";flex-shrink:0;"], props.animationProps, props.isVisible ? TAG_OPACITY_START : TAG_OPACITY_END, props.isVisible ? TAG_MAX_WIDTH_START : TAG_MAX_WIDTH_END);
|
|
21
21
|
});
|
|
22
22
|
var AnimatedTag = function AnimatedTag(_ref) {
|
|
23
23
|
var children = _ref.children,
|
|
@@ -33,8 +33,8 @@ var AnimatedTag = function AnimatedTag(_ref) {
|
|
|
33
33
|
setIsTagVisible = _React$useState2[1];
|
|
34
34
|
var _useTheme = useTheme(),
|
|
35
35
|
theme = _useTheme.theme;
|
|
36
|
-
var
|
|
37
|
-
var
|
|
36
|
+
var hideTagAnimationProps = /*#__PURE__*/css(["animation:", " ", " ", ";"], tagDissappearKeyframe, makeMotionTime(theme.motion.duration.xquick), String(theme.motion.easing.exit));
|
|
37
|
+
var showTagAnimationProps = /*#__PURE__*/css(["animation:", " ", " ", ";"], tagShowKeyframe, makeMotionTime(theme.motion.duration.xquick), String(theme.motion.easing.entrance));
|
|
38
38
|
return /*#__PURE__*/jsx(AnimatedTagContainer, {
|
|
39
39
|
isVisible: isTagVisible,
|
|
40
40
|
onAnimationEnd: function onAnimationEnd() {
|
|
@@ -45,7 +45,7 @@ var AnimatedTag = function AnimatedTag(_ref) {
|
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
|
-
|
|
48
|
+
animationProps: isTagVisible ? showTagAnimationProps : hideTagAnimationProps,
|
|
49
49
|
children: /*#__PURE__*/jsx(Tag, {
|
|
50
50
|
_isVirtuallyFocused: currentTagIndex === activeTagIndex,
|
|
51
51
|
_isTagInsideInput: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimatedTag.web.js","sources":["../../../../../../src/components/Tag/AnimatedTag.web.tsx"],"sourcesContent":["import React from 'react';\nimport type { FlattenSimpleInterpolation } from 'styled-components';\nimport styled, { css, keyframes } from 'styled-components';\nimport { Tag } from './Tag';\nimport type { AnimatedTagProps } from './types';\nimport {\n TAG_MAX_WIDTH_END,\n TAG_MAX_WIDTH_START,\n TAG_OPACITY_END,\n TAG_OPACITY_START,\n} from './tagAnimationConfig';\nimport BaseBox from '~components/Box/BaseBox';\nimport { useTheme } from '~components/BladeProvider';\nimport { makeMotionTime } from '~utils';\n\nconst tagDissappearKeyframe = keyframes`\n 0% {\n opacity: ${TAG_OPACITY_START};\n max-width: ${TAG_MAX_WIDTH_START}\n }\n\n 100% {\n opacity: ${TAG_OPACITY_END};\n max-width: ${TAG_MAX_WIDTH_END};\n }\n`;\n\nconst tagShowKeyframe = keyframes`\n 0% {\n opacity: ${TAG_OPACITY_END};\n }\n\n 100% {\n opacity: ${TAG_OPACITY_START};\n }\n`;\n\nconst AnimatedTagContainer = styled(BaseBox)<{\n
|
|
1
|
+
{"version":3,"file":"AnimatedTag.web.js","sources":["../../../../../../src/components/Tag/AnimatedTag.web.tsx"],"sourcesContent":["import React from 'react';\nimport type { FlattenSimpleInterpolation } from 'styled-components';\nimport styled, { css, keyframes } from 'styled-components';\nimport { Tag } from './Tag';\nimport type { AnimatedTagProps } from './types';\nimport {\n TAG_MAX_WIDTH_END,\n TAG_MAX_WIDTH_START,\n TAG_OPACITY_END,\n TAG_OPACITY_START,\n} from './tagAnimationConfig';\nimport BaseBox from '~components/Box/BaseBox';\nimport { useTheme } from '~components/BladeProvider';\nimport { makeMotionTime } from '~utils';\n\nconst tagDissappearKeyframe = keyframes`\n 0% {\n opacity: ${TAG_OPACITY_START};\n max-width: ${TAG_MAX_WIDTH_START}\n }\n\n 100% {\n opacity: ${TAG_OPACITY_END};\n max-width: ${TAG_MAX_WIDTH_END};\n }\n`;\n\nconst tagShowKeyframe = keyframes`\n 0% {\n opacity: ${TAG_OPACITY_END};\n }\n\n 100% {\n opacity: ${TAG_OPACITY_START};\n }\n`;\n\nconst AnimatedTagContainer = styled(BaseBox)<{\n animationProps: FlattenSimpleInterpolation;\n isVisible: boolean;\n}>(\n (props) => css`\n ${props.animationProps};\n display: inline-block;\n opacity: ${props.isVisible ? TAG_OPACITY_START : TAG_OPACITY_END};\n max-width: ${props.isVisible ? TAG_MAX_WIDTH_START : TAG_MAX_WIDTH_END};\n flex-shrink: 0;\n `,\n);\n\nconst AnimatedTag = ({\n children,\n currentTagIndex,\n isDisabled,\n activeTagIndex,\n onDismiss,\n size = 'medium',\n}: AnimatedTagProps): React.ReactElement => {\n const [isTagVisible, setIsTagVisible] = React.useState(true);\n const { theme } = useTheme();\n\n const hideTagAnimationProps = css`\n animation: ${tagDissappearKeyframe} ${makeMotionTime(theme.motion.duration.xquick)}\n ${String(theme.motion.easing.exit)};\n `;\n\n const showTagAnimationProps = css`\n animation: ${tagShowKeyframe} ${makeMotionTime(theme.motion.duration.xquick)}\n ${String(theme.motion.easing.entrance)};\n `;\n\n return (\n <AnimatedTagContainer\n isVisible={isTagVisible}\n onAnimationEnd={() => {\n if (!isTagVisible) {\n onDismiss({ tagIndex: currentTagIndex, tagName: children });\n }\n }}\n animationProps={isTagVisible ? showTagAnimationProps : hideTagAnimationProps}\n >\n <Tag\n _isVirtuallyFocused={currentTagIndex === activeTagIndex}\n _isTagInsideInput={true}\n onDismiss={() => {\n setIsTagVisible(false);\n }}\n marginRight=\"spacing.3\"\n marginY=\"spacing.2\"\n isDisabled={isDisabled}\n size={size}\n >\n {children}\n </Tag>\n </AnimatedTagContainer>\n );\n};\n\nexport { AnimatedTag };\n"],"names":["tagDissappearKeyframe","keyframes","TAG_OPACITY_START","TAG_MAX_WIDTH_START","TAG_OPACITY_END","TAG_MAX_WIDTH_END","tagShowKeyframe","AnimatedTagContainer","styled","BaseBox","withConfig","displayName","componentId","props","css","animationProps","isVisible","AnimatedTag","_ref","children","currentTagIndex","isDisabled","activeTagIndex","onDismiss","_ref$size","size","_React$useState","React","useState","_React$useState2","_slicedToArray","isTagVisible","setIsTagVisible","_useTheme","useTheme","theme","hideTagAnimationProps","makeMotionTime","motion","duration","xquick","String","easing","exit","showTagAnimationProps","entrance","_jsx","onAnimationEnd","tagIndex","tagName","Tag","_isVirtuallyFocused","_isTagInsideInput","marginRight","marginY"],"mappings":";;;;;;;;;;;;;AAeA,IAAMA,qBAAqB,gBAAGC,SAAS,CAExBC,CAAAA,aAAAA,EAAAA,aAAAA,EAAAA,gBAAAA,EAAAA,aAAAA,EAAAA,IAAAA,CAAAA,EAAAA,iBAAiB,EACfC,mBAAmB,EAIrBC,eAAe,EACbC,iBAAiB,CAEjC,CAAA;AAED,IAAMC,eAAe,gBAAGL,SAAS,2CAElBG,eAAe,EAIfF,iBAAiB,CAE/B,CAAA;AAED,IAAMK,oBAAoB,gBAAGC,MAAM,CAACC,OAAO,CAAC,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,sCAAA;EAAAC,WAAA,EAAA,cAAA;AAAA,CAAA,CAAA,CAI1C,UAACC,KAAK,EAAA;EAAA,OAAKC,GAAG,2EACVD,KAAK,CAACE,cAAc,EAEXF,KAAK,CAACG,SAAS,GAAGd,iBAAiB,GAAGE,eAAe,EACnDS,KAAK,CAACG,SAAS,GAAGb,mBAAmB,GAAGE,iBAAiB,CAAA,CAAA;AAAA,CAEvE,CACF,CAAA;AAED,IAAMY,WAAW,GAAG,SAAdA,WAAWA,CAAAC,IAAA,EAO2B;AAAA,EAAA,IAN1CC,QAAQ,GAAAD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,SAAS,EAAEe,YAAa;AACxBgB,IAAAA,cAAc,EAAE,SAAhBA,cAAcA,GAAQ;MACpB,IAAI,CAAChB,YAAY,EAAE;AACjBR,QAAAA,SAAS,CAAC;AAAEyB,UAAAA,QAAQ,EAAE5B,eAAe;AAAE6B,UAAAA,OAAO,EAAE9B,QAAAA;AAAS,SAAC,CAAC,CAAA;AAC7D,OAAA;KACA;AACFJ,IAAAA,cAAc,EAAEgB,YAAY,GAAGa,qBAAqB,GAAGR,qBAAsB;IAAAjB,QAAA,eAE7E2B,GAAA,CAACI,GAAG,EAAA;MACFC,mBAAmB,EAAE/B,eAAe,KAAKE,cAAe;AACxD8B,MAAAA,iBAAiB,EAAE,IAAK;AACxB7B,MAAAA,SAAS,EAAE,SAAXA,SAASA,GAAQ;QACfS,eAAe,CAAC,KAAK,CAAC,CAAA;OACtB;AACFqB,MAAAA,WAAW,EAAC,WAAW;AACvBC,MAAAA,OAAO,EAAC,WAAW;AACnBjC,MAAAA,UAAU,EAAEA,UAAW;AACvBI,MAAAA,IAAI,EAAEA,IAAK;AAAAN,MAAAA,QAAA,EAEVA,QAAAA;KACE,CAAA;AAAC,GACc,CAAC,CAAA;AAE3B;;;;"}
|
|
@@ -17,6 +17,7 @@ import './Card/index.js';
|
|
|
17
17
|
import './Carousel/index.js';
|
|
18
18
|
import './Checkbox/index.js';
|
|
19
19
|
import './ChatMessage/index.js';
|
|
20
|
+
import './Charts/index.js';
|
|
20
21
|
import './Chip/index.js';
|
|
21
22
|
import './Collapsible/index.js';
|
|
22
23
|
import './Counter/index.js';
|
|
@@ -106,6 +107,8 @@ export { CarouselItem } from './Carousel/CarouselItem.web.js';
|
|
|
106
107
|
export { Checkbox } from './Checkbox/Checkbox.js';
|
|
107
108
|
export { CheckboxGroup } from './Checkbox/CheckboxGroup/CheckboxGroup.js';
|
|
108
109
|
export { ChatMessage } from './ChatMessage/ChatMessage.web.js';
|
|
110
|
+
export { ChartLine, ChartLineWrapper } from './Charts/LineChart/LineChart.web.js';
|
|
111
|
+
export { ChartCartesianGrid, ChartLegend, ChartReferenceLine, ChartTooltip, ChartXAxis, ChartYAxis } from './Charts/CommonChartComponents/CommonChartComponents.web.js';
|
|
109
112
|
export { Chip } from './Chip/Chip.js';
|
|
110
113
|
export { ChipGroup } from './Chip/ChipGroup.js';
|
|
111
114
|
export { Collapsible } from './Collapsible/Collapsible.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|