@entur/button 3.4.1-beta-automat.0 → 3.4.2-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/IconButton.d.ts +1 -1
- package/dist/button.cjs.js.map +1 -1
- package/dist/button.esm.js.map +1 -1
- package/dist/styles.css +73 -107
- package/package.json +5 -6
package/dist/IconButton.d.ts
CHANGED
package/dist/button.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.cjs.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' | 'large';\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","React","jsx","cx","LoadingDots","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAMA,mBAAiB;AAWhB,MAAM,SAA0BC,iBAAM;AAAA,EAC3C,CACE;AAAA,IACE;AAAA,IAC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BAAA,CAAmB;AAAA,MAAA;AAAA,IAAA;AAIvD,QAAI,UAAU;AACZ,aACEF,2BAAAA,IAAC,OAAA,EAAI,WAAU,sCACZ,UAAA,mBACH;AAAA,IAEJ;AACA,iEAAU,UAAA,kBAAA,CAAkB;AAAA,EAC9B;AACF;AC3FAG,MAAAA,uBAAuB,QAAQ;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"button.cjs.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","React","jsx","cx","LoadingDots","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAMA,mBAAiB;AAWhB,MAAM,SAA0BC,iBAAM;AAAA,EAC3C,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA,WAAW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AA,IAAC,OAAA,EAAI,WAAU,sCACZ,UAAA,mBACH;AAAA,IAEJ;AACA,iEAAU,UAAA,kBAAA,CAAkB;AAAA,EAC9B;AACF;AC3FAG,MAAAA,uBAAuB,QAAQ;;;;;;;;;;;;;"}
|
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' | 'large';\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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.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,iBA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ACE;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,QACG;AACH,UAAM,UAA6B,MAAM;AAEzC,UAAM,qBAAqBA,eAAM,SAAS,IAAI,UAAU,CAAA,UAAS;AAC/D,UAAIA,eAAM,eAAe,KAAK,GAAG;AAE/B,eAAOA,eAAM,aAAa,OAAO,EAAE,eAAe,MAAM;AAAA,MAC1D;AACA,aAAO;AAAA,IACT,CAAC;AAED,UAAM,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;"}
|
package/dist/styles.css
CHANGED
|
@@ -445,15 +445,38 @@
|
|
|
445
445
|
|
|
446
446
|
:root{
|
|
447
447
|
--eds-button:1;
|
|
448
|
-
}.eds-button{
|
|
449
|
-
|
|
448
|
+
}a.eds-button{
|
|
449
|
+
display:-webkit-box;
|
|
450
|
+
display:-webkit-flex;
|
|
451
|
+
display:-moz-box;
|
|
452
|
+
display:flex;
|
|
453
|
+
-webkit-box-align:center;
|
|
454
|
+
-webkit-align-items:center;
|
|
455
|
+
-moz-box-align:center;
|
|
456
|
+
align-items:center;
|
|
457
|
+
-webkit-box-pack:center;
|
|
458
|
+
-webkit-justify-content:center;
|
|
459
|
+
-moz-box-pack:center;
|
|
460
|
+
justify-content:center;
|
|
461
|
+
}
|
|
462
|
+
a.eds-button .eds-icon{
|
|
463
|
+
position:static;
|
|
464
|
+
position:initial;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
.eds-button{
|
|
468
|
+
min-width:9.5rem;
|
|
450
469
|
width:-webkit-max-content;
|
|
451
470
|
width:-moz-max-content;
|
|
452
471
|
width:max-content;
|
|
453
|
-
height:
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
472
|
+
min-height:3rem;
|
|
473
|
+
height:-webkit-fit-content;
|
|
474
|
+
height:-moz-fit-content;
|
|
475
|
+
height:fit-content;
|
|
476
|
+
-webkit-border-radius:0.25rem;
|
|
477
|
+
-moz-border-radius:0.25rem;
|
|
478
|
+
border-radius:0.25rem;
|
|
479
|
+
font-size:inherit;
|
|
457
480
|
cursor:pointer;
|
|
458
481
|
display:inline-block;
|
|
459
482
|
-webkit-appearance:none;
|
|
@@ -461,20 +484,16 @@
|
|
|
461
484
|
appearance:none;
|
|
462
485
|
-webkit-text-decoration:none;
|
|
463
486
|
text-decoration:none;
|
|
464
|
-
|
|
465
|
-
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
padding-inline:var(--components-button-inlinepadding-medium);
|
|
469
|
-
font-size:var(--font-size-body-m);
|
|
470
|
-
line-height:var(--font-line-height-body-m);
|
|
471
|
-
font-weight:var(--font-weight-body);
|
|
487
|
+
padding:0 1rem;
|
|
488
|
+
font-size:1rem;
|
|
489
|
+
line-height:1.5rem;
|
|
490
|
+
font-weight:500;
|
|
472
491
|
text-align:center;
|
|
473
492
|
font-family:inherit;
|
|
474
493
|
position:relative;
|
|
475
|
-
vertical-align:
|
|
494
|
+
vertical-align:top;
|
|
476
495
|
background-color:var(--eds-button-background);
|
|
477
|
-
border:
|
|
496
|
+
border:0.125rem solid var(--eds-button-border);
|
|
478
497
|
color:var(--eds-button-text);
|
|
479
498
|
}
|
|
480
499
|
.eds-button:hover{
|
|
@@ -499,47 +518,25 @@
|
|
|
499
518
|
.eds-button > .eds-button__loading-dots .eds-loading-dots__dot{
|
|
500
519
|
background:var(--eds-button-text);
|
|
501
520
|
}
|
|
502
|
-
.eds-button
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
}
|
|
506
|
-
.eds-button--trailing-icon :where(.eds-icon:last-child){
|
|
507
|
-
margin-left:var(--components-button-gap-medium);
|
|
508
|
-
}
|
|
509
|
-
.eds-button--trailing-icon:where(.eds-button--size-small .eds-icon:last-child){
|
|
510
|
-
margin-left:var(--components-button-gap-small);
|
|
511
|
-
}
|
|
512
|
-
.eds-button--trailing-icon:where(.eds-button--size-large .eds-icon:last-child){
|
|
513
|
-
margin-left:var(--components-button-gap-large);
|
|
514
|
-
}
|
|
515
|
-
.eds-button--leading-icon :where(.eds-icon:first-child){
|
|
516
|
-
margin-right:var(--components-button-gap-medium);
|
|
521
|
+
.eds-button .eds-icon{
|
|
522
|
+
position:relative;
|
|
523
|
+
top:0.2em;
|
|
517
524
|
}
|
|
518
|
-
.eds-button--leading-icon
|
|
519
|
-
margin-right:
|
|
525
|
+
.eds-button--leading-icon .eds-icon{
|
|
526
|
+
margin-right:0.75rem;
|
|
520
527
|
}
|
|
521
|
-
.eds-button--
|
|
522
|
-
margin-
|
|
528
|
+
.eds-button--trailing-icon .eds-icon{
|
|
529
|
+
margin-left:0.75rem;
|
|
523
530
|
}
|
|
524
531
|
.eds-button--size-small{
|
|
525
|
-
|
|
526
|
-
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
padding-inline:var(--components-button-inlinepadding-small);
|
|
530
|
-
font-size:var(--font-size-body-s);
|
|
531
|
-
line-height:var(--font-line-height-body-s);
|
|
532
|
-
border:var(--components-button-border-small) solid var(--eds-button-border);
|
|
532
|
+
min-width:5.75rem;
|
|
533
|
+
min-height:2rem;
|
|
534
|
+
font-size:0.875rem;
|
|
535
|
+
line-height:1.375rem;
|
|
533
536
|
}
|
|
534
537
|
.eds-button--size-large{
|
|
535
|
-
|
|
536
|
-
-
|
|
537
|
-
-moz-border-radius:var(--components-button-radius-large);
|
|
538
|
-
border-radius:var(--components-button-radius-large);
|
|
539
|
-
padding-inline:var(--components-button-inlinepadding-large);
|
|
540
|
-
font-size:var(--font-size-body-xl);
|
|
541
|
-
line-height:var(--font-line-height-body-xl);
|
|
542
|
-
border:var(--components-button-border-large) solid var(--eds-button-border);
|
|
538
|
+
min-width:11.75rem;
|
|
539
|
+
min-height:3.75rem;
|
|
543
540
|
}
|
|
544
541
|
.eds-button--width-fluid{
|
|
545
542
|
width:100%;
|
|
@@ -634,6 +631,12 @@
|
|
|
634
631
|
.eds-button--variant-tertiary:active{
|
|
635
632
|
background-color:#aeb7e2;
|
|
636
633
|
}
|
|
634
|
+
.eds-button--variant-tertiary.eds-button--leading-icon .eds-icon{
|
|
635
|
+
margin-right:0.5rem;
|
|
636
|
+
}
|
|
637
|
+
.eds-button--variant-tertiary.eds-button--trailing-icon .eds-icon{
|
|
638
|
+
margin-left:0.5rem;
|
|
639
|
+
}
|
|
637
640
|
.eds-contrast .eds-button--variant-tertiary{
|
|
638
641
|
background-color:transparent;
|
|
639
642
|
color:#ffffff;
|
|
@@ -665,24 +668,6 @@
|
|
|
665
668
|
background-color:var(--components-button-disabled-contrast-fill);
|
|
666
669
|
color:var(--components-button-disabled-contrast-text-disabled);
|
|
667
670
|
border-color:transparent;
|
|
668
|
-
}
|
|
669
|
-
.eds-button:where(a){
|
|
670
|
-
display:-webkit-box;
|
|
671
|
-
display:-webkit-flex;
|
|
672
|
-
display:-moz-box;
|
|
673
|
-
display:flex;
|
|
674
|
-
-webkit-box-align:center;
|
|
675
|
-
-webkit-align-items:center;
|
|
676
|
-
-moz-box-align:center;
|
|
677
|
-
align-items:center;
|
|
678
|
-
-webkit-box-pack:center;
|
|
679
|
-
-webkit-justify-content:center;
|
|
680
|
-
-moz-box-pack:center;
|
|
681
|
-
justify-content:center;
|
|
682
|
-
}
|
|
683
|
-
.eds-button:where(a) :where(.eds-icon){
|
|
684
|
-
position:static;
|
|
685
|
-
position:initial;
|
|
686
671
|
}.eds-button-group .eds-button{
|
|
687
672
|
margin-right:0.75rem;
|
|
688
673
|
margin-bottom:0.75rem;
|
|
@@ -967,31 +952,27 @@
|
|
|
967
952
|
width:2rem;
|
|
968
953
|
border-width:0.0625rem;
|
|
969
954
|
}.eds-icon-button{
|
|
970
|
-
|
|
971
|
-
-webkit-
|
|
972
|
-
-moz-
|
|
973
|
-
|
|
955
|
+
border:0.125rem solid transparent;
|
|
956
|
+
-webkit-border-radius:0.25rem;
|
|
957
|
+
-moz-border-radius:0.25rem;
|
|
958
|
+
border-radius:0.25rem;
|
|
974
959
|
background:none;
|
|
975
|
-
-webkit-border-radius:var(--components-button-radius-medium);
|
|
976
|
-
-moz-border-radius:var(--components-button-radius-medium);
|
|
977
|
-
border-radius:var(--components-button-radius-medium);
|
|
978
|
-
border:var(--components-button-border-medium) solid transparent;
|
|
979
960
|
color:var(--components-button-iconbutton-standard-text);
|
|
980
961
|
cursor:pointer;
|
|
981
|
-
display:-webkit-
|
|
982
|
-
display:-webkit-
|
|
983
|
-
display:-moz-
|
|
984
|
-
display:
|
|
985
|
-
font-size:var(--font-size-body-m);
|
|
986
|
-
font-weight:var(--font-weight-body);
|
|
987
|
-
gap:var(--components-button-gap-medium);
|
|
988
|
-
height:var(--components-button-height-horizontalcontent-medium);
|
|
962
|
+
display:-webkit-box;
|
|
963
|
+
display:-webkit-flex;
|
|
964
|
+
display:-moz-box;
|
|
965
|
+
display:flex;
|
|
989
966
|
-webkit-box-pack:center;
|
|
990
967
|
-webkit-justify-content:center;
|
|
991
968
|
-moz-box-pack:center;
|
|
992
969
|
justify-content:center;
|
|
993
|
-
|
|
994
|
-
|
|
970
|
+
-webkit-box-align:center;
|
|
971
|
+
-webkit-align-items:center;
|
|
972
|
+
-moz-box-align:center;
|
|
973
|
+
align-items:center;
|
|
974
|
+
font-size:1rem;
|
|
975
|
+
padding:0.5rem;
|
|
995
976
|
}
|
|
996
977
|
.eds-contrast .eds-icon-button{
|
|
997
978
|
color:var(--components-button-iconbutton-contrast-text);
|
|
@@ -999,6 +980,11 @@
|
|
|
999
980
|
.eds-contrast .eds-icon-button > .eds-loading-dots .eds-loading-dots__dot{
|
|
1000
981
|
background-color:var(--components-button-iconbutton-contrast-icon);
|
|
1001
982
|
}
|
|
983
|
+
.eds-icon-button--size-small{
|
|
984
|
+
height:1.5rem;
|
|
985
|
+
width:1.5rem;
|
|
986
|
+
padding:0;
|
|
987
|
+
}
|
|
1002
988
|
.eds-icon-button:hover{
|
|
1003
989
|
background-color:var(--components-button-iconbutton-standard-hover);
|
|
1004
990
|
}
|
|
@@ -1030,24 +1016,4 @@
|
|
|
1030
1016
|
width:-webkit-fit-content;
|
|
1031
1017
|
width:-moz-fit-content;
|
|
1032
1018
|
width:fit-content;
|
|
1033
|
-
}
|
|
1034
|
-
.eds-icon-button--size-small{
|
|
1035
|
-
-webkit-border-radius:var(--components-button-radius-small);
|
|
1036
|
-
-moz-border-radius:var(--components-button-radius-small);
|
|
1037
|
-
border-radius:var(--components-button-radius-small);
|
|
1038
|
-
border:var(--components-button-border-small) solid var(--eds-button-border);
|
|
1039
|
-
font-size:var(--font-size-body-s);
|
|
1040
|
-
height:var(--components-button-height-horizontalcontent-small);
|
|
1041
|
-
line-height:var(--font-line-height-body-s);
|
|
1042
|
-
padding-inline:var(--components-button-inlinepadding-small);
|
|
1043
|
-
}
|
|
1044
|
-
.eds-icon-button--size-large{
|
|
1045
|
-
-webkit-border-radius:var(--components-button-radius-large);
|
|
1046
|
-
-moz-border-radius:var(--components-button-radius-large);
|
|
1047
|
-
border-radius:var(--components-button-radius-large);
|
|
1048
|
-
border:var(--components-button-border-large) solid var(--eds-button-border);
|
|
1049
|
-
font-size:var(--font-size-body-xl);
|
|
1050
|
-
height:var(--components-button-height-horizontalcontent-large);
|
|
1051
|
-
line-height:var(--font-line-height-body-xl);
|
|
1052
|
-
padding-inline:var(--components-button-inlinepadding-large);
|
|
1053
1019
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@entur/button",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.2-beta.0",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
5
|
"main": "dist/button.cjs.js",
|
|
6
6
|
"module": "dist/button.esm.js",
|
|
@@ -27,10 +27,9 @@
|
|
|
27
27
|
"react-dom": ">=16.8.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@entur/loader": "^0.6.
|
|
31
|
-
"@entur/tokens": "^3.21.1
|
|
32
|
-
"@entur/
|
|
33
|
-
"@entur/utils": "^0.12.6-beta-automat.0",
|
|
30
|
+
"@entur/loader": "^0.6.2-beta.0",
|
|
31
|
+
"@entur/tokens": "^3.21.1",
|
|
32
|
+
"@entur/utils": "^0.13.1",
|
|
34
33
|
"classnames": "^2.5.1"
|
|
35
34
|
},
|
|
36
35
|
"devDependencies": {
|
|
@@ -46,5 +45,5 @@
|
|
|
46
45
|
"vite": "^7.1.3",
|
|
47
46
|
"vite-plugin-dts": "^4.5.4"
|
|
48
47
|
},
|
|
49
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "bb439f99d29ac82cfa40794f882839e0c6162f8a"
|
|
50
49
|
}
|