@neo4j-ndl/react 4.2.11 → 4.2.13
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/CodeBlockWrapper.js +3 -0
- package/lib/cjs/_common/CodeBlockWrapper.js.map +1 -1
- package/lib/cjs/button/stories/button-variants.story.js +1 -1
- package/lib/cjs/button/stories/button-variants.story.js.map +1 -1
- package/lib/cjs/text-button/TextButton.js.map +1 -1
- package/lib/esm/_common/CodeBlockWrapper.js +3 -0
- package/lib/esm/_common/CodeBlockWrapper.js.map +1 -1
- package/lib/esm/button/stories/button-variants.story.js +1 -1
- package/lib/esm/button/stories/button-variants.story.js.map +1 -1
- package/lib/esm/text-button/TextButton.js.map +1 -1
- package/lib/types/_common/CodeBlockWrapper.d.ts.map +1 -1
- package/lib/types/button/stories/button-variants.story.d.ts.map +1 -1
- package/lib/types/text-button/TextButton.d.ts +1 -1
- package/lib/types/text-button/TextButton.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -60,6 +60,9 @@ const CodeBlockWrapper = (_a) => {
|
|
|
60
60
|
}, []);
|
|
61
61
|
(0, react_1.useLayoutEffect)(() => {
|
|
62
62
|
var _a, _b, _c, _d;
|
|
63
|
+
if (maxHeight === undefined) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
63
66
|
if (((_b = (_a = syntaxHighlighterWrapperRef.current) === null || _a === void 0 ? void 0 : _a.clientHeight) !== null && _b !== void 0 ? _b : 0) >=
|
|
64
67
|
((_d = (_c = syntaxHighlighterWrapperRef.current) === null || _c === void 0 ? void 0 : _c.scrollHeight) !== null && _d !== void 0 ? _d : 0)) {
|
|
65
68
|
setContainerHeight(`fit-content`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeBlockWrapper.js","sourceRoot":"","sources":["../../../src/_common/CodeBlockWrapper.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;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CAAC,CAAC;4BACrC,aAAa,CAAC,KAAK,CAAC,CAAC;wBACvB,CAAC;6BAAM,CAAC;4BACN,kBAAkB,CAAC,aAAa,CAAC,CAAC;4BAClC,aAAa,CAAC,IAAI,CAAC,CAAC;wBACtB,CAAC;oBACH,CAAC,YAEA,UAAU,CAAC,CAAC,CAAC,uBAAC,4BAAoB,KAAG,CAAC,CAAC,CAAC,uBAAC,8BAAsB,KAAG,GACnD,GACd,CACP,KACS,CACb,CAAC;AACJ,CAAC,CAAC;AAlJW,QAAA,gBAAgB,oBAkJ3B","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 classNames from 'classnames';\nimport type React from 'react';\nimport { useEffect, useLayoutEffect, useRef, useState } from 'react';\n\nimport { CleanIconButton } from '../clean-icon-button';\nimport { ChevronDownIconOutline, ChevronUpIconOutline } from '../icons';\nimport { type PolymorphicCommonProps } from './types';\n\nexport interface CodeBlockWrapperProps {\n maxHeight?: number;\n code: string;\n heading?: string | React.ReactNode;\n children: React.ReactNode;\n isDisabled?: boolean;\n actions?: React.ComponentPropsWithoutRef<typeof CleanIconButton<'button'>>[];\n shouldShowExpandButton: boolean;\n setShouldShowExpandButton: React.Dispatch<React.SetStateAction<boolean>>;\n className?: string;\n style?: React.CSSProperties;\n}\n\nconst defaultElement = 'div';\n\nexport const CodeBlockWrapper = <\n T extends React.ElementType = typeof defaultElement,\n>({\n as,\n maxHeight,\n code,\n heading,\n children,\n isDisabled,\n actions,\n shouldShowExpandButton,\n setShouldShowExpandButton,\n className,\n style,\n ref,\n htmlAttributes,\n ...restProps\n}: PolymorphicCommonProps<T, CodeBlockWrapperProps>) => {\n const Component: React.ElementType = as ?? defaultElement;\n\n const syntaxHighlighterWrapperRef = useRef<HTMLDivElement>(null);\n\n const [containerHeight, setContainerHeight] = useState(`${maxHeight}px`);\n const [isExpanded, setIsExpanded] = useState(maxHeight === undefined);\n\n useEffect(() => {\n if (\n (syntaxHighlighterWrapperRef.current?.scrollHeight ?? 0) <=\n (syntaxHighlighterWrapperRef.current?.clientHeight ?? 0)\n ) {\n setIsExpanded(true);\n } else {\n setIsExpanded(false);\n }\n }, []);\n\n useLayoutEffect(() => {\n if (maxHeight === undefined) {\n return;\n }\n\n if (\n (syntaxHighlighterWrapperRef.current?.clientHeight ?? 0) >=\n (syntaxHighlighterWrapperRef.current?.scrollHeight ?? 0)\n ) {\n setContainerHeight(`fit-content`);\n setShouldShowExpandButton(false);\n } else {\n setContainerHeight(`${maxHeight}px`);\n setShouldShowExpandButton(true);\n }\n }, [maxHeight, code, setShouldShowExpandButton]);\n\n return (\n <Component\n ref={ref}\n className={classNames('ndl-code-block-container', className)}\n style={{ height: containerHeight, ...style }}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"n-flex n-flex-col n-h-full\">\n {Boolean(heading) === true && (\n <div\n className={classNames('ndl-code-block-title', {\n 'ndl-disabled': isDisabled,\n })}\n style={{\n maxWidth: `calc(100% - ${(actions?.length ?? 0) * 36 + 20}px)`,\n }}\n data-testid=\"ndl-code-block-title\"\n >\n {heading}\n </div>\n )}\n <div\n className={classNames('ndl-code-content-container', {\n 'ndl-disabled': isDisabled,\n })}\n style={{\n height:\n Boolean(heading) === true ? 'calc(100% - 24px - 12px)' : '100%',\n }}\n >\n {/* Pseudo element on the left to steal the editor focus when clicking outside */}\n <div className=\"ndl-code-pseudo-element\"></div>\n <div\n ref={syntaxHighlighterWrapperRef}\n className=\"ndl-highlight-wrapper\"\n role=\"textbox\"\n aria-label=\"Code snippet\"\n tabIndex={0}\n >\n {children}\n </div>\n {/* Pseudo element on the right to steal the editor focus when clicking outside */}\n <div className=\"ndl-code-pseudo-element\"></div>\n </div>\n </div>\n <div\n className={classNames('ndl-code-block-actions', {\n 'ndl-disabled': isDisabled,\n })}\n >\n {actions?.map((iconButtonProps, i) => {\n const { htmlAttributes, description, ...restCleanIconButtonProps } =\n iconButtonProps;\n return (\n <CleanIconButton\n key={i}\n description={`${description ?? 'CodeBlock Action'}`}\n isDisabled={isDisabled}\n htmlAttributes={{\n 'data-testid': `ndl-action-button-${i}`,\n ...htmlAttributes,\n }}\n {...restCleanIconButtonProps}\n />\n );\n })}\n </div>\n {shouldShowExpandButton && (\n <div className=\"ndl-code-block-expand-button\">\n <CleanIconButton\n description={isExpanded ? 'Collapse' : 'Expand'}\n tooltipProps={{\n root: {\n shouldCloseOnReferenceClick: true,\n },\n }}\n onClick={() => {\n if (isExpanded) {\n setContainerHeight(`${maxHeight}px`);\n setIsExpanded(false);\n } else {\n setContainerHeight(`fit-content`);\n setIsExpanded(true);\n }\n }}\n >\n {isExpanded ? <ChevronUpIconOutline /> : <ChevronDownIconOutline />}\n </CleanIconButton>\n </div>\n )}\n </Component>\n );\n};\n"]}
|
|
@@ -24,7 +24,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
24
24
|
require("@neo4j-ndl/base/lib/neo4j-ds-styles.css");
|
|
25
25
|
const react_1 = require("@neo4j-ndl/react");
|
|
26
26
|
const Component = () => {
|
|
27
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "n-
|
|
27
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "n-grid n-grid-cols-3 n-gap-token-8 n-items-center", children: [(0, jsx_runtime_1.jsx)(react_1.FilledButton, { variant: "primary", children: "Filled Primary" }), (0, jsx_runtime_1.jsx)(react_1.FilledButton, { variant: "danger", children: "Filled Danger" }), (0, jsx_runtime_1.jsx)("div", {}), (0, jsx_runtime_1.jsx)(react_1.OutlinedButton, { variant: "primary", children: "Outlined Primary" }), (0, jsx_runtime_1.jsx)(react_1.OutlinedButton, { variant: "danger", children: "Outlined Danger" }), (0, jsx_runtime_1.jsx)(react_1.OutlinedButton, { variant: "neutral", children: "Outlined Neutral" }), (0, jsx_runtime_1.jsx)(react_1.TextButton, { variant: "primary", children: "Text Primary" }), (0, jsx_runtime_1.jsx)(react_1.TextButton, { variant: "danger", children: "Text Danger" }), (0, jsx_runtime_1.jsx)(react_1.TextButton, { variant: "neutral", children: "Text Neutral" })] }));
|
|
28
28
|
};
|
|
29
29
|
exports.default = Component;
|
|
30
30
|
//# sourceMappingURL=button-variants.story.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-variants.story.js","sourceRoot":"","sources":["../../../../src/button/stories/button-variants.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mDAAiD;AAEjD,4CAA4E;AAE5E,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,CACL,iCAAK,SAAS,EAAC,
|
|
1
|
+
{"version":3,"file":"button-variants.story.js","sourceRoot":"","sources":["../../../../src/button/stories/button-variants.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mDAAiD;AAEjD,4CAA4E;AAE5E,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,CACL,iCAAK,SAAS,EAAC,mDAAmD,aAChE,uBAAC,oBAAY,IAAC,OAAO,EAAC,SAAS,+BAA8B,EAC7D,uBAAC,oBAAY,IAAC,OAAO,EAAC,QAAQ,8BAA6B,EAC3D,iCAAO,EACP,uBAAC,sBAAc,IAAC,OAAO,EAAC,SAAS,iCAAkC,EACnE,uBAAC,sBAAc,IAAC,OAAO,EAAC,QAAQ,gCAAiC,EACjE,uBAAC,sBAAc,IAAC,OAAO,EAAC,SAAS,iCAAkC,EACnE,uBAAC,kBAAU,IAAC,OAAO,EAAC,SAAS,6BAA0B,EACvD,uBAAC,kBAAU,IAAC,OAAO,EAAC,QAAQ,4BAAyB,EACrD,uBAAC,kBAAU,IAAC,OAAO,EAAC,SAAS,6BAA0B,IACnD,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,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 */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { FilledButton, OutlinedButton, TextButton } from '@neo4j-ndl/react';\n\nconst Component = () => {\n return (\n <div className=\"n-grid n-grid-cols-3 n-gap-token-8 n-items-center\">\n <FilledButton variant=\"primary\">Filled Primary</FilledButton>\n <FilledButton variant=\"danger\">Filled Danger</FilledButton>\n <div />\n <OutlinedButton variant=\"primary\">Outlined Primary</OutlinedButton>\n <OutlinedButton variant=\"danger\">Outlined Danger</OutlinedButton>\n <OutlinedButton variant=\"neutral\">Outlined Neutral</OutlinedButton>\n <TextButton variant=\"primary\">Text Primary</TextButton>\n <TextButton variant=\"danger\">Text Danger</TextButton>\n <TextButton variant=\"neutral\">Text Neutral</TextButton>\n </div>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextButton.js","sourceRoot":"","sources":["../../../src/text-button/TextButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAuBA,qDAI8B;AAOvB,MAAM,UAAU,GAAG,CAAyC,EActB,EAAE,EAAE;QAdkB,EACjE,QAAQ,EACR,EAAE,EACF,IAAI,GAAG,QAAQ,EACf,SAAS,GAAG,KAAK,EACjB,OAAO,GAAG,SAAS,EACnB,UAAU,GAAG,KAAK,EAClB,IAAI,GAAG,QAAQ,EACf,OAAO,EACP,SAAS,EACT,KAAK,EACL,cAAc,EACd,GAAG,OAEwC,EADxC,SAAS,cAbqD,kIAclE,CADa;IAEZ,OAAO,CACL,uBAAC,uBAAU,kBACT,EAAE,EAAE,EAAE,EACN,UAAU,EAAC,MAAM,EACjB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,cAAc,EAC9B,GAAG,EAAE,GAAG,IACJ,SAAS,cAEZ,QAAQ,IACE,CACd,CAAC;AACJ,CAAC,CAAC;AAlCW,QAAA,UAAU,cAkCrB","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 type React from 'react';\n\nimport { type PolymorphicCommonProps } from '../_common/types';\nimport {\n ButtonBase,\n type ButtonVariants,\n type CommonButtonProps,\n} from '../button/ButtonBase';\n\ntype TextButtonProps = CommonButtonProps & {\n /** Variant of the button */\n variant?:
|
|
1
|
+
{"version":3,"file":"TextButton.js","sourceRoot":"","sources":["../../../src/text-button/TextButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAuBA,qDAI8B;AAOvB,MAAM,UAAU,GAAG,CAAyC,EActB,EAAE,EAAE;QAdkB,EACjE,QAAQ,EACR,EAAE,EACF,IAAI,GAAG,QAAQ,EACf,SAAS,GAAG,KAAK,EACjB,OAAO,GAAG,SAAS,EACnB,UAAU,GAAG,KAAK,EAClB,IAAI,GAAG,QAAQ,EACf,OAAO,EACP,SAAS,EACT,KAAK,EACL,cAAc,EACd,GAAG,OAEwC,EADxC,SAAS,cAbqD,kIAclE,CADa;IAEZ,OAAO,CACL,uBAAC,uBAAU,kBACT,EAAE,EAAE,EAAE,EACN,UAAU,EAAC,MAAM,EACjB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,cAAc,EAC9B,GAAG,EAAE,GAAG,IACJ,SAAS,cAEZ,QAAQ,IACE,CACd,CAAC;AACJ,CAAC,CAAC;AAlCW,QAAA,UAAU,cAkCrB","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 type React from 'react';\n\nimport { type PolymorphicCommonProps } from '../_common/types';\nimport {\n ButtonBase,\n type ButtonVariants,\n type CommonButtonProps,\n} from '../button/ButtonBase';\n\ntype TextButtonProps = CommonButtonProps & {\n /** Variant of the button */\n variant?: ButtonVariants;\n};\n\nexport const TextButton = <T extends React.ElementType = 'button'>({\n children,\n as,\n type = 'button',\n isLoading = false,\n variant = 'primary',\n isDisabled = false,\n size = 'medium',\n onClick,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, TextButtonProps>) => {\n return (\n <ButtonBase\n as={as}\n buttonFill=\"text\"\n variant={variant}\n className={className}\n isDisabled={isDisabled}\n isLoading={isLoading}\n onClick={onClick}\n size={size}\n style={style}\n type={type}\n htmlAttributes={htmlAttributes}\n ref={ref}\n {...restProps}\n >\n {children}\n </ButtonBase>\n );\n};\n"]}
|
|
@@ -54,6 +54,9 @@ export const CodeBlockWrapper = (_a) => {
|
|
|
54
54
|
}, []);
|
|
55
55
|
useLayoutEffect(() => {
|
|
56
56
|
var _a, _b, _c, _d;
|
|
57
|
+
if (maxHeight === undefined) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
57
60
|
if (((_b = (_a = syntaxHighlighterWrapperRef.current) === null || _a === void 0 ? void 0 : _a.clientHeight) !== null && _b !== void 0 ? _b : 0) >=
|
|
58
61
|
((_d = (_c = syntaxHighlighterWrapperRef.current) === null || _c === void 0 ? void 0 : _c.scrollHeight) !== null && _d !== void 0 ? _d : 0)) {
|
|
59
62
|
setContainerHeight(`fit-content`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeBlockWrapper.js","sourceRoot":"","sources":["../../../src/_common/CodeBlockWrapper.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAErE,OAAO,EAAE,eAA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CAAC,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 classNames from 'classnames';\nimport type React from 'react';\nimport { useEffect, useLayoutEffect, useRef, useState } from 'react';\n\nimport { CleanIconButton } from '../clean-icon-button';\nimport { ChevronDownIconOutline, ChevronUpIconOutline } from '../icons';\nimport { type PolymorphicCommonProps } from './types';\n\nexport interface CodeBlockWrapperProps {\n maxHeight?: number;\n code: string;\n heading?: string | React.ReactNode;\n children: React.ReactNode;\n isDisabled?: boolean;\n actions?: React.ComponentPropsWithoutRef<typeof CleanIconButton<'button'>>[];\n shouldShowExpandButton: boolean;\n setShouldShowExpandButton: React.Dispatch<React.SetStateAction<boolean>>;\n className?: string;\n style?: React.CSSProperties;\n}\n\nconst defaultElement = 'div';\n\nexport const CodeBlockWrapper = <\n T extends React.ElementType = typeof defaultElement,\n>({\n as,\n maxHeight,\n code,\n heading,\n children,\n isDisabled,\n actions,\n shouldShowExpandButton,\n setShouldShowExpandButton,\n className,\n style,\n ref,\n htmlAttributes,\n ...restProps\n}: PolymorphicCommonProps<T, CodeBlockWrapperProps>) => {\n const Component: React.ElementType = as ?? defaultElement;\n\n const syntaxHighlighterWrapperRef = useRef<HTMLDivElement>(null);\n\n const [containerHeight, setContainerHeight] = useState(`${maxHeight}px`);\n const [isExpanded, setIsExpanded] = useState(maxHeight === undefined);\n\n useEffect(() => {\n if (\n (syntaxHighlighterWrapperRef.current?.scrollHeight ?? 0) <=\n (syntaxHighlighterWrapperRef.current?.clientHeight ?? 0)\n ) {\n setIsExpanded(true);\n } else {\n setIsExpanded(false);\n }\n }, []);\n\n useLayoutEffect(() => {\n if (\n (syntaxHighlighterWrapperRef.current?.clientHeight ?? 0) >=\n (syntaxHighlighterWrapperRef.current?.scrollHeight ?? 0)\n ) {\n setContainerHeight(`fit-content`);\n setShouldShowExpandButton(false);\n } else {\n setContainerHeight(`${maxHeight}px`);\n setShouldShowExpandButton(true);\n }\n }, [maxHeight, code, setShouldShowExpandButton]);\n\n return (\n <Component\n ref={ref}\n className={classNames('ndl-code-block-container', className)}\n style={{ height: containerHeight, ...style }}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"n-flex n-flex-col n-h-full\">\n {Boolean(heading) === true && (\n <div\n className={classNames('ndl-code-block-title', {\n 'ndl-disabled': isDisabled,\n })}\n style={{\n maxWidth: `calc(100% - ${(actions?.length ?? 0) * 36 + 20}px)`,\n }}\n data-testid=\"ndl-code-block-title\"\n >\n {heading}\n </div>\n )}\n <div\n className={classNames('ndl-code-content-container', {\n 'ndl-disabled': isDisabled,\n })}\n style={{\n height:\n Boolean(heading) === true ? 'calc(100% - 24px - 12px)' : '100%',\n }}\n >\n {/* Pseudo element on the left to steal the editor focus when clicking outside */}\n <div className=\"ndl-code-pseudo-element\"></div>\n <div\n ref={syntaxHighlighterWrapperRef}\n className=\"ndl-highlight-wrapper\"\n role=\"textbox\"\n aria-label=\"Code snippet\"\n tabIndex={0}\n >\n {children}\n </div>\n {/* Pseudo element on the right to steal the editor focus when clicking outside */}\n <div className=\"ndl-code-pseudo-element\"></div>\n </div>\n </div>\n <div\n className={classNames('ndl-code-block-actions', {\n 'ndl-disabled': isDisabled,\n })}\n >\n {actions?.map((iconButtonProps, i) => {\n const { htmlAttributes, description, ...restCleanIconButtonProps } =\n iconButtonProps;\n return (\n <CleanIconButton\n key={i}\n description={`${description ?? 'CodeBlock Action'}`}\n isDisabled={isDisabled}\n htmlAttributes={{\n 'data-testid': `ndl-action-button-${i}`,\n ...htmlAttributes,\n }}\n {...restCleanIconButtonProps}\n />\n );\n })}\n </div>\n {shouldShowExpandButton && (\n <div className=\"ndl-code-block-expand-button\">\n <CleanIconButton\n description={isExpanded ? 'Collapse' : 'Expand'}\n tooltipProps={{\n root: {\n shouldCloseOnReferenceClick: true,\n },\n }}\n onClick={() => {\n if (isExpanded) {\n setContainerHeight(`${maxHeight}px`);\n setIsExpanded(false);\n } else {\n setContainerHeight(`fit-content`);\n setIsExpanded(true);\n }\n }}\n >\n {isExpanded ? <ChevronUpIconOutline /> : <ChevronDownIconOutline />}\n </CleanIconButton>\n </div>\n )}\n </Component>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"CodeBlockWrapper.js","sourceRoot":"","sources":["../../../src/_common/CodeBlockWrapper.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAErE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAgBxE,MAAM,cAAc,GAAG,KAAK,CAAC;AAE7B,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAE9B,EAeiD,EAAE,EAAE;;QAfrD,EACA,EAAE,EACF,SAAS,EACT,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,UAAU,EACV,OAAO,EACP,sBAAsB,EACtB,yBAAyB,EACzB,SAAS,EACT,KAAK,EACL,GAAG,EACH,cAAc,OAEmC,EAD9C,SAAS,cAdZ,iLAeD,CADa;IAEZ,MAAM,SAAS,GAAsB,EAAE,aAAF,EAAE,cAAF,EAAE,GAAI,cAAc,CAAC;IAE1D,MAAM,2BAA2B,GAAG,MAAM,CAAiB,I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E,EACnD,UAAU,EAAE,UAAU,EACtB,cAAc,kBACZ,aAAa,EAAE,qBAAqB,CAAC,EAAE,IACpC,cAAc,KAEf,wBAAwB,GAPvB,CAAC,CAQN,CACH,CAAC;gBACJ,CAAC,CAAC,GACE,EACL,sBAAsB,IAAI,CACzB,cAAK,SAAS,EAAC,8BAA8B,YAC3C,KAAC,eAAe,IACd,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,EAC/C,YAAY,EAAE;wBACZ,IAAI,EAAE;4BACJ,2BAA2B,EAAE,IAAI;yBAClC;qBACF,EACD,OAAO,EAAE,GAAG,EAAE;wBACZ,IAAI,UAAU,EAAE,CAAC;4BACf,kBAAkB,CAAC,GAAG,SAAS,IAAI,CAAC,CAAC;4BACrC,aAAa,CAAC,KAAK,CAAC,CAAC;wBACvB,CAAC;6BAAM,CAAC;4BACN,kBAAkB,CAAC,aAAa,CAAC,CAAC;4BAClC,aAAa,CAAC,IAAI,CAAC,CAAC;wBACtB,CAAC;oBACH,CAAC,YAEA,UAAU,CAAC,CAAC,CAAC,KAAC,oBAAoB,KAAG,CAAC,CAAC,CAAC,KAAC,sBAAsB,KAAG,GACnD,GACd,CACP,KACS,CACb,CAAC;AACJ,CAAC,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 classNames from 'classnames';\nimport type React from 'react';\nimport { useEffect, useLayoutEffect, useRef, useState } from 'react';\n\nimport { CleanIconButton } from '../clean-icon-button';\nimport { ChevronDownIconOutline, ChevronUpIconOutline } from '../icons';\nimport { type PolymorphicCommonProps } from './types';\n\nexport interface CodeBlockWrapperProps {\n maxHeight?: number;\n code: string;\n heading?: string | React.ReactNode;\n children: React.ReactNode;\n isDisabled?: boolean;\n actions?: React.ComponentPropsWithoutRef<typeof CleanIconButton<'button'>>[];\n shouldShowExpandButton: boolean;\n setShouldShowExpandButton: React.Dispatch<React.SetStateAction<boolean>>;\n className?: string;\n style?: React.CSSProperties;\n}\n\nconst defaultElement = 'div';\n\nexport const CodeBlockWrapper = <\n T extends React.ElementType = typeof defaultElement,\n>({\n as,\n maxHeight,\n code,\n heading,\n children,\n isDisabled,\n actions,\n shouldShowExpandButton,\n setShouldShowExpandButton,\n className,\n style,\n ref,\n htmlAttributes,\n ...restProps\n}: PolymorphicCommonProps<T, CodeBlockWrapperProps>) => {\n const Component: React.ElementType = as ?? defaultElement;\n\n const syntaxHighlighterWrapperRef = useRef<HTMLDivElement>(null);\n\n const [containerHeight, setContainerHeight] = useState(`${maxHeight}px`);\n const [isExpanded, setIsExpanded] = useState(maxHeight === undefined);\n\n useEffect(() => {\n if (\n (syntaxHighlighterWrapperRef.current?.scrollHeight ?? 0) <=\n (syntaxHighlighterWrapperRef.current?.clientHeight ?? 0)\n ) {\n setIsExpanded(true);\n } else {\n setIsExpanded(false);\n }\n }, []);\n\n useLayoutEffect(() => {\n if (maxHeight === undefined) {\n return;\n }\n\n if (\n (syntaxHighlighterWrapperRef.current?.clientHeight ?? 0) >=\n (syntaxHighlighterWrapperRef.current?.scrollHeight ?? 0)\n ) {\n setContainerHeight(`fit-content`);\n setShouldShowExpandButton(false);\n } else {\n setContainerHeight(`${maxHeight}px`);\n setShouldShowExpandButton(true);\n }\n }, [maxHeight, code, setShouldShowExpandButton]);\n\n return (\n <Component\n ref={ref}\n className={classNames('ndl-code-block-container', className)}\n style={{ height: containerHeight, ...style }}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"n-flex n-flex-col n-h-full\">\n {Boolean(heading) === true && (\n <div\n className={classNames('ndl-code-block-title', {\n 'ndl-disabled': isDisabled,\n })}\n style={{\n maxWidth: `calc(100% - ${(actions?.length ?? 0) * 36 + 20}px)`,\n }}\n data-testid=\"ndl-code-block-title\"\n >\n {heading}\n </div>\n )}\n <div\n className={classNames('ndl-code-content-container', {\n 'ndl-disabled': isDisabled,\n })}\n style={{\n height:\n Boolean(heading) === true ? 'calc(100% - 24px - 12px)' : '100%',\n }}\n >\n {/* Pseudo element on the left to steal the editor focus when clicking outside */}\n <div className=\"ndl-code-pseudo-element\"></div>\n <div\n ref={syntaxHighlighterWrapperRef}\n className=\"ndl-highlight-wrapper\"\n role=\"textbox\"\n aria-label=\"Code snippet\"\n tabIndex={0}\n >\n {children}\n </div>\n {/* Pseudo element on the right to steal the editor focus when clicking outside */}\n <div className=\"ndl-code-pseudo-element\"></div>\n </div>\n </div>\n <div\n className={classNames('ndl-code-block-actions', {\n 'ndl-disabled': isDisabled,\n })}\n >\n {actions?.map((iconButtonProps, i) => {\n const { htmlAttributes, description, ...restCleanIconButtonProps } =\n iconButtonProps;\n return (\n <CleanIconButton\n key={i}\n description={`${description ?? 'CodeBlock Action'}`}\n isDisabled={isDisabled}\n htmlAttributes={{\n 'data-testid': `ndl-action-button-${i}`,\n ...htmlAttributes,\n }}\n {...restCleanIconButtonProps}\n />\n );\n })}\n </div>\n {shouldShowExpandButton && (\n <div className=\"ndl-code-block-expand-button\">\n <CleanIconButton\n description={isExpanded ? 'Collapse' : 'Expand'}\n tooltipProps={{\n root: {\n shouldCloseOnReferenceClick: true,\n },\n }}\n onClick={() => {\n if (isExpanded) {\n setContainerHeight(`${maxHeight}px`);\n setIsExpanded(false);\n } else {\n setContainerHeight(`fit-content`);\n setIsExpanded(true);\n }\n }}\n >\n {isExpanded ? <ChevronUpIconOutline /> : <ChevronDownIconOutline />}\n </CleanIconButton>\n </div>\n )}\n </Component>\n );\n};\n"]}
|
|
@@ -22,7 +22,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
22
22
|
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
23
23
|
import { FilledButton, OutlinedButton, TextButton } from '@neo4j-ndl/react';
|
|
24
24
|
const Component = () => {
|
|
25
|
-
return (_jsxs("div", { className: "n-
|
|
25
|
+
return (_jsxs("div", { className: "n-grid n-grid-cols-3 n-gap-token-8 n-items-center", children: [_jsx(FilledButton, { variant: "primary", children: "Filled Primary" }), _jsx(FilledButton, { variant: "danger", children: "Filled Danger" }), _jsx("div", {}), _jsx(OutlinedButton, { variant: "primary", children: "Outlined Primary" }), _jsx(OutlinedButton, { variant: "danger", children: "Outlined Danger" }), _jsx(OutlinedButton, { variant: "neutral", children: "Outlined Neutral" }), _jsx(TextButton, { variant: "primary", children: "Text Primary" }), _jsx(TextButton, { variant: "danger", children: "Text Danger" }), _jsx(TextButton, { variant: "neutral", children: "Text Neutral" })] }));
|
|
26
26
|
};
|
|
27
27
|
export default Component;
|
|
28
28
|
//# sourceMappingURL=button-variants.story.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-variants.story.js","sourceRoot":"","sources":["../../../../src/button/stories/button-variants.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE5E,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,CACL,eAAK,SAAS,EAAC,
|
|
1
|
+
{"version":3,"file":"button-variants.story.js","sourceRoot":"","sources":["../../../../src/button/stories/button-variants.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE5E,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,CACL,eAAK,SAAS,EAAC,mDAAmD,aAChE,KAAC,YAAY,IAAC,OAAO,EAAC,SAAS,+BAA8B,EAC7D,KAAC,YAAY,IAAC,OAAO,EAAC,QAAQ,8BAA6B,EAC3D,eAAO,EACP,KAAC,cAAc,IAAC,OAAO,EAAC,SAAS,iCAAkC,EACnE,KAAC,cAAc,IAAC,OAAO,EAAC,QAAQ,gCAAiC,EACjE,KAAC,cAAc,IAAC,OAAO,EAAC,SAAS,iCAAkC,EACnE,KAAC,UAAU,IAAC,OAAO,EAAC,SAAS,6BAA0B,EACvD,KAAC,UAAU,IAAC,OAAO,EAAC,QAAQ,4BAAyB,EACrD,KAAC,UAAU,IAAC,OAAO,EAAC,SAAS,6BAA0B,IACnD,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,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 */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { FilledButton, OutlinedButton, TextButton } from '@neo4j-ndl/react';\n\nconst Component = () => {\n return (\n <div className=\"n-grid n-grid-cols-3 n-gap-token-8 n-items-center\">\n <FilledButton variant=\"primary\">Filled Primary</FilledButton>\n <FilledButton variant=\"danger\">Filled Danger</FilledButton>\n <div />\n <OutlinedButton variant=\"primary\">Outlined Primary</OutlinedButton>\n <OutlinedButton variant=\"danger\">Outlined Danger</OutlinedButton>\n <OutlinedButton variant=\"neutral\">Outlined Neutral</OutlinedButton>\n <TextButton variant=\"primary\">Text Primary</TextButton>\n <TextButton variant=\"danger\">Text Danger</TextButton>\n <TextButton variant=\"neutral\">Text Neutral</TextButton>\n </div>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextButton.js","sourceRoot":"","sources":["../../../src/text-button/TextButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAuBA,OAAO,EACL,UAAU,GAGX,MAAM,sBAAsB,CAAC;AAO9B,MAAM,CAAC,MAAM,UAAU,GAAG,CAAyC,EActB,EAAE,EAAE;QAdkB,EACjE,QAAQ,EACR,EAAE,EACF,IAAI,GAAG,QAAQ,EACf,SAAS,GAAG,KAAK,EACjB,OAAO,GAAG,SAAS,EACnB,UAAU,GAAG,KAAK,EAClB,IAAI,GAAG,QAAQ,EACf,OAAO,EACP,SAAS,EACT,KAAK,EACL,cAAc,EACd,GAAG,OAEwC,EADxC,SAAS,cAbqD,kIAclE,CADa;IAEZ,OAAO,CACL,KAAC,UAAU,kBACT,EAAE,EAAE,EAAE,EACN,UAAU,EAAC,MAAM,EACjB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,cAAc,EAC9B,GAAG,EAAE,GAAG,IACJ,SAAS,cAEZ,QAAQ,IACE,CACd,CAAC;AACJ,CAAC,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 type React from 'react';\n\nimport { type PolymorphicCommonProps } from '../_common/types';\nimport {\n ButtonBase,\n type ButtonVariants,\n type CommonButtonProps,\n} from '../button/ButtonBase';\n\ntype TextButtonProps = CommonButtonProps & {\n /** Variant of the button */\n variant?:
|
|
1
|
+
{"version":3,"file":"TextButton.js","sourceRoot":"","sources":["../../../src/text-button/TextButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAuBA,OAAO,EACL,UAAU,GAGX,MAAM,sBAAsB,CAAC;AAO9B,MAAM,CAAC,MAAM,UAAU,GAAG,CAAyC,EActB,EAAE,EAAE;QAdkB,EACjE,QAAQ,EACR,EAAE,EACF,IAAI,GAAG,QAAQ,EACf,SAAS,GAAG,KAAK,EACjB,OAAO,GAAG,SAAS,EACnB,UAAU,GAAG,KAAK,EAClB,IAAI,GAAG,QAAQ,EACf,OAAO,EACP,SAAS,EACT,KAAK,EACL,cAAc,EACd,GAAG,OAEwC,EADxC,SAAS,cAbqD,kIAclE,CADa;IAEZ,OAAO,CACL,KAAC,UAAU,kBACT,EAAE,EAAE,EAAE,EACN,UAAU,EAAC,MAAM,EACjB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,cAAc,EAC9B,GAAG,EAAE,GAAG,IACJ,SAAS,cAEZ,QAAQ,IACE,CACd,CAAC;AACJ,CAAC,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 type React from 'react';\n\nimport { type PolymorphicCommonProps } from '../_common/types';\nimport {\n ButtonBase,\n type ButtonVariants,\n type CommonButtonProps,\n} from '../button/ButtonBase';\n\ntype TextButtonProps = CommonButtonProps & {\n /** Variant of the button */\n variant?: ButtonVariants;\n};\n\nexport const TextButton = <T extends React.ElementType = 'button'>({\n children,\n as,\n type = 'button',\n isLoading = false,\n variant = 'primary',\n isDisabled = false,\n size = 'medium',\n onClick,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, TextButtonProps>) => {\n return (\n <ButtonBase\n as={as}\n buttonFill=\"text\"\n variant={variant}\n className={className}\n isDisabled={isDisabled}\n isLoading={isLoading}\n onClick={onClick}\n size={size}\n style={style}\n type={type}\n htmlAttributes={htmlAttributes}\n ref={ref}\n {...restProps}\n >\n {children}\n </ButtonBase>\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeBlockWrapper.d.ts","sourceRoot":"","sources":["../../../src/_common/CodeBlockWrapper.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD,MAAM,WAAW,qBAAqB;IACpC,SAAS,CAAC,EAAE,MAA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,CAAC,CAAC,EAAE,CAAC;IAC7E,sBAAsB,EAAE,OAAO,CAAC;IAChC,yBAAyB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACzE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAED,QAAA,MAAM,cAAc,QAAQ,CAAC;AAE7B,eAAO,MAAM,gBAAgB,GAC3B,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,OAAO,cAAc,EACnD,yKAeC,sBAAsB,CAAC,CAAC,EAAE,qBAAqB,CAAC,4CAiIlD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-variants.story.d.ts","sourceRoot":"","sources":["../../../../src/button/stories/button-variants.story.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAIjD,QAAA,MAAM,SAAS,+
|
|
1
|
+
{"version":3,"file":"button-variants.story.d.ts","sourceRoot":"","sources":["../../../../src/button/stories/button-variants.story.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAIjD,QAAA,MAAM,SAAS,+CAcd,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -23,7 +23,7 @@ import { type PolymorphicCommonProps } from '../_common/types';
|
|
|
23
23
|
import { type ButtonVariants, type CommonButtonProps } from '../button/ButtonBase';
|
|
24
24
|
type TextButtonProps = CommonButtonProps & {
|
|
25
25
|
/** Variant of the button */
|
|
26
|
-
variant?:
|
|
26
|
+
variant?: ButtonVariants;
|
|
27
27
|
};
|
|
28
28
|
export declare const TextButton: <T extends React.ElementType = "button">({ children, as, type, isLoading, variant, isDisabled, size, onClick, className, style, htmlAttributes, ref, ...restProps }: PolymorphicCommonProps<T, TextButtonProps>) => import("react/jsx-runtime").JSX.Element;
|
|
29
29
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextButton.d.ts","sourceRoot":"","sources":["../../../src/text-button/TextButton.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACvB,MAAM,sBAAsB,CAAC;AAE9B,KAAK,eAAe,GAAG,iBAAiB,GAAG;IACzC,4BAA4B;IAC5B,OAAO,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"TextButton.d.ts","sourceRoot":"","sources":["../../../src/text-button/TextButton.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACvB,MAAM,sBAAsB,CAAC;AAE9B,KAAK,eAAe,GAAG,iBAAiB,GAAG;IACzC,4BAA4B;IAC5B,OAAO,CAAC,EAAE,cAAc,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,QAAQ,EAAE,4HAchE,sBAAsB,CAAC,CAAC,EAAE,eAAe,CAAC,4CAoB5C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neo4j-ndl/react",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.13",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"description": "React implementation of Neo4j Design System",
|
|
6
6
|
"keywords": [
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"@tanstack/react-table": "8.21.3",
|
|
87
87
|
"react": ">=19.0.0",
|
|
88
88
|
"react-dom": ">=19.0.0",
|
|
89
|
-
"@neo4j-ndl/base": "^4.2.
|
|
89
|
+
"@neo4j-ndl/base": "^4.2.4"
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
92
|
"@dnd-kit/core": "6.3.1",
|