@semcore/button 16.1.0 → 16.1.1
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/CHANGELOG.md +1 -1
- package/lib/cjs/component/AbstractButton/AbstractButton.js +189 -0
- package/lib/cjs/component/AbstractButton/AbstractButton.js.map +1 -0
- package/lib/cjs/component/AbstractButton/AbstractButton.type.js +2 -0
- package/lib/cjs/component/AbstractButton/AbstractButton.type.js.map +1 -0
- package/lib/cjs/component/AbstractButton/SpinButton.js.map +1 -0
- package/lib/cjs/component/Button/Button.js +50 -160
- package/lib/cjs/component/Button/Button.js.map +1 -1
- package/lib/cjs/component/Button/Button.type.js.map +1 -1
- package/lib/cjs/component/ButtonLink/ButtonLink.js +54 -29
- package/lib/cjs/component/ButtonLink/ButtonLink.js.map +1 -1
- package/lib/cjs/component/ButtonLink/ButtonLink.type.js.map +1 -1
- package/lib/cjs/component/ButtonLink/buttonLink.shadow.css +140 -10
- package/lib/cjs/index.js +4 -3
- package/lib/cjs/index.js.map +1 -1
- package/lib/es6/component/AbstractButton/AbstractButton.js +184 -0
- package/lib/es6/component/AbstractButton/AbstractButton.js.map +1 -0
- package/lib/es6/component/AbstractButton/AbstractButton.type.js +2 -0
- package/lib/es6/component/AbstractButton/AbstractButton.type.js.map +1 -0
- package/lib/es6/component/AbstractButton/SpinButton.js.map +1 -0
- package/lib/es6/component/Button/Button.js +49 -160
- package/lib/es6/component/Button/Button.js.map +1 -1
- package/lib/es6/component/Button/Button.type.js.map +1 -1
- package/lib/es6/component/ButtonLink/ButtonLink.js +56 -30
- package/lib/es6/component/ButtonLink/ButtonLink.js.map +1 -1
- package/lib/es6/component/ButtonLink/ButtonLink.type.js.map +1 -1
- package/lib/es6/component/ButtonLink/buttonLink.shadow.css +140 -10
- package/lib/es6/index.js +2 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/esm/component/AbstractButton/AbstractButton.mjs +157 -0
- package/lib/esm/component/{Button → AbstractButton}/SpinButton.mjs +2 -1
- package/lib/esm/component/Button/Button.mjs +48 -140
- package/lib/esm/component/ButtonLink/ButtonLink.mjs +52 -30
- package/lib/esm/component/ButtonLink/buttonLink.shadow.css +140 -10
- package/lib/esm/index.mjs +2 -3
- package/lib/types/component/AbstractButton/AbstractButton.d.ts +24 -0
- package/lib/types/component/AbstractButton/AbstractButton.type.d.ts +38 -0
- package/lib/types/component/Button/Button.d.ts +1 -28
- package/lib/types/component/Button/Button.type.d.ts +39 -40
- package/lib/types/component/ButtonLink/ButtonLink.type.d.ts +19 -14
- package/lib/types/index.d.ts +2 -1
- package/package.json +7 -7
- package/lib/cjs/component/Button/SpinButton.js.map +0 -1
- package/lib/es6/component/Button/SpinButton.js.map +0 -1
- package/lib/esm/component/Button/Button.type.mjs +0 -1
- package/lib/esm/component/ButtonLink/ButtonLink.type.mjs +0 -1
- /package/lib/cjs/component/{Button → AbstractButton}/SpinButton.js +0 -0
- /package/lib/es6/component/{Button → AbstractButton}/SpinButton.js +0 -0
- /package/lib/types/component/{Button → AbstractButton}/SpinButton.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","names":["_core","require","_baseComponents","_addonTextChildren","_interopRequireDefault","_hasLabels","_logger","_typography","_react","_SpinButton","style","sstyled","insert","MAP_USE_DEFAULT_THEME","exports","primary","secondary","tertiary","RootButton","_Component","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","_callSuper2","concat","_defineProperty2","React","createRef","ariaLabelledByContent","_inherits2","_createClass2","key","value","getTextProps","size","asProps","containerRef","getAddonProps","componentDidMount","_this2","process","env","NODE_ENV","logger","warn","current","hasLabels","title","displayName","ariaLabelledby","setTimeout","_document$getElementB","_document$getElementB2","setState","document","getElementById","textContent","render","_ref","_ref7","_ref8","_this3","_this$asProps","styles","use","_this$asProps$theme","theme","loading","_this$asProps$disable","disabled","neighborLocation","children","ariaLabel","Children","AddonLeft","addonLeft","AddonRight","addonRight","hintPlacement","SButton","Box","Button","CORE_INSTANCE","useTheme","SInner","SSpin","buttonAriaLabel","state","showHint","undefined","createElement","NeighborLocation","Detect","_ref4","Fragment","cn","_objectSpread2","assignProps","Addon","addonTextChildren","Text","Hint","Component","ButtonText","props","_ref2","arguments[0]","_ref5","SText","_ref3","_ref6","SAddon","createComponent","_default"],"sources":["../../../../src/component/Button/Button.tsx"],"sourcesContent":["import { NeighborLocation, Box, Hint } from '@semcore/base-components';\nimport { Component, CORE_INSTANCE, createComponent, Root, sstyled } from '@semcore/core';\nimport addonTextChildren from '@semcore/core/lib/utils/addonTextChildren';\nimport hasLabels from '@semcore/core/lib/utils/hasLabels';\nimport logger from '@semcore/core/lib/utils/logger';\nimport { Text } from '@semcore/typography';\nimport React from 'react';\n\nimport style from './button.shadow.css';\nimport type { ButtonProps, ButtonAddonProps, ButtonTextProps, ButtonComponent } from './Button.type';\nimport SpinButton from './SpinButton';\n\nexport const MAP_USE_DEFAULT_THEME: Record<string, string> = {\n primary: 'info',\n secondary: 'muted',\n tertiary: 'info',\n};\n\ntype State = {\n ariaLabelledByContent: null | string;\n};\n\nexport class RootButton extends Component<ButtonProps, [], never, {}, State> {\n static displayName = 'Button';\n static style = style;\n static defaultProps = {\n use: 'secondary',\n size: 'm',\n };\n\n containerRef = React.createRef<HTMLButtonElement>();\n\n state: State = {\n ariaLabelledByContent: null,\n };\n\n getTextProps() {\n const { size } = this.asProps;\n\n return {\n size,\n 'hint:triggerRef': this.containerRef,\n };\n }\n\n getAddonProps() {\n const { size } = this.asProps;\n return {\n size,\n };\n }\n\n componentDidMount() {\n if (process.env.NODE_ENV !== 'production') {\n logger.warn(\n this.containerRef.current && !hasLabels(this.containerRef.current) && !this.asProps.title,\n `'title' or 'aria-label' or 'aria-labelledby' are required props for buttons without text content`,\n this.asProps['data-ui-name'] || RootButton.displayName,\n );\n }\n\n const ariaLabelledby = this.asProps['aria-labelledby'];\n\n if (ariaLabelledby) {\n setTimeout(() => {\n this.setState({\n ariaLabelledByContent: document.getElementById(ariaLabelledby)?.textContent ?? '',\n });\n }, 0);\n }\n }\n\n render() {\n const {\n styles,\n use,\n theme = typeof use === 'string' && MAP_USE_DEFAULT_THEME[use],\n loading,\n disabled = loading,\n size,\n neighborLocation,\n children,\n title,\n ['aria-label']: ariaLabel,\n Children,\n addonLeft: AddonLeft,\n addonRight: AddonRight,\n hintPlacement,\n } = this.asProps;\n const SButton = Root;\n // @ts-ignore\n const Button = this[CORE_INSTANCE];\n const useTheme = use && theme ? `${use}-${theme}` : false;\n const SInner = Box;\n const SSpin = Box;\n const buttonAriaLabel = title ?? ariaLabel ?? this.state.ariaLabelledByContent ?? '';\n\n const showHint = (children === undefined || title);\n\n return (\n <NeighborLocation.Detect neighborLocation={neighborLocation}>\n {(neighborLocation) => {\n return sstyled(styles)(\n <>\n <SButton\n render={Box}\n invertOutline={theme === 'invert'}\n type='button'\n tag='button'\n tabIndex={0}\n disabled={disabled}\n use:theme={useTheme}\n ref={this.containerRef}\n aria-busy={loading}\n __excludeProps={['title']}\n aria-label={showHint ? buttonAriaLabel : undefined}\n neighborLocation={neighborLocation}\n >\n {/* @ts-ignore */}\n <SInner tag='span' loading={loading} data-ui-name={`${this.asProps['data-ui-name']}.InnerWrapper`}>\n {AddonLeft\n ? (\n <Button.Addon>\n <AddonLeft />\n </Button.Addon>\n )\n : null}\n {addonTextChildren(Children, Button.Text, Button.Addon)}\n {AddonRight\n ? (\n <Button.Addon>\n <AddonRight />\n </Button.Addon>\n )\n : null}\n </SInner>\n {loading && (\n <SSpin tag='span'>\n <SpinButton centered size={size} theme={useTheme} />\n </SSpin>\n )}\n </SButton>\n {showHint && (\n <Hint\n triggerRef={this.containerRef}\n timeout={[250, 50]}\n placement={hintPlacement}\n >\n {buttonAriaLabel}\n </Hint>\n )}\n </>,\n );\n }}\n </NeighborLocation.Detect>\n );\n }\n}\n\nfunction ButtonText(props: ButtonTextProps) {\n const SText = Root;\n return sstyled(props.styles)(<SText render={Text} />);\n}\n\nfunction Addon(props: ButtonAddonProps) {\n const SAddon = Root;\n return sstyled(props.styles)(<SAddon render={Box} tag='span' />);\n}\n\nconst Button = createComponent(RootButton, {\n Text: ButtonText,\n Addon,\n}) as ButtonComponent;\n\nexport default Button;\n"],"mappings":";;;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AADA,IAAAC,eAAA,GAAAD,OAAA;AAEA,IAAAE,kBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,UAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,OAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAJ,sBAAA,CAAAH,OAAA;AAIA,IAAAQ,WAAA,GAAAL,sBAAA,CAAAH,OAAA;AAAsC;AAAA,IAAAS,KAAA,8BAAAV,KAAA,CAAAW,OAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAE/B,IAAMC,qBAA6C,GAAAC,OAAA,CAAAD,qBAAA,GAAG;EAC3DE,OAAO,EAAE,MAAM;EACfC,SAAS,EAAE,OAAO;EAClBC,QAAQ,EAAE;AACZ,CAAC;AAAC,IAMWC,UAAU,GAAAJ,OAAA,CAAAI,UAAA,0BAAAC,UAAA;EAAA,SAAAD,WAAA;IAAA,IAAAE,KAAA;IAAA,IAAAC,gBAAA,mBAAAH,UAAA;IAAA,SAAAI,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;MAAAF,IAAA,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;IAAA;IAAAP,KAAA,OAAAQ,WAAA,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AAG,EAAE,WAAW;EAChB9B,IAAI,EAAE;AACR,CAAC;AAmIH,SAASqE,UAAUA,CAACC,KAAsB,EAAE;EAAA,IAAAC,KAAA,GAAAC,YAAA;IAAAC,KAAA;EAC1C,IAAMC,KAAK,GACiCR,gBAAI;EAAhD,OAAAO,KAAA,GAAO,IAAArG,aAAO,EAACkG,KAAK,CAACzC,MAAM,CAAC,eAAC5D,MAAA,YAAAuF,aAAA,CAACkB,KAAK,EAAAD,KAAA,CAAAZ,EAAA,cAAAC,cAAA,qBAAArG,KAAA,CAAAsG,WAAA,MAAAQ,KAAA,GAAgB,CAAC;AACtD;AAEA,SAASP,KAAKA,CAACM,KAAuB,EAAE;EAAA,IAAAK,KAAA,GAAAH,YAAA;IAAAI,KAAA;EACtC,IAAMC,MAAM,GACiC/B,mBAAG;EAAhD,OAAA8B,KAAA,GAAO,IAAAxG,aAAO,EAACkG,KAAK,CAACzC,MAAM,CAAC,eAAC5D,MAAA,YAAAuF,aAAA,CAACqB,MAAM,EAAAD,KAAA,CAAAf,EAAA,eAAAC,cAAA,qBAAArG,KAAA,CAAAsG,WAAA;IAAA,OAAkB;EAAM,GAAAY,KAAA,GAAE,CAAC;AACjE;AAEA,IAAM5B,MAAM,GAAG,IAAA+B,qBAAe,EAACnG,UAAU,EAAE;EACzCuF,IAAI,EAAEG,UAAU;EAChBL,KAAK,EAALA;AACF,CAAC,CAAoB;AAAC,IAAAe,QAAA,GAAAxG,OAAA,cAEPwE,MAAM","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Button.js","names":["_core","require","_flexBox","_react","_interopRequireDefault","_AbstractButton2","style","sstyled","insert","RootButton","_AbstractButton","_classCallCheck2","_callSuper2","arguments","_inherits2","_createClass2","key","value","getTextColor","undefined","AbstractButton","_defineProperty2","use","size","Text","props","_ref","arguments[0]","_ref3","SText","Box","styles","createElement","cn","_objectSpread2","assignProps","Addon","_ref2","_ref4","SAddon","Button","createComponent","_default","exports"],"sources":["../../../../src/component/Button/Button.tsx"],"sourcesContent":["import { createComponent, sstyled, Root } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\nimport React from 'react';\n\nimport style from './button.shadow.css';\nimport type { ButtonAddonProps, ButtonComponent, ButtonTextProps } from './Button.type';\nimport { AbstractButton } from '../AbstractButton/AbstractButton';\n\nclass RootButton extends AbstractButton {\n static displayName = 'Button';\n static style = style;\n static defaultProps = {\n use: 'secondary',\n size: 'm',\n };\n\n protected getTextColor(): string | undefined {\n return undefined;\n }\n}\n\nfunction Text(props: ButtonTextProps) {\n const SText = Root;\n return sstyled(props.styles)(<SText render={Box} tag='span' />);\n}\n\nfunction Addon(props: ButtonAddonProps) {\n const SAddon = Root;\n return sstyled(props.styles)(<SAddon render={Box} tag='span' />);\n}\n\nconst Button = createComponent(RootButton, {\n Text,\n Addon,\n}) as ButtonComponent;\n\nexport default Button;\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AAIA,IAAAI,gBAAA,GAAAJ,OAAA;AAAkE;AAAA,IAAAK,KAAA,8BAAAN,KAAA,CAAAO,OAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAA,IAE5DC,UAAU,0BAAAC,eAAA;EAAA,SAAAD,WAAA;IAAA,IAAAE,gBAAA,mBAAAF,UAAA;IAAA,WAAAG,WAAA,mBAAAH,UAAA,EAAAI,SAAA;EAAA;EAAA,IAAAC,UAAA,aAAAL,UAAA,EAAAC,eAAA;EAAA,WAAAK,aAAA,aAAAN,UAAA;IAAAO,GAAA;IAAAC,KAAA,EAQd,SAAUC,YAAYA,CAAA,EAAuB;MAC3C,OAAOC,SAAS;IAClB;EAAC;AAAA,EAVsBC,+BAAc;AAAA,IAAAC,gBAAA,aAAjCZ,UAAU,iBACO,QAAQ;AAAA,IAAAY,gBAAA,aADzBZ,UAAU,WAECH,KAAK;AAAA,IAAAe,gBAAA,aAFhBZ,UAAU,kBAGQ;EACpBa,GAAG,EAAE,WAAW;EAChBC,IAAI,EAAE;AACR,CAAC;AAOH,SAASC,IAAIA,CAACC,KAAsB,EAAE;EAAA,IAAAC,IAAA,GAAAC,YAAA;IAAAC,KAAA;EACpC,IAAMC,KAAK,GACiCC,YAAG;EAA/C,OAAAF,KAAA,GAAO,IAAArB,aAAO,EAACkB,KAAK,CAACM,MAAM,CAAC,eAAC5B,MAAA,YAAA6B,aAAA,CAACH,KAAK,EAAAD,KAAA,CAAAK,EAAA,cAAAC,cAAA,qBAAAlC,KAAA,CAAAmC,WAAA;IAAA,OAAkB;EAAM,GAAAT,IAAA,GAAE,CAAC;AAChE;AAEA,SAASU,KAAKA,CAACX,KAAuB,EAAE;EAAA,IAAAY,KAAA,GAAAV,YAAA;IAAAW,KAAA;EACtC,IAAMC,MAAM,GACiCT,YAAG;EAAhD,OAAAQ,KAAA,GAAO,IAAA/B,aAAO,EAACkB,KAAK,CAACM,MAAM,CAAC,eAAC5B,MAAA,YAAA6B,aAAA,CAACO,MAAM,EAAAD,KAAA,CAAAL,EAAA,eAAAC,cAAA,qBAAAlC,KAAA,CAAAmC,WAAA;IAAA,OAAkB;EAAM,GAAAE,KAAA,GAAE,CAAC;AACjE;AAEA,IAAMG,MAAM,GAAG,IAAAC,qBAAe,EAAChC,UAAU,EAAE;EACzCe,IAAI,EAAJA,IAAI;EACJY,KAAK,EAALA;AACF,CAAC,CAAoB;AAAC,IAAAM,QAAA,GAAAC,OAAA,cAEPH,MAAM","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.type.js","names":[],"sources":["../../../../src/component/Button/Button.type.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"Button.type.js","names":[],"sources":["../../../../src/component/Button/Button.type.ts"],"sourcesContent":["import type { UnknownProperties, Intergalactic } from '@semcore/core';\n\nimport type {\n AbstractButtonAddonProps,\n AbstractButtonContext,\n AbstractButtonTextProps,\n AbstractButtonProps,\n} from '../AbstractButton/AbstractButton.type';\n\n/**\n * Button size\n * @default m\n */\nexport type ButtonSize = 'l' | 'm';\n/**\n * Button type\n * @default secondary\n */\ntype Use = 'primary' | 'secondary' | 'tertiary';\n\n/**\n * @deprecated don't use it. use `danger` for incorrect or danger behavior and `brand` for the orange one.\n */\ntype DeprecatedTheme = 'warning';\n\n/** Button theme */\ntype Theme = 'info' | 'success' | 'brand' | 'danger' | 'muted' | 'invert';\n\n/** @deprecated */\nexport interface IButtonProps extends ButtonProps, UnknownProperties {}\nexport type ButtonProps = AbstractButtonProps<ButtonSize, Use, Theme | DeprecatedTheme>;\n\n/** @deprecated */\nexport interface IButtonTextProps extends ButtonTextProps, UnknownProperties {}\nexport type ButtonTextProps = AbstractButtonTextProps<ButtonSize>;\n\n/** @deprecated */\nexport interface IButtonAddonProps extends ButtonAddonProps, UnknownProperties {}\nexport type ButtonAddonProps = AbstractButtonAddonProps<ButtonSize>;\n\n/** @deprecated */\nexport interface IButtonContext extends ButtonContext, UnknownProperties {}\nexport type ButtonContext = AbstractButtonContext;\n\nexport type ButtonChildren = {\n Text: Intergalactic.Component<'span', ButtonTextProps>;\n Addon: Intergalactic.Component<'span', ButtonAddonProps>;\n};\n\nexport type ButtonComponent = Intergalactic.Component<'button', ButtonProps, ButtonContext> & {\n Text: Intergalactic.Component<'span', ButtonTextProps>;\n Addon: Intergalactic.Component<'span', ButtonAddonProps>;\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -12,51 +12,76 @@ var _callSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/callSup
|
|
|
12
12
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
14
|
var _core = require("@semcore/core");
|
|
15
|
-
var
|
|
15
|
+
var _resolveColorEnhance = _interopRequireDefault(require("@semcore/core/lib/utils/enhances/resolveColorEnhance"));
|
|
16
|
+
var _flexBox = require("@semcore/flex-box");
|
|
16
17
|
var _react = _interopRequireDefault(require("react"));
|
|
18
|
+
var _AbstractButton2 = require("../AbstractButton/AbstractButton");
|
|
17
19
|
/*!__reshadow-styles__:"./buttonLink.shadow.css"*/
|
|
18
|
-
var style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".
|
|
20
|
+
var style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".___SButton_m3xza_gg_{display:inline-flex;font-family:inherit;font-size:var(--intergalactic-fs-200, 14px);color:var(--intergalactic-text-link, rgb(35, 95, 226));line-height:normal;position:relative;cursor:pointer;border:0;padding:0;margin:0;box-shadow:none;-webkit-tap-highlight-color:transparent;background:0 0;transition:color .15s ease-in-out}.___SButton_m3xza_gg_,.___SButton_m3xza_gg_:active{-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SButton_m3xza_gg_:hover{-webkit-text-decoration:none;text-decoration:none}}.___SButton_m3xza_gg_::-moz-focus-inner{border:0;padding:0}.___SButton_m3xza_gg_.__active_m3xza_gg_,.___SButton_m3xza_gg_:active{color:var(--intergalactic-text-link-hover-active, rgb(33, 89, 215))}@media (hover:hover){.___SButton_m3xza_gg_:hover{color:var(--intergalactic-text-link-hover-active, rgb(33, 89, 215))}}.___SButton_m3xza_gg_.__active_m3xza_gg_ .___SText_m3xza_gg_,.___SButton_m3xza_gg_:active .___SText_m3xza_gg_{border-color:currentColor}@media (hover:hover){.___SButton_m3xza_gg_:hover .___SText_m3xza_gg_{border-color:currentColor}}.___SButton_m3xza_gg_.__enableVisited_m3xza_gg_:visited{color:var(--intergalactic-text-link-visited, rgb(128, 41, 236))}@media (hover:hover){.___SButton_m3xza_gg_.__enableVisited_m3xza_gg_:visited:hover{color:var(--intergalactic-text-link-visited, rgb(128, 41, 236))}}.___SButton_m3xza_gg_ .___SText_m3xza_gg_{border-bottom-width:1px;border-bottom-style:solid;border-color:transparent;transition:border-bottom-color .15s ease-in-out}.___SButton_m3xza_gg_.__disabled_m3xza_gg_{opacity:var(--intergalactic-disabled-opacity, 0.4);cursor:default;pointer-events:none}.___SButton_m3xza_gg_._use_secondary_m3xza_gg_{color:var(--intergalactic-text-hint, rgba(0, 3, 0, 0.583))}@supports (color:color(display-p3 0 0 0%)){.___SButton_m3xza_gg_._use_secondary_m3xza_gg_{color:var(--intergalactic-text-hint, rgba(0, 3, 0, 0.583))}@media (color-gamut:p3){.___SButton_m3xza_gg_._use_secondary_m3xza_gg_{color:var(--intergalactic-text-hint, color(display-p3 0.00228 0.01289 0.00252 / 0.583))}}}.___SButton_m3xza_gg_._use_secondary_m3xza_gg_.__active_m3xza_gg_,.___SButton_m3xza_gg_._use_secondary_m3xza_gg_:active{color:var(--intergalactic-text-hint-hover-active, rgba(0, 3, 0, 0.605))}@media (hover:hover){.___SButton_m3xza_gg_._use_secondary_m3xza_gg_:hover{color:var(--intergalactic-text-hint-hover-active, rgba(0, 3, 0, 0.605))}}.___SButton_m3xza_gg_._use_secondary_m3xza_gg_ .___SText_m3xza_gg_{border-bottom-width:1px;border-bottom-style:dashed;border-color:currentColor}.___SAddon_m3xza_gg_,.___SInner_m3xza_gg_{display:inline-flex;justify-content:center;align-items:center}.___SInner_m3xza_gg_{height:100%;width:100%}.___SAddon_m3xza_gg_{vertical-align:middle;pointer-events:none}.___SButton_m3xza_gg_ .___SAddon_m3xza_gg_:not(:only-child):first-child{margin-right:var(--intergalactic-spacing-1x, 4px)}.___SButton_m3xza_gg_ .___SAddon_m3xza_gg_:not(:only-child):last-child{margin-left:var(--intergalactic-spacing-1x, 4px)}.___SButton_m3xza_gg_.__text-color_m3xza_gg_{color:var(--text-color_m3xza)}.___SButton_m3xza_gg_.__text-color_m3xza_gg_.__active_m3xza_gg_,.___SButton_m3xza_gg_.__text-color_m3xza_gg_:active{color:var(--text-color_m3xza);filter:brightness(.8)}@media (hover:hover){.___SButton_m3xza_gg_.__text-color_m3xza_gg_:hover{color:var(--text-color_m3xza);filter:brightness(.8)}}.___SButton_m3xza_gg_._size_100_m3xza_gg_{font-size:var(--intergalactic-fs-100, 12px);line-height:var(--intergalactic-lh-100, 133%)}.___SButton_m3xza_gg_._size_200_m3xza_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%)}.___SButton_m3xza_gg_._size_300_m3xza_gg_{font-size:var(--intergalactic-fs-300, 16px);line-height:var(--intergalactic-lh-300, 150%)}.___SButton_m3xza_gg_._size_400_m3xza_gg_{font-size:var(--intergalactic-fs-400, 20px);line-height:var(--intergalactic-lh-400, 120%)}.___SButton_m3xza_gg_._size_500_m3xza_gg_{font-size:var(--intergalactic-fs-500, 24px);line-height:var(--intergalactic-lh-500, 117%)}.___SButton_m3xza_gg_._size_600_m3xza_gg_{font-size:var(--intergalactic-fs-600, 32px);line-height:var(--intergalactic-lh-600, 125%)}.___SButton_m3xza_gg_._size_700_m3xza_gg_{font-size:var(--intergalactic-fs-700, 36px);line-height:var(--intergalactic-lh-700, 110%)}.___SButton_m3xza_gg_._size_800_m3xza_gg_{font-size:var(--intergalactic-fs-800, 48px);line-height:var(--intergalactic-lh-800, 117%)}@media (prefers-reduced-motion){.___SButton_m3xza_gg_,.___SText_m3xza_gg_{transition:none}}", /*__inner_css_end__*/"m3xza_gg_"),
|
|
19
21
|
/*__reshadow_css_end__*/
|
|
20
22
|
{
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
23
|
+
"__SButton": "___SButton_m3xza_gg_",
|
|
24
|
+
"_disabled": "__disabled_m3xza_gg_",
|
|
25
|
+
"__SInner": "___SInner_m3xza_gg_",
|
|
26
|
+
"__SAddon": "___SAddon_m3xza_gg_",
|
|
27
|
+
"_size_100": "_size_100_m3xza_gg_",
|
|
28
|
+
"_size_200": "_size_200_m3xza_gg_",
|
|
29
|
+
"_size_300": "_size_300_m3xza_gg_",
|
|
30
|
+
"_size_400": "_size_400_m3xza_gg_",
|
|
31
|
+
"_size_500": "_size_500_m3xza_gg_",
|
|
32
|
+
"_size_600": "_size_600_m3xza_gg_",
|
|
33
|
+
"_size_700": "_size_700_m3xza_gg_",
|
|
34
|
+
"_size_800": "_size_800_m3xza_gg_",
|
|
35
|
+
"__SText": "___SText_m3xza_gg_",
|
|
36
|
+
"_active": "__active_m3xza_gg_",
|
|
37
|
+
"_enableVisited": "__enableVisited_m3xza_gg_",
|
|
38
|
+
"_use_secondary": "_use_secondary_m3xza_gg_",
|
|
39
|
+
"_text-color": "__text-color_m3xza_gg_",
|
|
40
|
+
"--text-color": "--text-color_m3xza"
|
|
27
41
|
});
|
|
28
|
-
var
|
|
42
|
+
var enhance = {
|
|
43
|
+
resolveColor: (0, _resolveColorEnhance["default"])()
|
|
44
|
+
};
|
|
45
|
+
var RootButtonLink = /*#__PURE__*/function (_AbstractButton) {
|
|
29
46
|
function RootButtonLink() {
|
|
30
47
|
(0, _classCallCheck2["default"])(this, RootButtonLink);
|
|
31
48
|
return (0, _callSuper2["default"])(this, RootButtonLink, arguments);
|
|
32
49
|
}
|
|
33
|
-
(0, _inherits2["default"])(RootButtonLink,
|
|
50
|
+
(0, _inherits2["default"])(RootButtonLink, _AbstractButton);
|
|
34
51
|
return (0, _createClass2["default"])(RootButtonLink, [{
|
|
35
|
-
key: "
|
|
36
|
-
value: function
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return _ref2 = (0, _core.sstyled)(style), /*#__PURE__*/_react["default"].createElement(SButtonLink, _ref2.cn("SButtonLink", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
|
|
42
|
-
"tag": 'button',
|
|
43
|
-
"type": 'button',
|
|
44
|
-
"use:disabled": disabled,
|
|
45
|
-
"use:tabIndex": 0
|
|
46
|
-
}, _ref))));
|
|
52
|
+
key: "getTextColor",
|
|
53
|
+
value: function getTextColor() {
|
|
54
|
+
var _ref5 = this.asProps,
|
|
55
|
+
color = _ref5.color,
|
|
56
|
+
resolveColor = _ref5.resolveColor;
|
|
57
|
+
return resolveColor(color);
|
|
47
58
|
}
|
|
48
59
|
}]);
|
|
49
|
-
}(
|
|
60
|
+
}(_AbstractButton2.AbstractButton);
|
|
50
61
|
(0, _defineProperty2["default"])(RootButtonLink, "displayName", 'ButtonLink');
|
|
62
|
+
(0, _defineProperty2["default"])(RootButtonLink, "enhance", Object.values(enhance));
|
|
51
63
|
(0, _defineProperty2["default"])(RootButtonLink, "style", style);
|
|
52
64
|
(0, _defineProperty2["default"])(RootButtonLink, "defaultProps", {
|
|
53
|
-
use: 'primary'
|
|
54
|
-
size: 200
|
|
65
|
+
use: 'primary'
|
|
55
66
|
});
|
|
67
|
+
function Text(props) {
|
|
68
|
+
var _ref = arguments[0],
|
|
69
|
+
_ref3;
|
|
70
|
+
var SText = _flexBox.Box;
|
|
71
|
+
return _ref3 = (0, _core.sstyled)(props.styles), /*#__PURE__*/_react["default"].createElement(SText, _ref3.cn("SText", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
|
|
72
|
+
"tag": 'span'
|
|
73
|
+
}, _ref))));
|
|
74
|
+
}
|
|
75
|
+
function Addon(props) {
|
|
76
|
+
var _ref2 = arguments[0],
|
|
77
|
+
_ref4;
|
|
78
|
+
var SAddon = _flexBox.Box;
|
|
79
|
+
return _ref4 = (0, _core.sstyled)(props.styles), /*#__PURE__*/_react["default"].createElement(SAddon, _ref4.cn("SAddon", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
|
|
80
|
+
"tag": 'span'
|
|
81
|
+
}, _ref2))));
|
|
82
|
+
}
|
|
56
83
|
var ButtonLink = exports.ButtonLink = (0, _core.createComponent)(RootButtonLink, {
|
|
57
|
-
Text:
|
|
58
|
-
Addon:
|
|
59
|
-
}, {
|
|
60
|
-
parent: _link["default"]
|
|
84
|
+
Text: Text,
|
|
85
|
+
Addon: Addon
|
|
61
86
|
});
|
|
62
87
|
//# sourceMappingURL=ButtonLink.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonLink.js","names":["_core","require","
|
|
1
|
+
{"version":3,"file":"ButtonLink.js","names":["_core","require","_resolveColorEnhance","_interopRequireDefault","_flexBox","_react","_AbstractButton2","style","sstyled","insert","enhance","resolveColor","resolveColorEnhance","RootButtonLink","_AbstractButton","_classCallCheck2","_callSuper2","arguments","_inherits2","_createClass2","key","value","getTextColor","_ref5","asProps","color","AbstractButton","_defineProperty2","Object","values","use","Text","props","_ref","arguments[0]","_ref3","SText","Box","styles","createElement","cn","_objectSpread2","assignProps","Addon","_ref2","_ref4","SAddon","ButtonLink","exports","createComponent"],"sources":["../../../../src/component/ButtonLink/ButtonLink.tsx"],"sourcesContent":["import { createComponent, sstyled, Root } from '@semcore/core';\nimport resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';\nimport { Box } from '@semcore/flex-box';\nimport React from 'react';\n\nimport style from './buttonLink.shadow.css';\nimport type { ButtonLinkAddonProps, ButtonLinkComponent, ButtonLinkTextProps } from './ButtonLink.type';\nimport { AbstractButton } from '../AbstractButton/AbstractButton';\n\nconst enhance = {\n resolveColor: resolveColorEnhance(),\n};\n\nclass RootButtonLink extends AbstractButton {\n static displayName = 'ButtonLink';\n static enhance = Object.values(enhance);\n static style = style;\n static defaultProps = {\n use: 'primary',\n };\n\n protected getTextColor(): string | undefined {\n const { color, resolveColor } = this.asProps as any;\n return resolveColor(color);\n }\n}\n\nfunction Text(props: ButtonLinkTextProps) {\n const SText = Root;\n return sstyled(props.styles)(<SText render={Box} tag='span' />);\n}\n\nfunction Addon(props: ButtonLinkAddonProps) {\n const SAddon = Root;\n return sstyled(props.styles)(<SAddon render={Box} tag='span' />);\n}\n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hBd,cAAc,kBAII;EACpBiB,GAAG,EAAE;AACP,CAAC;AAQH,SAASC,IAAIA,CAACC,KAA0B,EAAE;EAAA,IAAAC,IAAA,GAAAC,YAAA;IAAAC,KAAA;EACxC,IAAMC,KAAK,GACiCC,YAAG;EAA/C,OAAAF,KAAA,GAAO,IAAA3B,aAAO,EAACwB,KAAK,CAACM,MAAM,CAAC,eAACjC,MAAA,YAAAkC,aAAA,CAACH,KAAK,EAAAD,KAAA,CAAAK,EAAA,cAAAC,cAAA,qBAAAzC,KAAA,CAAA0C,WAAA;IAAA,OAAkB;EAAM,GAAAT,IAAA,GAAE,CAAC;AAChE;AAEA,SAASU,KAAKA,CAACX,KAA2B,EAAE;EAAA,IAAAY,KAAA,GAAAV,YAAA;IAAAW,KAAA;EAC1C,IAAMC,MAAM,GACiCT,YAAG;EAAhD,OAAAQ,KAAA,GAAO,IAAArC,aAAO,EAACwB,KAAK,CAACM,MAAM,CAAC,eAACjC,MAAA,YAAAkC,aAAA,CAACO,MAAM,EAAAD,KAAA,CAAAL,EAAA,eAAAC,cAAA,qBAAAzC,KAAA,CAAA0C,WAAA;IAAA,OAAkB;EAAM,GAAAE,KAAA,GAAE,CAAC;AACjE;AAEO,IAAMG,UAAU,GAAAC,OAAA,CAAAD,UAAA,GAAG,IAAAE,qBAAe,EAACpC,cAAc,EAAE;EACxDkB,IAAI,EAAJA,IAAI;EACJY,KAAK,EAALA;AACF,CAAC,CAAwB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonLink.type.js","names":[],"sources":["../../../../src/component/ButtonLink/ButtonLink.type.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"ButtonLink.type.js","names":[],"sources":["../../../../src/component/ButtonLink/ButtonLink.type.ts"],"sourcesContent":["import type { Intergalactic } from '@semcore/core';\n\nimport type {\n AbstractButtonAddonProps,\n AbstractButtonContext,\n AbstractButtonTextProps,\n AbstractButtonProps,\n} from '../AbstractButton/AbstractButton.type';\n\n/**\n * Button link size\n */\nexport type ButtonLinkSize = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800;\n/**\n * Button link type\n * @default primary\n */\ntype Use = 'primary' | 'secondary';\n\nexport type ButtonLinkProps = AbstractButtonProps<ButtonLinkSize, Use, never>;\n\nexport type ButtonLinkTextProps = AbstractButtonTextProps<ButtonLinkSize>;\n\nexport type ButtonLinkAddonProps = AbstractButtonAddonProps<ButtonLinkSize>;\n\nexport type ButtonLinkContext = AbstractButtonContext;\n\nexport type ButtonLinkChildren = {\n Text: Intergalactic.Component<'span', ButtonLinkTextProps>;\n Addon: Intergalactic.Component<'span', ButtonLinkAddonProps>;\n};\n\nexport type ButtonLinkComponent = Intergalactic.Component<\n 'button',\n ButtonLinkProps,\n ButtonLinkContext\n> & {\n Text: Intergalactic.Component<'span', ButtonLinkTextProps>;\n Addon: Intergalactic.Component<'span', ButtonLinkAddonProps>;\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,19 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
SButton {
|
|
2
|
+
display: inline-flex;
|
|
3
3
|
font-family: inherit;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
SButtonLink[use='primary']:not([color]) {
|
|
4
|
+
font-size: var(--intergalactic-fs-200, 14px);
|
|
7
5
|
color: var(--intergalactic-text-link, oklch(0.53 0.21 263));
|
|
6
|
+
line-height: normal;
|
|
7
|
+
position: relative;
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
text-decoration: none;
|
|
10
|
+
border: none;
|
|
11
|
+
padding: 0;
|
|
12
|
+
margin: 0;
|
|
13
|
+
box-shadow: none;
|
|
14
|
+
-webkit-tap-highlight-color: transparent;
|
|
15
|
+
background: none;
|
|
16
|
+
transition: color 0.15s ease-in-out;
|
|
8
17
|
|
|
9
|
-
&[active],
|
|
10
18
|
&:active,
|
|
11
19
|
&:hover {
|
|
20
|
+
text-decoration: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&::-moz-focus-inner {
|
|
24
|
+
border: none;
|
|
25
|
+
padding: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&[active],
|
|
29
|
+
&:hover,
|
|
30
|
+
&:active {
|
|
12
31
|
color: var(--intergalactic-text-link-hover-active, oklch(0.51 0.202 263));
|
|
32
|
+
|
|
33
|
+
& SText {
|
|
34
|
+
border-color: currentColor;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&[enableVisited]:visited,
|
|
39
|
+
&[enableVisited]:visited:hover {
|
|
40
|
+
color: var(--intergalactic-text-link-visited, oklch(0.53 0.26 296));
|
|
13
41
|
}
|
|
42
|
+
|
|
43
|
+
SText {
|
|
44
|
+
border-bottom-width: 1px;
|
|
45
|
+
border-bottom-style: solid;
|
|
46
|
+
border-color: transparent;
|
|
47
|
+
transition: border-bottom-color 0.15s ease-in-out;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
SButton[disabled] {
|
|
52
|
+
opacity: var(--intergalactic-disabled-opacity, 0.4);
|
|
53
|
+
cursor: default;
|
|
54
|
+
/* Disable link interactions */
|
|
55
|
+
pointer-events: none;
|
|
14
56
|
}
|
|
15
57
|
|
|
16
|
-
|
|
58
|
+
SButton[use='secondary'] {
|
|
17
59
|
color: var(--intergalactic-text-hint, oklch(0.088 0.026 147.7 / 0.583));
|
|
18
60
|
|
|
19
61
|
&[active],
|
|
@@ -21,9 +63,97 @@ SButtonLink[use='secondary']:not([color]) {
|
|
|
21
63
|
&:hover {
|
|
22
64
|
color: var(--intergalactic-text-hint-hover-active, oklch(0.086 0.026 145.8 / 0.605));
|
|
23
65
|
}
|
|
66
|
+
|
|
67
|
+
SText {
|
|
68
|
+
border-bottom-width: 1px;
|
|
69
|
+
border-bottom-style: dashed;
|
|
70
|
+
border-color: currentColor;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
SInner {
|
|
75
|
+
display: inline-flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
justify-content: center;
|
|
78
|
+
height: 100%;
|
|
79
|
+
width: 100%;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
SAddon {
|
|
83
|
+
display: inline-flex;
|
|
84
|
+
justify-content: center;
|
|
85
|
+
align-items: center;
|
|
86
|
+
vertical-align: middle;
|
|
87
|
+
pointer-events: none;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
SButton SAddon {
|
|
91
|
+
&:not(:only-child):first-child {
|
|
92
|
+
margin-right: var(--intergalactic-spacing-1x, 4px);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&:not(:only-child):last-child {
|
|
96
|
+
margin-left: var(--intergalactic-spacing-1x, 4px);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
SButton[text-color] {
|
|
101
|
+
color: var(--text-color);
|
|
102
|
+
|
|
103
|
+
&[active],
|
|
104
|
+
&:hover,
|
|
105
|
+
&:active {
|
|
106
|
+
color: var(--text-color);
|
|
107
|
+
filter: brightness(0.8);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
SButton[size='100'] {
|
|
112
|
+
font-size: var(--intergalactic-fs-100, 12px);
|
|
113
|
+
line-height: var(--intergalactic-lh-100, 133%);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
SButton[size='200'] {
|
|
117
|
+
font-size: var(--intergalactic-fs-200, 14px);
|
|
118
|
+
line-height: var(--intergalactic-lh-200, 142%);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
SButton[size='300'] {
|
|
122
|
+
font-size: var(--intergalactic-fs-300, 16px);
|
|
123
|
+
line-height: var(--intergalactic-lh-300, 150%);
|
|
24
124
|
}
|
|
25
125
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
126
|
+
SButton[size='400'] {
|
|
127
|
+
font-size: var(--intergalactic-fs-400, 20px);
|
|
128
|
+
line-height: var(--intergalactic-lh-400, 120%);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
SButton[size='500'] {
|
|
132
|
+
font-size: var(--intergalactic-fs-500, 24px);
|
|
133
|
+
line-height: var(--intergalactic-lh-500, 117%);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
SButton[size='600'] {
|
|
137
|
+
font-size: var(--intergalactic-fs-600, 32px);
|
|
138
|
+
line-height: var(--intergalactic-lh-600, 125%);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
SButton[size='700'] {
|
|
142
|
+
font-size: var(--intergalactic-fs-700, 36px);
|
|
143
|
+
line-height: var(--intergalactic-lh-700, 110%);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
SButton[size='800'] {
|
|
147
|
+
font-size: var(--intergalactic-fs-800, 48px);
|
|
148
|
+
line-height: var(--intergalactic-lh-800, 117%);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
@media (prefers-reduced-motion) {
|
|
152
|
+
SButton {
|
|
153
|
+
transition: none;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
SText {
|
|
157
|
+
transition: none;
|
|
158
|
+
}
|
|
29
159
|
}
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
@@ -10,7 +10,7 @@ var _exportNames = {
|
|
|
10
10
|
Object.defineProperty(exports, "MAP_USE_DEFAULT_THEME", {
|
|
11
11
|
enumerable: true,
|
|
12
12
|
get: function get() {
|
|
13
|
-
return
|
|
13
|
+
return _AbstractButton.MAP_USE_DEFAULT_THEME;
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, "default", {
|
|
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "default", {
|
|
|
19
19
|
return _Button["default"];
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
var _Button =
|
|
22
|
+
var _Button = _interopRequireDefault(require("./component/Button/Button"));
|
|
23
23
|
var _Button2 = require("./component/Button/Button.type");
|
|
24
24
|
Object.keys(_Button2).forEach(function (key) {
|
|
25
25
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -56,4 +56,5 @@ Object.keys(_ButtonLink2).forEach(function (key) {
|
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
58
|
});
|
|
59
|
+
var _AbstractButton = require("./component/AbstractButton/AbstractButton");
|
|
59
60
|
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_Button","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Button","_interopRequireDefault","require","_Button2","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_ButtonLink","_ButtonLink2","_AbstractButton"],"sources":["../../src/index.ts"],"sourcesContent":["export { default } from './component/Button/Button';\nexport * from './component/Button/Button.type';\nexport * from './component/ButtonLink/ButtonLink';\nexport * from './component/ButtonLink/ButtonLink.type';\nexport { MAP_USE_DEFAULT_THEME } from './component/AbstractButton/AbstractButton';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,QAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,QAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAZ,QAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,WAAA,GAAAd,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAW,WAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAS,WAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAC,WAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AACA,IAAAU,YAAA,GAAAf,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAY,YAAA,EAAAX,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAU,YAAA,CAAAV,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAE,YAAA,CAAAV,GAAA;IAAA;EAAA;AAAA;AACA,IAAAW,eAAA,GAAAhB,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
+
import _callSuper from "@babel/runtime/helpers/callSuper";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
|
+
import { assignProps as _assignProps2 } from "@semcore/core";
|
|
8
|
+
import { assignProps as _assignProps } from "@semcore/core";
|
|
9
|
+
import { Component, CORE_INSTANCE, Root, sstyled } from '@semcore/core';
|
|
10
|
+
import addonTextChildren from '@semcore/core/lib/utils/addonTextChildren';
|
|
11
|
+
import hasLabels from '@semcore/core/lib/utils/hasLabels';
|
|
12
|
+
import logger from '@semcore/core/lib/utils/logger';
|
|
13
|
+
import { Box } from '@semcore/flex-box';
|
|
14
|
+
import NeighborLocation from '@semcore/neighbor-location';
|
|
15
|
+
import { Hint } from '@semcore/tooltip';
|
|
16
|
+
import React from 'react';
|
|
17
|
+
import SpinButton from './SpinButton';
|
|
18
|
+
export var MAP_USE_DEFAULT_THEME = {
|
|
19
|
+
primary: 'info',
|
|
20
|
+
secondary: 'muted',
|
|
21
|
+
tertiary: 'info'
|
|
22
|
+
};
|
|
23
|
+
export var AbstractButton = /*#__PURE__*/function (_Component) {
|
|
24
|
+
function AbstractButton() {
|
|
25
|
+
var _this;
|
|
26
|
+
_classCallCheck(this, AbstractButton);
|
|
27
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
28
|
+
args[_key] = arguments[_key];
|
|
29
|
+
}
|
|
30
|
+
_this = _callSuper(this, AbstractButton, [].concat(args));
|
|
31
|
+
_defineProperty(_this, "containerRef", /*#__PURE__*/React.createRef());
|
|
32
|
+
_defineProperty(_this, "state", {
|
|
33
|
+
ariaLabelledByContent: null
|
|
34
|
+
});
|
|
35
|
+
return _this;
|
|
36
|
+
}
|
|
37
|
+
_inherits(AbstractButton, _Component);
|
|
38
|
+
return _createClass(AbstractButton, [{
|
|
39
|
+
key: "getTextProps",
|
|
40
|
+
value: function getTextProps() {
|
|
41
|
+
var size = this.asProps.size;
|
|
42
|
+
return {
|
|
43
|
+
size: size
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}, {
|
|
47
|
+
key: "getAddonProps",
|
|
48
|
+
value: function getAddonProps() {
|
|
49
|
+
var size = this.asProps.size;
|
|
50
|
+
return {
|
|
51
|
+
size: size
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}, {
|
|
55
|
+
key: "componentDidMount",
|
|
56
|
+
value: function componentDidMount() {
|
|
57
|
+
var _this2 = this;
|
|
58
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
59
|
+
logger.warn(this.containerRef.current && !hasLabels(this.containerRef.current) && !this.asProps.title, "'title' or 'aria-label' or 'aria-labelledby' are required props for buttons without text content", this.asProps['data-ui-name'] || AbstractButton.displayName);
|
|
60
|
+
logger.warn(this.asProps.theme === 'warning', 'Warning theme is deprecated and will be removed in the next major release.', this.asProps['data-ui-name'] || AbstractButton.displayName);
|
|
61
|
+
}
|
|
62
|
+
var ariaLabelledby = this.asProps['aria-labelledby'];
|
|
63
|
+
if (ariaLabelledby) {
|
|
64
|
+
setTimeout(function () {
|
|
65
|
+
var _document$getElementB, _document$getElementB2;
|
|
66
|
+
_this2.setState({
|
|
67
|
+
ariaLabelledByContent: (_document$getElementB = (_document$getElementB2 = document.getElementById(ariaLabelledby)) === null || _document$getElementB2 === void 0 ? void 0 : _document$getElementB2.textContent) !== null && _document$getElementB !== void 0 ? _document$getElementB : ''
|
|
68
|
+
});
|
|
69
|
+
}, 0);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}, {
|
|
73
|
+
key: "renderButton",
|
|
74
|
+
value: function renderButton(_ref6) {
|
|
75
|
+
var _ref = this.asProps,
|
|
76
|
+
_ref3;
|
|
77
|
+
var buttonProps = _ref6.buttonProps,
|
|
78
|
+
children = _ref6.children;
|
|
79
|
+
var _this$asProps = this.asProps,
|
|
80
|
+
styles = _this$asProps.styles,
|
|
81
|
+
theme = _this$asProps.theme;
|
|
82
|
+
var SButton = Box;
|
|
83
|
+
return _ref3 = sstyled(styles), /*#__PURE__*/React.createElement(SButton, _ref3.cn("SButton", _objectSpread({}, _assignProps(_objectSpread({
|
|
84
|
+
"invertOutline": theme === 'invert'
|
|
85
|
+
}, buttonProps), _ref))), children);
|
|
86
|
+
}
|
|
87
|
+
}, {
|
|
88
|
+
key: "renderButtonWithHint",
|
|
89
|
+
value: function renderButtonWithHint(_ref7) {
|
|
90
|
+
var _ref2 = this.asProps,
|
|
91
|
+
_ref4;
|
|
92
|
+
var buttonProps = _ref7.buttonProps,
|
|
93
|
+
children = _ref7.children,
|
|
94
|
+
hintProps = _ref7.hintProps;
|
|
95
|
+
var _this$asProps2 = this.asProps,
|
|
96
|
+
styles = _this$asProps2.styles,
|
|
97
|
+
theme = _this$asProps2.theme;
|
|
98
|
+
var SButton = Hint;
|
|
99
|
+
return _ref4 = sstyled(styles), /*#__PURE__*/React.createElement(SButton, _ref4.cn("SButton", _objectSpread({}, _assignProps2(_objectSpread(_objectSpread(_objectSpread({
|
|
100
|
+
"invertOutline": theme === 'invert'
|
|
101
|
+
}, buttonProps), hintProps), {}, {
|
|
102
|
+
"ignorePortalsStacking": true
|
|
103
|
+
}), _ref2))), children);
|
|
104
|
+
}
|
|
105
|
+
}, {
|
|
106
|
+
key: "render",
|
|
107
|
+
value: function render() {
|
|
108
|
+
var _ref8,
|
|
109
|
+
_ref9,
|
|
110
|
+
_this3 = this;
|
|
111
|
+
var _this$asProps3 = this.asProps,
|
|
112
|
+
styles = _this$asProps3.styles,
|
|
113
|
+
use = _this$asProps3.use,
|
|
114
|
+
_this$asProps3$theme = _this$asProps3.theme,
|
|
115
|
+
theme = _this$asProps3$theme === void 0 ? typeof use === 'string' && MAP_USE_DEFAULT_THEME[use] : _this$asProps3$theme,
|
|
116
|
+
loading = _this$asProps3.loading,
|
|
117
|
+
_this$asProps3$disabl = _this$asProps3.disabled,
|
|
118
|
+
disabled = _this$asProps3$disabl === void 0 ? loading : _this$asProps3$disabl,
|
|
119
|
+
size = _this$asProps3.size,
|
|
120
|
+
neighborLocation = _this$asProps3.neighborLocation,
|
|
121
|
+
hasChildren = _this$asProps3.children,
|
|
122
|
+
title = _this$asProps3.title,
|
|
123
|
+
ariaLabel = _this$asProps3['aria-label'],
|
|
124
|
+
Children = _this$asProps3.Children,
|
|
125
|
+
AddonLeft = _this$asProps3.addonLeft,
|
|
126
|
+
AddonRight = _this$asProps3.addonRight,
|
|
127
|
+
hintPlacement = _this$asProps3.hintPlacement;
|
|
128
|
+
// @ts-ignore
|
|
129
|
+
var Button = this[CORE_INSTANCE];
|
|
130
|
+
var useTheme = use && theme ? "".concat(use, "-").concat(theme) : false;
|
|
131
|
+
var SInner = Box;
|
|
132
|
+
var SSpin = Box;
|
|
133
|
+
var buttonAriaLabel = (_ref8 = (_ref9 = title !== null && title !== void 0 ? title : ariaLabel) !== null && _ref9 !== void 0 ? _ref9 : this.state.ariaLabelledByContent) !== null && _ref8 !== void 0 ? _ref8 : '';
|
|
134
|
+
var buttonProps = {
|
|
135
|
+
'type': 'button',
|
|
136
|
+
'tag': 'button',
|
|
137
|
+
disabled: disabled,
|
|
138
|
+
'use:theme': useTheme,
|
|
139
|
+
'ref': this.containerRef,
|
|
140
|
+
'text-color': this.getTextColor(),
|
|
141
|
+
'aria-busy': loading,
|
|
142
|
+
'__excludeProps': ['title'],
|
|
143
|
+
'tabIndex': 0
|
|
144
|
+
};
|
|
145
|
+
var hintProps = {
|
|
146
|
+
title: buttonAriaLabel,
|
|
147
|
+
timeout: [250, 50],
|
|
148
|
+
placement: hintPlacement,
|
|
149
|
+
theme: theme === 'invert' ? 'invert' : undefined,
|
|
150
|
+
__excludeProps: []
|
|
151
|
+
};
|
|
152
|
+
return /*#__PURE__*/React.createElement(NeighborLocation.Detect, {
|
|
153
|
+
neighborLocation: neighborLocation
|
|
154
|
+
}, function (neighborLocation) {
|
|
155
|
+
var _ref5;
|
|
156
|
+
var children = (_ref5 = sstyled(styles), /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SInner, _ref5.cn("SInner", {
|
|
157
|
+
"tag": 'span',
|
|
158
|
+
"loading": loading,
|
|
159
|
+
"data-ui-name": "".concat(_this3.asProps['data-ui-name'], ".InnerWrapper")
|
|
160
|
+
}), AddonLeft ? /*#__PURE__*/React.createElement(Button.Addon, null, /*#__PURE__*/React.createElement(AddonLeft, _ref5.cn("AddonLeft", {}))) : null, addonTextChildren(Children, Button.Text, Button.Addon), AddonRight ? /*#__PURE__*/React.createElement(Button.Addon, null, /*#__PURE__*/React.createElement(AddonRight, _ref5.cn("AddonRight", {}))) : null), loading && /*#__PURE__*/React.createElement(SSpin, _ref5.cn("SSpin", {
|
|
161
|
+
"tag": 'span'
|
|
162
|
+
}), /*#__PURE__*/React.createElement(SpinButton, _ref5.cn("SpinButton", {
|
|
163
|
+
"centered": true,
|
|
164
|
+
"size": size,
|
|
165
|
+
"theme": useTheme
|
|
166
|
+
})))));
|
|
167
|
+
buttonProps.neighborLocation = neighborLocation;
|
|
168
|
+
if (hasChildren === undefined || title) {
|
|
169
|
+
return _this3.renderButtonWithHint({
|
|
170
|
+
buttonProps: buttonProps,
|
|
171
|
+
hintProps: hintProps,
|
|
172
|
+
children: children
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
return _this3.renderButton({
|
|
176
|
+
buttonProps: buttonProps,
|
|
177
|
+
children: children
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}]);
|
|
182
|
+
}(Component);
|
|
183
|
+
_defineProperty(AbstractButton, "displayName", 'AbstractButton');
|
|
184
|
+
//# sourceMappingURL=AbstractButton.js.map
|