@semcore/accordion 17.0.0 → 17.0.2-prerelease.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/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
+ ## [17.0.2] - 2026-04-29
6
+
7
+ ### Fixed
8
+
9
+ - Deprecated atomic types. Atomic parts are part of `NSAccordion`
10
+ namespace.
11
+
12
+ ## [17.0.1] - 2026-04-16
13
+
14
+ ### Fixed
15
+
16
+ - Build processing to correct extract styles.
17
+
5
18
  ## [17.0.0] - 2026-04-15
6
19
 
7
20
  ### BREAK
@@ -15,15 +15,15 @@ var _m = _interopRequireDefault(require("@semcore/icon/ChevronRight/m"));
15
15
  var _typography = require("@semcore/typography");
16
16
  var _react = _interopRequireDefault(require("react"));
17
17
  /*!__reshadow-styles__:"./style/accordion.shadow.css"*/
18
- const style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".___SItemToggle_1vyp0_gg_{display:flex;align-items:center;position:relative;cursor:pointer;outline:0}.___SItemToggle_1vyp0_gg_.__use_1vyp0_gg_.__use_1vyp0_gg_{color:var(--intergalactic-text-primary, #191b23);font-weight:var(--intergalactic-regular, 400)}.___SItemToggle_1vyp0_gg_.__use_1vyp0_gg_._use_primary_1vyp0_gg_{background-color:var(--intergalactic-bg-secondary-neutral, #f4f5f9);padding:var(--intergalactic-spacing-2x, 8px) var(--intergalactic-spacing-3x, 12px);margin-bottom:var(--intergalactic-spacing-05x, 2px)}@media (hover:hover){.___SItemToggle_1vyp0_gg_.__use_1vyp0_gg_._use_primary_1vyp0_gg_:hover{background-color:var(--intergalactic-bg-secondary-neutral-hover, #e0e1e9)}}.___SItemToggle_1vyp0_gg_.__disabled_1vyp0_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default}.___SItemChevron_1vyp0_gg_{margin-right:var(--intergalactic-spacing-2x, 8px);transform:rotate(0deg);transition:transform calc(var(--intergalactic-duration-accordion, 200)*1ms) ease-out;fill:var(--intergalactic-icon-primary-neutral, #6c6e79)}.___SItemChevron_1vyp0_gg_.__selected_1vyp0_gg_{transform:rotate(90deg)}@media (prefers-reduced-motion){.___SItemChevron_1vyp0_gg_{transition:none}}", /*__inner_css_end__*/"1vyp0_gg_"),
18
+ const style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".___SItemToggle_1q20s_gg_{display:flex;align-items:center;position:relative;cursor:pointer;outline:0}.___SItemToggle_1q20s_gg_.__use_1q20s_gg_.__use_1q20s_gg_{color:var(--intergalactic-text-primary, #191b23);font-weight:var(--intergalactic-regular, 400)}.___SItemToggle_1q20s_gg_.__use_1q20s_gg_._use_primary_1q20s_gg_{background-color:var(--intergalactic-bg-secondary-neutral, #f4f5f9);padding:var(--intergalactic-spacing-2x, 8px) var(--intergalactic-spacing-3x, 12px);margin-bottom:var(--intergalactic-spacing-05x, 2px)}@media (hover:hover){.___SItemToggle_1q20s_gg_.__use_1q20s_gg_._use_primary_1q20s_gg_:hover{background-color:var(--intergalactic-bg-secondary-neutral-hover, #e0e1e9)}}.___SItemToggle_1q20s_gg_.__disabled_1q20s_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default}.___SItemChevron_1q20s_gg_{margin-right:var(--intergalactic-spacing-2x, 8px);transform:rotate(0deg);transition:transform calc(var(--intergalactic-duration-accordion, 200)*1ms) ease-out;fill:var(--intergalactic-icon-primary-neutral, #6c6e79)}.___SItemChevron_1q20s_gg_.__selected_1q20s_gg_{transform:rotate(90deg)}@media (prefers-reduced-motion){.___SItemChevron_1q20s_gg_{transition:none}}", /*__inner_css_end__*/"1q20s_gg_"),
19
19
  /*__reshadow_css_end__*/
20
20
  {
21
- "__SItemToggle": "___SItemToggle_1vyp0_gg_",
22
- "_use": "__use_1vyp0_gg_",
23
- "_use_primary": "_use_primary_1vyp0_gg_",
24
- "_disabled": "__disabled_1vyp0_gg_",
25
- "__SItemChevron": "___SItemChevron_1vyp0_gg_",
26
- "_selected": "__selected_1vyp0_gg_"
21
+ "__SItemToggle": "___SItemToggle_1q20s_gg_",
22
+ "_use": "__use_1q20s_gg_",
23
+ "_use_primary": "_use_primary_1q20s_gg_",
24
+ "_disabled": "__disabled_1q20s_gg_",
25
+ "__SItemChevron": "___SItemChevron_1q20s_gg_",
26
+ "_selected": "__selected_1q20s_gg_"
27
27
  });
