glints-aries 4.0.171 → 4.0.173
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/es/@next/ButtonGroup/ButtonGroup.d.ts +8 -0
- package/es/@next/ButtonGroup/ButtonGroup.js +16 -0
- package/es/@next/ButtonGroup/ButtonGroup.stories.js +1 -1
- package/es/@next/ButtonGroup/ButtonGroupStyle.d.ts +1 -6
- package/es/@next/ButtonGroup/ButtonGroupStyle.js +3 -9
- package/es/@next/ButtonGroup/index.d.ts +1 -2
- package/es/@next/ButtonGroup/index.js +1 -2
- package/es/@next/Popover/Popover.d.ts +10 -0
- package/es/@next/Popover/Popover.js +14 -0
- package/es/@next/Popover/Popover.stories.d.ts +4 -0
- package/es/@next/Popover/Popover.stories.js +132 -0
- package/es/@next/Popover/PopoverFilter.stories.d.ts +4 -0
- package/es/@next/Popover/PopoverFilter.stories.js +145 -0
- package/es/@next/Popover/PopoverStyle.d.ts +1 -0
- package/es/@next/Popover/PopoverStyle.js +7 -0
- package/es/@next/Popover/index.d.ts +1 -0
- package/es/@next/Popover/index.js +1 -0
- package/es/@next/Popover/popoverStoryHelper/CheckboxGroup.d.ts +8 -0
- package/es/@next/Popover/popoverStoryHelper/CheckboxGroup.js +60 -0
- package/es/@next/Popover/popoverStoryHelper/SalarySelector.d.ts +7 -0
- package/es/@next/Popover/popoverStoryHelper/SalarySelector.js +22 -0
- package/es/@next/Tabs/Tabs.stories.js +1 -1
- package/es/@next/Tag/Tag.d.ts +5 -0
- package/es/@next/Tag/Tag.js +16 -0
- package/es/@next/Tag/Tag.stories.d.ts +4 -0
- package/es/@next/Tag/Tag.stories.js +17 -0
- package/es/@next/Tag/TagStyle.d.ts +2 -0
- package/es/@next/Tag/TagStyle.js +9 -0
- package/es/@next/Tag/index.d.ts +1 -0
- package/es/@next/Tag/index.js +1 -0
- package/es/@next/index.d.ts +9 -7
- package/es/@next/index.js +9 -8
- package/lib/@next/ButtonGroup/ButtonGroup.d.ts +8 -0
- package/lib/@next/ButtonGroup/ButtonGroup.js +22 -0
- package/lib/@next/ButtonGroup/ButtonGroup.stories.js +4 -4
- package/lib/@next/ButtonGroup/ButtonGroupStyle.d.ts +1 -6
- package/lib/@next/ButtonGroup/ButtonGroupStyle.js +5 -11
- package/lib/@next/ButtonGroup/index.d.ts +1 -2
- package/lib/@next/ButtonGroup/index.js +3 -2
- package/lib/@next/Popover/Popover.d.ts +10 -0
- package/lib/@next/Popover/Popover.js +20 -0
- package/lib/@next/Popover/Popover.stories.d.ts +4 -0
- package/lib/@next/Popover/Popover.stories.js +141 -0
- package/lib/@next/Popover/PopoverFilter.stories.d.ts +4 -0
- package/lib/@next/Popover/PopoverFilter.stories.js +154 -0
- package/lib/@next/Popover/PopoverStyle.d.ts +1 -0
- package/lib/@next/Popover/PopoverStyle.js +11 -0
- package/lib/@next/Popover/index.d.ts +1 -0
- package/lib/@next/Popover/index.js +7 -0
- package/lib/@next/Popover/popoverStoryHelper/CheckboxGroup.d.ts +8 -0
- package/lib/@next/Popover/popoverStoryHelper/CheckboxGroup.js +67 -0
- package/lib/@next/Popover/popoverStoryHelper/SalarySelector.d.ts +7 -0
- package/lib/@next/Popover/popoverStoryHelper/SalarySelector.js +28 -0
- package/lib/@next/Tabs/Tabs.stories.js +1 -1
- package/lib/@next/Tag/Tag.d.ts +5 -0
- package/lib/@next/Tag/Tag.js +22 -0
- package/lib/@next/Tag/Tag.stories.d.ts +4 -0
- package/lib/@next/Tag/Tag.stories.js +24 -0
- package/lib/@next/Tag/TagStyle.d.ts +2 -0
- package/lib/@next/Tag/TagStyle.js +15 -0
- package/lib/@next/Tag/index.d.ts +1 -0
- package/lib/@next/Tag/index.js +9 -0
- package/lib/@next/index.d.ts +9 -7
- package/lib/@next/index.js +19 -15
- package/package.json +9 -4
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ButtonGroupProps extends React.HtmlHTMLAttributes<HTMLDivElement> {
|
|
3
|
+
segmented?: boolean;
|
|
4
|
+
fullWidth?: boolean;
|
|
5
|
+
/** Set this true when buttons are wrapped by another element (e.g as an activator for Popover) */
|
|
6
|
+
isButtonWrapped?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const ButtonGroup: ({ segmented, fullWidth, isButtonWrapped, ...props }: ButtonGroupProps) => JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
|
+
var _excluded = ["segmented", "fullWidth", "isButtonWrapped"];
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { StyledButtonGroup } from './ButtonGroupStyle';
|
|
6
|
+
export var ButtonGroup = function ButtonGroup(_ref) {
|
|
7
|
+
var segmented = _ref.segmented,
|
|
8
|
+
fullWidth = _ref.fullWidth,
|
|
9
|
+
isButtonWrapped = _ref.isButtonWrapped,
|
|
10
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
11
|
+
return /*#__PURE__*/React.createElement(StyledButtonGroup, _extends({
|
|
12
|
+
"data-segmented": segmented,
|
|
13
|
+
"data-full-width": fullWidth,
|
|
14
|
+
"data-button-wrapped": isButtonWrapped
|
|
15
|
+
}, props));
|
|
16
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ButtonGroup } from './ButtonGroupStyle';
|
|
3
2
|
import { BaseContainer } from '../../Layout/GlintsContainer/GlintsContainer';
|
|
4
3
|
import { PrimaryButton } from '../Button/PrimaryButtonStyle';
|
|
5
4
|
import { Button } from '../Button/Button';
|
|
6
5
|
import { OutlineButton } from '../Button/OutlineButtonStyle';
|
|
6
|
+
import { ButtonGroup } from './ButtonGroup';
|
|
7
7
|
ButtonGroup.displayName = 'ButtonGroup';
|
|
8
8
|
export default {
|
|
9
9
|
title: '@next/ButtonGroup',
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export interface ButtonGroupProps extends React.HtmlHTMLAttributes<HTMLDivElement> {
|
|
3
|
-
segmented?: boolean;
|
|
4
|
-
fullWidth?: boolean;
|
|
5
|
-
}
|
|
6
|
-
export declare const ButtonGroup: import("styled-components").StyledComponent<"div", any, ButtonGroupProps, never>;
|
|
1
|
+
export declare const StyledButtonGroup: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -2,13 +2,7 @@ import styled from 'styled-components';
|
|
|
2
2
|
import { borderRadius4 } from '../utilities/borderRadius';
|
|
3
3
|
import { Neutral } from '../utilities/colors';
|
|
4
4
|
import { space8 } from '../utilities/spacing';
|
|
5
|
-
export var
|
|
6
|
-
displayName: "
|
|
5
|
+
export var StyledButtonGroup = styled.div.withConfig({
|
|
6
|
+
displayName: "ButtonGroupStyle__StyledButtonGroup",
|
|
7
7
|
componentId: "sc-7vhxrt-0"
|
|
8
|
-
})(["display:flex;flex-direction:row;align-items:center;padding:0px;", " ", ""],
|
|
9
|
-
var segmented = _ref.segmented;
|
|
10
|
-
return segmented ? "> button {\n border-radius: 0;\n border-right: 0;\n \n :nth-child(1) {\n border-radius: " + borderRadius4 + " 0px 0px " + borderRadius4 + "; \n }\n\n :nth-last-child(1) {\n border-radius: 0px " + borderRadius4 + " " + borderRadius4 + " 0px;\n border-right: 1px solid " + Neutral.B68 + "\n }\n }\n > button:focus {\n z-index: 1;\n border: 1px solid " + Neutral.B68 + "\n }\n\n button[data-active='true'] {\n border: 1px solid " + Neutral.B40 + "\n }\n " : "gap: " + space8 + ";";
|
|
11
|
-
}, function (_ref2) {
|
|
12
|
-
var fullWidth = _ref2.fullWidth;
|
|
13
|
-
return fullWidth ? "> button {\n flex: 1;\n }" : "";
|
|
14
|
-
});
|
|
8
|
+
})(["display:flex;flex-direction:row;align-items:center;padding:0px;gap:", ";&[data-segmented='true']{gap:0;}&[data-segmented='true'] button[data-active='true']{border:1px solid ", ";}&[data-segmented='true'] button{border-radius:0;border-right:0;:nth-child(1){border-radius:", " 0px 0px ", ";}:nth-last-child(1){border-radius:0px ", " ", " 0px;border-right:1px solid ", ";}}&[data-segmented='true'] button:focus{z-index:1;border:1px solid ", ";}&[data-full-width='true'] button{flex:1;}&[data-segmented='true']&[data-button-wrapped='true'] > *{button{border-radius:0;border-right:0;}:nth-child(1) button{border-radius:", " 0px 0px ", ";}:nth-last-child(1) button{border-radius:0px ", " ", " 0px;border-right:1px solid ", ";}}"], space8, Neutral.B40, borderRadius4, borderRadius4, borderRadius4, borderRadius4, Neutral.B68, Neutral.B68, borderRadius4, borderRadius4, borderRadius4, borderRadius4, Neutral.B68);
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { ButtonGroup };
|
|
1
|
+
export { ButtonGroup } from './ButtonGroup';
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { ButtonGroup };
|
|
1
|
+
export { ButtonGroup } from './ButtonGroup';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PopoverProps as PolarisPopoverProps } from 'polaris-glints';
|
|
3
|
+
export declare type PopoverProps = PolarisPopoverProps;
|
|
4
|
+
/** Using Popover from polaris-glints repository internally
|
|
5
|
+
* Please add `<div id="glints-portal-container"></div>` as a sibling element of where your React app is rendered.
|
|
6
|
+
* This is a temporary workaround, as React Portal need this as the anchor */
|
|
7
|
+
export declare const Popover: ((props: PopoverProps) => JSX.Element) & {
|
|
8
|
+
Pane: typeof import("polaris-glints/build/ts/latest/src/components/Popover/components").Pane;
|
|
9
|
+
Section: typeof import("polaris-glints/build/ts/latest/src/components/Popover/components").Section;
|
|
10
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Popover as PolarisPopover } from 'polaris-glints';
|
|
3
|
+
import { StyledPopover } from './PopoverStyle';
|
|
4
|
+
var PopoverComponent = function PopoverComponent(props) {
|
|
5
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledPopover, null), /*#__PURE__*/React.createElement(PolarisPopover, props));
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
/** Using Popover from polaris-glints repository internally
|
|
9
|
+
* Please add `<div id="glints-portal-container"></div>` as a sibling element of where your React app is rendered.
|
|
10
|
+
* This is a temporary workaround, as React Portal need this as the anchor */
|
|
11
|
+
export var Popover = Object.assign(PopoverComponent, {
|
|
12
|
+
Pane: PolarisPopover.Pane,
|
|
13
|
+
Section: PolarisPopover.Section
|
|
14
|
+
});
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { useCallback, useState } from 'react';
|
|
3
|
+
import { BaseContainer } from '../../Layout/GlintsContainer/GlintsContainer';
|
|
4
|
+
import { Button, PrimaryButton } from '../Button';
|
|
5
|
+
import { ButtonGroup } from '../ButtonGroup';
|
|
6
|
+
import { Icon } from '../Icon';
|
|
7
|
+
import { Typography } from '../Typography';
|
|
8
|
+
import { Popover } from './Popover';
|
|
9
|
+
Popover.displayName = 'Popover';
|
|
10
|
+
export default {
|
|
11
|
+
title: '@next/Popover',
|
|
12
|
+
component: Popover,
|
|
13
|
+
decorators: [function (Story) {
|
|
14
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(BaseContainer, null, Story()), /*#__PURE__*/React.createElement("div", {
|
|
15
|
+
id: "glints-portal-container"
|
|
16
|
+
}));
|
|
17
|
+
}],
|
|
18
|
+
argTypes: {
|
|
19
|
+
preferredPosition: {
|
|
20
|
+
control: 'select',
|
|
21
|
+
options: ['above', 'below', 'mostSpace']
|
|
22
|
+
},
|
|
23
|
+
preferredAlignment: {
|
|
24
|
+
control: 'select',
|
|
25
|
+
options: ['left', 'center', 'right']
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var PopoverExample = function PopoverExample(props) {
|
|
30
|
+
var _useState = useState(false),
|
|
31
|
+
popoverActive = _useState[0],
|
|
32
|
+
setPopoverActive = _useState[1];
|
|
33
|
+
var _useState2 = useState(false),
|
|
34
|
+
popoverActive2 = _useState2[0],
|
|
35
|
+
setPopoverActive2 = _useState2[1];
|
|
36
|
+
var _useState3 = useState(false),
|
|
37
|
+
popoverActive3 = _useState3[0],
|
|
38
|
+
setPopoverActive3 = _useState3[1];
|
|
39
|
+
var Suffix = /*#__PURE__*/React.createElement(Icon, {
|
|
40
|
+
name: "ri-arrow-m-up-fill"
|
|
41
|
+
});
|
|
42
|
+
var togglePopoverActive = useCallback(function () {
|
|
43
|
+
return setPopoverActive(function (popoverActive) {
|
|
44
|
+
return !popoverActive;
|
|
45
|
+
});
|
|
46
|
+
}, []);
|
|
47
|
+
var togglePopoverActive2 = useCallback(function () {
|
|
48
|
+
return setPopoverActive2(function (popoverActive) {
|
|
49
|
+
return !popoverActive;
|
|
50
|
+
});
|
|
51
|
+
}, []);
|
|
52
|
+
var togglePopoverActive3 = useCallback(function () {
|
|
53
|
+
return setPopoverActive3(function (popoverActive) {
|
|
54
|
+
return !popoverActive;
|
|
55
|
+
});
|
|
56
|
+
}, []);
|
|
57
|
+
var example1Activator = /*#__PURE__*/React.createElement(Button, {
|
|
58
|
+
onClick: togglePopoverActive
|
|
59
|
+
}, "Show");
|
|
60
|
+
var example2Activator = /*#__PURE__*/React.createElement(Button, {
|
|
61
|
+
onClick: togglePopoverActive2
|
|
62
|
+
}, "Show");
|
|
63
|
+
var example3Activator = /*#__PURE__*/React.createElement(Button, {
|
|
64
|
+
onClick: togglePopoverActive3
|
|
65
|
+
}, "Show");
|
|
66
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
67
|
+
style: {
|
|
68
|
+
marginLeft: '100px',
|
|
69
|
+
paddingTop: '150px',
|
|
70
|
+
display: 'flex',
|
|
71
|
+
gap: '50px'
|
|
72
|
+
}
|
|
73
|
+
}, /*#__PURE__*/React.createElement(Popover, _extends({}, props, {
|
|
74
|
+
active: popoverActive,
|
|
75
|
+
activator: example1Activator,
|
|
76
|
+
onClose: togglePopoverActive
|
|
77
|
+
}), /*#__PURE__*/React.createElement(Popover.Pane, null, /*#__PURE__*/React.createElement("div", {
|
|
78
|
+
style: {
|
|
79
|
+
padding: '10px'
|
|
80
|
+
}
|
|
81
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Typography, {
|
|
82
|
+
as: "span",
|
|
83
|
+
variant: "subtitle1"
|
|
84
|
+
}, "Title")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Typography, {
|
|
85
|
+
variant: "body1"
|
|
86
|
+
}, "Description")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(ButtonGroup, null, /*#__PURE__*/React.createElement(Button, null, "Label"), " ", /*#__PURE__*/React.createElement(PrimaryButton, null, "Label")))))), /*#__PURE__*/React.createElement(Popover, _extends({}, props, {
|
|
87
|
+
active: popoverActive2,
|
|
88
|
+
activator: example2Activator,
|
|
89
|
+
onClose: togglePopoverActive2
|
|
90
|
+
}), /*#__PURE__*/React.createElement(Popover.Pane, null, /*#__PURE__*/React.createElement(Popover.Section, null, /*#__PURE__*/React.createElement(Typography, {
|
|
91
|
+
as: "span",
|
|
92
|
+
variant: "subtitle2"
|
|
93
|
+
}, "AVAILABLE SALES CHANNEL"))), /*#__PURE__*/React.createElement(Popover.Pane, null, /*#__PURE__*/React.createElement("div", {
|
|
94
|
+
style: {
|
|
95
|
+
padding: '0px 16px'
|
|
96
|
+
}
|
|
97
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Typography, {
|
|
98
|
+
variant: "body1"
|
|
99
|
+
}, "Online")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Typography, {
|
|
100
|
+
variant: "body1"
|
|
101
|
+
}, "Facebook")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Typography, {
|
|
102
|
+
variant: "body1"
|
|
103
|
+
}, "Shopify POS"))))), /*#__PURE__*/React.createElement(Popover, _extends({}, props, {
|
|
104
|
+
active: popoverActive3,
|
|
105
|
+
activator: example3Activator,
|
|
106
|
+
onClose: togglePopoverActive3
|
|
107
|
+
}), /*#__PURE__*/React.createElement(Popover.Pane, null, /*#__PURE__*/React.createElement("div", {
|
|
108
|
+
style: {
|
|
109
|
+
padding: '10px'
|
|
110
|
+
}
|
|
111
|
+
}, /*#__PURE__*/React.createElement(ButtonGroup, null, /*#__PURE__*/React.createElement(Button, null, "Action"), /*#__PURE__*/React.createElement(Button, null, "Action"), /*#__PURE__*/React.createElement(Button, {
|
|
112
|
+
icon: Suffix,
|
|
113
|
+
iconPosition: "right"
|
|
114
|
+
}, "Move to"))))));
|
|
115
|
+
};
|
|
116
|
+
var Template = function Template(args) {
|
|
117
|
+
return /*#__PURE__*/React.createElement(PopoverExample, args);
|
|
118
|
+
};
|
|
119
|
+
export var Interactive = Template.bind({});
|
|
120
|
+
Interactive.args = {
|
|
121
|
+
preferredPosition: 'mostSpace',
|
|
122
|
+
preferredAlignment: 'center'
|
|
123
|
+
};
|
|
124
|
+
Interactive.parameters = {
|
|
125
|
+
docs: {
|
|
126
|
+
source: {
|
|
127
|
+
code: "const [popoverActive, setPopoverActive] = useState(false);\n const [popoverActive2, setPopoverActive2] = useState(false);\n const [popoverActive3, setPopoverActive3] = useState(false);\n const Suffix = <Icon name=\"ri-arrow-m-up-fill\" />;\n \n const togglePopoverActive = useCallback(\n () => setPopoverActive(popoverActive => !popoverActive),\n []\n );\n \n const togglePopoverActive2 = useCallback(\n () => setPopoverActive2(popoverActive => !popoverActive),\n []\n );\n \n const togglePopoverActive3 = useCallback(\n () => setPopoverActive3(popoverActive => !popoverActive),\n []\n );\n \n const example1Activator = <Button onClick={togglePopoverActive}>Show</Button>;\n const example2Activator = (\n <Button onClick={togglePopoverActive2}>Show</Button>\n );\n const example3Activator = (\n <Button onClick={togglePopoverActive3}>Show</Button>\n );\n return (\n <div\n style={{\n marginLeft: '100px',\n paddingTop: '200px',\n display: 'flex',\n gap: '50px',\n }}\n >\n <Popover\n {...props}\n active={popoverActive}\n activator={example1Activator}\n onClose={togglePopoverActive}\n >\n <Popover.Pane>\n <div style={{ padding: '10px' }}>\n <div>\n <Typography as=\"span\" variant=\"subtitle1\">\n Title\n </Typography>\n </div>\n <div>\n <Typography variant=\"body1\">Description</Typography>\n </div>\n <div>\n <ButtonGroup>\n <Button>Label</Button> <PrimaryButton>Label</PrimaryButton>\n </ButtonGroup>\n </div>\n </div>\n </Popover.Pane>\n </Popover>\n <Popover\n {...props}\n active={popoverActive2}\n activator={example2Activator}\n onClose={togglePopoverActive2}\n >\n <Popover.Pane>\n <Popover.Section>\n <Typography variant=\"subtitle2\">AVAILABLE SALES CHANNEL</Typography>\n </Popover.Section>\n </Popover.Pane>\n <Popover.Pane>\n <div>\n <Typography variant=\"body1\">Online</Typography>\n </div>\n <div>\n <Typography variant=\"body1\">Facebook</Typography>\n </div>\n <div>\n <Typography variant=\"body1\">Shopify POS</Typography>\n </div>\n </Popover.Pane>\n </Popover>\n <Popover\n {...props}\n active={popoverActive3}\n activator={example3Activator}\n onClose={togglePopoverActive3}\n >\n <Popover.Pane>\n <div style={{ padding: '10px' }}>\n <ButtonGroup>\n <Button>Action</Button>\n <Button>Action</Button>\n <Button icon={Suffix} iconPosition=\"right\">\n Move to\n </Button>\n </ButtonGroup>\n </div>\n </Popover.Pane>\n </Popover>\n </div>\n );"
|
|
128
|
+
},
|
|
129
|
+
language: 'javascript',
|
|
130
|
+
type: 'auto'
|
|
131
|
+
}
|
|
132
|
+
};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
2
|
+
import React, { useCallback, useState } from 'react';
|
|
3
|
+
import { BaseContainer } from '../../Layout/GlintsContainer/GlintsContainer';
|
|
4
|
+
import { Popover } from './Popover';
|
|
5
|
+
import { OutlineButton } from '../Button';
|
|
6
|
+
import { ButtonGroup } from '../ButtonGroup';
|
|
7
|
+
import { CheckboxGroup } from './popoverStoryHelper/CheckboxGroup';
|
|
8
|
+
import { Typography } from '../Typography';
|
|
9
|
+
import { SalarySelector } from './popoverStoryHelper/SalarySelector';
|
|
10
|
+
import { Icon } from '../Icon';
|
|
11
|
+
Popover.displayName = 'Popover';
|
|
12
|
+
export default {
|
|
13
|
+
title: '@next/Popover as Filter',
|
|
14
|
+
component: Popover,
|
|
15
|
+
decorators: [function (Story) {
|
|
16
|
+
return /*#__PURE__*/React.createElement(BaseContainer, null, Story(), /*#__PURE__*/React.createElement("div", {
|
|
17
|
+
id: "glints-portal-container"
|
|
18
|
+
}));
|
|
19
|
+
}],
|
|
20
|
+
argTypes: {}
|
|
21
|
+
};
|
|
22
|
+
var cities = {
|
|
23
|
+
Indonesia: ['Jakarta', 'Bandung', 'Bali'],
|
|
24
|
+
Malaysia: ['Kuala Lumpur', 'Ipoh', 'Penang'],
|
|
25
|
+
Singapore: ['Singapore']
|
|
26
|
+
};
|
|
27
|
+
var PopoverAsFilterExample = function PopoverAsFilterExample() {
|
|
28
|
+
var _useState = useState(false),
|
|
29
|
+
popoverCityActive = _useState[0],
|
|
30
|
+
setPopoverCityActive = _useState[1];
|
|
31
|
+
var _useState2 = useState(false),
|
|
32
|
+
popoverSalaryActive = _useState2[0],
|
|
33
|
+
setPopoverSalaryActive = _useState2[1];
|
|
34
|
+
var _useState3 = useState([]),
|
|
35
|
+
selectedCities = _useState3[0],
|
|
36
|
+
setSelectedCities = _useState3[1];
|
|
37
|
+
var _useState4 = useState(0),
|
|
38
|
+
salaryFrom = _useState4[0],
|
|
39
|
+
setSalaryFrom = _useState4[1];
|
|
40
|
+
var _useState5 = useState(0),
|
|
41
|
+
salaryTo = _useState5[0],
|
|
42
|
+
setSalaryTo = _useState5[1];
|
|
43
|
+
var Suffix = /*#__PURE__*/React.createElement(Icon, {
|
|
44
|
+
name: "ri-arrow-m-down-fill"
|
|
45
|
+
});
|
|
46
|
+
var togglePopoverCityActive = useCallback(function () {
|
|
47
|
+
return setPopoverCityActive(function (popoverActive) {
|
|
48
|
+
return !popoverActive;
|
|
49
|
+
});
|
|
50
|
+
}, []);
|
|
51
|
+
var toggleSalaryActive = useCallback(function () {
|
|
52
|
+
return setPopoverSalaryActive(function (popoverActive) {
|
|
53
|
+
return !popoverActive;
|
|
54
|
+
});
|
|
55
|
+
}, []);
|
|
56
|
+
var cityActivator = /*#__PURE__*/React.createElement(OutlineButton, {
|
|
57
|
+
onClick: togglePopoverCityActive,
|
|
58
|
+
icon: Suffix,
|
|
59
|
+
iconPosition: "right"
|
|
60
|
+
}, "City");
|
|
61
|
+
var salaryActivator = /*#__PURE__*/React.createElement(OutlineButton, {
|
|
62
|
+
onClick: toggleSalaryActive,
|
|
63
|
+
icon: Suffix,
|
|
64
|
+
iconPosition: "right"
|
|
65
|
+
}, "Salary");
|
|
66
|
+
var handleCityChanged = function handleCityChanged(action, cities) {
|
|
67
|
+
if (action === 'Add') {
|
|
68
|
+
var selected = new Set([].concat(selectedCities, cities));
|
|
69
|
+
setSelectedCities(Array.from(selected));
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
setSelectedCities(selectedCities.filter(function (sc) {
|
|
73
|
+
return !cities.includes(sc);
|
|
74
|
+
}));
|
|
75
|
+
};
|
|
76
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
77
|
+
style: {
|
|
78
|
+
marginLeft: '10px'
|
|
79
|
+
}
|
|
80
|
+
}, /*#__PURE__*/React.createElement(ButtonGroup, {
|
|
81
|
+
segmented: true,
|
|
82
|
+
isButtonWrapped: true
|
|
83
|
+
}, /*#__PURE__*/React.createElement(Popover, {
|
|
84
|
+
active: popoverCityActive,
|
|
85
|
+
activator: cityActivator,
|
|
86
|
+
autofocusTarget: "first-node",
|
|
87
|
+
onClose: togglePopoverCityActive
|
|
88
|
+
}, /*#__PURE__*/React.createElement(Popover.Pane, {
|
|
89
|
+
fixed: true
|
|
90
|
+
}, /*#__PURE__*/React.createElement(Popover.Section, null, /*#__PURE__*/React.createElement(Typography, {
|
|
91
|
+
as: "span",
|
|
92
|
+
variant: "subtitle2"
|
|
93
|
+
}, "Select Cities"))), /*#__PURE__*/React.createElement(Popover.Pane, null, /*#__PURE__*/React.createElement("div", {
|
|
94
|
+
style: {
|
|
95
|
+
padding: '10px'
|
|
96
|
+
}
|
|
97
|
+
}, Object.keys(cities).map(function (country) {
|
|
98
|
+
return /*#__PURE__*/React.createElement(CheckboxGroup, {
|
|
99
|
+
key: country,
|
|
100
|
+
country: country
|
|
101
|
+
// @ts-ignore
|
|
102
|
+
,
|
|
103
|
+
cities: cities[country],
|
|
104
|
+
onChanged: handleCityChanged
|
|
105
|
+
});
|
|
106
|
+
})))), /*#__PURE__*/React.createElement(Popover, {
|
|
107
|
+
active: popoverSalaryActive,
|
|
108
|
+
activator: salaryActivator,
|
|
109
|
+
autofocusTarget: "first-node",
|
|
110
|
+
onClose: toggleSalaryActive,
|
|
111
|
+
fullWidth: true
|
|
112
|
+
}, /*#__PURE__*/React.createElement(Popover.Pane, {
|
|
113
|
+
fixed: true
|
|
114
|
+
}, /*#__PURE__*/React.createElement(Popover.Section, null, /*#__PURE__*/React.createElement(Typography, {
|
|
115
|
+
as: "span",
|
|
116
|
+
variant: "caption"
|
|
117
|
+
}, "Salary"))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(SalarySelector, {
|
|
118
|
+
onFromChanged: setSalaryFrom,
|
|
119
|
+
onToChanged: setSalaryTo
|
|
120
|
+
})))), /*#__PURE__*/React.createElement("div", {
|
|
121
|
+
style: {
|
|
122
|
+
marginTop: '10px'
|
|
123
|
+
}
|
|
124
|
+
}, /*#__PURE__*/React.createElement(Typography, {
|
|
125
|
+
as: "span",
|
|
126
|
+
variant: "caption"
|
|
127
|
+
}, "Selected cities: ", selectedCities.join(','))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Typography, {
|
|
128
|
+
as: "span",
|
|
129
|
+
variant: "caption"
|
|
130
|
+
}, "Selected salary range: ", new Intl.NumberFormat().format(salaryFrom), " to", ' ', new Intl.NumberFormat().format(salaryTo))));
|
|
131
|
+
};
|
|
132
|
+
var Template = function Template() {
|
|
133
|
+
return /*#__PURE__*/React.createElement(PopoverAsFilterExample, null);
|
|
134
|
+
};
|
|
135
|
+
export var Interactive = Template.bind({});
|
|
136
|
+
Interactive.args = {};
|
|
137
|
+
Interactive.parameters = {
|
|
138
|
+
docs: {
|
|
139
|
+
source: {
|
|
140
|
+
code: "\n import { Popover } from 'Popover';\n import { OutlineButton } from '../Button';\n import { ButtonGroup } from '../ButtonGroup';\n import { CheckboxGroup } from './popoverStoryHelper/CheckboxGroup';\n import { Typography } from '../Typography';\n import { SalarySelector } from './popoverStoryHelper/SalarySelector';\n import { Icon } from '../Icon';\n\n const cities = {\n Indonesia: ['Jakarta', 'Bandung', 'Bali'],\n Malaysia: ['Kuala Lumpur', 'Ipoh', 'Penang'],\n Singapore: ['Singapore'],\n };\n \n const [popoverCityActive, setPopoverCityActive] = useState(false);\n const [popoverSalaryActive, setPopoverSalaryActive] = useState(false);\n const [selectedCities, setSelectedCities] = useState([]);\n const [salaryFrom, setSalaryFrom] = useState(0);\n const [salaryTo, setSalaryTo] = useState(0);\n \n const Suffix = <Icon name=\"ri-arrow-m-down-fill\" />;\n const togglePopoverCityActive = useCallback(\n () => setPopoverCityActive(popoverActive => !popoverActive),\n []\n );\n \n const toggleSalaryActive = useCallback(\n () => setPopoverSalaryActive(popoverActive => !popoverActive),\n []\n );\n \n const cityActivator = (\n <OutlineButton\n onClick={togglePopoverCityActive}\n icon={Suffix}\n iconPosition=\"right\"\n >\n City\n </OutlineButton>\n );\n const salaryActivator = (\n <OutlineButton\n onClick={toggleSalaryActive}\n icon={Suffix}\n iconPosition=\"right\"\n >\n Salary\n </OutlineButton>\n );\n \n const handleCityChanged = (action: 'Add' | 'Remove', cities: string[]) => {\n if (action === 'Add') {\n const selected = new Set([...selectedCities, ...cities]);\n setSelectedCities(Array.from(selected));\n return;\n }\n setSelectedCities(selectedCities.filter(sc => !cities.includes(sc)));\n };\n \n return (\n <div style={{ marginLeft: '10px' }}>\n <ButtonGroup segmented isButtonWrapped>\n <Popover\n active={popoverCityActive}\n activator={cityActivator}\n autofocusTarget=\"first-node\"\n onClose={togglePopoverCityActive}\n >\n <Popover.Pane fixed>\n <Popover.Section>\n <Typography as=\"span\" variant=\"subtitle2\">\n Select Cities\n </Typography>\n </Popover.Section>\n </Popover.Pane>\n <Popover.Pane>\n <div style={{ padding: '10px' }}>\n {Object.keys(cities).map((country: string) => {\n return (\n <CheckboxGroup\n key={country}\n country={country}\n cities={cities[country]}\n onChanged={handleCityChanged}\n />\n );\n })}\n </div>\n </Popover.Pane>\n </Popover>\n <Popover\n active={popoverSalaryActive}\n activator={salaryActivator}\n autofocusTarget=\"first-node\"\n onClose={toggleSalaryActive}\n fullWidth\n >\n <Popover.Pane fixed>\n <Popover.Section>\n <Typography as=\"span\" variant=\"caption\">\n Salary\n </Typography>\n </Popover.Section>\n </Popover.Pane>\n <div>\n <SalarySelector\n onFromChanged={setSalaryFrom}\n onToChanged={setSalaryTo}\n />\n </div>\n </Popover>\n </ButtonGroup>\n <div style={{ marginTop: '10px' }}>\n <Typography as=\"span\" variant=\"caption\">\n Selected cities: {selectedCities.join(',')}\n </Typography>\n </div>\n <div>\n <Typography as=\"span\" variant=\"caption\">\n Selected salary range: {new Intl.NumberFormat().format(salaryFrom)} to{' '}\n {new Intl.NumberFormat().format(salaryTo)}\n </Typography>\n </div>\n </div>\n );"
|
|
141
|
+
},
|
|
142
|
+
language: 'javascript',
|
|
143
|
+
type: 'auto'
|
|
144
|
+
}
|
|
145
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const StyledPopover: any;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createGlobalStyle } from 'styled-components';
|
|
2
|
+
import { borderRadius8 } from '../utilities/borderRadius';
|
|
3
|
+
import { Neutral } from '../utilities/colors';
|
|
4
|
+
import { space16, space4, space8 } from '../utilities/spacing';
|
|
5
|
+
|
|
6
|
+
// we need to use global style here because popover is created outside the root element for react app
|
|
7
|
+
export var StyledPopover = createGlobalStyle([".Polaris-Popover{max-width:calc(100vw - ", ");margin:0.3125rem 2px ", ";box-shadow:0px ", " 20px rgba(71,71,71,0.2),0px 3px 6px -3px rgba(71,71,71,0.08);border-radius:", ";backface-visibility:hidden;will-change:left,top;}.Polaris-Popover__PopoverOverlay{opacity:0;transition:opacity 100ms ease,transform 100ms ease;transform:translateY(-0.3125rem);}.Polaris-Popover__PopoverOverlay--entering{opacity:1;transform:translateY(0);}.Polaris-Popover__PopoverOverlay--open{opacity:1;transform:none;}.Polaris-Popover__PopoverOverlay--exiting{opacity:1;transform:translateY(0);transition-duration:0ms;}.Polaris-Popover--measuring:not(.Polaris-Popover__PopoverOverlay--exiting){opacity:0;transform:translateY(-0.3125rem);}.Polaris-Popover--fullWidth{margin:0.3125rem auto 0 auto;width:fit-content;}.Polaris-Popover--fullWidth .Polaris-Popover__Content{max-width:none;}.Polaris-Popover--positionedAbove{margin:", " 2px 0.3125rem;}.Polaris-Popover--positionedAbove.Polaris-Popover--fullWidth{margin:0 auto 0.3125rem auto;}.Polaris-Popover__Wrapper{position:relative;overflow:hidden;background-color:", ";border-radius:", ";outline:1px solid transparent;}.Polaris-Popover__Content{position:relative;display:flex;flex-direction:column;border-radius:1px;max-width:25rem;max-height:31.25rem;}.Polaris-Popover__Content:focus{outline:none;}.Polaris-Popover__Content--fullHeight{max-height:none;}.Polaris-Popover__Content--fluidContent{max-height:none;max-width:none;}.Polaris-Popover__Pane{flex:1 1;max-width:100%;}.Polaris-Popover__Pane + .Polaris-Popover__Pane{border-top:1px solid ", ";}.Polaris-Popover__Pane:focus{outline:none;}.Polaris-Popover__Pane--fixed{overflow:visible;flex:0 0 auto;}.Polaris-Popover__Pane--captureOverscroll{overscroll-behavior:contain;}.Polaris-Popover__Section{padding:", ";color:", ";}.Polaris-Popover__Section + .Polaris-Popover__Section{border-top:1px solid #e1e3e5;}.Polaris-Popover__FocusTracker{position:absolute !important;top:0;width:0.0625rem !important;height:0.0625rem !important;margin:0 !important;padding:0 !important;overflow:hidden !important;clip-path:inset(50%) !important;border:0 !important;white-space:nowrap !important;}@media print{.Polaris-Popover__PopoverOverlay--hideOnPrint{display:none !important;}}.Polaris-PositionedOverlay{position:absolute;z-index:400;}.Polaris-PositionedOverlay--fixed{position:fixed;}.Polaris-PositionedOverlay--calculating{visibility:hidden;}.Polaris-PositionedOverlay--preventInteraction{pointer-events:none;}"], space8, space4, space8, borderRadius8, space4, Neutral.B100, borderRadius8, Neutral.B85, space16, Neutral.B40);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Popover, PopoverProps } from './Popover';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Popover, PopoverProps } from './Popover';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type Props = {
|
|
3
|
+
country: string;
|
|
4
|
+
cities: string[];
|
|
5
|
+
onChanged: (action: 'Add' | 'Remove', cities: string[]) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const CheckboxGroup: ({ country, cities, onChanged }: Props) => JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Checkbox } from '../../Checkbox';
|
|
3
|
+
export var CheckboxGroup = function CheckboxGroup(_ref) {
|
|
4
|
+
var country = _ref.country,
|
|
5
|
+
cities = _ref.cities,
|
|
6
|
+
onChanged = _ref.onChanged;
|
|
7
|
+
var _useState = useState(false),
|
|
8
|
+
isCountrySelected = _useState[0],
|
|
9
|
+
setIsCountrySelected = _useState[1];
|
|
10
|
+
var _useState2 = useState([]),
|
|
11
|
+
selectedCities = _useState2[0],
|
|
12
|
+
setSelectedCities = _useState2[1];
|
|
13
|
+
var handleCountryChanged = function handleCountryChanged(checked) {
|
|
14
|
+
setIsCountrySelected(checked);
|
|
15
|
+
if (checked) {
|
|
16
|
+
setSelectedCities(cities);
|
|
17
|
+
} else {
|
|
18
|
+
setSelectedCities([]);
|
|
19
|
+
}
|
|
20
|
+
onChanged(checked ? 'Add' : 'Remove', cities);
|
|
21
|
+
};
|
|
22
|
+
var handleCityChanged = function handleCityChanged(checked, id) {
|
|
23
|
+
if (checked && !selectedCities.includes(id)) {
|
|
24
|
+
var selected = [].concat(selectedCities, [id]);
|
|
25
|
+
setSelectedCities(selected);
|
|
26
|
+
onChanged('Add', [id]);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (!checked) {
|
|
30
|
+
var _selected = selectedCities.filter(function (s) {
|
|
31
|
+
return s !== id;
|
|
32
|
+
});
|
|
33
|
+
setSelectedCities(_selected);
|
|
34
|
+
onChanged('Remove', [id]);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
38
|
+
key: country
|
|
39
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
40
|
+
id: country,
|
|
41
|
+
label: country,
|
|
42
|
+
checked: isCountrySelected,
|
|
43
|
+
onChange: function onChange(newChecked) {
|
|
44
|
+
return handleCountryChanged(newChecked);
|
|
45
|
+
}
|
|
46
|
+
}), cities.map(function (city) {
|
|
47
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
48
|
+
key: "div-" + city,
|
|
49
|
+
style: {
|
|
50
|
+
marginLeft: '10px'
|
|
51
|
+
}
|
|
52
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
53
|
+
id: city,
|
|
54
|
+
label: city,
|
|
55
|
+
key: city,
|
|
56
|
+
checked: selectedCities.includes(city) || isCountrySelected,
|
|
57
|
+
onChange: handleCityChanged
|
|
58
|
+
}));
|
|
59
|
+
}));
|
|
60
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CurrencyInput } from '../../CurrencyInput/CurrencyInput';
|
|
3
|
+
import { Typography } from '../../Typography';
|
|
4
|
+
export var SalarySelector = function SalarySelector(_ref) {
|
|
5
|
+
var onFromChanged = _ref.onFromChanged,
|
|
6
|
+
onToChanged = _ref.onToChanged;
|
|
7
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
8
|
+
style: {
|
|
9
|
+
display: 'flex',
|
|
10
|
+
gap: '4px',
|
|
11
|
+
padding: '10px',
|
|
12
|
+
alignItems: 'center'
|
|
13
|
+
}
|
|
14
|
+
}, /*#__PURE__*/React.createElement(Typography, {
|
|
15
|
+
as: "div",
|
|
16
|
+
variant: "caption"
|
|
17
|
+
}, "IDR"), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CurrencyInput, {
|
|
18
|
+
onChange: onFromChanged
|
|
19
|
+
})), /*#__PURE__*/React.createElement("div", null, "-"), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CurrencyInput, {
|
|
20
|
+
onChange: onToChanged
|
|
21
|
+
}))));
|
|
22
|
+
};
|
|
@@ -44,7 +44,7 @@ Interactive.parameters = {
|
|
|
44
44
|
docs: {
|
|
45
45
|
source: {
|
|
46
46
|
code: "const [selected, setSelected] = useState(args.selected || 0);\n const tabs: TabModel[] = [\n { id: 'id-tab-1', content: 'Tab #1' },\n { id: 'id-tab-2', content: 'Tab #2' },\n ];\n \n const Table = () => {\n return (\n <StyledTable>\n <StyledRow>\n <StyledHeaderColumn>Company</StyledHeaderColumn>\n <StyledHeaderColumn>Contact</StyledHeaderColumn>\n <StyledHeaderColumn>Country</StyledHeaderColumn>\n </StyledRow>\n <StyledRow>\n <StyledColumn>Alfreds Futterkiste</StyledColumn>\n <StyledColumn>Maria Anders</StyledColumn>\n <StyledColumn>Germany</StyledColumn>\n </StyledRow>\n <StyledRow>\n <StyledColumn>Centro comercial Moctezuma</StyledColumn>\n <StyledColumn>Francisco Chang</StyledColumn>\n <StyledColumn>Mexico</StyledColumn>\n </StyledRow>\n <StyledRow>\n <StyledColumn>Ernst Handel</StyledColumn>\n <StyledColumn>Roland Mendel</StyledColumn>\n <StyledColumn>Austria</StyledColumn>\n </StyledRow>\n <StyledRow>\n <StyledColumn>Island Trading</StyledColumn>\n <StyledColumn>Helen Bennett</StyledColumn>\n <StyledColumn>UK</StyledColumn>\n </StyledRow>\n </StyledTable>\n );\n };\n \n const tabContents = [\n <Table />,\n <Typography variant=\"body2\">\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod\n tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim\n veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea\n commodo consequat. Duis aute irure dolor in reprehenderit in voluptate\n velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat\n cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id\n est laborum.\n </Typography>,\n ];\n \n return (\n <Tabs\n tabs={tabs}\n selected={selected}\n onSelected={i => setSelected(i)}\n fitted={args.fitted}\n >\n {tabContents[selected]}\n </Tabs>\n );\n };",
|
|
47
|
-
language: '
|
|
47
|
+
language: 'javascript',
|
|
48
48
|
type: 'auto'
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
2
|
+
var _excluded = ["children"];
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Typography } from '../Typography';
|
|
5
|
+
import { Neutral } from '../utilities/colors';
|
|
6
|
+
import { TagStyle } from './TagStyle';
|
|
7
|
+
export var Tag = function Tag(_ref) {
|
|
8
|
+
var children = _ref.children,
|
|
9
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
10
|
+
var content = typeof children === 'string' ? /*#__PURE__*/React.createElement(Typography, {
|
|
11
|
+
variant: "caption",
|
|
12
|
+
color: Neutral.B18,
|
|
13
|
+
as: 'span'
|
|
14
|
+
}, children) : children;
|
|
15
|
+
return /*#__PURE__*/React.createElement(TagStyle, props, content);
|
|
16
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BaseContainer } from '../../Layout/GlintsContainer/GlintsContainer';
|
|
3
|
+
import { Tag } from './Tag';
|
|
4
|
+
Tag.displayName = 'Tag';
|
|
5
|
+
var defaultText = 'Basic Tag';
|
|
6
|
+
export default {
|
|
7
|
+
title: '@next/Tag',
|
|
8
|
+
component: Tag,
|
|
9
|
+
decorators: [function (Story) {
|
|
10
|
+
return /*#__PURE__*/React.createElement(BaseContainer, null, Story());
|
|
11
|
+
}]
|
|
12
|
+
};
|
|
13
|
+
var Template = function Template(args) {
|
|
14
|
+
return /*#__PURE__*/React.createElement(Tag, args, defaultText);
|
|
15
|
+
};
|
|
16
|
+
export var Interactive = Template.bind({});
|
|
17
|
+
Interactive.args = {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { Breakpoints } from '..';
|
|
3
|
+
import { borderRadius4 } from '../utilities/borderRadius';
|
|
4
|
+
import { Blue } from '../utilities/colors';
|
|
5
|
+
import { space4, space8 } from '../utilities/spacing';
|
|
6
|
+
export var TagStyle = styled.div.withConfig({
|
|
7
|
+
displayName: "TagStyle",
|
|
8
|
+
componentId: "sc-r1wv7a-0"
|
|
9
|
+
})(["background-color:", ";width:fit-content;padding:", " ", ";border-radius:", ";@media (max-width:", "){font-size:12px;}"], Blue.S08, space4, space8, borderRadius4, Breakpoints.large);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Tag';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Tag';
|