@skbkontur/react-ui 4.16.0-next.0 → 4.16.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/cjs/components/Button/getInnerLinkTheme.js +0 -3
- package/cjs/components/Button/getInnerLinkTheme.js.map +1 -1
- package/cjs/components/Calendar/DayCellView.js +1 -1
- package/cjs/components/Calendar/DayCellView.js.map +1 -1
- package/cjs/components/Calendar/DayCellView.styles.d.ts +1 -1
- package/cjs/components/Calendar/DayCellView.styles.js +4 -4
- package/cjs/components/Calendar/DayCellView.styles.js.map +1 -1
- package/cjs/components/DropdownMenu/DropdownMenu.d.ts +1 -1
- package/cjs/components/DropdownMenu/DropdownMenu.js +4 -1
- package/cjs/components/DropdownMenu/DropdownMenu.js.map +1 -1
- package/cjs/components/DropdownMenu/DropdownMenu.md +28 -0
- package/cjs/components/Kebab/Kebab.d.ts +1 -1
- package/cjs/components/Kebab/Kebab.js +4 -1
- package/cjs/components/Kebab/Kebab.js.map +1 -1
- package/cjs/components/Kebab/Kebab.md +28 -0
- package/cjs/components/Link/Link.js +4 -2
- package/cjs/components/Link/Link.js.map +1 -1
- package/cjs/components/Link/Link.mixins.d.ts +1 -2
- package/cjs/components/Link/Link.mixins.js +4 -16
- package/cjs/components/Link/Link.mixins.js.map +1 -1
- package/cjs/components/Link/Link.styles.d.ts +2 -0
- package/cjs/components/Link/Link.styles.js +56 -38
- package/cjs/components/Link/Link.styles.js.map +1 -1
- package/cjs/components/Modal/ModalFooter.js +1 -1
- package/cjs/components/Modal/ModalFooter.js.map +1 -1
- package/cjs/components/Modal/ModalHeader.js +1 -1
- package/cjs/components/Modal/ModalHeader.js.map +1 -1
- package/cjs/components/TooltipMenu/TooltipMenu.d.ts +1 -1
- package/cjs/components/TooltipMenu/TooltipMenu.js +6 -1
- package/cjs/components/TooltipMenu/TooltipMenu.js.map +1 -1
- package/cjs/components/TooltipMenu/TooltipMenu.md +28 -0
- package/cjs/internal/CustomComboBox/CustomComboBox.js +14 -8
- package/cjs/internal/CustomComboBox/CustomComboBox.js.map +1 -1
- package/cjs/internal/InternalMenu/InternalMenu.d.ts +9 -4
- package/cjs/internal/InternalMenu/InternalMenu.js +8 -4
- package/cjs/internal/InternalMenu/InternalMenu.js.map +1 -1
- package/cjs/internal/InternalMenu/isIconPaddingEnabled.d.ts +2 -0
- package/cjs/internal/InternalMenu/isIconPaddingEnabled.js +9 -0
- package/cjs/internal/InternalMenu/isIconPaddingEnabled.js.map +1 -0
- package/cjs/internal/Menu/Menu.d.ts +2 -1
- package/cjs/internal/Menu/Menu.js +3 -3
- package/cjs/internal/Menu/Menu.js.map +1 -1
- package/cjs/internal/PopupMenu/PopupMenu.d.ts +2 -1
- package/cjs/internal/PopupMenu/PopupMenu.js +2 -1
- package/cjs/internal/PopupMenu/PopupMenu.js.map +1 -1
- package/cjs/internal/ThemeShowcase/VariablesCollector.d.ts +1 -1
- package/cjs/internal/themes/DefaultTheme.d.ts +0 -15
- package/cjs/internal/themes/DefaultTheme.js +2 -47
- package/cjs/internal/themes/DefaultTheme.js.map +1 -1
- package/cjs/internal/themes/Theme2022.d.ts +0 -3
- package/cjs/internal/themes/Theme2022.js +2 -11
- package/cjs/internal/themes/Theme2022.js.map +1 -1
- package/cjs/typings/html.d.ts +0 -1
- package/components/Button/getInnerLinkTheme/getInnerLinkTheme.js +0 -3
- package/components/Button/getInnerLinkTheme/getInnerLinkTheme.js.map +1 -1
- package/components/Calendar/DayCellView/DayCellView.js +1 -1
- package/components/Calendar/DayCellView/DayCellView.js.map +1 -1
- package/components/Calendar/DayCellView.styles/DayCellView.styles.js +2 -2
- package/components/Calendar/DayCellView.styles/DayCellView.styles.js.map +1 -1
- package/components/Calendar/DayCellView.styles.d.ts +1 -1
- package/components/DropdownMenu/DropdownMenu/DropdownMenu.js +1 -0
- package/components/DropdownMenu/DropdownMenu/DropdownMenu.js.map +1 -1
- package/components/DropdownMenu/DropdownMenu.d.ts +1 -1
- package/components/DropdownMenu/DropdownMenu.md +28 -0
- package/components/Kebab/Kebab/Kebab.js +1 -0
- package/components/Kebab/Kebab/Kebab.js.map +1 -1
- package/components/Kebab/Kebab.d.ts +1 -1
- package/components/Kebab/Kebab.md +28 -0
- package/components/Link/Link/Link.js +4 -4
- package/components/Link/Link/Link.js.map +1 -1
- package/components/Link/Link.mixins/Link.mixins.js +2 -5
- package/components/Link/Link.mixins/Link.mixins.js.map +1 -1
- package/components/Link/Link.mixins.d.ts +1 -2
- package/components/Link/Link.styles/Link.styles.js +28 -21
- package/components/Link/Link.styles/Link.styles.js.map +1 -1
- package/components/Link/Link.styles.d.ts +2 -0
- package/components/Modal/ModalFooter/ModalFooter.js +1 -1
- package/components/Modal/ModalFooter/ModalFooter.js.map +1 -1
- package/components/Modal/ModalHeader/ModalHeader.js +1 -1
- package/components/Modal/ModalHeader/ModalHeader.js.map +1 -1
- package/components/TooltipMenu/TooltipMenu/TooltipMenu.js +5 -1
- package/components/TooltipMenu/TooltipMenu/TooltipMenu.js.map +1 -1
- package/components/TooltipMenu/TooltipMenu.d.ts +1 -1
- package/components/TooltipMenu/TooltipMenu.md +28 -0
- package/internal/CustomComboBox/CustomComboBox/CustomComboBox.js +20 -7
- package/internal/CustomComboBox/CustomComboBox/CustomComboBox.js.map +1 -1
- package/internal/InternalMenu/InternalMenu/InternalMenu.js +2 -3
- package/internal/InternalMenu/InternalMenu/InternalMenu.js.map +1 -1
- package/internal/InternalMenu/InternalMenu.d.ts +9 -4
- package/internal/InternalMenu/isIconPaddingEnabled/isIconPaddingEnabled.js +6 -0
- package/internal/InternalMenu/isIconPaddingEnabled/isIconPaddingEnabled.js.map +1 -0
- package/internal/InternalMenu/isIconPaddingEnabled/package.json +6 -0
- package/internal/InternalMenu/isIconPaddingEnabled.d.ts +2 -0
- package/internal/Menu/Menu/Menu.js +2 -3
- package/internal/Menu/Menu/Menu.js.map +1 -1
- package/internal/Menu/Menu.d.ts +2 -1
- package/internal/PopupMenu/PopupMenu/PopupMenu.js +1 -0
- package/internal/PopupMenu/PopupMenu/PopupMenu.js.map +1 -1
- package/internal/PopupMenu/PopupMenu.d.ts +2 -1
- package/internal/ThemeShowcase/VariablesCollector.d.ts +1 -1
- package/internal/themes/DefaultTheme/DefaultTheme.js +4 -79
- package/internal/themes/DefaultTheme/DefaultTheme.js.map +1 -1
- package/internal/themes/DefaultTheme.d.ts +0 -15
- package/internal/themes/Theme2022/Theme2022.js +5 -20
- package/internal/themes/Theme2022/Theme2022.js.map +1 -1
- package/internal/themes/Theme2022.d.ts +0 -3
- package/package.json +2 -2
- package/typings/html.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [4.16.0-next.1](https://github.com/skbkontur/retail-ui/compare/@skbkontur/react-ui@4.15.1...@skbkontur/react-ui@4.16.0-next.1) (2023-07-04)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **Calendar:** return customization of current day border in theme 2022 ([#3186](https://github.com/skbkontur/retail-ui/issues/3186)) ([1595e1d](https://github.com/skbkontur/retail-ui/commit/1595e1df80d72d42116f9604b44565733ce4895f))
|
|
12
|
+
* **DropdownMenu,TooltipMenu,Kebab:** add preventIconsOffset prop ([beb6f90](https://github.com/skbkontur/retail-ui/commit/beb6f900f0e4c7c4b9e79d86f8b0066ae75b400d))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
6
18
|
# [4.16.0-next.0](https://github.com/skbkontur/retail-ui/compare/@skbkontur/react-ui@4.15.0...@skbkontur/react-ui@4.16.0-next.0) (2023-06-13)
|
|
7
19
|
|
|
8
20
|
**Note:** Version bump only for package @skbkontur/react-ui
|
|
@@ -11,6 +23,21 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
11
23
|
|
|
12
24
|
|
|
13
25
|
|
|
26
|
+
## [4.15.1](https://github.com/skbkontur/retail-ui/compare/@skbkontur/react-ui@4.15.0...@skbkontur/react-ui@4.15.1) (2023-07-04)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Bug Fixes
|
|
30
|
+
|
|
31
|
+
* allow use inherit as a linkColor ([#3185](https://github.com/skbkontur/retail-ui/issues/3185)) ([09218bb](https://github.com/skbkontur/retail-ui/commit/09218bb9bce9746e25b1894b9c3631e0a0b44785))
|
|
32
|
+
* **ComboBox:** flushSync throws an error into console ([#3189](https://github.com/skbkontur/retail-ui/issues/3189)) ([8e0d2d2](https://github.com/skbkontur/retail-ui/commit/8e0d2d20f2bd5e5f034841a8057ce4a06012d23b))
|
|
33
|
+
* **html:** get rid of type duplication ([#3188](https://github.com/skbkontur/retail-ui/issues/3188)) ([5de46a4](https://github.com/skbkontur/retail-ui/commit/5de46a4aef7728239f417c225235f9a97ec23cac))
|
|
34
|
+
* **Modal.Header, Modal.Footer:** passing common props ([#3187](https://github.com/skbkontur/retail-ui/issues/3187)) ([4aa327b](https://github.com/skbkontur/retail-ui/commit/4aa327b9b457912591c57b83342e722ae0802506))
|
|
35
|
+
* **theme:** add missing units to values ([#3184](https://github.com/skbkontur/retail-ui/issues/3184)) ([885a372](https://github.com/skbkontur/retail-ui/commit/885a372d8d6b5e3df3894cfee8f59ed685b0c056))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
14
41
|
# [4.15.0](https://github.com/skbkontur/retail-ui/compare/@skbkontur/react-ui@4.14.2...@skbkontur/react-ui@4.15.0) (2023-06-13)
|
|
15
42
|
|
|
16
43
|
|
|
@@ -4,11 +4,8 @@
|
|
|
4
4
|
var getInnerLinkTheme = function getInnerLinkTheme(theme) {
|
|
5
5
|
return _ThemeFactory.ThemeFactory.create(
|
|
6
6
|
{
|
|
7
|
-
linkLineBorderBottomColor: theme.btnLinkLineBorderBottomColor,
|
|
8
7
|
linkLineBorderBottomStyle: theme.btnLinkLineBorderBottomStyle,
|
|
9
8
|
linkLineBorderBottomWidth: theme.btnLinkLineBorderBottomWidth,
|
|
10
|
-
linkLineHoverBorderBottomColor: theme.btnLinkLineHoverBorderBottomColor,
|
|
11
|
-
linkLineActiveBorderBottomColor: theme.btnLinkLineActiveBorderBottomColor,
|
|
12
9
|
linkDisabledColor: theme.btnLinkDisabledColor },
|
|
13
10
|
|
|
14
11
|
theme);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["getInnerLinkTheme.ts"],"names":["getInnerLinkTheme","theme","ThemeFactory","create","
|
|
1
|
+
{"version":3,"sources":["getInnerLinkTheme.ts"],"names":["getInnerLinkTheme","theme","ThemeFactory","create","linkLineBorderBottomStyle","btnLinkLineBorderBottomStyle","linkLineBorderBottomWidth","btnLinkLineBorderBottomWidth","linkDisabledColor","btnLinkDisabledColor"],"mappings":"0EAAA;;;AAGO,IAAMA,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,KAAD,EAAyB;AACxD,SAAOC,2BAAaC,MAAb;AACL;AACEC,IAAAA,yBAAyB,EAAEH,KAAK,CAACI,4BADnC;AAEEC,IAAAA,yBAAyB,EAAEL,KAAK,CAACM,4BAFnC;AAGEC,IAAAA,iBAAiB,EAAEP,KAAK,CAACQ,oBAH3B,EADK;;AAMLR,EAAAA,KANK,CAAP;;AAQD,CATM,C","sourcesContent":["import { ThemeFactory } from '../../lib/theming/ThemeFactory';\nimport { Theme } from '../../lib/theming/Theme';\n\nexport const getInnerLinkTheme = (theme: Theme): Theme => {\n return ThemeFactory.create(\n {\n linkLineBorderBottomStyle: theme.btnLinkLineBorderBottomStyle,\n linkLineBorderBottomWidth: theme.btnLinkLineBorderBottomWidth,\n linkDisabledColor: theme.btnLinkDisabledColor,\n },\n theme,\n );\n};\n"]}
|
|
@@ -43,7 +43,7 @@ function DayCellView(props) {var _cx;
|
|
|
43
43
|
className: (0, _Emotion.cx)((_cx = {}, _cx[
|
|
44
44
|
_DayCellView.styles.cell(theme)] = true, _cx[
|
|
45
45
|
_DayCellView.styles.today(theme)] = isToday && !_isTheme2022, _cx[
|
|
46
|
-
_DayCellView.styles.today2022()] = isToday && _isTheme2022, _cx[
|
|
46
|
+
_DayCellView.styles.today2022(theme)] = isToday && _isTheme2022, _cx[
|
|
47
47
|
_DayCellView.styles.selected(theme)] = Boolean(value && CDS.isEqual(date, value)), _cx[
|
|
48
48
|
_DayCellView.styles.weekend(theme)] = Boolean(isWeekend), _cx)),
|
|
49
49
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DayCellView.tsx"],"names":["DayCellView","props","date","minDate","maxDate","today","value","isWeekend","onDateClick","theme","ThemeContext","_isTheme2022","handleClick","month","year","child","globalClasses","todayCaption","styles","isToday","Boolean","CDS","isEqual","isBetween","cell","today2022","selected","weekend"],"mappings":"yEAAA;;;AAGA;AACA;AACA;;AAEA;AACA,mD;;;;;;;;;;;;AAYO,SAASA,WAAT,CAAqBC,KAArB,EAA8C;AACnD,MAAQC,IAAR,GAAyED,KAAzE,CAAQC,IAAR,CAAcC,OAAd,GAAyEF,KAAzE,CAAcE,OAAd,CAAuBC,OAAvB,GAAyEH,KAAzE,CAAuBG,OAAvB,CAAgCC,KAAhC,GAAyEJ,KAAzE,CAAgCI,KAAhC,CAAuCC,KAAvC,GAAyEL,KAAzE,CAAuCK,KAAvC,CAA8CC,SAA9C,GAAyEN,KAAzE,CAA8CM,SAA9C,CAAyDC,WAAzD,GAAyEP,KAAzE,CAAyDO,WAAzD;AACA,MAAMC,KAAK,GAAG,uBAAWC,0BAAX,CAAd;AACA,MAAMC,YAAY,GAAG,+BAAYF,KAAZ,CAArB;;AAEA,MAAMG,WAAW,GAAG,SAAdA,WAAc,GAAM;AACxB,sBAA8BX,KAAK,CAACC,IAApC,CAAQA,IAAR,eAAQA,IAAR,CAAcW,KAAd,eAAcA,KAAd,CAAqBC,IAArB,eAAqBA,IAArB;AACAN,IAAAA,WAAW,QAAX,YAAAA,WAAW,CAAG,EAAEN,IAAI,EAAJA,IAAF,EAAQW,KAAK,EAALA,KAAR,EAAeC,IAAI,EAAJA,IAAf,EAAH,CAAX;AACD,GAHD;;AAKA,MAAMC,KAAK,GAAGJ,YAAY;AACxB,yCAAM,SAAS,EAAE,iBAAGK,2BAAcC,YAAjB,EAA+BC,oBAAOD,YAAP,EAA/B,CAAjB,IAAyEf,IAAI,CAACA,IAA9E,CADwB;;AAGxBA,EAAAA,IAAI,CAACA,IAHP;;;AAMA,MAAMiB,OAAO,GAAGC,OAAO,CAACf,KAAK,IAAIgB,GAAG,CAACC,OAAJ,CAAYpB,IAAZ,EAAkBG,KAAlB,CAAV,CAAvB;;AAEA;AACE;AACE,MAAA,QAAQ,EAAE,CAAC,CADb;AAEE,MAAA,QAAQ,EAAE,CAACgB,GAAG,CAACE,SAAJ,CAAcrB,IAAd,EAAoBC,OAApB,EAA6BC,OAA7B,CAFb;AAGE,MAAA,SAAS,EAAE;AACRc,0BAAOM,IAAP,CAAYf,KAAZ,CADQ,IACa,IADb;AAERS,0BAAOb,KAAP,CAAaI,KAAb,CAFQ,IAEcU,OAAO,IAAI,CAACR,YAF1B;AAGRO,0BAAOO,SAAP,
|
|
1
|
+
{"version":3,"sources":["DayCellView.tsx"],"names":["DayCellView","props","date","minDate","maxDate","today","value","isWeekend","onDateClick","theme","ThemeContext","_isTheme2022","handleClick","month","year","child","globalClasses","todayCaption","styles","isToday","Boolean","CDS","isEqual","isBetween","cell","today2022","selected","weekend"],"mappings":"yEAAA;;;AAGA;AACA;AACA;;AAEA;AACA,mD;;;;;;;;;;;;AAYO,SAASA,WAAT,CAAqBC,KAArB,EAA8C;AACnD,MAAQC,IAAR,GAAyED,KAAzE,CAAQC,IAAR,CAAcC,OAAd,GAAyEF,KAAzE,CAAcE,OAAd,CAAuBC,OAAvB,GAAyEH,KAAzE,CAAuBG,OA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AAjB,CAHQ,IAGkBU,OAAO,IAAIR,YAH7B;AAIRO,0BAAOQ,QAAP,CAAgBjB,KAAhB,CAJQ,IAIiBW,OAAO,CAACd,KAAK,IAAIe,GAAG,CAACC,OAAJ,CAAYpB,IAAZ,EAAkBI,KAAlB,CAAV,CAJxB;AAKRY,0BAAOS,OAAP,CAAelB,KAAf,CALQ,IAKgBW,OAAO,CAACb,SAAD,CALvB,OAHb;;AAUE,MAAA,OAAO,EAAEK,WAVX;;AAYGG,IAAAA,KAZH,CADF;;;AAgBD","sourcesContent":["import React, { useContext } from 'react';\n\nimport { Nullable } from '../../typings/utility-types';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { cx } from '../../lib/theming/Emotion';\nimport { isTheme2022 } from '../../lib/theming/ThemeHelpers';\n\nimport * as CDS from './CalendarDateShape';\nimport { globalClasses, styles } from './DayCellView.styles';\n\ninterface DayCellViewProps {\n date: CDS.CalendarDateShape;\n today?: CDS.CalendarDateShape;\n value?: Nullable<CDS.CalendarDateShape>;\n minDate?: CDS.CalendarDateShape;\n maxDate?: CDS.CalendarDateShape;\n onDateClick?: (day: CDS.CalendarDateShape) => void;\n isWeekend?: boolean;\n}\n\nexport function DayCellView(props: DayCellViewProps) {\n const { date, minDate, maxDate, today, value, isWeekend, onDateClick } = props;\n const theme = useContext(ThemeContext);\n const _isTheme2022 = isTheme2022(theme);\n\n const handleClick = () => {\n const { date, month, year } = props.date;\n onDateClick?.({ date, month, year });\n };\n\n const child = _isTheme2022 ? (\n <span className={cx(globalClasses.todayCaption, styles.todayCaption())}>{date.date}</span>\n ) : (\n date.date\n );\n\n const isToday = Boolean(today && CDS.isEqual(date, today));\n\n return (\n <button\n tabIndex={-1}\n disabled={!CDS.isBetween(date, minDate, maxDate)}\n className={cx({\n [styles.cell(theme)]: true,\n [styles.today(theme)]: isToday && !_isTheme2022,\n [styles.today2022(theme)]: isToday && _isTheme2022,\n [styles.selected(theme)]: Boolean(value && CDS.isEqual(date, value)),\n [styles.weekend(theme)]: Boolean(isWeekend),\n })}\n onClick={handleClick}\n >\n {child}\n </button>\n );\n}\n"]}
|
|
@@ -59,10 +59,10 @@ var styles = (0, _Emotion.memoizeStyle)({
|
|
|
59
59
|
|
|
60
60
|
},
|
|
61
61
|
|
|
62
|
-
today2022: function today2022() {
|
|
63
|
-
return (0, _Emotion.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteralLoose2.default)(["\n .", " {\n border-bottom:
|
|
64
|
-
globalClasses.todayCaption
|
|
65
|
-
|
|
62
|
+
today2022: function today2022(t) {
|
|
63
|
+
return (0, _Emotion.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteralLoose2.default)(["\n .", " {\n border-bottom: ", ";\n }\n "])),
|
|
64
|
+
globalClasses.todayCaption,
|
|
65
|
+
t.calendarCellTodayBorder);
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DayCellView.styles.ts"],"names":["globalClasses","todayCaption","styles","cell","t","css","calendarCellBg","calendarCellSize","calendarCellLineHeight","calendarCellHoverBgColor","calendarCellHoverColor","calendarCellActiveHoverColor","selected","calendarCellSelectedBgColor","calendarCellSelectedFontColor","weekend","calendarCellWeekendColor","today","calendarCellTodayBorder","today2022"],"mappings":"oSAAA;;AAEA,iD;;AAEO,IAAMA,aAAa,GAAG,qBAAO,eAAP,EAAwB;AACnDC,EAAAA,YAAY,EAAE,eADqC,EAAxB,CAAtB,C;;;AAIA,IAAMC,MAAM,GAAG,2BAAa;AACjCC,EAAAA,IADiC,gBAC5BC,CAD4B,EAClB;AACb,eAAOC,YAAP;AACI,8BADJ;;AAGgBD,IAAAA,CAAC,CAACE,cAHlB;;;;;;;;;AAYWF,IAAAA,CAAC,CAACG,gBAZb;AAaYH,IAAAA,CAAC,CAACG,gBAbd;AAciBH,IAAAA,CAAC,CAACI,sBAdnB;;;;AAkBwBJ,IAAAA,CAAC,CAACK,wBAlB1B;AAmBaL,IAAAA,CAAC,CAACM,sBAnBf;;;;;;;;AA2BaN,IAAAA,CAAC,CAACO,4BA3Bf;;;AA8BD,GAhCgC;;AAkCjCC,EAAAA,QAlCiC,oBAkCxBR,CAlCwB,EAkCd;AACjB,eAAOC,YAAP;AACsBD,IAAAA,CAAC,CAACS,2BADxB;AAEWT,IAAAA,CAAC,CAACU,6BAFb;;AAID,GAvCgC;;AAyCjCC,EAAAA,OAzCiC,mBAyCzBX,CAzCyB,EAyCf;AAChB,eAAOC,YAAP;AACWD,IAAAA,CAAC,CAACY,wBADb;;AAGD,GA7CgC;;AA+CjCC,EAAAA,KA/CiC,iBA+C3Bb,CA/C2B,EA+CjB;AACd,eAAOC,YAAP;AACYD,IAAAA,CAAC,CAACc,uBADd;;AAGD,GAnDgC;;AAqDjCC,EAAAA,SArDiC,
|
|
1
|
+
{"version":3,"sources":["DayCellView.styles.ts"],"names":["globalClasses","todayCaption","styles","cell","t","css","calendarCellBg","calendarCellSize","calendarCellLineHeight","calendarCellHoverBgColor","calendarCellHoverColor","calendarCellActiveHoverColor","selected","calendarCellSelectedBgColor","calendarCellSelectedFontColor","weekend","calendarCellWeekendColor","today","calendarCellTodayBorder","today2022"],"mappings":"oSAAA;;AAEA,iD;;AAEO,IAAMA,aAAa,GAAG,qBAAO,eAAP,EAAwB;AACnDC,EAAAA,YAAY,EAAE,eADqC,EAAxB,CAAtB,C;;;AAIA,IAAMC,MAAM,GAAG,2BAAa;AACjCC,EAAAA,IADiC,gBAC5BC,CAD4B,EAClB;AACb,eAAOC,YAAP;AACI,8BADJ;;AAGgBD,IAAAA,CAAC,CAACE,cAHlB;;;;;;;;;AAYWF,IAAAA,CAAC,CAACG,gBAZb;AAaYH,IAAAA,CAAC,CAACG,gBAbd;AAciBH,IAAAA,CAAC,CAACI,sBAdnB;;;;AAkBwBJ,IAAAA,CAAC,CAACK,wBAlB1B;AAmBaL,IAAAA,CAAC,CAACM,sBAnBf;;;;;;;;AA2BaN,IAAAA,CAAC,CAACO,4BA3Bf;;;AA8BD,GAhCgC;;AAkCjCC,EAAAA,QAlCiC,oBAkCxBR,CAlCwB,EAkCd;AACjB,eAAOC,YAAP;AACsBD,IAAAA,CAAC,CAACS,2BADxB;AAEWT,IAAAA,CAAC,CAACU,6BAFb;;AAID,GAvCgC;;AAyCjCC,EAAAA,OAzCiC,mBAyCzBX,CAzCyB,EAyCf;AAChB,eAAOC,YAAP;AACWD,IAAAA,CAAC,CAACY,wBADb;;AAGD,GA7CgC;;AA+CjCC,EAAAA,KA/CiC,iBA+C3Bb,CA/C2B,EA+CjB;AACd,eAAOC,YAAP;AACYD,IAAAA,CAAC,CAACc,uBADd;;AAGD,GAnDgC;;AAqDjCC,EAAAA,SArDiC,qBAqDvBf,CArDuB,EAqDb;AAClB,eAAOC,YAAP;AACKL,IAAAA,aAAa,CAACC,YADnB;AAEqBG,IAAAA,CAAC,CAACc,uBAFvB;;;AAKD,GA3DgC;;AA6DjCjB,EAAAA,YA7DiC,0BA6DlB;AACb,eAAOI,YAAP;;;AAGD,GAjEgC,EAAb,CAAf,C","sourcesContent":["import { css, memoizeStyle, prefix } from '../../lib/theming/Emotion';\nimport { Theme } from '../../lib/theming/Theme';\nimport { resetButton } from '../../lib/styles/Mixins';\n\nexport const globalClasses = prefix('day-cell-view')({\n todayCaption: 'today-caption',\n});\n\nexport const styles = memoizeStyle({\n cell(t: Theme) {\n return css`\n ${resetButton()};\n\n background: ${t.calendarCellBg};\n border: 1px solid transparent;\n display: inline-block;\n font-size: 14px;\n padding: 0;\n text-align: center;\n user-select: none;\n position: relative;\n\n width: ${t.calendarCellSize};\n height: ${t.calendarCellSize};\n line-height: ${t.calendarCellLineHeight};\n border-radius: 50%;\n\n &:hover {\n background-color: ${t.calendarCellHoverBgColor};\n color: ${t.calendarCellHoverColor};\n cursor: pointer;\n }\n &:disabled {\n opacity: 0.5;\n pointer-events: none;\n }\n &:active:hover:enabled {\n color: ${t.calendarCellActiveHoverColor};\n }\n `;\n },\n\n selected(t: Theme) {\n return css`\n background-color: ${t.calendarCellSelectedBgColor};\n color: ${t.calendarCellSelectedFontColor};\n `;\n },\n\n weekend(t: Theme) {\n return css`\n color: ${t.calendarCellWeekendColor};\n `;\n },\n\n today(t: Theme) {\n return css`\n border: ${t.calendarCellTodayBorder};\n `;\n },\n\n today2022(t: Theme) {\n return css`\n .${globalClasses.todayCaption} {\n border-bottom: ${t.calendarCellTodayBorder};\n }\n `;\n },\n\n todayCaption() {\n return css`\n padding-bottom: 2px;\n `;\n },\n});\n"]}
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { PopupMenuProps } from '../../internal/PopupMenu';
|
|
3
3
|
import { PopupPositionsType } from '../../internal/Popup';
|
|
4
4
|
import { CommonProps } from '../../internal/CommonWrapper';
|
|
5
|
-
export interface DropdownMenuProps extends CommonProps, Pick<PopupMenuProps, 'onOpen' | 'onClose' | 'popupMenuId'> {
|
|
5
|
+
export interface DropdownMenuProps extends CommonProps, Pick<PopupMenuProps, 'onOpen' | 'onClose' | 'popupMenuId' | 'preventIconsOffset'> {
|
|
6
6
|
/** Максимальная высота меню */
|
|
7
7
|
menuMaxHeight?: React.CSSProperties['maxWidth'];
|
|
8
8
|
/** Ширина меню */
|
|
@@ -54,6 +54,8 @@ var _getDropdownMenuTheme = require("./getDropdownMenuTheme");var _class, _class
|
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
|
|
57
|
+
|
|
58
|
+
|
|
57
59
|
|
|
58
60
|
|
|
59
61
|
|
|
@@ -118,6 +120,7 @@ DropdownMenu = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/
|
|
|
118
120
|
|
|
119
121
|
|
|
120
122
|
|
|
123
|
+
|
|
121
124
|
|
|
122
125
|
|
|
123
126
|
open = function () {
|
|
@@ -132,4 +135,4 @@ DropdownMenu = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/
|
|
|
132
135
|
}
|
|
133
136
|
};_this.
|
|
134
137
|
|
|
135
|
-
refPopupMenu = function (ref) {return _this.popupMenu = ref;};if (!props.caption && !_currentEnvironment.isProductionEnv) {throw new Error('Prop "caption" is required!!!');}return _this;}var _proto = DropdownMenu.prototype;_proto.render = function render() {var _this2 = this;return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Consumer, null, function (theme) {return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Provider, { value: (0, _getDropdownMenuTheme.getDropdownMenuTheme)(theme) }, _this2.renderMain());});};_proto.renderMain = function renderMain() {if (!this.props.caption) {return null;}var _this$getProps = this.getProps(),positions = _this$getProps.positions,disableAnimations = _this$getProps.disableAnimations;return /*#__PURE__*/_react.default.createElement(_CommonWrapper.CommonWrapper, (0, _extends2.default)({ rootNodeRef: this.setRootNode }, this.props), /*#__PURE__*/_react.default.createElement(_PopupMenu.PopupMenu, { ref: this.refPopupMenu, caption: this.props.caption, menuMaxHeight: this.props.menuMaxHeight, menuWidth: this.props.menuWidth, popupHasPin: false, positions: positions, disableAnimations: disableAnimations, header: this.props.header, footer: this.props.footer, width: this.props.width, onClose: this.props.onClose, onOpen: this.props.onOpen, popupMenuId: this.props.popupMenuId }, this.props.children));};return DropdownMenu;}(_react.default.Component), _class2.__KONTUR_REACT_UI__ = 'DropdownMenu', _class2.defaultProps = { disableAnimations: _currentEnvironment.isTestEnv, positions: ['bottom left', 'bottom right', 'top left', 'top right'] }, _temp)) || _class;exports.DropdownMenu = DropdownMenu;
|
|
138
|
+
refPopupMenu = function (ref) {return _this.popupMenu = ref;};if (!props.caption && !_currentEnvironment.isProductionEnv) {throw new Error('Prop "caption" is required!!!');}return _this;}var _proto = DropdownMenu.prototype;_proto.render = function render() {var _this2 = this;return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Consumer, null, function (theme) {return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Provider, { value: (0, _getDropdownMenuTheme.getDropdownMenuTheme)(theme) }, _this2.renderMain());});};_proto.renderMain = function renderMain() {if (!this.props.caption) {return null;}var _this$getProps = this.getProps(),positions = _this$getProps.positions,disableAnimations = _this$getProps.disableAnimations;return /*#__PURE__*/_react.default.createElement(_CommonWrapper.CommonWrapper, (0, _extends2.default)({ rootNodeRef: this.setRootNode }, this.props), /*#__PURE__*/_react.default.createElement(_PopupMenu.PopupMenu, { ref: this.refPopupMenu, caption: this.props.caption, menuMaxHeight: this.props.menuMaxHeight, menuWidth: this.props.menuWidth, preventIconsOffset: this.props.preventIconsOffset, popupHasPin: false, positions: positions, disableAnimations: disableAnimations, header: this.props.header, footer: this.props.footer, width: this.props.width, onClose: this.props.onClose, onOpen: this.props.onOpen, popupMenuId: this.props.popupMenuId }, this.props.children));};return DropdownMenu;}(_react.default.Component), _class2.__KONTUR_REACT_UI__ = 'DropdownMenu', _class2.defaultProps = { disableAnimations: _currentEnvironment.isTestEnv, positions: ['bottom left', 'bottom right', 'top left', 'top right'] }, _temp)) || _class;exports.DropdownMenu = DropdownMenu;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DropdownMenu.tsx"],"names":["DropdownMenu","rootNode","props","getProps","defaultProps","popupMenu","open","close","refPopupMenu","ref","caption","isProductionEnv","Error","render","theme","renderMain","positions","disableAnimations","setRootNode","menuMaxHeight","menuWidth","header","footer","width","onClose","onOpen","popupMenuId","children","React","Component","__KONTUR_REACT_UI__","isTestEnv"],"mappings":"0UAAA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,8D
|
|
1
|
+
{"version":3,"sources":["DropdownMenu.tsx"],"names":["DropdownMenu","rootNode","props","getProps","defaultProps","popupMenu","open","close","refPopupMenu","ref","caption","isProductionEnv","Error","render","theme","renderMain","positions","disableAnimations","setRootNode","menuMaxHeight","menuWidth","preventIconsOffset","header","footer","width","onClose","onOpen","popupMenuId","children","React","Component","__KONTUR_REACT_UI__","isTestEnv"],"mappings":"0UAAA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AA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AAD,2BAAe,WAAW,EAAE,KAAKC,WAAjC,IAAkD,KAAKhB,KAAvD,gBACE,6BAAC,oBAAD,IACE,GAAG,EAAE,KAAKM,YADZ,EAEE,OAAO,EAAE,KAAKN,KAAL,CAAWQ,OAFtB,EAGE,aAAa,EAAE,KAAKR,KAAL,CAAWiB,aAH5B,EAIE,SAAS,EAAE,KAAKjB,KAAL,CAAWkB,SAJxB,EAKE,kBAAkB,EAAE,KAAKlB,KAAL,CAAWmB,kBALjC,EAME,WAAW,EAAE,KANf,EAOE,SAAS,EAAEL,SAPb,EAQE,iBAAiB,EAAEC,iBARrB,EASE,MAAM,EAAE,KAAKf,KAAL,CAAWoB,MATrB,EAUE,MAAM,EAAE,KAAKpB,KAAL,CAAWqB,MAVrB,EAWE,KAAK,EAAE,KAAKrB,KAAL,CAAWsB,KAXpB,EAYE,OAAO,EAAE,KAAKtB,KAAL,CAAWuB,OAZtB,EAaE,MAAM,EAAE,KAAKvB,KAAL,CAAWwB,MAbrB,EAcE,WAAW,EAAE,KAAKxB,KAAL,CAAWyB,WAd1B,IAgBG,KAAKzB,KAAL,CAAW0B,QAhBd,CADF,CADF,CAsBD,C,uBA1D+BC,eAAMC,S,WACxBC,mB,GAAsB,c,UAEtB3B,Y,GAA6B,EACzCa,iBAAiB,EAAEe,6BADsB,EAEzChB,SAAS,EAAE,CAAC,aAAD,EAAgB,cAAhB,EAAgC,UAAhC,EAA4C,WAA5C,CAF8B,E","sourcesContent":["import React from 'react';\n\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { Nullable } from '../../typings/utility-types';\nimport { PopupMenu, PopupMenuProps } from '../../internal/PopupMenu';\nimport { isProductionEnv, isTestEnv } from '../../lib/currentEnvironment';\nimport { PopupPositionsType } from '../../internal/Popup';\nimport { CommonWrapper, CommonProps } from '../../internal/CommonWrapper';\nimport { rootNode, TSetRootNode } from '../../lib/rootNode';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\n\nimport { getDropdownMenuTheme } from './getDropdownMenuTheme';\n\nexport interface DropdownMenuProps\n extends CommonProps,\n Pick<PopupMenuProps, 'onOpen' | 'onClose' | 'popupMenuId' | 'preventIconsOffset'> {\n /** Максимальная высота меню */\n menuMaxHeight?: React.CSSProperties['maxWidth'];\n /** Ширина меню */\n menuWidth?: React.CSSProperties['width'];\n /** Ширина caption */\n width?: React.CSSProperties['width'];\n\n /**\n * Элемент или функция возвращающая элемент,\n * если передана, используется вместо `caption`,\n * в таком случае управлять открытием и закрытием меню\n * придется в этой функции\n */\n caption: PopupMenuProps['caption'];\n\n /**\n * Произвольный элемент, который будет отрендерен в шапке меню.\n *\n * _Примечание_: контрол [MenuHeader](#/Components/MenuHeader) передаётся только в `children` меню-контролов. Не стоит передавать `MenuHeader` в `header`.\n */\n header?: React.ReactNode;\n /**\n * Произвольный элемент, который будет отрендерен в подвале меню.\n *\n * Перед элементом переданным в `footer` будет отрендерен [MenuSeparator](#/Components/MenuSeparator).\n */\n footer?: React.ReactNode;\n /**\n * Список позиций доступных для расположения выпадашки относительно `caption`.\n *\n * Если во всех позициях выпадашка вылезает за пределы `viewport`, будет использована первая из этого списка.\n *\n * **Возможные значения**: `top left`, `top center`, `top right`, `right top`, `right middle`, `right bottom`, `bottom left`, `bottom center`, `bottom right`, `left top`, `left middle`, `left bottom`\n * @default ['bottom left', 'bottom right', 'top left', 'top right']\n */\n positions?: PopupPositionsType[];\n\n /**\n * Не показывать анимацию\n */\n disableAnimations?: boolean;\n}\n\ntype DefaultProps = Required<Pick<DropdownMenuProps, 'disableAnimations' | 'positions'>>;\n\n/**\n * Меню, раскрывающееся по клику на переданный в `caption` элемент\n */\n@rootNode\nexport class DropdownMenu extends React.Component<DropdownMenuProps> {\n public static __KONTUR_REACT_UI__ = 'DropdownMenu';\n\n public static defaultProps: DefaultProps = {\n disableAnimations: isTestEnv,\n positions: ['bottom left', 'bottom right', 'top left', 'top right'],\n };\n\n private getProps = createPropsGetter(DropdownMenu.defaultProps);\n\n private popupMenu: Nullable<PopupMenu> = null;\n private setRootNode!: TSetRootNode;\n\n constructor(props: DropdownMenuProps) {\n super(props);\n\n if (!props.caption && !isProductionEnv) {\n throw new Error('Prop \"caption\" is required!!!');\n }\n }\n\n public render() {\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n return <ThemeContext.Provider value={getDropdownMenuTheme(theme)}>{this.renderMain()}</ThemeContext.Provider>;\n }}\n </ThemeContext.Consumer>\n );\n }\n\n public renderMain() {\n if (!this.props.caption) {\n return null;\n }\n const { positions, disableAnimations } = this.getProps();\n return (\n <CommonWrapper rootNodeRef={this.setRootNode} {...this.props}>\n <PopupMenu\n ref={this.refPopupMenu}\n caption={this.props.caption}\n menuMaxHeight={this.props.menuMaxHeight}\n menuWidth={this.props.menuWidth}\n preventIconsOffset={this.props.preventIconsOffset}\n popupHasPin={false}\n positions={positions}\n disableAnimations={disableAnimations}\n header={this.props.header}\n footer={this.props.footer}\n width={this.props.width}\n onClose={this.props.onClose}\n onOpen={this.props.onOpen}\n popupMenuId={this.props.popupMenuId}\n >\n {this.props.children}\n </PopupMenu>\n </CommonWrapper>\n );\n }\n\n public open = (): void => {\n if (this.popupMenu) {\n this.popupMenu.open();\n }\n };\n\n public close = (): void => {\n if (this.popupMenu) {\n this.popupMenu.close();\n }\n };\n\n private refPopupMenu = (ref: Nullable<PopupMenu>) => (this.popupMenu = ref);\n}\n"]}
|
|
@@ -113,6 +113,34 @@ import { Button, MenuHeader, MenuItem, MenuSeparator } from '@skbkontur/react-ui
|
|
|
113
113
|
</DropdownMenu>;
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
+
С иконками и включенным по-умолчанию автоматическим выравниванием текста.
|
|
117
|
+
|
|
118
|
+
```jsx harmony
|
|
119
|
+
import { Button, MenuHeader, MenuItem, MenuSeparator, DropdownMenu } from '@skbkontur/react-ui';
|
|
120
|
+
import OkIcon from '@skbkontur/react-icons/Ok';
|
|
121
|
+
|
|
122
|
+
<DropdownMenu caption={<Button use="primary">Открыть меню</Button>}>
|
|
123
|
+
<MenuHeader>MenuHeader</MenuHeader>
|
|
124
|
+
<MenuItem icon={<OkIcon />}>MenuItem1</MenuItem>
|
|
125
|
+
<MenuItem icon={<OkIcon />}>MenuItem2</MenuItem>
|
|
126
|
+
<MenuItem>MenuItem3</MenuItem>
|
|
127
|
+
</DropdownMenu>;
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
С иконками и отключенным автоматическим выравниванием текста.
|
|
131
|
+
|
|
132
|
+
```jsx harmony
|
|
133
|
+
import { Button, MenuHeader, MenuItem, MenuSeparator, DropdownMenu } from '@skbkontur/react-ui';
|
|
134
|
+
import OkIcon from '@skbkontur/react-icons/Ok';
|
|
135
|
+
|
|
136
|
+
<DropdownMenu preventIconsOffset caption={<Button use="primary">Открыть меню</Button>}>
|
|
137
|
+
<MenuHeader>MenuHeader</MenuHeader>
|
|
138
|
+
<MenuItem icon={<OkIcon />}>MenuItem1</MenuItem>
|
|
139
|
+
<MenuItem icon={<OkIcon />}>MenuItem2</MenuItem>
|
|
140
|
+
<MenuItem>MenuItem3</MenuItem>
|
|
141
|
+
</DropdownMenu>
|
|
142
|
+
```
|
|
143
|
+
|
|
116
144
|
Меню с отключенной анимацией.
|
|
117
145
|
|
|
118
146
|
```jsx harmony
|
|
@@ -3,7 +3,7 @@ import { PopupMenuProps } from '../../internal/PopupMenu';
|
|
|
3
3
|
import { Nullable } from '../../typings/utility-types';
|
|
4
4
|
import { PopupPositionsType } from '../../internal/Popup';
|
|
5
5
|
import { CommonProps } from '../../internal/CommonWrapper';
|
|
6
|
-
export interface KebabProps extends CommonProps, Pick<PopupMenuProps, 'onOpen' | 'onClose' | 'popupMenuId'> {
|
|
6
|
+
export interface KebabProps extends CommonProps, Pick<PopupMenuProps, 'onOpen' | 'onClose' | 'popupMenuId' | 'preventIconsOffset'> {
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
size?: 'small' | 'medium' | 'large';
|
|
9
9
|
/**
|
|
@@ -48,6 +48,8 @@ var _KebabIcon = require("./KebabIcon");var _class, _class2, _temp;function _get
|
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
|
|
51
|
+
|
|
52
|
+
|
|
51
53
|
|
|
52
54
|
|
|
53
55
|
|
|
@@ -145,6 +147,7 @@ Kebab = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/functio
|
|
|
145
147
|
|
|
146
148
|
|
|
147
149
|
|
|
150
|
+
|
|
148
151
|
|
|
149
152
|
|
|
150
153
|
renderCaption = function (captionProps) {
|
|
@@ -218,7 +221,7 @@ Kebab = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/functio
|
|
|
218
221
|
_this.setState({
|
|
219
222
|
focusedByTab: false });
|
|
220
223
|
|
|
221
|
-
};return _this;}var _proto = Kebab.prototype;_proto.componentDidMount = function componentDidMount() {/** addListener'у нужен колбэк в аргумент */this.listener = LayoutEvents.addListener(function () {return undefined;});};_proto.componentWillUnmount = function componentWillUnmount() {this.listener.remove();};_proto.render = function render() {var _this2 = this;return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Consumer, null, function (theme) {_this2.theme = theme;return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Provider, { value: _ThemeFactory.ThemeFactory.create({ popupPinOffset: theme.kebabPinOffset, popupMargin: theme.kebabMargin, popupPinSize: theme.kebabPinSize }, theme) }, _this2.renderMain());});};_proto.renderMain = function renderMain() {var disabled = this.props.disabled;var _this$getProps2 = this.getProps(),positions = _this$getProps2.positions,disableAnimations = _this$getProps2.disableAnimations,onOpen = _this$getProps2.onOpen,onClose = _this$getProps2.onClose;return /*#__PURE__*/_react.default.createElement(_CommonWrapper.CommonWrapper, (0, _extends2.default)({ rootNodeRef: this.setRootNode }, this.props), /*#__PURE__*/_react.default.createElement(_PopupMenu.PopupMenu, { popupHasPin: true, positions: positions, onChangeMenuState: this.handleChangeMenuState, caption: this.renderCaption, disableAnimations: disableAnimations, menuMaxHeight: this.props.menuMaxHeight, onOpen: onOpen, onClose: onClose, popupMenuId: this.props.popupMenuId }, !disabled && this.props.children));};_proto.
|
|
224
|
+
};return _this;}var _proto = Kebab.prototype;_proto.componentDidMount = function componentDidMount() {/** addListener'у нужен колбэк в аргумент */this.listener = LayoutEvents.addListener(function () {return undefined;});};_proto.componentWillUnmount = function componentWillUnmount() {this.listener.remove();};_proto.render = function render() {var _this2 = this;return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Consumer, null, function (theme) {_this2.theme = theme;return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Provider, { value: _ThemeFactory.ThemeFactory.create({ popupPinOffset: theme.kebabPinOffset, popupMargin: theme.kebabMargin, popupPinSize: theme.kebabPinSize }, theme) }, _this2.renderMain());});};_proto.renderMain = function renderMain() {var disabled = this.props.disabled;var _this$getProps2 = this.getProps(),positions = _this$getProps2.positions,disableAnimations = _this$getProps2.disableAnimations,onOpen = _this$getProps2.onOpen,onClose = _this$getProps2.onClose;return /*#__PURE__*/_react.default.createElement(_CommonWrapper.CommonWrapper, (0, _extends2.default)({ rootNodeRef: this.setRootNode }, this.props), /*#__PURE__*/_react.default.createElement(_PopupMenu.PopupMenu, { popupHasPin: true, preventIconsOffset: this.props.preventIconsOffset, positions: positions, onChangeMenuState: this.handleChangeMenuState, caption: this.renderCaption, disableAnimations: disableAnimations, menuMaxHeight: this.props.menuMaxHeight, onOpen: onOpen, onClose: onClose, popupMenuId: this.props.popupMenuId }, !disabled && this.props.children));};_proto.
|
|
222
225
|
|
|
223
226
|
renderIcon = function renderIcon() {var _cx;
|
|
224
227
|
var _this$getProps3 = this.getProps(),size = _this$getProps3.size,_this$getProps3$icon = _this$getProps3.icon,icon = _this$getProps3$icon === void 0 ? /*#__PURE__*/_react.default.createElement(_px.MenuKebabIcon, null) : _this$getProps3$icon;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Kebab.tsx"],"names":["KebabDataTids","caption","Kebab","rootNode","getProps","defaultProps","state","focusedByTab","anchor","listener","remove","undefined","renderCaption","captionProps","disabled","size","handleCaptionKeyDown","event","openMenu","handleCaptionClick","toggleMenu","handleFocus","handleBlur","styles","kebab","theme","kebabSmall","kebabMedium","kebabLarge","kebab2022","opened","focused","props","renderIcon2022","renderIcon","e","isKeyEnter","isKeySpace","isKeyArrowVertical","preventDefault","handleChangeMenuState","isOpened","restoreFocus","setState","requestAnimationFrame","keyListener","isTabPressed","componentDidMount","LayoutEvents","addListener","componentWillUnmount","render","ThemeFactory","create","popupPinOffset","kebabPinOffset","popupMargin","kebabMargin","popupPinSize","kebabPinSize","renderMain","positions","disableAnimations","onOpen","onClose","setRootNode","menuMaxHeight","popupMenuId","children","icon","iconsmall","iconmedium","iconlarge","sizes","small","parseInt","kebabIconSizeSmall","medium","kebabIconSizeMedium","large","kebabIconSizeLarge","React","cloneElement","color","kebabIconColor","Component","__KONTUR_REACT_UI__","propTypes","isTestEnv","PropTypes","node","bool","oneOfType","string","number","func"],"mappings":"2VAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA,wC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BO,IAAMA,aAAa,GAAG;AAC3BC,EAAAA,OAAO,EAAE,gBADkB,EAAtB,C;;;;;;;;;;;AAYMC,K,OADZC,kB;;;;;;;;;;;;;AAcSC,IAAAA,Q,GAAW,0CAAkBF,KAAK,CAACG,YAAxB,C;;AAEZC,IAAAA,K,GAAoB;AACzBC,MAAAA,YAAY,EAAE,KADW;AAEzBC,MAAAA,MAAM,EAAE,IAFiB,E;;;;;;AAQnBC,IAAAA,Q;;AAEJ;AACFC,MAAAA,MAAM,EAAE,0BAAMC,SAAN,EADN,E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DIC,IAAAA,a,GAAgB,UAACC,YAAD,EAAyC;AAC/D,2BAA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AAN,EADiC,EAEzCqD,OAAO,EAAE,2BAAMrD,SAAN,EAFgC,EAGzCkD,SAAS,EAAE,CAAC,aAAD,EAAgB,cAAhB,EAAgC,UAAhC,EAA4C,WAA5C,CAH8B,EAIzC9C,IAAI,EAAE,OAJmC,EAKzC+C,iBAAiB,EAAE0B,6BALsB,E;;;AA4L7CtF,KAAK,CAACqF,SAAN,GAAkB;AAChBnB,EAAAA,QAAQ,EAAEqB,mBAAUC,IADJ;AAEhB5E,EAAAA,QAAQ,EAAE2E,mBAAUE,IAFJ;AAGhBzB,EAAAA,aAAa,EAAEuB,mBAAUG,SAAV,CAAoB,CAACH,mBAAUI,MAAX,EAAmBJ,mBAAUK,MAA7B,CAApB,CAHC;;AAKhB;AACF;AACA;AACE/E,EAAAA,IAAI,EAAE0E,mBAAUI,MARA;;AAUhB;AACF;AACA;AACE7B,EAAAA,OAAO,EAAEyB,mBAAUM,IAbH;;AAehB;AACF;AACA;AACEhC,EAAAA,MAAM,EAAE0B,mBAAUM,IAlBF,EAAlB","sourcesContent":["import React, { AriaAttributes } from 'react';\nimport PropTypes from 'prop-types';\nimport { isElement } from 'react-is';\n\nimport { isKonturIcon } from '../../lib/utils';\nimport { isKeyArrowVertical, isKeyEnter, isKeySpace, someKeys } from '../../lib/events/keyboard/identifiers';\nimport * as LayoutEvents from '../../lib/LayoutEvents';\nimport { keyListener } from '../../lib/events/keyListener';\nimport { PopupMenu, PopupMenuCaptionProps, PopupMenuProps } from '../../internal/PopupMenu';\nimport { Nullable } from '../../typings/utility-types';\nimport { PopupPositionsType } from '../../internal/Popup';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { Theme } from '../../lib/theming/Theme';\nimport { MenuKebabIcon } from '../../internal/icons/16px';\nimport { isTestEnv } from '../../lib/currentEnvironment';\nimport { ThemeFactory } from '../../lib/theming/ThemeFactory';\nimport { CommonWrapper, CommonProps } from '../../internal/CommonWrapper';\nimport { cx } from '../../lib/theming/Emotion';\nimport { rootNode, TSetRootNode } from '../../lib/rootNode';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\nimport { isTheme2022 } from '../../lib/theming/ThemeHelpers';\nimport { ButtonSize } from '../Button';\n\nimport { styles } from './Kebab.styles';\nimport { KebabIcon } from './KebabIcon';\n\nexport interface KebabProps extends CommonProps, Pick<PopupMenuProps, 'onOpen' | 'onClose' | 'popupMenuId'> {\n disabled?: boolean;\n size?: 'small' | 'medium' | 'large';\n /**\n * Список позиций доступных для расположения выпадашки.\n *\n * Если во всех позициях выпадашка вылезает за пределы `viewport`, будет использована первая из этого списка.\n *\n * **Возможные значения**: `top left`, `top center`, `top right`, `right top`, `right middle`, `right bottom`, `bottom left`, `bottom center`, `bottom right`, `left top`, `left middle`, `left bottom`\n * @default ['bottom left', 'bottom right', 'top left', 'top right']\n */\n positions?: PopupPositionsType[];\n menuMaxHeight?: number | string;\n /**\n * Не показывать анимацию\n */\n disableAnimations?: boolean;\n /**\n * Кастомная иконка\n */\n icon?: React.ReactNode;\n /**\n * Атрибут для указания id элемента(-ов), описывающих его\n */\n 'aria-describedby'?: AriaAttributes['aria-describedby'];\n}\n\nexport const KebabDataTids = {\n caption: 'Kebab__caption',\n} as const;\n\nexport interface KebabState {\n anchor: Nullable<HTMLElement>;\n focusedByTab: boolean;\n}\n\ntype DefaultProps = Required<Pick<KebabProps, 'onOpen' | 'onClose' | 'positions' | 'size' | 'disableAnimations'>>;\n\n@rootNode\nexport class Kebab extends React.Component<KebabProps, KebabState> {\n public static __KONTUR_REACT_UI__ = 'Kebab';\n\n public static propTypes = {};\n\n public static defaultProps: DefaultProps = {\n onOpen: () => undefined,\n onClose: () => undefined,\n positions: ['bottom left', 'bottom right', 'top left', 'top right'],\n size: 'small',\n disableAnimations: isTestEnv,\n };\n\n private getProps = createPropsGetter(Kebab.defaultProps);\n\n public state: KebabState = {\n focusedByTab: false,\n anchor: null,\n };\n\n private theme!: Theme;\n private setRootNode!: TSetRootNode;\n\n private listener: {\n remove: () => void;\n } = {\n remove: () => undefined,\n };\n\n public componentDidMount() {\n /** addListener'у нужен колбэк в аргумент */\n this.listener = LayoutEvents.addListener(() => undefined);\n }\n\n public componentWillUnmount() {\n this.listener.remove();\n }\n\n public render(): JSX.Element {\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = theme;\n return (\n <ThemeContext.Provider\n value={ThemeFactory.create(\n {\n popupPinOffset: theme.kebabPinOffset,\n popupMargin: theme.kebabMargin,\n popupPinSize: theme.kebabPinSize,\n },\n theme,\n )}\n >\n {this.renderMain()}\n </ThemeContext.Provider>\n );\n }}\n </ThemeContext.Consumer>\n );\n }\n\n private renderMain() {\n const { disabled } = this.props;\n const { positions, disableAnimations, onOpen, onClose } = this.getProps();\n return (\n <CommonWrapper rootNodeRef={this.setRootNode} {...this.props}>\n <PopupMenu\n popupHasPin\n positions={positions}\n onChangeMenuState={this.handleChangeMenuState}\n caption={this.renderCaption}\n disableAnimations={disableAnimations}\n menuMaxHeight={this.props.menuMaxHeight}\n onOpen={onOpen}\n onClose={onClose}\n popupMenuId={this.props.popupMenuId}\n >\n {!disabled && this.props.children}\n </PopupMenu>\n </CommonWrapper>\n );\n }\n\n private renderCaption = (captionProps: PopupMenuCaptionProps) => {\n const { disabled, size } = this.getProps();\n const handleCaptionKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (!disabled) {\n this.handleCaptionKeyDown(event, captionProps.openMenu);\n }\n };\n\n const handleCaptionClick = () => {\n if (!disabled) {\n captionProps.toggleMenu();\n }\n };\n\n return (\n <span\n data-tid={KebabDataTids.caption}\n tabIndex={disabled ? -1 : 0}\n onClick={handleCaptionClick}\n onKeyDown={handleCaptionKeyDown}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n className={cx(\n styles.kebab(this.theme),\n size === 'small' && styles.kebabSmall(this.theme),\n size === 'medium' && styles.kebabMedium(this.theme),\n size === 'large' && styles.kebabLarge(this.theme),\n isTheme2022(this.theme) && styles.kebab2022(),\n captionProps.opened && styles.opened(this.theme),\n disabled && styles.disabled(),\n this.state.focusedByTab && styles.focused(this.theme),\n )}\n aria-describedby={this.props['aria-describedby']}\n >\n {isTheme2022(this.theme) ? this.renderIcon2022() : this.renderIcon()}\n </span>\n );\n };\n\n private handleCaptionKeyDown = (\n e: React.KeyboardEvent<HTMLDivElement>,\n openMenu: PopupMenuCaptionProps['openMenu'],\n ) => {\n if (someKeys(isKeyEnter, isKeySpace, isKeyArrowVertical)(e)) {\n e.preventDefault();\n openMenu(true);\n }\n };\n\n private handleChangeMenuState = (isOpened: boolean, restoreFocus: boolean): void => {\n this.setState({\n focusedByTab: !isOpened && restoreFocus,\n });\n };\n\n private handleFocus = () => {\n if (!this.props.disabled) {\n // focus event fires before keyDown eventlistener\n // so we should check tabPressed in async way\n requestAnimationFrame(() => {\n if (keyListener.isTabPressed) {\n this.setState({ focusedByTab: true });\n }\n });\n }\n };\n\n private handleBlur = () => {\n this.setState({\n focusedByTab: false,\n });\n };\n\n private renderIcon() {\n const { size, icon = <MenuKebabIcon /> } = this.getProps();\n return (\n <div\n className={cx({\n [styles.icon(this.theme)]: true,\n [styles.iconsmall(this.theme)]: size === 'small',\n [styles.iconmedium(this.theme)]: size === 'medium',\n [styles.iconlarge(this.theme)]: size === 'large',\n })}\n >\n {icon}\n </div>\n );\n }\n\n private renderIcon2022() {\n const { size, icon = <KebabIcon /> } = this.getProps();\n\n if (isElement(icon) && isKonturIcon(icon)) {\n const sizes: Record<ButtonSize, number> = {\n small: parseInt(this.theme.kebabIconSizeSmall),\n medium: parseInt(this.theme.kebabIconSizeMedium),\n large: parseInt(this.theme.kebabIconSizeLarge),\n };\n\n return React.cloneElement(icon, {\n size: icon.props.size ?? sizes[size],\n color: icon.props.color ?? this.theme.kebabIconColor,\n });\n }\n\n return icon;\n }\n}\n\nKebab.propTypes = {\n children: PropTypes.node,\n disabled: PropTypes.bool,\n menuMaxHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n\n /**\n * Размер кебаба small 14px | large 20px\n */\n size: PropTypes.string,\n\n /**\n * Коллбек, вызывающийся перед закрытием кебаба\n */\n onClose: PropTypes.func,\n\n /**\n * Коллбек, вызывающийся перед открытием кебаба\n */\n onOpen: PropTypes.func,\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["Kebab.tsx"],"names":["KebabDataTids","caption","Kebab","rootNode","getProps","defaultProps","state","focusedByTab","anchor","listener","remove","undefined","renderCaption","captionProps","disabled","size","handleCaptionKeyDown","event","openMenu","handleCaptionClick","toggleMenu","handleFocus","handleBlur","styles","kebab","theme","kebabSmall","kebabMedium","kebabLarge","kebab2022","opened","focused","props","renderIcon2022","renderIcon","e","isKeyEnter","isKeySpace","isKeyArrowVertical","preventDefault","handleChangeMenuState","isOpened","restoreFocus","setState","requestAnimationFrame","keyListener","isTabPressed","componentDidMount","LayoutEvents","addListener","componentWillUnmount","render","ThemeFactory","create","popupPinOffset","kebabPinOffset","popupMargin","kebabMargin","popupPinSize","kebabPinSize","renderMain","positions","disableAnimations","onOpen","onClose","setRootNode","preventIconsOffset","menuMaxHeight","popupMenuId","children","icon","iconsmall","iconmedium","iconlarge","sizes","small","parseInt","kebabIconSizeSmall","medium","kebabIconSizeMedium","large","kebabIconSizeLarge","React","cloneElement","color","kebabIconColor","Component","__KONTUR_REACT_UI__","propTypes","isTestEnv","PropTypes","node","bool","oneOfType","string","number","func"],"mappings":"2VAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA,wC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BO,IAAMA,aAAa,GAAG;AAC3BC,EAAAA,OAAO,EAAE,gBADkB,EAAtB,C;;;;;;;;;;;AAYMC,K,OADZC,kB;;;;;;;;;;;;;AAcSC,IAAAA,Q,GAAW,0CAAkBF,KAAK,CAACG,YAAxB,C;;AAEZC,IAAAA,K,GAAoB;AACzBC,MAAAA,YAAY,EAAE,KADW;AAEzB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B2D,KAAK,CAAC3D,IAAD,CADA;AAE9BqE,QAAAA,KAAK,uBAAEd,IAAI,CAACtC,KAAL,CAAWoD,KAAb,gCAAsB,KAAK3D,KAAL,CAAW4D,cAFR,EAAzB,CAAP;;AAID;;AAED,WAAOf,IAAP;AACD,G,gBA/LwBY,eAAMI,S,WACjBC,mB,GAAsB,O,UAEtBC,S,GAAY,E,UAEZnF,Y,GAA6B,EACzC0D,MAAM,EAAE,0BAAMpD,SAAN,EADiC,EAEzCqD,OAAO,EAAE,2BAAMrD,SAAN,EAFgC,EAGzCkD,SAAS,EAAE,CAAC,aAAD,EAAgB,cAAhB,EAAgC,UAAhC,EAA4C,WAA5C,CAH8B,EAIzC9C,IAAI,EAAE,OAJmC,EAKzC+C,iBAAiB,EAAE2B,6BALsB,E;;;AA6L7CvF,KAAK,CAACsF,SAAN,GAAkB;AAChBnB,EAAAA,QAAQ,EAAEqB,mBAAUC,IADJ;AAEhB7E,EAAAA,QAAQ,EAAE4E,mBAAUE,IAFJ;AAGhBzB,EAAAA,aAAa,EAAEuB,mBAAUG,SAAV,CAAoB,CAACH,mBAAUI,MAAX,EAAmBJ,mBAAUK,MAA7B,CAApB,CAHC;;AAKhB;AACF;AACA;AACEhF,EAAAA,IAAI,EAAE2E,mBAAUI,MARA;;AAUhB;AACF;AACA;AACE9B,EAAAA,OAAO,EAAE0B,mBAAUM,IAbH;;AAehB;AACF;AACA;AACEjC,EAAAA,MAAM,EAAE2B,mBAAUM,IAlBF,EAAlB","sourcesContent":["import React, { AriaAttributes } from 'react';\nimport PropTypes from 'prop-types';\nimport { isElement } from 'react-is';\n\nimport { isKonturIcon } from '../../lib/utils';\nimport { isKeyArrowVertical, isKeyEnter, isKeySpace, someKeys } from '../../lib/events/keyboard/identifiers';\nimport * as LayoutEvents from '../../lib/LayoutEvents';\nimport { keyListener } from '../../lib/events/keyListener';\nimport { PopupMenu, PopupMenuCaptionProps, PopupMenuProps } from '../../internal/PopupMenu';\nimport { Nullable } from '../../typings/utility-types';\nimport { PopupPositionsType } from '../../internal/Popup';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { Theme } from '../../lib/theming/Theme';\nimport { MenuKebabIcon } from '../../internal/icons/16px';\nimport { isTestEnv } from '../../lib/currentEnvironment';\nimport { ThemeFactory } from '../../lib/theming/ThemeFactory';\nimport { CommonWrapper, CommonProps } from '../../internal/CommonWrapper';\nimport { cx } from '../../lib/theming/Emotion';\nimport { rootNode, TSetRootNode } from '../../lib/rootNode';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\nimport { isTheme2022 } from '../../lib/theming/ThemeHelpers';\nimport { ButtonSize } from '../Button';\n\nimport { styles } from './Kebab.styles';\nimport { KebabIcon } from './KebabIcon';\n\nexport interface KebabProps\n extends CommonProps,\n Pick<PopupMenuProps, 'onOpen' | 'onClose' | 'popupMenuId' | 'preventIconsOffset'> {\n disabled?: boolean;\n size?: 'small' | 'medium' | 'large';\n /**\n * Список позиций доступных для расположения выпадашки.\n *\n * Если во всех позициях выпадашка вылезает за пределы `viewport`, будет использована первая из этого списка.\n *\n * **Возможные значения**: `top left`, `top center`, `top right`, `right top`, `right middle`, `right bottom`, `bottom left`, `bottom center`, `bottom right`, `left top`, `left middle`, `left bottom`\n * @default ['bottom left', 'bottom right', 'top left', 'top right']\n */\n positions?: PopupPositionsType[];\n menuMaxHeight?: number | string;\n /**\n * Не показывать анимацию\n */\n disableAnimations?: boolean;\n /**\n * Кастомная иконка\n */\n icon?: React.ReactNode;\n /**\n * Атрибут для указания id элемента(-ов), описывающих его\n */\n 'aria-describedby'?: AriaAttributes['aria-describedby'];\n}\n\nexport const KebabDataTids = {\n caption: 'Kebab__caption',\n} as const;\n\nexport interface KebabState {\n anchor: Nullable<HTMLElement>;\n focusedByTab: boolean;\n}\n\ntype DefaultProps = Required<Pick<KebabProps, 'onOpen' | 'onClose' | 'positions' | 'size' | 'disableAnimations'>>;\n\n@rootNode\nexport class Kebab extends React.Component<KebabProps, KebabState> {\n public static __KONTUR_REACT_UI__ = 'Kebab';\n\n public static propTypes = {};\n\n public static defaultProps: DefaultProps = {\n onOpen: () => undefined,\n onClose: () => undefined,\n positions: ['bottom left', 'bottom right', 'top left', 'top right'],\n size: 'small',\n disableAnimations: isTestEnv,\n };\n\n private getProps = createPropsGetter(Kebab.defaultProps);\n\n public state: KebabState = {\n focusedByTab: false,\n anchor: null,\n };\n\n private theme!: Theme;\n private setRootNode!: TSetRootNode;\n\n private listener: {\n remove: () => void;\n } = {\n remove: () => undefined,\n };\n\n public componentDidMount() {\n /** addListener'у нужен колбэк в аргумент */\n this.listener = LayoutEvents.addListener(() => undefined);\n }\n\n public componentWillUnmount() {\n this.listener.remove();\n }\n\n public render(): JSX.Element {\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = theme;\n return (\n <ThemeContext.Provider\n value={ThemeFactory.create(\n {\n popupPinOffset: theme.kebabPinOffset,\n popupMargin: theme.kebabMargin,\n popupPinSize: theme.kebabPinSize,\n },\n theme,\n )}\n >\n {this.renderMain()}\n </ThemeContext.Provider>\n );\n }}\n </ThemeContext.Consumer>\n );\n }\n\n private renderMain() {\n const { disabled } = this.props;\n const { positions, disableAnimations, onOpen, onClose } = this.getProps();\n return (\n <CommonWrapper rootNodeRef={this.setRootNode} {...this.props}>\n <PopupMenu\n popupHasPin\n preventIconsOffset={this.props.preventIconsOffset}\n positions={positions}\n onChangeMenuState={this.handleChangeMenuState}\n caption={this.renderCaption}\n disableAnimations={disableAnimations}\n menuMaxHeight={this.props.menuMaxHeight}\n onOpen={onOpen}\n onClose={onClose}\n popupMenuId={this.props.popupMenuId}\n >\n {!disabled && this.props.children}\n </PopupMenu>\n </CommonWrapper>\n );\n }\n\n private renderCaption = (captionProps: PopupMenuCaptionProps) => {\n const { disabled, size } = this.getProps();\n const handleCaptionKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (!disabled) {\n this.handleCaptionKeyDown(event, captionProps.openMenu);\n }\n };\n\n const handleCaptionClick = () => {\n if (!disabled) {\n captionProps.toggleMenu();\n }\n };\n\n return (\n <span\n data-tid={KebabDataTids.caption}\n tabIndex={disabled ? -1 : 0}\n onClick={handleCaptionClick}\n onKeyDown={handleCaptionKeyDown}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n className={cx(\n styles.kebab(this.theme),\n size === 'small' && styles.kebabSmall(this.theme),\n size === 'medium' && styles.kebabMedium(this.theme),\n size === 'large' && styles.kebabLarge(this.theme),\n isTheme2022(this.theme) && styles.kebab2022(),\n captionProps.opened && styles.opened(this.theme),\n disabled && styles.disabled(),\n this.state.focusedByTab && styles.focused(this.theme),\n )}\n aria-describedby={this.props['aria-describedby']}\n >\n {isTheme2022(this.theme) ? this.renderIcon2022() : this.renderIcon()}\n </span>\n );\n };\n\n private handleCaptionKeyDown = (\n e: React.KeyboardEvent<HTMLDivElement>,\n openMenu: PopupMenuCaptionProps['openMenu'],\n ) => {\n if (someKeys(isKeyEnter, isKeySpace, isKeyArrowVertical)(e)) {\n e.preventDefault();\n openMenu(true);\n }\n };\n\n private handleChangeMenuState = (isOpened: boolean, restoreFocus: boolean): void => {\n this.setState({\n focusedByTab: !isOpened && restoreFocus,\n });\n };\n\n private handleFocus = () => {\n if (!this.props.disabled) {\n // focus event fires before keyDown eventlistener\n // so we should check tabPressed in async way\n requestAnimationFrame(() => {\n if (keyListener.isTabPressed) {\n this.setState({ focusedByTab: true });\n }\n });\n }\n };\n\n private handleBlur = () => {\n this.setState({\n focusedByTab: false,\n });\n };\n\n private renderIcon() {\n const { size, icon = <MenuKebabIcon /> } = this.getProps();\n return (\n <div\n className={cx({\n [styles.icon(this.theme)]: true,\n [styles.iconsmall(this.theme)]: size === 'small',\n [styles.iconmedium(this.theme)]: size === 'medium',\n [styles.iconlarge(this.theme)]: size === 'large',\n })}\n >\n {icon}\n </div>\n );\n }\n\n private renderIcon2022() {\n const { size, icon = <KebabIcon /> } = this.getProps();\n\n if (isElement(icon) && isKonturIcon(icon)) {\n const sizes: Record<ButtonSize, number> = {\n small: parseInt(this.theme.kebabIconSizeSmall),\n medium: parseInt(this.theme.kebabIconSizeMedium),\n large: parseInt(this.theme.kebabIconSizeLarge),\n };\n\n return React.cloneElement(icon, {\n size: icon.props.size ?? sizes[size],\n color: icon.props.color ?? this.theme.kebabIconColor,\n });\n }\n\n return icon;\n }\n}\n\nKebab.propTypes = {\n children: PropTypes.node,\n disabled: PropTypes.bool,\n menuMaxHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n\n /**\n * Размер кебаба small 14px | large 20px\n */\n size: PropTypes.string,\n\n /**\n * Коллбек, вызывающийся перед закрытием кебаба\n */\n onClose: PropTypes.func,\n\n /**\n * Коллбек, вызывающийся перед открытием кебаба\n */\n onOpen: PropTypes.func,\n};\n"]}
|
|
@@ -160,6 +160,34 @@ let Card = ({ title }) => (
|
|
|
160
160
|
<Card title="С кастомным действием" />
|
|
161
161
|
```
|
|
162
162
|
|
|
163
|
+
С иконками и включенным по-умолчанию автоматическим выравниванием текста.
|
|
164
|
+
|
|
165
|
+
```jsx harmony
|
|
166
|
+
import { Button, MenuHeader, MenuItem, MenuSeparator, Kebab } from '@skbkontur/react-ui';
|
|
167
|
+
import OkIcon from '@skbkontur/react-icons/Ok';
|
|
168
|
+
|
|
169
|
+
<Kebab>
|
|
170
|
+
<MenuHeader>MenuHeader</MenuHeader>
|
|
171
|
+
<MenuItem icon={<OkIcon />}>MenuItem1</MenuItem>
|
|
172
|
+
<MenuItem icon={<OkIcon />}>MenuItem2</MenuItem>
|
|
173
|
+
<MenuItem>MenuItem3</MenuItem>
|
|
174
|
+
</Kebab>;
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
С иконками и отключенным автоматическим выравниванием текста.
|
|
178
|
+
|
|
179
|
+
```jsx harmony
|
|
180
|
+
import { Button, MenuHeader, MenuItem, MenuSeparator, Kebab } from '@skbkontur/react-ui';
|
|
181
|
+
import OkIcon from '@skbkontur/react-icons/Ok';
|
|
182
|
+
|
|
183
|
+
<Kebab preventIconsOffset>
|
|
184
|
+
<MenuHeader>MenuHeader</MenuHeader>
|
|
185
|
+
<MenuItem icon={<OkIcon />}>MenuItem1</MenuItem>
|
|
186
|
+
<MenuItem icon={<OkIcon />}>MenuItem2</MenuItem>
|
|
187
|
+
<MenuItem>MenuItem3</MenuItem>
|
|
188
|
+
</Kebab>
|
|
189
|
+
```
|
|
190
|
+
|
|
163
191
|
Отключенное кебаб-меню.
|
|
164
192
|
|
|
165
193
|
```jsx harmony
|
|
@@ -170,13 +170,14 @@ Link = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/function
|
|
|
170
170
|
|
|
171
171
|
var linkProps = {
|
|
172
172
|
className: (0, _Emotion.cx)(
|
|
173
|
+
_Link.styles.useRoot(),
|
|
173
174
|
use === 'default' && _Link.styles.useDefault(_this.theme),
|
|
174
175
|
use === 'success' && _Link.styles.useSuccess(_this.theme),
|
|
175
176
|
use === 'danger' && _Link.styles.useDanger(_this.theme),
|
|
176
177
|
use === 'grayed' && _Link.styles.useGrayed(_this.theme),
|
|
177
178
|
!!_button && _Link.styles.button(_this.theme),
|
|
178
179
|
!!_buttonOpened && _Link.styles.buttonOpened(_this.theme),
|
|
179
|
-
_this.getLinkClassName(isFocused, Boolean(disabled || loading))),
|
|
180
|
+
_this.getLinkClassName(isFocused, Boolean(disabled || loading), _isTheme2022)),
|
|
180
181
|
|
|
181
182
|
href: href,
|
|
182
183
|
rel: rel,
|
|
@@ -227,7 +228,7 @@ Link = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/function
|
|
|
227
228
|
}
|
|
228
229
|
};return _this;}var _proto = Link.prototype;_proto.render = function render() {var _this2 = this;return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Consumer, null, function (theme) {_this2.theme = _this2.props.theme ? _ThemeFactory.ThemeFactory.create(_this2.props.theme, theme) : theme;return /*#__PURE__*/_react.default.createElement(_CommonWrapper.CommonWrapper, (0, _extends2.default)({ rootNodeRef: _this2.setRootNode }, _this2.getProps()), _this2.renderMain);});};_proto.
|
|
229
230
|
|
|
230
|
-
getLinkClassName = function getLinkClassName(focused, disabled) {
|
|
231
|
+
getLinkClassName = function getLinkClassName(focused, disabled, _isTheme2022) {
|
|
231
232
|
var _this$getProps = this.getProps(),use = _this$getProps.use;
|
|
232
233
|
var isBorderBottom = parseInt(this.theme.linkLineBorderBottomWidth) > 0;
|
|
233
234
|
var isFocused = focused && !disabled;
|
|
@@ -242,6 +243,7 @@ Link = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/function
|
|
|
242
243
|
(0, _Emotion.cx)(
|
|
243
244
|
_Link.styles.lineRoot(),
|
|
244
245
|
disabled && _Link.styles.disabled(this.theme),
|
|
246
|
+
disabled && _isTheme2022 && (0, _ThemeHelpers.isDarkTheme)(this.theme) && _Link.styles.disabledDark22Theme(),
|
|
245
247
|
isFocused && use === 'default' && _Link.styles.lineFocus(this.theme),
|
|
246
248
|
isFocused && use === 'success' && _Link.styles.lineFocusSuccess(this.theme),
|
|
247
249
|
isFocused && use === 'danger' && _Link.styles.lineFocusDanger(this.theme),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Link.tsx"],"names":["LinkDataTids","root","Link","rootNode","getProps","defaultProps","state","focusedByTab","renderMain","props","disabled","href","icon","use","loading","_button","_buttonOpened","relOrigin","rel","Component","as","focused","rest","_isTheme2022","theme","iconElement","styles","arrow","isFocused","linkProps","className","useDefault","useSuccess","useDanger","useGrayed","button","buttonOpened","getLinkClassName","Boolean","onClick","handleClick","onFocus","handleFocus","onBlur","handleBlur","tabIndex","child","children","globalClasses","text","lineText","requestAnimationFrame","keyListener","isTabPressed","setState","event","preventDefault","render","ThemeFactory","create","setRootNode","isBorderBottom","parseInt","linkLineBorderBottomWidth","focus","useGrayedFocus","lineRoot","lineFocus","lineFocusSuccess","lineFocusDanger","lineFocusGrayed","React","__KONTUR_REACT_UI__","propTypes","PropTypes","bool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,KAAKc,KAArB,CAFd;AAGEI,IAAAA,SAAS,IAAIf,GAAG,KAAK,SAArB,IAAkCa,aAAOyC,SAAP,CAAiB,KAAK3C,KAAtB,CAHpC;AAIEI,IAAAA,SAAS,IAAIf,GAAG,KAAK,SAArB,IAAkCa,aAAO0C,gBAAP,CAAwB,KAAK5C,KAA7B,CAJpC;AAKEI,IAAAA,SAAS,IAAIf,GAAG,KAAK,QAArB,IAAiCa,aAAO2C,eAAP,CAAuB,KAAK7C,KAA5B,CALnC;AAMEI,IAAAA,SAAS,IAAIf,GAAG,KAAK,QAArB,IAAiCa,aAAO4C,eAAP,CAAuB,KAAK9C,KAA5B,CANnC,CAPJ;;AAeD,G,eA7JuB+C,eAAMpD,S,WAChBqD,mB,GAAsB,M,UAEtBC,S,GAAY,EACxB/D,QAAQ,EAAEgE,mBAAUC,IADI,EAGxBhE,IAAI,EAAE+D,mBAAUE,MAHQ,EAKxBhE,IAAI,EAAE8D,mBAAUG,IALQ,EAOxBhE,GAAG,EAAE6D,mBAAUI,KAAV,CAAgB,CAAC,SAAD,EAAY,SAAZ,EAAuB,QAAvB,EAAiC,QAAjC,CAAhB,CAPmB,E,UAUZzE,Y,GAA6B,EACzCM,IAAI,EAAE,EADmC,EAEzCE,GAAG,EAAE,SAFoC,EAGzCO,EAAE,EAAE,GAHqC,E","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nimport { Override } from '../../typings/utility-types';\nimport { keyListener } from '../../lib/events/keyListener';\nimport { Theme, ThemeIn } from '../../lib/theming/Theme';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { isExternalLink } from '../../lib/utils';\nimport { Spinner } from '../Spinner';\nimport { CommonProps, CommonWrapper, CommonWrapperRestProps } from '../../internal/CommonWrapper';\nimport { cx } from '../../lib/theming/Emotion';\nimport { rootNode, TSetRootNode } from '../../lib/rootNode';\nimport { createPropsGetter, DefaultizedProps } from '../../lib/createPropsGetter';\nimport { ThemeFactory } from '../../lib/theming/ThemeFactory';\nimport { isTheme2022 } from '../../lib/theming/ThemeHelpers';\n\nimport { globalClasses, styles } from './Link.styles';\n\nexport interface LinkProps\n extends CommonProps,\n Override<\n React.AnchorHTMLAttributes<HTMLAnchorElement>,\n {\n /**\n * Отключенное состояние.\n */\n disabled?: boolean;\n /**\n * HTML-атрибут `href`.\n */\n href?: string;\n /**\n * Добавляет ссылке иконку.\n */\n icon?: React.ReactElement<any>;\n /**\n * Тема ссылки.\n */\n use?: 'default' | 'success' | 'danger' | 'grayed';\n /**\n * @ignore\n */\n _button?: boolean;\n /**\n * @ignore\n */\n _buttonOpened?: boolean;\n /**\n * HTML-атрибут `tabindex`.\n */\n tabIndex?: number;\n /**\n * Переводит ссылку в состояние загрузки.\n */\n loading?: boolean;\n /**\n * HTML-событие `onclick`.\n */\n onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;\n\n /**\n * Обычный объект с переменными темы.\n * Он будет объединён с темой из контекста.\n */\n theme?: ThemeIn;\n /**\n * Компонент, используемый в качестве корневого узла.\n * @ignore\n */\n as?: React.ElementType | keyof React.ReactHTML;\n /**\n * @ignore\n */\n focused?: boolean;\n }\n > {}\n\nexport interface LinkState {\n focusedByTab: boolean;\n}\n\nexport const LinkDataTids = {\n root: 'Link__root',\n} as const;\n\ntype DefaultProps = Required<Pick<LinkProps, 'href' | 'use' | 'as'>>;\ntype DefaultizedLinkProps = DefaultizedProps<LinkProps, DefaultProps>;\n\n/**\n * Элемент ссылки из HTML.\n */\n@rootNode\nexport class Link extends React.Component<LinkProps, LinkState> {\n public static __KONTUR_REACT_UI__ = 'Link';\n\n public static propTypes = {\n disabled: PropTypes.bool,\n\n href: PropTypes.string,\n\n icon: PropTypes.node,\n\n use: PropTypes.oneOf(['default', 'success', 'danger', 'grayed']),\n };\n\n public static defaultProps: DefaultProps = {\n href: '',\n use: 'default',\n as: 'a',\n };\n\n private getProps = createPropsGetter(Link.defaultProps);\n\n public state: LinkState = {\n focusedByTab: false,\n };\n\n private theme!: Theme;\n private setRootNode!: TSetRootNode;\n\n public render(): JSX.Element {\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = this.props.theme ? ThemeFactory.create(this.props.theme as Theme, theme) : theme;\n return (\n <CommonWrapper rootNodeRef={this.setRootNode} {...this.getProps()}>\n {this.renderMain}\n </CommonWrapper>\n );\n }}\n </ThemeContext.Consumer>\n );\n }\n\n private renderMain = (props: CommonWrapperRestProps<DefaultizedLinkProps>) => {\n const {\n disabled,\n href,\n icon,\n use,\n loading,\n _button,\n _buttonOpened,\n rel: relOrigin,\n as: Component,\n focused = false,\n ...rest\n } = props;\n const _isTheme2022 = isTheme2022(this.theme);\n\n let iconElement = null;\n if (icon) {\n iconElement = (\n <span className={styles.icon(this.theme)}>{loading ? <Spinner caption={null} dimmed inline /> : icon}</span>\n );\n }\n\n let arrow = null;\n if (_button) {\n arrow = <span className={styles.arrow()} />;\n }\n\n let rel = relOrigin;\n if (typeof rel === 'undefined' && href) {\n rel = `noopener${isExternalLink(href) ? ' noreferrer' : ''}`;\n }\n\n const isFocused = !disabled && (this.state.focusedByTab || focused);\n\n const linkProps = {\n className: cx(\n use === 'default' && styles.useDefault(this.theme),\n use === 'success' && styles.useSuccess(this.theme),\n use === 'danger' && styles.useDanger(this.theme),\n use === 'grayed' && styles.useGrayed(this.theme),\n !!_button && styles.button(this.theme),\n !!_buttonOpened && styles.buttonOpened(this.theme),\n this.getLinkClassName(isFocused, Boolean(disabled || loading)),\n ),\n href,\n rel,\n onClick: this.handleClick,\n onFocus: this.handleFocus,\n onBlur: this.handleBlur,\n tabIndex: disabled || loading ? -1 : this.props.tabIndex,\n };\n\n let child = this.props.children;\n if (_isTheme2022) {\n child = <span className={cx(globalClasses.text, styles.lineText(this.theme))}>{this.props.children}</span>;\n }\n\n return (\n <Component data-tid={LinkDataTids.root} {...rest} {...linkProps}>\n {iconElement}\n {child}\n {arrow}\n </Component>\n );\n };\n\n private handleFocus = () => {\n if (!this.props.disabled) {\n // focus event fires before keyDown eventlistener\n // so we should check tabPressed in async way\n requestAnimationFrame(() => {\n if (keyListener.isTabPressed) {\n this.setState({ focusedByTab: true });\n }\n });\n }\n };\n\n private handleBlur = () => {\n this.setState({ focusedByTab: false });\n };\n\n private handleClick = (event: React.MouseEvent<HTMLAnchorElement>) => {\n const { onClick, disabled, loading } = this.props;\n const href = this.getProps().href;\n if (!href) {\n event.preventDefault();\n }\n if (onClick && !disabled && !loading) {\n onClick(event);\n }\n };\n\n private getLinkClassName(focused: boolean, disabled: boolean): string {\n const { use } = this.getProps();\n const isBorderBottom = parseInt(this.theme.linkLineBorderBottomWidth) > 0;\n const isFocused = focused && !disabled;\n\n return !isBorderBottom\n ? cx(\n styles.root(this.theme),\n isFocused && styles.focus(this.theme),\n disabled && styles.disabled(this.theme),\n use === 'grayed' && focused && styles.useGrayedFocus(this.theme),\n )\n : cx(\n styles.lineRoot(),\n disabled && styles.disabled(this.theme),\n isFocused && use === 'default' && styles.lineFocus(this.theme),\n isFocused && use === 'success' && styles.lineFocusSuccess(this.theme),\n isFocused && use === 'danger' && styles.lineFocusDanger(this.theme),\n isFocused && use === 'grayed' && styles.lineFocusGrayed(this.theme),\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["Link.tsx"],"names":["LinkDataTids","root","Link","rootNode","getProps","defaultProps","state","focusedByTab","renderMain","props","disabled","href","icon","use","loading","_button","_buttonOpened","relOrigin","rel","Component","as","focused","rest","_isTheme2022","theme","iconElement","styles","arrow","isFocused","linkProps","className","useRoot","useDefault","useSuccess","useDanger","useGrayed","button","buttonOpened","getLinkClassName","Boolean","onClick","handleClick","onFocus","handleFocus","onBlur","handleBlur","tabIndex","child","children","globalClasses","text","lineText","requestAnimationFrame","keyListener","isTabPressed","setState","event","preventDefault","render","ThemeFactory","create","setRootNode","isBorderBottom","parseInt","linkLineBorderBottomWidth","focus","useGrayedFocus","lineRoot","disabledDark22Theme","lineFocus","lineFocusSuccess","lineFocusDanger","lineFocusGrayed","React","__KONTU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JjC,CADG;;AAOH;AACEE,iBAAOyC,QAAP,EADF;AAEEzD,IAAAA,QAAQ,IAAIgB,aAAOhB,QAAP,CAAgB,KAAKc,KAArB,CAFd;AAGEd,IAAAA,QAAQ,IAAIa,YAAZ,IAA4B,+BAAY,KAAKC,KAAjB,CAA5B,IAAuDE,aAAO0C,mBAAP,EAHzD;AAIExC,IAAAA,SAAS,IAAIf,GAAG,KAAK,SAArB,IAAkCa,aAAO2C,SAAP,CAAiB,KAAK7C,KAAtB,CAJpC;AAKEI,IAAAA,SAAS,IAAIf,GAAG,KAAK,SAArB,IAAkCa,aAAO4C,gBAAP,CAAwB,KAAK9C,KAA7B,CALpC;AAMEI,IAAAA,SAAS,IAAIf,GAAG,KAAK,QAArB,IAAiCa,aAAO6C,eAAP,CAAuB,KAAK/C,KAA5B,CANnC;AAOEI,IAAAA,SAAS,IAAIf,GAAG,KAAK,QAArB,IAAiCa,aAAO8C,eAAP,CAAuB,KAAKhD,KAA5B,CAPnC,CAPJ;;AAgBD,G,eA/JuBiD,eAAMtD,S,WAChBuD,mB,GAAsB,M,UAEtBC,S,GAAY,EACxBjE,QAAQ,EAAEkE,mBAAUC,IADI,EAGxBlE,IAAI,EAAEiE,mBAAUE,MAHQ,EAKxBlE,IAAI,EAAEgE,mBAAUG,IALQ,EAOxBlE,GAAG,EAAE+D,mBAAUI,KAAV,CAAgB,CAAC,SAAD,EAAY,SAAZ,EAAuB,QAAvB,EAAiC,QAAjC,CAAhB,CAPmB,E,UAUZ3E,Y,GAA6B,EACzCM,IAAI,EAAE,EADmC,EAEzCE,GAAG,EAAE,SAFoC,EAGzCO,EAAE,EAAE,GAHqC,E","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nimport { Override } from '../../typings/utility-types';\nimport { keyListener } from '../../lib/events/keyListener';\nimport { Theme, ThemeIn } from '../../lib/theming/Theme';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { isExternalLink } from '../../lib/utils';\nimport { Spinner } from '../Spinner';\nimport { CommonProps, CommonWrapper, CommonWrapperRestProps } from '../../internal/CommonWrapper';\nimport { cx } from '../../lib/theming/Emotion';\nimport { rootNode, TSetRootNode } from '../../lib/rootNode';\nimport { createPropsGetter, DefaultizedProps } from '../../lib/createPropsGetter';\nimport { ThemeFactory } from '../../lib/theming/ThemeFactory';\nimport { isDarkTheme, isTheme2022 } from '../../lib/theming/ThemeHelpers';\n\nimport { globalClasses, styles } from './Link.styles';\n\nexport interface LinkProps\n extends CommonProps,\n Override<\n React.AnchorHTMLAttributes<HTMLAnchorElement>,\n {\n /**\n * Отключенное состояние.\n */\n disabled?: boolean;\n /**\n * HTML-атрибут `href`.\n */\n href?: string;\n /**\n * Добавляет ссылке иконку.\n */\n icon?: React.ReactElement<any>;\n /**\n * Тема ссылки.\n */\n use?: 'default' | 'success' | 'danger' | 'grayed';\n /**\n * @ignore\n */\n _button?: boolean;\n /**\n * @ignore\n */\n _buttonOpened?: boolean;\n /**\n * HTML-атрибут `tabindex`.\n */\n tabIndex?: number;\n /**\n * Переводит ссылку в состояние загрузки.\n */\n loading?: boolean;\n /**\n * HTML-событие `onclick`.\n */\n onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;\n\n /**\n * Обычный объект с переменными темы.\n * Он будет объединён с темой из контекста.\n */\n theme?: ThemeIn;\n /**\n * Компонент, используемый в качестве корневого узла.\n * @ignore\n */\n as?: React.ElementType | keyof React.ReactHTML;\n /**\n * @ignore\n */\n focused?: boolean;\n }\n > {}\n\nexport interface LinkState {\n focusedByTab: boolean;\n}\n\nexport const LinkDataTids = {\n root: 'Link__root',\n} as const;\n\ntype DefaultProps = Required<Pick<LinkProps, 'href' | 'use' | 'as'>>;\ntype DefaultizedLinkProps = DefaultizedProps<LinkProps, DefaultProps>;\n\n/**\n * Элемент ссылки из HTML.\n */\n@rootNode\nexport class Link extends React.Component<LinkProps, LinkState> {\n public static __KONTUR_REACT_UI__ = 'Link';\n\n public static propTypes = {\n disabled: PropTypes.bool,\n\n href: PropTypes.string,\n\n icon: PropTypes.node,\n\n use: PropTypes.oneOf(['default', 'success', 'danger', 'grayed']),\n };\n\n public static defaultProps: DefaultProps = {\n href: '',\n use: 'default',\n as: 'a',\n };\n\n private getProps = createPropsGetter(Link.defaultProps);\n\n public state: LinkState = {\n focusedByTab: false,\n };\n\n private theme!: Theme;\n private setRootNode!: TSetRootNode;\n\n public render(): JSX.Element {\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = this.props.theme ? ThemeFactory.create(this.props.theme as Theme, theme) : theme;\n return (\n <CommonWrapper rootNodeRef={this.setRootNode} {...this.getProps()}>\n {this.renderMain}\n </CommonWrapper>\n );\n }}\n </ThemeContext.Consumer>\n );\n }\n\n private renderMain = (props: CommonWrapperRestProps<DefaultizedLinkProps>) => {\n const {\n disabled,\n href,\n icon,\n use,\n loading,\n _button,\n _buttonOpened,\n rel: relOrigin,\n as: Component,\n focused = false,\n ...rest\n } = props;\n const _isTheme2022 = isTheme2022(this.theme);\n\n let iconElement = null;\n if (icon) {\n iconElement = (\n <span className={styles.icon(this.theme)}>{loading ? <Spinner caption={null} dimmed inline /> : icon}</span>\n );\n }\n\n let arrow = null;\n if (_button) {\n arrow = <span className={styles.arrow()} />;\n }\n\n let rel = relOrigin;\n if (typeof rel === 'undefined' && href) {\n rel = `noopener${isExternalLink(href) ? ' noreferrer' : ''}`;\n }\n\n const isFocused = !disabled && (this.state.focusedByTab || focused);\n\n const linkProps = {\n className: cx(\n styles.useRoot(),\n use === 'default' && styles.useDefault(this.theme),\n use === 'success' && styles.useSuccess(this.theme),\n use === 'danger' && styles.useDanger(this.theme),\n use === 'grayed' && styles.useGrayed(this.theme),\n !!_button && styles.button(this.theme),\n !!_buttonOpened && styles.buttonOpened(this.theme),\n this.getLinkClassName(isFocused, Boolean(disabled || loading), _isTheme2022),\n ),\n href,\n rel,\n onClick: this.handleClick,\n onFocus: this.handleFocus,\n onBlur: this.handleBlur,\n tabIndex: disabled || loading ? -1 : this.props.tabIndex,\n };\n\n let child = this.props.children;\n if (_isTheme2022) {\n child = <span className={cx(globalClasses.text, styles.lineText(this.theme))}>{this.props.children}</span>;\n }\n\n return (\n <Component data-tid={LinkDataTids.root} {...rest} {...linkProps}>\n {iconElement}\n {child}\n {arrow}\n </Component>\n );\n };\n\n private handleFocus = () => {\n if (!this.props.disabled) {\n // focus event fires before keyDown eventlistener\n // so we should check tabPressed in async way\n requestAnimationFrame(() => {\n if (keyListener.isTabPressed) {\n this.setState({ focusedByTab: true });\n }\n });\n }\n };\n\n private handleBlur = () => {\n this.setState({ focusedByTab: false });\n };\n\n private handleClick = (event: React.MouseEvent<HTMLAnchorElement>) => {\n const { onClick, disabled, loading } = this.props;\n const href = this.getProps().href;\n if (!href) {\n event.preventDefault();\n }\n if (onClick && !disabled && !loading) {\n onClick(event);\n }\n };\n\n private getLinkClassName(focused: boolean, disabled: boolean, _isTheme2022: boolean): string {\n const { use } = this.getProps();\n const isBorderBottom = parseInt(this.theme.linkLineBorderBottomWidth) > 0;\n const isFocused = focused && !disabled;\n\n return !isBorderBottom\n ? cx(\n styles.root(this.theme),\n isFocused && styles.focus(this.theme),\n disabled && styles.disabled(this.theme),\n use === 'grayed' && focused && styles.useGrayedFocus(this.theme),\n )\n : cx(\n styles.lineRoot(),\n disabled && styles.disabled(this.theme),\n disabled && _isTheme2022 && isDarkTheme(this.theme) && styles.disabledDark22Theme(),\n isFocused && use === 'default' && styles.lineFocus(this.theme),\n isFocused && use === 'success' && styles.lineFocusSuccess(this.theme),\n isFocused && use === 'danger' && styles.lineFocusDanger(this.theme),\n isFocused && use === 'grayed' && styles.lineFocusGrayed(this.theme),\n );\n }\n}\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export declare const linkMixin: (hoverTextDecoration: string) => string;
|
|
2
2
|
export declare const linkDisabledMixin: () => string;
|
|
3
3
|
export declare const linkUseColorsMixin: (mainColor: string, hoverColor: string, activeColor: string) => string;
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const linkUseLineColorsHoverMixin: (hoverColor: string, nestedSelector: string) => string;
|
|
4
|
+
export declare const linkUseLineWithoutOpacity: () => string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";exports.__esModule = true;exports.
|
|
1
|
+
"use strict";exports.__esModule = true;exports.linkUseLineWithoutOpacity = exports.linkUseColorsMixin = exports.linkMixin = exports.linkDisabledMixin = void 0;var linkMixin = function linkMixin(hoverTextDecoration) {
|
|
2
2
|
return "\n border-radius: 1px;\n outline: none;\n text-decoration: none;\n\n &:hover {\n text-decoration: " +
|
|
3
3
|
|
|
4
4
|
|
|
@@ -37,20 +37,8 @@ var linkUseColorsMixin = function linkUseColorsMixin(mainColor, hoverColor, acti
|
|
|
37
37
|
|
|
38
38
|
};exports.linkUseColorsMixin = linkUseColorsMixin;
|
|
39
39
|
|
|
40
|
-
var
|
|
41
|
-
return "\n
|
|
42
|
-
mainColor + ";\n\n &:active {\n border-bottom-color: " +
|
|
40
|
+
var linkUseLineWithoutOpacity = function linkUseLineWithoutOpacity() {
|
|
41
|
+
return "\n animation: none !important;\n ";
|
|
43
42
|
|
|
44
43
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
};exports.linkUseLineColorsMixin = linkUseLineColorsMixin;
|
|
49
|
-
|
|
50
|
-
var linkUseLineColorsHoverMixin = function linkUseLineColorsHoverMixin(hoverColor, nestedSelector) {
|
|
51
|
-
return "\n &:hover " +
|
|
52
|
-
nestedSelector + " {\n border-bottom-color: " +
|
|
53
|
-
hoverColor + ";\n }\n ";
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
};exports.linkUseLineColorsHoverMixin = linkUseLineColorsHoverMixin;
|
|
44
|
+
};exports.linkUseLineWithoutOpacity = linkUseLineWithoutOpacity;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Link.mixins.ts"],"names":["linkMixin","hoverTextDecoration","linkDisabledMixin","linkUseColorsMixin","mainColor","hoverColor","activeColor","
|
|
1
|
+
{"version":3,"sources":["Link.mixins.ts"],"names":["linkMixin","hoverTextDecoration","linkDisabledMixin","linkUseColorsMixin","mainColor","hoverColor","activeColor","linkUseLineWithoutOpacity"],"mappings":"+JAAO,IAAMA,SAAS,GAAG,SAAZA,SAAY,CAACC,mBAAD,EAAiC;AACxD;;;;;;AAMuBA,EAAAA,mBANvB;;;AASD,CAVM,C;;AAYA,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,GAAM;AACrC;;;;;;;;;;AAUD,CAXM,C;;AAaA,IAAMC,kBAAkB,GAAG,SAArBA,kBAAqB,CAACC,SAAD,EAAoBC,UAApB,EAAwCC,WAAxC,EAAgE;AAChG;AACWF,EAAAA,SADX;;;AAIaC,EAAAA,UAJb;;;;AAQaC,EAAAA,WARb;;;AAWD,CAZM,C;;AAcA,IAAMC,yBAAyB,GAAG,SAA5BA,yBAA4B,GAAM;AAC7C;;;AAGD,CAJM,C","sourcesContent":["export const linkMixin = (hoverTextDecoration: string) => {\n return `\n border-radius: 1px;\n outline: none;\n text-decoration: none;\n\n &:hover {\n text-decoration: ${hoverTextDecoration};\n }\n `;\n};\n\nexport const linkDisabledMixin = () => {\n return `\n box-shadow: none;\n cursor: default;\n pointer-events: none;\n text-decoration: none;\n\n &:hover {\n text-decoration: none;\n }\n `;\n};\n\nexport const linkUseColorsMixin = (mainColor: string, hoverColor: string, activeColor: string) => {\n return `\n color: ${mainColor};\n\n &:hover {\n color: ${hoverColor};\n }\n\n &:active {\n color: ${activeColor};\n }\n `;\n};\n\nexport const linkUseLineWithoutOpacity = () => {\n return `\n animation: none !important;\n `;\n};\n"]}
|
|
@@ -13,6 +13,7 @@ export declare const styles: {
|
|
|
13
13
|
button(t: Theme): string;
|
|
14
14
|
buttonOpened(t: Theme): string;
|
|
15
15
|
arrow(): string;
|
|
16
|
+
useRoot(): string;
|
|
16
17
|
useDefault(t: Theme): string;
|
|
17
18
|
useSuccess(t: Theme): string;
|
|
18
19
|
useDanger(t: Theme): string;
|
|
@@ -20,5 +21,6 @@ export declare const styles: {
|
|
|
20
21
|
useGrayedFocus(t: Theme): string;
|
|
21
22
|
focus(t: Theme): string;
|
|
22
23
|
disabled(t: Theme): string;
|
|
24
|
+
disabledDark22Theme(): string;
|
|
23
25
|
icon(t: Theme): string;
|
|
24
26
|
};
|