@ndlib/component-library 1.0.23 → 1.0.24

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 (29) hide show
  1. package/dist/components/composites/CardV2/index.js +1 -1
  2. package/dist/components/composites/ModalV2/index.js +1 -1
  3. package/dist/components/elements/{layoutV2 → BoxV2}/BoxV2.stories.d.ts +1 -1
  4. package/dist/components/elements/{layoutV2 → BoxV2}/BoxV2.stories.js +1 -1
  5. package/dist/components/elements/ButtonV2/ButtonV2.stories.js +2 -2
  6. package/dist/components/elements/CheckboxGroupV2/CheckboxGroupV2.stories.js +1 -1
  7. package/dist/components/elements/CheckboxGroupV2/index.js +2 -2
  8. package/dist/components/elements/CheckboxV2/CheckboxV2.stories.js +1 -1
  9. package/dist/components/elements/{layoutV2/ColumnV2.d.ts → ColumnV2/index.d.ts} +1 -1
  10. package/dist/components/elements/{layoutV2/ColumnV2.js → ColumnV2/index.js} +1 -1
  11. package/dist/components/elements/HeadingV2/HeadingV2.stories.js +1 -1
  12. package/dist/components/elements/IconV2/IconV2.stories.js +1 -1
  13. package/dist/components/elements/LabelV2/LabelV2.stories.js +1 -1
  14. package/dist/components/elements/ParagraphV2/ParagraphV2.stories.js +1 -1
  15. package/dist/components/elements/ReadMoreV2/ReadMoreV2.stories.js +1 -1
  16. package/dist/components/elements/RowV2/RowV2.module.css +47 -0
  17. package/dist/components/elements/{layoutV2/RowV2.d.ts → RowV2/index.d.ts} +1 -0
  18. package/dist/components/elements/{layoutV2/RowV2.js → RowV2/index.js} +12 -10
  19. package/dist/components/elements/SelectV2/SelectV2.stories.js +1 -1
  20. package/dist/components/elements/SelectV2/index.js +1 -1
  21. package/dist/components/elements/SpinnerV2/SpinnerV2.stories.js +1 -1
  22. package/dist/components/elements/TextInputV2/TextInputV2.stories.js +1 -1
  23. package/dist/index.d.ts +3 -3
  24. package/dist/index.js +3 -3
  25. package/dist/theme/typography.js +1 -1
  26. package/dist/utils/processSx.js +2 -37
  27. package/package.json +1 -1
  28. /package/dist/components/elements/{layoutV2/BoxV2.d.ts → BoxV2/index.d.ts} +0 -0
  29. /package/dist/components/elements/{layoutV2/BoxV2.js → BoxV2/index.js} +0 -0
@@ -3,7 +3,7 @@ import React, { useEffect, useState } from 'react';
3
3
  import { HEADINGV2_SIZE, HeadingV2 } from '../../elements/HeadingV2';
4
4
  import { BOX_SHADOW } from '../../../theme';
5
5
  import { GROUPV2_TYPE, GroupV2 } from '../../elements/GroupV2';
6
- import { BoxV2 } from '../../elements/layoutV2/BoxV2';
6
+ import { BoxV2 } from '../../elements/BoxV2';
7
7
  import { IconV2 } from '../../elements/IconV2';
8
8
  import { ColumnV2, FONT, FONT_SIZE, RowV2, TYPOGRAPHY_TYPE } from '../../..';
9
9
  import { COLOR } from '../../../theme/colors';
@@ -14,7 +14,7 @@ import _ReactModal from 'react-modal';
14
14
  import { importedDefaultComponentShim } from '../../../utils/misc';
15
15
  import { Z_INDEX } from '../../../theme';
16
16
  import { GROUPV2_TYPE, GroupV2 } from '../../elements/GroupV2';
17
- import { RowV2 } from '../../elements/layoutV2/RowV2';
17
+ import { RowV2 } from '../../elements/RowV2';
18
18
  import { HEADINGV2_SIZE, HeadingV2 } from '../../elements/HeadingV2';
19
19
  import { BUTTONV2_TYPE, ButtonV2 } from '../../elements/ButtonV2';
20
20
  import { COLOR } from '../../../theme/colors';
@@ -1,5 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
- import { BoxV2 as BoxV2Component } from './BoxV2';
2
+ import { BoxV2 as BoxV2Component } from '.';
3
3
  declare const meta: Meta<typeof BoxV2Component>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof BoxV2Component>;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { BoxV2 as BoxV2Component } from './BoxV2';
