@antscorp/antsomi-ui 1.3.5-beta.928 → 1.3.5-beta.929

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.
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { IconProps as OriginIconProps } from '../../icons/types';
3
2
  export interface IconProps extends OriginIconProps {
4
3
  size?: number;
@@ -1,3 +1,13 @@
1
- /// <reference types="react" />
2
- export declare const Switch: import("react").ForwardRefExoticComponent<import("antd").SwitchProps & import("react").RefAttributes<HTMLElement>>;
3
- export type { SwitchProps } from 'antd';
1
+ import React from 'react';
2
+ import { type SwitchProps as AntdSwitchProps } from 'antd';
3
+ import { DataType } from 'csstype';
4
+ declare module 'react' {
5
+ interface CSSProperties {
6
+ '--switch-color'?: DataType.Color;
7
+ }
8
+ }
9
+ type SwitchProps = AntdSwitchProps & {
10
+ color?: string;
11
+ };
12
+ declare const Switch: React.FC<SwitchProps>;
13
+ export { Switch, type SwitchProps };
@@ -1,3 +1,8 @@
1
- import { Switch as AntdSwitch } from 'antd';
2
- export const Switch = AntdSwitch;
3
- Switch.defaultProps = {};
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { THEME } from '@antscorp/antsomi-ui/es/constants';
3
+ import { StyledSwitch } from './styled';
4
+ const Switch = props => {
5
+ const { color = THEME.token?.colorPrimary || '#005eb8', ...rest } = props;
6
+ return _jsx(StyledSwitch, { style: { '--switch-color': color }, ...rest });
7
+ };
8
+ export { Switch };
@@ -1,2 +1 @@
1
- export { Switch } from './Switch';
2
- export type { SwitchProps } from 'antd';
1
+ export { Switch, type SwitchProps } from './Switch';
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const StyledSwitch: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd").SwitchProps & import("react").RefAttributes<HTMLElement>>, any, {}, never>;
@@ -0,0 +1,60 @@
1
+ import { THEME } from '@antscorp/antsomi-ui/es/constants';
2
+ import { Switch } from 'antd';
3
+ import styled from 'styled-components';
4
+ export const StyledSwitch = styled(Switch) `
5
+ &.antsomi-switch {
6
+ border: 2px solid var(--switch-color);
7
+
8
+ &.antsomi-switch-checked {
9
+ background: var(--switch-color);
10
+
11
+ > .antsomi-switch-handle {
12
+ &::before {
13
+ background-color: ${THEME.token?.bw0};
14
+ }
15
+ }
16
+
17
+ .antsomi-switch-inner {
18
+ padding-inline-start: 4px;
19
+ padding-inline-end: 18px;
20
+ }
21
+
22
+ &:hover:not(.antsomi-switch-disabled) {
23
+ background-color: var(--switch-color);
24
+ }
25
+ }
26
+
27
+ &.antsomi-switch-disabled {
28
+ background: ${THEME.token?.bw0};
29
+ border-color: ${THEME.token?.colorTextPlaceholder};
30
+
31
+ > .antsomi-switch-handle {
32
+ &::before {
33
+ background-color: ${THEME.token?.colorTextPlaceholder};
34
+ }
35
+ }
36
+
37
+ &.antsomi-switch-checked {
38
+ background: ${THEME.token?.colorTextPlaceholder};
39
+ border-color: ${THEME.token?.colorTextPlaceholder};
40
+
41
+ > .antsomi-switch-handle {
42
+ &::before {
43
+ background-color: ${THEME.token?.bw0};
44
+ }
45
+ }
46
+ }
47
+ }
48
+
49
+ .antsomi-switch-handle {
50
+ &::before {
51
+ background-color: var(--switch-color);
52
+ }
53
+ }
54
+
55
+ .antsomi-switch-inner {
56
+ padding-inline-start: 4px;
57
+ padding-inline-end: 18px;
58
+ }
59
+ }
60
+ `;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { PayloadInfo } from '@antscorp/antsomi-ui/es/types';
2
3
  export type TDisplayFormat = 'number' | 'percentage' | 'currency' | 'datetime';
3
4
  type DisplayFormatProps = {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { TFeatureMenu } from '@antscorp/antsomi-ui/es/models/LeftMenu';
3
2
  export type TMenuItem = Omit<Partial<TFeatureMenu>, 'children' | keyof TRequireMenuItemKey> & {
4
3
  key: string;
@@ -3,4 +3,5 @@
3
3
  * Asynchronously loads the component for TemplateListing
4
4
  *
5
5
  */
6
+ /// <reference types="react" />
6
7
  export declare const TemplateListing: (props: import("./types").TemplateListingProps<{}>) => JSX.Element;
@@ -999,46 +999,6 @@ export const GlobalStyle = () => (_jsx(Global, { styles: css `
999
999
  }
1000
1000
  }
1001
1001
 
1002
- /* Switch */
1003
- .antsomi-switch {
1004
- border: 2px solid ${THEME.token?.colorPrimary} !important;
1005
-
1006
- &.antsomi-switch-checked {
1007
- > .antsomi-switch-handle {
1008
- &::before {
1009
- background-color: ${THEME.token?.bw0} !important;
1010
- }
1011
- }
1012
- }
1013
-
1014
- &.antsomi-switch-disabled[aria-checked='true'] {
1015
- background-color: ${THEME.token?.colorTextPlaceholder} !important;
1016
- border: 2px solid ${THEME.token?.colorTextPlaceholder} !important;
1017
-
1018
- > .antsomi-switch-handle {
1019
- &::before {
1020
- background-color: ${THEME.token?.bw0} !important;
1021
- }
1022
- }
1023
- }
1024
-
1025
- &.antsomi-switch-disabled[aria-checked='false'] {
1026
- background-color: ${THEME.token?.bw0} !important;
1027
- border: 2px solid ${THEME.token?.colorTextPlaceholder} !important;
1028
-
1029
- > .antsomi-switch-handle {
1030
- &::before {
1031
- background-color: ${THEME.token?.colorTextPlaceholder} !important;
1032
- }
1033
- }
1034
- }
1035
-
1036
- .antsomi-switch-inner {
1037
- padding-inline-start: 4px !important;
1038
- padding-inline-end: 18px !important;
1039
- }
1040
- }
1041
-
1042
1002
  /* Tabs */
1043
1003
  .antsomi-tabs {
1044
1004
  .antsomi-tabs-tab {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { AREA_LAYOUT_KEYS, BLOCK_KEYS } from '../constants';
3
2
  import { TAlign } from './variables';
4
3
  export type TImageStyles = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.928",
3
+ "version": "1.3.5-beta.929",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",