28
28
  class RootAccordion extends _core.Component {
29
29
  constructor(...args) {
@@ -1 +1 @@
1
- {"version":3,"file":"Accordion.js","names":["_core","require","_baseComponents","_uniqueID","_interopRequireDefault","_useCssVariable","_l","_m","_typography","_react","style","sstyled","insert","RootAccordion","Component","constructor","args","_defineProperty2","default","newValue","value","asProps","Array","isArray","indexOfNewValue","indexOf","result","push","splice","handlers","uncontrolledProps","getItemProps","selectedValue","duration","use","selected","includes","$handleInteraction","handleToggleInteraction","render","Children","createElement","defaultValue","cssVariableEnhance","variable","fallback","map","Number","parseInt","prop","RootItem","getToggleProps","uid","disabled","onClick","undefined","handleClick","id","tag","size","tabIndex","getToggleButtonProps","getCollapseProps","getChevronProps","exports","uniqueIDEnhancement","Toggle","React","createRef","event","key","toggleRef","current","target","currentTarget","click","preventDefault","_ref","_ref5","styles","SItemToggle","Text","cn","assignProps","handleKeyDown","Chevron","props","_ref2","arguments[0]","_ref6","SItemChevron","ChevronRightL","ChevronRightM","ToggleButton","_ref3","_ref7","Flex","Collapse","_ref4","visible","CollapseAnimate","Item","createComponent","Accordion","wrapAccordion","wrapper","_default"],"sources":["../../src/Accordion.tsx"],"sourcesContent":["import { Collapse as CollapseAnimate, Flex } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport { createComponent, Component, sstyled, Root } from '@semcore/core';\nimport uniqueIDEnhancement from '@semcore/core/lib/utils/uniqueID';\nimport { cssVariableEnhance } from '@semcore/core/lib/utils/useCssVariable';\nimport ChevronRightL from '@semcore/icon/ChevronRight/l';\nimport ChevronRightM from '@semcore/icon/ChevronRight/m';\nimport { Text } from '@semcore/typography';\nimport React from 'react';\n\nimport type {\n AccordionComponent,\n AccordionHandlers,\n AccordionItemChevronComponent,\n AccordionItemCollapseComponent,\n AccordionItemComponent,\n AccordionItemProps,\n AccordionItemToggleButtonComponent,\n AccordionItemToggleComponent,\n IntergalacticAccordionComponent,\n} from './Accordion.type';\nimport style from './style/accordion.shadow.css';\n\nclass RootAccordion extends Component<\n Intergalactic.InternalTypings.InferComponentProps<IntergalacticAccordionComponent>,\n typeof RootAccordion.enhance,\n AccordionHandlers\n> {\n static displayName = 'Accordion';\n static style = style;\n static defaultProps = {\n defaultValue: [],\n use: 'secondary',\n };\n\n static enhance = [\n cssVariableEnhance({\n variable: '--intergalactic-duration-accordion',\n fallback: '200',\n map: (value: string) => `${Number.parseInt(value)}`,\n prop: 'duration',\n }),\n ] as const;\n\n uncontrolledProps() {\n return {\n value: null,\n };\n }\n\n handleToggleInteraction = (newValue: AccordionItemProps['value']) => {\n const { value } = this.asProps;\n\n if (Array.isArray(value)) {\n const indexOfNewValue = value.indexOf(newValue);\n const result = [...value];\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n indexOfNewValue === -1 ? result.push(newValue) : result.splice(indexOfNewValue, 1);\n this.handlers.value(result);\n } else {\n this.handlers.value(value === newValue ? null : newValue);\n }\n };\n\n getItemProps({ value }: AccordionItemProps) {\n const { value: selectedValue, duration, use } = this.asProps;\n const selected = Array.isArray(selectedValue)\n ? selectedValue.includes(value)\n : selectedValue === value;\n\n return {\n selected,\n duration,\n use,\n $handleInteraction: this.handleToggleInteraction,\n };\n }\n\n render() {\n const { Children } = this.asProps;\n return <Children />;\n }\n}\nexport class RootItem extends Component<\n Intergalactic.InternalTypings.InferChildComponentProps<AccordionItemComponent, typeof RootAccordion, 'Item'>,\n typeof RootItem.enhance\n> {\n static displayName = 'Item';\n static style = style;\n static enhance = [uniqueIDEnhancement()] as const;\n\n handleClick = () => {\n const { value, $handleInteraction } = this.asProps;\n\n $handleInteraction(value);\n };\n\n getToggleProps() {\n const { value, uid, disabled, use } = this.asProps;\n return {\n use,\n disabled,\n onClick: disabled ? undefined : this.handleClick,\n id: `igc-${uid}-${value}-toggle`,\n tag: 'h3',\n size: 300,\n tabIndex: disabled ? -1 : 0,\n };\n }\n\n getToggleButtonProps() {\n const { value, uid, selected, disabled } = this.asProps;\n return {\n disabled,\n 'id': `igc-${uid}-${value}-toggle-button`,\n 'aria-expanded': selected ? 'true' : 'false',\n 'aria-controls': selected ? `igc-${uid}-${value}-collapse` : undefined,\n };\n }\n\n getCollapseProps() {\n const { selected, uid, duration, value } = this.asProps;\n return {\n selected,\n duration,\n 'id': `igc-${uid}-${value}-collapse`,\n 'role': 'region',\n 'aria-labelledby': `igc-${uid}-${value}-toggle-button`,\n };\n }\n\n getChevronProps() {\n const { selected, size } = this.asProps;\n return {\n selected,\n size,\n };\n }\n\n render() {\n const { Children } = this.asProps;\n return <Children />;\n }\n}\n\nclass Toggle extends Component<\n Intergalactic.InternalTypings.InferChildComponentProps<AccordionItemToggleComponent, typeof RootItem, 'Toggle'>\n> {\n toggleRef = React.createRef();\n\n handleKeyDown = (event: React.KeyboardEvent<HTMLSpanElement>) => {\n if (event.key === 'Enter') {\n if (this.toggleRef.current === event.target) {\n event.currentTarget.click();\n }\n } else if (event.key === ' ') {\n event.preventDefault();\n if (this.toggleRef.current === event.target) {\n event.currentTarget.click();\n }\n }\n };\n\n render() {\n const { styles, use } = this.asProps;\n const SItemToggle = Root;\n\n return sstyled(styles)(\n <SItemToggle use={use} ref={this.toggleRef} render={Text} innerOutline onKeyDown={this.handleKeyDown} />,\n );\n }\n}\n\nfunction Chevron(\n props: Intergalactic.InternalTypings.InferChildComponentProps<\n AccordionItemChevronComponent,\n typeof RootItem,\n 'Chevron'\n >,\n) {\n const { styles, size } = props;\n\n const SItemChevron = Root;\n return sstyled(styles)(<SItemChevron render={size === 'l' ? ChevronRightL : ChevronRightM} />);\n}\n\nfunction ToggleButton(\n props: Intergalactic.InternalTypings.InferChildComponentProps<\n AccordionItemToggleButtonComponent,\n typeof RootItem,\n 'ToggleButton'\n >,\n) {\n const { styles } = props;\n\n return sstyled(styles)(\n <Root render={Flex} alignItems='center' role='button' />,\n );\n}\n\nfunction Collapse(\n props: Intergalactic.InternalTypings.InferChildComponentProps<\n AccordionItemCollapseComponent,\n typeof RootItem,\n 'Collapse'\n >,\n) {\n const { selected } = props;\n const visible = selected;\n\n return (\n <Root\n render={CollapseAnimate}\n visible={visible}\n interactive\n inert={!visible ? '' : undefined}\n aria-hidden={!visible}\n />\n );\n}\n\nconst Item = createComponent(RootItem, {\n Toggle,\n Chevron,\n ToggleButton,\n Collapse,\n}) as AccordionItemComponent;\n\nconst Accordion = createComponent(RootAccordion, {\n Item,\n}) as unknown as AccordionComponent;\n\nexport const wrapAccordion = <PropsExtending extends {}>(\n wrapper: (\n props: Intergalactic.InternalTypings.UntypeRefAndTag<\n Intergalactic.InternalTypings.ComponentPropsNesting<IntergalacticAccordionComponent>\n > &\n PropsExtending,\n ) => React.ReactNode,\n) => wrapper as IntergalacticAccordionComponent<PropsExtending>;\n\nexport default Accordion;\n"],"mappings":";;;;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAFA,IAAAC,eAAA,GAAAD,OAAA;AAGA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,EAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,EAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAL,sBAAA,CAAAH,OAAA;AAA0B;AAAA,MAAAS,KAAA,8BAAAV,KAAA,CAAAW,OAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAe1B,MAAMC,aA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,SAAS,GAAG,IAAAD,qBAAe,EAACzF,aAAa,EAAE;EAC/CwF;AACF,CAAC,CAAkC;AAE5B,MAAMG,aAAa,GACxBC,OAKoB,IACjBA,OAA0D;AAACzC,OAAA,CAAAwC,aAAA,GAAAA,aAAA;AAAA,IAAAE,QAAA,GAAA1C,OAAA,CAAA9C,OAAA,GAEjDqF,SAAS","ignoreList":[]}
1
+ {"version":3,"file":"Accordion.js","names":["_core","require","_baseComponents","_uniqueID","_interopRequireDefault","_useCssVariable","_l","_m","_typography","_react","style","sstyled","insert","RootAccordion","Component","constructor","args","_defineProperty2","default","newValue","value","asProps","Array","isArray","indexOfNewValue","indexOf","result","push","splice","handlers","uncontrolledProps","getItemProps","selectedValue","duration","use","selected","includes","$handleInteraction","handleToggleInteraction","render","Children","createElement","defaultValue","cssVariableEnhance","variable","fallback","map","Number","parseInt","prop","RootItem","getToggleProps","uid","disabled","onClick","undefined","handleClick","id","tag","size","tabIndex","getToggleButtonProps","getCollapseProps","getChevronProps","exports","uniqueIDEnhancement","Toggle","React","createRef","event","key","toggleRef","current","target","currentTarget","click","preventDefault","_ref","_ref5","styles","SItemToggle","Text","cn","assignProps","handleKeyDown","Chevron","props","_ref2","arguments[0]","_ref6","SItemChevron","ChevronRightL","ChevronRightM","ToggleButton","_ref3","_ref7","Flex","Collapse","_ref4","visible","CollapseAnimate","Item","createComponent","Accordion","wrapAccordion","wrapper","_default"],"sources":["../../src/Accordion.tsx"],"sourcesContent":["import { Collapse as CollapseAnimate, Flex } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport { createComponent, Component, sstyled, Root } from '@semcore/core';\nimport uniqueIDEnhancement from '@semcore/core/lib/utils/uniqueID';\nimport { cssVariableEnhance } from '@semcore/core/lib/utils/useCssVariable';\nimport ChevronRightL from '@semcore/icon/ChevronRight/l';\nimport ChevronRightM from '@semcore/icon/ChevronRight/m';\nimport { Text } from '@semcore/typography';\nimport React from 'react';\n\nimport type { NSAccordion } from './Accordion.type';\nimport style from './style/accordion.shadow.css';\n\nclass RootAccordion extends Component<\n Intergalactic.InternalTypings.InferComponentProps<NSAccordion.Component>,\n typeof RootAccordion.enhance,\n NSAccordion.Handlers\n> {\n static displayName = 'Accordion';\n static style = style;\n static defaultProps = {\n defaultValue: [],\n use: 'secondary',\n };\n\n static enhance = [\n cssVariableEnhance({\n variable: '--intergalactic-duration-accordion',\n fallback: '200',\n map: (value: string) => `${Number.parseInt(value)}`,\n prop: 'duration',\n }),\n ] as const;\n\n uncontrolledProps() {\n return {\n value: null,\n };\n }\n\n handleToggleInteraction = (newValue: NSAccordion.Item.Props['value']) => {\n const { value } = this.asProps;\n\n if (Array.isArray(value)) {\n const indexOfNewValue = value.indexOf(newValue);\n const result = [...value];\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n indexOfNewValue === -1 ? result.push(newValue) : result.splice(indexOfNewValue, 1);\n this.handlers.value(result);\n } else {\n this.handlers.value(value === newValue ? null : newValue);\n }\n };\n\n getItemProps({ value }: NSAccordion.Item.Props) {\n const { value: selectedValue, duration, use } = this.asProps;\n const selected = Array.isArray(selectedValue)\n ? selectedValue.includes(value)\n : selectedValue === value;\n\n return {\n selected,\n duration,\n use,\n $handleInteraction: this.handleToggleInteraction,\n };\n }\n\n render() {\n const { Children } = this.asProps;\n return <Children />;\n }\n}\nexport class RootItem extends Component<\n Intergalactic.InternalTypings.InferChildComponentProps<NSAccordion.Item.Component, typeof RootAccordion, 'Item'>,\n typeof RootItem.enhance\n> {\n static displayName = 'Item';\n static style = style;\n static enhance = [uniqueIDEnhancement()] as const;\n\n handleClick = () => {\n const { value, $handleInteraction } = this.asProps;\n\n $handleInteraction(value);\n };\n\n getToggleProps() {\n const { value, uid, disabled, use } = this.asProps;\n return {\n use,\n disabled,\n onClick: disabled ? undefined : this.handleClick,\n id: `igc-${uid}-${value}-toggle`,\n tag: 'h3',\n size: 300,\n tabIndex: disabled ? -1 : 0,\n };\n }\n\n getToggleButtonProps() {\n const { value, uid, selected, disabled } = this.asProps;\n return {\n disabled,\n 'id': `igc-${uid}-${value}-toggle-button`,\n 'aria-expanded': selected ? 'true' : 'false',\n 'aria-controls': selected ? `igc-${uid}-${value}-collapse` : undefined,\n };\n }\n\n getCollapseProps() {\n const { selected, uid, duration, value } = this.asProps;\n return {\n selected,\n duration,\n 'id': `igc-${uid}-${value}-collapse`,\n 'role': 'region',\n 'aria-labelledby': `igc-${uid}-${value}-toggle-button`,\n };\n }\n\n getChevronProps() {\n const { selected, size } = this.asProps;\n return {\n selected,\n size,\n };\n }\n\n render() {\n const { Children } = this.asProps;\n return <Children />;\n }\n}\n\nclass Toggle extends Component<\n Intergalactic.InternalTypings.InferChildComponentProps<NSAccordion.Item.Toggle.Component, typeof RootItem, 'Toggle'>\n> {\n toggleRef = React.createRef();\n\n handleKeyDown = (event: React.KeyboardEvent<HTMLSpanElement>) => {\n if (event.key === 'Enter') {\n if (this.toggleRef.current === event.target) {\n event.currentTarget.click();\n }\n } else if (event.key === ' ') {\n event.preventDefault();\n if (this.toggleRef.current === event.target) {\n event.currentTarget.click();\n }\n }\n };\n\n render() {\n const { styles, use } = this.asProps;\n const SItemToggle = Root;\n\n return sstyled(styles)(\n <SItemToggle use={use} ref={this.toggleRef} render={Text} innerOutline onKeyDown={this.handleKeyDown} />,\n );\n }\n}\n\nfunction Chevron(\n props: Intergalactic.InternalTypings.InferChildComponentProps<\n NSAccordion.Item.Chevron.Component,\n typeof RootItem,\n 'Chevron'\n >,\n) {\n const { styles, size } = props;\n\n const SItemChevron = Root;\n return sstyled(styles)(<SItemChevron render={size === 'l' ? ChevronRightL : ChevronRightM} />);\n}\n\nfunction ToggleButton(\n props: Intergalactic.InternalTypings.InferChildComponentProps<\n NSAccordion.Item.ToggleButton.Component,\n typeof RootItem,\n 'ToggleButton'\n >,\n) {\n const { styles } = props;\n\n return sstyled(styles)(\n <Root render={Flex} alignItems='center' role='button' />,\n );\n}\n\nfunction Collapse(\n props: Intergalactic.InternalTypings.InferChildComponentProps<\n NSAccordion.Item.Collapse.Component,\n typeof RootItem,\n 'Collapse'\n >,\n) {\n const { selected } = props;\n const visible = selected;\n\n return (\n <Root\n render={CollapseAnimate}\n visible={visible}\n interactive\n inert={!visible ? '' : undefined}\n aria-hidden={!visible}\n />\n );\n}\n\nconst Item = createComponent(RootItem, {\n Toggle,\n Chevron,\n ToggleButton,\n Collapse,\n}) as NSAccordion.Item.Component;\n\nconst Accordion = createComponent(RootAccordion, {\n Item,\n}) as unknown as NSAccordion.Component;\n\nexport const wrapAccordion = <PropsExtending extends {}>(\n wrapper: (\n props: Intergalactic.InternalTypings.UntypeRefAndTag<\n Intergalactic.InternalTypings.ComponentPropsNesting<NSAccordion.WrapComponent>\n > &\n PropsExtending,\n ) => React.ReactNode,\n) => wrapper as NSAccordion.WrapComponent<PropsExtending>;\n\nexport default Accordion;\n"],"mappings":";;;;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAFA,IAAAC,eAAA,GAAAD,OAAA;AAGA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,EAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,EAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAL,sBAAA,CAAAH,OAAA;AAA0B;AAAA,MAAAS,KAAA,8BAAAV,KAAA,CAAAW,OAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAK1B,MAAMC,aAAa,SAASC,eAAS,CAInC;EAAAC,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA,mCAuB2BC,QAAyC,IAAK;MACvE,MAAM;QAAEC;MAAM,CAAC,GAAG,IAAI,CAACC,OAAO;MAE9B,IAAIC,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,EAAE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[]}
@@ -1 +1 @@
1
- {"version":3,"file":"Accordion.type.js","names":[],"sources":["../../src/Accordion.type.ts"],"sourcesContent":["import type { BoxProps, FlexProps, Flex } from '@semcore/base-components';\nimport type { PropGetterFn, Intergalactic } from '@semcore/core';\nimport type { Text } from '@semcore/typography';\nimport type { Property } from 'csstype';\n\nexport type AccordionValue = null | number | string | Array<number | string | null>;\n\nexport type AccordionProps<T extends AccordionValue = AccordionValue> = FlexProps & {\n /** Value for the active tab. Can be set as stroke, number, null or as array.\n * @type AccordionValue\n * */\n value?: T;\n /**\n * Value of the active tabs selected by default\n * @type AccordionValue\n * @default []\n */\n defaultValue?: T;\n /** Called when the selection is changed\n * @type (value: AccordionValue, event?: React.SyntheticEvent) => void\n * */\n onChange?:\n | ((value: T, event?: React.SyntheticEvent) => void)\n | React.Dispatch<React.SetStateAction<T>>;\n /** Animation duration of each Accordion.Item inside\n * @default 350 */\n duration?: number;\n\n /**\n * Changes the visual appearance of the component\n * @default secondary\n */\n use?: 'primary' | 'secondary';\n};\n\nexport interface IAccordionProps<T extends AccordionValue = AccordionValue>\n extends AccordionProps<T> {}\n\nexport type AccordionContext = {\n getItemProps: PropGetterFn;\n};\n\nexport type AccordionHandlers = {\n value: AccordionProps['value'];\n};\n\nexport type AccordionItemProps = {\n /** Tab value */\n value: string | number;\n /** Disabling selection changes */\n disabled?: boolean;\n /** Animation duration\n * @default 350 */\n duration?: number;\n};\n\nexport type AccordionItemContext = {\n getToggleProps?: PropGetterFn;\n getCollapseProps?: PropGetterFn;\n getChevronProps?: PropGetterFn;\n selected?: boolean;\n};\n\nexport type AccordionItemToggleProps = BoxProps & {\n tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n};\nexport type ChevronItemProps = BoxProps & {\n /**\n * Chevron size\n * @default m\n */\n size?: 'm' | 'l';\n};\n\nexport type CollapseAnimationProps = {\n /** Animation titles */\n keyframes?: [string, string];\n /** Enables animation on first rendering\n * @default false\n */\n initialAnimation?: boolean;\n /**\n * @default ease-out\n */\n timingFunction?: Property.AnimationTimingFunction;\n /**\n * @default false\n */\n animationsDisabled?: boolean;\n};\n\nexport type AccordionCollapseProps = BoxProps & CollapseAnimationProps & {\n /** Animation duration in ms\n * @default 0\n */\n duration?: number | [number, number];\n /** If it set to `true`, animated node is persisted in dom even if `visible=false` */\n preserveNode?: boolean;\n /**\n * Add overflow=clip when passing animation\n * @default true\n * */\n overflowHidden?: boolean;\n /**\n * Value for height after animation\n * @default auto\n */\n defaultHeight?: 'auto' | '100%';\n};\n\nexport type IntergalacticAccordionComponent<PropsExtending = {}> = (<\n Value extends AccordionValue,\n Tag extends Intergalactic.Tag = 'div',\n>(\n props: Intergalactic.InternalTypings.ComponentProps<\n Tag,\n 'div',\n AccordionProps<Value>,\n AccordionContext & { value: Value },\n [handlers: AccordionHandlers]\n > &\n PropsExtending,\n) => Intergalactic.InternalTypings.ComponentRenderingResults) &\nIntergalactic.InternalTypings.ComponentAdditive<'div', 'div', AccordionProps>;\n\nexport type AccordionItemComponent = Intergalactic.Component<\n 'div',\n AccordionItemProps,\n AccordionItemContext\n>;\nexport type AccordionItemToggleComponent = Intergalactic.Component<typeof Text, AccordionItemToggleProps>;\nexport type AccordionItemToggleButtonComponent = Intergalactic.Component<typeof Flex, {}>;\nexport type AccordionItemChevronComponent = Intergalactic.Component<'div', ChevronItemProps>;\nexport type AccordionItemCollapseComponent = Intergalactic.Component<'div', AccordionCollapseProps>;\n\nexport type AccordionComponent = IntergalacticAccordionComponent & {\n Item: AccordionItemComponent & {\n Toggle: AccordionItemToggleComponent;\n ToggleButton: AccordionItemToggleButtonComponent;\n Chevron: AccordionItemChevronComponent;\n Collapse: AccordionItemCollapseComponent;\n };\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"Accordion.type.js","names":[],"sources":["../../src/Accordion.type.ts"],"sourcesContent":["import type { BoxProps, FlexProps, Flex } from '@semcore/base-components';\nimport type { PropGetterFn, Intergalactic } from '@semcore/core';\nimport type { Text } from '@semcore/typography';\nimport type { Property } from 'csstype';\n\ndeclare namespace NSAccordion {\n // TODO: It looks like the value isn't accurate. Revise and align it with the component's logic.\n type Value = null | number | string | Array<number | string | null>;\n type Props<V extends NSAccordion.Value = NSAccordion.Value> = FlexProps & {\n /** Value for the active tab. Can be set as stroke, number, null or as array.\n * @type AccordionValue\n * */\n value?: V;\n /**\n * Value of the active tabs selected by default\n * @type AccordionValue\n * @default []\n */\n defaultValue?: V;\n /** Called when the selection is changed\n * @type (value: AccordionValue, event?: React.SyntheticEvent) => void\n * */\n onChange?:\n | ((value: V, event?: React.SyntheticEvent) => void)\n | React.Dispatch<React.SetStateAction<V>>;\n /** Animation duration of each Accordion.Item inside\n * @default 350 */\n duration?: number;\n /**\n * Changes the visual appearance of the component\n * @default secondary\n */\n use?: 'primary' | 'secondary';\n };\n type Ctx = {\n getItemProps: PropGetterFn;\n };\n type Handlers = {\n value: Props['value'];\n };\n namespace Item {\n type Props = {\n /** Tab value */\n value: string | number;\n /** Disabling selection changes */\n disabled?: boolean;\n /** Animation duration\n * @default 350 */\n duration?: number;\n };\n type Ctx = {\n getToggleProps?: PropGetterFn;\n getCollapseProps?: PropGetterFn;\n getChevronProps?: PropGetterFn;\n selected?: boolean;\n };\n namespace Toggle {\n type Props = BoxProps & {\n tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n };\n type Component = Intergalactic.Component<typeof Text, Props>;\n }\n namespace ToggleButton {\n type Props = {};\n type Component = Intergalactic.Component<typeof Flex, Props>;\n }\n namespace Chevron {\n type Props = BoxProps & {\n /**\n * Chevron size\n * @default m\n */\n size?: 'm' | 'l';\n };\n\n type Component = Intergalactic.Component<'div', Props>;\n }\n\n namespace Collapse {\n type Props = BoxProps & {\n /** Animation titles */\n keyframes?: [string, string];\n /** Enables animation on first rendering\n * @default false\n */\n initialAnimation?: boolean;\n /**\n * @default ease-out\n */\n timingFunction?: Property.AnimationTimingFunction;\n /**\n * @default false\n */\n animationsDisabled?: boolean;\n /** Animation duration in ms\n * @default 0\n */\n duration?: number | [number, number];\n /** If it set to `true`, animated node is persisted in dom even if `visible=false` */\n preserveNode?: boolean;\n /**\n * Add overflow=clip when passing animation\n * @default true\n * */\n overflowHidden?: boolean;\n /**\n * Value for height after animation\n * @default auto\n */\n defaultHeight?: 'auto' | '100%';\n };\n type Component = Intergalactic.Component<'div', Props>;\n }\n\n type Component = Intergalactic.Component<'div', Props, Ctx> & {\n Toggle: Toggle.Component;\n ToggleButton: ToggleButton.Component;\n Chevron: Chevron.Component;\n Collapse: Collapse.Component;\n };\n }\n\n type WrapComponent<PropsExtending = {}> = (<\n V extends Value,\n Tag extends Intergalactic.Tag = 'div',\n >(\n props: Intergalactic.InternalTypings.ComponentProps<\n Tag,\n 'div',\n Props<V>,\n Ctx & { value: V },\n [handlers: Handlers]\n > & PropsExtending,\n ) => Intergalactic.InternalTypings.ComponentRenderingResults) &\n Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', Props>;\n\n type Component = WrapComponent & {\n Item: Item.Component;\n };\n}\n\n/** @deprecated It will be removed in v18. */\nexport type AccordionValue = NSAccordion.Value;\n/** @deprecated It will be removed in v18. */\nexport type AccordionProps<V extends AccordionValue = AccordionValue> = NSAccordion.Props<V>;\n/** @deprecated It will be removed in v18. */\nexport type AccordionContext = NSAccordion.Ctx;\n/** @deprecated It will be removed in v18. */\nexport type AccordionHandlers = NSAccordion.Handlers;\n/** @deprecated It will be removed in v18. */\nexport type AccordionItemProps = NSAccordion.Item.Props;\n/** @deprecated It will be removed in v18. */\nexport type AccordionItemContext = NSAccordion.Item.Ctx;\n/** @deprecated It will be removed in v18. */\nexport type AccordionItemToggleProps = NSAccordion.Item.Toggle.Props;\n/** @deprecated It will be removed in v18. */\nexport type ChevronItemProps = NSAccordion.Item.Chevron.Props;\n/** @deprecated It will be removed in v18. */\nexport type AccordionCollapseProps = NSAccordion.Item.Collapse.Props;\n\nexport type { NSAccordion };\n"],"mappings":"","ignoreList":[]}
@@ -13,15 +13,15 @@ import ChevronRightM from '@semcore/icon/ChevronRight/m';
13
13
  import { Text } from '@semcore/typography';
14
14
  import React from 'react';
15
15
  /*!__reshadow-styles__:"./style/accordion.shadow.css"*/
16
- const style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___SItemToggle_1vyp0_gg_{display:flex;align-items:center;position:relative;cursor:pointer;outline:0}.___SItemToggle_1vyp0_gg_.__use_1vyp0_gg_.__use_1vyp0_gg_{color:var(--intergalactic-text-primary, #191b23);font-weight:var(--intergalactic-regular, 400)}.___SItemToggle_1vyp0_gg_.__use_1vyp0_gg_._use_primary_1vyp0_gg_{background-color:var(--intergalactic-bg-secondary-neutral, #f4f5f9);padding:var(--intergalactic-spacing-2x, 8px) var(--intergalactic-spacing-3x, 12px);margin-bottom:var(--intergalactic-spacing-05x, 2px)}@media (hover:hover){.___SItemToggle_1vyp0_gg_.__use_1vyp0_gg_._use_primary_1vyp0_gg_:hover{background-color:var(--intergalactic-bg-secondary-neutral-hover, #e0e1e9)}}.___SItemToggle_1vyp0_gg_.__disabled_1vyp0_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default}.___SItemChevron_1vyp0_gg_{margin-right:var(--intergalactic-spacing-2x, 8px);transform:rotate(0deg);transition:transform calc(var(--intergalactic-duration-accordion, 200)*1ms) ease-out;fill:var(--intergalactic-icon-primary-neutral, #6c6e79)}.___SItemChevron_1vyp0_gg_.__selected_1vyp0_gg_{transform:rotate(90deg)}@media (prefers-reduced-motion){.___SItemChevron_1vyp0_gg_{transition:none}}", /*__inner_css_end__*/"1vyp0_gg_"),
16
+ const style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___SItemToggle_1q20s_gg_{display:flex;align-items:center;position:relative;cursor:pointer;outline:0}.___SItemToggle_1q20s_gg_.__use_1q20s_gg_.__use_1q20s_gg_{color:var(--intergalactic-text-primary, #191b23);font-weight:var(--intergalactic-regular, 400)}.___SItemToggle_1q20s_gg_.__use_1q20s_gg_._use_primary_1q20s_gg_{background-color:var(--intergalactic-bg-secondary-neutral, #f4f5f9);padding:var(--intergalactic-spacing-2x, 8px) var(--intergalactic-spacing-3x, 12px);margin-bottom:var(--intergalactic-spacing-05x, 2px)}@media (hover:hover){.___SItemToggle_1q20s_gg_.__use_1q20s_gg_._use_primary_1q20s_gg_:hover{background-color:var(--intergalactic-bg-secondary-neutral-hover, #e0e1e9)}}.___SItemToggle_1q20s_gg_.__disabled_1q20s_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default}.___SItemChevron_1q20s_gg_{margin-right:var(--intergalactic-spacing-2x, 8px);transform:rotate(0deg);transition:transform calc(var(--intergalactic-duration-accordion, 200)*1ms) ease-out;fill:var(--intergalactic-icon-primary-neutral, #6c6e79)}.___SItemChevron_1q20s_gg_.__selected_1q20s_gg_{transform:rotate(90deg)}@media (prefers-reduced-motion){.___SItemChevron_1q20s_gg_{transition:none}}", /*__inner_css_end__*/"1q20s_gg_"),
17
17
  /*__reshadow_css_end__*/
18
18
  {
19
- "__SItemToggle": "___SItemToggle_1vyp0_gg_",
20
- "_use": "__use_1vyp0_gg_",
21
- "_use_primary": "_use_primary_1vyp0_gg_",
22
- "_disabled": "__disabled_1vyp0_gg_",
23
- "__SItemChevron": "___SItemChevron_1vyp0_gg_",
24
- "_selected": "__selected_1vyp0_gg_"
19
+ "__SItemToggle": "___SItemToggle_1q20s_gg_",
20
+ "_use": "__use_1q20s_gg_",
21
+ "_use_primary": "_use_primary_1q20s_gg_",
22
+ "_disabled": "__disabled_1q20s_gg_",
23
+ "__SItemChevron": "___SItemChevron_1q20s_gg_",
24
+ "_selected": "__selected_1q20s_gg_"
25
25
  });
26
26
  class RootAccordion extends Component {
27
27
  constructor(...args) {
@@ -1 +1 @@
1
- {"version":3,"file":"Accordion.js","names":["Collapse","CollapseAnimate","Flex","createComponent","Component","sstyled","Root","uniqueIDEnhancement","cssVariableEnhance","ChevronRightL","ChevronRightM","Text","React","style","_sstyled","insert","RootAccordion","constructor","args","_defineProperty","newValue","value","asProps","Array","isArray","indexOfNewValue","indexOf","result","push","splice","handlers","uncontrolledProps","getItemProps","selectedValue","duration","use","selected","includes","$handleInteraction","handleToggleInteraction","render","Children","createElement","defaultValue","variable","fallback","map","Number","parseInt","prop","RootItem","getToggleProps","uid","disabled","onClick","undefined","handleClick","id","tag","size","tabIndex","getToggleButtonProps","getCollapseProps","getChevronProps","Toggle","createRef","event","key","toggleRef","current","target","currentTarget","click","preventDefault","_ref","_ref5","styles","SItemToggle","cn","_assignProps","handleKeyDown","Chevron","props","_ref2","arguments[0]","_ref6","SItemChevron","_assignProps2","ToggleButton","_ref3","_ref7","_assignProps3","_ref4","visible","_assignProps4","Item","Accordion","wrapAccordion","wrapper"],"sources":["../../src/Accordion.tsx"],"sourcesContent":["import { Collapse as CollapseAnimate, Flex } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport { createComponent, Component, sstyled, Root } from '@semcore/core';\nimport uniqueIDEnhancement from '@semcore/core/lib/utils/uniqueID';\nimport { cssVariableEnhance } from '@semcore/core/lib/utils/useCssVariable';\nimport ChevronRightL from '@semcore/icon/ChevronRight/l';\nimport ChevronRightM from '@semcore/icon/ChevronRight/m';\nimport { Text } from '@semcore/typography';\nimport React from 'react';\n\nimport type {\n AccordionComponent,\n AccordionHandlers,\n AccordionItemChevronComponent,\n AccordionItemCollapseComponent,\n AccordionItemComponent,\n AccordionItemProps,\n AccordionItemToggleButtonComponent,\n AccordionItemToggleComponent,\n IntergalacticAccordionComponent,\n} from './Accordion.type';\nimport style from './style/accordion.shadow.css';\n\nclass RootAccordion extends Component<\n Intergalactic.InternalTypings.InferComponentProps<IntergalacticAccordionComponent>,\n typeof RootAccordion.enhance,\n AccordionHandlers\n> {\n static displayName = 'Accordion';\n static style = style;\n static defaultProps = {\n defaultValue: [],\n use: 'secondary',\n };\n\n static enhance = [\n cssVariableEnhance({\n variable: '--intergalactic-duration-accordion',\n fallback: '200',\n map: (value: string) => `${Number.parseInt(value)}`,\n prop: 'duration',\n }),\n ] as const;\n\n uncontrolledProps() {\n return {\n value: null,\n };\n }\n\n handleToggleInteraction = (newValue: AccordionItemProps['value']) => {\n const { value } = this.asProps;\n\n if (Array.isArray(value)) {\n const indexOfNewValue = value.indexOf(newValue);\n const result = [...value];\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n indexOfNewValue === -1 ? result.push(newValue) : result.splice(indexOfNewValue, 1);\n this.handlers.value(result);\n } else {\n this.handlers.value(value === newValue ? null : newValue);\n }\n };\n\n getItemProps({ value }: AccordionItemProps) {\n const { value: selectedValue, duration, use } = this.asProps;\n const selected = Array.isArray(selectedValue)\n ? selectedValue.includes(value)\n : selectedValue === value;\n\n return {\n selected,\n duration,\n use,\n $handleInteraction: this.handleToggleInteraction,\n };\n }\n\n render() {\n const { Children } = this.asProps;\n return <Children />;\n }\n}\nexport class RootItem extends Component<\n Intergalactic.InternalTypings.InferChildComponentProps<AccordionItemComponent, typeof RootAccordion, 'Item'>,\n typeof RootItem.enhance\n> {\n static displayName = 'Item';\n static style = style;\n static enhance = [uniqueIDEnhancement()] as const;\n\n handleClick = () => {\n const { value, $handleInteraction } = this.asProps;\n\n $handleInteraction(value);\n };\n\n getToggleProps() {\n const { value, uid, disabled, use } = this.asProps;\n return {\n use,\n disabled,\n onClick: disabled ? undefined : this.handleClick,\n id: `igc-${uid}-${value}-toggle`,\n tag: 'h3',\n size: 300,\n tabIndex: disabled ? -1 : 0,\n };\n }\n\n getToggleButtonProps() {\n const { value, uid, selected, disabled } = this.asProps;\n return {\n disabled,\n 'id': `igc-${uid}-${value}-toggle-button`,\n 'aria-expanded': selected ? 'true' : 'false',\n 'aria-controls': selected ? `igc-${uid}-${value}-collapse` : undefined,\n };\n }\n\n getCollapseProps() {\n const { selected, uid, duration, value } = this.asProps;\n return {\n selected,\n duration,\n 'id': `igc-${uid}-${value}-collapse`,\n 'role': 'region',\n 'aria-labelledby': `igc-${uid}-${value}-toggle-button`,\n };\n }\n\n getChevronProps() {\n const { selected, size } = this.asProps;\n return {\n selected,\n size,\n };\n }\n\n render() {\n const { Children } = this.asProps;\n return <Children />;\n }\n}\n\nclass Toggle extends Component<\n Intergalactic.InternalTypings.InferChildComponentProps<AccordionItemToggleComponent, typeof RootItem, 'Toggle'>\n> {\n toggleRef = React.createRef();\n\n handleKeyDown = (event: React.KeyboardEvent<HTMLSpanElement>) => {\n if (event.key === 'Enter') {\n if (this.toggleRef.current === event.target) {\n event.currentTarget.click();\n }\n } else if (event.key === ' ') {\n event.preventDefault();\n if (this.toggleRef.current === event.target) {\n event.currentTarget.click();\n }\n }\n };\n\n render() {\n const { styles, use } = this.asProps;\n const SItemToggle = Root;\n\n return sstyled(styles)(\n <SItemToggle use={use} ref={this.toggleRef} render={Text} innerOutline onKeyDown={this.handleKeyDown} />,\n );\n }\n}\n\nfunction Chevron(\n props: Intergalactic.InternalTypings.InferChildComponentProps<\n AccordionItemChevronComponent,\n typeof RootItem,\n 'Chevron'\n >,\n) {\n const { styles, size } = props;\n\n const SItemChevron = Root;\n return sstyled(styles)(<SItemChevron render={size === 'l' ? ChevronRightL : ChevronRightM} />);\n}\n\nfunction ToggleButton(\n props: Intergalactic.InternalTypings.InferChildComponentProps<\n AccordionItemToggleButtonComponent,\n typeof RootItem,\n 'ToggleButton'\n >,\n) {\n const { styles } = props;\n\n return sstyled(styles)(\n <Root render={Flex} alignItems='center' role='button' />,\n );\n}\n\nfunction Collapse(\n props: Intergalactic.InternalTypings.InferChildComponentProps<\n AccordionItemCollapseComponent,\n typeof RootItem,\n 'Collapse'\n >,\n) {\n const { selected } = props;\n const visible = selected;\n\n return (\n <Root\n render={CollapseAnimate}\n visible={visible}\n interactive\n inert={!visible ? '' : undefined}\n aria-hidden={!visible}\n />\n );\n}\n\nconst Item = createComponent(RootItem, {\n Toggle,\n Chevron,\n ToggleButton,\n Collapse,\n}) as AccordionItemComponent;\n\nconst Accordion = createComponent(RootAccordion, {\n Item,\n}) as unknown as AccordionComponent;\n\nexport const wrapAccordion = <PropsExtending extends {}>(\n wrapper: (\n props: Intergalactic.InternalTypings.UntypeRefAndTag<\n Intergalactic.InternalTypings.ComponentPropsNesting<IntergalacticAccordionComponent>\n > &\n PropsExtending,\n ) => React.ReactNode,\n) => wrapper as IntergalacticAccordionComponent<PropsExtending>;\n\nexport default Accordion;\n"],"mappings":";;;;;;AAAA,SAASA,QAAQ,IAAIC,eAAe,EAAEC,IAAI,QAAQ,0BAA0B;AAE5E,SAASC,eAAe,EAAEC,SAAS,EAAEC,OAAO,EAAEC,IAAI,QAAQ,eAAe;AACzE,OAAOC,mBAAmB,MAAM,kCAAkC;AAClE,SAASC,kBAAkB,QAAQ,wCAAwC;AAC3E,OAAOC,aAAa,MAAM,8BAA8B;AACxD,OAAOC,aAAa,MAAM,8BAA8B;AACxD,SAASC,IAAI,QAAQ,qBAAqB;AAC1C,OAAOC,KAAK,MAAM,OAAO;AAAC;AAAA,MAAAC,KAAA,8BAAAC,QAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAe1B,MAAMC,aAAa,SAASZ,SAAS,CAInC;EAAAa,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,kCAuB2BC,QAAqC,IAAK;MACnE,MAAM;QAAEC;MAAM,CAAC,GAAG,IAAI,CAACC,OAAO;MAE9B,IAAIC,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,EAAE;QACxB,MAAMI,eAAe,GAAGJ,KAAK,CAACK,OAAO,CAACN,QAAQ,CAAC;QAC/C,MAAMO,MAAM,GAAG,CAAC,GAAGN,KAAK,CAAC;QACzB;QACAI,eAAe,KAAK,CAAC,CAAC,GAAGE,MAAM,CAACC,IAAI,CAACR,QAAQ,CAAC,GAAGO,MAAM,CAACE,MAAM,CAACJ,eAAe,EAAE,CAAC,CAAC;QAClF,IAAI,CAACK,QAAQ,CAACT,KAAK,CAACM,MAA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e,EAAA6F,aAAA;IAAA,WACdD,OAAO;IAAA;IAAA,SAET,CAACA,OAAO,GAAG,EAAE,GAAGtC,SAAS;IAAA,eACnB,CAACsC;EAAO,GAAAD,KAAA,CACtB,CAAC;AAEN;AAEA,MAAMG,IAAI,GAAG5F,eAAe,CAAC+C,QAAQ,EAAE;EACrCc,MAAM;EACNiB,OAAO;EACPO,YAAY;EACZxF;AACF,CAAC,CAA2B;AAE5B,MAAMgG,SAAS,GAAG7F,eAAe,CAACa,aAAa,EAAE;EAC/C+E;AACF,CAAC,CAAkC;AAEnC,OAAO,MAAME,aAAa,GACxBC,OAKoB,IACjBA,OAA0D;AAE/D,eAAeF,SAAS","ignoreList":[]}
1
+ {"version":3,"file":"Accordion.js","names":["Collapse","CollapseAnimate","Flex","createComponent","Component","sstyled","Root","uniqueIDEnhancement","cssVariableEnhance","ChevronRightL","ChevronRightM","Text","React","style","_sstyled","insert","RootAccordion","constructor","args","_defineProperty","newValue","value","asProps","Array","isArray","indexOfNewValue","indexOf","result","push","splice","handlers","uncontrolledProps","getItemProps","selectedValue","duration","use","selected","includes","$handleInteraction","handleToggleInteraction","render","Children","createElement","defaultValue","variable","fallback","map","Number","parseInt","prop","RootItem","getToggleProps","uid","disabled","onClick","undefined","handleClick","id","tag","size","tabIndex","getToggleButtonProps","getCollapseProps","getChevronProps","Toggle","createRef","event","key","toggleRef","current","target","currentTarget","click","preventDefault","_ref","_ref5","styles","SItemToggle","cn","_assignProps","handleKeyDown","Chevron","props","_ref2","arguments[0]","_ref6","SItemChevron","_assignProps2","ToggleButton","_ref3","_ref7","_assignProps3","_ref4","visible","_assignProps4","Item","Accordion","wrapAccordion","wrapper"],"sources":["../../src/Accordion.tsx"],"sourcesContent":["import { Collapse as CollapseAnimate, Flex } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport { createComponent, Component, sstyled, Root } from '@semcore/core';\nimport uniqueIDEnhancement from '@semcore/core/lib/utils/uniqueID';\nimport { cssVariableEnhance } from '@semcore/core/lib/utils/useCssVariable';\nimport ChevronRightL from '@semcore/icon/ChevronRight/l';\nimport ChevronRightM from '@semcore/icon/ChevronRight/m';\nimport { Text } from '@semcore/typography';\nimport React from 'react';\n\nimport type { NSAccordion } from './Accordion.type';\nimport style from './style/accordion.shadow.css';\n\nclass RootAccordion extends Component<\n Intergalactic.InternalTypings.InferComponentProps<NSAccordion.Component>,\n typeof RootAccordion.enhance,\n NSAccordion.Handlers\n> {\n static displayName = 'Accordion';\n static style = style;\n static defaultProps = {\n defaultValue: [],\n use: 'secondary',\n };\n\n static enhance = [\n cssVariableEnhance({\n variable: '--intergalactic-duration-accordion',\n fallback: '200',\n map: (value: string) => `${Number.parseInt(value)}`,\n prop: 'duration',\n }),\n ] as const;\n\n uncontrolledProps() {\n return {\n value: null,\n };\n }\n\n handleToggleInteraction = (newValue: NSAccordion.Item.Props['value']) => {\n const { value } = this.asProps;\n\n if (Array.isArray(value)) {\n const indexOfNewValue = value.indexOf(newValue);\n const result = [...value];\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n indexOfNewValue === -1 ? result.push(newValue) : result.splice(indexOfNewValue, 1);\n this.handlers.value(result);\n } else {\n this.handlers.value(value === newValue ? null : newValue);\n }\n };\n\n getItemProps({ value }: NSAccordion.Item.Props) {\n const { value: selectedValue, duration, use } = this.asProps;\n const selected = Array.isArray(selectedValue)\n ? selectedValue.includes(value)\n : selectedValue === value;\n\n return {\n selected,\n duration,\n use,\n $handleInteraction: this.handleToggleInteraction,\n };\n }\n\n render() {\n const { Children } = this.asProps;\n return <Children />;\n }\n}\nexport class RootItem extends Component<\n Intergalactic.InternalTypings.InferChildComponentProps<NSAccordion.Item.Component, typeof RootAccordion, 'Item'>,\n typeof RootItem.enhance\n> {\n static displayName = 'Item';\n static style = style;\n static enhance = [uniqueIDEnhancement()] as const;\n\n handleClick = () => {\n const { value, $handleInteraction } = this.asProps;\n\n $handleInteraction(value);\n };\n\n getToggleProps() {\n const { value, uid, disabled, use } = this.asProps;\n return {\n use,\n disabled,\n onClick: disabled ? undefined : this.handleClick,\n id: `igc-${uid}-${value}-toggle`,\n tag: 'h3',\n size: 300,\n tabIndex: disabled ? -1 : 0,\n };\n }\n\n getToggleButtonProps() {\n const { value, uid, selected, disabled } = this.asProps;\n return {\n disabled,\n 'id': `igc-${uid}-${value}-toggle-button`,\n 'aria-expanded': selected ? 'true' : 'false',\n 'aria-controls': selected ? `igc-${uid}-${value}-collapse` : undefined,\n };\n }\n\n getCollapseProps() {\n const { selected, uid, duration, value } = this.asProps;\n return {\n selected,\n duration,\n 'id': `igc-${uid}-${value}-collapse`,\n 'role': 'region',\n 'aria-labelledby': `igc-${uid}-${value}-toggle-button`,\n };\n }\n\n getChevronProps() {\n const { selected, size } = this.asProps;\n return {\n selected,\n size,\n };\n }\n\n render() {\n const { Children } = this.asProps;\n return <Children />;\n }\n}\n\nclass Toggle extends Component<\n Intergalactic.InternalTypings.InferChildComponentProps<NSAccordion.Item.Toggle.Component, typeof RootItem, 'Toggle'>\n> {\n toggleRef = React.createRef();\n\n handleKeyDown = (event: React.KeyboardEvent<HTMLSpanElement>) => {\n if (event.key === 'Enter') {\n if (this.toggleRef.current === event.target) {\n event.currentTarget.click();\n }\n } else if (event.key === ' ') {\n event.preventDefault();\n if (this.toggleRef.current === event.target) {\n event.currentTarget.click();\n }\n }\n };\n\n render() {\n const { styles, use } = this.asProps;\n const SItemToggle = Root;\n\n return sstyled(styles)(\n <SItemToggle use={use} ref={this.toggleRef} render={Text} innerOutline onKeyDown={this.handleKeyDown} />,\n );\n }\n}\n\nfunction Chevron(\n props: Intergalactic.InternalTypings.InferChildComponentProps<\n NSAccordion.Item.Chevron.Component,\n typeof RootItem,\n 'Chevron'\n >,\n) {\n const { styles, size } = props;\n\n const SItemChevron = Root;\n return sstyled(styles)(<SItemChevron render={size === 'l' ? ChevronRightL : ChevronRightM} />);\n}\n\nfunction ToggleButton(\n props: Intergalactic.InternalTypings.InferChildComponentProps<\n NSAccordion.Item.ToggleButton.Component,\n typeof RootItem,\n 'ToggleButton'\n >,\n) {\n const { styles } = props;\n\n return sstyled(styles)(\n <Root render={Flex} alignItems='center' role='button' />,\n );\n}\n\nfunction Collapse(\n props: Intergalactic.InternalTypings.InferChildComponentProps<\n NSAccordion.Item.Collapse.Component,\n typeof RootItem,\n 'Collapse'\n >,\n) {\n const { selected } = props;\n const visible = selected;\n\n return (\n <Root\n render={CollapseAnimate}\n visible={visible}\n interactive\n inert={!visible ? '' : undefined}\n aria-hidden={!visible}\n />\n );\n}\n\nconst Item = createComponent(RootItem, {\n Toggle,\n Chevron,\n ToggleButton,\n Collapse,\n}) as NSAccordion.Item.Component;\n\nconst Accordion = createComponent(RootAccordion, {\n Item,\n}) as unknown as NSAccordion.Component;\n\nexport const wrapAccordion = <PropsExtending extends {}>(\n wrapper: (\n props: Intergalactic.InternalTypings.UntypeRefAndTag<\n Intergalactic.InternalTypings.ComponentPropsNesting<NSAccordion.WrapComponent>\n > &\n PropsExtending,\n ) => React.ReactNode,\n) => wrapper as NSAccordion.WrapComponent<PropsExtending>;\n\nexport default Accordion;\n"],"mappings":";;;;;;AAAA,SAASA,QAAQ,IAAIC,eAAe,EAAEC,IAAI,QAAQ,0BAA0B;AAE5E,SAASC,eAAe,EAAEC,SAAS,EAAEC,OAAO,EAAEC,IAAI,QAAQ,eAAe;AACzE,OAAOC,mBAAmB,MAAM,kCAAkC;AAClE,SAASC,kBAAkB,QAAQ,wCAAwC;AAC3E,OAAOC,aAAa,MAAM,8BAA8B;AACxD,OAAOC,aAAa,MAAM,8BAA8B;AACxD,SAASC,IAAI,QAAQ,qBAAqB;AAC1C,OAAOC,KAAK,MAAM,OAAO;AAAC;AAAA,MAAAC,KAAA,8BAAAC,QAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAK1B,MAAMC,aAAa,SAASZ,SAAS,CAInC;EAAAa,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAA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A,GAAAL,YAAA;IAAAM,KAAA;EACA,MAAM;IAAEd;EAAO,CAAC,GAAGM,KAAK;EAExB,OAAAQ,KAAA,GAAOrF,OAAO,CAACuE,MAAM,CAAC,eACpBhE,KAAA,CAAA8B,aAAA,CAAcxC,IAAI,EAAAyF,aAAA;IAAA,cAAa,QAAQ;IAAA,QAAM;EAAQ,GAAAF,KAAA,CAAE,CAAC;AAE5D;AAEA,SAASzF,QAAQA,CACfkF,KAIC,EACD;EAAA,IAAAU,KAAA,GAAAR,YAAA;EACA,MAAM;IAAEhD;EAAS,CAAC,GAAG8C,KAAK;EAC1B,MAAMW,OAAO,GAAGzD,QAAQ;EAExB,oBACExB,KAAA,CAAA8B,aAAA,CACUzC,eAAe,EAAA6F,aAAA;IAAA,WACdD,OAAO;IAAA;IAAA,SAET,CAACA,OAAO,GAAG,EAAE,GAAGtC,SAAS;IAAA,eACnB,CAACsC;EAAO,GAAAD,KAAA,CACtB,CAAC;AAEN;AAEA,MAAMG,IAAI,GAAG5F,eAAe,CAAC+C,QAAQ,EAAE;EACrCc,MAAM;EACNiB,OAAO;EACPO,YAAY;EACZxF;AACF,CAAC,CAA+B;AAEhC,MAAMgG,SAAS,GAAG7F,eAAe,CAACa,aAAa,EAAE;EAC/C+E;AACF,CAAC,CAAqC;AAEtC,OAAO,MAAME,aAAa,GACxBC,OAKoB,IACjBA,OAAoD;AAEzD,eAAeF,SAAS","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"Accordion.type.js","names":[],"sources":["../../src/Accordion.type.ts"],"sourcesContent":["import type { BoxProps, FlexProps, Flex } from '@semcore/base-components';\nimport type { PropGetterFn, Intergalactic } from '@semcore/core';\nimport type { Text } from '@semcore/typography';\nimport type { Property } from 'csstype';\n\nexport type AccordionValue = null | number | string | Array<number | string | null>;\n\nexport type AccordionProps<T extends AccordionValue = AccordionValue> = FlexProps & {\n /** Value for the active tab. Can be set as stroke, number, null or as array.\n * @type AccordionValue\n * */\n value?: T;\n /**\n * Value of the active tabs selected by default\n * @type AccordionValue\n * @default []\n */\n defaultValue?: T;\n /** Called when the selection is changed\n * @type (value: AccordionValue, event?: React.SyntheticEvent) => void\n * */\n onChange?:\n | ((value: T, event?: React.SyntheticEvent) => void)\n | React.Dispatch<React.SetStateAction<T>>;\n /** Animation duration of each Accordion.Item inside\n * @default 350 */\n duration?: number;\n\n /**\n * Changes the visual appearance of the component\n * @default secondary\n */\n use?: 'primary' | 'secondary';\n};\n\nexport interface IAccordionProps<T extends AccordionValue = AccordionValue>\n extends AccordionProps<T> {}\n\nexport type AccordionContext = {\n getItemProps: PropGetterFn;\n};\n\nexport type AccordionHandlers = {\n value: AccordionProps['value'];\n};\n\nexport type AccordionItemProps = {\n /** Tab value */\n value: string | number;\n /** Disabling selection changes */\n disabled?: boolean;\n /** Animation duration\n * @default 350 */\n duration?: number;\n};\n\nexport type AccordionItemContext = {\n getToggleProps?: PropGetterFn;\n getCollapseProps?: PropGetterFn;\n getChevronProps?: PropGetterFn;\n selected?: boolean;\n};\n\nexport type AccordionItemToggleProps = BoxProps & {\n tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n};\nexport type ChevronItemProps = BoxProps & {\n /**\n * Chevron size\n * @default m\n */\n size?: 'm' | 'l';\n};\n\nexport type CollapseAnimationProps = {\n /** Animation titles */\n keyframes?: [string, string];\n /** Enables animation on first rendering\n * @default false\n */\n initialAnimation?: boolean;\n /**\n * @default ease-out\n */\n timingFunction?: Property.AnimationTimingFunction;\n /**\n * @default false\n */\n animationsDisabled?: boolean;\n};\n\nexport type AccordionCollapseProps = BoxProps & CollapseAnimationProps & {\n /** Animation duration in ms\n * @default 0\n */\n duration?: number | [number, number];\n /** If it set to `true`, animated node is persisted in dom even if `visible=false` */\n preserveNode?: boolean;\n /**\n * Add overflow=clip when passing animation\n * @default true\n * */\n overflowHidden?: boolean;\n /**\n * Value for height after animation\n * @default auto\n */\n defaultHeight?: 'auto' | '100%';\n};\n\nexport type IntergalacticAccordionComponent<PropsExtending = {}> = (<\n Value extends AccordionValue,\n Tag extends Intergalactic.Tag = 'div',\n>(\n props: Intergalactic.InternalTypings.ComponentProps<\n Tag,\n 'div',\n AccordionProps<Value>,\n AccordionContext & { value: Value },\n [handlers: AccordionHandlers]\n > &\n PropsExtending,\n) => Intergalactic.InternalTypings.ComponentRenderingResults) &\nIntergalactic.InternalTypings.ComponentAdditive<'div', 'div', AccordionProps>;\n\nexport type AccordionItemComponent = Intergalactic.Component<\n 'div',\n AccordionItemProps,\n AccordionItemContext\n>;\nexport type AccordionItemToggleComponent = Intergalactic.Component<typeof Text, AccordionItemToggleProps>;\nexport type AccordionItemToggleButtonComponent = Intergalactic.Component<typeof Flex, {}>;\nexport type AccordionItemChevronComponent = Intergalactic.Component<'div', ChevronItemProps>;\nexport type AccordionItemCollapseComponent = Intergalactic.Component<'div', AccordionCollapseProps>;\n\nexport type AccordionComponent = IntergalacticAccordionComponent & {\n Item: AccordionItemComponent & {\n Toggle: AccordionItemToggleComponent;\n ToggleButton: AccordionItemToggleButtonComponent;\n Chevron: AccordionItemChevronComponent;\n Collapse: AccordionItemCollapseComponent;\n };\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"Accordion.type.js","names":[],"sources":["../../src/Accordion.type.ts"],"sourcesContent":["import type { BoxProps, FlexProps, Flex } from '@semcore/base-components';\nimport type { PropGetterFn, Intergalactic } from '@semcore/core';\nimport type { Text } from '@semcore/typography';\nimport type { Property } from 'csstype';\n\ndeclare namespace NSAccordion {\n // TODO: It looks like the value isn't accurate. Revise and align it with the component's logic.\n type Value = null | number | string | Array<number | string | null>;\n type Props<V extends NSAccordion.Value = NSAccordion.Value> = FlexProps & {\n /** Value for the active tab. Can be set as stroke, number, null or as array.\n * @type AccordionValue\n * */\n value?: V;\n /**\n * Value of the active tabs selected by default\n * @type AccordionValue\n * @default []\n */\n defaultValue?: V;\n /** Called when the selection is changed\n * @type (value: AccordionValue, event?: React.SyntheticEvent) => void\n * */\n onChange?:\n | ((value: V, event?: React.SyntheticEvent) => void)\n | React.Dispatch<React.SetStateAction<V>>;\n /** Animation duration of each Accordion.Item inside\n * @default 350 */\n duration?: number;\n /**\n * Changes the visual appearance of the component\n * @default secondary\n */\n use?: 'primary' | 'secondary';\n };\n type Ctx = {\n getItemProps: PropGetterFn;\n };\n type Handlers = {\n value: Props['value'];\n };\n namespace Item {\n type Props = {\n /** Tab value */\n value: string | number;\n /** Disabling selection changes */\n disabled?: boolean;\n /** Animation duration\n * @default 350 */\n duration?: number;\n };\n type Ctx = {\n getToggleProps?: PropGetterFn;\n getCollapseProps?: PropGetterFn;\n getChevronProps?: PropGetterFn;\n selected?: boolean;\n };\n namespace Toggle {\n type Props = BoxProps & {\n tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n };\n type Component = Intergalactic.Component<typeof Text, Props>;\n }\n namespace ToggleButton {\n type Props = {};\n type Component = Intergalactic.Component<typeof Flex, Props>;\n }\n namespace Chevron {\n type Props = BoxProps & {\n /**\n * Chevron size\n * @default m\n */\n size?: 'm' | 'l';\n };\n\n type Component = Intergalactic.Component<'div', Props>;\n }\n\n namespace Collapse {\n type Props = BoxProps & {\n /** Animation titles */\n keyframes?: [string, string];\n /** Enables animation on first rendering\n * @default false\n */\n initialAnimation?: boolean;\n /**\n * @default ease-out\n */\n timingFunction?: Property.AnimationTimingFunction;\n /**\n * @default false\n */\n animationsDisabled?: boolean;\n /** Animation duration in ms\n * @default 0\n */\n duration?: number | [number, number];\n /** If it set to `true`, animated node is persisted in dom even if `visible=false` */\n preserveNode?: boolean;\n /**\n * Add overflow=clip when passing animation\n * @default true\n * */\n overflowHidden?: boolean;\n /**\n * Value for height after animation\n * @default auto\n */\n defaultHeight?: 'auto' | '100%';\n };\n type Component = Intergalactic.Component<'div', Props>;\n }\n\n type Component = Intergalactic.Component<'div', Props, Ctx> & {\n Toggle: Toggle.Component;\n ToggleButton: ToggleButton.Component;\n Chevron: Chevron.Component;\n Collapse: Collapse.Component;\n };\n }\n\n type WrapComponent<PropsExtending = {}> = (<\n V extends Value,\n Tag extends Intergalactic.Tag = 'div',\n >(\n props: Intergalactic.InternalTypings.ComponentProps<\n Tag,\n 'div',\n Props<V>,\n Ctx & { value: V },\n [handlers: Handlers]\n > & PropsExtending,\n ) => Intergalactic.InternalTypings.ComponentRenderingResults) &\n Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', Props>;\n\n type Component = WrapComponent & {\n Item: Item.Component;\n };\n}\n\n/** @deprecated It will be removed in v18. */\nexport type AccordionValue = NSAccordion.Value;\n/** @deprecated It will be removed in v18. */\nexport type AccordionProps<V extends AccordionValue = AccordionValue> = NSAccordion.Props<V>;\n/** @deprecated It will be removed in v18. */\nexport type AccordionContext = NSAccordion.Ctx;\n/** @deprecated It will be removed in v18. */\nexport type AccordionHandlers = NSAccordion.Handlers;\n/** @deprecated It will be removed in v18. */\nexport type AccordionItemProps = NSAccordion.Item.Props;\n/** @deprecated It will be removed in v18. */\nexport type AccordionItemContext = NSAccordion.Item.Ctx;\n/** @deprecated It will be removed in v18. */\nexport type AccordionItemToggleProps = NSAccordion.Item.Toggle.Props;\n/** @deprecated It will be removed in v18. */\nexport type ChevronItemProps = NSAccordion.Item.Chevron.Props;\n/** @deprecated It will be removed in v18. */\nexport type AccordionCollapseProps = NSAccordion.Item.Collapse.Props;\n\nexport type { NSAccordion };\n"],"mappings":"","ignoreList":[]}
@@ -7,21 +7,22 @@ import ChevronRightL from "@semcore/icon/ChevronRight/l";
7
7
  import ChevronRightM from "@semcore/icon/ChevronRight/m";
8
8
  import { Text } from "@semcore/typography";
9
9
  import React from "react";
10
+ /*!__reshadow-styles__:"./style/accordion.shadow.css"*/
10
11
  const style = (
11
12
  /*__reshadow_css_start__*/
12
13
  (sstyled.insert(
13
14
  /*__inner_css_start__*/
14
- ".___SItemToggle_1vyp0_gg_{display:flex;align-items:center;position:relative;cursor:pointer;outline:0}.___SItemToggle_1vyp0_gg_.__use_1vyp0_gg_.__use_1vyp0_gg_{color:var(--intergalactic-text-primary, #191b23);font-weight:var(--intergalactic-regular, 400)}.___SItemToggle_1vyp0_gg_.__use_1vyp0_gg_._use_primary_1vyp0_gg_{background-color:var(--intergalactic-bg-secondary-neutral, #f4f5f9);padding:var(--intergalactic-spacing-2x, 8px) var(--intergalactic-spacing-3x, 12px);margin-bottom:var(--intergalactic-spacing-05x, 2px)}@media (hover:hover){.___SItemToggle_1vyp0_gg_.__use_1vyp0_gg_._use_primary_1vyp0_gg_:hover{background-color:var(--intergalactic-bg-secondary-neutral-hover, #e0e1e9)}}.___SItemToggle_1vyp0_gg_.__disabled_1vyp0_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default}.___SItemChevron_1vyp0_gg_{margin-right:var(--intergalactic-spacing-2x, 8px);transform:rotate(0deg);transition:transform calc(var(--intergalactic-duration-accordion, 200)*1ms) ease-out;fill:var(--intergalactic-icon-primary-neutral, #6c6e79)}.___SItemChevron_1vyp0_gg_.__selected_1vyp0_gg_{transform:rotate(90deg)}@media (prefers-reduced-motion){.___SItemChevron_1vyp0_gg_{transition:none}}",
15
+ ".___SItemToggle_1q20s_gg_{display:flex;align-items:center;position:relative;cursor:pointer;outline:0}.___SItemToggle_1q20s_gg_.__use_1q20s_gg_.__use_1q20s_gg_{color:var(--intergalactic-text-primary, #191b23);font-weight:var(--intergalactic-regular, 400)}.___SItemToggle_1q20s_gg_.__use_1q20s_gg_._use_primary_1q20s_gg_{background-color:var(--intergalactic-bg-secondary-neutral, #f4f5f9);padding:var(--intergalactic-spacing-2x, 8px) var(--intergalactic-spacing-3x, 12px);margin-bottom:var(--intergalactic-spacing-05x, 2px)}@media (hover:hover){.___SItemToggle_1q20s_gg_.__use_1q20s_gg_._use_primary_1q20s_gg_:hover{background-color:var(--intergalactic-bg-secondary-neutral-hover, #e0e1e9)}}.___SItemToggle_1q20s_gg_.__disabled_1q20s_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default}.___SItemChevron_1q20s_gg_{margin-right:var(--intergalactic-spacing-2x, 8px);transform:rotate(0deg);transition:transform calc(var(--intergalactic-duration-accordion, 200)*1ms) ease-out;fill:var(--intergalactic-icon-primary-neutral, #6c6e79)}.___SItemChevron_1q20s_gg_.__selected_1q20s_gg_{transform:rotate(90deg)}@media (prefers-reduced-motion){.___SItemChevron_1q20s_gg_{transition:none}}",
15
16
  /*__inner_css_end__*/
16
- "1vyp0_gg_"
17
+ "1q20s_gg_"
17
18
  ), /*__reshadow_css_end__*/
18
19
  {
19
- "__SItemToggle": "___SItemToggle_1vyp0_gg_",
20
- "_use": "__use_1vyp0_gg_",
21
- "_use_primary": "_use_primary_1vyp0_gg_",
22
- "_disabled": "__disabled_1vyp0_gg_",
23
- "__SItemChevron": "___SItemChevron_1vyp0_gg_",
24
- "_selected": "__selected_1vyp0_gg_"
20
+ "__SItemToggle": "___SItemToggle_1q20s_gg_",
21
+ "_use": "__use_1q20s_gg_",
22
+ "_use_primary": "_use_primary_1q20s_gg_",
23
+ "_disabled": "__disabled_1q20s_gg_",
24
+ "__SItemChevron": "___SItemChevron_1q20s_gg_",
25
+ "_selected": "__selected_1q20s_gg_"
25
26
  })
26
27
  );
27
28
  class RootAccordion extends Component {
@@ -1,8 +1,8 @@
1
1
  import type { Intergalactic } from '@semcore/core';
2
2
  import { Component } from '@semcore/core';
3
3
  import React from 'react';
4
- import type { AccordionComponent, AccordionHandlers, AccordionItemComponent, AccordionItemProps, IntergalacticAccordionComponent } from './Accordion.type';
5
- declare class RootAccordion extends Component<Intergalactic.InternalTypings.InferComponentProps<IntergalacticAccordionComponent>, typeof RootAccordion.enhance, AccordionHandlers> {
4
+ import type { NSAccordion } from './Accordion.type';
5
+ declare class RootAccordion extends Component<Intergalactic.InternalTypings.InferComponentProps<NSAccordion.Component>, typeof RootAccordion.enhance, NSAccordion.Handlers> {
6
6
  static displayName: string;
7
7
  static style: {
8
8
  [key: string]: string;
@@ -17,16 +17,16 @@ declare class RootAccordion extends Component<Intergalactic.InternalTypings.Infe
17
17
  uncontrolledProps(): {
18
18
  value: null;
19
19
  };
20
- handleToggleInteraction: (newValue: AccordionItemProps["value"]) => void;
21
- getItemProps({ value }: AccordionItemProps): {
20
+ handleToggleInteraction: (newValue: NSAccordion.Item.Props["value"]) => void;
21
+ getItemProps({ value }: NSAccordion.Item.Props): {
22
22
  selected: boolean;
23
23
  duration: never;
24
24
  use: "primary" | "secondary" | undefined;
25
- $handleInteraction: (newValue: AccordionItemProps["value"]) => void;
25
+ $handleInteraction: (newValue: NSAccordion.Item.Props["value"]) => void;
26
26
  };
27
27
  render(): React.JSX.Element;
28
28
  }
29
- export declare class RootItem extends Component<Intergalactic.InternalTypings.InferChildComponentProps<AccordionItemComponent, typeof RootAccordion, 'Item'>, typeof RootItem.enhance> {
29
+ export declare class RootItem extends Component<Intergalactic.InternalTypings.InferChildComponentProps<NSAccordion.Item.Component, typeof RootAccordion, 'Item'>, typeof RootItem.enhance> {
30
30
  static displayName: string;
31
31
  static style: {
32
32
  [key: string]: string;
@@ -63,6 +63,6 @@ export declare class RootItem extends Component<Intergalactic.InternalTypings.In
63
63
  };
64
64
  render(): React.JSX.Element;
65
65
  }
66
- declare const Accordion: AccordionComponent;
67
- export declare const wrapAccordion: <PropsExtending extends {}>(wrapper: (props: Intergalactic.InternalTypings.UntypeRefAndTag<Intergalactic.InternalTypings.ComponentPropsNesting<IntergalacticAccordionComponent>> & PropsExtending) => React.ReactNode) => IntergalacticAccordionComponent<PropsExtending>;
66
+ declare const Accordion: NSAccordion.Component;
67
+ export declare const wrapAccordion: <PropsExtending extends {}>(wrapper: (props: Intergalactic.InternalTypings.UntypeRefAndTag<Intergalactic.InternalTypings.ComponentPropsNesting<NSAccordion.WrapComponent>> & PropsExtending) => React.ReactNode) => NSAccordion.WrapComponent<PropsExtending>;
68
68
  export default Accordion;
@@ -2,113 +2,141 @@ import type { BoxProps, FlexProps, Flex } from '@semcore/base-components';
2
2
  import type { PropGetterFn, Intergalactic } from '@semcore/core';
3
3
  import type { Text } from '@semcore/typography';
4
4
  import type { Property } from 'csstype';
5
- export type AccordionValue = null | number | string | Array<number | string | null>;
6
- export type AccordionProps<T extends AccordionValue = AccordionValue> = FlexProps & {
7
- /** Value for the active tab. Can be set as stroke, number, null or as array.
8
- * @type AccordionValue
9
- * */
10
- value?: T;
11
- /**
12
- * Value of the active tabs selected by default
13
- * @type AccordionValue
14
- * @default []
15
- */
16
- defaultValue?: T;
17
- /** Called when the selection is changed
18
- * @type (value: AccordionValue, event?: React.SyntheticEvent) => void
19
- * */
20
- onChange?: ((value: T, event?: React.SyntheticEvent) => void) | React.Dispatch<React.SetStateAction<T>>;
21
- /** Animation duration of each Accordion.Item inside
22
- * @default 350 */
23
- duration?: number;
24
- /**
25
- * Changes the visual appearance of the component
26
- * @default secondary
27
- */
28
- use?: 'primary' | 'secondary';
29
- };
30
- export interface IAccordionProps<T extends AccordionValue = AccordionValue> extends AccordionProps<T> {
31
- }
32
- export type AccordionContext = {
33
- getItemProps: PropGetterFn;
34
- };
35
- export type AccordionHandlers = {
36
- value: AccordionProps['value'];
37
- };
38
- export type AccordionItemProps = {
39
- /** Tab value */
40
- value: string | number;
41
- /** Disabling selection changes */
42
- disabled?: boolean;
43
- /** Animation duration
44
- * @default 350 */
45
- duration?: number;
46
- };
47
- export type AccordionItemContext = {
48
- getToggleProps?: PropGetterFn;
49
- getCollapseProps?: PropGetterFn;
50
- getChevronProps?: PropGetterFn;
51
- selected?: boolean;
52
- };
53
- export type AccordionItemToggleProps = BoxProps & {
54
- tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
55
- };
56
- export type ChevronItemProps = BoxProps & {
57
- /**
58
- * Chevron size
59
- * @default m
60
- */
61
- size?: 'm' | 'l';
62
- };
63
- export type CollapseAnimationProps = {
64
- /** Animation titles */
65
- keyframes?: [string, string];
66
- /** Enables animation on first rendering
67
- * @default false
68
- */
69
- initialAnimation?: boolean;
70
- /**
71
- * @default ease-out
72
- */
73
- timingFunction?: Property.AnimationTimingFunction;
74
- /**
75
- * @default false
76
- */
77
- animationsDisabled?: boolean;
78
- };
79
- export type AccordionCollapseProps = BoxProps & CollapseAnimationProps & {
80
- /** Animation duration in ms
81
- * @default 0
82
- */
83
- duration?: number | [number, number];
84
- /** If it set to `true`, animated node is persisted in dom even if `visible=false` */
85
- preserveNode?: boolean;
86
- /**
87
- * Add overflow=clip when passing animation
88
- * @default true
89
- * */
90
- overflowHidden?: boolean;
91
- /**
92
- * Value for height after animation
93
- * @default auto
94
- */
95
- defaultHeight?: 'auto' | '100%';
96
- };
97
- export type IntergalacticAccordionComponent<PropsExtending = {}> = (<Value extends AccordionValue, Tag extends Intergalactic.Tag = 'div'>(props: Intergalactic.InternalTypings.ComponentProps<Tag, 'div', AccordionProps<Value>, AccordionContext & {
98
- value: Value;
99
- }, [
100
- handlers: AccordionHandlers
101
- ]> & PropsExtending) => Intergalactic.InternalTypings.ComponentRenderingResults) & Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', AccordionProps>;
102
- export type AccordionItemComponent = Intergalactic.Component<'div', AccordionItemProps, AccordionItemContext>;
103
- export type AccordionItemToggleComponent = Intergalactic.Component<typeof Text, AccordionItemToggleProps>;
104
- export type AccordionItemToggleButtonComponent = Intergalactic.Component<typeof Flex, {}>;
105
- export type AccordionItemChevronComponent = Intergalactic.Component<'div', ChevronItemProps>;
106
- export type AccordionItemCollapseComponent = Intergalactic.Component<'div', AccordionCollapseProps>;
107
- export type AccordionComponent = IntergalacticAccordionComponent & {
108
- Item: AccordionItemComponent & {
109
- Toggle: AccordionItemToggleComponent;
110
- ToggleButton: AccordionItemToggleButtonComponent;
111
- Chevron: AccordionItemChevronComponent;
112
- Collapse: AccordionItemCollapseComponent;
5
+ declare namespace NSAccordion {
6
+ type Value = null | number | string | Array<number | string | null>;
7
+ type Props<V extends NSAccordion.Value = NSAccordion.Value> = FlexProps & {
8
+ /** Value for the active tab. Can be set as stroke, number, null or as array.
9
+ * @type AccordionValue
10
+ * */
11
+ value?: V;
12
+ /**
13
+ * Value of the active tabs selected by default
14
+ * @type AccordionValue
15
+ * @default []
16
+ */
17
+ defaultValue?: V;
18
+ /** Called when the selection is changed
19
+ * @type (value: AccordionValue, event?: React.SyntheticEvent) => void
20
+ * */
21
+ onChange?: ((value: V, event?: React.SyntheticEvent) => void) | React.Dispatch<React.SetStateAction<V>>;
22
+ /** Animation duration of each Accordion.Item inside
23
+ * @default 350 */
24
+ duration?: number;
25
+ /**
26
+ * Changes the visual appearance of the component
27
+ * @default secondary
28
+ */
29
+ use?: 'primary' | 'secondary';
30
+ };
31
+ type Ctx = {
32
+ getItemProps: PropGetterFn;
33
+ };
34
+ type Handlers = {
35
+ value: Props['value'];
113
36
  };
114
- };
37
+ namespace Item {
38
+ type Props = {
39
+ /** Tab value */
40
+ value: string | number;
41
+ /** Disabling selection changes */
42
+ disabled?: boolean;
43
+ /** Animation duration
44
+ * @default 350 */
45
+ duration?: number;
46
+ };
47
+ type Ctx = {
48
+ getToggleProps?: PropGetterFn;
49
+ getCollapseProps?: PropGetterFn;
50
+ getChevronProps?: PropGetterFn;
51
+ selected?: boolean;
52
+ };
53
+ namespace Toggle {
54
+ type Props = BoxProps & {
55
+ tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
56
+ };
57
+ type Component = Intergalactic.Component<typeof Text, Props>;
58
+ }
59
+ namespace ToggleButton {
60
+ type Props = {};
61
+ type Component = Intergalactic.Component<typeof Flex, Props>;
62
+ }
63
+ namespace Chevron {
64
+ type Props = BoxProps & {
65
+ /**
66
+ * Chevron size
67
+ * @default m
68
+ */
69
+ size?: 'm' | 'l';
70
+ };
71
+ type Component = Intergalactic.Component<'div', Props>;
72
+ }
73
+ namespace Collapse {
74
+ type Props = BoxProps & {
75
+ /** Animation titles */
76
+ keyframes?: [string, string];
77
+ /** Enables animation on first rendering
78
+ * @default false
79
+ */
80
+ initialAnimation?: boolean;
81
+ /**
82
+ * @default ease-out
83
+ */
84
+ timingFunction?: Property.AnimationTimingFunction;
85
+ /**
86
+ * @default false
87
+ */
88
+ animationsDisabled?: boolean;
89
+ /** Animation duration in ms
90
+ * @default 0
91
+ */
92
+ duration?: number | [number, number];
93
+ /** If it set to `true`, animated node is persisted in dom even if `visible=false` */
94
+ preserveNode?: boolean;
95
+ /**
96
+ * Add overflow=clip when passing animation
97
+ * @default true
98
+ * */
99
+ overflowHidden?: boolean;
100
+ /**
101
+ * Value for height after animation
102
+ * @default auto
103
+ */
104
+ defaultHeight?: 'auto' | '100%';
105
+ };
106
+ type Component = Intergalactic.Component<'div', Props>;
107
+ }
108
+ type Component = Intergalactic.Component<'div', Props, Ctx> & {
109
+ Toggle: Toggle.Component;
110
+ ToggleButton: ToggleButton.Component;
111
+ Chevron: Chevron.Component;
112
+ Collapse: Collapse.Component;
113
+ };
114
+ }
115
+ type WrapComponent<PropsExtending = {}> = (<V extends Value, Tag extends Intergalactic.Tag = 'div'>(props: Intergalactic.InternalTypings.ComponentProps<Tag, 'div', Props<V>, Ctx & {
116
+ value: V;
117
+ }, [
118
+ handlers: Handlers
119
+ ]> & PropsExtending) => Intergalactic.InternalTypings.ComponentRenderingResults) & Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', Props>;
120
+ type Component = WrapComponent & {
121
+ Item: Item.Component;
122
+ };
123
+ }
124
+ /** @deprecated It will be removed in v18. */
125
+ export type AccordionValue = NSAccordion.Value;
126
+ /** @deprecated It will be removed in v18. */
127
+ export type AccordionProps<V extends AccordionValue = AccordionValue> = NSAccordion.Props<V>;
128
+ /** @deprecated It will be removed in v18. */
129
+ export type AccordionContext = NSAccordion.Ctx;
130
+ /** @deprecated It will be removed in v18. */
131
+ export type AccordionHandlers = NSAccordion.Handlers;
132
+ /** @deprecated It will be removed in v18. */
133
+ export type AccordionItemProps = NSAccordion.Item.Props;
134
+ /** @deprecated It will be removed in v18. */
135
+ export type AccordionItemContext = NSAccordion.Item.Ctx;
136
+ /** @deprecated It will be removed in v18. */
137
+ export type AccordionItemToggleProps = NSAccordion.Item.Toggle.Props;
138
+ /** @deprecated It will be removed in v18. */
139
+ export type ChevronItemProps = NSAccordion.Item.Chevron.Props;
140
+ /** @deprecated It will be removed in v18. */
141
+ export type AccordionCollapseProps = NSAccordion.Item.Collapse.Props;
142
+ export type { NSAccordion };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/accordion",
3
3
  "description": "Semrush Accordion Component",
4
- "version": "17.0.0",
4
+ "version": "17.0.2-prerelease.0",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
@@ -14,13 +14,13 @@
14
14
  "require": "./lib/cjs/index.js"
15
15
  },
16
16
  "dependencies": {
17
- "@semcore/button": "^17.0.0",
18
- "@semcore/typography": "^17.0.0",
17
+ "@semcore/button": "^17.0.1-prerelease.0",
18
+ "@semcore/typography": "^17.0.2-prerelease.0",
19
19
  "csstype": "3.1.3"
20
20
  },
21
21
  "peerDependencies": {
22
- "@semcore/base-components": "^17.0.0 || ^17.0.0-0",
23
- "@semcore/icon": "^17.0.0 || ^17.0.0-0"
22
+ "@semcore/base-components": "^17.0.2",
23
+ "@semcore/icon": "^17.0.1"
24
24
  },
25
25
  "repository": {
26
26
  "type": "git",
@@ -28,10 +28,10 @@
28
28
  "directory": "semcore/accordion"
29
29
  },
30
30
  "devDependencies": {
31
- "@semcore/base-components": "17.0.0",
32
- "@semcore/core": "17.0.0",
31
+ "@semcore/core": "17.0.1",
33
32
  "@semcore/testing-utils": "1.0.0",
34
- "@semcore/icon": "17.0.0"
33
+ "@semcore/base-components": "17.0.2-prerelease.0",
34
+ "@semcore/icon": "17.0.1-prerelease.0"
35
35
  },
36
36
  "scripts": {
37
37
  "build": "pnpm semcore-builder && pnpm vite build"