@ndlib/component-library 1.0.41 → 1.0.42

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 (66) hide show
  1. package/dist/components/elements/AlertsV2/AlertV2.stories.d.ts +10 -0
  2. package/dist/components/elements/AlertsV2/AlertV2.stories.js +51 -0
  3. package/dist/components/elements/AlertsV2/AlertsV2.module.css +49 -0
  4. package/dist/components/elements/AlertsV2/AlertsV2.stories.d.ts +7 -0
  5. package/dist/components/elements/AlertsV2/AlertsV2.stories.js +17 -0
  6. package/dist/components/elements/AlertsV2/index.d.ts +15 -0
  7. package/dist/components/elements/AlertsV2/index.js +50 -0
  8. package/dist/components/elements/BlockQuoteV2/BlockQuoteV2.module.css +6 -0
  9. package/dist/components/elements/BlockQuoteV2/index.d.ts +4 -0
  10. package/dist/components/elements/BlockQuoteV2/index.js +21 -0
  11. package/dist/components/elements/BrandingBarV2/BrandingBarV2.module.css +68 -0
  12. package/dist/components/elements/BrandingBarV2/BrandingBarV2.stories.d.ts +6 -0
  13. package/dist/components/elements/BrandingBarV2/BrandingBarV2.stories.js +13 -0
  14. package/dist/components/elements/BrandingBarV2/index.d.ts +2 -0
  15. package/dist/components/elements/BrandingBarV2/index.js +10 -0
  16. package/dist/components/elements/CaptionV2/index.d.ts +2 -0
  17. package/dist/components/elements/CaptionV2/index.js +22 -0
  18. package/dist/components/elements/DatePickerV2/DatePickerV2.stories.d.ts +8 -0
  19. package/dist/components/elements/DatePickerV2/DatePickerV2.stories.js +53 -0
  20. package/dist/components/elements/DatePickerV2/index.d.ts +23 -0
  21. package/dist/components/elements/DatePickerV2/index.js +57 -0
  22. package/dist/components/elements/DropdownV2/DropdownV2.stories.d.ts +8 -0
  23. package/dist/components/elements/DropdownV2/DropdownV2.stories.js +26 -0
  24. package/dist/components/elements/DropdownV2/index.d.ts +26 -0
  25. package/dist/components/elements/DropdownV2/index.js +81 -0
  26. package/dist/components/elements/InlineV2/InlineV2.stories.d.ts +6 -0
  27. package/dist/components/elements/InlineV2/InlineV2.stories.js +14 -0
  28. package/dist/components/elements/InlineV2/index.d.ts +6 -0
  29. package/dist/components/elements/InlineV2/index.js +23 -0
  30. package/dist/components/elements/ListV2/ListV2.stories.d.ts +10 -0
  31. package/dist/components/elements/ListV2/ListV2.stories.js +39 -0
  32. package/dist/components/elements/ListV2/index.d.ts +27 -0
  33. package/dist/components/elements/ListV2/index.js +102 -0
  34. package/dist/components/elements/MarkdownV2/MarkdownV2.module.css +39 -0
  35. package/dist/components/elements/MarkdownV2/MarkdownV2.stories.d.ts +10 -0
  36. package/dist/components/elements/MarkdownV2/MarkdownV2.stories.js +130 -0
  37. package/dist/components/elements/MarkdownV2/index.d.ts +11 -0
  38. package/dist/components/elements/MarkdownV2/index.js +123 -0
  39. package/dist/components/elements/MonthPickerV2/MonthPickerV2.stories.d.ts +7 -0
  40. package/dist/components/elements/MonthPickerV2/MonthPickerV2.stories.js +33 -0
  41. package/dist/components/elements/MonthPickerV2/index.d.ts +14 -0
  42. package/dist/components/elements/MonthPickerV2/index.js +26 -0
  43. package/dist/components/elements/PillV2/PillV2.module.css +29 -0
  44. package/dist/components/elements/PillV2/PillV2.stories.d.ts +8 -0
  45. package/dist/components/elements/PillV2/PillV2.stories.js +42 -0
  46. package/dist/components/elements/PillV2/index.d.ts +21 -0
  47. package/dist/components/elements/PillV2/index.js +79 -0
  48. package/dist/components/elements/RadioGroupV2/RadioGroupV2.stories.d.ts +7 -0
  49. package/dist/components/elements/RadioGroupV2/RadioGroupV2.stories.js +28 -0
  50. package/dist/components/elements/RadioGroupV2/index.d.ts +16 -0
  51. package/dist/components/elements/RadioGroupV2/index.js +27 -0
  52. package/dist/components/elements/RadioV2/RadioV2.module.css +17 -0
  53. package/dist/components/elements/RadioV2/RadioV2.stories.d.ts +6 -0
  54. package/dist/components/elements/RadioV2/RadioV2.stories.js +19 -0
  55. package/dist/components/elements/RadioV2/index.d.ts +8 -0
  56. package/dist/components/elements/RadioV2/index.js +23 -0
  57. package/dist/components/elements/TabListV2/TabListV2.module.css +21 -0
  58. package/dist/components/elements/TabListV2/TabListV2.stories.d.ts +6 -0
  59. package/dist/components/elements/TabListV2/TabListV2.stories.js +14 -0
  60. package/dist/components/elements/TabListV2/example.d.ts +7 -0
  61. package/dist/components/elements/TabListV2/example.js +36 -0
  62. package/dist/components/elements/TabListV2/index.d.ts +10 -0
  63. package/dist/components/elements/TabListV2/index.js +31 -0
  64. package/dist/index.d.ts +11 -0
  65. package/dist/index.js +11 -0
  66. package/package.json +1 -1
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { MonthPickerV2 } from '.';
4
+ import { BoxV2 } from '../BoxV2';
5
+ import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
6
+ const meta = {
7
+ title: 'Elements/Fields/MonthPickerV2',
8
+ component: MonthPickerV2,
9
+ tags: ['autodocs'],
10
+ decorators: [UIVersion2],
11
+ };
12
+ export default meta;
13
+ const StatefulMonthPickerV2 = (props) => {
14
+ const [date, setDate] = useState(new Date());
15
+ return _jsx(MonthPickerV2, Object.assign({}, props, { value: date, onChange: setDate }));
16
+ };
17
+ export const Default = {
18
+ render: () => (_jsx(BoxV2, Object.assign({ sx: { height: '500px' } }, { children: _jsx(StatefulMonthPickerV2, {}) }))),
19
+ };
20
+ export const Inline = {
21
+ argTypes: {
22
+ backgroundColor: {
23
+ options: ['blue', 'gold', 'green', 'red'],
24
+ control: {
25
+ type: 'select',
26
+ },
27
+ },
28
+ },
29
+ render: (args) => {
30
+ const { backgroundColor } = args;
31
+ return (_jsx(BoxV2, Object.assign({ sx: { height: '500px' } }, { children: _jsx(StatefulMonthPickerV2, { backgroundColor: backgroundColor, inline: true }) })));
32
+ },
33
+ };
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import 'react-datepicker/dist/react-datepicker.css';
3
+ import { TextInputV2Props } from '../TextInputV2';
4
+ import { BoxV2Props } from '../BoxV2';
5
+ export declare const MonthPickerV2: React.FC<{
6
+ value: Date;
7
+ onChange: (date: Date) => void;
8
+ minDate?: Date;
9
+ maxDate?: Date;
10
+ inline?: boolean;
11
+ backgroundColor?: string;
12
+ inputProps?: Partial<TextInputV2Props>;
13
+ wrapperProps?: BoxV2Props;
14
+ }>;
@@ -0,0 +1,26 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import _ReactDatePicker from 'react-datepicker';
14
+ import 'react-datepicker/dist/react-datepicker.css';
15
+ import { TextInputV2 } from '../TextInputV2';
16
+ import { InputWrapperV2 } from '../DatePickerV2';
17
+ import { BoxV2 } from '../BoxV2';
18
+ import { importedDefaultComponentShim } from '../../../utils/misc';
19
+ const ReactDatePicker = importedDefaultComponentShim(_ReactDatePicker);
20
+ const PermissiveTextInputV2 = TextInputV2;
21
+ export const MonthPickerV2 = (_a) => {
22
+ var { value, inputProps, backgroundColor, wrapperProps } = _a, rest = __rest(_a, ["value", "inputProps", "backgroundColor", "wrapperProps"]);
23
+ if (!backgroundColor)
24
+ backgroundColor = 'blue';
25
+ return (_jsx(BoxV2, Object.assign({}, wrapperProps, { children: _jsx(ReactDatePicker, Object.assign({ calendarClassName: `ndlib-date-picker ndlib-date-picker-${backgroundColor}`, selected: value, customInput: _jsx(InputWrapperV2, { children: _jsx(PermissiveTextInputV2, Object.assign({}, inputProps)) }), showMonthYearPicker: true }, rest)) })));
26
+ };
@@ -0,0 +1,29 @@
1
+ .pillButton {
2
+ border-radius: 1000px;
3
+ border: solid 1px;
4
+ display: flex;
5
+ flex-direction: row;
6
+ align-items: center;
7
+ justify-content: center;
8
+ }
9
+
10
+ .pillButton.clickable:hover {
11
+ box-shadow: 0 0 8px #dfdfdf;
12
+ transform: scale(1.03);
13
+ }
14
+
15
+ .pillButton.clickable:focus {
16
+ box-shadow: 0 0 8px #dfdfdf;
17
+ transform: scale(1.03);
18
+ outline: 2px solid var(--ndBlueBright);
19
+ outline-offset: 2px;
20
+ }
21
+
22
+ .pillContent {
23
+ flex-grow: 1;
24
+ justify-content: flex-start;
25
+ text-overflow: ellipsis;
26
+ white-space: nowrap;
27
+ overflow: hidden;
28
+ text-align: start;
29
+ }
@@ -0,0 +1,8 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { PillV2 } from '.';
3
+ declare const meta: Meta<typeof PillV2>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof PillV2>;
6
+ export declare const Default: Story;
7
+ export declare const Icon: Story;
8
+ export declare const NoAction: Story;
@@ -0,0 +1,42 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import SearchIcon from '@mui/icons-material/Search';
3
+ import { PILLV2_SIZE, PILLV2_TYPE, PillV2 } from '.';
4
+ import { GROUPV2_TYPE, GroupV2 } from '../GroupV2';
5
+ import { HEADINGV2_SIZE, HeadingV2 } from '../HeadingV2';
6
+ import { ColumnV2 } from '../ColumnV2';
7
+ import { RowV2 } from '../RowV2';
8
+ import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
9
+ const meta = {
10
+ title: 'Elements/PillV2',
11
+ component: PillV2,
12
+ tags: ['autodocs'],
13
+ decorators: [UIVersion2],
14
+ };
15
+ export default meta;
16
+ const sizes = [
17
+ { size: PILLV2_SIZE.LG, label: 'Large' },
18
+ { size: PILLV2_SIZE.SM, label: 'Small' },
19
+ ];
20
+ export const Default = {
21
+ render: (args) => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2, Object.assign({ type: GROUPV2_TYPE.REGION }, { children: [_jsx(HeadingV2, Object.assign({ size: HEADINGV2_SIZE.MD }, { children: size.label })), _jsxs(RowV2, Object.assign({ sx: { mt: 2 } }, { children: [_jsx(PillV2, Object.assign({}, args, { size: size.size, sx: { mr: 1 } })), _jsx(PillV2, Object.assign({}, args, { size: size.size, type: PILLV2_TYPE.OUTLINE }))] }))] })))) })),
22
+ args: {
23
+ type: PILLV2_TYPE.DEFAULT,
24
+ children: 'Virtual Event',
25
+ onClick: () => console.log('clicked'),
26
+ },
27
+ };
28
+ export const Icon = {
29
+ render: (args) => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2, Object.assign({ type: GROUPV2_TYPE.REGION }, { children: [_jsx(HeadingV2, Object.assign({ size: HEADINGV2_SIZE.MD }, { children: size.label })), _jsxs(RowV2, Object.assign({ sx: { mt: 2 } }, { children: [_jsx(PillV2, Object.assign({}, args, { size: size.size, sx: { mr: 1 }, icon: SearchIcon })), _jsx(PillV2, Object.assign({}, args, { size: size.size, type: PILLV2_TYPE.OUTLINE, icon: SearchIcon }))] }))] })))) })),
30
+ args: {
31
+ type: PILLV2_TYPE.DEFAULT,
32
+ children: 'Virtual Event',
33
+ onClick: () => console.log('clicked'),
34
+ },
35
+ };
36
+ export const NoAction = {
37
+ render: (args) => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2, Object.assign({ type: GROUPV2_TYPE.REGION }, { children: [_jsx(HeadingV2, Object.assign({ size: HEADINGV2_SIZE.MD }, { children: size.label })), _jsxs(RowV2, Object.assign({ sx: { mt: 2 } }, { children: [_jsx(PillV2, Object.assign({}, args, { size: size.size, sx: { mr: 1 } })), _jsx(PillV2, Object.assign({}, args, { size: size.size, type: PILLV2_TYPE.OUTLINE }))] }))] })))) })),
38
+ args: {
39
+ type: PILLV2_TYPE.DEFAULT,
40
+ children: 'Virtual Event',
41
+ },
42
+ };
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { COLOR } from '../../../theme/colors';
3
+ export declare enum PILLV2_SIZE {
4
+ SM = "sm",
5
+ LG = "lg"
6
+ }
7
+ export declare enum PILLV2_TYPE {
8
+ DEFAULT = "default",
9
+ OUTLINE = "outline"
10
+ }
11
+ export declare const PillV2: React.ForwardRefExoticComponent<{
12
+ sx?: import("../../../theme").StylesPropV2 | undefined;
13
+ children?: React.ReactNode;
14
+ } & Omit<React.HTMLAttributes<HTMLButtonElement>, "children" | "onChange"> & {
15
+ size?: PILLV2_SIZE | undefined;
16
+ type?: PILLV2_TYPE | undefined;
17
+ color?: COLOR | undefined;
18
+ icon?: React.FC<any> | undefined;
19
+ } & {
20
+ htmlFor?: string | undefined;
21
+ } & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,79 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import React from 'react';
14
+ import { COLOR, colors } from '../../../theme/colors';
15
+ import { TYPOGRAPHY_TYPE, getTypographyStyles } from '../../../theme/typography';
16
+ import { IconV2 } from '../IconV2';
17
+ import { processSx } from '../../../utils/processSx';
18
+ import * as styles from './PillV2.module.css';
19
+ import clsx from 'clsx';
20
+ const typeSafeStyles = styles;
21
+ export var PILLV2_SIZE;
22
+ (function (PILLV2_SIZE) {
23
+ PILLV2_SIZE["SM"] = "sm";
24
+ PILLV2_SIZE["LG"] = "lg";
25
+ })(PILLV2_SIZE || (PILLV2_SIZE = {}));
26
+ const typographyMap = {
27
+ [PILLV2_SIZE.SM]: TYPOGRAPHY_TYPE.PARAGRAPH_XSMALL,
28
+ [PILLV2_SIZE.LG]: TYPOGRAPHY_TYPE.PARAGRAPH_SMALL,
29
+ };
30
+ const defaultPaddingX = {
31
+ [PILLV2_SIZE.SM]: '0.5rem',
32
+ [PILLV2_SIZE.LG]: '0.75rem',
33
+ };
34
+ const defaultHeight = {
35
+ [PILLV2_SIZE.SM]: '1.75rem',
36
+ [PILLV2_SIZE.LG]: '2rem',
37
+ };
38
+ const iconMargin = {
39
+ [PILLV2_SIZE.SM]: '0.25rem',
40
+ [PILLV2_SIZE.LG]: '0.25rem',
41
+ };
42
+ export var PILLV2_TYPE;
43
+ (function (PILLV2_TYPE) {
44
+ PILLV2_TYPE["DEFAULT"] = "default";
45
+ PILLV2_TYPE["OUTLINE"] = "outline";
46
+ })(PILLV2_TYPE || (PILLV2_TYPE = {}));
47
+ export const PillV2 = React.forwardRef((_a, ref) => {
48
+ var { size: sizeParam, type: typeParam, color, icon, children, sx, onClick } = _a, rest = __rest(_a, ["size", "type", "color", "icon", "children", "sx", "onClick"]);
49
+ const clickable = onClick !== undefined;
50
+ let bg = COLOR.PRIMARY;
51
+ let textColor = COLOR.TEXT;
52
+ let borderColor = COLOR.TRANSPARENT;
53
+ const cursor = clickable ? 'pointer' : 'default';
54
+ const type = typeParam || PILLV2_TYPE.DEFAULT;
55
+ const size = sizeParam || PILLV2_SIZE.SM;
56
+ const paddingX = defaultPaddingX[size];
57
+ const height = defaultHeight[size];
58
+ if (type === PILLV2_TYPE.DEFAULT) {
59
+ bg = color || COLOR.PRIMARY;
60
+ textColor =
61
+ bg === COLOR.PRIMARY
62
+ ? COLOR.TEXT_ON_PRIMARY
63
+ : bg === COLOR.SECONDARY
64
+ ? COLOR.TEXT_ON_SECONDARY
65
+ : COLOR.TEXT;
66
+ }
67
+ if (type === PILLV2_TYPE.OUTLINE) {
68
+ bg = COLOR.BACKGROUND;
69
+ textColor = color || COLOR.PRIMARY;
70
+ borderColor = textColor;
71
+ }
72
+ const typography = typographyMap[size];
73
+ const typographyStyles = getTypographyStyles(typography);
74
+ const body = children;
75
+ const processedSx = processSx(Object.assign(Object.assign({}, typographyStyles), sx));
76
+ return (_jsxs("button", Object.assign({ ref: ref, tabIndex: onClick ? 0 : -1, onClick: onClick, className: clsx(typeSafeStyles.pillButton, {
77
+ [typeSafeStyles.clickable]: clickable,
78
+ }), style: Object.assign(Object.assign({}, processedSx), { cursor, backgroundColor: colors[bg], color: colors[textColor], paddingLeft: paddingX, paddingRight: paddingX, height: height, borderColor: colors[borderColor] }) }, rest, { children: [icon && (_jsx(IconV2, { icon: icon, size: typographyStyles.fontSize, sx: { mr: iconMargin[size] }, color: textColor })), _jsx("div", Object.assign({ className: typeSafeStyles.pillContent }, { children: body }))] })));
79
+ });
@@ -0,0 +1,7 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { RadioGroupV2 } from '.';
3
+ declare const meta: Meta<typeof RadioGroupV2>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof RadioGroupV2>;
6
+ export declare const Default: Story;
7
+ export declare const Disabled: Story;
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { RadioGroupV2 } from '.';
3
+ import { useState } from 'react';
4
+ import { RowV2 } from '../RowV2';
5
+ import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
6
+ const meta = {
7
+ title: 'Elements/Fields/RadioGroupV2',
8
+ component: RadioGroupV2,
9
+ tags: ['autodocs'],
10
+ decorators: [UIVersion2],
11
+ };
12
+ export default meta;
13
+ const options = [
14
+ { value: 'orange', label: 'Orange' },
15
+ { value: 'apple', label: 'Apple' },
16
+ { value: 'strawberry', label: 'Strawberry' },
17
+ { value: 'pineapple', label: 'Pineapple' },
18
+ ];
19
+ const StatefulRadioGroup = (props) => {
20
+ const [checked, setChecked] = useState(new Set());
21
+ return (_jsx(RadioGroupV2, Object.assign({}, props, { checked: checked, options: props.options || options, onChange: setChecked })));
22
+ };
23
+ export const Default = {
24
+ render: () => (_jsx(RowV2, { children: _jsx(StatefulRadioGroup, {}) })),
25
+ };
26
+ export const Disabled = {
27
+ render: () => (_jsx(RowV2, { children: _jsx(StatefulRadioGroup, { options: options.map((option, i) => (Object.assign(Object.assign({}, option), { disabled: i === 1 ? true : false }))) }) })),
28
+ };
@@ -0,0 +1,16 @@
1
+ import { StyledElementPropsV2, StylesPropV2 } from '../../../theme';
2
+ import { Key } from '../option';
3
+ type Option<K extends Key = string> = {
4
+ value: K;
5
+ label: string;
6
+ disabled?: boolean;
7
+ };
8
+ export type RadioGroupV2Props<K extends Key = string> = StyledElementPropsV2<HTMLDivElement, {
9
+ onChange: (value: K) => void;
10
+ options: Option<K>[];
11
+ columnStyles?: StylesPropV2;
12
+ rowStyles?: StylesPropV2;
13
+ checked?: K;
14
+ }, string>;
15
+ export declare function RadioGroupV2<K extends Key = string>({ options, checked, onChange, columnStyles, rowStyles, ...rest }: RadioGroupV2Props<K>): import("react/jsx-runtime").JSX.Element;
16
+ export {};
@@ -0,0 +1,27 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { RowV2 } from '../RowV2';
14
+ import { LabelV2 } from '../LabelV2';
15
+ import { GroupV2, GROUPV2_TYPE } from '../GroupV2';
16
+ import { ColumnV2 } from '../ColumnV2';
17
+ import { TYPOGRAPHY_TYPE, getTypographyStyles } from '../../../theme/typography';
18
+ import { RadioV2 } from '../RadioV2';
19
+ export function RadioGroupV2(_a) {
20
+ var { options, checked, onChange, columnStyles, rowStyles } = _a, rest = __rest(_a, ["options", "checked", "onChange", "columnStyles", "rowStyles"]);
21
+ return (_jsx(ColumnV2, Object.assign({}, rest, { sx: columnStyles }, { children: options.map((option) => (_jsx(GroupV2, Object.assign({ type: GROUPV2_TYPE.RAW }, { children: ({ labelTargetId }) => (_jsxs(RowV2, Object.assign({ sx: Object.assign({ mb: 2, alignItems: 'center' }, rowStyles) }, { children: [_jsx(RadioV2, { onChange: () => {
22
+ onChange(option.value);
23
+ }, checked: checked === option.value, id: labelTargetId, sx: {
24
+ mr: 2,
25
+ flexShrink: 0,
26
+ }, disabled: option.disabled }), _jsx(LabelV2, Object.assign({ htmlFor: labelTargetId, sx: Object.assign({ cursor: option.disabled ? 'not-allowed' : 'pointer' }, getTypographyStyles(TYPOGRAPHY_TYPE.PARAGRAPH_MEDIUM)) }, { children: option.label }))] }))) }), option.value))) })));
27
+ }
@@ -0,0 +1,17 @@
1
+ .radio {
2
+ margin: 0px;
3
+ height: 1.25rem;
4
+ width: 1.25rem;
5
+ }
6
+
7
+ .radio:not(:disabled) {
8
+ cursor: pointer;
9
+ }
10
+
11
+ .radio:disabled {
12
+ cursor: not-allowed;
13
+ }
14
+
15
+ .radio:not(:disabled):hover {
16
+ box-shadow: 0 0 8px #dfdfdf;
17
+ }
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { RadioV2 } from './index';
3
+ declare const meta: Meta<typeof RadioV2>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof RadioV2>;
6
+ export declare const Default: Story;
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { RadioV2 } from './index';
3
+ import { useState } from 'react';
4
+ import { RowV2 } from '../RowV2';
5
+ import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
6
+ const meta = {
7
+ title: 'Elements/Fields/RadioV2',
8
+ component: RadioV2,
9
+ tags: ['autodocs'],
10
+ decorators: [UIVersion2],
11
+ };
12
+ export default meta;
13
+ const StatefulRadio = (props) => {
14
+ const [checked, setChecked] = useState(false);
15
+ return _jsx(RadioV2, Object.assign({}, props, { checked: checked, onChange: setChecked }));
16
+ };
17
+ export const Default = {
18
+ render: () => (_jsx(RowV2, { children: _jsx(StatefulRadio, {}) })),
19
+ };
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { StyledElementPropsV2 } from '../../../theme';
3
+ export type RadioV2Props = StyledElementPropsV2<HTMLInputElement, {
4
+ checked: boolean;
5
+ onChange: (value: boolean) => void;
6
+ disabled?: boolean;
7
+ }, string>;
8
+ export declare const RadioV2: React.FC<RadioV2Props>;
@@ -0,0 +1,23 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { processSx } from '../../../utils/processSx';
14
+ import * as styles from './RadioV2.module.css';
15
+ import clsx from 'clsx';
16
+ const typeSafeStyles = styles;
17
+ export const RadioV2 = (_a) => {
18
+ var { checked, onChange, disabled, sx, className } = _a, rest = __rest(_a, ["checked", "onChange", "disabled", "sx", "className"]);
19
+ const processedSx = processSx(sx);
20
+ return (_jsx("input", Object.assign({ type: "radio", onChange: (e) => {
21
+ onChange(e.target.checked);
22
+ }, checked: checked, disabled: disabled, className: clsx(typeSafeStyles.radio, className), style: processedSx }, rest)));
23
+ };
@@ -0,0 +1,21 @@
1
+ .tabBtn {
2
+ height: 3.25rem;
3
+ box-sizing: border-box;
4
+ padding-left: 1rem;
5
+ padding-right: 1rem;
6
+ background: var(--white);
7
+ border: none;
8
+ cursor: pointer;
9
+ }
10
+
11
+ .tabLabelSelected {
12
+ transform: scale(1.1);
13
+ }
14
+
15
+ .tabLabelSelected:hover {
16
+ transform: scale(1.1);
17
+ }
18
+
19
+ .tabLabelUnselected:hover {
20
+ transform: scale(1.05);
21
+ }
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { TabListV2 } from './index';
3
+ declare const meta: Meta<typeof TabListV2>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof TabListV2>;
6
+ export declare const Default: Story;
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { TabListV2 } from './index';
3
+ import { ExampleTabsV2 } from './example';
4
+ import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
5
+ const meta = {
6
+ title: 'Elements/TabListV2',
7
+ component: TabListV2,
8
+ tags: ['autodocs'],
9
+ decorators: [UIVersion2],
10
+ };
11
+ export default meta;
12
+ export const Default = {
13
+ render: () => _jsx(ExampleTabsV2, {}),
14
+ };
@@ -0,0 +1,7 @@
1
+ type Item = {
2
+ id: string;
3
+ label: string;
4
+ };
5
+ export declare const items: Item[];
6
+ export declare const ExampleTabsV2: () => import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,36 @@
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { TabListV2, TabV2 } from '.';
4
+ export const items = [
5
+ {
6
+ id: '1',
7
+ label: 'Items & Requests',
8
+ },
9
+ {
10
+ id: '2',
11
+ label: 'Courses',
12
+ },
13
+ {
14
+ id: '3',
15
+ label: 'Checkout',
16
+ },
17
+ {
18
+ id: '4',
19
+ label: 'History',
20
+ },
21
+ {
22
+ id: '5',
23
+ label: 'Preferences',
24
+ },
25
+ {
26
+ id: '6',
27
+ label: 'Reservations',
28
+ },
29
+ ];
30
+ const StateManager = ({ children }) => {
31
+ const [selected, setSelected] = React.useState('1');
32
+ return _jsx(_Fragment, { children: children({ selected, setSelected }) });
33
+ };
34
+ export const ExampleTabsV2 = () => (_jsx(StateManager, { children: ({ selected, setSelected }) => (_jsx(TabListV2, { children: items.map((item) => (_jsx(TabV2, Object.assign({ onClick: () => {
35
+ setSelected(item.id);
36
+ }, selected: selected === item.id }, { children: item.label }), item.id))) })) }));
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { StyledElementPropsV2 } from '../../../theme';
3
+ type TabListV2Props = StyledElementPropsV2<HTMLDivElement>;
4
+ export declare const TabListV2: React.FC<TabListV2Props>;
5
+ type TabV2Props = StyledElementPropsV2<HTMLButtonElement, {
6
+ selected?: boolean;
7
+ children: string;
8
+ }>;
9
+ export declare const TabV2: React.FC<TabV2Props>;
10
+ export {};
@@ -0,0 +1,31 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { useUniqueId } from '../../providers/uniqueIds';
14
+ import { TYPOGRAPHY_TYPE, getTypographyStyles } from '../../../theme/typography';
15
+ import { processSx } from '../../../utils/processSx';
16
+ import * as styles from './TabListV2.module.css';
17
+ const typeSafeStyles = styles;
18
+ export const TabListV2 = (_a) => {
19
+ var { children, sx } = _a, props = __rest(_a, ["children", "sx"]);
20
+ const processedSx = processSx(sx);
21
+ return (_jsx("div", Object.assign({ role: "tablist", style: Object.assign({ flexDirection: 'row' }, processedSx) }, props, { children: children })));
22
+ };
23
+ export const TabV2 = (_a) => {
24
+ var { selected, children, sx } = _a, rest = __rest(_a, ["selected", "children", "sx"]);
25
+ const typographyStyles = getTypographyStyles(TYPOGRAPHY_TYPE.CONDENSED_TEXT_LARGE);
26
+ const processedSx = processSx(Object.assign(Object.assign({}, sx), typographyStyles));
27
+ const labelId = useUniqueId('tab-label');
28
+ return (_jsx("button", Object.assign({ role: "tab", className: typeSafeStyles.tabBtn, style: Object.assign({ color: selected ? 'var(--darkGray)' : 'var(--gray)', borderBottom: selected ? 'solid 3px' : 'solid 1px', borderColor: selected ? 'var(--ndBlueBright)' : 'var(--lightGray)' }, processedSx), "aria-labelledby": labelId, "aria-selected": selected ? 'true' : 'false' }, rest, { children: _jsx("div", Object.assign({ id: labelId, className: selected
29
+ ? typeSafeStyles.tabLabelSelected
30
+ : typeSafeStyles.tabLabelUnselected }, { children: children })) })));
31
+ };
package/dist/index.d.ts CHANGED
@@ -5,8 +5,10 @@ export { COLOR, colors } from './theme/colors';
5
5
  export { TYPOGRAPHY_TYPE, FONT, FONT_SIZE, FONT_WEIGHT, LINE_HEIGHT, } from './theme/typography';
