@broxus/react-uikit 0.9.0 → 0.9.2

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.
@@ -17,4 +17,4 @@ export interface ButtonOwnProps extends Partial<AnchorButtonProps>, Partial<Nati
17
17
  type?: 'default' | 'primary' | 'secondary' | 'tertiary' | 'danger' | 'link' | 'text';
18
18
  }
19
19
  export type ButtonProps<E extends React.ElementType = React.ElementType> = React.PropsWithChildren<ButtonOwnProps & PolymorphicProps<E>> & PolymorphicProps<E, ButtonOwnProps>;
20
- export declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps<React.ElementType<any>>, "ref"> & React.RefAttributes<any>>;
20
+ export declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<any>>;
@@ -279,21 +279,22 @@
279
279
  * The same for all style modifiers
280
280
  */
281
281
 
282
- .uk-button-default:disabled,
283
- .uk-button-primary:disabled,
284
- .uk-button-secondary:disabled,
285
- .uk-button-tertiary:disabled,
286
- .uk-button-success:disabled,
287
- .uk-button-warning:disabled,
288
- .uk-button-danger:disabled {
289
- background-color: var(--button-disabled-background);
290
- color: var(--button-disabled-color);
291
- @if mixin-exists(hook-button-disabled) {
292
- @include hook-button-disabled;
282
+ @if $button-disabled-mode == same {
283
+ .uk-button-default:disabled,
284
+ .uk-button-primary:disabled,
285
+ .uk-button-secondary:disabled,
286
+ .uk-button-tertiary:disabled,
287
+ .uk-button-success:disabled,
288
+ .uk-button-warning:disabled,
289
+ .uk-button-danger:disabled {
290
+ background-color: var(--button-disabled-background);
291
+ color: var(--button-disabled-color);
292
+ @if mixin-exists(hook-button-disabled) {
293
+ @include hook-button-disabled;
294
+ }
293
295
  }
294
296
  }
295
297
 
296
-
297
298
  /* Size modifiers
298
299
  ========================================================================== */
299
300
 
@@ -12,5 +12,5 @@ export interface PolymorphicComponent<Component extends React.ElementType = Reac
12
12
  defaultProps?: Partial<any>;
13
13
  id?: string;
14
14
  }
15
- export declare const Component: React.ForwardRefExoticComponent<Omit<ComponentOwnProp<React.ElementType<any>>, "ref"> & React.RefAttributes<unknown>>;
15
+ export declare const Component: React.ForwardRefExoticComponent<Omit<ComponentOwnProp<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<unknown>>;
16
16
  export {};
@@ -9,4 +9,4 @@ export interface ContainerOwnProps {
9
9
  size?: 'xsmall' | 'small' | 'large' | 'xlarge' | 'expand';
10
10
  }
11
11
  export type ContainerProps<E extends React.ElementType = React.ElementType> = React.PropsWithChildren<ContainerOwnProps & PolymorphicProps<E>> & PolymorphicProps<E, ContainerOwnProps>;
12
- export declare const Container: React.MemoExoticComponent<(<E extends React.ElementType<any> = "div">(props: ContainerProps<E>) => React.JSX.Element)>;
12
+ export declare const Container: React.MemoExoticComponent<(<E extends React.ElementType<any, keyof React.JSX.IntrinsicElements> = "div">(props: ContainerProps<E>) => React.JSX.Element)>;
@@ -8,7 +8,7 @@ import './index.scss';
8
8
  const defaultPushState = { distance: 180 };
9
9
  export const Drawer = React.forwardRef((props, ref) => {
10
10
  const config = useConfig();
11
- const { animation = 'slide', children, className, contentWrapperStyle, defaultOpen, destroyOnClose, direction, getContainer = config.getPopupContainer, keyboard = true, mask = true, maskClosable = true, motion, open, placement = 'right', prefixCls = config.prefixCls, push = defaultPushState, size, rootClassName, rootStyle, trigger, onClose: onCloseCallback, ...restProps } = props;
11
+ const { animation = 'slide', children, className, defaultOpen, destroyOnClose, direction, getContainer = config.getPopupContainer, keyboard = true, mask = true, maskClosable = true, motion, open, placement = 'right', prefixCls = config.prefixCls, push = defaultPushState, size, rootClassName, rootStyle, trigger, onClose: onCloseCallback, ...restProps } = props;
12
12
  const [isShown, setShown] = React.useState(defaultOpen);
13
13
  const [internalOpen, setOpen] = React.useState(defaultOpen);
14
14
  const mergedOpen = open === undefined ? internalOpen : open;
@@ -101,11 +101,7 @@ export const Drawer = React.forwardRef((props, ref) => {
101
101
  React.useEffect(() => cleanup, [cleanup]);
102
102
  return (React.createElement(React.Fragment, null,
103
103
  trigger?.({ collapse, expand, isOpen: !!mergedOpen }),
104
- React.createElement(RcDrawer, { className: className, contentWrapperStyle: {
105
- height: undefined,
106
- width: undefined,
107
- ...contentWrapperStyle,
108
- }, destroyOnClose: destroyOnClose, keyboard: keyboard, getContainer: getContainer, mask: mask, maskClosable: maskClosable, maskMotion: {
104
+ React.createElement(RcDrawer, { className: className, destroyOnClose: destroyOnClose, keyboard: keyboard, getContainer: getContainer, mask: mask, maskClosable: maskClosable, maskMotion: {
109
105
  motionName: getMotionName(prefixCls || config.prefixCls, 'drawer-fade'),
110
106
  }, motion: mergedMotion, open: mergedOpen, placement: placement, prefixCls: rootCls, push: push, rootClassName: drawerRootClassName, rootStyle: { ...rootStyle, display: (mergedOpen || isShown) ? 'block' : '' }, onClose: onClose, ...restProps }, children)));
111
107
  });
@@ -5,13 +5,47 @@ import { useConfig } from '../../components/ConfigProvider';
5
5
  import { FlexContext } from '../../components/Flex/context';
6
6
  import { getBreakpointsConfigClasses } from '../../utils';
7
7
  const defaultElement = 'div';
8
+ const alignContentMap = new Map([
9
+ ['around', 'around'],
10
+ ['between', 'between'],
11
+ ['end', 'right'],
12
+ ['middle', 'middle'],
13
+ ['start', 'left'],
14
+ ['stretch', 'stretch'],
15
+ ]);
16
+ const alignItemsMap = new Map([
17
+ ['end', 'bottom'],
18
+ ['middle', 'middle'],
19
+ ['start', 'top'],
20
+ ['stretch', 'stretch'],
21
+ ]);
22
+ const justifyContentMap = new Map([
23
+ ['around', 'around'],
24
+ ['between', 'between'],
25
+ ['end', 'right'],
26
+ ['center', 'center'],
27
+ ['start', 'left'],
28
+ ]);
29
+ function mapJustifyContentBreakpoints(value) {
30
+ const config = {};
31
+ for (const key in value) {
32
+ // @ts-ignore
33
+ if (justifyContentMap.has(value[key])) {
34
+ // @ts-ignore
35
+ config[key] = justifyContentMap.get(value[key]);
36
+ }
37
+ }
38
+ return config;
39
+ }
8
40
  export function Flex(props) {
9
41
  const config = useConfig();
10
42
  const { alignContent, alignItems, className, flexDirection, flexWrap, inline, justifyContent, prefixCls = config.prefixCls, ...restProps } = props;
11
43
  const rootCls = React.useMemo(() => config.getRootPrefixCls(prefixCls || config.prefixCls, 'flex'), [config, prefixCls]);
12
- const justifyContentCls = React.useMemo(() => (typeof justifyContent === 'string'
13
- ? `${rootCls}-${justifyContent}`
14
- : getBreakpointsConfigClasses(prefixCls || config.prefixCls, 'flex', justifyContent)), [config.prefixCls, justifyContent, prefixCls, rootCls]);
44
+ const justifyContentCls = React.useMemo(
45
+ // eslint-disable-next-line no-nested-ternary
46
+ () => (typeof justifyContent === 'string'
47
+ ? (justifyContentMap.has(justifyContent) ? `${rootCls}-${justifyContentMap.get(justifyContent)}` : '')
48
+ : getBreakpointsConfigClasses(prefixCls || config.prefixCls, 'flex', mapJustifyContentBreakpoints(justifyContent || {}))), [config.prefixCls, justifyContent, prefixCls, rootCls]);
15
49
  const context = React.useMemo(() => ({
16
50
  getRootCls() {
17
51
  return rootCls;
@@ -21,9 +55,9 @@ export function Flex(props) {
21
55
  React.createElement(Component, { className: classNames({
22
56
  [rootCls]: !inline,
23
57
  [`${rootCls}-inline`]: inline,
24
- [`${rootCls}-${alignItems}`]: alignItems !== undefined,
58
+ [`${rootCls}-${alignItemsMap.get(alignItems)}`]: alignItems && alignItemsMap.has(alignItems),
25
59
  [`${rootCls}-${flexDirection}`]: flexDirection !== undefined,
26
60
  [`${rootCls}-${flexWrap}`]: flexWrap !== undefined,
27
- [`${rootCls}-wrap-${alignContent}`]: alignContent !== undefined,
61
+ [`${rootCls}-wrap-${alignContentMap.get(alignContent)}`]: alignContent && alignContentMap.has(alignContent),
28
62
  }, justifyContentCls, className), component: defaultElement, ...restProps })));
29
63
  }
@@ -6,4 +6,4 @@ export interface LinkOwnProps extends React.AnchorHTMLAttributes<HTMLAnchorEleme
6
6
  type?: 'heading' | 'muted' | 'reset' | 'text' | 'toggle';
7
7
  }
8
8
  export type LinkProps<E extends React.ElementType = React.ElementType> = React.PropsWithChildren<LinkOwnProps & PolymorphicProps<E>> & PolymorphicProps<E, LinkOwnProps>;
9
- export declare const Link: React.ForwardRefExoticComponent<Omit<LinkProps<React.ElementType<any>>, "ref"> & React.RefAttributes<unknown>>;
9
+ export declare const Link: React.ForwardRefExoticComponent<Omit<LinkProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<unknown>>;
@@ -610,8 +610,7 @@
610
610
  margin: 0;
611
611
  max-height: 200px;
612
612
  outline: none;
613
- overflow-x: hidden;
614
- overflow-y: auto;
613
+ overflow: hidden auto;
615
614
  padding: 0;
616
615
  text-align: left;
617
616
  @if mixin-exists(hook-tabs-dropdown-menu) {
@@ -769,4 +768,5 @@
769
768
  --inverse-tabs-tab-hover-color: var(--inverse-global-color);
770
769
  --inverse-tabs-tab-active-color: var(--inverse-global-emphasis-color);
771
770
  --inverse-tabs-tab-disabled-color: var(--inverse-global-muted-color);
771
+ --inverse-tabs-ink-bar-color: var(--inverse-global-primary-background);
772
772
  }
@@ -2095,6 +2095,10 @@
2095
2095
  @mixin hook-inverse-tabs-tab-hover() {}
2096
2096
  @mixin hook-inverse-tabs-tab-active() {}
2097
2097
  @mixin hook-inverse-tabs-tab-disabled() {}
2098
+ @mixin hook-inverse-tabs-tab-remove() {}
2099
+ @mixin hook-inverse-tabs-tab-remove-hover() {}
2100
+ @mixin hook-inverse-tabs-tab-remove-active() {}
2101
+ @mixin hook-inverse-tabs-ink-bar() {}
2098
2102
  @mixin hook-inverse-component-tabs() {
2099
2103
  .uk-tabs {
2100
2104
  @if mixin-exists(hook-inverse-tabs) {
@@ -2102,34 +2106,64 @@
2102
2106
  }
2103
2107
  }
2104
2108
 
2105
- .uk-tabs > * > a {
2109
+ .uk-tabs-tab,
2110
+ .uk-tabs-nav-more,
2111
+ .uk-tabs-nav-add {
2106
2112
  color: var(--inverse-tabs-tab-color);
2107
2113
  @if mixin-exists(hook-inverse-tabs-tab) {
2108
2114
  @include hook-inverse-tabs-tab;
2109
2115
  }
2110
2116
  }
2111
2117
 
2112
- .uk-tabs > * > a:hover,
2113
- .uk-tabs > * > a:focus {
2118
+ .uk-tabs-tab:not(.uk-tabs-tab-disabled):hover,
2119
+ .uk-tabs-tab:not(.uk-tabs-tab-disabled):focus,
2120
+ .uk-tabs-nav-add:hover,
2121
+ .uk-tabs-nav-add:focus {
2114
2122
  color: var(--inverse-tabs-tab-hover-color);
2115
2123
  @if mixin-exists(hook-inverse-tabs-tab-hover) {
2116
2124
  @include hook-inverse-tabs-tab-hover;
2117
2125
  }
2118
2126
  }
2119
2127
 
2120
- .uk-tabs > .uk-active > a {
2128
+ .uk-tabs-tab-active:not(.uk-tabs-tab-disabled) {
2121
2129
  color: var(--inverse-tabs-tab-active-color);
2122
2130
  @if mixin-exists(hook-inverse-tabs-tab-active) {
2123
2131
  @include hook-inverse-tabs-tab-active;
2124
2132
  }
2125
2133
  }
2126
2134
 
2127
- .uk-tabs > .uk-disabled > a {
2135
+ .uk-tabs-tab-disabled {
2128
2136
  color: var(--inverse-tabs-tab-disabled-color);
2129
2137
  @if mixin-exists(hook-inverse-tabs-tab-disabled) {
2130
2138
  @include hook-inverse-tabs-tab-disabled;
2131
2139
  }
2132
2140
  }
2141
+
2142
+ .uk-tabs-tab-remove {
2143
+ @if mixin-exists(hook-inverse-tabs-tab-remove) {
2144
+ @include hook-inverse-tabs-tab-remove;
2145
+ }
2146
+ }
2147
+
2148
+ .uk-tabs-tab-remove:hover {
2149
+ @if mixin-exists(hook-inverse-tabs-tab-remove-hover) {
2150
+ @include hook-inverse-tabs-tab-remove-hover;
2151
+ }
2152
+ }
2153
+
2154
+ .uk-tabs-tab-remove:focus,
2155
+ .uk-tabs-tab-remove:active {
2156
+ @if mixin-exists(hook-inverse-tabs-tab-remove-active) {
2157
+ @include hook-inverse-tabs-tab-remove-active;
2158
+ }
2159
+ }
2160
+
2161
+ .uk-tabs-ink-bar {
2162
+ background: var(--inverse-tabs-ink-bar-color);
2163
+ @if mixin-exists(hook-inverse-tabs-ink-bar) {
2164
+ @include hook-inverse-tabs-ink-bar;
2165
+ }
2166
+ }
2133
2167
  }
2134
2168
 
2135
2169
  @mixin hook-table() {}
@@ -7,12 +7,6 @@
7
7
  @import 'mixin.scss';
8
8
 
9
9
 
10
- // Load deprecated components
11
- // ========================================================================
12
-
13
- $deprecated: false !default;
14
-
15
-
16
10
  // Breakpoints
17
11
  // ========================================================================
18
12
 
@@ -392,6 +386,7 @@ $inverse-breadcrumb-divider-color: $inverse-global-
392
386
  // Button
393
387
  // ========================================================================
394
388
 
389
+ $button-disabled-mode: same !default;
395
390
  $button-line-height: $global-control-height !default;
396
391
  $button-xsmall-line-height: $global-control-xsmall-height !default;
397
392
  $button-small-line-height: $global-control-small-height !default;