@semcore/accordion
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -5,2 +5,24 @@ # Changelog | ||
## [2.1.0] - 2020-09-30 | ||
### Added | ||
- Added generic for better `value` and `onChange` typings | ||
### Changed | ||
- Update @semcore/core version to ^1.8 | ||
## [2.0.3] - 2020-09-18 | ||
### Fixed | ||
- Bubbling event from interaction components inside `Accordion.Item.Content` for listener `onChange` in `Accordion` | ||
## [2.0.2] - 2020-09-08 | ||
### Fixed | ||
- Fixed possible styles collisions between components with different versions, but same styles | ||
## [2.0.1] - 2020-07-21 | ||
@@ -7,0 +29,0 @@ |
@@ -14,2 +14,4 @@ "use strict"; | ||
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")); | ||
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); | ||
@@ -23,2 +25,4 @@ | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); | ||
@@ -28,4 +32,2 @@ | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
@@ -51,3 +53,3 @@ | ||
function _createSuper(Derived) { return function () { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; } | ||
@@ -61,18 +63,18 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
/*__inner_css_start__*/ | ||
".___SAccordion_13u98_gg_{display:flex;flex-direction:column;align-items:flex-start;overflow-anchor:none}.___SItemTrigger_13u98_gg_{position:relative;padding:0;margin:0;font-family:inherit;font-weight:400;line-height:normal;vertical-align:middle;background:#fff;outline:0;border:none;box-shadow:none;cursor:pointer;box-sizing:border-box;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;touch-action:manipulation;-webkit-tap-highlight-color:transparent}.___SItemTrigger_13u98_gg_.__disabled_13u98_gg_{opacity:.3;cursor:default;pointer-events:none}.___SItemTrigger_13u98_gg_.__keyboardFocused_13u98_gg_{box-shadow:0 0 0 3px rgba(43,148,225,.3);z-index:1}.___SItemChevron_13u98_gg_{margin-right:8px;transform:rotate(0deg);transition:transform .25s ease-out}.___SItemChevron_13u98_gg_.__selected_13u98_gg_{transform:rotate(90deg)}.___SItemContent_13u98_gg_{width:100%}._animate--enter_gah2y_gg_{display:block}._animate--exit_t5t68_gg_{display:none}._animate--enter-active_1aleg_gg_,._animate--exit-active_wacx6_gg_{height:0;overflow:hidden;transition:height .35s ease}" | ||
".___SAccordion_4z90p_gg_{display:flex;flex-direction:column;align-items:flex-start;overflow-anchor:none}.___SItemTrigger_4z90p_gg_{position:relative;padding:0;margin:0;font-family:inherit;font-weight:400;line-height:normal;vertical-align:middle;background:#fff;outline:0;border:none;box-shadow:none;cursor:pointer;box-sizing:border-box;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;touch-action:manipulation;-webkit-tap-highlight-color:transparent}.___SItemTrigger_4z90p_gg_.__disabled_4z90p_gg_{opacity:.3;cursor:default;pointer-events:none}.___SItemTrigger_4z90p_gg_.__keyboardFocused_4z90p_gg_{box-shadow:0 0 0 3px rgba(43,148,225,.3);z-index:1}.___SItemChevron_4z90p_gg_{margin-right:8px;transform:rotate(0deg);transition:transform .25s ease-out}.___SItemChevron_4z90p_gg_.__selected_4z90p_gg_{transform:rotate(90deg)}.___SItemContent_4z90p_gg_{width:100%}._animate--enter_1ggkx_gg_{display:block}._animate--exit_1s0td_gg_{display:none}._animate--enter-active_f4qht_gg_,._animate--exit-active_1rr0v_gg_{height:0;overflow:hidden;transition:height .35s ease}" | ||
/*__inner_css_end__*/ | ||
, "1rpvtvf") | ||
, "cx9nf2") | ||
/*__reshadow_css_end__*/ | ||
, { | ||
"__SAccordion": "___SAccordion_13u98_gg_", | ||
"__SItemTrigger": "___SItemTrigger_13u98_gg_", | ||
"_disabled": "__disabled_13u98_gg_", | ||
"_keyboardFocused": "__keyboardFocused_13u98_gg_", | ||
"__SItemChevron": "___SItemChevron_13u98_gg_", | ||
"_selected": "__selected_13u98_gg_", | ||
"__SItemContent": "___SItemContent_13u98_gg_", | ||
"animate--enter": "_animate--enter_gah2y_gg_", | ||
"animate--exit": "_animate--exit_t5t68_gg_", | ||
"animate--exit-active": "_animate--exit-active_wacx6_gg_", | ||
"animate--enter-active": "_animate--enter-active_1aleg_gg_" | ||
"__SAccordion": "___SAccordion_4z90p_gg_", | ||
"__SItemTrigger": "___SItemTrigger_4z90p_gg_", | ||
"_disabled": "__disabled_4z90p_gg_", | ||
"_keyboardFocused": "__keyboardFocused_4z90p_gg_", | ||
"__SItemChevron": "___SItemChevron_4z90p_gg_", | ||
"_selected": "__selected_4z90p_gg_", | ||
"__SItemContent": "___SItemContent_4z90p_gg_", | ||
"animate--enter": "_animate--enter_1ggkx_gg_", | ||
"animate--exit": "_animate--exit_1s0td_gg_", | ||
"animate--exit-active": "_animate--exit-active_1rr0v_gg_", | ||
"animate--enter-active": "_animate--enter-active_f4qht_gg_" | ||
}), | ||
@@ -85,5 +87,5 @@ style = (0, _extends2["default"])({}, _ref); | ||
/*__inner_css_start__*/ | ||
"@media (max-width: 768px) {\n\n.___SItemChevron_13u98_gg_ {\n margin-right: 10.4px\n}}" | ||
"@media (max-width: 768px) {\n\n.___SItemChevron_4z90p_gg_ {\n margin-right: 10.4px\n}}" | ||
/*__inner_css_end__*/ | ||
, "1rpvtvf") | ||
, "164zr22") | ||
/*__reshadow_css_end__*/ | ||
@@ -155,7 +157,12 @@ ; | ||
value: function render() { | ||
var SAccordion = this.Root; | ||
var styles = this.asProps.styles; | ||
var SAccordion = _flexBox.Flex; // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
var _this$asProps2 = this.asProps, | ||
styles = _this$asProps2.styles, | ||
forwardRef = _this$asProps2.forwardRef, | ||
onChange = _this$asProps2.onChange, | ||
other = (0, _objectWithoutProperties2["default"])(_this$asProps2, ["styles", "forwardRef", "onChange"]); | ||
return (0, _core.styled)(((0, _core.set)([styled_c8, styles]), /*#__PURE__*/_react["default"].createElement(SAccordion, (0, _core.map)("SAccordion", { | ||
render: _flexBox.Flex | ||
})))); | ||
ref: forwardRef | ||
}, other)))); | ||
} | ||
@@ -196,5 +203,5 @@ }]); | ||
value: function getTriggerProps() { | ||
var _this$asProps2 = this.asProps, | ||
selected = _this$asProps2.selected, | ||
disabled = _this$asProps2.disabled; | ||
var _this$asProps3 = this.asProps, | ||
selected = _this$asProps3.selected, | ||
disabled = _this$asProps3.disabled; | ||
return { | ||
@@ -256,6 +263,6 @@ disabled: disabled, | ||
var SItemTrigger = this.Root; | ||
var _this$asProps3 = this.asProps, | ||
styles = _this$asProps3.styles, | ||
disabled = _this$asProps3.disabled, | ||
keyboardFocused = _this$asProps3.keyboardFocused; | ||
var _this$asProps4 = this.asProps, | ||
styles = _this$asProps4.styles, | ||
disabled = _this$asProps4.disabled, | ||
keyboardFocused = _this$asProps4.keyboardFocused; | ||
return (0, _core.styled)(((0, _core.set)([styled_12c, styles]), /*#__PURE__*/_react["default"].createElement(SItemTrigger, (0, _core.map)("SItemTrigger", { | ||
@@ -262,0 +269,0 @@ render: _flexBox.Box, |
import React, { HTMLAttributes } from 'react'; | ||
import { IFlexProps, IBoxProps } from '@semcore/flex-box'; | ||
import { Component, PropGetter, Merge } from '@semcore/core'; | ||
import { Component, PropGetterFn, Merge, PropsAndRef } from '@semcore/core'; | ||
export declare type AccordionValue = number | string | Array<number> | Array<string>; | ||
export interface IAccordionProps extends IFlexProps { | ||
export interface IAccordionProps<T extends AccordionValue = AccordionValue> extends IFlexProps { | ||
/** Значение активной вкладки */ | ||
value?: AccordionValue; | ||
value?: T; | ||
/** | ||
@@ -12,5 +12,5 @@ * Значение выбранных по умолчанию активных вкладок | ||
*/ | ||
defaultValue?: AccordionValue; | ||
defaultValue?: T; | ||
/** Вызывается при изменении выбора */ | ||
onChange?: (value: AccordionValue, event?: React.SyntheticEvent) => void; | ||
onChange?: (value: T, event?: React.SyntheticEvent) => void; | ||
/** | ||
@@ -20,6 +20,6 @@ * Функция для управления активностью вкладок | ||
*/ | ||
selectedValues?: (activeValue: AccordionValue, value: React.ReactText) => AccordionValue; | ||
selectedValues?: (activeValue: T, value: React.ReactText) => AccordionValue; | ||
} | ||
export interface IAccordionContext extends IAccordionProps { | ||
getItemProps?: PropGetter<RootAccordion['getItemProps']>; | ||
getItemProps: PropGetterFn; | ||
} | ||
@@ -51,5 +51,5 @@ declare class RootAccordion extends Component<IAccordionProps> { | ||
export interface IAccordionItemContext { | ||
getTriggerProps?: PropGetter<RootItem['getTriggerProps']>; | ||
getContentProps?: PropGetter<RootItem['getContentProps']>; | ||
getChevronProps?: PropGetter<RootItem['getChevronProps']>; | ||
getTriggerProps?: PropGetterFn; | ||
getContentProps?: PropGetterFn; | ||
getChevronProps?: PropGetterFn; | ||
selected?: boolean; | ||
@@ -82,3 +82,3 @@ } | ||
export declare class Trigger extends Component<IBoxProps> { | ||
static enhance: ((props: any) => any)[]; | ||
static enhance: any[]; | ||
static defaultProps: { | ||
@@ -92,3 +92,3 @@ tag: string; | ||
export declare function Content(props: any): JSX.Element; | ||
declare const Accordion: import("@semcore/core").ComponentType<Merge<IAccordionProps, React.HTMLAttributes<HTMLDivElement>>, { | ||
declare const Accordion: import("@semcore/core").ComponentType<IAccordionProps<AccordionValue>, { | ||
Item: [IAccordionItemProps, { | ||
@@ -99,3 +99,7 @@ Trigger: Merge<IBoxProps, HTMLAttributes<HTMLButtonElement>>; | ||
}]; | ||
}, IAccordionContext & IAccordionItemContext>; | ||
}, IAccordionContext & IAccordionItemContext, { | ||
value: any[]; | ||
}, <T extends AccordionValue = AccordionValue>(props: PropsAndRef<IAccordionProps<T>, IAccordionContext & IAccordionItemContext, { | ||
value: any[]; | ||
}>) => React.ReactElement>; | ||
export declare const AccordionItem: import("@semcore/core").ComponentType<IAccordionItemProps, { | ||
@@ -105,3 +109,5 @@ Trigger: Merge<IBoxProps, HTMLAttributes<HTMLButtonElement>>; | ||
Content: Merge<IBoxProps, HTMLAttributes<HTMLDivElement>>; | ||
}, IAccordionContext & IAccordionItemContext>; | ||
}, IAccordionContext & IAccordionItemContext, { | ||
value: any[]; | ||
}, null>; | ||
export default Accordion; |
{ | ||
"name": "@semcore/accordion", | ||
"description": "SEMRush Accordion Component", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"main": "lib/cjs/index.js", | ||
@@ -21,3 +21,3 @@ "module": "lib/es6/index.js", | ||
"peerDependencies": { | ||
"@semcore/core": "^1.5", | ||
"@semcore/core": "^1.8", | ||
"react": "^16.8" | ||
@@ -24,0 +24,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
72049
1126