6
6
  export { GlobalStyles } from './theme/GlobalStyles';
7
7
  export { Alert, Alerts } from './components/elements/Alerts';
8
+ export { AlertV2, AlertsV2 } from './components/elements/AlertsV2';
8
9
  export { ArrowLink } from './components/elements/ArrowLink';
9
10
  export { BrandingBar } from './components/elements/BrandingBar';
11
+ export { BrandingBarV2 } from './components/elements/BrandingBarV2';
10
12
  export { Button, BUTTON_SIZE, BUTTON_TYPE, LinkButton, } from './components/elements/Button';
11
13
  export { ButtonV2, BUTTONV2_SIZE, BUTTONV2_TYPE, LinkButtonV2, } from './components/elements/ButtonV2';
12
14
  export { Heading, HEADING_SIZE } from './components/elements/Heading';
@@ -18,6 +20,7 @@ export { ParagraphV2, PARAGRAPHV2_SIZE, } from './components/elements/ParagraphV
18
20
  export { Group, useGroup, GROUP_TYPE } from './components/elements/Group';
19
21
  export { GroupV2, useGroupV2, GROUPV2_TYPE, } from './components/elements/GroupV2';
20
22
  export { Markdown } from './components/elements/Markdown';
23
+ export { MarkdownV2 } from './components/elements/MarkdownV2';
21
24
  export { Box } from './components/elements/layout/Box';
