@entur/button 3.3.13-beta.3 → 3.3.13-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Button.d.ts +42 -0
- package/dist/ButtonGroup.d.ts +14 -0
- package/dist/FloatingButton.d.ts +18 -0
- package/dist/IconButton.d.ts +32 -0
- package/dist/NegativeButton.d.ts +29 -0
- package/dist/PrimaryButton.d.ts +29 -0
- package/dist/SecondaryButton.d.ts +29 -0
- package/dist/SecondarySquareButton.d.ts +21 -0
- package/dist/SquareButton.d.ts +26 -0
- package/dist/SuccessButton.d.ts +29 -0
- package/dist/SuccessSquareButton.d.ts +21 -0
- package/dist/TertiaryButton.d.ts +30 -0
- package/dist/TertiarySquareButton.d.ts +23 -0
- package/dist/button.cjs.development.js +309 -0
- package/dist/button.cjs.development.js.map +1 -0
- package/dist/button.cjs.production.min.js +2 -0
- package/dist/button.cjs.production.min.js.map +1 -0
- package/dist/button.esm.js +269 -245
- package/dist/button.esm.js.map +1 -1
- package/dist/index.d.ts +13 -383
- package/dist/index.js +8 -0
- package/dist/styles.css +490 -472
- package/package.json +13 -23
- package/dist/button.cjs.js +0 -268
- package/dist/button.cjs.js.map +0 -1
package/dist/button.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.esm.js","sources":["../src/Button.tsx","../src/PrimaryButton.tsx","../src/SecondaryButton.tsx","../src/SuccessButton.tsx","../src/NegativeButton.tsx","../src/TertiaryButton.tsx","../src/ButtonGroup.tsx","../src/FloatingButton.tsx","../src/SquareButton.tsx","../src/SecondarySquareButton.tsx","../src/SuccessSquareButton.tsx","../src/TertiarySquareButton.tsx","../src/IconButton.tsx","../src/index.tsx"],"sourcesContent":["import * as React from 'react';\nimport cx from 'classnames';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\nimport { LoadingDots } from '@entur/loader';\nimport './Button.scss';\n\n/** @deprecated use variant=\"secondary\" size=\"small\" instead */\nconst tertiary = 'tertiary';\n\ntype ButtonBaseProps = {\n /** Farge og uttrykk på knappen */\n variant: 'primary' | 'secondary' | 'success' | 'negative' | typeof tertiary;\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n /** Et HTML-element eller en React-komponent som komponenten tar utgangspunkt i for å lage denne knappevarianten\n * @default \"button\"\n */\n as?: string | React.ElementType;\n /**\n * Tekst som leses opp på skjermleser (nødvendig når knappetekst mangler)\n */\n 'aria-label'?: string;\n};\n\nconst defaultElement = 'button';\n\nexport type ButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, ButtonBaseProps>;\n\nexport type ButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: ButtonProps<T>,\n) => React.ReactElement | null;\n\nexport const Button: ButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n {\n as,\n children,\n variant = 'primary',\n size = 'medium',\n loading,\n className,\n disabled = false,\n width = 'auto',\n 'aria-label': ariaLabel,\n ...rest\n }: ButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = as || defaultElement;\n const childrenArray = React.Children.toArray(children);\n const hasLeadingIcon =\n childrenArray.length > 1 && typeof childrenArray[0] !== 'string';\n const hasTrailingIcon =\n childrenArray.length > 1 &&\n typeof childrenArray[childrenArray.length - 1] !== 'string';\n\n const ariaLabelWhenLoading = childrenArray\n .filter(child => typeof child === 'string')\n .join(' ');\n\n const ariaLabelValue = () => {\n if (ariaLabel) return ariaLabel;\n if (loading) return ariaLabelWhenLoading;\n return undefined;\n };\n\n return (\n <Element\n className={cx(\n 'eds-button',\n {\n [`eds-button--variant-${variant}`]: variant,\n [`eds-button--size-${size}`]: size,\n 'eds-button--width-fluid': width === 'fluid',\n 'eds-button--loading': loading,\n 'eds-button--leading-icon': hasLeadingIcon,\n 'eds-button--trailing-icon': hasTrailingIcon,\n },\n className,\n )}\n ref={ref}\n aria-busy={loading}\n disabled={disabled}\n aria-disabled={disabled}\n aria-label={ariaLabelValue()}\n {...rest}\n >\n {loading ? (\n <LoadingDots className=\"eds-button__loading-dots\" />\n ) : (\n children\n )}\n </Element>\n );\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type PrimaryButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type PrimaryButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, PrimaryButtonBaseProps>;\n\nexport type PrimaryButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: PrimaryButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const PrimaryButton: PrimaryButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PrimaryButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"primary\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type SecondaryButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type SecondaryButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, SecondaryButtonBaseProps>;\n\nexport type SecondaryButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: SecondaryButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const SecondaryButton: SecondaryButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: SecondaryButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"secondary\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type SuccessButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type SuccessButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, SuccessButtonBaseProps>;\n\nexport type SuccessButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: SuccessButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const SuccessButton: SuccessButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: SuccessButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"success\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type NegativeButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type NegativeButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, NegativeButtonBaseProps>;\n\nexport type NegativeButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: NegativeButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const NegativeButton: NegativeButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: NegativeButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"negative\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type TertiaryButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type TertiaryButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, TertiaryButtonBaseProps>;\n\nexport type TertiaryButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: TertiaryButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\n/** @deprecated use SecondaryButton size=\"small\" instead */\nexport const TertiaryButton: TertiaryButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: TertiaryButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n <Button\n as={Element}\n {...props}\n ref={ref}\n variant=\"tertiary\"\n size=\"small\"\n />\n );\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport './ButtonGroup.scss';\n\nexport type ButtonGroupProps = {\n /** To eller flere Button-komponenter */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** HTML-elementet eller React-komponenten som lages\n * @default \"div\"\n */\n as?: string | React.ElementType;\n [key: string]: any;\n};\n\nexport const ButtonGroup: React.FC<ButtonGroupProps> = ({\n as: Element = 'div',\n className,\n ...rest\n}) => {\n return (\n <Element className={classNames('eds-button-group', className)} {...rest} />\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport './FloatingButton.scss';\n\nexport type FloatingButtonProps = {\n /** Beskrivende tekst for skjermlesere */\n 'aria-label': string;\n /** Ikon eller ikon-og-tekst */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Callback når knappen klikkes */\n onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;\n /** Størrelse på knappen\n * @default \"medium\"\n */\n size?: 'medium' | 'small';\n [key: string]: any;\n} & React.ButtonHTMLAttributes<HTMLButtonElement>;\n\nexport const FloatingButton: React.FC<FloatingButtonProps> = ({\n className,\n children,\n size = 'medium',\n ...rest\n}) => {\n return (\n <button\n className={classNames(\n 'eds-floating-button',\n { 'eds-floating-button--extended': React.Children.count(children) > 1 },\n { 'eds-floating-button--small': size === 'small' },\n className,\n )}\n type=\"button\"\n {...rest}\n >\n {wrapStringsInSpans(children)}\n </button>\n );\n};\n\nconst wrapStringsInSpans = (children: React.ReactNode) =>\n React.Children.map(children, child =>\n typeof child === 'string' ? <span>{child}</span> : child,\n );\n","import * as React from 'react';\nimport classNames from 'classnames';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\nimport { LoadingDots } from '@entur/loader';\nimport './SquareButton.scss';\n\nexport type SquareButtonBaseProps = {\n /** Tekst og ikon */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** En type knapp */\n variant?: 'success' | 'secondary' | 'tertiary';\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** DOM-elementet knappen rendres som */\n as?: string | React.ElementType;\n};\n\nexport type SquareButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, SquareButtonBaseProps>;\n\nexport type SquareButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: SquareButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const SquareButton: SquareButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n {\n as,\n children,\n className,\n disabled = false,\n loading = false,\n variant = 'secondary',\n ...rest\n }: SquareButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = as || defaultElement;\n return (\n <Element\n className={classNames(\n 'eds-square-button',\n `eds-square-button--${variant}`,\n {\n 'eds-square-button--loading': loading,\n },\n className,\n )}\n aria-busy={loading}\n disabled={disabled}\n aria-disabled={disabled}\n ref={ref}\n {...rest}\n >\n {React.Children.map(children, child => {\n if (typeof child === 'string') {\n return <span className=\"eds-square-button__label\">{child}</span>;\n }\n return (\n <span className=\"eds-square-button__button\">\n {loading ? (\n <LoadingDots className=\"eds-square-button__loading-dots\" />\n ) : (\n child\n )}\n </span>\n );\n })}\n </Element>\n );\n },\n);\n","import React from 'react';\nimport { SquareButton } from './SquareButton';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\ntype SecondarySquareButtonBaseProps = {\n /** Tekst og ikon, ikon og tekst, eller bare ikon */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nexport type SecondarySquareButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, SecondarySquareButtonBaseProps>;\n\nexport type SecondarySquareButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: SecondarySquareButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const SecondarySquareButton: SecondarySquareButtonComponent =\n React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: SecondarySquareButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n // @ts-expect-error type error due to props not being BaseButtonProps\n <SquareButton as={Element} ref={ref} {...props} variant=\"secondary\" />\n );\n },\n );\n","import React from 'react';\nimport { SquareButton } from './SquareButton';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\ntype SuccessSquareButtonBaseProps = {\n /** Tekst og ikon, ikon og tekst, eller bare ikon */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nexport type SuccessSquareButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, SuccessSquareButtonBaseProps>;\n\nexport type SuccessSquareButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: SuccessSquareButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const SuccessSquareButton: SuccessSquareButtonComponent =\n React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: SuccessSquareButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n // @ts-expect-error type error due to props not being BaseButtonProps\n <SquareButton as={Element} ref={ref} {...props} variant=\"success\" />\n );\n },\n );\n","import React from 'react';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\nimport { SquareButton } from './SquareButton';\n\ntype TertiarySquareButtonBaseProps = {\n /** Tekst og ikon, ikon og tekst, eller bare ikon */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** DOM-elementet knappen rendres som */\n as?: string | React.ElementType;\n};\n\nexport type TertiarySquareButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, TertiarySquareButtonBaseProps>;\n\nexport type TertiarySquareButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: TertiarySquareButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const TertiarySquareButton: TertiarySquareButtonComponent =\n React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: TertiarySquareButtonProps<T>,\n ref: PolymorphicRef<T>,\n // @ts-expect-error TS error seems to stem from how the props are built up\n ) => <SquareButton ref={ref} {...props} variant=\"tertiary\" />,\n );\n","import React from 'react';\nimport classNames from 'classnames';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\nimport { LoadingDots } from '@entur/loader';\nimport './IconButton.scss';\n\nexport type IconButtonBaseProps = {\n /** Ikonet som du vil ha inne i knappen */\n children: React.ReactNode;\n /** Tekst som forklarer knappens handling. MÅ være satt hvis du ikke har en forklarende tooltip på knappen */\n 'aria-label'?: string;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** HTML-elementet eller React-komponenten som lager knappen\n * @default 'button'\n */\n as?: React.ElementType;\n /**Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'small' | 'medium';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nconst defaultElement = 'button';\n\nexport type IconButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, IconButtonBaseProps>;\n\nexport type IconButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: IconButtonProps<T>,\n) => React.ReactElement | null;\n\nexport const IconButton: IconButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n {\n children,\n className,\n disabled = false,\n size = 'medium',\n as,\n loading,\n ...rest\n }: IconButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = as || defaultElement;\n\n const IconWithAriaHidden = React.Children.map(children, child => {\n if (React.isValidElement(child)) {\n // @ts-expect-error aria-hidden does, in fact, exist\n return React.cloneElement(child, { 'aria-hidden': true });\n }\n return child;\n });\n\n const iconButtonElement = (\n <Element\n className={classNames(\n 'eds-icon-button',\n className,\n {\n 'eds-icon-button--disabled': disabled,\n },\n `eds-icon-button--size-${size}`,\n )}\n disabled={disabled}\n aria-disabled={disabled}\n aria-busy={loading}\n ref={ref}\n {...rest}\n >\n {loading ? <LoadingDots /> : <>{IconWithAriaHidden}</>}\n </Element>\n );\n\n if (disabled) {\n return (\n <div className=\"eds-icon-button--disabled__wrapper\">\n {iconButtonElement}\n </div>\n );\n }\n return <>{iconButtonElement}</>;\n },\n);\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('button');\n\nexport * from './Button';\nexport * from './PrimaryButton';\nexport * from './SecondaryButton';\nexport * from './SuccessButton';\nexport * from './NegativeButton';\nexport * from './TertiaryButton';\nexport * from './ButtonGroup';\nexport * from './FloatingButton';\nexport * from './SecondarySquareButton';\nexport * from './SuccessSquareButton';\nexport * from './TertiarySquareButton';\nexport * from './IconButton';\n"],"names":["defaultElement","cx","React"],"mappings":";;;;;;AA0CA,MAAMA,mBAAiB;AAWhB,MAAM,SAA0B,MAAM;AAAA,EAC3C,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,GAAG;AAAA,EAAA,GAEL,QACG;AACH,UAAM,UAA6B,MAAMA;AACzC,UAAM,gBAAgB,MAAM,SAAS,QAAQ,QAAQ;AACrD,UAAM,iBACJ,cAAc,SAAS,KAAK,OAAO,cAAc,CAAC,MAAM;AAC1D,UAAM,kBACJ,cAAc,SAAS,KACvB,OAAO,cAAc,cAAc,SAAS,CAAC,MAAM;AAErD,UAAM,uBAAuB,cAC1B,OAAO,CAAA,UAAS,OAAO,UAAU,QAAQ,EACzC,KAAK,GAAG;AAEX,UAAM,iBAAiB,MAAM;AAC3B,UAAI,UAAW,QAAO;AACtB,UAAI,QAAS,QAAO;AACpB,aAAO;AAAA,IACT;AAEA,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAWC;AAAAA,UACT;AAAA,UACA;AAAA,YACE,CAAC,uBAAuB,OAAO,EAAE,GAAG;AAAA,YACpC,CAAC,oBAAoB,IAAI,EAAE,GAAG;AAAA,YAC9B,2BAA2B,UAAU;AAAA,YACrC,uBAAuB;AAAA,YACvB,4BAA4B;AAAA,YAC5B,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AAM,oBACJ;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAW;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,YACE,6BAA6B;AAAA,UAAA;AAAA,UAE/B,yBAAyB,IAAI;AAAA,QAAA;AAAA,QAE/B;AAAA,QACA,iBAAe;AAAA,QACf,aAAW;AAAA,QACX;AAAA,QACC,GAAG;AAAA,QAEH,UAAA,UAAU,oBAAC,aAAA,CAAA,CAAY,oCAAQ,UAAA,mBAAA,CAAmB;AAAA,MAAA;AAAA,IAAA;AAIvD,QAAI,UAAU;AACZ,aACE,oBAAC,OAAA,EAAI,WAAU,sCACZ,UAAA,mBACH;AAAA,IAEJ;AACA,2CAAU,UAAA,kBAAA,CAAkB;AAAA,EAC9B;AACF;AC3FA,uBAAuB,QAAQ;"}
|
|
1
|
+
{"version":3,"file":"button.esm.js","sources":["../src/Button.tsx","../src/PrimaryButton.tsx","../src/SecondaryButton.tsx","../src/SuccessButton.tsx","../src/NegativeButton.tsx","../src/TertiaryButton.tsx","../src/ButtonGroup.tsx","../src/FloatingButton.tsx","../src/SquareButton.tsx","../src/SecondarySquareButton.tsx","../src/SuccessSquareButton.tsx","../src/TertiarySquareButton.tsx","../src/IconButton.tsx","../src/index.tsx"],"sourcesContent":["import * as React from 'react';\nimport cx from 'classnames';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\nimport { LoadingDots } from '@entur/loader';\nimport './Button.scss';\n\n/** @deprecated use variant=\"secondary\" size=\"small\" instead */\nconst tertiary = 'tertiary';\n\ntype ButtonBaseProps = {\n /** Farge og uttrykk på knappen */\n variant: 'primary' | 'secondary' | 'success' | 'negative' | typeof tertiary;\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n /** Et HTML-element eller en React-komponent som komponenten tar utgangspunkt i for å lage denne knappevarianten\n * @default \"button\"\n */\n as?: string | React.ElementType;\n /**\n * Tekst som leses opp på skjermleser (nødvendig når knappetekst mangler)\n */\n 'aria-label'?: string;\n};\n\nconst defaultElement = 'button';\n\nexport type ButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, ButtonBaseProps>;\n\nexport type ButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: ButtonProps<T>,\n) => React.ReactElement | null;\n\nexport const Button: ButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n {\n as,\n children,\n variant = 'primary',\n size = 'medium',\n loading,\n className,\n disabled = false,\n width = 'auto',\n 'aria-label': ariaLabel,\n ...rest\n }: ButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = as || defaultElement;\n const childrenArray = React.Children.toArray(children);\n const hasLeadingIcon =\n childrenArray.length > 1 && typeof childrenArray[0] !== 'string';\n const hasTrailingIcon =\n childrenArray.length > 1 &&\n typeof childrenArray[childrenArray.length - 1] !== 'string';\n\n const ariaLabelWhenLoading = childrenArray\n .filter(child => typeof child === 'string')\n .join(' ');\n\n const ariaLabelValue = () => {\n if (ariaLabel) return ariaLabel;\n if (loading) return ariaLabelWhenLoading;\n return undefined;\n };\n\n return (\n <Element\n className={cx(\n 'eds-button',\n {\n [`eds-button--variant-${variant}`]: variant,\n [`eds-button--size-${size}`]: size,\n 'eds-button--width-fluid': width === 'fluid',\n 'eds-button--loading': loading,\n 'eds-button--leading-icon': hasLeadingIcon,\n 'eds-button--trailing-icon': hasTrailingIcon,\n },\n className,\n )}\n ref={ref}\n aria-busy={loading}\n disabled={disabled}\n aria-disabled={disabled}\n aria-label={ariaLabelValue()}\n {...rest}\n >\n {loading ? (\n <LoadingDots className=\"eds-button__loading-dots\" />\n ) : (\n children\n )}\n </Element>\n );\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type PrimaryButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type PrimaryButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, PrimaryButtonBaseProps>;\n\nexport type PrimaryButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: PrimaryButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const PrimaryButton: PrimaryButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: PrimaryButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"primary\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type SecondaryButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type SecondaryButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, SecondaryButtonBaseProps>;\n\nexport type SecondaryButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: SecondaryButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const SecondaryButton: SecondaryButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: SecondaryButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"secondary\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type SuccessButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type SuccessButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, SuccessButtonBaseProps>;\n\nexport type SuccessButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: SuccessButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const SuccessButton: SuccessButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: SuccessButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"success\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type NegativeButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type NegativeButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, NegativeButtonBaseProps>;\n\nexport type NegativeButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: NegativeButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const NegativeButton: NegativeButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: NegativeButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n // @ts-expect-error type error due to props not being BaseButtonProps\n return <Button as={Element} {...props} ref={ref} variant=\"negative\" />;\n },\n);\n","import React from 'react';\nimport { Button } from './Button';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\nexport type TertiaryButtonBaseProps = {\n /** Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'medium' | 'large';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Bredden på knappen.\n * @default 'auto'\n */\n width?: 'fluid' | 'auto';\n /** Innholdet i knappen */\n children: React.ReactNode;\n};\n\nexport type TertiaryButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, TertiaryButtonBaseProps>;\n\nexport type TertiaryButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: TertiaryButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\n/** @deprecated use SecondaryButton size=\"small\" instead */\nexport const TertiaryButton: TertiaryButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: TertiaryButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n <Button\n as={Element}\n {...props}\n ref={ref}\n variant=\"tertiary\"\n size=\"small\"\n />\n );\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport './ButtonGroup.scss';\n\nexport type ButtonGroupProps = {\n /** To eller flere Button-komponenter */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** HTML-elementet eller React-komponenten som lages\n * @default \"div\"\n */\n as?: string | React.ElementType;\n [key: string]: any;\n};\n\nexport const ButtonGroup: React.FC<ButtonGroupProps> = ({\n as: Element = 'div',\n className,\n ...rest\n}) => {\n return (\n <Element className={classNames('eds-button-group', className)} {...rest} />\n );\n};\n","import React from 'react';\nimport classNames from 'classnames';\nimport './FloatingButton.scss';\n\nexport type FloatingButtonProps = {\n /** Beskrivende tekst for skjermlesere */\n 'aria-label': string;\n /** Ikon eller ikon-og-tekst */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Callback når knappen klikkes */\n onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;\n /** Størrelse på knappen\n * @default \"medium\"\n */\n size?: 'medium' | 'small';\n [key: string]: any;\n} & React.ButtonHTMLAttributes<HTMLButtonElement>;\n\nexport const FloatingButton: React.FC<FloatingButtonProps> = ({\n className,\n children,\n size = 'medium',\n ...rest\n}) => {\n return (\n <button\n className={classNames(\n 'eds-floating-button',\n { 'eds-floating-button--extended': React.Children.count(children) > 1 },\n { 'eds-floating-button--small': size === 'small' },\n className,\n )}\n type=\"button\"\n {...rest}\n >\n {wrapStringsInSpans(children)}\n </button>\n );\n};\n\nconst wrapStringsInSpans = (children: React.ReactNode) =>\n React.Children.map(children, child =>\n typeof child === 'string' ? <span>{child}</span> : child,\n );\n","import * as React from 'react';\nimport classNames from 'classnames';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\nimport { LoadingDots } from '@entur/loader';\nimport './SquareButton.scss';\n\nexport type SquareButtonBaseProps = {\n /** Tekst og ikon */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** En type knapp */\n variant?: 'success' | 'secondary' | 'tertiary';\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** DOM-elementet knappen rendres som */\n as?: string | React.ElementType;\n};\n\nexport type SquareButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, SquareButtonBaseProps>;\n\nexport type SquareButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: SquareButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const SquareButton: SquareButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n {\n as,\n children,\n className,\n disabled = false,\n loading = false,\n variant = 'secondary',\n ...rest\n }: SquareButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = as || defaultElement;\n return (\n <Element\n className={classNames(\n 'eds-square-button',\n `eds-square-button--${variant}`,\n {\n 'eds-square-button--loading': loading,\n },\n className,\n )}\n aria-busy={loading}\n disabled={disabled}\n aria-disabled={disabled}\n ref={ref}\n {...rest}\n >\n {React.Children.map(children, child => {\n if (typeof child === 'string') {\n return <span className=\"eds-square-button__label\">{child}</span>;\n }\n return (\n <span className=\"eds-square-button__button\">\n {loading ? (\n <LoadingDots className=\"eds-square-button__loading-dots\" />\n ) : (\n child\n )}\n </span>\n );\n })}\n </Element>\n );\n },\n);\n","import React from 'react';\nimport { SquareButton } from './SquareButton';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\ntype SecondarySquareButtonBaseProps = {\n /** Tekst og ikon, ikon og tekst, eller bare ikon */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nexport type SecondarySquareButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, SecondarySquareButtonBaseProps>;\n\nexport type SecondarySquareButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: SecondarySquareButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const SecondarySquareButton: SecondarySquareButtonComponent =\n React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: SecondarySquareButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n // @ts-expect-error type error due to props not being BaseButtonProps\n <SquareButton as={Element} ref={ref} {...props} variant=\"secondary\" />\n );\n },\n );\n","import React from 'react';\nimport { SquareButton } from './SquareButton';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\n\ntype SuccessSquareButtonBaseProps = {\n /** Tekst og ikon, ikon og tekst, eller bare ikon */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nexport type SuccessSquareButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, SuccessSquareButtonBaseProps>;\n\nexport type SuccessSquareButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: SuccessSquareButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const SuccessSquareButton: SuccessSquareButtonComponent =\n React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: SuccessSquareButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = props.as || defaultElement;\n return (\n // @ts-expect-error type error due to props not being BaseButtonProps\n <SquareButton as={Element} ref={ref} {...props} variant=\"success\" />\n );\n },\n );\n","import React from 'react';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\nimport { SquareButton } from './SquareButton';\n\ntype TertiarySquareButtonBaseProps = {\n /** Tekst og ikon, ikon og tekst, eller bare ikon */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n /** DOM-elementet knappen rendres som */\n as?: string | React.ElementType;\n};\n\nexport type TertiarySquareButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, TertiarySquareButtonBaseProps>;\n\nexport type TertiarySquareButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: TertiarySquareButtonProps<T>,\n) => React.ReactElement | null;\n\nconst defaultElement = 'button';\n\nexport const TertiarySquareButton: TertiarySquareButtonComponent =\n React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n props: TertiarySquareButtonProps<T>,\n ref: PolymorphicRef<T>,\n // @ts-expect-error TS error seems to stem from how the props are built up\n ) => <SquareButton ref={ref} {...props} variant=\"tertiary\" />,\n );\n","import React from 'react';\nimport classNames from 'classnames';\nimport { PolymorphicComponentPropsWithRef, PolymorphicRef } from '@entur/utils';\nimport { LoadingDots } from '@entur/loader';\nimport './IconButton.scss';\n\nexport type IconButtonBaseProps = {\n /** Ikonet som du vil ha inne i knappen */\n children: React.ReactNode;\n /** Tekst som forklarer knappens handling. MÅ være satt hvis du ikke har en forklarende tooltip på knappen */\n 'aria-label'?: string;\n /** Ekstra klassenavn */\n className?: string;\n /** Deaktivering av knappen\n * @default false\n */\n disabled?: boolean;\n /** HTML-elementet eller React-komponenten som lager knappen\n * @default 'button'\n */\n as?: React.ElementType;\n /**Størrelsen på knappen\n * @default 'medium'\n */\n size?: 'small' | 'medium';\n /** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe\n * @default false\n */\n loading?: boolean;\n};\n\nconst defaultElement = 'button';\n\nexport type IconButtonProps<T extends React.ElementType> =\n PolymorphicComponentPropsWithRef<T, IconButtonBaseProps>;\n\nexport type IconButtonComponent = <\n T extends React.ElementType = typeof defaultElement,\n>(\n props: IconButtonProps<T>,\n) => React.ReactElement | null;\n\nexport const IconButton: IconButtonComponent = React.forwardRef(\n <T extends React.ElementType = typeof defaultElement>(\n {\n children,\n className,\n disabled = false,\n size = 'medium',\n as,\n loading,\n ...rest\n }: IconButtonProps<T>,\n ref: PolymorphicRef<T>,\n ) => {\n const Element: React.ElementType = as || defaultElement;\n\n const IconWithAriaHidden = React.Children.map(children, child => {\n if (React.isValidElement(child)) {\n // @ts-expect-error aria-hidden does, in fact, exist\n return React.cloneElement(child, { 'aria-hidden': true });\n }\n return child;\n });\n\n const iconButtonElement = (\n <Element\n className={classNames(\n 'eds-icon-button',\n className,\n {\n 'eds-icon-button--disabled': disabled,\n },\n `eds-icon-button--size-${size}`,\n )}\n disabled={disabled}\n aria-disabled={disabled}\n aria-busy={loading}\n ref={ref}\n {...rest}\n >\n {loading ? <LoadingDots /> : <>{IconWithAriaHidden}</>}\n </Element>\n );\n\n if (disabled) {\n return (\n <div className=\"eds-icon-button--disabled__wrapper\">\n {iconButtonElement}\n </div>\n );\n }\n return <>{iconButtonElement}</>;\n },\n);\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('button');\n\nexport * from './Button';\nexport * from './PrimaryButton';\nexport * from './SecondaryButton';\nexport * from './SuccessButton';\nexport * from './NegativeButton';\nexport * from './TertiaryButton';\nexport * from './ButtonGroup';\nexport * from './FloatingButton';\nexport * from './SecondarySquareButton';\nexport * from './SuccessSquareButton';\nexport * from './TertiarySquareButton';\nexport * from './IconButton';\n"],"names":["defaultElement","Button","React","forwardRef","_ref","ref","_cx","as","children","_ref$variant","variant","_ref$size","size","loading","className","_ref$disabled","disabled","_ref$width","width","ariaLabel","rest","_objectWithoutPropertiesLoose","_excluded","Element","childrenArray","Children","toArray","hasLeadingIcon","length","hasTrailingIcon","ariaLabelWhenLoading","filter","child","join","ariaLabelValue","undefined","_extends","cx","LoadingDots","PrimaryButton","props","SecondaryButton","SuccessButton","NegativeButton","TertiaryButton","ButtonGroup","_ref$as","createElement","classNames","FloatingButton","count","type","wrapStringsInSpans","map","SquareButton","_ref$loading","SecondarySquareButton","SuccessSquareButton","TertiarySquareButton","IconButton","IconWithAriaHidden","isValidElement","cloneElement","iconButtonElement","Fragment","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,IAAMA,gBAAc,GAAG,QAAQ,CAAA;AAWxB,IAAMC,MAAM,gBAAoBC,KAAK,CAACC,UAAU,CACrD,UAAAC,IAAA,EAaEC,GAAsB,EACpB;AAAA,EAAA,IAAAC,GAAA,CAAA;AAAA,EAAA,IAZAC,EAAE,GAAAH,IAAA,CAAFG,EAAE;IACFC,QAAQ,GAAAJ,IAAA,CAARI,QAAQ;IAAAC,YAAA,GAAAL,IAAA,CACRM,OAAO;AAAPA,IAAAA,OAAO,GAAAD,YAAA,KAAG,KAAA,CAAA,GAAA,SAAS,GAAAA,YAAA;IAAAE,SAAA,GAAAP,IAAA,CACnBQ,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,QAAQ,GAAAA,SAAA;IACfE,OAAO,GAAAT,IAAA,CAAPS,OAAO;IACPC,SAAS,GAAAV,IAAA,CAATU,SAAS;IAAAC,aAAA,GAAAX,IAAA,CACTY,QAAQ;AAARA,IAAAA,QAAQ,GAAAD,aAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,aAAA;IAAAE,UAAA,GAAAb,IAAA,CAChBc,KAAK;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,EAAA,IAAA,CAAG,GAAGpC,cAAG,CAAA6C,aAAA,CAAA7C,cAAA,CAAA8D,QAAA,EAAA,IAAA,EAAAJ,kBAAkB,CAAI,CAEzD,CAAA;AAED,EAAA,IAAI5C,QAAQ,EAAE;AACZ,IAAA,OACEd;AAAKY,MAAAA,SAAS,EAAC,oCAAA;KACZ,EAAAiD,iBAAiB,CACd,CAAA;AAEV,GAAA;EACA,OAAO7D,cAAA,CAAA6C,aAAA,CAAA7C,cAAA,CAAA8D,QAAA,EAAA,IAAA,EAAGD,iBAAiB,CAAI,CAAA;AACjC,CAAC;;AC1FHE,sBAAsB,CAAC,QAAQ,CAAC;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,383 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
declare type ButtonBaseProps = {
|
|
15
|
-
/** Farge og uttrykk på knappen */
|
|
16
|
-
variant: 'primary' | 'secondary' | 'success' | 'negative' | typeof tertiary;
|
|
17
|
-
/** Størrelsen på knappen
|
|
18
|
-
* @default 'medium'
|
|
19
|
-
*/
|
|
20
|
-
size?: 'small' | 'medium' | 'large';
|
|
21
|
-
/** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe
|
|
22
|
-
* @default false
|
|
23
|
-
*/
|
|
24
|
-
loading?: boolean;
|
|
25
|
-
/** Ekstra klassenavn */
|
|
26
|
-
className?: string;
|
|
27
|
-
/** Deaktivering av knappen
|
|
28
|
-
* @default false
|
|
29
|
-
*/
|
|
30
|
-
disabled?: boolean;
|
|
31
|
-
/** Bredden på knappen.
|
|
32
|
-
* @default 'auto'
|
|
33
|
-
*/
|
|
34
|
-
width?: 'fluid' | 'auto';
|
|
35
|
-
/** Innholdet i knappen */
|
|
36
|
-
children: React_2.ReactNode;
|
|
37
|
-
/** Et HTML-element eller en React-komponent som komponenten tar utgangspunkt i for å lage denne knappevarianten
|
|
38
|
-
* @default "button"
|
|
39
|
-
*/
|
|
40
|
-
as?: string | React_2.ElementType;
|
|
41
|
-
/**
|
|
42
|
-
* Tekst som leses opp på skjermleser (nødvendig når knappetekst mangler)
|
|
43
|
-
*/
|
|
44
|
-
'aria-label'?: string;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export declare type ButtonComponent = <T extends React_2.ElementType = typeof defaultElement>(props: ButtonProps<T>) => React_2.ReactElement | null;
|
|
48
|
-
|
|
49
|
-
export declare const ButtonGroup: default_2.FC<ButtonGroupProps>;
|
|
50
|
-
|
|
51
|
-
export declare type ButtonGroupProps = {
|
|
52
|
-
/** To eller flere Button-komponenter */
|
|
53
|
-
children: default_2.ReactNode;
|
|
54
|
-
/** Ekstra klassenavn */
|
|
55
|
-
className?: string;
|
|
56
|
-
/** HTML-elementet eller React-komponenten som lages
|
|
57
|
-
* @default "div"
|
|
58
|
-
*/
|
|
59
|
-
as?: string | default_2.ElementType;
|
|
60
|
-
[key: string]: any;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export declare type ButtonProps<T extends React_2.ElementType> = PolymorphicComponentPropsWithRef<T, ButtonBaseProps>;
|
|
64
|
-
|
|
65
|
-
declare const defaultElement = "button";
|
|
66
|
-
|
|
67
|
-
declare const defaultElement_10 = "button";
|
|
68
|
-
|
|
69
|
-
declare const defaultElement_2 = "button";
|
|
70
|
-
|
|
71
|
-
declare const defaultElement_3 = "button";
|
|
72
|
-
|
|
73
|
-
declare const defaultElement_4 = "button";
|
|
74
|
-
|
|
75
|
-
declare const defaultElement_5 = "button";
|
|
76
|
-
|
|
77
|
-
declare const defaultElement_6 = "button";
|
|
78
|
-
|
|
79
|
-
declare const defaultElement_7 = "button";
|
|
80
|
-
|
|
81
|
-
declare const defaultElement_8 = "button";
|
|
82
|
-
|
|
83
|
-
declare const defaultElement_9 = "button";
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Allows for extending a set of props (`ExtendedProps`) by an overriding set of props
|
|
87
|
-
* (`OverrideProps`), ensuring that any duplicates are overridden by the overriding
|
|
88
|
-
* set of props.
|
|
89
|
-
*/
|
|
90
|
-
declare type ExtendableProps<ExtendedProps = Record<string, unknown>, OverrideProps = Record<string, unknown>> = OverrideProps & Omit<ExtendedProps, keyof OverrideProps>;
|
|
91
|
-
|
|
92
|
-
export declare const FloatingButton: default_2.FC<FloatingButtonProps>;
|
|
93
|
-
|
|
94
|
-
export declare type FloatingButtonProps = {
|
|
95
|
-
/** Beskrivende tekst for skjermlesere */
|
|
96
|
-
'aria-label': string;
|
|
97
|
-
/** Ikon eller ikon-og-tekst */
|
|
98
|
-
children: default_2.ReactNode;
|
|
99
|
-
/** Ekstra klassenavn */
|
|
100
|
-
className?: string;
|
|
101
|
-
/** Callback når knappen klikkes */
|
|
102
|
-
onClick: (e: default_2.MouseEvent<HTMLButtonElement>) => void;
|
|
103
|
-
/** Størrelse på knappen
|
|
104
|
-
* @default "medium"
|
|
105
|
-
*/
|
|
106
|
-
size?: 'medium' | 'small';
|
|
107
|
-
[key: string]: any;
|
|
108
|
-
} & default_2.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
109
|
-
|
|
110
|
-
export declare const IconButton: IconButtonComponent;
|
|
111
|
-
|
|
112
|
-
export declare type IconButtonBaseProps = {
|
|
113
|
-
/** Ikonet som du vil ha inne i knappen */
|
|
114
|
-
children: default_2.ReactNode;
|
|
115
|
-
/** Tekst som forklarer knappens handling. MÅ være satt hvis du ikke har en forklarende tooltip på knappen */
|
|
116
|
-
'aria-label'?: string;
|
|
117
|
-
/** Ekstra klassenavn */
|
|
118
|
-
className?: string;
|
|
119
|
-
/** Deaktivering av knappen
|
|
120
|
-
* @default false
|
|
121
|
-
*/
|
|
122
|
-
disabled?: boolean;
|
|
123
|
-
/** HTML-elementet eller React-komponenten som lager knappen
|
|
124
|
-
* @default 'button'
|
|
125
|
-
*/
|
|
126
|
-
as?: default_2.ElementType;
|
|
127
|
-
/**Størrelsen på knappen
|
|
128
|
-
* @default 'medium'
|
|
129
|
-
*/
|
|
130
|
-
size?: 'small' | 'medium';
|
|
131
|
-
/** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe
|
|
132
|
-
* @default false
|
|
133
|
-
*/
|
|
134
|
-
loading?: boolean;
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
export declare type IconButtonComponent = <T extends default_2.ElementType = typeof defaultElement_10>(props: IconButtonProps<T>) => default_2.ReactElement | null;
|
|
138
|
-
|
|
139
|
-
export declare type IconButtonProps<T extends default_2.ElementType> = PolymorphicComponentPropsWithRef<T, IconButtonBaseProps>;
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Allows for inheriting the props from the specified element type so that
|
|
143
|
-
* props like children, className & style work, as well as element-specific
|
|
144
|
-
* attributes like aria roles. The component (`C`) must be passed in.
|
|
145
|
-
*/
|
|
146
|
-
declare type InheritableElementProps<C extends default_2.ElementType, Props = Record<string, unknown>> = ExtendableProps<PropsOf<C>, Props>;
|
|
147
|
-
|
|
148
|
-
export declare const NegativeButton: NegativeButtonComponent;
|
|
149
|
-
|
|
150
|
-
export declare type NegativeButtonBaseProps = {
|
|
151
|
-
/** Størrelsen på knappen
|
|
152
|
-
* @default 'medium'
|
|
153
|
-
*/
|
|
154
|
-
size?: 'small' | 'medium' | 'large';
|
|
155
|
-
/** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe
|
|
156
|
-
* @default false
|
|
157
|
-
*/
|
|
158
|
-
loading?: boolean;
|
|
159
|
-
/** Ekstra klassenavn */
|
|
160
|
-
className?: string;
|
|
161
|
-
/** Deaktivering av knappen
|
|
162
|
-
* @default false
|
|
163
|
-
*/
|
|
164
|
-
disabled?: boolean;
|
|
165
|
-
/** Bredden på knappen.
|
|
166
|
-
* @default 'auto'
|
|
167
|
-
*/
|
|
168
|
-
width?: 'fluid' | 'auto';
|
|
169
|
-
/** Innholdet i knappen */
|
|
170
|
-
children: default_2.ReactNode;
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
export declare type NegativeButtonComponent = <T extends default_2.ElementType = typeof defaultElement_5>(props: NegativeButtonProps<T>) => default_2.ReactElement | null;
|
|
174
|
-
|
|
175
|
-
export declare type NegativeButtonProps<T extends default_2.ElementType> = PolymorphicComponentPropsWithRef<T, NegativeButtonBaseProps>;
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* A more sophisticated version of `InheritableElementProps` where
|
|
179
|
-
* the passed in `as` prop will determine which props can be included
|
|
180
|
-
*/
|
|
181
|
-
declare type PolymorphicComponentProps<C extends default_2.ElementType, Props = Record<string, unknown>> = InheritableElementProps<C, Props & AsProp<C>>;
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* A wrapper of `PolymorphicComponentProps` that also includes the `ref`
|
|
185
|
-
* prop for the polymorphic component
|
|
186
|
-
*/
|
|
187
|
-
declare type PolymorphicComponentPropsWithRef<C extends default_2.ElementType, Props = Record<string, unknown>> = PolymorphicComponentProps<C, Props> & {
|
|
188
|
-
ref?: PolymorphicRef<C>;
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Utility type to extract the `ref` prop from a polymorphic component
|
|
193
|
-
*/
|
|
194
|
-
declare type PolymorphicRef<C extends default_2.ElementType> = default_2.ComponentPropsWithRef<C>['ref'];
|
|
195
|
-
|
|
196
|
-
export declare const PrimaryButton: PrimaryButtonComponent;
|
|
197
|
-
|
|
198
|
-
export declare type PrimaryButtonBaseProps = {
|
|
199
|
-
/** Størrelsen på knappen
|
|
200
|
-
* @default 'medium'
|
|
201
|
-
*/
|
|
202
|
-
size?: 'small' | 'medium' | 'large';
|
|
203
|
-
/** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe
|
|
204
|
-
* @default false
|
|
205
|
-
*/
|
|
206
|
-
loading?: boolean;
|
|
207
|
-
/** Ekstra klassenavn */
|
|
208
|
-
className?: string;
|
|
209
|
-
/** Deaktivering av knappen
|
|
210
|
-
* @default false
|
|
211
|
-
*/
|
|
212
|
-
disabled?: boolean;
|
|
213
|
-
/** Bredden på knappen.
|
|
214
|
-
* @default 'auto'
|
|
215
|
-
*/
|
|
216
|
-
width?: 'fluid' | 'auto';
|
|
217
|
-
/** Innholdet i knappen */
|
|
218
|
-
children: default_2.ReactNode;
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
export declare type PrimaryButtonComponent = <T extends default_2.ElementType = typeof defaultElement_2>(props: PrimaryButtonProps<T>) => default_2.ReactElement | null;
|
|
222
|
-
|
|
223
|
-
export declare type PrimaryButtonProps<T extends default_2.ElementType> = PolymorphicComponentPropsWithRef<T, PrimaryButtonBaseProps>;
|
|
224
|
-
|
|
225
|
-
declare type PropsOf<C extends keyof JSX.IntrinsicElements | default_2.JSXElementConstructor<any>> = JSX.LibraryManagedAttributes<C, default_2.ComponentPropsWithoutRef<C>>;
|
|
226
|
-
|
|
227
|
-
export declare const SecondaryButton: SecondaryButtonComponent;
|
|
228
|
-
|
|
229
|
-
export declare type SecondaryButtonBaseProps = {
|
|
230
|
-
/** Størrelsen på knappen
|
|
231
|
-
* @default 'medium'
|
|
232
|
-
*/
|
|
233
|
-
size?: 'small' | 'medium' | 'large';
|
|
234
|
-
/** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe
|
|
235
|
-
* @default false
|
|
236
|
-
*/
|
|
237
|
-
loading?: boolean;
|
|
238
|
-
/** Ekstra klassenavn */
|
|
239
|
-
className?: string;
|
|
240
|
-
/** Deaktivering av knappen
|
|
241
|
-
* @default false
|
|
242
|
-
*/
|
|
243
|
-
disabled?: boolean;
|
|
244
|
-
/** Bredden på knappen.
|
|
245
|
-
* @default 'auto'
|
|
246
|
-
*/
|
|
247
|
-
width?: 'fluid' | 'auto';
|
|
248
|
-
/** Innholdet i knappen */
|
|
249
|
-
children: default_2.ReactNode;
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
export declare type SecondaryButtonComponent = <T extends default_2.ElementType = typeof defaultElement_3>(props: SecondaryButtonProps<T>) => default_2.ReactElement | null;
|
|
253
|
-
|
|
254
|
-
export declare type SecondaryButtonProps<T extends default_2.ElementType> = PolymorphicComponentPropsWithRef<T, SecondaryButtonBaseProps>;
|
|
255
|
-
|
|
256
|
-
export declare const SecondarySquareButton: SecondarySquareButtonComponent;
|
|
257
|
-
|
|
258
|
-
declare type SecondarySquareButtonBaseProps = {
|
|
259
|
-
/** Tekst og ikon, ikon og tekst, eller bare ikon */
|
|
260
|
-
children: default_2.ReactNode;
|
|
261
|
-
/** Ekstra klassenavn */
|
|
262
|
-
className?: string;
|
|
263
|
-
/** Deaktivering av knappen
|
|
264
|
-
* @default false
|
|
265
|
-
*/
|
|
266
|
-
disabled?: boolean;
|
|
267
|
-
/** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe
|
|
268
|
-
* @default false
|
|
269
|
-
*/
|
|
270
|
-
loading?: boolean;
|
|
271
|
-
};
|
|
272
|
-
|
|
273
|
-
export declare type SecondarySquareButtonComponent = <T extends default_2.ElementType = typeof defaultElement_7>(props: SecondarySquareButtonProps<T>) => default_2.ReactElement | null;
|
|
274
|
-
|
|
275
|
-
export declare type SecondarySquareButtonProps<T extends default_2.ElementType> = PolymorphicComponentPropsWithRef<T, SecondarySquareButtonBaseProps>;
|
|
276
|
-
|
|
277
|
-
export declare const SuccessButton: SuccessButtonComponent;
|
|
278
|
-
|
|
279
|
-
export declare type SuccessButtonBaseProps = {
|
|
280
|
-
/** Størrelsen på knappen
|
|
281
|
-
* @default 'medium'
|
|
282
|
-
*/
|
|
283
|
-
size?: 'small' | 'medium' | 'large';
|
|
284
|
-
/** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe
|
|
285
|
-
* @default false
|
|
286
|
-
*/
|
|
287
|
-
loading?: boolean;
|
|
288
|
-
/** Ekstra klassenavn */
|
|
289
|
-
className?: string;
|
|
290
|
-
/** Deaktivering av knappen
|
|
291
|
-
* @default false
|
|
292
|
-
*/
|
|
293
|
-
disabled?: boolean;
|
|
294
|
-
/** Bredden på knappen.
|
|
295
|
-
* @default 'auto'
|
|
296
|
-
*/
|
|
297
|
-
width?: 'fluid' | 'auto';
|
|
298
|
-
/** Innholdet i knappen */
|
|
299
|
-
children: default_2.ReactNode;
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
export declare type SuccessButtonComponent = <T extends default_2.ElementType = typeof defaultElement_4>(props: SuccessButtonProps<T>) => default_2.ReactElement | null;
|
|
303
|
-
|
|
304
|
-
export declare type SuccessButtonProps<T extends default_2.ElementType> = PolymorphicComponentPropsWithRef<T, SuccessButtonBaseProps>;
|
|
305
|
-
|
|
306
|
-
export declare const SuccessSquareButton: SuccessSquareButtonComponent;
|
|
307
|
-
|
|
308
|
-
declare type SuccessSquareButtonBaseProps = {
|
|
309
|
-
/** Tekst og ikon, ikon og tekst, eller bare ikon */
|
|
310
|
-
children: default_2.ReactNode;
|
|
311
|
-
/** Ekstra klassenavn */
|
|
312
|
-
className?: string;
|
|
313
|
-
/** Deaktivering av knappen
|
|
314
|
-
* @default false
|
|
315
|
-
*/
|
|
316
|
-
disabled?: boolean;
|
|
317
|
-
/** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe
|
|
318
|
-
* @default false
|
|
319
|
-
*/
|
|
320
|
-
loading?: boolean;
|
|
321
|
-
};
|
|
322
|
-
|
|
323
|
-
export declare type SuccessSquareButtonComponent = <T extends default_2.ElementType = typeof defaultElement_8>(props: SuccessSquareButtonProps<T>) => default_2.ReactElement | null;
|
|
324
|
-
|
|
325
|
-
export declare type SuccessSquareButtonProps<T extends default_2.ElementType> = PolymorphicComponentPropsWithRef<T, SuccessSquareButtonBaseProps>;
|
|
326
|
-
|
|
327
|
-
/** @deprecated use variant="secondary" size="small" instead */
|
|
328
|
-
declare const tertiary = "tertiary";
|
|
329
|
-
|
|
330
|
-
/** @deprecated use SecondaryButton size="small" instead */
|
|
331
|
-
export declare const TertiaryButton: TertiaryButtonComponent;
|
|
332
|
-
|
|
333
|
-
export declare type TertiaryButtonBaseProps = {
|
|
334
|
-
/** Størrelsen på knappen
|
|
335
|
-
* @default 'medium'
|
|
336
|
-
*/
|
|
337
|
-
size?: 'medium' | 'large';
|
|
338
|
-
/** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe
|
|
339
|
-
* @default false
|
|
340
|
-
*/
|
|
341
|
-
loading?: boolean;
|
|
342
|
-
/** Ekstra klassenavn */
|
|
343
|
-
className?: string;
|
|
344
|
-
/** Deaktivering av knappen
|
|
345
|
-
* @default false
|
|
346
|
-
*/
|
|
347
|
-
disabled?: boolean;
|
|
348
|
-
/** Bredden på knappen.
|
|
349
|
-
* @default 'auto'
|
|
350
|
-
*/
|
|
351
|
-
width?: 'fluid' | 'auto';
|
|
352
|
-
/** Innholdet i knappen */
|
|
353
|
-
children: default_2.ReactNode;
|
|
354
|
-
};
|
|
355
|
-
|
|
356
|
-
export declare type TertiaryButtonComponent = <T extends default_2.ElementType = typeof defaultElement_6>(props: TertiaryButtonProps<T>) => default_2.ReactElement | null;
|
|
357
|
-
|
|
358
|
-
export declare type TertiaryButtonProps<T extends default_2.ElementType> = PolymorphicComponentPropsWithRef<T, TertiaryButtonBaseProps>;
|
|
359
|
-
|
|
360
|
-
export declare const TertiarySquareButton: TertiarySquareButtonComponent;
|
|
361
|
-
|
|
362
|
-
declare type TertiarySquareButtonBaseProps = {
|
|
363
|
-
/** Tekst og ikon, ikon og tekst, eller bare ikon */
|
|
364
|
-
children: default_2.ReactNode;
|
|
365
|
-
/** Ekstra klassenavn */
|
|
366
|
-
className?: string;
|
|
367
|
-
/** Deaktivering av knappen
|
|
368
|
-
* @default false
|
|
369
|
-
*/
|
|
370
|
-
disabled?: boolean;
|
|
371
|
-
/** Om knappen er opptatt, f.eks. med å lagre eller å kjøpe
|
|
372
|
-
* @default false
|
|
373
|
-
*/
|
|
374
|
-
loading?: boolean;
|
|
375
|
-
/** DOM-elementet knappen rendres som */
|
|
376
|
-
as?: string | default_2.ElementType;
|
|
377
|
-
};
|
|
378
|
-
|
|
379
|
-
export declare type TertiarySquareButtonComponent = <T extends default_2.ElementType = typeof defaultElement_9>(props: TertiarySquareButtonProps<T>) => default_2.ReactElement | null;
|
|
380
|
-
|
|
381
|
-
export declare type TertiarySquareButtonProps<T extends default_2.ElementType> = PolymorphicComponentPropsWithRef<T, TertiarySquareButtonBaseProps>;
|
|
382
|
-
|
|
383
|
-
export { }
|
|
1
|
+
import './index.scss';
|
|
2
|
+
export * from './Button';
|
|
3
|
+
export * from './PrimaryButton';
|
|
4
|
+
export * from './SecondaryButton';
|
|
5
|
+
export * from './SuccessButton';
|
|
6
|
+
export * from './NegativeButton';
|
|
7
|
+
export * from './TertiaryButton';
|
|
8
|
+
export * from './ButtonGroup';
|
|
9
|
+
export * from './FloatingButton';
|
|
10
|
+
export * from './SecondarySquareButton';
|
|
11
|
+
export * from './SuccessSquareButton';
|
|
12
|
+
export * from './TertiarySquareButton';
|
|
13
|
+
export * from './IconButton';
|