glints-aries 4.0.166 → 4.0.167

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.
Files changed (39) hide show
  1. package/es/@next/Checkbox/Checkbox.js +4 -8
  2. package/es/@next/Checkbox/CheckboxStyle.js +2 -2
  3. package/es/@next/Icon/components/RiCheckboxIndeterminateFill.js +0 -1
  4. package/es/@next/Icon/components/RiCheckboxIndeterminateLine.js +0 -1
  5. package/es/@next/Icon/components/RiSearch.js +2 -9
  6. package/es/@next/Tabs/Tab.d.ts +8 -0
  7. package/es/@next/Tabs/Tab.js +19 -0
  8. package/es/@next/Tabs/TabStyle.d.ts +6 -0
  9. package/es/@next/Tabs/TabStyle.js +28 -0
  10. package/es/@next/Tabs/Tabs.d.ts +21 -0
  11. package/es/@next/Tabs/Tabs.js +43 -0
  12. package/es/@next/Tabs/Tabs.stories.d.ts +4 -0
  13. package/es/@next/Tabs/Tabs.stories.js +51 -0
  14. package/es/@next/Tabs/TabsStoriesStyle.d.ts +4 -0
  15. package/es/@next/Tabs/TabsStoriesStyle.js +18 -0
  16. package/es/@next/Tabs/index.d.ts +2 -0
  17. package/es/@next/Tabs/index.js +2 -0
  18. package/es/@next/index.d.ts +1 -0
  19. package/es/@next/index.js +1 -0
  20. package/lib/@next/Checkbox/Checkbox.js +4 -8
  21. package/lib/@next/Checkbox/CheckboxStyle.js +1 -1
  22. package/lib/@next/Icon/components/RiCheckboxIndeterminateFill.js +0 -1
  23. package/lib/@next/Icon/components/RiCheckboxIndeterminateLine.js +0 -1
  24. package/lib/@next/Icon/components/RiSearch.js +2 -9
  25. package/lib/@next/Tabs/Tab.d.ts +8 -0
  26. package/lib/@next/Tabs/Tab.js +25 -0
  27. package/lib/@next/Tabs/TabStyle.d.ts +6 -0
  28. package/lib/@next/Tabs/TabStyle.js +41 -0
  29. package/lib/@next/Tabs/Tabs.d.ts +21 -0
  30. package/lib/@next/Tabs/Tabs.js +51 -0
  31. package/lib/@next/Tabs/Tabs.stories.d.ts +4 -0
  32. package/lib/@next/Tabs/Tabs.stories.js +60 -0
  33. package/lib/@next/Tabs/TabsStoriesStyle.d.ts +4 -0
  34. package/lib/@next/Tabs/TabsStoriesStyle.js +28 -0
  35. package/lib/@next/Tabs/index.d.ts +2 -0
  36. package/lib/@next/Tabs/index.js +15 -0
  37. package/lib/@next/index.d.ts +1 -0
  38. package/lib/@next/index.js +6 -1
  39. package/package.json +1 -2