22
25
  export { BoxV2 } from './components/elements/BoxV2';
23
26
  export { Column } from './components/elements/layout/Column';
@@ -30,25 +33,33 @@ export { INPUTV2_SIZE, TextInputV2 } from './components/elements/TextInputV2';
30
33
  export { Select } from './components/elements/Select';
31
34
  export { SelectV2 } from './components/elements/SelectV2';
32
35
  export { DatePicker } from './components/elements/DatePicker';
36
+ export { DatePickerV2 } from './components/elements/DatePickerV2';
33
37
  export { MonthPicker } from './components/elements/MonthPicker';
38
+ export { MonthPickerV2 } from './components/elements/MonthPickerV2';
34
39
  export { Checkbox } from './components/elements/Checkbox';
35
40
  export { CheckboxV2 } from './components/elements/CheckboxV2';
36
41
  export { CheckboxGroup } from './components/elements/CheckboxGroup';
37
42
  export { CheckboxGroupV2 } from './components/elements/CheckboxGroupV2';
38
43
  export { ConsentBanner } from './components/elements/ConsentBanner';
39
44
  export { Radio } from './components/elements/Radio';
45
+ export { RadioV2 } from './components/elements/RadioV2';
40
46
  export { RadioGroup } from './components/elements/RadioGroup';
