@neo4j-ndl/react 4.14.1 → 4.14.3
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/lib/cjs/_common/component-docs-page.js +72 -0
- package/lib/cjs/_common/component-docs-page.js.map +1 -0
- package/lib/cjs/data-grid/Components.js +3 -1
- package/lib/cjs/data-grid/Components.js.map +1 -1
- package/lib/cjs/data-grid/DataGrid.js +2 -1
- package/lib/cjs/data-grid/DataGrid.js.map +1 -1
- package/lib/cjs/data-grid/data-grid-context.js.map +1 -1
- package/lib/cjs/data-grid/index.js +14 -1
- package/lib/cjs/data-grid/index.js.map +1 -1
- package/lib/cjs/data-grid/stories/datagrid-custom-cell-with-style-rules.story.js +142 -0
- package/lib/cjs/data-grid/stories/datagrid-custom-cell-with-style-rules.story.js.map +1 -0
- package/lib/cjs/data-grid/stories/datagrid-rule-based-styling.story.js +133 -0
- package/lib/cjs/data-grid/stories/datagrid-rule-based-styling.story.js.map +1 -0
- package/lib/cjs/data-grid/stories/index.js +9 -1
- package/lib/cjs/data-grid/stories/index.js.map +1 -1
- package/lib/cjs/data-grid/style-rules/evaluate.js +283 -0
- package/lib/cjs/data-grid/style-rules/evaluate.js.map +1 -0
- package/lib/cjs/data-grid/style-rules/hooks.js +45 -0
- package/lib/cjs/data-grid/style-rules/hooks.js.map +1 -0
- package/lib/cjs/data-grid/style-rules/index.js +37 -0
- package/lib/cjs/data-grid/style-rules/index.js.map +1 -0
- package/lib/cjs/data-grid/style-rules/types.js +158 -0
- package/lib/cjs/data-grid/style-rules/types.js.map +1 -0
- package/lib/cjs/graph-label/GraphLabel.js +9 -8
- package/lib/cjs/graph-label/GraphLabel.js.map +1 -1
- package/lib/cjs/index.js +3 -8
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/_common/component-docs-page.js +69 -0
- package/lib/esm/_common/component-docs-page.js.map +1 -0
- package/lib/esm/data-grid/Components.js +3 -1
- package/lib/esm/data-grid/Components.js.map +1 -1
- package/lib/esm/data-grid/DataGrid.js +2 -1
- package/lib/esm/data-grid/DataGrid.js.map +1 -1
- package/lib/esm/data-grid/data-grid-context.js.map +1 -1
- package/lib/esm/data-grid/index.js +3 -0
- package/lib/esm/data-grid/index.js.map +1 -1
- package/lib/esm/data-grid/stories/datagrid-custom-cell-with-style-rules.story.js +140 -0
- package/lib/esm/data-grid/stories/datagrid-custom-cell-with-style-rules.story.js.map +1 -0
- package/lib/esm/data-grid/stories/datagrid-rule-based-styling.story.js +131 -0
- package/lib/esm/data-grid/stories/datagrid-rule-based-styling.story.js.map +1 -0
- package/lib/esm/data-grid/stories/index.js +6 -0
- package/lib/esm/data-grid/stories/index.js.map +1 -1
- package/lib/esm/data-grid/style-rules/evaluate.js +279 -0
- package/lib/esm/data-grid/style-rules/evaluate.js.map +1 -0
- package/lib/esm/data-grid/style-rules/hooks.js +42 -0
- package/lib/esm/data-grid/style-rules/hooks.js.map +1 -0
- package/lib/esm/data-grid/style-rules/index.js +24 -0
- package/lib/esm/data-grid/style-rules/index.js.map +1 -0
- package/lib/esm/data-grid/style-rules/types.js +155 -0
- package/lib/esm/data-grid/style-rules/types.js.map +1 -0
- package/lib/esm/graph-label/GraphLabel.js +9 -8
- package/lib/esm/graph-label/GraphLabel.js.map +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/types/_common/{readme-docs-page.d.ts → component-docs-page.d.ts} +2 -2
- package/lib/types/_common/component-docs-page.d.ts.map +1 -0
- package/lib/types/data-grid/Components.d.ts.map +1 -1
- package/lib/types/data-grid/DataGrid.d.ts +4 -1
- package/lib/types/data-grid/DataGrid.d.ts.map +1 -1
- package/lib/types/data-grid/data-grid-context.d.ts +2 -0
- package/lib/types/data-grid/data-grid-context.d.ts.map +1 -1
- package/lib/types/data-grid/index.d.ts +4 -0
- package/lib/types/data-grid/index.d.ts.map +1 -1
- package/lib/types/data-grid/stories/datagrid-custom-cell-with-style-rules.story.d.ts +24 -0
- package/lib/types/data-grid/stories/datagrid-custom-cell-with-style-rules.story.d.ts.map +1 -0
- package/lib/types/data-grid/stories/datagrid-pinned-columns.stories.d.ts +2 -2
- package/lib/types/data-grid/stories/datagrid-rule-based-styling.story.d.ts +24 -0
- package/lib/types/data-grid/stories/datagrid-rule-based-styling.story.d.ts.map +1 -0
- package/lib/types/data-grid/stories/datagrid-search-and-filters.stories.d.ts +2 -2
- package/lib/types/data-grid/stories/index.d.ts +4 -0
- package/lib/types/data-grid/stories/index.d.ts.map +1 -1
- package/lib/types/data-grid/style-rules/evaluate.d.ts +41 -0
- package/lib/types/data-grid/style-rules/evaluate.d.ts.map +1 -0
- package/lib/types/data-grid/style-rules/hooks.d.ts +27 -0
- package/lib/types/data-grid/style-rules/hooks.d.ts.map +1 -0
- package/lib/types/data-grid/style-rules/index.d.ts +25 -0
- package/lib/types/data-grid/style-rules/index.d.ts.map +1 -0
- package/lib/types/data-grid/style-rules/types.d.ts +161 -0
- package/lib/types/data-grid/style-rules/types.d.ts.map +1 -0
- package/lib/types/graph-label/GraphLabel.d.ts.map +1 -1
- package/lib/types/index.d.ts +1 -1
- package/lib/types/index.d.ts.map +1 -1
- package/package.json +4 -3
- package/lib/cjs/_common/readme-docs-page.js +0 -55
- package/lib/cjs/_common/readme-docs-page.js.map +0 -1
- package/lib/esm/_common/readme-docs-page.js +0 -52
- package/lib/esm/_common/readme-docs-page.js.map +0 -1
- package/lib/types/_common/readme-docs-page.d.ts.map +0 -1
|
@@ -52,17 +52,14 @@ const HexagonEnd = ({ direction = 'left', color, htmlAttributes, height = 24, })
|
|
|
52
52
|
'ndl-left': direction === 'left',
|
|
53
53
|
'ndl-right': direction === 'right',
|
|
54
54
|
});
|
|
55
|
-
return ((0, jsx_runtime_1.
|
|
55
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: classes }, htmlAttributes, { children: (0, jsx_runtime_1.jsx)("svg", { "aria-hidden": true, className: "ndl-hexagon-end-inner", fill: "none", height: height, preserveAspectRatio: "none", viewBox: "0 0 9 24", width: "9", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { style: { fill: color }, fillRule: "evenodd", clipRule: "evenodd", d: "M5.73024 1.03676C6.08165 0.397331 6.75338 0 7.48301 0H9V24H7.483C6.75338 24 6.08165 23.6027 5.73024 22.9632L0.315027 13.1094C-0.105009 12.4376 -0.105009 11.5624 0.315026 10.8906L5.73024 1.03676Z" }) }) })));
|
|
56
56
|
};
|
|
57
|
-
const SquareEnd = ({ direction = 'left', color,
|
|
57
|
+
const SquareEnd = ({ direction = 'left', color, htmlAttributes, }) => {
|
|
58
58
|
const classes = (0, classnames_1.default)('ndl-square-end', {
|
|
59
59
|
'ndl-left': direction === 'left',
|
|
60
60
|
'ndl-right': direction === 'right',
|
|
61
61
|
});
|
|
62
|
-
return ((0, jsx_runtime_1.
|
|
63
|
-
};
|
|
64
|
-
const HorizontalLines = ({ height = 24 }) => {
|
|
65
|
-
return ((0, jsx_runtime_1.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", height: height + 6, preserveAspectRatio: "none", viewBox: "0 0 37 30", fill: "none", className: "ndl-relationship-label-lines", children: [(0, jsx_runtime_1.jsx)("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M 37 2 H 0 V 0 H 37 V 2 Z" }), (0, jsx_runtime_1.jsx)("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M 37 30 H 0 V 28 H 37 V 30 Z" })] }));
|
|
62
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: classes }, htmlAttributes, { children: (0, jsx_runtime_1.jsx)("div", { className: "ndl-square-end-inner", style: { backgroundColor: color } }) })));
|
|
66
63
|
};
|
|
67
64
|
/**
|
|
68
65
|
*
|
|
@@ -144,15 +141,19 @@ const GraphLabel = (_a) => {
|
|
|
144
141
|
type === 'relationshipRight') {
|
|
145
142
|
const classes = (0, classnames_1.default)('ndl-relationship-label', commonClasses);
|
|
146
143
|
const height = size === 'small' ? 20 : 24;
|
|
144
|
+
const focusRingClasses = (0, classnames_1.default)('ndl-relationship-focus-ring', {
|
|
145
|
+
'ndl-end-left-square': type === 'relationshipRight',
|
|
146
|
+
'ndl-end-right-square': type === 'relationshipLeft',
|
|
147
|
+
});
|
|
147
148
|
return ((0, jsx_runtime_1.jsxs)(Component, Object.assign({ style: Object.assign(Object.assign({ maxWidth: isFluid ? '100%' : MAX_WIDTH }, style), { color: isDisabled ? disabledTextColor : textColor }), className: classes }, (isButton && {
|
|
148
149
|
disabled: isDisabled,
|
|
149
150
|
onClick: handleClick,
|
|
150
151
|
onMouseEnter: handleMouseEnter,
|
|
151
152
|
onMouseLeave: handleMouseLeave,
|
|
152
153
|
type: 'button',
|
|
153
|
-
}), { ref: ref }, restProps, htmlAttributes, { children: [type === 'relationshipLeft' || type === 'relationship' ? ((0, jsx_runtime_1.jsx)(HexagonEnd, { direction: "left", color: backgroundColor, height: height })) : ((0, jsx_runtime_1.jsx)(SquareEnd, { direction: "left", color: backgroundColor
|
|
154
|
+
}), { ref: ref }, restProps, htmlAttributes, { children: [type === 'relationshipLeft' || type === 'relationship' ? ((0, jsx_runtime_1.jsx)(HexagonEnd, { direction: "left", color: backgroundColor, height: height })) : ((0, jsx_runtime_1.jsx)(SquareEnd, { direction: "left", color: backgroundColor })), (0, jsx_runtime_1.jsx)("div", { className: "ndl-relationship-label-container", style: {
|
|
154
155
|
backgroundColor: backgroundColor,
|
|
155
|
-
}, children:
|
|
156
|
+
}, children: (0, jsx_runtime_1.jsx)("div", { className: "ndl-relationship-label-content", children: children }) }), type === 'relationshipRight' || type === 'relationship' ? ((0, jsx_runtime_1.jsx)(HexagonEnd, { direction: "right", color: backgroundColor, height: height })) : ((0, jsx_runtime_1.jsx)(SquareEnd, { direction: "right", color: backgroundColor })), (0, jsx_runtime_1.jsx)("span", { "aria-hidden": true, className: focusRingClasses })] })));
|
|
156
157
|
}
|
|
157
158
|
else {
|
|
158
159
|
const classes = (0, classnames_1.default)('ndl-property-key-label', commonClasses);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphLabel.js","sourceRoot":"","sources":["../../../src/graph-label/GraphLabel.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,0CAAyC;AACzC,4DAAoC;AAEpC,iCAA0C;AAM1C,mCAIiB;AAgDjB;;;;;;GAMG;AAEH,MAAM,UAAU,GAAG,CAAC,EAClB,SAAS,GAAG,MAAM,EAClB,KAAK,EACL,cAAc,EACd,MAAM,GAAG,EAAE,GACK,EAAE,EAAE;IACpB,MAAM,OAAO,GAAG,IAAA,oBAAU,EAAC,iBAAiB,EAAE;QAC5C,UAAU,EAAE,SAAS,KAAK,MAAM;QAChC,WAAW,EAAE,SAAS,KAAK,OAAO;KACnC,CAAC,CAAC;IAEH,OAAO,CACL,+CAAK,SAAS,EAAE,OAAO,IAAM,cAAc,eACzC,+CACe,IAAI,EACjB,SAAS,EAAC,uBAAuB,EACjC,IAAI,EAAC,MAAM,EACX,MAAM,EAAE,MAAM,EACd,mBAAmB,EAAC,MAAM,EAC1B,OAAO,EAAC,UAAU,EAClB,KAAK,EAAC,GAAG,EACT,KAAK,EAAC,4BAA4B,YAGlC,iCACE,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,EACtB,QAAQ,EAAC,SAAS,EAClB,QAAQ,EAAC,SAAS,EAClB,CAAC,EAAC,oMAAoM,GACtM,GACE,EACN,+CACe,IAAI,EACjB,SAAS,EAAC,wBAAwB,EAClC,IAAI,EAAC,MAAM,EACX,MAAM,EAAE,MAAM,GAAG,CAAC,EAClB,mBAAmB,EAAC,MAAM,EAC1B,OAAO,EAAC,WAAW,EACnB,KAAK,EAAC,IAAI,EACV,KAAK,EAAC,4BAA4B,YAElC,iCACE,QAAQ,EAAC,SAAS,EAClB,QAAQ,EAAC,SAAS,EAClB,CAAC,EAAC,kWAAkW,GACpW,GACE,KACF,CACP,CAAC;AACJ,CAAC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KACS,CACb,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,MAAM,OAAO,GAAG,IAAA,oBAAU,EAAC,wBAAwB,EAAE,aAAa,CAAC,CAAC;QAEpE,OAAO,CACL,uBAAC,SAAS,oBACJ,CAAC,QAAQ,IAAI;YACf,IAAI,EAAE,QAAQ;SACf,CAAC,IACF,KAAK,kBACH,eAAe,EAAE,eAAe,EAChC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,EACjD,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,IACnC,KAAK,GAEV,SAAS,EAAE,OAAO,EAClB,OAAO,EAAE,WAAW,EACpB,YAAY,EAAE,gBAAgB,EAC9B,YAAY,EAAE,gBAAgB,EAC9B,GAAG,EAAE,GAAG,IACJ,cAAc,cAElB,gCAAK,SAAS,EAAC,gCAAgC,YAAE,QAAQ,GAAO,IACtD,CACb,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAxNW,QAAA,UAAU,cAwNrB","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { tokens } from '@neo4j-ndl/base';\nimport classNames from 'classnames';\nimport type React from 'react';\nimport { useMemo, useState } from 'react';\n\nimport {\n type HtmlAttributes,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport {\n getDisabledTextColor,\n getHoverColor,\n getTextColorFromBackground,\n} from './color';\n\n/**\n *\n *\n * Types\n *\n *\n */\n\ntype GraphLabelProps = {\n /** The type of label */\n type:\n | 'node'\n | 'relationship'\n | 'propertyKey'\n | 'relationshipLeft'\n | 'relationshipRight';\n /** Callback function that is called when the label is clicked */\n onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n /** Additional styles to apply to the label */\n style?: React.CSSProperties;\n /** Content displayed inside the label */\n children?: React.ReactNode;\n /** The background color of the label */\n color?: string;\n /** Whether the label is disabled */\n isDisabled?: boolean;\n /** Additional class names */\n className?: string;\n /** Whether the label is selected */\n isSelected?: boolean;\n /** Whether the label should expand to full available width */\n isFluid?: boolean;\n /** The size of the label */\n size?: 'small' | 'large';\n};\n\ntype HexagonEndProps = {\n /** The direction of the hexagon end */\n direction: 'left' | 'right';\n /** The color of the hexagon end */\n color?: string;\n /** The height of the hexagon end in pixels */\n height?: number;\n /** HTML attributes */\n htmlAttributes?: HtmlAttributes<'div'>;\n};\n/**\n *\n *\n * Helpers\n *\n *\n */\n\nconst HexagonEnd = ({\n direction = 'left',\n color,\n htmlAttributes,\n height = 24,\n}: HexagonEndProps) => {\n const classes = classNames('ndl-hexagon-end', {\n 'ndl-left': direction === 'left',\n 'ndl-right': direction === 'right',\n });\n\n return (\n <div className={classes} {...htmlAttributes}>\n <svg\n aria-hidden={true}\n className=\"ndl-hexagon-end-inner\"\n fill=\"none\"\n height={height}\n preserveAspectRatio=\"none\"\n viewBox=\"0 0 9 24\"\n width=\"9\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n {/* triangle */}\n <path\n style={{ fill: color }}\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M5.73024 1.03676C6.08165 0.397331 6.75338 0 7.48301 0H9V24H7.483C6.75338 24 6.08165 23.6027 5.73024 22.9632L0.315027 13.1094C-0.105009 12.4376 -0.105009 11.5624 0.315026 10.8906L5.73024 1.03676Z\"\n />\n </svg>\n <svg\n aria-hidden={true}\n className=\"ndl-hexagon-end-active\"\n fill=\"none\"\n height={height + 6}\n preserveAspectRatio=\"none\"\n viewBox=\"0 0 13 30\"\n width=\"13\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M10.075 2C9.12474 2 8.24318 2.54521 7.74867 3.43873L2.21419 13.4387C1.68353 14.3976 1.68353 15.6024 2.21419 16.5613L7.74867 26.5613C8.24318 27.4548 9.12474 28 10.075 28H13V30H10.075C8.49126 30 7.022 29.0913 6.1978 27.6021L0.663324 17.6021C-0.221109 16.0041 -0.221108 13.9959 0.663325 12.3979L6.1978 2.39789C7.022 0.90869 8.49126 0 10.075 0H13V2H10.075Z\"\n />\n </svg>\n </div>\n );\n};\n\ntype SquareEndProps = {\n /** The direction of the square end (where it's rounded and has the active state) */\n direction: 'left' | 'right';\n /** The color of the square end */\n color: string;\n /** The height of the square end in pixels */\n height: number;\n /** HTML attributes */\n htmlAttributes?: HtmlAttributes<'div'>;\n};\n\nconst SquareEnd = ({\n direction = 'left',\n color,\n height = 24,\n htmlAttributes,\n}: SquareEndProps) => {\n const classes = classNames('ndl-square-end', {\n 'ndl-left': direction === 'left',\n 'ndl-right': direction === 'right',\n });\n\n return (\n <div className={classes} {...htmlAttributes}>\n <div\n className=\"ndl-square-end-inner\"\n style={{ backgroundColor: color }}\n />\n <svg\n className=\"ndl-square-end-active\"\n width=\"7\"\n height={height + 6}\n preserveAspectRatio=\"none\"\n viewBox=\"0 0 7 30\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M 3.8774 2 C 3.2697 2 2.7917 2.248 2.3967 2.6605 C 1.928 3.1498 1.7993 3.8555 1.7993 4.5331 V 13.8775 V 25.4669 C 1.7993 26.1445 1.928 26.8502 2.3967 27.3395 C 2.7917 27.752 3.2697 28 3.8774 28 H 7 V 30 H 3.8774 C 2.6211 30 1.4369 29.4282 0.5895 28.4485 C 0.1462 27.936 0.0002 27.2467 0.0002 26.5691 L -0.0002 13.8775 L 0.0002 3.4309 C 0.0002 2.7533 0.1462 2.064 0.5895 1.5515 C 1.4368 0.5718 2.6211 0 3.8774 0 H 7 V 2 H 3.8774 Z\"\n />\n </svg>\n </div>\n );\n};\n\ntype HorizontalLinesProps = {\n height?: number;\n};\n\nconst HorizontalLines = ({ height = 24 }: HorizontalLinesProps) => {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n height={height + 6}\n preserveAspectRatio=\"none\"\n viewBox=\"0 0 37 30\"\n fill=\"none\"\n className=\"ndl-relationship-label-lines\"\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M 37 2 H 0 V 0 H 37 V 2 Z\"\n />\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M 37 30 H 0 V 28 H 37 V 30 Z\"\n />\n </svg>\n );\n};\n\n/**\n *\n *\n * GraphLabel Component\n *\n *\n */\n\nconst MAX_WIDTH = 200;\n\nexport const GraphLabel = <T extends React.ElementType = 'button'>({\n type = 'node',\n color,\n isDisabled = false,\n isSelected = false,\n as,\n onClick,\n className,\n style,\n children,\n htmlAttributes,\n isFluid = false,\n size = 'large',\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, GraphLabelProps>) => {\n const [isHover, setIsHover] = useState(false);\n\n const handleMouseEnter = (\n event: React.MouseEvent<HTMLButtonElement, MouseEvent>,\n ) => {\n setIsHover(true);\n\n if (htmlAttributes && htmlAttributes.onMouseEnter !== undefined) {\n htmlAttributes.onMouseEnter(event);\n }\n };\n\n const handleMouseLeave = (\n event: React.MouseEvent<HTMLButtonElement, MouseEvent>,\n ) => {\n setIsHover(false);\n\n htmlAttributes?.onMouseLeave?.(event);\n };\n\n const Component: React.ElementType = as ?? 'button';\n const isButton = Component === 'button';\n\n const handleClick = (\n event: React.MouseEvent<HTMLButtonElement, MouseEvent>,\n ) => {\n // By default, a <button /> element with disabled set to true will not get its\n // on click handler called. To support the same behavior on <a /> tags we\n // swallow the event here when disabled, since the <a /> tag with disabled set to\n // true will have its onClick handler called\n if (isDisabled) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n if (onClick) {\n onClick(event);\n }\n };\n\n let backgroundColor = useMemo(() => {\n if (color === undefined) {\n switch (type) {\n case 'node':\n return tokens.graph['1'];\n case 'relationship':\n case 'relationshipLeft':\n case 'relationshipRight':\n return tokens.theme.light.color.neutral.bg.strong;\n default:\n return tokens.theme.light.color.neutral.bg.strongest;\n }\n }\n return color;\n }, [color, type]);\n\n const hoverColor = useMemo(\n () =>\n getHoverColor(\n backgroundColor ? backgroundColor : tokens.palette.lemon[40],\n ),\n [backgroundColor],\n );\n const textColor = useMemo(\n () =>\n getTextColorFromBackground(\n backgroundColor ? backgroundColor : tokens.palette.lemon[40],\n ),\n [backgroundColor],\n );\n const disabledTextColor = useMemo(\n () =>\n getDisabledTextColor(\n backgroundColor ? backgroundColor : tokens.palette.lemon[40],\n ),\n [backgroundColor],\n );\n\n if (isHover && !isDisabled) {\n backgroundColor = hoverColor;\n }\n\n const commonClasses = classNames('ndl-graph-label', className, {\n 'ndl-disabled': isDisabled,\n 'ndl-interactable': isButton,\n 'ndl-selected': isSelected,\n 'ndl-small': size === 'small',\n });\n\n if (type === 'node') {\n const classes = classNames('ndl-node-label', commonClasses);\n\n return (\n <Component\n className={classes}\n ref={ref}\n style={{\n backgroundColor: backgroundColor,\n color: isDisabled ? disabledTextColor : textColor,\n maxWidth: isFluid ? '100%' : MAX_WIDTH,\n ...style,\n }}\n {...(isButton && {\n disabled: isDisabled,\n onClick: handleClick,\n onMouseEnter: handleMouseEnter,\n onMouseLeave: handleMouseLeave,\n type: 'button',\n })}\n {...htmlAttributes}\n >\n <div className=\"ndl-node-label-content\">{children}</div>\n </Component>\n );\n } else if (\n type === 'relationship' ||\n type === 'relationshipLeft' ||\n type === 'relationshipRight'\n ) {\n const classes = classNames('ndl-relationship-label', commonClasses);\n const height = size === 'small' ? 20 : 24;\n\n return (\n <Component\n style={{\n maxWidth: isFluid ? '100%' : MAX_WIDTH,\n ...style,\n color: isDisabled ? disabledTextColor : textColor,\n }}\n className={classes}\n {...(isButton && {\n disabled: isDisabled,\n onClick: handleClick,\n onMouseEnter: handleMouseEnter,\n onMouseLeave: handleMouseLeave,\n type: 'button',\n })}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {type === 'relationshipLeft' || type === 'relationship' ? (\n <HexagonEnd\n direction=\"left\"\n color={backgroundColor}\n height={height}\n />\n ) : (\n <SquareEnd direction=\"left\" color={backgroundColor} height={height} />\n )}\n <div\n className=\"ndl-relationship-label-container\"\n style={{\n backgroundColor: backgroundColor,\n }}\n >\n <div className=\"ndl-relationship-label-content\">{children}</div>\n <HorizontalLines height={height} />\n </div>\n {type === 'relationshipRight' || type === 'relationship' ? (\n <HexagonEnd\n direction=\"right\"\n color={backgroundColor}\n height={height}\n />\n ) : (\n <SquareEnd\n direction=\"right\"\n color={backgroundColor}\n height={height}\n />\n )}\n </Component>\n );\n } else {\n const classes = classNames('ndl-property-key-label', commonClasses);\n\n return (\n <Component\n {...(isButton && {\n type: 'button',\n })}\n style={{\n backgroundColor: backgroundColor,\n color: isDisabled ? disabledTextColor : textColor,\n maxWidth: isFluid ? '100%' : MAX_WIDTH,\n ...style,\n }}\n className={classes}\n onClick={handleClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n ref={ref}\n {...htmlAttributes}\n >\n <div className=\"ndl-property-key-label-content\">{children}</div>\n </Component>\n );\n }\n};\n"]}
|
|
1
|
+
{"version":3,"file":"GraphLabel.js","sourceRoot":"","sources":["../../../src/graph-label/GraphLabel.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,0CAAyC;AACzC,4DAAoC;AAEpC,iCAA0C;AAM1C,mCAIiB;AAgDjB;;;;;;GAMG;AAEH,MAAM,UAAU,GA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AAI,KAC9C,CACb,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,MAAM,OAAO,GAAG,IAAA,oBAAU,EAAC,wBAAwB,EAAE,aAAa,CAAC,CAAC;QAEpE,OAAO,CACL,uBAAC,SAAS,oBACJ,CAAC,QAAQ,IAAI;YACf,IAAI,EAAE,QAAQ;SACf,CAAC,IACF,KAAK,kBACH,eAAe,EAAE,eAAe,EAChC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,EACjD,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,IACnC,KAAK,GAEV,SAAS,EAAE,OAAO,EAClB,OAAO,EAAE,WAAW,EACpB,YAAY,EAAE,gBAAgB,EAC9B,YAAY,EAAE,gBAAgB,EAC9B,GAAG,EAAE,GAAG,IACJ,cAAc,cAElB,gCAAK,SAAS,EAAC,gCAAgC,YAAE,QAAQ,GAAO,IACtD,CACb,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAxNW,QAAA,UAAU,cAwNrB","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { tokens } from '@neo4j-ndl/base';\nimport classNames from 'classnames';\nimport type React from 'react';\nimport { useMemo, useState } from 'react';\n\nimport {\n type HtmlAttributes,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport {\n getDisabledTextColor,\n getHoverColor,\n getTextColorFromBackground,\n} from './color';\n\n/**\n *\n *\n * Types\n *\n *\n */\n\ntype GraphLabelProps = {\n /** The type of label */\n type:\n | 'node'\n | 'relationship'\n | 'propertyKey'\n | 'relationshipLeft'\n | 'relationshipRight';\n /** Callback function that is called when the label is clicked */\n onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n /** Additional styles to apply to the label */\n style?: React.CSSProperties;\n /** Content displayed inside the label */\n children?: React.ReactNode;\n /** The background color of the label */\n color?: string;\n /** Whether the label is disabled */\n isDisabled?: boolean;\n /** Additional class names */\n className?: string;\n /** Whether the label is selected */\n isSelected?: boolean;\n /** Whether the label should expand to full available width */\n isFluid?: boolean;\n /** The size of the label */\n size?: 'small' | 'large';\n};\n\ntype HexagonEndProps = {\n /** The direction of the hexagon end */\n direction: 'left' | 'right';\n /** The color of the hexagon end */\n color?: string;\n /** The height of the hexagon end in pixels */\n height?: number;\n /** HTML attributes */\n htmlAttributes?: HtmlAttributes<'div'>;\n};\n/**\n *\n *\n * Helpers\n *\n *\n */\n\nconst HexagonEnd = ({\n direction = 'left',\n color,\n htmlAttributes,\n height = 24,\n}: HexagonEndProps) => {\n const classes = classNames('ndl-hexagon-end', {\n 'ndl-left': direction === 'left',\n 'ndl-right': direction === 'right',\n });\n\n return (\n <div className={classes} {...htmlAttributes}>\n <svg\n aria-hidden={true}\n className=\"ndl-hexagon-end-inner\"\n fill=\"none\"\n height={height}\n preserveAspectRatio=\"none\"\n viewBox=\"0 0 9 24\"\n width=\"9\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n {/* triangle */}\n <path\n style={{ fill: color }}\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M5.73024 1.03676C6.08165 0.397331 6.75338 0 7.48301 0H9V24H7.483C6.75338 24 6.08165 23.6027 5.73024 22.9632L0.315027 13.1094C-0.105009 12.4376 -0.105009 11.5624 0.315026 10.8906L5.73024 1.03676Z\"\n />\n </svg>\n </div>\n );\n};\n\ntype SquareEndProps = {\n /** The direction of the square end (where it's rounded) */\n direction: 'left' | 'right';\n /** The color of the square end */\n color: string;\n /** HTML attributes */\n htmlAttributes?: HtmlAttributes<'div'>;\n};\n\nconst SquareEnd = ({\n direction = 'left',\n color,\n htmlAttributes,\n}: SquareEndProps) => {\n const classes = classNames('ndl-square-end', {\n 'ndl-left': direction === 'left',\n 'ndl-right': direction === 'right',\n });\n\n return (\n <div className={classes} {...htmlAttributes}>\n <div\n className=\"ndl-square-end-inner\"\n style={{ backgroundColor: color }}\n />\n </div>\n );\n};\n\n/**\n *\n *\n * GraphLabel Component\n *\n *\n */\n\nconst MAX_WIDTH = 200;\n\nexport const GraphLabel = <T extends React.ElementType = 'button'>({\n type = 'node',\n color,\n isDisabled = false,\n isSelected = false,\n as,\n onClick,\n className,\n style,\n children,\n htmlAttributes,\n isFluid = false,\n size = 'large',\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, GraphLabelProps>) => {\n const [isHover, setIsHover] = useState(false);\n\n const handleMouseEnter = (\n event: React.MouseEvent<HTMLButtonElement, MouseEvent>,\n ) => {\n setIsHover(true);\n\n if (htmlAttributes && htmlAttributes.onMouseEnter !== undefined) {\n htmlAttributes.onMouseEnter(event);\n }\n };\n\n const handleMouseLeave = (\n event: React.MouseEvent<HTMLButtonElement, MouseEvent>,\n ) => {\n setIsHover(false);\n\n htmlAttributes?.onMouseLeave?.(event);\n };\n\n const Component: React.ElementType = as ?? 'button';\n const isButton = Component === 'button';\n\n const handleClick = (\n event: React.MouseEvent<HTMLButtonElement, MouseEvent>,\n ) => {\n // By default, a <button /> element with disabled set to true will not get its\n // on click handler called. To support the same behavior on <a /> tags we\n // swallow the event here when disabled, since the <a /> tag with disabled set to\n // true will have its onClick handler called\n if (isDisabled) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n if (onClick) {\n onClick(event);\n }\n };\n\n let backgroundColor = useMemo(() => {\n if (color === undefined) {\n switch (type) {\n case 'node':\n return tokens.graph['1'];\n case 'relationship':\n case 'relationshipLeft':\n case 'relationshipRight':\n return tokens.theme.light.color.neutral.bg.strong;\n default:\n return tokens.theme.light.color.neutral.bg.strongest;\n }\n }\n return color;\n }, [color, type]);\n\n const hoverColor = useMemo(\n () =>\n getHoverColor(\n backgroundColor ? backgroundColor : tokens.palette.lemon[40],\n ),\n [backgroundColor],\n );\n const textColor = useMemo(\n () =>\n getTextColorFromBackground(\n backgroundColor ? backgroundColor : tokens.palette.lemon[40],\n ),\n [backgroundColor],\n );\n const disabledTextColor = useMemo(\n () =>\n getDisabledTextColor(\n backgroundColor ? backgroundColor : tokens.palette.lemon[40],\n ),\n [backgroundColor],\n );\n\n if (isHover && !isDisabled) {\n backgroundColor = hoverColor;\n }\n\n const commonClasses = classNames('ndl-graph-label', className, {\n 'ndl-disabled': isDisabled,\n 'ndl-interactable': isButton,\n 'ndl-selected': isSelected,\n 'ndl-small': size === 'small',\n });\n\n if (type === 'node') {\n const classes = classNames('ndl-node-label', commonClasses);\n\n return (\n <Component\n className={classes}\n ref={ref}\n style={{\n backgroundColor: backgroundColor,\n color: isDisabled ? disabledTextColor : textColor,\n maxWidth: isFluid ? '100%' : MAX_WIDTH,\n ...style,\n }}\n {...(isButton && {\n disabled: isDisabled,\n onClick: handleClick,\n onMouseEnter: handleMouseEnter,\n onMouseLeave: handleMouseLeave,\n type: 'button',\n })}\n {...htmlAttributes}\n >\n <div className=\"ndl-node-label-content\">{children}</div>\n </Component>\n );\n } else if (\n type === 'relationship' ||\n type === 'relationshipLeft' ||\n type === 'relationshipRight'\n ) {\n const classes = classNames('ndl-relationship-label', commonClasses);\n const height = size === 'small' ? 20 : 24;\n const focusRingClasses = classNames('ndl-relationship-focus-ring', {\n 'ndl-end-left-square': type === 'relationshipRight',\n 'ndl-end-right-square': type === 'relationshipLeft',\n });\n\n return (\n <Component\n style={{\n maxWidth: isFluid ? '100%' : MAX_WIDTH,\n ...style,\n color: isDisabled ? disabledTextColor : textColor,\n }}\n className={classes}\n {...(isButton && {\n disabled: isDisabled,\n onClick: handleClick,\n onMouseEnter: handleMouseEnter,\n onMouseLeave: handleMouseLeave,\n type: 'button',\n })}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {type === 'relationshipLeft' || type === 'relationship' ? (\n <HexagonEnd\n direction=\"left\"\n color={backgroundColor}\n height={height}\n />\n ) : (\n <SquareEnd direction=\"left\" color={backgroundColor} />\n )}\n <div\n className=\"ndl-relationship-label-container\"\n style={{\n backgroundColor: backgroundColor,\n }}\n >\n <div className=\"ndl-relationship-label-content\">{children}</div>\n </div>\n {type === 'relationshipRight' || type === 'relationship' ? (\n <HexagonEnd\n direction=\"right\"\n color={backgroundColor}\n height={height}\n />\n ) : (\n <SquareEnd direction=\"right\" color={backgroundColor} />\n )}\n <span aria-hidden={true} className={focusRingClasses} />\n </Component>\n );\n } else {\n const classes = classNames('ndl-property-key-label', commonClasses);\n\n return (\n <Component\n {...(isButton && {\n type: 'button',\n })}\n style={{\n backgroundColor: backgroundColor,\n color: isDisabled ? disabledTextColor : textColor,\n maxWidth: isFluid ? '100%' : MAX_WIDTH,\n ...style,\n }}\n className={classes}\n onClick={handleClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n ref={ref}\n {...htmlAttributes}\n >\n <div className=\"ndl-property-key-label-content\">{children}</div>\n </Component>\n );\n }\n};\n"]}
|
package/lib/cjs/index.js
CHANGED
|
@@ -34,8 +34,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
34
34
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
35
35
|
};
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
exports.TimeZonePicker = exports.NeedleTime = exports.TimePicker = exports.Skeleton = exports.Tooltip = exports.toast = exports.Toaster = exports.ToasterControlled = exports.Divider = exports.DropdownButton = exports.InlineEdit = exports.Slider = exports.ClipboardButton = exports.Logo = exports.Avatar = exports.Flex = exports.Box = exports.Breadcrumbs = exports.Drawer = exports.Typography = exports.SideNavigation = exports.StatusIndicator = exports.CodeBlock = exports.GraphLabel = exports.Wizard = exports.Tag = exports.Select = exports.TextLink = exports.TextArea = exports.TextInput = exports.
|
|
38
|
-
exports.SelectableTag = exports.DismissibleTag = exports.ReadOnlyTag = exports.SelectIconButton = exports.Kbd = exports.Code = exports.TextButton = exports.FilledButton = exports.OutlinedButton = exports.ColorPicker = exports.ConditionalWrap = exports.IconButtonArray = exports.CleanIconButton = exports.IconButton = exports.LoadingBar =
|
|
37
|
+
exports.useSpotlightContext = exports.SpotlightTour = exports.SpotlightTarget = exports.SpotlightProvider = exports.Spotlight = exports.TimeZonePicker = exports.NeedleTime = exports.TimePicker = exports.Skeleton = exports.Tooltip = exports.toast = exports.Toaster = exports.ToasterControlled = exports.Divider = exports.DropdownButton = exports.InlineEdit = exports.Slider = exports.ClipboardButton = exports.Logo = exports.Avatar = exports.Flex = exports.Box = exports.Breadcrumbs = exports.Drawer = exports.Typography = exports.SideNavigation = exports.StatusIndicator = exports.CodeBlock = exports.GraphLabel = exports.Wizard = exports.Tag = exports.Select = exports.TextLink = exports.TextArea = exports.TextInput = exports.Dropzone = exports.ProgressBar = exports.Popover = exports.SegmentedControl = exports.Tabs = exports.LoadingSpinner = exports.Dialog = exports.DatePicker = exports.Menu = exports.Radio = exports.Switch = exports.Checkbox = exports.Banner = exports.StatusLabel = exports.Accordion = void 0;
|
|
38
|
+
exports.SelectableTag = exports.DismissibleTag = exports.ReadOnlyTag = exports.SelectIconButton = exports.Kbd = exports.Code = exports.TextButton = exports.FilledButton = exports.OutlinedButton = exports.ColorPicker = exports.ConditionalWrap = exports.IconButtonArray = exports.CleanIconButton = exports.IconButton = exports.LoadingBar = void 0;
|
|
39
39
|
var accordion_1 = require("./accordion");
|
|
40
40
|
Object.defineProperty(exports, "Accordion", { enumerable: true, get: function () { return accordion_1.Accordion; } });
|
|
41
41
|
var status_label_1 = require("./status-label");
|
|
@@ -66,12 +66,7 @@ var progress_bar_1 = require("./progress-bar");
|
|
|
66
66
|
Object.defineProperty(exports, "ProgressBar", { enumerable: true, get: function () { return progress_bar_1.ProgressBar; } });
|
|
67
67
|
var dropzone_1 = require("./dropzone");
|
|
68
68
|
Object.defineProperty(exports, "Dropzone", { enumerable: true, get: function () { return dropzone_1.Dropzone; } });
|
|
69
|
-
|
|
70
|
-
Object.defineProperty(exports, "DataGrid", { enumerable: true, get: function () { return data_grid_1.DataGrid; } });
|
|
71
|
-
Object.defineProperty(exports, "useDataGridContext", { enumerable: true, get: function () { return data_grid_1.useDataGridContext; } });
|
|
72
|
-
Object.defineProperty(exports, "useTableNav", { enumerable: true, get: function () { return data_grid_1.useTableNav; } });
|
|
73
|
-
Object.defineProperty(exports, "dataGridUtils", { enumerable: true, get: function () { return data_grid_1.dataGridUtils; } });
|
|
74
|
-
Object.defineProperty(exports, "DataGridNav", { enumerable: true, get: function () { return data_grid_1.DataGridNav; } });
|
|
69
|
+
__exportStar(require("./data-grid"), exports);
|
|
75
70
|
var text_input_1 = require("./text-input");
|
|
76
71
|
Object.defineProperty(exports, "TextInput", { enumerable: true, get: function () { return text_input_1.TextInput; } });
|
|
77
72
|
var text_area_1 = require("./text-area");
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;;;;;;;AAEH,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,iCAAgC;AAAvB,8FAAA,KAAK,OAAA;AACd,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,6CAA2C;AAAl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A;AACnB,6CAA2C;AAAlC,yGAAA,UAAU,OAAA;AACnB,yDAAsD;AAA7C,oHAAA,eAAe,OAAA;AACxB,yDAAsD;AAA7C,oHAAA,eAAe,OAAA;AACxB,uDAAqD;AAA5C,mHAAA,eAAe,OAAA;AACxB,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,iDAA+C;AAAtC,6GAAA,YAAY,OAAA;AACrB,6CAA2C;AAAlC,yGAAA,UAAU,OAAA;AACnB,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,6BAA4B;AAAnB,0FAAA,GAAG,OAAA;AACZ,2DAAwD;AAA/C,sHAAA,gBAAgB,OAAA;AACzB,iDAA8C;AAArC,4GAAA,WAAW,OAAA;AACpB,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,mDAAiD;AAAxC,+GAAA,aAAa,OAAA","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport { Accordion } from './accordion';\nexport { StatusLabel } from './status-label';\nexport { Banner } from './banner';\nexport { Checkbox } from './checkbox';\nexport { Switch } from './switch';\nexport { Radio } from './radio';\nexport { Menu } from './menu';\nexport { DatePicker } from './date-picker';\nexport { Dialog } from './dialog';\nexport { LoadingSpinner } from './loading-spinner';\nexport { Tabs } from './tabs';\nexport { SegmentedControl } from './segmented-control';\nexport { Popover } from './popover';\nexport { ProgressBar } from './progress-bar';\nexport { Dropzone } from './dropzone';\nexport * from './data-grid';\nexport { TextInput } from './text-input';\nexport { TextArea } from './text-area';\nexport { TextLink } from './text-link';\nexport { Select } from './select';\nexport { Tag } from './tag';\nexport * from './theme';\nexport { Wizard } from './wizard';\nexport { GraphLabel } from './graph-label';\nexport { CodeBlock } from './code-block';\nexport { StatusIndicator } from './status-indicator';\nexport { SideNavigation } from './side-navigation';\nexport { Typography } from './typography';\nexport { Drawer } from './drawer';\nexport { Breadcrumbs } from './breadcrumbs';\nexport * from './hooks';\nexport { Box } from './box';\nexport { Flex } from './flex';\nexport { Avatar } from './avatar';\nexport { Logo } from './logo';\nexport { ClipboardButton } from './clipboard-button';\nexport { Slider } from './slider';\nexport { InlineEdit } from './inline-edit';\nexport { DropdownButton } from './dropdown-button';\nexport { Divider } from './divider';\nexport * from './tree-view';\nexport { ToasterControlled, Toaster, toast, type ToastId } from './toast';\nexport { Tooltip } from './tooltip';\nexport { Skeleton } from './skeleton';\nexport { TimePicker, NeedleTime } from './time-picker';\nexport { TimeZonePicker } from './timezone-picker';\nexport {\n Spotlight,\n SpotlightProvider,\n SpotlightTarget,\n SpotlightTour,\n useSpotlightContext,\n} from './spotlight';\nexport { LoadingBar } from './loading-bar';\nexport { IconButton } from './icon-button';\nexport { CleanIconButton } from './clean-icon-button';\nexport { IconButtonArray } from './icon-button-array';\nexport { ConditionalWrap } from './conditional-wrap';\nexport { ColorPicker } from './color-picker';\nexport { OutlinedButton } from './outlined-button';\nexport { FilledButton } from './filled-button';\nexport { TextButton } from './text-button';\nexport { Code } from './code';\nexport { Kbd } from './kbd';\nexport { SelectIconButton } from './select-icon-button';\nexport { ReadOnlyTag } from './read-only-tag';\nexport { DismissibleTag } from './dismissible-tag';\nexport { SelectableTag } from './selectable-tag';\n"]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) "Neo4j"
|
|
5
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
6
|
+
*
|
|
7
|
+
* This file is part of Neo4j.
|
|
8
|
+
*
|
|
9
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
10
|
+
* it under the terms of the GNU General Public License as published by
|
|
11
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
12
|
+
* (at your option) any later version.
|
|
13
|
+
*
|
|
14
|
+
* This program is distributed in the hope that it will be useful,
|
|
15
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
* GNU General Public License for more details.
|
|
18
|
+
*
|
|
19
|
+
* You should have received a copy of the GNU General Public License
|
|
20
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
21
|
+
*/
|
|
22
|
+
import { Markdown } from '@storybook/addon-docs/blocks';
|
|
23
|
+
import { useCallback } from 'react';
|
|
24
|
+
import { TextLink } from '../text-link';
|
|
25
|
+
import { Typography } from '../typography';
|
|
26
|
+
/**
|
|
27
|
+
* Creates a Storybook docs page that combines a component's README (props)
|
|
28
|
+
* and optional ACCESSIBILITY.md into a single page with a navigation index.
|
|
29
|
+
*
|
|
30
|
+
* Requires the `autodocs` tag on the component meta to create a Docs entry in the sidebar
|
|
31
|
+
* (the global preview config disables autodocs with `!autodocs`).
|
|
32
|
+
*
|
|
33
|
+
* Usage in a *.stories.tsx file:
|
|
34
|
+
* ```ts
|
|
35
|
+
* import ReadmeContent from '../README.md?raw';
|
|
36
|
+
* import AccessibilityContent from '../ACCESSIBILITY.md?raw';
|
|
37
|
+
* import { createComponentDocsPage } from '../../_common/component-docs-page';
|
|
38
|
+
*
|
|
39
|
+
* const meta: Meta = {
|
|
40
|
+
* // ...
|
|
41
|
+
* tags: ['docsPage', 'autodocs'],
|
|
42
|
+
* parameters: {
|
|
43
|
+
* docs: {
|
|
44
|
+
* page: createComponentDocsPage(ReadmeContent, AccessibilityContent),
|
|
45
|
+
* },
|
|
46
|
+
* },
|
|
47
|
+
* };
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
function stripMarkdownComments(content) {
|
|
51
|
+
return content.replace(/^\[\/\/\]: #.*\n*/gm, '');
|
|
52
|
+
}
|
|
53
|
+
export function createComponentDocsPage(readme, accessibility) {
|
|
54
|
+
const cleaned = stripMarkdownComments(readme);
|
|
55
|
+
const cleanedA11y = accessibility
|
|
56
|
+
? stripMarkdownComments(accessibility).replace(/^## /gm, '### ')
|
|
57
|
+
: null;
|
|
58
|
+
return function ComponentDocsPage() {
|
|
59
|
+
const scrollTo = useCallback((e, id) => {
|
|
60
|
+
var _a;
|
|
61
|
+
e.preventDefault();
|
|
62
|
+
(_a = document.getElementById(id)) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ behavior: 'smooth' });
|
|
63
|
+
}, []);
|
|
64
|
+
return (_jsxs(_Fragment, { children: [cleanedA11y && (_jsxs(_Fragment, { children: [_jsx(Typography, { as: "h1", variant: "title-1", children: "Docs" }), _jsxs("nav", { className: "n-flex n-flex-col n-gap-token-2 n-mb-2", children: [_jsx(TextLink, { href: "#props", htmlAttributes: { onClick: (e) => scrollTo(e, 'props') }, children: "Props" }), _jsx(TextLink, { href: "#accessibility", htmlAttributes: {
|
|
65
|
+
onClick: (e) => scrollTo(e, 'accessibility'),
|
|
66
|
+
}, children: "Accessibility" })] })] })), _jsx(Markdown, { children: cleaned }), cleanedA11y && (_jsx(_Fragment, { children: _jsx(Markdown, { children: `## Accessibility\n\n${cleanedA11y}` }) }))] }));
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=component-docs-page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-docs-page.js","sourceRoot":"","sources":["../../../src/_common/component-docs-page.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH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,gBAAgB,EACrB,cAAc,EAAE;wCACd,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,eAAe,CAAC;qCAC7C,8BAGQ,IACP,IACL,CACJ,EACD,KAAC,QAAQ,cAAE,OAAO,GAAY,EAC7B,WAAW,IAAI,CACd,4BACE,KAAC,QAAQ,cAAE,uBAAuB,WAAW,EAAE,GAAY,GAC1D,CACJ,IACA,CACJ,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { Markdown } from '@storybook/addon-docs/blocks';\nimport { type MouseEvent, useCallback } from 'react';\n\nimport { TextLink } from '../text-link';\nimport { Typography } from '../typography';\n\n/**\n * Creates a Storybook docs page that combines a component's README (props)\n * and optional ACCESSIBILITY.md into a single page with a navigation index.\n *\n * Requires the `autodocs` tag on the component meta to create a Docs entry in the sidebar\n * (the global preview config disables autodocs with `!autodocs`).\n *\n * Usage in a *.stories.tsx file:\n * ```ts\n * import ReadmeContent from '../README.md?raw';\n * import AccessibilityContent from '../ACCESSIBILITY.md?raw';\n * import { createComponentDocsPage } from '../../_common/component-docs-page';\n *\n * const meta: Meta = {\n * // ...\n * tags: ['docsPage', 'autodocs'],\n * parameters: {\n * docs: {\n * page: createComponentDocsPage(ReadmeContent, AccessibilityContent),\n * },\n * },\n * };\n * ```\n */\n\nfunction stripMarkdownComments(content: string): string {\n return content.replace(/^\\[\\/\\/\\]: #.*\\n*/gm, '');\n}\n\nexport function createComponentDocsPage(\n readme: string,\n accessibility?: string,\n) {\n const cleaned = stripMarkdownComments(readme);\n const cleanedA11y = accessibility\n ? stripMarkdownComments(accessibility).replace(/^## /gm, '### ')\n : null;\n\n return function ComponentDocsPage() {\n const scrollTo = useCallback(\n (e: MouseEvent<HTMLAnchorElement>, id: string) => {\n e.preventDefault();\n document.getElementById(id)?.scrollIntoView({ behavior: 'smooth' });\n },\n [],\n );\n\n return (\n <>\n {cleanedA11y && (\n <>\n <Typography as=\"h1\" variant=\"title-1\">\n Docs\n </Typography>\n <nav className=\"n-flex n-flex-col n-gap-token-2 n-mb-2\">\n <TextLink\n href=\"#props\"\n htmlAttributes={{ onClick: (e) => scrollTo(e, 'props') }}\n >\n Props\n </TextLink>\n <TextLink\n href=\"#accessibility\"\n htmlAttributes={{\n onClick: (e) => scrollTo(e, 'accessibility'),\n }}\n >\n Accessibility\n </TextLink>\n </nav>\n </>\n )}\n <Markdown>{cleaned}</Markdown>\n {cleanedA11y && (\n <>\n <Markdown>{`## Accessibility\\n\\n${cleanedA11y}`}</Markdown>\n </>\n )}\n </>\n );\n };\n}\n"]}
|
|
@@ -43,6 +43,7 @@ import { Skeleton } from '../skeleton';
|
|
|
43
43
|
import { Typography } from '../typography';
|
|
44
44
|
import { useDataGridContext } from './data-grid-context';
|
|
45
45
|
import { resizeColumn, ResizeDirection, userFriendlyPagination, } from './helpers';
|
|
46
|
+
import { useDataGridCellStyle } from './style-rules/hooks';
|
|
46
47
|
/** Table results per page, with the first option being the default */
|
|
47
48
|
const TABLE_RESULTS = {
|
|
48
49
|
DEFAULT: 10,
|
|
@@ -280,6 +281,7 @@ const BodyCell = (_a) => {
|
|
|
280
281
|
const isDropDownCell = Boolean((_d = cell.column.columnDef.meta) === null || _d === void 0 ? void 0 : _d.isDropDownCell);
|
|
281
282
|
const isCustomCell = isActionColumn || isDropDownCell;
|
|
282
283
|
const { isKeyboardNavigationEnabled, isSkeletonLoading, skeletonProps } = useDataGridContext();
|
|
284
|
+
const ruleStyle = useDataGridCellStyle(cell);
|
|
283
285
|
return (_jsx("div", Object.assign({ ref: ref, className: classNames('ndl-data-grid-td', className, {
|
|
284
286
|
'ndl-data-grid-custom-cell': isCustomCell,
|
|
285
287
|
'ndl-data-grid-dropdown-cell': isDropDownCell,
|
|
@@ -290,7 +292,7 @@ const BodyCell = (_a) => {
|
|
|
290
292
|
'ndl-data-grid-pinned-cell-right': cell.column.getIsPinned() === 'right',
|
|
291
293
|
'ndl-data-grid-row-action': isActionColumn,
|
|
292
294
|
'ndl-focusable-cell': isKeyboardNavigationEnabled,
|
|
293
|
-
}), role: "cell", tabIndex: isKeyboardNavigationEnabled ? 0 : undefined, style: Object.assign(Object.assign({}, style), { width: isActionColumn ? 40 : cell.column.getSize() }) }, restProps, htmlAttributes, { children: _jsx(Skeleton, Object.assign({ onBackground: "weak", shape: "rectangular", width: "100%" }, skeletonProps, { isLoading: isSkeletonLoading && !isActionColumn, children: children || flexRender(cell.column.columnDef.cell, cell.getContext()) })) }), cell.id));
|
|
295
|
+
}), role: "cell", tabIndex: isKeyboardNavigationEnabled ? 0 : undefined, style: Object.assign(Object.assign(Object.assign({}, ruleStyle), style), { width: isActionColumn ? 40 : cell.column.getSize() }) }, restProps, htmlAttributes, { children: _jsx(Skeleton, Object.assign({ onBackground: "weak", shape: "rectangular", width: "100%" }, skeletonProps, { isLoading: isSkeletonLoading && !isActionColumn, children: children || flexRender(cell.column.columnDef.cell, cell.getContext()) })) }), cell.id));
|
|
294
296
|
};
|
|
295
297
|
const BodyRow = (_a) => {
|
|
296
298
|
var { row, children, className, style, htmlAttributes, ref } = _a, restProps = __rest(_a, ["row", "children", "className", "style", "htmlAttributes", "ref"]);
|