@consta/uikit 4.27.0 → 4.28.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/ChipsCanary/index.d.ts +1 -0
- package/ChipsCanary/index.js +1 -0
- package/__internal__/src/components/BadgeGroup/BadgeGroup.js +1 -1
- package/__internal__/src/components/BadgeGroup/BadgeGroup.js.map +1 -1
- package/__internal__/src/components/BadgeGroup/helper.d.ts +0 -1
- package/__internal__/src/components/BadgeGroup/helper.js +1 -1
- package/__internal__/src/components/BadgeGroup/helper.js.map +1 -1
- package/__internal__/src/components/Button/Button.css +1 -1
- package/__internal__/src/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/__internal__/src/components/CheckboxGroup/CheckboxGroup.js.map +1 -1
- package/__internal__/src/components/CheckboxGroup/helper.d.ts +3 -1
- package/__internal__/src/components/CheckboxGroup/helper.js +1 -1
- package/__internal__/src/components/CheckboxGroup/helper.js.map +1 -1
- package/__internal__/src/components/CheckboxGroup/types.d.ts +9 -1
- package/__internal__/src/components/CheckboxGroup/types.js.map +1 -1
- package/__internal__/src/components/ChipsCanary/Chips.css +1 -0
- package/__internal__/src/components/ChipsCanary/ChipsCanary.d.ts +3 -0
- package/__internal__/src/components/ChipsCanary/ChipsCanary.js +2 -0
- package/__internal__/src/components/ChipsCanary/ChipsCanary.js.map +1 -0
- package/__internal__/src/components/ChipsCanary/ChipsChoice/ChipsChoice.d.ts +4 -0
- package/__internal__/src/components/ChipsCanary/ChipsChoice/ChipsChoice.js +2 -0
- package/__internal__/src/components/ChipsCanary/ChipsChoice/ChipsChoice.js.map +1 -0
- package/__internal__/src/components/ChipsCanary/ChipsChoice/index.d.ts +2 -0
- package/__internal__/src/components/ChipsCanary/ChipsChoice/index.js +2 -0
- package/__internal__/src/components/ChipsCanary/ChipsChoice/index.js.map +1 -0
- package/__internal__/src/components/ChipsCanary/ChipsChoice/types.d.ts +29 -0
- package/__internal__/src/components/ChipsCanary/ChipsChoice/types.js +2 -0
- package/__internal__/src/components/ChipsCanary/ChipsChoice/types.js.map +1 -0
- package/__internal__/src/components/ChipsCanary/ChipsItem/ChipsItem.css +3 -0
- package/__internal__/src/components/ChipsCanary/ChipsItem/ChipsItem.d.ts +3 -0
- package/__internal__/src/components/ChipsCanary/ChipsItem/ChipsItem.js +2 -0
- package/__internal__/src/components/ChipsCanary/ChipsItem/ChipsItem.js.map +1 -0
- package/__internal__/src/components/ChipsCanary/ChipsItem/index.d.ts +1 -0
- package/__internal__/src/components/ChipsCanary/ChipsItem/index.js +2 -0
- package/__internal__/src/components/ChipsCanary/ChipsItem/index.js.map +1 -0
- package/__internal__/src/components/ChipsCanary/helpers.d.ts +39 -0
- package/__internal__/src/components/ChipsCanary/helpers.js +2 -0
- package/__internal__/src/components/ChipsCanary/helpers.js.map +1 -0
- package/__internal__/src/components/ChipsCanary/index.d.ts +4 -0
- package/__internal__/src/components/ChipsCanary/index.js +2 -0
- package/__internal__/src/components/ChipsCanary/index.js.map +1 -0
- package/__internal__/src/components/ChipsCanary/types.d.ts +62 -0
- package/__internal__/src/components/ChipsCanary/types.js +2 -0
- package/__internal__/src/components/ChipsCanary/types.js.map +1 -0
- package/__internal__/src/components/ChoiceGroup/ChoiceGroup.js +1 -1
- package/__internal__/src/components/ChoiceGroup/ChoiceGroup.js.map +1 -1
- package/__internal__/src/components/ChoiceGroup/Item/ChoiceGroup-Item.d.ts +7 -9
- package/__internal__/src/components/ChoiceGroup/Item/ChoiceGroup-Item.js +1 -1
- package/__internal__/src/components/ChoiceGroup/Item/ChoiceGroup-Item.js.map +1 -1
- package/__internal__/src/components/ChoiceGroup/helper.d.ts +3 -1
- package/__internal__/src/components/ChoiceGroup/helper.js +1 -1
- package/__internal__/src/components/ChoiceGroup/helper.js.map +1 -1
- package/__internal__/src/components/ChoiceGroup/types.d.ts +7 -1
- package/__internal__/src/components/ChoiceGroup/types.js.map +1 -1
- package/__internal__/src/components/ComboboxCanary/ComboboxCanary.js +1 -1
- package/__internal__/src/components/ComboboxCanary/ComboboxCanary.js.map +1 -1
- package/__internal__/src/components/ComboboxCanary/helpers.d.ts +4 -0
- package/__internal__/src/components/ComboboxCanary/helpers.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeDate/DatePickerTypeDate.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeDate/DatePickerTypeDate.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeDateRange/DatePickerTypeDateRange.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeDateRange/DatePickerTypeDateRange.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeDateTime/DatePickerTypeDateTime.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeDateTime/DatePickerTypeDateTime.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeDateTimeRange/DatePickerTypeDateTimeRange.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeDateTimeRange/DatePickerTypeDateTimeRange.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeMonth/DatePickerTypeMonth.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeMonth/DatePickerTypeMonth.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeMonthRange/DatePickerTypeMonthRange.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeMonthRange/DatePickerTypeMonthRange.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeTime/DatePickerTypeTime.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeTime/DatePickerTypeTime.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeYear/DatePickerTypeYear.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeYear/DatePickerTypeYear.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeYearRange/DatePickerTypeYearRange.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerTypeYearRange/DatePickerTypeYearRange.js.map +1 -1
- package/__internal__/src/components/DatePicker/useCalendarVisible.js +1 -1
- package/__internal__/src/components/DatePicker/useCalendarVisible.js.map +1 -1
- package/__internal__/src/components/EventInterceptor/propsHandlers/useTextFieldEventsHandler.d.ts +1 -54
- package/__internal__/src/components/ListCanary/ListCanary.js +1 -1
- package/__internal__/src/components/ListCanary/ListCanary.js.map +1 -1
- package/__internal__/src/components/ListCanary/index.d.ts +1 -0
- package/__internal__/src/components/ListCanary/index.js +1 -1
- package/__internal__/src/components/ListCanary/index.js.map +1 -1
- package/__internal__/src/components/ListCanary/renderHeader.d.ts +4 -0
- package/__internal__/src/components/ListCanary/renderHeader.js +2 -0
- package/__internal__/src/components/ListCanary/renderHeader.js.map +1 -0
- package/__internal__/src/components/SelectComponentsCanary/Select.css +1 -1
- package/__internal__/src/components/SelectComponentsCanary/useSelect/useSelect.d.ts +1 -0
- package/__internal__/src/components/SelectComponentsCanary/useSelect/useSelect.js +1 -1
- package/__internal__/src/components/SelectComponentsCanary/useSelect/useSelect.js.map +1 -1
- package/__internal__/src/components/TextField/types.d.ts +2 -2
- package/__internal__/src/components/TextField/types.js.map +1 -1
- package/__internal__/src/hooks/useChoiceGroup/useChoiceGroup.d.ts +2 -2
- package/__internal__/src/hooks/useChoiceGroup/useChoiceGroup.js.map +1 -1
- package/__internal__/src/hooks/useGlobalKeys/useGlobalKeys.d.ts +1 -1
- package/__internal__/src/hooks/useGlobalKeys/useGlobalKeys.js.map +1 -1
- package/__internal__/src/hooks/useKeysCanary/index.d.ts +1 -0
- package/__internal__/src/hooks/useKeysCanary/index.js +2 -0
- package/__internal__/src/hooks/useKeysCanary/index.js.map +1 -0
- package/__internal__/src/hooks/useKeysCanary/useKeysCanary.d.ts +12 -0
- package/__internal__/src/hooks/useKeysCanary/useKeysCanary.js +2 -0
- package/__internal__/src/hooks/useKeysCanary/useKeysCanary.js.map +1 -0
- package/__internal__/src/hooks/useKeysRef/useKeysRef.d.ts +2 -1
- package/__internal__/src/hooks/useKeysRef/useKeysRef.js +1 -1
- package/__internal__/src/hooks/useKeysRef/useKeysRef.js.map +1 -1
- package/__internal__/src/utils/stand.d.ts +1 -0
- package/__internal__/src/utils/stand.js +2 -0
- package/__internal__/src/utils/stand.js.map +1 -0
- package/package.json +1 -1
- package/useKeysCanary/index.d.ts +1 -0
- package/useKeysCanary/index.js +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../__internal__/src/components/ChipsCanary";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../__internal__/src/components/ChipsCanary";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["items","fitMode","getItemAs","getItemAttributes","getItemIconLeft","getItemIconRight","getItemKey","getItemLabel","getItemStatus","getItemRef","getItemView","minified","size","form","className","moreRef","moreAttributes"];import"./BadgeGroup.css";import React,{forwardRef}from"react";import{useForkRef}from"../../hooks/useForkRef";import{useHideElementsInLine}from"../../hooks/useHideElementsInLine";import{cn}from"../../utils/bem";import{Badge,badgePropFormDefault,badgePropSizeDefault}from"../Badge/Badge";import{
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["items","fitMode","getItemAs","getItemAttributes","getItemIconLeft","getItemIconRight","getItemKey","getItemLabel","getItemStatus","getItemRef","getItemView","minified","size","form","className","moreRef","moreAttributes"];import"./BadgeGroup.css";import React,{forwardRef}from"react";import{forkRef,useForkRef}from"../../hooks/useForkRef";import{useHideElementsInLine}from"../../hooks/useHideElementsInLine";import{cn}from"../../utils/bem";import{Badge,badgePropFormDefault,badgePropSizeDefault}from"../Badge/Badge";import{withDefaultGetters}from"./helper";var cnBadgeGroup=cn("BadgeGroup"),BadgeGroupRender=function(a,b){var c=withDefaultGetters(a),d=c.items,e=c.fitMode,f=void 0===e?"wrap":e,g=c.getItemAs,h=c.getItemAttributes,i=c.getItemIconLeft,j=c.getItemIconRight,k=c.getItemKey,l=c.getItemLabel,m=c.getItemStatus,n=c.getItemRef,o=c.getItemView,p=c.minified,q=c.size,r=void 0===q?badgePropSizeDefault:q,s=c.form,t=void 0===s?badgePropFormDefault:s,u=c.className,v=c.moreRef,w=c.moreAttributes,x=_objectWithoutProperties(c,_excluded),y=useHideElementsInLine(d),z=y.visibleItems,A=y.itemsRefs,B=y.wrapperRef,C=y.hiddenItems,D=y.moreRef,E=useForkRef([D,v]);return React.createElement("div",Object.assign({ref:useForkRef([b,B]),className:cnBadgeGroup({size:r,fitMode:f},[u])},x),d.map(function(a,b){var c,d=g(a);return React.createElement(Badge,Object.assign({key:k(a),size:r,form:t,minified:p,label:l(a),iconLeft:i(a),iconRight:j(a),as:d,ref:forkRef([A[b],n(a)]),view:o(a),status:m(a),className:cnBadgeGroup("Badge",{hidden:!("reduction"!==f)&&!z[b]})},null!==(c=h(a))&&void 0!==c?c:{}))}),"reduction"===f&&React.createElement(Badge,Object.assign({className:cnBadgeGroup("Badge",{hidden:0>=C.length,zero:0>=C.length}),key:"more",label:"+".concat(C.length),status:"system",form:t,size:r,view:"filled",ref:E},w)))};export var BadgeGroup=forwardRef(BadgeGroupRender);export*from"./types";
|
|
2
2
|
//# sourceMappingURL=BadgeGroup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeGroup.js","names":["React","forwardRef","useForkRef","useHideElementsInLine","cn","Badge","badgePropFormDefault","badgePropSizeDefault","
|
|
1
|
+
{"version":3,"file":"BadgeGroup.js","names":["React","forwardRef","forkRef","useForkRef","useHideElementsInLine","cn","Badge","badgePropFormDefault","badgePropSizeDefault","withDefaultGetters","cnBadgeGroup","BadgeGroupRender","props","ref","items","fitMode","getItemAs","getItemAttributes","getItemIconLeft","getItemIconRight","getItemKey","getItemLabel","getItemStatus","getItemRef","getItemView","minified","size","form","className","moreRefProp","moreRef","moreAttributes","otherProps","visibleItems","itemsRefs","wrapperRef","hiddenItems","hideMoreRef","map","item","index","as","hidden","length","zero","BadgeGroup"],"sources":["../../../../../src/components/BadgeGroup/BadgeGroup.tsx"],"sourcesContent":["import './BadgeGroup.css';\n\nimport React, { forwardRef } from 'react';\n\nimport { forkRef, useForkRef } from '##/hooks/useForkRef';\nimport { useHideElementsInLine } from '##/hooks/useHideElementsInLine';\nimport { cn } from '##/utils/bem';\n\nimport {\n Badge,\n badgePropFormDefault,\n badgePropSizeDefault,\n} from '../Badge/Badge';\nimport { withDefaultGetters } from './helper';\nimport { BadgeGroupComponent, BadgeGroupProps } from './types';\n\nconst cnBadgeGroup = cn('BadgeGroup');\n\nconst BadgeGroupRender = (\n props: BadgeGroupProps,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const {\n items,\n fitMode = 'wrap',\n getItemAs,\n getItemAttributes,\n getItemIconLeft,\n getItemIconRight,\n getItemKey,\n getItemLabel,\n getItemStatus,\n getItemRef,\n getItemView,\n minified,\n size = badgePropSizeDefault,\n form = badgePropFormDefault,\n className,\n moreRef: moreRefProp,\n moreAttributes,\n ...otherProps\n } = withDefaultGetters(props);\n\n const {\n visibleItems,\n itemsRefs,\n wrapperRef,\n hiddenItems,\n moreRef: hideMoreRef,\n } = useHideElementsInLine(items);\n\n const moreRef = useForkRef([hideMoreRef, moreRefProp]);\n\n return (\n <div\n ref={useForkRef([ref, wrapperRef])}\n className={cnBadgeGroup({ size, fitMode }, [className])}\n {...otherProps}\n >\n {items.map((item, index) => {\n const as = getItemAs(item);\n return (\n <Badge\n key={getItemKey(item)}\n size={size}\n form={form}\n minified={minified}\n label={getItemLabel(item)}\n iconLeft={getItemIconLeft(item)}\n iconRight={getItemIconRight(item)}\n as={as}\n ref={forkRef([itemsRefs[index], getItemRef(item)])}\n view={getItemView(item)}\n status={getItemStatus(item)}\n className={cnBadgeGroup('Badge', {\n hidden: fitMode === 'reduction' ? !visibleItems[index] : false,\n })}\n {...(getItemAttributes(item) ?? {})}\n />\n );\n })}\n {fitMode === 'reduction' && (\n <Badge\n className={cnBadgeGroup('Badge', {\n hidden: hiddenItems.length <= 0,\n zero: hiddenItems.length <= 0,\n })}\n key=\"more\"\n label={`+${hiddenItems.length}`}\n status=\"system\"\n form={form}\n size={size}\n view=\"filled\"\n ref={moreRef}\n {...moreAttributes}\n />\n )}\n </div>\n );\n};\n\nexport const BadgeGroup = forwardRef(BadgeGroupRender) as BadgeGroupComponent;\n\nexport * from './types';\n"],"mappings":"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"}
|
|
@@ -32,4 +32,3 @@ export declare function withDefaultGetters<ITEM>(props: BadgeGroupProps<ITEM>):
|
|
|
32
32
|
getItemAs: BadgeGroupPropGetItemAs<BadgeGroupDefaultItem> | BadgeGroupPropGetItemAs<ITEM>;
|
|
33
33
|
getItemAttributes: BadgeGroupPropGetItemAttributes<BadgeGroupDefaultItem> | BadgeGroupPropGetItemAttributes<ITEM>;
|
|
34
34
|
};
|
|
35
|
-
export declare const forkRef: <T>(refs: (import("react").Ref<T> | undefined)[]) => ((instance: T | null) => void) | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _defineProperty from"@babel/runtime/helpers/defineProperty";function
|
|
1
|
+
import _defineProperty from"@babel/runtime/helpers/defineProperty";function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}var defaultGetItemKey=function(a){return a.key},defaultGetItemIconRight=function(a){return a.iconRight},defaultGetItemIconLeft=function(a){return a.iconLeft},defaultGetItemStatus=function(a){return a.status},defaultGetItemView=function(a){return a.view},defaultGetItemLabel=function(a){return a.label},defaultGetItemAs=function(a){return a.as},defaultGetItemAttributes=function(a){return a.attributes},defaultGetItemRef=function(a){return a.ref};export function withDefaultGetters(a){return _objectSpread(_objectSpread({},a),{},{getItemKey:a.getItemKey||defaultGetItemKey,getItemLabel:a.getItemLabel||defaultGetItemLabel,getItemIconRight:a.getItemIconRight||defaultGetItemIconRight,getItemIconLeft:a.getItemIconLeft||defaultGetItemIconLeft,getItemView:a.getItemView||defaultGetItemView,getItemStatus:a.getItemStatus||defaultGetItemStatus,getItemRef:a.getItemRef||defaultGetItemRef,getItemAs:a.getItemAs||defaultGetItemAs,getItemAttributes:a.getItemAttributes||defaultGetItemAttributes})}
|
|
2
2
|
//# sourceMappingURL=helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.js","names":["
|
|
1
|
+
{"version":3,"file":"helper.js","names":["defaultGetItemKey","item","key","defaultGetItemIconRight","iconRight","defaultGetItemIconLeft","iconLeft","defaultGetItemStatus","status","defaultGetItemView","view","defaultGetItemLabel","label","defaultGetItemAs","as","defaultGetItemAttributes","attributes","defaultGetItemRef","ref","withDefaultGetters","props","getItemKey","getItemLabel","getItemIconRight","getItemIconLeft","getItemView","getItemStatus","getItemRef","getItemAs","getItemAttributes"],"sources":["../../../../../src/components/BadgeGroup/helper.ts"],"sourcesContent":["import {\n BadgeGroupDefaultItem,\n BadgeGroupPropGetItemAs,\n BadgeGroupPropGetItemAttributes,\n BadgeGroupPropGetItemIconLeft,\n BadgeGroupPropGetItemIconRight,\n BadgeGroupPropGetItemKey,\n BadgeGroupPropGetItemLabel,\n BadgeGroupPropGetItemRef,\n BadgeGroupPropGetItemStatus,\n BadgeGroupPropGetItemView,\n BadgeGroupProps,\n} from './types';\n\nconst defaultGetItemKey: BadgeGroupPropGetItemKey<BadgeGroupDefaultItem> = (\n item,\n) => item.key;\nconst defaultGetItemIconRight: BadgeGroupPropGetItemIconRight<\n BadgeGroupDefaultItem\n> = (item) => item.iconRight;\nconst defaultGetItemIconLeft: BadgeGroupPropGetItemIconLeft<\n BadgeGroupDefaultItem\n> = (item) => item.iconLeft;\nconst defaultGetItemStatus: BadgeGroupPropGetItemStatus<\n BadgeGroupDefaultItem\n> = (item) => item.status;\nconst defaultGetItemView: BadgeGroupPropGetItemView<BadgeGroupDefaultItem> = (\n item,\n) => item.view;\nconst defaultGetItemLabel: BadgeGroupPropGetItemLabel<BadgeGroupDefaultItem> = (\n item,\n) => item.label;\nconst defaultGetItemAs: BadgeGroupPropGetItemAs<BadgeGroupDefaultItem> = (\n item,\n) => item.as;\nconst defaultGetItemAttributes: BadgeGroupPropGetItemAttributes<\n BadgeGroupDefaultItem\n> = (item) => item.attributes;\nconst defaultGetItemRef: BadgeGroupPropGetItemRef<BadgeGroupDefaultItem> = (\n item,\n) => item.ref;\n\nexport function withDefaultGetters<ITEM>(props: BadgeGroupProps<ITEM>) {\n return {\n ...props,\n getItemKey: props.getItemKey || defaultGetItemKey,\n getItemLabel: props.getItemLabel || defaultGetItemLabel,\n getItemIconRight: props.getItemIconRight || defaultGetItemIconRight,\n getItemIconLeft: props.getItemIconLeft || defaultGetItemIconLeft,\n getItemView: props.getItemView || defaultGetItemView,\n getItemStatus: props.getItemStatus || defaultGetItemStatus,\n getItemRef: props.getItemRef || defaultGetItemRef,\n getItemAs: props.getItemAs || defaultGetItemAs,\n getItemAttributes: props.getItemAttributes || defaultGetItemAttributes,\n };\n}\n"],"mappings":"wqBAcMA,kBAAkE,CAAG,SACzEC,CADyE,QAEtEA,EAAI,CAACC,GAFiE,C,CAGrEC,uBAEL,CAAG,SAACF,CAAD,QAAUA,EAAI,CAACG,SAAf,C,CACEC,sBAEL,CAAG,SAACJ,CAAD,QAAUA,EAAI,CAACK,QAAf,C,CACEC,oBAEL,CAAG,SAACN,CAAD,QAAUA,EAAI,CAACO,MAAf,C,CACEC,kBAAoE,CAAG,SAC3ER,CAD2E,QAExEA,EAAI,CAACS,IAFmE,C,CAGvEC,mBAAsE,CAAG,SAC7EV,CAD6E,QAE1EA,EAAI,CAACW,KAFqE,C,CAGzEC,gBAAgE,CAAG,SACvEZ,CADuE,QAEpEA,EAAI,CAACa,EAF+D,C,CAGnEC,wBAEL,CAAG,SAACd,CAAD,QAAUA,EAAI,CAACe,UAAf,C,CACEC,iBAAkE,CAAG,SACzEhB,CADyE,QAEtEA,EAAI,CAACiB,GAFiE,C,CAI3E,MAAO,SAASC,mBAAT,CAAkCC,CAAlC,CAAgE,CACrE,sCACKA,CADL,MAEEC,UAAU,CAAED,CAAK,CAACC,UAAN,EAAoBrB,iBAFlC,CAGEsB,YAAY,CAAEF,CAAK,CAACE,YAAN,EAAsBX,mBAHtC,CAIEY,gBAAgB,CAAEH,CAAK,CAACG,gBAAN,EAA0BpB,uBAJ9C,CAKEqB,eAAe,CAAEJ,CAAK,CAACI,eAAN,EAAyBnB,sBAL5C,CAMEoB,WAAW,CAAEL,CAAK,CAACK,WAAN,EAAqBhB,kBANpC,CAOEiB,aAAa,CAAEN,CAAK,CAACM,aAAN,EAAuBnB,oBAPxC,CAQEoB,UAAU,CAAEP,CAAK,CAACO,UAAN,EAAoBV,iBARlC,CASEW,SAAS,CAAER,CAAK,CAACQ,SAAN,EAAmBf,gBAThC,CAUEgB,iBAAiB,CAAET,CAAK,CAACS,iBAAN,EAA2Bd,wBAVhD,EAYD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.Button{--button-loader-color:var(--button-color);--button-cursor:pointer;-webkit-appearance:none;background:var(--button-bg-color);border:none;border-radius:var(--control-radius);box-sizing:border-box;color:var(--button-color);cursor:var(--button-cursor);display:inline-block;flex-shrink:0;font-family:var(--font-primary);font-size:var(--button-font-size);font-weight:var(--font-weight-text-regular);height:var(--button-height);line-height:var(--button-height);max-width:100%;overflow:hidden;padding:0 var(--button-space);position:relative;text-decoration:none;text-overflow:ellipsis;transition:background-color .15s ease,border-color .15s ease,box-shadow .15s ease,color .15s ease,fill .15s ease;white-space:nowrap}.Button:not(.Button_disabled):hover,.Button:not(.Button_disabled):not(.Button_loading):hover,.Button:not(.Button_loading):hover{background:var(--button-bg-color-hover);color:var(--button-color-hover)}.Button_form_brick{border-radius:0}.Button_form_round{border-radius:99rem}.Button_form_brickDefault{border-radius:0 var(--control-radius) var(--control-radius) 0}.Button_form_defaultBrick{border-radius:var(--control-radius) 0 0 var(--control-radius)}.Button_form_brickRound{border-radius:0 99rem 99rem 0}.Button_form_roundBrick{border-radius:99rem 0 0 99rem}.Button_size_xs{--button-height:var(--control-height-xs);--button-font-size:var(--control-text-size-xs);--button-space:calc(var(--control-space-xs) - var(--space-3xs));--button-icon-indent:var(--space-xs)}.Button_size_s{--button-height:var(--control-height-s);--button-font-size:var(--control-text-size-s);--button-space:var(--control-space-xs);--button-icon-indent:calc(var(--space-s) - var(--space-3xs))}.Button_size_m{--button-height:var(--control-height-m);--button-font-size:var(--control-text-size-m);--button-space:var(--control-space-s);--button-icon-indent:calc(var(--space-m) - var(--space-3xs))}.Button_size_l{--button-height:var(--control-height-l);--button-font-size:var(--control-text-size-l);--button-space:var(--control-space-m);--button-icon-indent:var(--space-l)}.Button_view_clear{--button-bg-color:var(--color-control-bg-clear);--button-bg-color-hover:var(--color-control-bg-clear-hover);--button-color:var(--color-control-typo-clear);--button-color-hover:var(--color-control-typo-clear-hover);--button-border:transparent;--button-bg-color-disable:var(--color-control-bg-border-disable);--button-color-disable:var(--color-control-typo-disable)}.Button_view_ghost{--button-bg-color:var(--color-control-bg-ghost);--button-bg-color-hover:var(--color-control-bg-ghost-hover);--button-color:var(--color-control-typo-ghost);--button-color-hover:var(--color-control-typo-ghost-hover);--button-border:transparent;--button-bg-color-disable:var(--color-control-bg-disable);--button-color-disable:var(--color-control-typo-disable)}.Button_view_primary{--button-bg-color:var(--color-control-bg-primary);--button-bg-color-hover:var(--color-control-bg-primary-hover);--button-color:var(--color-control-typo-primary);--button-color-hover:var(--color-control-typo-primary-hover);--button-border:transparent;--button-bg-color-disable:var(--color-control-bg-disable);--button-color-disable:var(--color-control-typo-disable)}.Button_view_secondary{--button-bg-color:var(--color-control-bg-secondary);--button-bg-color-hover:var(--color-control-bg-clear);--button-color:var(--color-control-typo-secondary);--button-color-hover:var(--color-control-typo-secondary-hover);--button-border:var(--color-control-bg-border-secondary);--button-border-hover:var(--color-control-bg-border-secondary-hover);--button-bg-color-disable:var(--color-control-bg-secondary);--button-color-disable:var(--color-control-typo-disable);--button-border-disable:var(--color-control-typo-disable);border:var(--control-border-width) solid var(--button-border);line-height:calc(var(--button-height) - var(--control-border-width)*2)}.Button_view_secondary:not(.Button_disabled):hover,.Button_view_secondary:not(.Button_disabled):not(.Button_loading):hover,.Button_view_secondary:not(.Button_loading):hover{border-color:var(--button-border-hover)}.Button_width_full{width:100%}.Button_disabled{--button-loader-color:var(--button-color-disable);--button-cursor:not-allowed;--button-color-hover:var(--button-color-disable);--button-border-hover:var(--button-color-disable);--button-bg-color-hover:var(--button-bg-color-disable);background-color:var(--button-bg-color-disable);border-color:var(--button-border-disable);color:var(--button-color-disable)}.Button_onlyIcon{--button-icon-indent:0;justify-content:center;padding:0;width:var(--button-height)}.Button_onlyIcon,.Button_withIcon{align-items:center;display:inline-flex}.Button-Icon{display:
|
|
1
|
+
.Button{--button-loader-color:var(--button-color);--button-cursor:pointer;-webkit-appearance:none;background:var(--button-bg-color);border:none;border-radius:var(--control-radius);box-sizing:border-box;color:var(--button-color);cursor:var(--button-cursor);display:inline-block;flex-shrink:0;font-family:var(--font-primary);font-size:var(--button-font-size);font-weight:var(--font-weight-text-regular);height:var(--button-height);line-height:var(--button-height);max-width:100%;overflow:hidden;padding:0 var(--button-space);position:relative;text-decoration:none;text-overflow:ellipsis;transition:background-color .15s ease,border-color .15s ease,box-shadow .15s ease,color .15s ease,fill .15s ease;white-space:nowrap}.Button:not(.Button_disabled):hover,.Button:not(.Button_disabled):not(.Button_loading):hover,.Button:not(.Button_loading):hover{background:var(--button-bg-color-hover);color:var(--button-color-hover)}.Button_form_brick{border-radius:0}.Button_form_round{border-radius:99rem}.Button_form_brickDefault{border-radius:0 var(--control-radius) var(--control-radius) 0}.Button_form_defaultBrick{border-radius:var(--control-radius) 0 0 var(--control-radius)}.Button_form_brickRound{border-radius:0 99rem 99rem 0}.Button_form_roundBrick{border-radius:99rem 0 0 99rem}.Button_size_xs{--button-height:var(--control-height-xs);--button-font-size:var(--control-text-size-xs);--button-space:calc(var(--control-space-xs) - var(--space-3xs));--button-icon-indent:var(--space-xs)}.Button_size_s{--button-height:var(--control-height-s);--button-font-size:var(--control-text-size-s);--button-space:var(--control-space-xs);--button-icon-indent:calc(var(--space-s) - var(--space-3xs))}.Button_size_m{--button-height:var(--control-height-m);--button-font-size:var(--control-text-size-m);--button-space:var(--control-space-s);--button-icon-indent:calc(var(--space-m) - var(--space-3xs))}.Button_size_l{--button-height:var(--control-height-l);--button-font-size:var(--control-text-size-l);--button-space:var(--control-space-m);--button-icon-indent:var(--space-l)}.Button_view_clear{--button-bg-color:var(--color-control-bg-clear);--button-bg-color-hover:var(--color-control-bg-clear-hover);--button-color:var(--color-control-typo-clear);--button-color-hover:var(--color-control-typo-clear-hover);--button-border:transparent;--button-bg-color-disable:var(--color-control-bg-border-disable);--button-color-disable:var(--color-control-typo-disable)}.Button_view_ghost{--button-bg-color:var(--color-control-bg-ghost);--button-bg-color-hover:var(--color-control-bg-ghost-hover);--button-color:var(--color-control-typo-ghost);--button-color-hover:var(--color-control-typo-ghost-hover);--button-border:transparent;--button-bg-color-disable:var(--color-control-bg-disable);--button-color-disable:var(--color-control-typo-disable)}.Button_view_primary{--button-bg-color:var(--color-control-bg-primary);--button-bg-color-hover:var(--color-control-bg-primary-hover);--button-color:var(--color-control-typo-primary);--button-color-hover:var(--color-control-typo-primary-hover);--button-border:transparent;--button-bg-color-disable:var(--color-control-bg-disable);--button-color-disable:var(--color-control-typo-disable)}.Button_view_secondary{--button-bg-color:var(--color-control-bg-secondary);--button-bg-color-hover:var(--color-control-bg-clear);--button-color:var(--color-control-typo-secondary);--button-color-hover:var(--color-control-typo-secondary-hover);--button-border:var(--color-control-bg-border-secondary);--button-border-hover:var(--color-control-bg-border-secondary-hover);--button-bg-color-disable:var(--color-control-bg-secondary);--button-color-disable:var(--color-control-typo-disable);--button-border-disable:var(--color-control-typo-disable);border:var(--control-border-width) solid var(--button-border);line-height:calc(var(--button-height) - var(--control-border-width)*2)}.Button_view_secondary:not(.Button_disabled):hover,.Button_view_secondary:not(.Button_disabled):not(.Button_loading):hover,.Button_view_secondary:not(.Button_loading):hover{border-color:var(--button-border-hover)}.Button_width_full{width:100%}.Button_disabled{--button-loader-color:var(--button-color-disable);--button-cursor:not-allowed;--button-color-hover:var(--button-color-disable);--button-border-hover:var(--button-color-disable);--button-bg-color-hover:var(--button-bg-color-disable);background-color:var(--button-bg-color-disable);border-color:var(--button-border-disable);color:var(--button-color-disable)}.Button_onlyIcon{--button-icon-indent:0;justify-content:center;padding:0;width:var(--button-height)}.Button_onlyIcon,.Button_withIcon{align-items:center;display:inline-flex}.Button-Icon{display:flex;flex-shrink:0}.Button-Icon_position_left{margin-right:var(--button-icon-indent)}.Button-Icon_position_right{margin-left:var(--button-icon-indent)}.Button-Label{flex-grow:1;flex-shrink:1;overflow:hidden;text-align:center;text-overflow:ellipsis}.Button_loading{--button-cursor:wait;color:transparent}.Button_loading:not(.Button_disabled){--button-color-hover:transparent;--button-bg-color-hover:var(--button-bg-color)}.Button_loading.Button_disabled{--button-cursor:not-allowed;color:transparent}.Button_loading .Button-Loader{--loaderBackgroundColor:var(--button-loader-color);position:absolute}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["value","items","getItemKey","getItemLabel","getItemDisabled","onChange","name","direction","size","view","disabled","className"];import"./CheckboxGroup.css";import React,{forwardRef}from"react";import{useChoiceGroup}from"../../hooks/useChoiceGroup/useChoiceGroup";import{cn}from"../../utils/bem";import{Checkbox}from"../Checkbox/Checkbox";import{withDefaultGetters}from"./helper";import{checkboxGroupDefaultDirection,checkboxGroupDefaultSize,checkboxGroupDefaultView}from"./types";export var cnCheckboxGroup=cn("CheckboxGroup");var CheckboxGroupRender=function(a,b){var c=withDefaultGetters(a),d=c.value,e=void 0===d?null:d,f=c.items,g=c.getItemKey,h=c.getItemLabel,i=c.getItemDisabled,j=c.
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["value","items","getItemKey","getItemLabel","getItemDisabled","getItemAttributes","onChange","name","direction","size","view","disabled","className","getItemRef"],_excluded2=["className"];import"./CheckboxGroup.css";import React,{forwardRef}from"react";import{useChoiceGroup}from"../../hooks/useChoiceGroup/useChoiceGroup";import{cn}from"../../utils/bem";import{Checkbox}from"../Checkbox/Checkbox";import{withDefaultGetters}from"./helper";import{checkboxGroupDefaultDirection,checkboxGroupDefaultSize,checkboxGroupDefaultView}from"./types";export var cnCheckboxGroup=cn("CheckboxGroup");var CheckboxGroupRender=function(a,b){var c=withDefaultGetters(a),d=c.value,e=void 0===d?null:d,f=c.items,g=c.getItemKey,h=c.getItemLabel,i=c.getItemDisabled,j=c.getItemAttributes,k=c.onChange,l=c.name,m=c.direction,n=void 0===m?checkboxGroupDefaultDirection:m,o=c.size,p=void 0===o?checkboxGroupDefaultSize:o,q=c.view,r=void 0===q?checkboxGroupDefaultView:q,s=c.disabled,t=c.className,u=c.getItemRef,v=_objectWithoutProperties(c,_excluded),w=useChoiceGroup({value:e,getKey:function getKey(a){var b;return null!==(b=g(a))&&void 0!==b?b:h(a)},callBack:k,multiple:!0}),x=w.getOnChange,y=w.getChecked;return React.createElement("div",Object.assign({},v,{ref:b,className:cnCheckboxGroup({direction:n,size:p,view:r},[t])}),f.map(function(a){var b,c,d=null!==(b=j(a))&&void 0!==b?b:{},e=d.className,f=_objectWithoutProperties(d,_excluded2);return React.createElement(Checkbox,Object.assign({key:null!==(c=g(a))&&void 0!==c?c:h(a),label:h(a),size:p,view:r,name:l,ref:u(a),disabled:void 0!==s&&s||(null===i||void 0===i?void 0:i(a)),checked:y(a),onChange:function(b){var c=b.e;return x(a)(c)},className:cnCheckboxGroup("Item",[e])},f))}))};export var CheckboxGroup=forwardRef(CheckboxGroupRender);export*from"./types";
|
|
2
2
|
//# sourceMappingURL=CheckboxGroup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxGroup.js","names":["React","forwardRef","useChoiceGroup","cn","Checkbox","withDefaultGetters","checkboxGroupDefaultDirection","checkboxGroupDefaultSize","checkboxGroupDefaultView","cnCheckboxGroup","CheckboxGroupRender","props","ref","value","items","getItemKey","getItemLabel","getItemDisabled","onChange","name","direction","size","view","disabled","className","otherProps","getKey","item","callBack","multiple","getOnChange","getChecked","map","e","CheckboxGroup"],"sources":["../../../../../src/components/CheckboxGroup/CheckboxGroup.tsx"],"sourcesContent":["import './CheckboxGroup.css';\n\nimport React, { forwardRef } from 'react';\n\nimport { useChoiceGroup } from '../../hooks/useChoiceGroup/useChoiceGroup';\nimport { cn } from '../../utils/bem';\nimport { Checkbox } from '../Checkbox/Checkbox';\nimport { withDefaultGetters } from './helper';\nimport {\n CheckboxGroupComponent,\n checkboxGroupDefaultDirection,\n checkboxGroupDefaultSize,\n checkboxGroupDefaultView,\n CheckboxGroupProps,\n} from './types';\n\nexport const cnCheckboxGroup = cn('CheckboxGroup');\n\nconst CheckboxGroupRender = (\n props: CheckboxGroupProps,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const {\n value = null,\n items,\n getItemKey,\n getItemLabel,\n getItemDisabled,\n onChange,\n name,\n direction = checkboxGroupDefaultDirection,\n size = checkboxGroupDefaultSize,\n view = checkboxGroupDefaultView,\n disabled = false,\n className,\n ...otherProps\n } = withDefaultGetters(props);\n\n const { getOnChange, getChecked } = useChoiceGroup({\n value,\n getKey: (item) => getItemKey(item) ?? getItemLabel(item),\n callBack: onChange,\n multiple: true,\n });\n\n return (\n <div\n {...otherProps}\n ref={ref}\n className={cnCheckboxGroup({ direction, size, view }, [className])}\n >\n {items.map((item) => (\n
|
|
1
|
+
{"version":3,"file":"CheckboxGroup.js","names":["React","forwardRef","useChoiceGroup","cn","Checkbox","withDefaultGetters","checkboxGroupDefaultDirection","checkboxGroupDefaultSize","checkboxGroupDefaultView","cnCheckboxGroup","CheckboxGroupRender","props","ref","value","items","getItemKey","getItemLabel","getItemDisabled","getItemAttributes","onChange","name","direction","size","view","disabled","className","getItemRef","otherProps","getKey","item","callBack","multiple","getOnChange","getChecked","map","atributes","e","CheckboxGroup"],"sources":["../../../../../src/components/CheckboxGroup/CheckboxGroup.tsx"],"sourcesContent":["import './CheckboxGroup.css';\n\nimport React, { forwardRef } from 'react';\n\nimport { useChoiceGroup } from '../../hooks/useChoiceGroup/useChoiceGroup';\nimport { cn } from '../../utils/bem';\nimport { Checkbox } from '../Checkbox/Checkbox';\nimport { withDefaultGetters } from './helper';\nimport {\n CheckboxGroupComponent,\n checkboxGroupDefaultDirection,\n checkboxGroupDefaultSize,\n checkboxGroupDefaultView,\n CheckboxGroupProps,\n} from './types';\n\nexport const cnCheckboxGroup = cn('CheckboxGroup');\n\nconst CheckboxGroupRender = (\n props: CheckboxGroupProps,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const {\n value = null,\n items,\n getItemKey,\n getItemLabel,\n getItemDisabled,\n getItemAttributes,\n onChange,\n name,\n direction = checkboxGroupDefaultDirection,\n size = checkboxGroupDefaultSize,\n view = checkboxGroupDefaultView,\n disabled = false,\n className,\n getItemRef,\n ...otherProps\n } = withDefaultGetters(props);\n\n const { getOnChange, getChecked } = useChoiceGroup({\n value,\n getKey: (item) => getItemKey(item) ?? getItemLabel(item),\n callBack: onChange,\n multiple: true,\n });\n\n return (\n <div\n {...otherProps}\n ref={ref}\n className={cnCheckboxGroup({ direction, size, view }, [className])}\n >\n {items.map((item) => {\n const { className, ...atributes } = getItemAttributes(item) ?? {};\n return (\n <Checkbox\n key={getItemKey(item) ?? getItemLabel(item)}\n label={getItemLabel(item)}\n size={size}\n view={view}\n name={name}\n ref={getItemRef(item)}\n disabled={disabled || getItemDisabled?.(item)}\n checked={getChecked(item)}\n onChange={({ e }) => getOnChange(item)(e)}\n className={cnCheckboxGroup('Item', [className])}\n {...atributes}\n />\n );\n })}\n </div>\n );\n};\n\nexport const CheckboxGroup = forwardRef(\n CheckboxGroupRender,\n) as CheckboxGroupComponent;\n\nexport * from './types';\n"],"mappings":"gSAAA,4BAEA,MAAOA,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OAASC,cAAT,iDACA,OAASC,EAAT,uBACA,OAASC,QAAT,4BACA,OAASC,kBAAT,gBACA,OAEEC,6BAFF,CAGEC,wBAHF,CAIEC,wBAJF,eAQA,MAAO,IAAMC,gBAAe,CAAGN,EAAE,CAAC,eAAD,CAA1B,CAEP,GAAMO,oBAAmB,CAAG,SAC1BC,CAD0B,CAE1BC,CAF0B,CAGvB,OAiBCP,kBAAkB,CAACM,CAAD,CAjBnB,KAEDE,KAFC,CAEDA,CAFC,YAEO,IAFP,GAGDC,CAHC,GAGDA,KAHC,CAIDC,CAJC,GAIDA,UAJC,CAKDC,CALC,GAKDA,YALC,CAMDC,CANC,GAMDA,eANC,CAODC,CAPC,GAODA,iBAPC,CAQDC,CARC,GAQDA,QARC,CASDC,CATC,GASDA,IATC,KAUDC,SAVC,CAUDA,CAVC,YAUWf,6BAVX,OAWDgB,IAXC,CAWDA,CAXC,YAWMf,wBAXN,OAYDgB,IAZC,CAYDA,CAZC,YAYMf,wBAZN,OAaDgB,QAbC,CAcDC,CAdC,GAcDA,SAdC,CAeDC,CAfC,GAeDA,UAfC,CAgBEC,CAhBF,yCAmBiCzB,cAAc,CAAC,CACjDW,KAAK,CAALA,CADiD,CAEjDe,MAAM,CAAE,gBAACC,CAAD,yBAAUd,CAAU,CAACc,CAAD,CAApB,gBAA8Bb,CAAY,CAACa,CAAD,CAA1C,CAFyC,CAGjDC,QAAQ,CAAEX,CAHuC,CAIjDY,QAAQ,GAJyC,CAAD,CAnB/C,CAmBKC,CAnBL,GAmBKA,WAnBL,CAmBkBC,CAnBlB,GAmBkBA,UAnBlB,CA0BH,MACE,4CACMN,CADN,EAEE,GAAG,CAAEf,CAFP,CAGE,SAAS,CAAEH,eAAe,CAAC,CAAEY,SAAS,CAATA,CAAF,CAAaC,IAAI,CAAJA,CAAb,CAAmBC,IAAI,CAAJA,CAAnB,CAAD,CAA4B,CAACE,CAAD,CAA5B,CAH5B,GAKGX,CAAK,CAACoB,GAAN,CAAU,SAACL,CAAD,CAAU,qBACiBX,CAAiB,CAACW,CAAD,CADlC,gBAC4C,EAD5C,CACXJ,CADW,GACXA,SADW,CACGU,CADH,wCAEnB,MACE,qBAAC,QAAD,gBACE,GAAG,WAAEpB,CAAU,CAACc,CAAD,CAAZ,gBAAsBb,CAAY,CAACa,CAAD,CADvC,CAEE,KAAK,CAAEb,CAAY,CAACa,CAAD,CAFrB,CAGE,IAAI,CAAEP,CAHR,CAIE,IAAI,CAAEC,CAJR,CAKE,IAAI,CAAEH,CALR,CAME,GAAG,CAAEM,CAAU,CAACG,CAAD,CANjB,CAOE,QAAQ,CAAE,uBAAYZ,CAAZ,WAAYA,CAAZ,QAAYA,CAAe,CAAGY,CAAH,CAA3B,CAPZ,CAQE,OAAO,CAAEI,CAAU,CAACJ,CAAD,CARrB,CASE,QAAQ,CAAE,eAAGO,EAAH,GAAGA,CAAH,OAAWJ,EAAW,CAACH,CAAD,CAAX,CAAkBO,CAAlB,CAAX,CATZ,CAUE,SAAS,CAAE3B,eAAe,CAAC,MAAD,CAAS,CAACgB,CAAD,CAAT,CAV5B,EAWMU,CAXN,EAcH,CAjBA,CALH,CAyBH,CAvDD,CAyDA,MAAO,IAAME,cAAa,CAAGpC,UAAU,CACrCS,mBADqC,CAAhC,CAIP"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { CheckboxGroupDefaultItem, CheckboxGroupPropGetItemDisabled, CheckboxGroupPropGetItemKey, CheckboxGroupPropGetItemLabel, CheckboxGroupProps } from './types';
|
|
2
|
+
import { CheckboxGroupDefaultItem, CheckboxGroupPropGetItemAttributes, CheckboxGroupPropGetItemDisabled, CheckboxGroupPropGetItemKey, CheckboxGroupPropGetItemLabel, CheckboxGroupPropGetItemRef, CheckboxGroupProps } from './types';
|
|
3
3
|
export declare const withDefaultGetters: (props: CheckboxGroupProps) => {
|
|
4
4
|
getItemKey: CheckboxGroupPropGetItemKey<CheckboxGroupDefaultItem>;
|
|
5
5
|
getItemLabel: CheckboxGroupPropGetItemLabel<CheckboxGroupDefaultItem>;
|
|
6
6
|
getItemDisabled: CheckboxGroupPropGetItemDisabled<CheckboxGroupDefaultItem>;
|
|
7
|
+
getItemAttributes: CheckboxGroupPropGetItemAttributes<CheckboxGroupDefaultItem>;
|
|
8
|
+
getItemRef: CheckboxGroupPropGetItemRef<CheckboxGroupDefaultItem>;
|
|
7
9
|
value?: CheckboxGroupDefaultItem[] | null | undefined;
|
|
8
10
|
items: CheckboxGroupDefaultItem[];
|
|
9
11
|
onChange: (props: {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _defineProperty from"@babel/runtime/helpers/defineProperty";function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}var defaultGetItemKey=function(a){return a.key},defaultGetItemLabel=function(a){return a.label},defaultGetItemDisabled=function(a){return a.disabled};export var withDefaultGetters=function(a){return _objectSpread(_objectSpread({},a),{},{getItemKey:a.getItemKey||defaultGetItemKey,getItemLabel:a.getItemLabel||defaultGetItemLabel,getItemDisabled:a.getItemDisabled||defaultGetItemDisabled})};
|
|
1
|
+
import _defineProperty from"@babel/runtime/helpers/defineProperty";function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}var defaultGetItemKey=function(a){return a.key},defaultGetItemLabel=function(a){return a.label},defaultGetItemDisabled=function(a){return a.disabled},defaultGetItemAttributes=function(a){return a.attributes},defaultGetItemRef=function(a){return a.ref};export var withDefaultGetters=function(a){return _objectSpread(_objectSpread({},a),{},{getItemKey:a.getItemKey||defaultGetItemKey,getItemLabel:a.getItemLabel||defaultGetItemLabel,getItemDisabled:a.getItemDisabled||defaultGetItemDisabled,getItemAttributes:a.getItemAttributes||defaultGetItemAttributes,getItemRef:a.getItemRef||defaultGetItemRef})};
|
|
2
2
|
//# sourceMappingURL=helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.js","names":["defaultGetItemKey","item","key","defaultGetItemLabel","label","defaultGetItemDisabled","disabled","withDefaultGetters","props","getItemKey","getItemLabel","getItemDisabled"],"sources":["../../../../../src/components/CheckboxGroup/helper.ts"],"sourcesContent":["import {\n CheckboxGroupDefaultItem,\n CheckboxGroupPropGetItemDisabled,\n CheckboxGroupPropGetItemKey,\n CheckboxGroupPropGetItemLabel,\n CheckboxGroupProps,\n} from './types';\n\nconst defaultGetItemKey: CheckboxGroupPropGetItemKey<\n CheckboxGroupDefaultItem\n> = (item) => item.key;\nconst defaultGetItemLabel: CheckboxGroupPropGetItemLabel<\n CheckboxGroupDefaultItem\n> = (item) => item.label;\nconst defaultGetItemDisabled: CheckboxGroupPropGetItemDisabled<\n CheckboxGroupDefaultItem\n> = (item) => item.disabled;\n\nexport const withDefaultGetters = (props: CheckboxGroupProps) => ({\n ...props,\n getItemKey: props.getItemKey || defaultGetItemKey,\n getItemLabel: props.getItemLabel || defaultGetItemLabel,\n getItemDisabled: props.getItemDisabled || defaultGetItemDisabled,\n});\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"helper.js","names":["defaultGetItemKey","item","key","defaultGetItemLabel","label","defaultGetItemDisabled","disabled","defaultGetItemAttributes","attributes","defaultGetItemRef","ref","withDefaultGetters","props","getItemKey","getItemLabel","getItemDisabled","getItemAttributes","getItemRef"],"sources":["../../../../../src/components/CheckboxGroup/helper.ts"],"sourcesContent":["import {\n CheckboxGroupDefaultItem,\n CheckboxGroupPropGetItemAttributes,\n CheckboxGroupPropGetItemDisabled,\n CheckboxGroupPropGetItemKey,\n CheckboxGroupPropGetItemLabel,\n CheckboxGroupPropGetItemRef,\n CheckboxGroupProps,\n} from './types';\n\nconst defaultGetItemKey: CheckboxGroupPropGetItemKey<\n CheckboxGroupDefaultItem\n> = (item) => item.key;\nconst defaultGetItemLabel: CheckboxGroupPropGetItemLabel<\n CheckboxGroupDefaultItem\n> = (item) => item.label;\nconst defaultGetItemDisabled: CheckboxGroupPropGetItemDisabled<\n CheckboxGroupDefaultItem\n> = (item) => item.disabled;\nconst defaultGetItemAttributes: CheckboxGroupPropGetItemAttributes<\n CheckboxGroupDefaultItem\n> = (item) => item.attributes;\nconst defaultGetItemRef: CheckboxGroupPropGetItemRef<\n CheckboxGroupDefaultItem\n> = (item) => item.ref;\n\nexport const withDefaultGetters = (props: CheckboxGroupProps) => ({\n ...props,\n getItemKey: props.getItemKey || defaultGetItemKey,\n getItemLabel: props.getItemLabel || defaultGetItemLabel,\n getItemDisabled: props.getItemDisabled || defaultGetItemDisabled,\n getItemAttributes: props.getItemAttributes || defaultGetItemAttributes,\n getItemRef: props.getItemRef || defaultGetItemRef,\n});\n"],"mappings":"wqBAUMA,kBAEL,CAAG,SAACC,CAAD,QAAUA,EAAI,CAACC,GAAf,C,CACEC,mBAEL,CAAG,SAACF,CAAD,QAAUA,EAAI,CAACG,KAAf,C,CACEC,sBAEL,CAAG,SAACJ,CAAD,QAAUA,EAAI,CAACK,QAAf,C,CACEC,wBAEL,CAAG,SAACN,CAAD,QAAUA,EAAI,CAACO,UAAf,C,CACEC,iBAEL,CAAG,SAACR,CAAD,QAAUA,EAAI,CAACS,GAAf,C,CAEJ,MAAO,IAAMC,mBAAkB,CAAG,SAACC,CAAD,wCAC7BA,CAD6B,MAEhCC,UAAU,CAAED,CAAK,CAACC,UAAN,EAAoBb,iBAFA,CAGhCc,YAAY,CAAEF,CAAK,CAACE,YAAN,EAAsBX,mBAHJ,CAIhCY,eAAe,CAAEH,CAAK,CAACG,eAAN,EAAyBV,sBAJV,CAKhCW,iBAAiB,CAAEJ,CAAK,CAACI,iBAAN,EAA2BT,wBALd,CAMhCU,UAAU,CAAEL,CAAK,CAACK,UAAN,EAAoBR,iBANA,GAA3B"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { PropsWithHTMLAttributesAndRef } from '../../utils/types/PropsWithHTMLAttributes';
|
|
3
|
+
declare type CheckboxGroupPropAttributes = Omit<JSX.IntrinsicElements['label'], 'ref' | 'onChange' | 'onFocus' | 'children' | 'onBlur'>;
|
|
3
4
|
export declare type CheckboxGroupDefaultItem = {
|
|
4
5
|
key?: string | number;
|
|
5
6
|
label: string;
|
|
6
7
|
disabled?: boolean;
|
|
8
|
+
attributes?: CheckboxGroupPropAttributes;
|
|
9
|
+
ref?: React.RefObject<HTMLLabelElement>;
|
|
7
10
|
};
|
|
8
11
|
export declare const checkboxGroupDirections: readonly ["column", "row"];
|
|
9
12
|
export declare type CheckboxGroupDirection = typeof checkboxGroupDirections[number];
|
|
@@ -17,12 +20,16 @@ export declare const checkboxGroupDefaultView: CheckboxGroupPropView;
|
|
|
17
20
|
export declare type CheckboxGroupPropGetItemKey<ITEM> = (item: ITEM) => string | number | undefined;
|
|
18
21
|
export declare type CheckboxGroupPropGetItemLabel<ITEM> = (item: ITEM) => string;
|
|
19
22
|
export declare type CheckboxGroupPropGetItemDisabled<ITEM> = (item: ITEM) => boolean | undefined;
|
|
23
|
+
export declare type CheckboxGroupPropGetItemAttributes<ITEM> = (item: ITEM) => CheckboxGroupPropAttributes | undefined;
|
|
24
|
+
export declare type CheckboxGroupPropGetItemRef<ITEM> = (item: ITEM) => React.RefObject<HTMLLabelElement> | undefined;
|
|
20
25
|
export declare type CheckboxGroupProps<ITEM = CheckboxGroupDefaultItem> = PropsWithHTMLAttributesAndRef<{
|
|
21
26
|
value?: ITEM[] | null;
|
|
22
27
|
items: ITEM[];
|
|
23
28
|
getItemKey?: CheckboxGroupPropGetItemKey<ITEM>;
|
|
24
29
|
getItemLabel?: CheckboxGroupPropGetItemLabel<ITEM>;
|
|
25
30
|
getItemDisabled?: CheckboxGroupPropGetItemDisabled<ITEM>;
|
|
31
|
+
getItemAttributes?: CheckboxGroupPropGetItemAttributes<ITEM>;
|
|
32
|
+
getItemRef?: CheckboxGroupPropGetItemRef<ITEM>;
|
|
26
33
|
onChange: (props: {
|
|
27
34
|
e: React.ChangeEvent<HTMLInputElement>;
|
|
28
35
|
value: ITEM[] | null;
|
|
@@ -39,3 +46,4 @@ export declare type CheckboxGroupProps<ITEM = CheckboxGroupDefaultItem> = PropsW
|
|
|
39
46
|
getItemLabel: CheckboxGroupPropGetItemLabel<ITEM>;
|
|
40
47
|
});
|
|
41
48
|
export declare type CheckboxGroupComponent = <ITEM = CheckboxGroupDefaultItem>(props: CheckboxGroupProps<ITEM>) => React.ReactElement | null;
|
|
49
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["checkboxGroupDirections","checkboxGroupDefaultDirection","checkboxGroupSizes","checkboxGroupDefaultSize","checkboxGroupViews","checkboxGroupDefaultView"],"sources":["../../../../../src/components/CheckboxGroup/types.ts"],"sourcesContent":["import { PropsWithHTMLAttributesAndRef } from '../../utils/types/PropsWithHTMLAttributes';\n\nexport type CheckboxGroupDefaultItem = {\n key?: string | number;\n label: string;\n disabled?: boolean;\n};\n\nexport const checkboxGroupDirections = ['column', 'row'] as const;\nexport type CheckboxGroupDirection = typeof checkboxGroupDirections[number];\nexport const checkboxGroupDefaultDirection: CheckboxGroupDirection =\n checkboxGroupDirections[0];\n\nexport const checkboxGroupSizes = ['m', 'xs', 's', 'l'] as const;\nexport type CheckboxGroupPropSize = typeof checkboxGroupSizes[number];\nexport const checkboxGroupDefaultSize: CheckboxGroupPropSize =\n checkboxGroupSizes[0];\n\nexport const checkboxGroupViews = ['primary', 'ghost'] as const;\nexport type CheckboxGroupPropView = typeof checkboxGroupViews[number];\nexport const checkboxGroupDefaultView: CheckboxGroupPropView =\n checkboxGroupViews[0];\n\nexport type CheckboxGroupPropGetItemKey<ITEM> = (\n item: ITEM,\n) => string | number | undefined;\nexport type CheckboxGroupPropGetItemLabel<ITEM> = (item: ITEM) => string;\nexport type CheckboxGroupPropGetItemDisabled<ITEM> = (\n item: ITEM,\n) => boolean | undefined;\n\nexport type CheckboxGroupProps<ITEM = CheckboxGroupDefaultItem> =\n PropsWithHTMLAttributesAndRef<\n {\n value?: ITEM[] | null;\n items: ITEM[];\n getItemKey?: CheckboxGroupPropGetItemKey<ITEM>;\n getItemLabel?: CheckboxGroupPropGetItemLabel<ITEM>;\n getItemDisabled?: CheckboxGroupPropGetItemDisabled<ITEM>;\n onChange: (props: {\n e: React.ChangeEvent<HTMLInputElement>;\n value: ITEM[] | null;\n }) => void;\n name?: string;\n direction?: CheckboxGroupDirection;\n size?: CheckboxGroupPropSize;\n view?: CheckboxGroupPropView;\n disabled?: boolean;\n className?: string;\n },\n HTMLDivElement\n > &\n (ITEM extends { label: CheckboxGroupDefaultItem['label'] }\n ? {}\n : {\n getItemLabel: CheckboxGroupPropGetItemLabel<ITEM>;\n });\n\nexport type CheckboxGroupComponent = <ITEM = CheckboxGroupDefaultItem>(\n props: CheckboxGroupProps<ITEM>,\n) => React.ReactElement | null;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","names":["checkboxGroupDirections","checkboxGroupDefaultDirection","checkboxGroupSizes","checkboxGroupDefaultSize","checkboxGroupViews","checkboxGroupDefaultView"],"sources":["../../../../../src/components/CheckboxGroup/types.ts"],"sourcesContent":["import React from 'react';\n\nimport { PropsWithHTMLAttributesAndRef } from '../../utils/types/PropsWithHTMLAttributes';\n\ntype CheckboxGroupPropAttributes = Omit<\n JSX.IntrinsicElements['label'],\n 'ref' | 'onChange' | 'onFocus' | 'children' | 'onBlur'\n>;\n\nexport type CheckboxGroupDefaultItem = {\n key?: string | number;\n label: string;\n disabled?: boolean;\n attributes?: CheckboxGroupPropAttributes;\n ref?: React.RefObject<HTMLLabelElement>;\n};\n\nexport const checkboxGroupDirections = ['column', 'row'] as const;\nexport type CheckboxGroupDirection = typeof checkboxGroupDirections[number];\nexport const checkboxGroupDefaultDirection: CheckboxGroupDirection =\n checkboxGroupDirections[0];\n\nexport const checkboxGroupSizes = ['m', 'xs', 's', 'l'] as const;\nexport type CheckboxGroupPropSize = typeof checkboxGroupSizes[number];\nexport const checkboxGroupDefaultSize: CheckboxGroupPropSize =\n checkboxGroupSizes[0];\n\nexport const checkboxGroupViews = ['primary', 'ghost'] as const;\nexport type CheckboxGroupPropView = typeof checkboxGroupViews[number];\nexport const checkboxGroupDefaultView: CheckboxGroupPropView =\n checkboxGroupViews[0];\n\nexport type CheckboxGroupPropGetItemKey<ITEM> = (\n item: ITEM,\n) => string | number | undefined;\nexport type CheckboxGroupPropGetItemLabel<ITEM> = (item: ITEM) => string;\nexport type CheckboxGroupPropGetItemDisabled<ITEM> = (\n item: ITEM,\n) => boolean | undefined;\nexport type CheckboxGroupPropGetItemAttributes<ITEM> = (\n item: ITEM,\n) => CheckboxGroupPropAttributes | undefined;\nexport type CheckboxGroupPropGetItemRef<ITEM> = (\n item: ITEM,\n) => React.RefObject<HTMLLabelElement> | undefined;\n\nexport type CheckboxGroupProps<ITEM = CheckboxGroupDefaultItem> =\n PropsWithHTMLAttributesAndRef<\n {\n value?: ITEM[] | null;\n items: ITEM[];\n getItemKey?: CheckboxGroupPropGetItemKey<ITEM>;\n getItemLabel?: CheckboxGroupPropGetItemLabel<ITEM>;\n getItemDisabled?: CheckboxGroupPropGetItemDisabled<ITEM>;\n getItemAttributes?: CheckboxGroupPropGetItemAttributes<ITEM>;\n getItemRef?: CheckboxGroupPropGetItemRef<ITEM>;\n onChange: (props: {\n e: React.ChangeEvent<HTMLInputElement>;\n value: ITEM[] | null;\n }) => void;\n name?: string;\n direction?: CheckboxGroupDirection;\n size?: CheckboxGroupPropSize;\n view?: CheckboxGroupPropView;\n disabled?: boolean;\n className?: string;\n },\n HTMLDivElement\n > &\n (ITEM extends { label: CheckboxGroupDefaultItem['label'] }\n ? {}\n : {\n getItemLabel: CheckboxGroupPropGetItemLabel<ITEM>;\n });\n\nexport type CheckboxGroupComponent = <ITEM = CheckboxGroupDefaultItem>(\n props: CheckboxGroupProps<ITEM>,\n) => React.ReactElement | null;\n"],"mappings":"AAiBA,MAAO,IAAMA,wBAAuB,CAAG,CAAC,QAAD,CAAW,KAAX,CAAhC,CAEP,MAAO,IAAMC,8BAAqD,CAChED,uBAAuB,CAAC,CAAD,CADlB,CAGP,MAAO,IAAME,mBAAkB,CAAG,CAAC,GAAD,CAAM,IAAN,CAAY,GAAZ,CAAiB,GAAjB,CAA3B,CAEP,MAAO,IAAMC,yBAA+C,CAC1DD,kBAAkB,CAAC,CAAD,CADb,CAGP,MAAO,IAAME,mBAAkB,CAAG,CAAC,SAAD,CAAY,OAAZ,CAA3B,CAEP,MAAO,IAAMC,yBAA+C,CAC1DD,kBAAkB,CAAC,CAAD,CADb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.canary--Chips{display:flex;flex-wrap:wrap;gap:var(--space-xs)}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["items","getItemActive","getItemAs","getItemAttributes","getItemIconLeft","getItemIconRight","getItemLabel","getItemRef","getItemStatus","className","interactive","onItemClick","onItemRightIconClick","activeView","size"];import"./Chips.css";import React,{forwardRef}from"react";import{cnCanary as cn}from"../../utils/bem";import{ChipsItem}from"./ChipsItem";import{withDefaultGetters}from"./helpers";var cnChips=cn("Chips"),ChipsRender=function(a,b){var c=withDefaultGetters(a),d=c.items,e=c.getItemActive,f=c.getItemAs,g=c.getItemAttributes,h=c.getItemIconLeft,i=c.getItemIconRight,j=c.getItemLabel,k=c.getItemRef,l=c.getItemStatus,m=c.className,n=c.interactive,o=c.onItemClick,p=c.onItemRightIconClick,q=c.activeView,r=c.size,s=_objectWithoutProperties(c,_excluded);return React.createElement("div",Object.assign({},s,{ref:b,className:cnChips(null,[m])}),d.map(function(a,b){return React.createElement(ChipsItem,Object.assign({},g(a),{key:b,size:r,activeView:q,onClick:o?function(b){return o(a,{e:b})}:void 0,onRightIconClick:p?function(b){return p(a,{e:b})}:void 0,label:j(a),as:f(a),active:e(a),iconLeft:h(a),iconRight:i(a),ref:k(a),status:l(a),interactive:n}))}))};export var Chips=forwardRef(ChipsRender);
|
|
2
|
+
//# sourceMappingURL=ChipsCanary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChipsCanary.js","names":["React","forwardRef","cnCanary","cn","ChipsItem","withDefaultGetters","cnChips","ChipsRender","props","ref","items","getItemActive","getItemAs","getItemAttributes","getItemIconLeft","getItemIconRight","getItemLabel","getItemRef","getItemStatus","className","interactive","onItemClick","onItemRightIconClick","activeView","size","otherProps","map","item","index","e","Chips"],"sources":["../../../../../src/components/ChipsCanary/ChipsCanary.tsx"],"sourcesContent":["import './Chips.css';\n\nimport React, { forwardRef } from 'react';\n\nimport { cnCanary as cn } from '##/utils/bem';\n\nimport { ChipsItem } from './ChipsItem';\nimport { withDefaultGetters } from './helpers';\nimport { ChipsComponent, ChipsProps } from './types';\n\nconst cnChips = cn('Chips');\n\nconst ChipsRender = (props: ChipsProps, ref: React.Ref<HTMLDivElement>) => {\n const {\n items,\n getItemActive,\n getItemAs,\n getItemAttributes,\n getItemIconLeft,\n getItemIconRight,\n getItemLabel,\n getItemRef,\n getItemStatus,\n className,\n interactive,\n onItemClick,\n onItemRightIconClick,\n activeView,\n size,\n ...otherProps\n } = withDefaultGetters(props);\n\n return (\n <div {...otherProps} ref={ref} className={cnChips(null, [className])}>\n {items.map((item, index) => {\n return (\n <ChipsItem\n {...getItemAttributes(item)}\n key={index}\n size={size}\n activeView={activeView}\n onClick={\n onItemClick\n ? (e: React.MouseEvent) => onItemClick(item, { e })\n : undefined\n }\n onRightIconClick={\n onItemRightIconClick\n ? (e: React.MouseEvent) => onItemRightIconClick(item, { e })\n : undefined\n }\n label={getItemLabel(item)}\n as={getItemAs(item)}\n active={getItemActive(item)}\n iconLeft={getItemIconLeft(item)}\n iconRight={getItemIconRight(item)}\n ref={getItemRef(item)}\n status={getItemStatus(item)}\n interactive={interactive}\n />\n );\n })}\n </div>\n );\n};\n\nexport const Chips = forwardRef(ChipsRender) as ChipsComponent;\n"],"mappings":"iUAAA,oBAEA,MAAOA,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OAASC,QAAQ,GAAIC,GAArB,uBAEA,OAASC,SAAT,mBACA,OAASC,kBAAT,iB,GAGMC,QAAO,CAAGH,EAAE,CAAC,OAAD,C,CAEZI,WAAW,CAAG,SAACC,CAAD,CAAoBC,CAApB,CAAuD,CACzE,MAiBIJ,kBAAkB,CAACG,CAAD,CAjBtB,CACEE,CADF,GACEA,KADF,CAEEC,CAFF,GAEEA,aAFF,CAGEC,CAHF,GAGEA,SAHF,CAIEC,CAJF,GAIEA,iBAJF,CAKEC,CALF,GAKEA,eALF,CAMEC,CANF,GAMEA,gBANF,CAOEC,CAPF,GAOEA,YAPF,CAQEC,CARF,GAQEA,UARF,CASEC,CATF,GASEA,aATF,CAUEC,CAVF,GAUEA,SAVF,CAWEC,CAXF,GAWEA,WAXF,CAYEC,CAZF,GAYEA,WAZF,CAaEC,CAbF,GAaEA,oBAbF,CAcEC,CAdF,GAcEA,UAdF,CAeEC,CAfF,GAeEA,IAfF,CAgBKC,CAhBL,uCAmBA,MACE,4CAASA,CAAT,EAAqB,GAAG,CAAEhB,CAA1B,CAA+B,SAAS,CAAEH,OAAO,CAAC,IAAD,CAAO,CAACa,CAAD,CAAP,CAAjD,GACGT,CAAK,CAACgB,GAAN,CAAU,SAACC,CAAD,CAAOC,CAAP,CAAiB,CAC1B,MACE,qBAAC,SAAD,kBACMf,CAAiB,CAACc,CAAD,CADvB,EAEE,GAAG,CAAEC,CAFP,CAGE,IAAI,CAAEJ,CAHR,CAIE,UAAU,CAAED,CAJd,CAKE,OAAO,CACLF,CAAW,CACP,SAACQ,CAAD,QAAyBR,EAAW,CAACM,CAAD,CAAO,CAAEE,CAAC,CAADA,CAAF,CAAP,CAApC,CADO,OANf,CAUE,gBAAgB,CACdP,CAAoB,CAChB,SAACO,CAAD,QAAyBP,EAAoB,CAACK,CAAD,CAAO,CAAEE,CAAC,CAADA,CAAF,CAAP,CAA7C,CADgB,OAXxB,CAeE,KAAK,CAAEb,CAAY,CAACW,CAAD,CAfrB,CAgBE,EAAE,CAAEf,CAAS,CAACe,CAAD,CAhBf,CAiBE,MAAM,CAAEhB,CAAa,CAACgB,CAAD,CAjBvB,CAkBE,QAAQ,CAAEb,CAAe,CAACa,CAAD,CAlB3B,CAmBE,SAAS,CAAEZ,CAAgB,CAACY,CAAD,CAnB7B,CAoBE,GAAG,CAAEV,CAAU,CAACU,CAAD,CApBjB,CAqBE,MAAM,CAAET,CAAa,CAACS,CAAD,CArBvB,CAsBE,WAAW,CAAEP,CAtBf,GAyBH,CA3BA,CADH,CA+BH,C,CAED,MAAO,IAAMU,MAAK,CAAG7B,UAAU,CAACM,WAAD,CAAxB"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ChipsChoiceComponent, ChipsChoiceDefaultItem, ChipsChoicePropGetItemKey } from './types';
|
|
2
|
+
export declare const getUndefined: () => undefined;
|
|
3
|
+
export declare const getItemKeyDefault: ChipsChoicePropGetItemKey<ChipsChoiceDefaultItem>;
|
|
4
|
+
export declare const ChipsChoice: ChipsChoiceComponent;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["value","onChange","multiple","getItemKey","getItemLabel"];import React,{forwardRef}from"react";import{Chips}from"./..";import{useChoiceGroup}from"../../../hooks/useChoiceGroup";import{defaultGetItemLabel}from"../helpers";export var getUndefined=function(){};export var getItemKeyDefault=function(a){return a.key};var ChipsChoiceRender=function(a,b){var c=a.value,d=a.onChange,e=a.multiple,f=a.getItemKey,g=void 0===f?getItemKeyDefault:f,h=a.getItemLabel,i=void 0===h?defaultGetItemLabel:h,j=_objectWithoutProperties(a,_excluded),k=useChoiceGroup({getKey:function getKey(a){var b=g(a);return typeof b!==void 0&&b?b:i(a)},value:c,callBack:function callBack(a){var b=a.value,c=a.e;return d(b,{e:c})},multiple:e}),l=k.getOnChange,m=k.getChecked;return React.createElement(Chips,Object.assign({},j,{ref:b,onItemRightIconClick:getUndefined,onItemClick:function onItemClick(a,b){var c=b.e;return l(a)(c)},getItemIconRight:getUndefined,getItemAttributes:getUndefined,getItemActive:m,interactive:!0}))};export var ChipsChoice=forwardRef(ChipsChoiceRender);
|
|
2
|
+
//# sourceMappingURL=ChipsChoice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChipsChoice.js","names":["React","forwardRef","Chips","useChoiceGroup","defaultGetItemLabel","getUndefined","getItemKeyDefault","item","key","ChipsChoiceRender","props","ref","value","onChange","multiple","getItemKey","getItemLabel","otherProps","getKey","callBack","e","getOnChange","getChecked","ChipsChoice"],"sources":["../../../../../../src/components/ChipsCanary/ChipsChoice/ChipsChoice.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { Chips } from '##/components/ChipsCanary';\nimport {\n CallbackWithoutMultiple,\n useChoiceGroup,\n} from '##/hooks/useChoiceGroup';\n\nimport { defaultGetItemLabel } from '../helpers';\nimport {\n ChipsChoiceComponent,\n ChipsChoiceDefaultItem,\n ChipsChoicePropGetItemKey,\n ChipsChoiceProps,\n} from './types';\n\nexport const getUndefined = () => undefined;\nexport const getItemKeyDefault: ChipsChoicePropGetItemKey<\n ChipsChoiceDefaultItem\n> = (item) => item.key;\n\nconst ChipsChoiceRender = (\n props: ChipsChoiceProps,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const {\n value,\n onChange,\n multiple,\n getItemKey = getItemKeyDefault,\n getItemLabel = defaultGetItemLabel,\n ...otherProps\n } = props;\n\n const callBack: CallbackWithoutMultiple<\n ChipsChoiceDefaultItem,\n React.MouseEvent\n > = ({ value, e }) => onChange(value, { e });\n\n const { getOnChange, getChecked } = useChoiceGroup<\n ChipsChoiceDefaultItem,\n React.MouseEvent\n >({\n getKey: (item: ChipsChoiceDefaultItem) => {\n const key = getItemKey(item);\n return typeof key !== undefined && key ? key : getItemLabel(item);\n },\n value: value as ChipsChoiceDefaultItem,\n callBack,\n multiple: multiple as false,\n // привел к типам из-за того что\n // TS не понимает что параметры для не Multiple и Multiple не могут прийти одновременно\n });\n\n return (\n <Chips\n {...otherProps}\n ref={ref}\n onItemRightIconClick={getUndefined}\n onItemClick={(item, { e }) => getOnChange(item)(e)}\n getItemIconRight={getUndefined}\n getItemAttributes={getUndefined}\n getItemActive={getChecked}\n interactive\n />\n );\n};\n\nexport const ChipsChoice = forwardRef(\n ChipsChoiceRender,\n) as ChipsChoiceComponent;\n"],"mappings":"+JAAA,MAAOA,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OAASC,KAAT,YACA,OAEEC,cAFF,qCAKA,OAASC,mBAAT,kBAQA,MAAO,IAAMC,aAAY,CAAG,YAArB,CACP,MAAO,IAAMC,kBAEZ,CAAG,SAACC,CAAD,QAAUA,EAAI,CAACC,GAAf,CAFG,CAIP,GAAMC,kBAAiB,CAAG,SACxBC,CADwB,CAExBC,CAFwB,CAGrB,IAEDC,EAFC,CAQCF,CARD,CAEDE,KAFC,CAGDC,CAHC,CAQCH,CARD,CAGDG,QAHC,CAIDC,CAJC,CAQCJ,CARD,CAIDI,QAJC,GAQCJ,CARD,CAKDK,UALC,CAKDA,CALC,YAKYT,iBALZ,KAQCI,CARD,CAMDM,YANC,CAMDA,CANC,YAMcZ,mBANd,GAOEa,CAPF,0BAQCP,CARD,cAeiCP,cAAc,CAGhD,CACAe,MAAM,CAAE,gBAACX,CAAD,CAAkC,CACxC,GAAMC,EAAG,CAAGO,CAAU,CAACR,CAAD,CAAtB,CACA,MAAO,OAAOC,EAAP,WAA4BA,CAA5B,CAAkCA,CAAlC,CAAwCQ,CAAY,CAACT,CAAD,CAC5D,CAJD,CAKAK,KAAK,CAAEA,CALP,CAMAO,QAAQ,CAXN,QAHEA,SAGF,OAAGP,EAAH,GAAGA,KAAH,CAAUQ,CAAV,GAAUA,CAAV,OAAkBP,EAAQ,CAACD,CAAD,CAAQ,CAAEQ,CAAC,CAADA,CAAF,CAAR,CAA1B,CAKF,CAOAN,QAAQ,CAAEA,CAPV,CAHgD,CAf/C,CAeKO,CAfL,GAeKA,WAfL,CAekBC,CAflB,GAekBA,UAflB,CA8BH,MACE,qBAAC,KAAD,kBACML,CADN,EAEE,GAAG,CAAEN,CAFP,CAGE,oBAAoB,CAAEN,YAHxB,CAIE,WAAW,CAAE,qBAACE,CAAD,OAASa,EAAT,GAASA,CAAT,OAAiBC,EAAW,CAACd,CAAD,CAAX,CAAkBa,CAAlB,CAAjB,CAJf,CAKE,gBAAgB,CAAEf,YALpB,CAME,iBAAiB,CAAEA,YANrB,CAOE,aAAa,CAAEiB,CAPjB,CAQE,WAAW,GARb,GAWH,CA7CD,CA+CA,MAAO,IAAMC,YAAW,CAAGtB,UAAU,CACnCQ,iBADmC,CAA9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../src/components/ChipsCanary/ChipsChoice/index.ts"],"sourcesContent":["export * from './ChipsChoice';\nexport * from './types';\n"],"mappings":"AAAA,2BACA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ChipsItemProps, ChipsPropActiveView, ChipsPropGetItemIconLeft, ChipsPropGetItemLabel, ChipsPropGetItemRef, ChipsPropGetItemStatus, ChipsPropSize } from "..";
|
|
3
|
+
import { PropsWithHTMLAttributesAndRef } from "../../../utils/types/PropsWithHTMLAttributes";
|
|
4
|
+
export declare type ChipsChoiceDefaultItem = Omit<ChipsItemProps, 'size' | 'activeView' | 'interactive' | 'onRightIconClick' | 'iconRight' | 'as'> & {
|
|
5
|
+
key: string;
|
|
6
|
+
};
|
|
7
|
+
export declare type ChipsChoicePropGetItemKey<ITEM> = (item: ITEM) => string | number | undefined;
|
|
8
|
+
export declare type ChipsChoicePropOnChange<ITEM, MULTIPLE extends boolean> = (value: MULTIPLE extends true ? ITEM[] | null : ITEM, props: {
|
|
9
|
+
e: React.MouseEvent;
|
|
10
|
+
}) => void;
|
|
11
|
+
export declare type ChipsChoicePropValue<ITEM, MULTIPLE extends boolean> = (MULTIPLE extends true ? ITEM[] : ITEM) | null;
|
|
12
|
+
export declare type ChipsChoiceProps<ITEM = ChipsChoiceDefaultItem, MULTIPLE extends boolean = false> = PropsWithHTMLAttributesAndRef<{
|
|
13
|
+
size?: ChipsPropSize;
|
|
14
|
+
activeView?: ChipsPropActiveView;
|
|
15
|
+
items: ITEM[];
|
|
16
|
+
getItemStatus?: ChipsPropGetItemStatus<ITEM>;
|
|
17
|
+
getItemLabel?: ChipsPropGetItemLabel<ITEM>;
|
|
18
|
+
getItemIconLeft?: ChipsPropGetItemIconLeft<ITEM>;
|
|
19
|
+
getItemRef?: ChipsPropGetItemRef<ITEM>;
|
|
20
|
+
onChange: ChipsChoicePropOnChange<ITEM, MULTIPLE>;
|
|
21
|
+
multiple?: MULTIPLE;
|
|
22
|
+
value?: ChipsChoicePropValue<ITEM, MULTIPLE>;
|
|
23
|
+
getItemKey?: ChipsChoicePropGetItemKey<ITEM>;
|
|
24
|
+
}, HTMLDivElement> & (ITEM extends {
|
|
25
|
+
label: string;
|
|
26
|
+
} ? {} : {
|
|
27
|
+
getItemLabel?: ChipsPropGetItemLabel<ITEM>;
|
|
28
|
+
});
|
|
29
|
+
export declare type ChipsChoiceComponent = <ITEM = ChipsChoiceDefaultItem, MULTIPLE extends boolean = false>(props: ChipsChoiceProps<ITEM, MULTIPLE>) => React.ReactElement | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../../../src/components/ChipsCanary/ChipsChoice/types.ts"],"sourcesContent":["import {\n ChipsItemProps,\n ChipsPropActiveView,\n ChipsPropGetItemIconLeft,\n ChipsPropGetItemLabel,\n ChipsPropGetItemRef,\n ChipsPropGetItemStatus,\n ChipsPropSize,\n} from '##/components/ChipsCanary';\nimport { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\nexport type ChipsChoiceDefaultItem = Omit<\n ChipsItemProps,\n | 'size'\n | 'activeView'\n | 'interactive'\n | 'onRightIconClick'\n | 'iconRight'\n | 'as'\n> & {\n key: string;\n};\n\nexport type ChipsChoicePropGetItemKey<ITEM> = (\n item: ITEM,\n) => string | number | undefined;\n\nexport type ChipsChoicePropOnChange<ITEM, MULTIPLE extends boolean> = (\n value: MULTIPLE extends true ? ITEM[] | null : ITEM,\n props: {\n e: React.MouseEvent;\n },\n) => void;\n\nexport type ChipsChoicePropValue<ITEM, MULTIPLE extends boolean> =\n | (MULTIPLE extends true ? ITEM[] : ITEM)\n | null;\n\nexport type ChipsChoiceProps<\n ITEM = ChipsChoiceDefaultItem,\n MULTIPLE extends boolean = false,\n> = PropsWithHTMLAttributesAndRef<\n {\n size?: ChipsPropSize;\n activeView?: ChipsPropActiveView;\n items: ITEM[];\n getItemStatus?: ChipsPropGetItemStatus<ITEM>;\n getItemLabel?: ChipsPropGetItemLabel<ITEM>;\n getItemIconLeft?: ChipsPropGetItemIconLeft<ITEM>;\n getItemRef?: ChipsPropGetItemRef<ITEM>;\n onChange: ChipsChoicePropOnChange<ITEM, MULTIPLE>;\n multiple?: MULTIPLE;\n value?: ChipsChoicePropValue<ITEM, MULTIPLE>;\n getItemKey?: ChipsChoicePropGetItemKey<ITEM>;\n },\n HTMLDivElement\n> &\n (ITEM extends { label: string }\n ? {}\n : {\n getItemLabel?: ChipsPropGetItemLabel<ITEM>;\n });\n\nexport type ChipsChoiceComponent = <\n ITEM = ChipsChoiceDefaultItem,\n MULTIPLE extends boolean = false,\n>(\n props: ChipsChoiceProps<ITEM, MULTIPLE>,\n) => React.ReactElement | null;\n"],"mappings":""}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
.canary--ChipsItem{--chip-bg-color:var(--color-control-bg-ghost);--chip-bg-color-hover:var(--color-control-bg-ghost-hover);--chip-color:var(--color-control-typo-ghost);--chip-color-hover:var(--color-control-typo-ghost-hover);--chip-border:transparent;--chip-border-hover:transparent;align-items:center;background-color:var(--chip-bg-color);border:var(--control-border-width) solid var(--chip-border);border-radius:99rem;box-sizing:border-box;color:var(--chip-color);display:inline-flex;font-family:inherit;font-size:var(--chip-text-size);gap:calc(var(--chip-space)/2);height:var(--chip-height);justify-content:center;padding:0 var(--chip-space);text-decoration:none;transition:background-color .15s ease,border-color .15s ease,box-shadow .15s ease,color .15s ease,fill .15s ease;white-space:nowrap}.canary--ChipsItem_status{padding:0 var(--chip-space) 0 calc(var(--chip-height)/2 - var(--chip-badge-size)/2)}.canary--ChipsItem_active{--chip-bg-color:var(--chip-active-bg-color);--chip-bg-color-hover:var(--chip-active-bg-color-hover);--chip-color:var(--chip-active-color);--chip-color-hover:var(--chip-active-color-hover);--chip-border:var(--chip-active-border);--chip-border-hover:var(--chip-active-border-hover)}.canary--ChipsItem_interactive{cursor:pointer}.canary--ChipsItem_interactive:hover{background-color:var(--chip-bg-color-hover);border:var(--control-border-width) solid var(--chip-border-hover);color:var(--chip-color-hover)}.canary--ChipsItem_size_xs{--chip-height:var(--control-height-xs);--chip-text-size:var(--control-text-size-xs);--chip-space:var(--space-xs);--chip-badge-size:10px}.canary--ChipsItem_size_s{--chip-height:var(--control-height-s);--chip-text-size:var(--control-text-size-s);--chip-space:var(--space-s);--chip-badge-size:16px}.canary--ChipsItem_size_m{--chip-height:var(--control-height-m);--chip-text-size:var(--control-text-size-m);--chip-space:var(--space-m);--chip-badge-size:16px}.canary--ChipsItem_size_l{--chip-height:var(--control-height-l);--chip-text-size:var(--control-text-size-l);--chip-space:var(--space-l);--chip-badge-size:24px}.canary--ChipsItem_activeView_primary{--chip-active-bg-color:var(--color-control-bg-primary);--chip-active-bg-color-hover:var(--color-control-bg-primary-hover);--chip-active-color:var(--color-control-typo-primary);--chip-active-color-hover:var(--color-control-typo-primary-hover);--chip-active-border:transparent;--chip-active-border-hover:transparent}.canary--ChipsItem_activeView_secondary{--chip-active-bg-color:var(--color-control-bg-secondary);--chip-active-bg-color-hover:var(--color-control-bg-clear);--chip-active-color:var(--color-control-typo-secondary);--chip-active-color-hover:var(--color-control-typo-secondary-hover);--chip-active-border:var(--color-control-bg-border-secondary);--chip-active-border-hover:var(
|
|
2
|
+
--color-control-bg-border-secondary-hover
|
|
3
|
+
)}.canary--ChipsItem-IconButton{background-color:transparent;border:transparent;border-radius:var(--control-radius);color:inherit;cursor:pointer;padding:0}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["as","label","size","status","activeView","className","interactive","style","active","iconLeft","iconRight","onRightIconClick","onKeyUp","tabIndex"];import"./ChipsItem.css";import React,{useRef}from"react";import{Badge}from"../../Badge";import{useForkRef}from"../../../hooks/useForkRef";import{useKeys}from"../../../hooks/useKeysCanary";import{cnMixFocus}from"../../../mixs/MixFocus";import{cnCanary as cn}from"../../../utils/bem";import{forwardRefWithAs}from"../../../utils/types/PropsWithAsAttributes";import{chipsPropActiveViewDefault,chipsPropSizeDefault}from"../types";var cnChip=cn("ChipsItem"),iconSizeMap={l:"m",m:"s",s:"s",xs:"xs"};export var ChipsItem=forwardRefWithAs(function(a,b){var c=a.as,d=void 0===c?"span":c,e=a.label,f=a.size,g=void 0===f?chipsPropSizeDefault:f,h=a.status,i=a.activeView,j=void 0===i?chipsPropActiveViewDefault:i,k=a.className,l=a.interactive,m=a.style,n=a.active,o=a.iconLeft,p=a.iconRight,q=a.onRightIconClick,r=a.onKeyUp,s=a.tabIndex,t=_objectWithoutProperties(a,_excluded),u=useRef(null),v=useRef(null),w=useKeys({keys:{Enter:function Enter(){if(v&&q){var a;null===(a=v.current)||void 0===a?void 0:a.focus()}else{var b;null===(b=u.current)||void 0===b?void 0:b.click()}},Escape:function Escape(){if(v&&q){var a;null===(a=u.current)||void 0===a?void 0:a.focus()}},Space:function Space(){var a;null===(a=u.current)||void 0===a?void 0:a.click()}},onEvent:r,isActive:!!l});return React.createElement(d,Object.assign({},t,{className:cnChip({size:g,interactive:l,activeView:j,active:n,status:!!h},[l?cnMixFocus():void 0,k]),ref:useForkRef([u,b]),onKeyUp:w,tabIndex:l?s||0:void 0,role:l?"button":void 0}),h&&React.createElement(Badge,{status:h,size:iconSizeMap[g],minified:!0}),!h&&o&&React.createElement(o,{size:iconSizeMap[g]}),e,p&&React.createElement(p,Object.assign({size:iconSizeMap[g]},q?{as:"button",role:"button",type:"button",onClick:q,className:cnChip("IconButton",[cnMixFocus()]),ref:v,tabIndex:-1}:{})))});
|
|
2
|
+
//# sourceMappingURL=ChipsItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChipsItem.js","names":["React","useRef","Badge","useForkRef","useKeys","cnMixFocus","cnCanary","cn","forwardRefWithAs","chipsPropActiveViewDefault","chipsPropSizeDefault","cnChip","iconSizeMap","l","m","s","xs","ChipsItem","props","ref","as","label","size","status","activeView","className","interactive","style","active","IconLeft","iconLeft","IconRight","iconRight","onRightIconClick","onKeyUpProp","onKeyUp","tabIndex","otherProps","componentRef","iconButtonRef","keys","Enter","current","focus","click","Escape","Space","onEvent","isActive","role","type","onClick"],"sources":["../../../../../../src/components/ChipsCanary/ChipsItem/ChipsItem.tsx"],"sourcesContent":["import './ChipsItem.css';\n\nimport { IconPropSize } from '@consta/icons/Icon';\nimport React, { useRef } from 'react';\n\nimport { Badge } from '##/components/Badge';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { useKeys } from '##/hooks/useKeysCanary';\nimport { cnMixFocus } from '##/mixs/MixFocus';\nimport { cnCanary as cn } from '##/utils/bem';\nimport { forwardRefWithAs } from '##/utils/types/PropsWithAsAttributes';\n\nimport {\n ChipsItemProps,\n chipsPropActiveViewDefault,\n ChipsPropSize,\n chipsPropSizeDefault,\n} from '../types';\n\nconst cnChip = cn('ChipsItem');\n\nconst iconSizeMap: Record<ChipsPropSize, IconPropSize> = {\n l: 'm',\n m: 's',\n s: 's',\n xs: 'xs',\n};\n\nexport const ChipsItem = forwardRefWithAs<ChipsItemProps, 'span'>(\n (props, ref) => {\n const {\n as = 'span',\n label,\n size = chipsPropSizeDefault,\n status,\n activeView = chipsPropActiveViewDefault,\n className,\n interactive,\n style,\n active,\n iconLeft: IconLeft,\n iconRight: IconRight,\n onRightIconClick,\n onKeyUp: onKeyUpProp,\n tabIndex,\n ...otherProps\n } = props;\n\n const componentRef = useRef<HTMLElement>(null);\n const iconButtonRef = useRef<HTMLButtonElement>(null);\n\n const onKeyUp = useKeys({\n keys: {\n Enter: () => {\n if (iconButtonRef && onRightIconClick) {\n iconButtonRef.current?.focus();\n } else {\n componentRef.current?.click();\n }\n },\n Escape: () => {\n if (iconButtonRef && onRightIconClick) {\n componentRef.current?.focus();\n }\n },\n Space: () => {\n componentRef.current?.click();\n },\n },\n onEvent: onKeyUpProp,\n isActive: !!interactive,\n });\n\n const Tag = as as string;\n\n return (\n <Tag\n {...otherProps}\n className={cnChip(\n { size, interactive, activeView, active, status: Boolean(status) },\n [interactive ? cnMixFocus() : undefined, className],\n )}\n ref={useForkRef([componentRef, ref])}\n onKeyUp={onKeyUp}\n tabIndex={interactive ? tabIndex || 0 : undefined}\n role={interactive ? 'button' : undefined}\n >\n {status && <Badge status={status} size={iconSizeMap[size]} minified />}\n {!status && IconLeft && <IconLeft size={iconSizeMap[size]} />}\n {label}\n {IconRight && (\n <IconRight\n size={iconSizeMap[size]}\n {...(onRightIconClick\n ? {\n as: 'button',\n role: 'button',\n type: 'button',\n onClick: onRightIconClick,\n className: cnChip('IconButton', [cnMixFocus()]),\n ref: iconButtonRef,\n tabIndex: -1,\n }\n : {})}\n />\n )}\n </Tag>\n );\n },\n);\n"],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ChipsItem';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../src/components/ChipsCanary/ChipsItem/index.ts"],"sourcesContent":["export * from './ChipsItem';\n"],"mappings":"AAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ChipsDefaultItem, ChipsPropGetItemActive, ChipsPropGetItemAs, ChipsPropGetItemAttributes, ChipsPropGetItemIconLeft, ChipsPropGetItemIconRight, ChipsPropGetItemLabel, ChipsPropGetItemRef, ChipsPropGetItemStatus, ChipsProps } from './types';
|
|
3
|
+
export declare const defaultGetItemIconRight: ChipsPropGetItemIconRight<ChipsDefaultItem>;
|
|
4
|
+
export declare const defaultGetItemActive: ChipsPropGetItemActive<ChipsDefaultItem>;
|
|
5
|
+
export declare const defaultGetItemIconLeft: ChipsPropGetItemIconLeft<ChipsDefaultItem>;
|
|
6
|
+
export declare const defaultGetItemStatus: ChipsPropGetItemStatus<ChipsDefaultItem>;
|
|
7
|
+
export declare const defaultGetItemLabel: ChipsPropGetItemLabel<ChipsDefaultItem>;
|
|
8
|
+
export declare const defaultGetItemAs: ChipsPropGetItemAs<ChipsDefaultItem>;
|
|
9
|
+
export declare const defaultGetItemAttributes: ChipsPropGetItemAttributes<ChipsDefaultItem>;
|
|
10
|
+
export declare const defaultGetItemRef: ChipsPropGetItemRef<ChipsDefaultItem>;
|
|
11
|
+
export declare function withDefaultGetters<ITEM>(props: ChipsProps<ITEM>): {
|
|
12
|
+
size?: "m" | "s" | "xs" | "l" | undefined;
|
|
13
|
+
activeView?: "primary" | "secondary" | undefined;
|
|
14
|
+
items: ITEM[];
|
|
15
|
+
interactive?: boolean | undefined;
|
|
16
|
+
getItemStatus?: ChipsPropGetItemStatus<ITEM> | undefined;
|
|
17
|
+
getItemLabel?: ChipsPropGetItemLabel<ITEM> | undefined;
|
|
18
|
+
getItemIconLeft?: ChipsPropGetItemIconLeft<ITEM> | undefined;
|
|
19
|
+
getItemIconRight?: ChipsPropGetItemIconRight<ITEM> | undefined;
|
|
20
|
+
getItemRef?: ChipsPropGetItemRef<ITEM> | undefined;
|
|
21
|
+
getItemAs?: ChipsPropGetItemAs<ITEM> | undefined;
|
|
22
|
+
getItemAttributes?: ChipsPropGetItemAttributes<ITEM> | undefined;
|
|
23
|
+
getItemActive?: ChipsPropGetItemActive<ITEM> | undefined;
|
|
24
|
+
onItemClick?: import("./types").ChipsPropOnItemClick<ITEM> | undefined;
|
|
25
|
+
onItemRightIconClick?: import("./types").ChipsPropItemOnRightIconClick<ITEM> | undefined;
|
|
26
|
+
} & Omit<import("react").HTMLAttributes<HTMLDivElement>, "css" | "size" | "items" | "getItemLabel" | "getItemStatus" | "onItemClick" | "getItemActive" | "getItemAs" | "getItemAttributes" | "getItemRef" | "interactive" | "getItemIconLeft" | "getItemIconRight" | "activeView" | "onItemRightIconClick"> & import("react").RefAttributes<HTMLDivElement> & (ITEM extends {
|
|
27
|
+
label: string;
|
|
28
|
+
} ? {} : {
|
|
29
|
+
getItemLabel: ChipsPropGetItemLabel<ITEM>;
|
|
30
|
+
}) & {
|
|
31
|
+
getItemLabel: ChipsPropGetItemLabel<ChipsDefaultItem> | ChipsPropGetItemLabel<ITEM>;
|
|
32
|
+
getItemIconRight: ChipsPropGetItemIconRight<ChipsDefaultItem> | ChipsPropGetItemIconRight<ITEM>;
|
|
33
|
+
getItemIconLeft: ChipsPropGetItemIconLeft<ChipsDefaultItem> | ChipsPropGetItemIconLeft<ITEM>;
|
|
34
|
+
getItemStatus: ChipsPropGetItemStatus<ChipsDefaultItem> | ChipsPropGetItemStatus<ITEM>;
|
|
35
|
+
getItemRef: ChipsPropGetItemRef<ChipsDefaultItem> | ChipsPropGetItemRef<ITEM>;
|
|
36
|
+
getItemAs: ChipsPropGetItemAs<ChipsDefaultItem> | ChipsPropGetItemAs<ITEM>;
|
|
37
|
+
getItemAttributes: ChipsPropGetItemAttributes<ChipsDefaultItem> | ChipsPropGetItemAttributes<ITEM>;
|
|
38
|
+
getItemActive: ChipsPropGetItemActive<ChipsDefaultItem> | ChipsPropGetItemActive<ITEM>;
|
|
39
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import _defineProperty from"@babel/runtime/helpers/defineProperty";function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}export var defaultGetItemIconRight=function(a){return a.iconRight};export var defaultGetItemActive=function(a){return a.active};export var defaultGetItemIconLeft=function(a){return a.iconLeft};export var defaultGetItemStatus=function(a){return a.status};export var defaultGetItemLabel=function(a){return a.label};export var defaultGetItemAs=function(a){return a.as};export var defaultGetItemAttributes=function(a){return a.attributes};export var defaultGetItemRef=function(a){return a.ref};export function withDefaultGetters(a){return _objectSpread(_objectSpread({},a),{},{getItemLabel:a.getItemLabel||defaultGetItemLabel,getItemIconRight:a.getItemIconRight||defaultGetItemIconRight,getItemIconLeft:a.getItemIconLeft||defaultGetItemIconLeft,getItemStatus:a.getItemStatus||defaultGetItemStatus,getItemRef:a.getItemRef||defaultGetItemRef,getItemAs:a.getItemAs||defaultGetItemAs,getItemAttributes:a.getItemAttributes||defaultGetItemAttributes,getItemActive:a.getItemActive||defaultGetItemActive})}
|
|
2
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","names":["defaultGetItemIconRight","item","iconRight","defaultGetItemActive","active","defaultGetItemIconLeft","iconLeft","defaultGetItemStatus","status","defaultGetItemLabel","label","defaultGetItemAs","as","defaultGetItemAttributes","attributes","defaultGetItemRef","ref","withDefaultGetters","props","getItemLabel","getItemIconRight","getItemIconLeft","getItemStatus","getItemRef","getItemAs","getItemAttributes","getItemActive"],"sources":["../../../../../src/components/ChipsCanary/helpers.ts"],"sourcesContent":["import {\n ChipsDefaultItem,\n ChipsPropGetItemActive,\n ChipsPropGetItemAs,\n ChipsPropGetItemAttributes,\n ChipsPropGetItemIconLeft,\n ChipsPropGetItemIconRight,\n ChipsPropGetItemLabel,\n ChipsPropGetItemRef,\n ChipsPropGetItemStatus,\n ChipsProps,\n} from './types';\n\nexport const defaultGetItemIconRight: ChipsPropGetItemIconRight<\n ChipsDefaultItem\n> = (item) => item.iconRight;\nexport const defaultGetItemActive: ChipsPropGetItemActive<ChipsDefaultItem> = (\n item,\n) => item.active;\nexport const defaultGetItemIconLeft: ChipsPropGetItemIconLeft<\n ChipsDefaultItem\n> = (item) => item.iconLeft;\nexport const defaultGetItemStatus: ChipsPropGetItemStatus<ChipsDefaultItem> = (\n item,\n) => item.status;\nexport const defaultGetItemLabel: ChipsPropGetItemLabel<ChipsDefaultItem> = (\n item,\n) => item.label;\nexport const defaultGetItemAs: ChipsPropGetItemAs<ChipsDefaultItem> = (item) =>\n item.as;\nexport const defaultGetItemAttributes: ChipsPropGetItemAttributes<\n ChipsDefaultItem\n> = (item) => item.attributes;\nexport const defaultGetItemRef: ChipsPropGetItemRef<ChipsDefaultItem> = (\n item,\n) => item.ref;\n\nexport function withDefaultGetters<ITEM>(props: ChipsProps<ITEM>) {\n return {\n ...props,\n getItemLabel: props.getItemLabel || defaultGetItemLabel,\n getItemIconRight: props.getItemIconRight || defaultGetItemIconRight,\n getItemIconLeft: props.getItemIconLeft || defaultGetItemIconLeft,\n getItemStatus: props.getItemStatus || defaultGetItemStatus,\n getItemRef: props.getItemRef || defaultGetItemRef,\n getItemAs: props.getItemAs || defaultGetItemAs,\n getItemAttributes: props.getItemAttributes || defaultGetItemAttributes,\n getItemActive: props.getItemActive || defaultGetItemActive,\n };\n}\n"],"mappings":"qqBAaA,MAAO,IAAMA,wBAEZ,CAAG,SAACC,CAAD,QAAUA,EAAI,CAACC,SAAf,CAFG,CAGP,MAAO,IAAMC,qBAA8D,CAAG,SAC5EF,CAD4E,QAEzEA,EAAI,CAACG,MAFoE,CAAvE,CAGP,MAAO,IAAMC,uBAEZ,CAAG,SAACJ,CAAD,QAAUA,EAAI,CAACK,QAAf,CAFG,CAGP,MAAO,IAAMC,qBAA8D,CAAG,SAC5EN,CAD4E,QAEzEA,EAAI,CAACO,MAFoE,CAAvE,CAGP,MAAO,IAAMC,oBAA4D,CAAG,SAC1ER,CAD0E,QAEvEA,EAAI,CAACS,KAFkE,CAArE,CAGP,MAAO,IAAMC,iBAAsD,CAAG,SAACV,CAAD,QACpEA,EAAI,CAACW,EAD+D,CAA/D,CAEP,MAAO,IAAMC,yBAEZ,CAAG,SAACZ,CAAD,QAAUA,EAAI,CAACa,UAAf,CAFG,CAGP,MAAO,IAAMC,kBAAwD,CAAG,SACtEd,CADsE,QAEnEA,EAAI,CAACe,GAF8D,CAAjE,CAIP,MAAO,SAASC,mBAAT,CAAkCC,CAAlC,CAA2D,CAChE,sCACKA,CADL,MAEEC,YAAY,CAAED,CAAK,CAACC,YAAN,EAAsBV,mBAFtC,CAGEW,gBAAgB,CAAEF,CAAK,CAACE,gBAAN,EAA0BpB,uBAH9C,CAIEqB,eAAe,CAAEH,CAAK,CAACG,eAAN,EAAyBhB,sBAJ5C,CAKEiB,aAAa,CAAEJ,CAAK,CAACI,aAAN,EAAuBf,oBALxC,CAMEgB,UAAU,CAAEL,CAAK,CAACK,UAAN,EAAoBR,iBANlC,CAOES,SAAS,CAAEN,CAAK,CAACM,SAAN,EAAmBb,gBAPhC,CAQEc,iBAAiB,CAAEP,CAAK,CAACO,iBAAN,EAA2BZ,wBARhD,CASEa,aAAa,CAAER,CAAK,CAACQ,aAAN,EAAuBvB,oBATxC,EAWD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../src/components/ChipsCanary/index.ts"],"sourcesContent":["export * from './ChipsCanary';\nexport * from './ChipsChoice';\nexport * from './ChipsItem';\nexport * from './types';\n"],"mappings":"AAAA,2BACA,2BACA,yBACA"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IconComponent } from '@consta/icons/Icon';
|
|
3
|
+
import { badgePropStatus } from "../Badge";
|
|
4
|
+
import { PropsWithHTMLAttributesAndRef } from "../../utils/types/PropsWithHTMLAttributes";
|
|
5
|
+
export declare const chipsPropSize: readonly ["xs", "s", "m", "l"];
|
|
6
|
+
export declare type ChipsPropSize = typeof chipsPropSize[number];
|
|
7
|
+
export declare const chipsPropSizeDefault: ChipsPropSize;
|
|
8
|
+
export declare const chipsPropActiveView: readonly ["primary", "secondary"];
|
|
9
|
+
export declare type ChipsPropActiveView = typeof chipsPropActiveView[number];
|
|
10
|
+
export declare const chipsPropActiveViewDefault: ChipsPropActiveView;
|
|
11
|
+
export declare type ChipsPropStatus = typeof badgePropStatus[number];
|
|
12
|
+
export declare type ChipsItemProps = {
|
|
13
|
+
size?: ChipsPropSize;
|
|
14
|
+
activeView?: ChipsPropActiveView;
|
|
15
|
+
interactive?: boolean;
|
|
16
|
+
onRightIconClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
17
|
+
iconLeft?: IconComponent;
|
|
18
|
+
iconRight?: IconComponent;
|
|
19
|
+
status?: ChipsPropStatus;
|
|
20
|
+
label: string;
|
|
21
|
+
active?: boolean;
|
|
22
|
+
};
|
|
23
|
+
export declare type ChipsDefaultItem = Omit<ChipsItemProps, 'size' | 'activeView' | 'interactive' | 'onRightIconClick'> & {
|
|
24
|
+
attributes?: Omit<JSX.IntrinsicElements[keyof JSX.IntrinsicElements], 'children' | 'ref'>;
|
|
25
|
+
as?: keyof JSX.IntrinsicElements;
|
|
26
|
+
ref?: React.RefObject<HTMLElement>;
|
|
27
|
+
};
|
|
28
|
+
export declare type ChipsPropGetItemStatus<ITEM> = (item: ITEM) => ChipsDefaultItem['status'];
|
|
29
|
+
export declare type ChipsPropGetItemLabel<ITEM> = (item: ITEM) => ChipsDefaultItem['label'];
|
|
30
|
+
export declare type ChipsPropGetItemIconLeft<ITEM> = (item: ITEM) => ChipsDefaultItem['iconLeft'];
|
|
31
|
+
export declare type ChipsPropGetItemIconRight<ITEM> = (item: ITEM) => ChipsDefaultItem['iconRight'];
|
|
32
|
+
export declare type ChipsPropGetItemRef<ITEM> = (item: ITEM) => ChipsDefaultItem['ref'];
|
|
33
|
+
export declare type ChipsPropGetItemAs<ITEM> = (item: ITEM) => ChipsDefaultItem['as'];
|
|
34
|
+
export declare type ChipsPropGetItemAttributes<ITEM> = (item: ITEM) => ChipsDefaultItem['attributes'];
|
|
35
|
+
export declare type ChipsPropGetItemActive<ITEM> = (item: ITEM) => ChipsDefaultItem['active'];
|
|
36
|
+
export declare type ChipsPropOnItemClick<ITEM> = (item: ITEM, props: {
|
|
37
|
+
e: React.MouseEvent;
|
|
38
|
+
}) => void;
|
|
39
|
+
export declare type ChipsPropItemOnRightIconClick<ITEM> = (item: ITEM, props: {
|
|
40
|
+
e: React.MouseEvent;
|
|
41
|
+
}) => void;
|
|
42
|
+
export declare type ChipsProps<ITEM = ChipsDefaultItem> = PropsWithHTMLAttributesAndRef<{
|
|
43
|
+
size?: ChipsPropSize;
|
|
44
|
+
activeView?: ChipsPropActiveView;
|
|
45
|
+
items: ITEM[];
|
|
46
|
+
interactive?: boolean;
|
|
47
|
+
getItemStatus?: ChipsPropGetItemStatus<ITEM>;
|
|
48
|
+
getItemLabel?: ChipsPropGetItemLabel<ITEM>;
|
|
49
|
+
getItemIconLeft?: ChipsPropGetItemIconLeft<ITEM>;
|
|
50
|
+
getItemIconRight?: ChipsPropGetItemIconRight<ITEM>;
|
|
51
|
+
getItemRef?: ChipsPropGetItemRef<ITEM>;
|
|
52
|
+
getItemAs?: ChipsPropGetItemAs<ITEM>;
|
|
53
|
+
getItemAttributes?: ChipsPropGetItemAttributes<ITEM>;
|
|
54
|
+
getItemActive?: ChipsPropGetItemActive<ITEM>;
|
|
55
|
+
onItemClick?: ChipsPropOnItemClick<ITEM>;
|
|
56
|
+
onItemRightIconClick?: ChipsPropItemOnRightIconClick<ITEM>;
|
|
57
|
+
}, HTMLDivElement> & (ITEM extends {
|
|
58
|
+
label: string;
|
|
59
|
+
} ? {} : {
|
|
60
|
+
getItemLabel: ChipsPropGetItemLabel<ITEM>;
|
|
61
|
+
});
|
|
62
|
+
export declare type ChipsComponent = <ITEM = ChipsDefaultItem>(props: ChipsProps<ITEM>) => React.ReactElement | null;
|