47
+ export { RadioGroupV2 } from './components/elements/RadioGroupV2';
41
48
  export { List, ListItem, LIST_SIZE } from './components/elements/List';
49
+ export { ListV2, ListItemV2, LISTV2_SIZE } from './components/elements/ListV2';
42
50
  export { ReadMore } from './components/elements/ReadMore';
43
51
  export { ReadMoreV2 } from './components/elements/ReadMoreV2';
44
52
  export { Icon } from './components/elements/Icon';
45
53
  export { IconV2 } from './components/elements/IconV2';
46
54
  export { Dropdown } from './components/elements/Dropdown';
55
+ export { DropdownV2 } from './components/elements/DropdownV2';
47
56
  export { Spinner, SPINNER_SIZE } from './components/elements/Spinner';
48
57
  export { SpinnerV2, SPINNERV2_SIZE } from './components/elements/SpinnerV2';
49
58
  export { Pill, PILL_SIZE, PILL_TYPE } from './components/elements/Pill';
59
+ export { PillV2, PILLV2_SIZE, PILLV2_TYPE } from './components/elements/PillV2';
50
60
  export { Table, TableColumn } from './components/elements/Table';
51
61
  export { TabList, Tab } from './components/elements/TabList';
62
+ export { TabListV2, TabV2 } from './components/elements/TabListV2';
52
63
  export { RawHtml } from './components/elements/RawHtml';
53
64
  export { ListBoxV2 } from './components/elements/ListBoxV2';
54
65
  export { Card, CARD_SIZE, CARD_LAYOUT } from './components/composites/Card';