@@ -7,8 +7,6 @@ import { StyledCheckbox, StyledCheckboxContainer, StyledColumn, StyledContainer,
7
7
  import { noop } from 'lodash-es';
8
8
  import { Icon } from '../Icon';
9
9
  import { Typography } from '../Typography';
10
- import { Neutral, Red, Blue } from '../utilities/colors';
11
- var randomId = nanoid();
12
10
  export var Checkbox = function Checkbox(_ref) {
13
11
  var label = _ref.label,
14
12
  id = _ref.id,
@@ -19,6 +17,7 @@ export var Checkbox = function Checkbox(_ref) {
19
17
  hasError = _ref.hasError,
20
18
  helpText = _ref.helpText,
21
19
  otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
20
+ var randomId = nanoid();
22
21
  var checkBoxId = id ? id : randomId;
23
22
  var labelId = "label-" + checkBoxId;
24
23
  var inputNode = useRef(null);
@@ -29,7 +28,6 @@ export var Checkbox = function Checkbox(_ref) {
29
28
  isFocused = _useState2[0],
30
29
  setIsFocused = _useState2[1];
31
30
  var checkedIcon = indeterminate ? 'ri-checkbox-indeterminate-fill' : 'ri-checkbox-fill';
32
- var iconFill = disabled ? Neutral.B95 : hasError ? Red.B93 : Blue.S99;
33
31
  useEffect(function () {
34
32
  var value = indeterminate ? 'mixed' : checked;
35
33
  setCheckedState(value);
@@ -43,7 +41,8 @@ export var Checkbox = function Checkbox(_ref) {
43
41
  onChange(checkedValue, checkBoxId);
44
42
  };
45
43
  return /*#__PURE__*/React.createElement(StyledContainer, {
46
- "aria-disabled": disabled
44
+ "aria-disabled": disabled,
45
+ "data-error": hasError
47
46
  }, /*#__PURE__*/React.createElement(StyledRow, null, /*#__PURE__*/React.createElement(StyledLeftColumn, null, /*#__PURE__*/React.createElement(StyledCheckboxContainer, null, /*#__PURE__*/React.createElement(StyledCheckbox, {
48
47
  role: "checkbox",
49
48
  "aria-labelledby": labelId,
@@ -73,10 +72,7 @@ export var Checkbox = function Checkbox(_ref) {
73
72
  return setIsFocused(false);
74
73
  }
75
74
  }, otherProps))), /*#__PURE__*/React.createElement(Icon, {
76
- name: checkedIcon,
77
- height: "20px",
78
- width: "20px",
79
- fill: iconFill
75
+ name: checkedIcon
80
76
  }))), /*#__PURE__*/React.createElement(StyledColumn, null, /*#__PURE__*/React.createElement("label", {
81
77
  id: labelId,
82
78
  htmlFor: checkBoxId,
@@ -1,12 +1,12 @@
1
1
  import styled from 'styled-components';
2
2
  import { Breakpoints } from '../..';
3
3
  import { borderRadius4 } from '../utilities/borderRadius';
4
- import { Neutral, Red } from '../utilities/colors';
4
+ import { Blue, Neutral, Red } from '../utilities/colors';
5
5
  import { space4 } from '../utilities/spacing';
6
6
  export var StyledContainer = styled.div.withConfig({
7
7
  displayName: "CheckboxStyle__StyledContainer",
8
8
  componentId: "sc-a9bf1h-0"
9
- })(["flex-direction:row;align-items:flex-start;padding:", " 0px;gap:8px;color:", ";label{cursor:pointer;margin-top:-1px;}svg{border-radius:4px;position:absolute;top:0;left:0;opacity:0;pointer-events:none;}&[aria-disabled='true'],&[aria-disabled='true'] .help-text{color:", ";}&[aria-disabled='true'] div[role='checkbox']{border-color:", ";background:", ";}&[aria-disabled='true'] svg{background:", ";}"], space4, Neutral.B18, Neutral.B68, Neutral.B85, Neutral.B95, Neutral.B68);
9
+ })(["flex-direction:row;align-items:flex-start;padding:", " 0px;gap:8px;color:", ";label{cursor:pointer;margin-top:-1px;}svg{border-radius:4px;position:absolute;height:20px;width:20px;top:0;left:0;opacity:0;pointer-events:none;fill:", ";}&[aria-disabled='true'],&[aria-disabled='true'] .help-text{color:", ";}&[aria-disabled='true'] div[role='checkbox']{border-color:", ";background:", ";}&[aria-disabled='true'] svg{background:", ";fill:", ";}&[data-error='true'] svg{fill:", ";}"], space4, Neutral.B18, Blue.S99, Neutral.B68, Neutral.B85, Neutral.B95, Neutral.B68, Neutral.B95, Red.B93);
10
10
  export var StyledCheckboxContainer = styled.div.withConfig({
11
11
  displayName: "CheckboxStyle__StyledCheckboxContainer",
12
12
  componentId: "sc-a9bf1h-1"
@@ -3,7 +3,6 @@ import * as React from 'react';
3
3
  var SvgRiCheckboxIndeterminateFill = function SvgRiCheckboxIndeterminateFill(props) {
4
4
  return /*#__PURE__*/React.createElement("svg", _extends({
5
5
  viewBox: "0 0 18 18",
6
- fill: "none",
7
6
  xmlns: "http://www.w3.org/2000/svg"
8
7
  }, props), /*#__PURE__*/React.createElement("path", {
9
8
  d: "M1 0h16a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H1a1 1 0 0 1-1-1V1a1 1 0 0 1 1-1Zm3 8v2h10V8H4Z"
@@ -3,7 +3,6 @@ import * as React from 'react';
3
3
  var SvgRiCheckboxIndeterminateLine = function SvgRiCheckboxIndeterminateLine(props) {
4
4
  return /*#__PURE__*/React.createElement("svg", _extends({
5
5
  viewBox: "0 0 18 18",
6
- fill: "none",
7
6
  xmlns: "http://www.w3.org/2000/svg"
8
7
  }, props), /*#__PURE__*/React.createElement("path", {
9
8
  d: "M1 0h16a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H1a1 1 0 0 1-1-1V1a1 1 0 0 1 1-1Zm1 2v14h14V2H2Zm2 6h10v2H4V8Z"
@@ -4,15 +4,8 @@ var SvgRiSearch = function SvgRiSearch(props) {
4
4
  return /*#__PURE__*/React.createElement("svg", _extends({
5
5
  viewBox: "0 0 24 24",
6
6
  xmlns: "http://www.w3.org/2000/svg"
7
- }, props), /*#__PURE__*/React.createElement("g", {
8
- clipPath: "url(#ri-search_svg__a)"
9
- }, /*#__PURE__*/React.createElement("path", {
7
+ }, props), /*#__PURE__*/React.createElement("path", {
10
8
  d: "m18.031 16.617 4.283 4.282-1.415 1.415-4.282-4.283A8.96 8.96 0 0 1 11 20c-4.968 0-9-4.032-9-9s4.032-9 9-9 9 4.032 9 9a8.96 8.96 0 0 1-1.969 5.617Zm-2.006-.742A6.977 6.977 0 0 0 18 11c0-3.868-3.133-7-7-7-3.868 0-7 3.132-7 7 0 3.867 3.132 7 7 7a6.977 6.977 0 0 0 4.875-1.975l.15-.15Z"
11
- })), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
12
- id: "ri-search_svg__a"
13
- }, /*#__PURE__*/React.createElement("path", {
14
- fill: "#fff",
15
- d: "M0 0h24v24H0z"
16
- }))));
9
+ }));
17
10
  };
18
11
  export default SvgRiSearch;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export declare type TabProps = {
3
+ content: React.ReactNode;
4
+ id?: string;
5
+ selected?: boolean;
6
+ onSelect: () => void;
7
+ };
8
+ export declare const Tab: ({ content, id, selected, onSelect }: TabProps) => JSX.Element;
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { Typography } from '../Typography';
3
+ import { StyledSpan, StyledTabButton } from './TabStyle';
4
+ export var Tab = function Tab(_ref) {
5
+ var content = _ref.content,
6
+ id = _ref.id,
7
+ selected = _ref.selected,
8
+ onSelect = _ref.onSelect;
9
+ return /*#__PURE__*/React.createElement(StyledTabButton, {
10
+ "data-selected": selected,
11
+ id: id,
12
+ onClick: function onClick() {
13
+ return onSelect();
14
+ }
15
+ }, /*#__PURE__*/React.createElement(StyledSpan, null, /*#__PURE__*/React.createElement(Typography, {
16
+ as: "span",
17
+ variant: "body1"
18
+ }, content)));
19
+ };
@@ -0,0 +1,6 @@
1
+ export declare const StyledTabsContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ export declare const StyledTabHeaderContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export declare const StyledUl: import("styled-components").StyledComponent<"ul", any, {}, never>;
4
+ export declare const StyledLi: import("styled-components").StyledComponent<"li", any, {}, never>;
5
+ export declare const StyledSpan: import("styled-components").StyledComponent<"span", any, {}, never>;
6
+ export declare const StyledTabButton: import("styled-components").StyledComponent<"button", any, {}, never>;
@@ -0,0 +1,28 @@
1
+ import styled from 'styled-components';
2
+ import { Blue, Neutral } from '../utilities/colors';
3
+ import { space16, space4, space8 } from '../utilities/spacing';
4
+ import * as Breakpoints from '../utilities/breakpoints';
5
+ export var StyledTabsContainer = styled.div.withConfig({
6
+ displayName: "TabStyle__StyledTabsContainer",
7
+ componentId: "sc-3xj4eu-0"
8
+ })(["display:block;"]);
9
+ export var StyledTabHeaderContainer = styled.div.withConfig({
10
+ displayName: "TabStyle__StyledTabHeaderContainer",
11
+ componentId: "sc-3xj4eu-1"
12
+ })(["box-shadow:inset 0px -1px 0px #e1e3e5;"]);
13
+ export var StyledUl = styled.ul.withConfig({
14
+ displayName: "TabStyle__StyledUl",
15
+ componentId: "sc-3xj4eu-2"
16
+ })(["display:flex;flex-direction:row;align-items:flex-start;padding:0;gap:", ";&[data-fitted='true'] li{flex:1;}"], space8);
17
+ export var StyledLi = styled.li.withConfig({
18
+ displayName: "TabStyle__StyledLi",
19
+ componentId: "sc-3xj4eu-3"
20
+ })(["display:flex;margin:0;padding:0 ", ";"], space4);
21
+ export var StyledSpan = styled.span.withConfig({
22
+ displayName: "TabStyle__StyledSpan",
23
+ componentId: "sc-3xj4eu-4"
24
+ })(["position:relative;display:block;padding:0 ", ";&::before{content:'';position:absolute;bottom:-", ";left:0;right:0;height:3px;border-top-left-radius:", ";border-top-right-radius:", ";}&&::after{content:'';position:absolute;z-index:1;inset:-1px;pointer-events:none;box-shadow:0 0 0 -1px ", ";transition:box-shadow 100ms ease;}@media (max-width:", "){&::before{bottom:-14px;}}"], space16, space16, space4, space4, Blue.S99, Breakpoints.large);
25
+ export var StyledTabButton = styled.button.withConfig({
26
+ displayName: "TabStyle__StyledTabButton",
27
+ componentId: "sc-3xj4eu-5"
28
+ })(["border:0;background:", ";height:56px;cursor:pointer;color:", ";margin-bottom:1px;width:100%;padding:0 ", ";&:hover{color:", ";}&:hover span::before{background:", ";}&[data-selected='true']{color:", ";}&[data-selected='true'] > span::before{background:", ";}@media (max-width:", "){height:48px;}"], Neutral.B100, Neutral.B40, space4, Neutral.B18, Blue.S100, Blue.S99, Blue.S99, Breakpoints.large);
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ export declare type TabModel = {
3
+ /** Id of the tab, a random id will nbe assigned if empty */
4
+ id?: string;
5
+ /** Content of the type header */
6
+ content: React.ReactNode;
7
+ };
8
+ export declare type TabsProps = {
9
+ /** TabModel has 2 properties
10
+ *
11
+ * `id?: string`, id for Tab and will be autogenerated if empty
12
+ *
13
+ * `content: React.ReactNode` component for Tab header
14
+ * */
15
+ tabs: TabModel[];
16
+ selected?: number;
17
+ children?: React.ReactNode;
18
+ fitted?: boolean;
19
+ onSelected?: (index: number) => void;
20
+ };
21
+ export declare const Tabs: ({ tabs, selected: selectedIndex, children, fitted, onSelected, }: TabsProps) => JSX.Element;
@@ -0,0 +1,43 @@
1
+ import nextId from 'react-id-generator';
2
+ import React, { useEffect, useState } from 'react';
3
+ import { Tab } from './Tab';
4
+ import { StyledLi, StyledTabHeaderContainer, StyledTabsContainer, StyledUl } from './TabStyle';
5
+ export var Tabs = function Tabs(_ref) {
6
+ var tabs = _ref.tabs,
7
+ _ref$selected = _ref.selected,
8
+ selectedIndex = _ref$selected === void 0 ? 0 : _ref$selected,
9
+ children = _ref.children,
10
+ fitted = _ref.fitted,
11
+ onSelected = _ref.onSelected;
12
+ var tabLength = tabs.length;
13
+ var _useState = useState(0),
14
+ selectedTabIndex = _useState[0],
15
+ setSelectedTabIndex = _useState[1];
16
+ useEffect(function () {
17
+ if (selectedIndex < 0 || selectedIndex >= tabLength) {
18
+ return;
19
+ }
20
+ setSelectedTabIndex(selectedIndex);
21
+ }, [selectedIndex, tabLength]);
22
+ var handleSelectedIndexChanged = function handleSelectedIndexChanged(index) {
23
+ setSelectedTabIndex(index);
24
+ onSelected == null ? void 0 : onSelected(index);
25
+ };
26
+ var renderTabs = tabs.map(function (tab, index) {
27
+ var tabId = tab.id || nextId();
28
+ return /*#__PURE__*/React.createElement(StyledLi, {
29
+ key: tabId + "-" + index
30
+ }, /*#__PURE__*/React.createElement(Tab, {
31
+ id: tabId,
32
+ key: "tab-" + tabId + "-" + index,
33
+ content: tab.content,
34
+ onSelect: function onSelect() {
35
+ return handleSelectedIndexChanged(index);
36
+ },
37
+ selected: index === selectedTabIndex
38
+ }));
39
+ });
40
+ return /*#__PURE__*/React.createElement(StyledTabsContainer, null, /*#__PURE__*/React.createElement(StyledTabHeaderContainer, null, /*#__PURE__*/React.createElement(StyledUl, {
41
+ "data-fitted": fitted
42
+ }, renderTabs, " ")), /*#__PURE__*/React.createElement("div", null, children));
43
+ };
@@ -0,0 +1,4 @@
1
+ import { Meta } from '@storybook/react';
2
+ declare const _default: Meta<import("@storybook/react").Args>;
3
+ export default _default;
4
+ export declare const Interactive: any;
@@ -0,0 +1,51 @@
1
+ /* eslint-disable react/jsx-key */
2
+ import React, { useState } from 'react';
3
+ import { Tabs } from './Tabs';
4
+ import { BaseContainer } from '../../Layout/GlintsContainer/GlintsContainer';
5
+ import { Typography } from '../Typography';
6
+ import { StyledColumn, StyledHeaderColumn, StyledRow, StyledTable } from './TabsStoriesStyle';
7
+ Tabs.displayName = 'Tabs';
8
+ export default {
9
+ title: '@next/Tabs',
10
+ component: Tabs,
11
+ decorators: [function (Story) {
12
+ return /*#__PURE__*/React.createElement(BaseContainer, null, Story());
13
+ }]
14
+ };
15
+ var Template = function Template(args) {
16
+ var _useState = useState(args.selected || 0),
17
+ selected = _useState[0],
18
+ setSelected = _useState[1];
19
+ var tabs = [{
20
+ id: 'id-tab-1',
21
+ content: 'Tab #1'
22
+ }, {
23
+ id: 'id-tab-2',
24
+ content: 'Tab #2'
25
+ }];
26
+ var Table = function Table() {
27
+ return /*#__PURE__*/React.createElement(StyledTable, null, /*#__PURE__*/React.createElement(StyledRow, null, /*#__PURE__*/React.createElement(StyledHeaderColumn, null, "Company"), /*#__PURE__*/React.createElement(StyledHeaderColumn, null, "Contact"), /*#__PURE__*/React.createElement(StyledHeaderColumn, null, "Country")), /*#__PURE__*/React.createElement(StyledRow, null, /*#__PURE__*/React.createElement(StyledColumn, null, "Alfreds Futterkiste"), /*#__PURE__*/React.createElement(StyledColumn, null, "Maria Anders"), /*#__PURE__*/React.createElement(StyledColumn, null, "Germany")), /*#__PURE__*/React.createElement(StyledRow, null, /*#__PURE__*/React.createElement(StyledColumn, null, "Centro comercial Moctezuma"), /*#__PURE__*/React.createElement(StyledColumn, null, "Francisco Chang"), /*#__PURE__*/React.createElement(StyledColumn, null, "Mexico")), /*#__PURE__*/React.createElement(StyledRow, null, /*#__PURE__*/React.createElement(StyledColumn, null, "Ernst Handel"), /*#__PURE__*/React.createElement(StyledColumn, null, "Roland Mendel"), /*#__PURE__*/React.createElement(StyledColumn, null, "Austria")), /*#__PURE__*/React.createElement(StyledRow, null, /*#__PURE__*/React.createElement(StyledColumn, null, "Island Trading"), /*#__PURE__*/React.createElement(StyledColumn, null, "Helen Bennett"), /*#__PURE__*/React.createElement(StyledColumn, null, "UK")));
28
+ };
29
+ var tabContents = [/*#__PURE__*/React.createElement(Table, null), /*#__PURE__*/React.createElement(Typography, {
30
+ variant: "body2"
31
+ }, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.")];
32
+ return /*#__PURE__*/React.createElement(Tabs, {
33
+ tabs: tabs,
34
+ selected: selected,
35
+ onSelected: function onSelected(i) {
36
+ return setSelected(i);
37
+ },
38
+ fitted: args.fitted
39
+ }, tabContents[selected]);
40
+ };
41
+ export var Interactive = Template.bind({});
42
+ Interactive.args = {};
43
+ Interactive.parameters = {
44
+ docs: {
45
+ source: {
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: 'html',
48
+ type: 'auto'
49
+ }
50
+ }
51
+ };
@@ -0,0 +1,4 @@
1
+ export declare const StyledTable: import("styled-components").StyledComponent<"table", any, {}, never>;
2
+ export declare const StyledRow: import("styled-components").StyledComponent<"tr", any, {}, never>;
3
+ export declare const StyledColumn: import("styled-components").StyledComponent<"td", any, {}, never>;
4
+ export declare const StyledHeaderColumn: import("styled-components").StyledComponent<"th", any, {}, never>;
@@ -0,0 +1,18 @@
1
+ /* eslint-disable react/jsx-key */
2
+ import styled from 'styled-components';
3
+ export var StyledTable = styled.table.withConfig({
4
+ displayName: "TabsStoriesStyle__StyledTable",
5
+ componentId: "sc-34eyhb-0"
6
+ })(["font-family:arial,sans-serif;border-collapse:collapse;width:100%;"]);
7
+ export var StyledRow = styled.tr.withConfig({
8
+ displayName: "TabsStoriesStyle__StyledRow",
9
+ componentId: "sc-34eyhb-1"
10
+ })(["&:nth-child(even){background-color:#dddddd;}"]);
11
+ export var StyledColumn = styled.td.withConfig({
12
+ displayName: "TabsStoriesStyle__StyledColumn",
13
+ componentId: "sc-34eyhb-2"
14
+ })(["border:1px solid #dddddd;text-align:left;padding:8px;"]);
15
+ export var StyledHeaderColumn = styled.th.withConfig({
16
+ displayName: "TabsStoriesStyle__StyledHeaderColumn",
17
+ componentId: "sc-34eyhb-3"
18
+ })(["border:1px solid #dddddd;text-align:left;padding:8px;"]);
@@ -0,0 +1,2 @@
1
+ export * from './Tab';
2
+ export * from './Tabs';
@@ -0,0 +1,2 @@
1
+ export * from './Tab';
2
+ export * from './Tabs';
@@ -2,6 +2,7 @@ export { Button, OutlineButton, DestructiveButton, OutlineMonochromeButton, Prim
2
2
  export { ButtonGroup } from './ButtonGroup';
3
3
  export { Icon } from './Icon';
4
4
  export { Typography } from './Typography';
5
+ export { Tab, Tabs, TabProps, TabsProps } from './Tabs';
5
6
  import * as Breakpoints from './utilities/breakpoints';
6
7
  import * as BorderRadius from './utilities/borderRadius';
7
8
  import * as Colors from './utilities/colors';
package/es/@next/index.js CHANGED
@@ -2,6 +2,7 @@ export { Button, OutlineButton, DestructiveButton, OutlineMonochromeButton, Prim
2
2
  export { ButtonGroup } from './ButtonGroup';
3
3
  export { Icon } from './Icon';
4
4
  export { Typography } from './Typography';
5
+ export { Tab, Tabs, TabProps, TabsProps } from './Tabs';
5
6
 
6
7
  // Utilities
7
8
  import * as Breakpoints from './utilities/breakpoints';
@@ -11,11 +11,9 @@ var _CheckboxStyle = require("./CheckboxStyle");
11
11
  var _lodash = require("lodash");
12
12
  var _Icon = require("../Icon");
13
13
  var _Typography = require("../Typography");
14
- var _colors = require("../utilities/colors");
15
14
  var _excluded = ["label", "id", "checked", "onChange", "disabled", "indeterminate", "hasError", "helpText"];
16
15
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
18
- var randomId = (0, _nanoid.nanoid)();
19
17
  var Checkbox = function Checkbox(_ref) {
20
18
  var label = _ref.label,
21
19
  id = _ref.id,
@@ -26,6 +24,7 @@ var Checkbox = function Checkbox(_ref) {
26
24
  hasError = _ref.hasError,
27
25
  helpText = _ref.helpText,
28
26
  otherProps = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
27
+ var randomId = (0, _nanoid.nanoid)();
29
28
  var checkBoxId = id ? id : randomId;
30
29
  var labelId = "label-" + checkBoxId;
31
30
  var inputNode = (0, _react.useRef)(null);
@@ -36,7 +35,6 @@ var Checkbox = function Checkbox(_ref) {
36
35
  isFocused = _useState2[0],
37
36
  setIsFocused = _useState2[1];
38
37
  var checkedIcon = indeterminate ? 'ri-checkbox-indeterminate-fill' : 'ri-checkbox-fill';
39
- var iconFill = disabled ? _colors.Neutral.B95 : hasError ? _colors.Red.B93 : _colors.Blue.S99;
40
38
  (0, _react.useEffect)(function () {
41
39
  var value = indeterminate ? 'mixed' : checked;
42
40
  setCheckedState(value);
@@ -50,7 +48,8 @@ var Checkbox = function Checkbox(_ref) {
50
48
  onChange(checkedValue, checkBoxId);
51
49
  };
52
50
  return /*#__PURE__*/_react["default"].createElement(_CheckboxStyle.StyledContainer, {
53
- "aria-disabled": disabled
51
+ "aria-disabled": disabled,
52
+ "data-error": hasError
54
53
  }, /*#__PURE__*/_react["default"].createElement(_CheckboxStyle.StyledRow, null, /*#__PURE__*/_react["default"].createElement(_CheckboxStyle.StyledLeftColumn, null, /*#__PURE__*/_react["default"].createElement(_CheckboxStyle.StyledCheckboxContainer, null, /*#__PURE__*/_react["default"].createElement(_CheckboxStyle.StyledCheckbox, {
55
54
  role: "checkbox",
56
55
  "aria-labelledby": labelId,
@@ -80,10 +79,7 @@ var Checkbox = function Checkbox(_ref) {
80
79
  return setIsFocused(false);
81
80
  }
82
81
  }, otherProps))), /*#__PURE__*/_react["default"].createElement(_Icon.Icon, {
83
- name: checkedIcon,
84
- height: "20px",
85
- width: "20px",
86
- fill: iconFill
82
+ name: checkedIcon
87
83
  }))), /*#__PURE__*/_react["default"].createElement(_CheckboxStyle.StyledColumn, null, /*#__PURE__*/_react["default"].createElement("label", {
88
84
  id: labelId,
89
85
  htmlFor: checkBoxId,
@@ -11,7 +11,7 @@ var _spacing = require("../utilities/spacing");
11
11
  var StyledContainer = _styledComponents["default"].div.withConfig({
12
12
  displayName: "CheckboxStyle__StyledContainer",
13
13
  componentId: "sc-a9bf1h-0"
14
- })(["flex-direction:row;align-items:flex-start;padding:", " 0px;gap:8px;color:", ";label{cursor:pointer;margin-top:-1px;}svg{border-radius:4px;position:absolute;top:0;left:0;opacity:0;pointer-events:none;}&[aria-disabled='true'],&[aria-disabled='true'] .help-text{color:", ";}&[aria-disabled='true'] div[role='checkbox']{border-color:", ";background:", ";}&[aria-disabled='true'] svg{background:", ";}"], _spacing.space4, _colors.Neutral.B18, _colors.Neutral.B68, _colors.Neutral.B85, _colors.Neutral.B95, _colors.Neutral.B68);
14
+ })(["flex-direction:row;align-items:flex-start;padding:", " 0px;gap:8px;color:", ";label{cursor:pointer;margin-top:-1px;}svg{border-radius:4px;position:absolute;height:20px;width:20px;top:0;left:0;opacity:0;pointer-events:none;fill:", ";}&[aria-disabled='true'],&[aria-disabled='true'] .help-text{color:", ";}&[aria-disabled='true'] div[role='checkbox']{border-color:", ";background:", ";}&[aria-disabled='true'] svg{background:", ";fill:", ";}&[data-error='true'] svg{fill:", ";}"], _spacing.space4, _colors.Neutral.B18, _colors.Blue.S99, _colors.Neutral.B68, _colors.Neutral.B85, _colors.Neutral.B95, _colors.Neutral.B68, _colors.Neutral.B95, _colors.Red.B93);
15
15
  exports.StyledContainer = StyledContainer;
16
16
  var StyledCheckboxContainer = _styledComponents["default"].div.withConfig({
17
17
  displayName: "CheckboxStyle__StyledCheckboxContainer",
@@ -10,7 +10,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
10
10
  var SvgRiCheckboxIndeterminateFill = function SvgRiCheckboxIndeterminateFill(props) {
11
11
  return /*#__PURE__*/React.createElement("svg", (0, _extends2["default"])({
12
12
  viewBox: "0 0 18 18",
13
- fill: "none",
14
13
  xmlns: "http://www.w3.org/2000/svg"
15
14
  }, props), /*#__PURE__*/React.createElement("path", {
16
15
  d: "M1 0h16a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H1a1 1 0 0 1-1-1V1a1 1 0 0 1 1-1Zm3 8v2h10V8H4Z"
@@ -10,7 +10,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
10
10
  var SvgRiCheckboxIndeterminateLine = function SvgRiCheckboxIndeterminateLine(props) {
11
11
  return /*#__PURE__*/React.createElement("svg", (0, _extends2["default"])({
12
12
  viewBox: "0 0 18 18",
13
- fill: "none",
14
13
  xmlns: "http://www.w3.org/2000/svg"
15
14
  }, props), /*#__PURE__*/React.createElement("path", {
16
15
  d: "M1 0h16a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H1a1 1 0 0 1-1-1V1a1 1 0 0 1 1-1Zm1 2v14h14V2H2Zm2 6h10v2H4V8Z"
@@ -11,16 +11,9 @@ var SvgRiSearch = function SvgRiSearch(props) {
11
11
  return /*#__PURE__*/React.createElement("svg", (0, _extends2["default"])({
12
12
  viewBox: "0 0 24 24",
13
13
  xmlns: "http://www.w3.org/2000/svg"
14
- }, props), /*#__PURE__*/React.createElement("g", {
15
- clipPath: "url(#ri-search_svg__a)"
16
- }, /*#__PURE__*/React.createElement("path", {
14
+ }, props), /*#__PURE__*/React.createElement("path", {
17
15
  d: "m18.031 16.617 4.283 4.282-1.415 1.415-4.282-4.283A8.96 8.96 0 0 1 11 20c-4.968 0-9-4.032-9-9s4.032-9 9-9 9 4.032 9 9a8.96 8.96 0 0 1-1.969 5.617Zm-2.006-.742A6.977 6.977 0 0 0 18 11c0-3.868-3.133-7-7-7-3.868 0-7 3.132-7 7 0 3.867 3.132 7 7 7a6.977 6.977 0 0 0 4.875-1.975l.15-.15Z"
18
- })), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
19
- id: "ri-search_svg__a"
20
- }, /*#__PURE__*/React.createElement("path", {
21
- fill: "#fff",
22
- d: "M0 0h24v24H0z"
23
- }))));
16
+ }));
24
17
  };
25
18
  var _default = SvgRiSearch;
26
19
  exports["default"] = _default;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export declare type TabProps = {
3
+ content: React.ReactNode;
4
+ id?: string;
5
+ selected?: boolean;
6
+ onSelect: () => void;
7
+ };
8
+ export declare const Tab: ({ content, id, selected, onSelect }: TabProps) => JSX.Element;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ exports.__esModule = true;
5
+ exports.Tab = void 0;
6
+ var _react = _interopRequireDefault(require("react"));
7
+ var _Typography = require("../Typography");
8
+ var _TabStyle = require("./TabStyle");
9
+ var Tab = function Tab(_ref) {
10
+ var content = _ref.content,
11
+ id = _ref.id,
12
+ selected = _ref.selected,
13
+ onSelect = _ref.onSelect;
14
+ return /*#__PURE__*/_react["default"].createElement(_TabStyle.StyledTabButton, {
15
+ "data-selected": selected,
16
+ id: id,
17
+ onClick: function onClick() {
18
+ return onSelect();
19
+ }
20
+ }, /*#__PURE__*/_react["default"].createElement(_TabStyle.StyledSpan, null, /*#__PURE__*/_react["default"].createElement(_Typography.Typography, {
21
+ as: "span",
22
+ variant: "body1"
23
+ }, content)));
24
+ };
25
+ exports.Tab = Tab;
@@ -0,0 +1,6 @@
1
+ export declare const StyledTabsContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ export declare const StyledTabHeaderContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export declare const StyledUl: import("styled-components").StyledComponent<"ul", any, {}, never>;
4
+ export declare const StyledLi: import("styled-components").StyledComponent<"li", any, {}, never>;
5
+ export declare const StyledSpan: import("styled-components").StyledComponent<"span", any, {}, never>;
6
+ export declare const StyledTabButton: import("styled-components").StyledComponent<"button", any, {}, never>;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ exports.__esModule = true;
5
+ exports.StyledUl = exports.StyledTabsContainer = exports.StyledTabHeaderContainer = exports.StyledTabButton = exports.StyledSpan = exports.StyledLi = void 0;
6
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
7
+ var _colors = require("../utilities/colors");
8
+ var _spacing = require("../utilities/spacing");
9
+ var Breakpoints = _interopRequireWildcard(require("../utilities/breakpoints"));
10
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
11
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
12
+ var StyledTabsContainer = _styledComponents["default"].div.withConfig({
13
+ displayName: "TabStyle__StyledTabsContainer",
14
+ componentId: "sc-3xj4eu-0"
15
+ })(["display:block;"]);
16
+ exports.StyledTabsContainer = StyledTabsContainer;
17
+ var StyledTabHeaderContainer = _styledComponents["default"].div.withConfig({
18
+ displayName: "TabStyle__StyledTabHeaderContainer",
19
+ componentId: "sc-3xj4eu-1"
20
+ })(["box-shadow:inset 0px -1px 0px #e1e3e5;"]);
21
+ exports.StyledTabHeaderContainer = StyledTabHeaderContainer;
22
+ var StyledUl = _styledComponents["default"].ul.withConfig({
23
+ displayName: "TabStyle__StyledUl",
24
+ componentId: "sc-3xj4eu-2"
25
+ })(["display:flex;flex-direction:row;align-items:flex-start;padding:0;gap:", ";&[data-fitted='true'] li{flex:1;}"], _spacing.space8);
26
+ exports.StyledUl = StyledUl;
27
+ var StyledLi = _styledComponents["default"].li.withConfig({
28
+ displayName: "TabStyle__StyledLi",
29
+ componentId: "sc-3xj4eu-3"
30
+ })(["display:flex;margin:0;padding:0 ", ";"], _spacing.space4);
31
+ exports.StyledLi = StyledLi;
32
+ var StyledSpan = _styledComponents["default"].span.withConfig({
33
+ displayName: "TabStyle__StyledSpan",
34
+ componentId: "sc-3xj4eu-4"
35
+ })(["position:relative;display:block;padding:0 ", ";&::before{content:'';position:absolute;bottom:-", ";left:0;right:0;height:3px;border-top-left-radius:", ";border-top-right-radius:", ";}&&::after{content:'';position:absolute;z-index:1;inset:-1px;pointer-events:none;box-shadow:0 0 0 -1px ", ";transition:box-shadow 100ms ease;}@media (max-width:", "){&::before{bottom:-14px;}}"], _spacing.space16, _spacing.space16, _spacing.space4, _spacing.space4, _colors.Blue.S99, Breakpoints.large);
36
+ exports.StyledSpan = StyledSpan;
37
+ var StyledTabButton = _styledComponents["default"].button.withConfig({
38
+ displayName: "TabStyle__StyledTabButton",
39
+ componentId: "sc-3xj4eu-5"
40
+ })(["border:0;background:", ";height:56px;cursor:pointer;color:", ";margin-bottom:1px;width:100%;padding:0 ", ";&:hover{color:", ";}&:hover span::before{background:", ";}&[data-selected='true']{color:", ";}&[data-selected='true'] > span::before{background:", ";}@media (max-width:", "){height:48px;}"], _colors.Neutral.B100, _colors.Neutral.B40, _spacing.space4, _colors.Neutral.B18, _colors.Blue.S100, _colors.Blue.S99, _colors.Blue.S99, Breakpoints.large);
41
+ exports.StyledTabButton = StyledTabButton;
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ export declare type TabModel = {
3
+ /** Id of the tab, a random id will nbe assigned if empty */
4
+ id?: string;
5
+ /** Content of the type header */
6
+ content: React.ReactNode;
7
+ };
8
+ export declare type TabsProps = {
9
+ /** TabModel has 2 properties
10
+ *
11
+ * `id?: string`, id for Tab and will be autogenerated if empty
12
+ *
13
+ * `content: React.ReactNode` component for Tab header
14
+ * */
15
+ tabs: TabModel[];
16
+ selected?: number;
17
+ children?: React.ReactNode;
18
+ fitted?: boolean;
19
+ onSelected?: (index: number) => void;
20
+ };
21
+ export declare const Tabs: ({ tabs, selected: selectedIndex, children, fitted, onSelected, }: TabsProps) => JSX.Element;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ exports.__esModule = true;
5
+ exports.Tabs = void 0;
6
+ var _reactIdGenerator = _interopRequireDefault(require("react-id-generator"));
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _Tab = require("./Tab");
9
+ var _TabStyle = require("./TabStyle");
10
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
11
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
12
+ var Tabs = function Tabs(_ref) {
13
+ var tabs = _ref.tabs,
14
+ _ref$selected = _ref.selected,
15
+ selectedIndex = _ref$selected === void 0 ? 0 : _ref$selected,
16
+ children = _ref.children,
17
+ fitted = _ref.fitted,
18
+ onSelected = _ref.onSelected;
19
+ var tabLength = tabs.length;
20
+ var _useState = (0, _react.useState)(0),
21
+ selectedTabIndex = _useState[0],
22
+ setSelectedTabIndex = _useState[1];
23
+ (0, _react.useEffect)(function () {
24
+ if (selectedIndex < 0 || selectedIndex >= tabLength) {
25
+ return;
26
+ }
27
+ setSelectedTabIndex(selectedIndex);
28
+ }, [selectedIndex, tabLength]);
29
+ var handleSelectedIndexChanged = function handleSelectedIndexChanged(index) {
30
+ setSelectedTabIndex(index);
31
+ onSelected == null ? void 0 : onSelected(index);
32
+ };
33
+ var renderTabs = tabs.map(function (tab, index) {
34
+ var tabId = tab.id || (0, _reactIdGenerator["default"])();
35
+ return /*#__PURE__*/_react["default"].createElement(_TabStyle.StyledLi, {
36
+ key: tabId + "-" + index
37
+ }, /*#__PURE__*/_react["default"].createElement(_Tab.Tab, {
38
+ id: tabId,
39
+ key: "tab-" + tabId + "-" + index,
40
+ content: tab.content,
41
+ onSelect: function onSelect() {
42
+ return handleSelectedIndexChanged(index);
43
+ },
44
+ selected: index === selectedTabIndex
45
+ }));
46
+ });
47
+ return /*#__PURE__*/_react["default"].createElement(_TabStyle.StyledTabsContainer, null, /*#__PURE__*/_react["default"].createElement(_TabStyle.StyledTabHeaderContainer, null, /*#__PURE__*/_react["default"].createElement(_TabStyle.StyledUl, {
48
+ "data-fitted": fitted
49
+ }, renderTabs, " ")), /*#__PURE__*/_react["default"].createElement("div", null, children));
50
+ };
51
+ exports.Tabs = Tabs;
@@ -0,0 +1,4 @@
1
+ import { Meta } from '@storybook/react';
2
+ declare const _default: Meta<import("@storybook/react").Args>;
3
+ export default _default;
4
+ export declare const Interactive: any;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports["default"] = exports.Interactive = void 0;
5
+ var _react = _interopRequireWildcard(require("react"));
6
+ var _Tabs = require("./Tabs");
7
+ var _GlintsContainer = require("../../Layout/GlintsContainer/GlintsContainer");
8
+ var _Typography = require("../Typography");
9
+ var _TabsStoriesStyle = require("./TabsStoriesStyle");
10
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
11
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
12
+ /* eslint-disable react/jsx-key */
13
+
14
+ _Tabs.Tabs.displayName = 'Tabs';
15
+ var _default = {
16
+ title: '@next/Tabs',
17
+ component: _Tabs.Tabs,
18
+ decorators: [function (Story) {
19
+ return /*#__PURE__*/_react["default"].createElement(_GlintsContainer.BaseContainer, null, Story());
20
+ }]
21
+ };
22
+ exports["default"] = _default;
23
+ var Template = function Template(args) {
24
+ var _useState = (0, _react.useState)(args.selected || 0),
25
+ selected = _useState[0],
26
+ setSelected = _useState[1];
27
+ var tabs = [{
28
+ id: 'id-tab-1',
29
+ content: 'Tab #1'
30
+ }, {
31
+ id: 'id-tab-2',
32
+ content: 'Tab #2'
33
+ }];
34
+ var Table = function Table() {
35
+ return /*#__PURE__*/_react["default"].createElement(_TabsStoriesStyle.StyledTable, null, /*#__PURE__*/_react["default"].createElement(_TabsStoriesStyle.StyledRow, null, /*#__PURE__*/_react["default"].createElement(_TabsStoriesStyle.StyledHeaderColumn, null, "Company"), /*#__PURE__*/_react["default"].createElement(_TabsStoriesStyle.StyledHeaderColumn, null, "Contact"), /*#__PURE__*/_react["default"].createElement(_TabsStoriesStyle.StyledHeaderColumn, null, "Country")), /*#__PURE__*/_react["default"].createElement(_TabsStoriesStyle.StyledRow, null, /*#__PURE__*/_react["default"].createElement(_TabsStoriesStyle.StyledColumn, null, "Alfreds Futterkiste"), /*#__PURE__*/_react["default"].createElement(_TabsStoriesStyle.StyledColumn, null, "Maria Anders"), /*#__PURE__*/_react["default"].createElement(_TabsStoriesStyle.StyledColumn, null, "Germany")), /*#__PURE__*/_react["default"].createElement(_TabsStoriesStyle.StyledRow, null, /*#__PURE__*/_react["default"].createElement(_TabsStoriesStyle.StyledColumn, null, "Centro comercial Moctezuma"), /*#__PURE__*/_react["default"].createElement(_TabsStoriesStyle.StyledColumn, null, "Francisco Chang"), /*#__PURE__*/_react["default"].createElement(_TabsStoriesStyle.StyledColumn, null, "Mexico")), /*#__PURE__*/_react["default"].createElement(_TabsStoriesStyle.StyledRow, null, /*#__PURE__*/_react["default"].createElement(_TabsStoriesStyle.StyledColumn, null, "Ernst Handel"), /*#__PURE__*/_react["default"].createElement(_TabsStoriesStyle.StyledColumn, null, "Roland Mendel"), /*#__PURE__*/_react["default"].createElement(_TabsStoriesStyle.StyledColumn, null, "Austria")), /*#__PURE__*/_react["default"].createElement(_TabsStoriesStyle.StyledRow, null, /*#__PURE__*/_react["default"].createElement(_TabsStoriesStyle.StyledColumn, null, "Island Trading"), /*#__PURE__*/_react["default"].createElement(_TabsStoriesStyle.StyledColumn, null, "Helen Bennett"), /*#__PURE__*/_react["default"].createElement(_TabsStoriesStyle.StyledColumn, null, "UK")));
36
+ };
37
+ var tabContents = [/*#__PURE__*/_react["default"].createElement(Table, null), /*#__PURE__*/_react["default"].createElement(_Typography.Typography, {
38
+ variant: "body2"
39
+ }, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.")];
40
+ return /*#__PURE__*/_react["default"].createElement(_Tabs.Tabs, {
41
+ tabs: tabs,
42
+ selected: selected,
43
+ onSelected: function onSelected(i) {
44
+ return setSelected(i);
45
+ },
46
+ fitted: args.fitted
47
+ }, tabContents[selected]);
48
+ };
49
+ var Interactive = Template.bind({});
50
+ exports.Interactive = Interactive;
51
+ Interactive.args = {};
52
+ Interactive.parameters = {
53
+ docs: {
54
+ source: {
55
+ 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 };",
56
+ language: 'html',
57
+ type: 'auto'
58
+ }
59
+ }
60
+ };
@@ -0,0 +1,4 @@
1
+ export declare const StyledTable: import("styled-components").StyledComponent<"table", any, {}, never>;
2
+ export declare const StyledRow: import("styled-components").StyledComponent<"tr", any, {}, never>;
3
+ export declare const StyledColumn: import("styled-components").StyledComponent<"td", any, {}, never>;
4
+ export declare const StyledHeaderColumn: import("styled-components").StyledComponent<"th", any, {}, never>;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ exports.__esModule = true;
5
+ exports.StyledTable = exports.StyledRow = exports.StyledHeaderColumn = exports.StyledColumn = void 0;
6
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
7
+ /* eslint-disable react/jsx-key */
8
+
9
+ var StyledTable = _styledComponents["default"].table.withConfig({
10
+ displayName: "TabsStoriesStyle__StyledTable",
11
+ componentId: "sc-34eyhb-0"
12
+ })(["font-family:arial,sans-serif;border-collapse:collapse;width:100%;"]);
13
+ exports.StyledTable = StyledTable;
14
+ var StyledRow = _styledComponents["default"].tr.withConfig({
15
+ displayName: "TabsStoriesStyle__StyledRow",
16
+ componentId: "sc-34eyhb-1"
17
+ })(["&:nth-child(even){background-color:#dddddd;}"]);
18
+ exports.StyledRow = StyledRow;
19
+ var StyledColumn = _styledComponents["default"].td.withConfig({
20
+ displayName: "TabsStoriesStyle__StyledColumn",
21
+ componentId: "sc-34eyhb-2"
22
+ })(["border:1px solid #dddddd;text-align:left;padding:8px;"]);
23
+ exports.StyledColumn = StyledColumn;
24
+ var StyledHeaderColumn = _styledComponents["default"].th.withConfig({
25
+ displayName: "TabsStoriesStyle__StyledHeaderColumn",
26
+ componentId: "sc-34eyhb-3"
27
+ })(["border:1px solid #dddddd;text-align:left;padding:8px;"]);
28
+ exports.StyledHeaderColumn = StyledHeaderColumn;
@@ -0,0 +1,2 @@
1
+ export * from './Tab';
2
+ export * from './Tabs';
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ var _Tab = require("./Tab");
5
+ Object.keys(_Tab).forEach(function (key) {
6
+ if (key === "default" || key === "__esModule") return;
7
+ if (key in exports && exports[key] === _Tab[key]) return;
8
+ exports[key] = _Tab[key];
9
+ });
10
+ var _Tabs = require("./Tabs");
11
+ Object.keys(_Tabs).forEach(function (key) {
12
+ if (key === "default" || key === "__esModule") return;
13
+ if (key in exports && exports[key] === _Tabs[key]) return;
14
+ exports[key] = _Tabs[key];
15
+ });
@@ -2,6 +2,7 @@ export { Button, OutlineButton, DestructiveButton, OutlineMonochromeButton, Prim
2
2
  export { ButtonGroup } from './ButtonGroup';
3
3
  export { Icon } from './Icon';
4
4
  export { Typography } from './Typography';
5
+ export { Tab, Tabs, TabProps, TabsProps } from './Tabs';
5
6
  import * as Breakpoints from './utilities/breakpoints';
6
7
  import * as BorderRadius from './utilities/borderRadius';
7
8
  import * as Colors from './utilities/colors';
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.Typography = exports.Spacing = exports.PrimaryButton = exports.OutlineMonochromeButton = exports.OutlineButton = exports.Icon = exports.Fonts = exports.DropShadow = exports.DestructiveButton = exports.Colors = exports.ButtonGroup = exports.Button = exports.Breakpoints = exports.BorderRadius = void 0;
4
+ exports.Typography = exports.TabsProps = exports.Tabs = exports.TabProps = exports.Tab = exports.Spacing = exports.PrimaryButton = exports.OutlineMonochromeButton = exports.OutlineButton = exports.Icon = exports.Fonts = exports.DropShadow = exports.DestructiveButton = exports.Colors = exports.ButtonGroup = exports.Button = exports.Breakpoints = exports.BorderRadius = void 0;
5
5
  var _Button = require("./Button");
6
6
  exports.Button = _Button.Button;
7
7
  exports.OutlineButton = _Button.OutlineButton;
@@ -14,6 +14,11 @@ var _Icon = require("./Icon");
14
14
  exports.Icon = _Icon.Icon;
15
15
  var _Typography = require("./Typography");
16
16
  exports.Typography = _Typography.Typography;
17
+ var _Tabs = require("./Tabs");
18
+ exports.Tab = _Tabs.Tab;
19
+ exports.Tabs = _Tabs.Tabs;
20
+ exports.TabProps = _Tabs.TabProps;
21
+ exports.TabsProps = _Tabs.TabsProps;
17
22
  var Breakpoints = _interopRequireWildcard(require("./utilities/breakpoints"));
18
23
  exports.Breakpoints = Breakpoints;
19
24
  var BorderRadius = _interopRequireWildcard(require("./utilities/borderRadius"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glints-aries",
3
- "version": "4.0.166",
3
+ "version": "4.0.167",
4
4
  "description": "Glints ui-kit for frontend",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./es/index.js",
@@ -129,7 +129,6 @@
129
129
  "classnames": "^2.2.6",
130
130
  "downshift": "^6.1.3",
131
131
  "moment": "^2.24.0",
132
- "nanoid": "^4.0.0",
133
132
  "react-id-generator": "^3.0.1",
134
133
  "styled-system": "^5.1.5"
135
134
  },