2
+ import { BoxV2 as BoxV2Component } from '.';
3
3
  import { COLOR } from '../../../theme/colors';
4
4
  import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
5
5
  const meta = {
@@ -5,8 +5,8 @@ import SettingsIcon from '@mui/icons-material/Settings';
5
5
  import { BUTTONV2_SIZE, BUTTONV2_TYPE, ButtonV2, LinkButtonV2 } from '.';
6
6
  import { GROUPV2_TYPE, GroupV2 } from '../GroupV2';
7
7
  import { HEADINGV2_SIZE, HeadingV2 } from '../HeadingV2';
8
- import { ColumnV2 } from '../layoutV2/ColumnV2';
9
- import { RowV2 } from '../layoutV2/RowV2';
8
+ import { ColumnV2 } from '../ColumnV2';
9
+ import { RowV2 } from '../RowV2';
10
10
  import { ParagraphV2 } from '../ParagraphV2';
11
11
  import { COLOR } from '../../../theme/colors';
12
12
  import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { CheckboxGroupV2 } from './index';
3
3
  import { useState } from 'react';
4
- import { RowV2 } from '../layoutV2/RowV2';
4
+ import { RowV2 } from '../RowV2';
5
5
  import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
6
6
  const meta = {
7
7
  title: 'Elements/Fields/CheckboxGroupV2',
@@ -11,12 +11,12 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { useMemo } from 'react';
14
- import { RowV2 } from '../layoutV2/RowV2';
14
+ import { RowV2 } from '../RowV2';
15
15
  import { CheckboxV2 } from '../CheckboxV2';
16
16
  import { LabelV2 } from '../LabelV2';
17
17
  import { GroupV2 } from '../GroupV2';
18
18
  import { GROUPV2_TYPE } from '../GroupV2';
19
- import { ColumnV2 } from '../layoutV2/ColumnV2';
19
+ import { ColumnV2 } from '../ColumnV2';
20
20
  import { TYPOGRAPHY_TYPE, getTypographyStyles } from '../../../theme/typography';
21
21
  import { COLOR } from '../../../theme/colors';
22
22
  export function CheckboxGroupV2(_a) {
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { CheckboxV2 } from '.';
3
3
  import { useState } from 'react';
4
- import { RowV2 } from '../layoutV2/RowV2';
4
+ import { RowV2 } from '../RowV2';
5
5
  import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
6
6
  const meta = {
7
7
  title: 'Elements/Fields/CheckboxV2',
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { FlexHelperPropsV2 } from './RowV2';
2
+ import { FlexHelperPropsV2 } from '../RowV2';
3
3
  export declare const ColumnV2: React.ForwardRefExoticComponent<{
4
4
  sx?: import("../../../theme").StylesPropV2 | undefined;
5
5
  children?: React.ReactNode;
@@ -11,7 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import React from 'react';
14
- import { convertFlexHelperPropsV2 } from './RowV2';
14
+ import { convertFlexHelperPropsV2 } from '../RowV2';
15
15
  import { processSx } from '../../../utils/processSx';
16
16
  export const ColumnV2 = React.forwardRef((_a, ref) => {
17
17
  var { sx, children } = _a, rest = __rest(_a, ["sx", "children"]);
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { GROUPV2_TYPE, GroupV2 } from '../GroupV2';
3
3
  import { HEADINGV2_SIZE, HeadingV2 } from '.';
4
- import { ColumnV2 } from '../layoutV2/ColumnV2';
4
+ import { ColumnV2 } from '../ColumnV2';
5
5
  import { COLOR } from '../../../theme/colors';
6
6
  import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
7
7
  const meta = {
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { GROUPV2_TYPE, GroupV2 } from '../GroupV2';
3
3
  import { HEADINGV2_SIZE, HeadingV2 } from '../HeadingV2';
4
- import { ColumnV2 } from '../layoutV2/ColumnV2';
4
+ import { ColumnV2 } from '../ColumnV2';
5
5
  import { IconV2 } from '.';
6
6
  import AccessAlarmIcon from '@mui/icons-material/AccessAlarm';
7
7
  import { COLOR } from '../../../theme/colors';
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { GROUPV2_TYPE, GroupV2 } from '../GroupV2';
3
3
  import { LABELV2_SIZE, LabelV2 } from '.';
4
- import { ColumnV2 } from '../layoutV2/ColumnV2';
4
+ import { ColumnV2 } from '../ColumnV2';
5
5
  import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
6
6
  const meta = {
7
7
  title: 'Elements/LabelV2',
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { GROUPV2_TYPE, GroupV2 } from '../GroupV2';
3
3
  import { PARAGRAPHV2_SIZE, ParagraphV2 } from '.';
4
- import { ColumnV2 } from '../layoutV2/ColumnV2';
4
+ import { ColumnV2 } from '../ColumnV2';
5
5
  import { HEADINGV2_SIZE, HeadingV2 } from '../HeadingV2';
6
6
  import { COLOR } from '../../../theme/colors';
7
7
  import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { ReadMoreV2 } from '.';
3
- import { ColumnV2 } from '../layoutV2/ColumnV2';
3
+ import { ColumnV2 } from '../ColumnV2';
4
4
  import { TYPOGRAPHY_TYPE } from '../../../theme/typography';
5
5
  import { COLOR } from '../../../theme/colors';
6
6
  import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
@@ -0,0 +1,47 @@
1
+ .row {
2
+ display: flex;
3
+ }
4
+
5
+ .flexRow {
6
+ flex-direction: row;
7
+ }
8
+
9
+ .bp0 {
10
+ flex-direction: column;
11
+
12
+ @media screen and (min-width: 576px) {
13
+ flex-direction: row;
14
+ }
15
+ }
16
+
17
+ .bp1 {
18
+ flex-direction: column;
19
+
20
+ @media screen and (min-width: 768px) {
21
+ flex-direction: row;
22
+ }
23
+ }
24
+
25
+ .bp2 {
26
+ flex-direction: column;
27
+
28
+ @media screen and (min-width: 992px) {
29
+ flex-direction: row;
30
+ }
31
+ }
32
+
33
+ .bp3 {
34
+ flex-direction: column;
35
+
36
+ @media screen and (min-width: 1200px) {
37
+ flex-direction: row;
38
+ }
39
+ }
40
+
41
+ .bp4 {
42
+ flex-direction: column;
43
+
44
+ @media screen and (min-width: 1400px) {
45
+ flex-direction: row;
46
+ }
47
+ }
@@ -14,6 +14,7 @@ export declare const RowV2: React.ForwardRefExoticComponent<{
14
14
  children?: React.ReactNode;
15
15
  } & Omit<React.HTMLAttributes<HTMLDivElement>, "children" | "onChange"> & FlexHelperPropsV2 & {
16
16
  breakpoint?: number | undefined;
17
+ className?: string | undefined;
17
18
  } & {
18
19
  htmlFor?: string | undefined;
19
20
  } & React.RefAttributes<HTMLDivElement>>;
@@ -12,6 +12,9 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import React from 'react';
14
14
  import { processSx } from '../../../utils/processSx';
15
+ import * as styles from './RowV2.module.css';
16
+ import clsx from 'clsx';
17
+ const typeSafeStyles = styles;
15
18
  export const convertFlexHelperPropsV2 = (props) => {
16
19
  const styleObject = {};
17
20
  if (props.grow) {
@@ -39,16 +42,15 @@ export const convertFlexHelperPropsV2 = (props) => {
39
42
  return styleObject;
40
43
  };
41
44
  export const RowV2 = React.forwardRef((_a, ref) => {
42
- var { sx, children, breakpoint: breakpointParam } = _a, rest = __rest(_a, ["sx", "children", "breakpoint"]);
45
+ var { sx, children, breakpoint: breakpointParam, className } = _a, rest = __rest(_a, ["sx", "children", "breakpoint", "className"]);
43
46
  const flexStyles = convertFlexHelperPropsV2(rest);
44
- let flexDirection = 'row';
45
- if (breakpointParam !== undefined) {
46
- flexDirection = [];
47
- for (let i = 0; i <= breakpointParam; i++) {
48
- flexDirection.push('column');
47
+ const processedStyles = processSx(sx);
48
+ const getBreakpointClass = (breakpoint) => {
49
+ if (breakpoint !== undefined && breakpoint >= 0 && breakpoint <= 4) {
50
+ return typeSafeStyles[`bp${breakpoint}`];
49
51
  }
50
- flexDirection.push('row');
51
- }
52
- const processedStyles = processSx(Object.assign(Object.assign({}, sx), { flexDirection }));
53
- return (_jsx("div", Object.assign({}, rest, { ref: ref, style: Object.assign(Object.assign(Object.assign({}, flexStyles), processedStyles), { display: 'flex' }) }, { children: children })));
52
+ return typeSafeStyles.flexRow;
53
+ };
54
+ const flexBreakpointClass = getBreakpointClass(breakpointParam);
55
+ return (_jsx("div", Object.assign({}, rest, { ref: ref, style: Object.assign(Object.assign({}, flexStyles), processedStyles), className: clsx(typeSafeStyles.row, flexBreakpointClass, className) }, { children: children })));
54
56
  });
@@ -3,7 +3,7 @@ import AppleIcon from '@mui/icons-material/Apple';
3
3
  import { INPUTV2_SIZE } from '../TextInputV2';
4
4
  import { SelectV2 } from '.';
5
5
  import { useState } from 'react';
6
- import { ColumnV2 } from '../layoutV2/ColumnV2';
6
+ import { ColumnV2 } from '../ColumnV2';
7
7
  import { GroupV2 } from '../GroupV2';
8
8
  import { HeadingV2, HEADINGV2_SIZE } from '../HeadingV2';
9
9
  import { COLOR } from '../../../theme/colors';
@@ -9,7 +9,7 @@ import { BUTTONV2_SIZE, BUTTONV2_TYPE, ButtonV2 } from '../ButtonV2';
9
9
  import { defaultRenderOptionLabel, getOptionId, } from '../option';
10
10
  import { KEY_CODES, importedDefaultComponentShim } from '../../../utils/misc';
11
11
  import { COLOR } from '../../../theme/colors';
12
- import { BoxV2 } from '../layoutV2/BoxV2';
12
+ import { BoxV2 } from '../BoxV2';
13
13
  import { LabelV2 } from '../LabelV2';
14
14
  import { useUniqueId } from '../../providers/uniqueIds';
15
15
  import { BOX_SHADOW, Z_INDEX } from '../../../theme/custom';
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { ColumnV2 } from '../layoutV2/ColumnV2';
2
+ import { ColumnV2 } from '../ColumnV2';
3
3
  import { GROUPV2_TYPE, GroupV2 } from '../GroupV2';
4
4
  import { HEADINGV2_SIZE, HeadingV2 } from '../HeadingV2';
5
5
  import { SPINNERV2_SIZE, SpinnerV2 } from '.';
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import SearchIcon from '@mui/icons-material/Search';
3
3
  import { INPUTV2_SIZE, TextInputV2 } from '.';
4
4
  import { useState } from 'react';
5
- import { ColumnV2 } from '../layoutV2/ColumnV2';
5
+ import { ColumnV2 } from '../ColumnV2';
6
6
  import { GroupV2 } from '../GroupV2';
7
7
  import { HeadingV2, HEADINGV2_SIZE } from '../HeadingV2';
8
8
  import { COLOR } from '../../../theme/colors';
package/dist/index.d.ts CHANGED
@@ -19,11 +19,11 @@ export { Group, useGroup, GROUP_TYPE } from './components/elements/Group';
19
19
  export { GroupV2, useGroupV2, GROUPV2_TYPE, } from './components/elements/GroupV2';
20
20
  export { Markdown } from './components/elements/Markdown';
21
21
  export { Box } from './components/elements/layout/Box';
22
- export { BoxV2 } from './components/elements/layoutV2/BoxV2';
22
+ export { BoxV2 } from './components/elements/BoxV2';
23
23
  export { Column } from './components/elements/layout/Column';
24
- export { ColumnV2 } from './components/elements/layoutV2/ColumnV2';
24
+ export { ColumnV2 } from './components/elements/ColumnV2';
25
25
  export { Row } from './components/elements/layout/Row';
26
- export { RowV2 } from './components/elements/layoutV2/RowV2';
26
+ export { RowV2 } from './components/elements/RowV2';
27
27
  export { Link, LINK_SIZE } from './components/elements/Link';
28
28
  export { INPUT_SIZE, TextInput } from './components/elements/TextInput';
29
29
  export { INPUTV2_SIZE, TextInputV2 } from './components/elements/TextInputV2';
package/dist/index.js CHANGED
@@ -18,11 +18,11 @@ export { Group, useGroup, GROUP_TYPE } from './components/elements/Group';
18
18
  export { GroupV2, useGroupV2, GROUPV2_TYPE, } from './components/elements/GroupV2';
19
19
  export { Markdown } from './components/elements/Markdown';
20
20
  export { Box } from './components/elements/layout/Box';
21
- export { BoxV2 } from './components/elements/layoutV2/BoxV2';
21
+ export { BoxV2 } from './components/elements/BoxV2';
22
22
  export { Column } from './components/elements/layout/Column';
23
- export { ColumnV2 } from './components/elements/layoutV2/ColumnV2';
23
+ export { ColumnV2 } from './components/elements/ColumnV2';
24
24
  export { Row } from './components/elements/layout/Row';
25
- export { RowV2 } from './components/elements/layoutV2/RowV2';
25
+ export { RowV2 } from './components/elements/RowV2';
26
26
  export { Link, LINK_SIZE } from './components/elements/Link';
27
27
  export { INPUT_SIZE, TextInput } from './components/elements/TextInput';
28
28
  export { INPUTV2_SIZE, TextInputV2 } from './components/elements/TextInputV2';
@@ -63,7 +63,7 @@ export const fontStyles = {
63
63
  fontSizes: fontSizeMap,
64
64
  lineHeights: {
65
65
  [LINE_HEIGHT.NORMAL]: 1.625,
66
- [LINE_HEIGHT.CONDENSED]: 1.3,
66
+ [LINE_HEIGHT.CONDENSED]: 1.4,
67
67
  [LINE_HEIGHT.EXTRA_CONDENSED]: 1,
68
68
  },
69
69
  fontWeights: {
@@ -1,13 +1,6 @@
1
1
  import { colors, COLOR } from '../theme/colors';
2
2
  import { fontStyles, FONT, FONT_SIZE, TYPOGRAPHY_TYPE, FONT_WEIGHT, LINE_HEIGHT, } from '../theme/typography';
3
3
  import { getTypographyStyles } from '../theme/typography';
4
- const breakpoints = {
5
- xs: '576px',
6
- sm: '768px',
7
- md: '992px',
8
- lg: '1200px',
9
- xl: '1400px',
10
- };
11
4
  const resolveMappedValue = (key, value) => {
12
5
  if (Object.values(COLOR).includes(value)) {
13
6
  return colors[value];
@@ -97,39 +90,11 @@ export const processSx = (sx) => {
97
90
  for (const key in sx) {
98
91
  let value = sx[key];
99
92
  value = resolveMappedValue(key, value);
100
- if (Array.isArray(value)) {
101
- styles[key] = value[0];
102
- if (value[1]) {
103
- styles[`@media (min-width: ${breakpoints.xs})`] = Object.assign(Object.assign({}, styles[`@media (min-width: ${breakpoints.xs})`]), { [key]: value[1] });
104
- }
105
- if (value[2]) {
106
- styles[`@media (min-width: ${breakpoints.sm})`] = Object.assign(Object.assign({}, styles[`@media (min-width: ${breakpoints.sm})`]), { [key]: value[2] });
107
- }
108
- if (value[3]) {
109
- styles[`@media (min-width: ${breakpoints.md})`] = Object.assign(Object.assign({}, styles[`@media (min-width: ${breakpoints.md})`]), { [key]: value[3] });
110
- }
111
- if (value[4]) {
112
- styles[`@media (min-width: ${breakpoints.lg})`] = Object.assign(Object.assign({}, styles[`@media (min-width: ${breakpoints.lg})`]), { [key]: value[4] });
113
- }
114
- if (value[5]) {
115
- styles[`@media (min-width: ${breakpoints.xl})`] = Object.assign(Object.assign({}, styles[`@media (min-width: ${breakpoints.xl})`]), { [key]: value[5] });
116
- }
117
- }
118
- else {
119
- Object.assign(styles, expandShorthandProperties(key, value));
120
- }
93
+ Object.assign(styles, expandShorthandProperties(key, value));
121
94
  }
122
95
  const flattenedStyles = {};
123
96
  for (const key in styles) {
124
- if (typeof styles[key] === 'object' && key.startsWith('@media')) {
125
- const mediaStyles = styles[key];
126
- for (const mediaKey in mediaStyles) {
127
- flattenedStyles[key] = Object.assign(Object.assign({}, flattenedStyles[key]), { [mediaKey]: mediaStyles[mediaKey] });
128
- }
129
- }
130
- else {
131
- flattenedStyles[key] = styles[key];
132
- }
97
+ flattenedStyles[key] = styles[key];
133
98
  }
134
99
  return flattenedStyles;
135
100
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndlib/component-library",
3
- "version": "1.0.23",
3
+ "version": "1.0.24",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "files": [