@nulogy/components 8.4.1 → 8.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -42699,6 +42699,162 @@
42699
42699
  onHidden: function onHidden() {}
42700
42700
  };
42701
42701
 
42702
+ var SummaryContext = /*#__PURE__*/React.createContext(undefined);
42703
+ function useSummaryContext() {
42704
+ var context = React.useContext(SummaryContext);
42705
+
42706
+ if (!context) {
42707
+ throw new Error("Summary compound components cannot be rendered outside the Summary component");
42708
+ }
42709
+
42710
+ return context;
42711
+ }
42712
+ var SummaryContextProvider = function SummaryContextProvider(_ref) {
42713
+ var breakpoint = _ref.breakpoint,
42714
+ children = _ref.children;
42715
+ return /*#__PURE__*/React__default['default'].createElement(SummaryContext.Provider, {
42716
+ value: {
42717
+ breakpoint: breakpoint
42718
+ }
42719
+ }, children);
42720
+ };
42721
+
42722
+ var SummaryWrapper = styled__default['default'](Box).withConfig({
42723
+ displayName: "Summary__SummaryWrapper",
42724
+ componentId: "sc-1hzufqo-0"
42725
+ })(function (_ref) {
42726
+ var _ref2;
42727
+
42728
+ var theme = _ref.theme,
42729
+ breakpoint = _ref.breakpoint;
42730
+ return _ref2 = {
42731
+ display: "flex",
42732
+ background: theme.colors.white,
42733
+ gap: theme.space.x2,
42734
+ paddingTop: theme.space.x1,
42735
+ paddingBottom: theme.space.x1,
42736
+ paddingLeft: theme.space.x2,
42737
+ paddingRight: theme.space.x2,
42738
+ borderRadius: theme.radii.medium,
42739
+ width: "fit-content"
42740
+ }, _ref2["@media (max-width: " + breakpoint + "px)"] = {
42741
+ background: "none",
42742
+ flexFlow: "wrap",
42743
+ padding: 0,
42744
+ paddingTop: theme.space.x2,
42745
+ rowGap: 0
42746
+ }, _ref2;
42747
+ });
42748
+ var DEFAULT_BREAKPOINT = Theme.breakpoints.medium;
42749
+
42750
+ var Summary = function Summary(_a) {
42751
+ var _a$breakpoint = _a.breakpoint,
42752
+ breakpoint = _a$breakpoint === void 0 ? DEFAULT_BREAKPOINT : _a$breakpoint,
42753
+ children = _a.children,
42754
+ rest = __rest(_a, ["breakpoint", "children"]);
42755
+
42756
+ var breakpointPx = pixelDigitsFrom$1(breakpoint);
42757
+ return /*#__PURE__*/React__default['default'].createElement(SummaryContextProvider, {
42758
+ breakpoint: breakpointPx
42759
+ }, /*#__PURE__*/React__default['default'].createElement(SummaryWrapper, Object.assign({
42760
+ breakpoint: breakpointPx
42761
+ }, rest), children));
42762
+ };
42763
+
42764
+ function useMediaQuery(query) {
42765
+ var isUnsupported = typeof window === "undefined" || typeof window.matchMedia === "undefined";
42766
+
42767
+ var getMatches = function getMatches(query) {
42768
+ if (isUnsupported) {
42769
+ return false;
42770
+ }
42771
+
42772
+ return window.matchMedia(query).matches;
42773
+ };
42774
+
42775
+ var _useState = React.useState(getMatches(query)),
42776
+ matches = _useState[0],
42777
+ setMatches = _useState[1];
42778
+
42779
+ function handleChange() {
42780
+ setMatches(getMatches(query));
42781
+ }
42782
+
42783
+ React.useEffect(function () {
42784
+ if (isUnsupported) return;
42785
+ var matchMedia = window.matchMedia(query);
42786
+ handleChange();
42787
+ matchMedia.addEventListener("change", handleChange);
42788
+ return function () {
42789
+ matchMedia.removeEventListener("change", handleChange);
42790
+ };
42791
+ }, [query]);
42792
+ return matches;
42793
+ }
42794
+
42795
+ var SummaryItemWrapper = styled__default['default'](Flex).withConfig({
42796
+ displayName: "SummaryItem__SummaryItemWrapper",
42797
+ componentId: "kqzify-0"
42798
+ })(function (_ref) {
42799
+ var _ref2;
42800
+
42801
+ var theme = _ref.theme,
42802
+ breakpoint = _ref.breakpoint;
42803
+ return _ref2 = {
42804
+ gap: theme.space.half,
42805
+ flexDirection: "column"
42806
+ }, _ref2["@media (max-width: " + breakpoint + "px)"] = {
42807
+ flexDirection: "row"
42808
+ }, _ref2;
42809
+ });
42810
+
42811
+ var SummaryItem = function SummaryItem(_a) {
42812
+ var value = _a.value,
42813
+ status = _a.status,
42814
+ rest = __rest(_a, ["value", "status"]);
42815
+
42816
+ var _useSummaryContext = useSummaryContext(),
42817
+ breakpoint = _useSummaryContext.breakpoint;
42818
+
42819
+ var matches = useMediaQuery("(max-width: " + breakpoint + "px)");
42820
+ delete rest["children"];
42821
+ return /*#__PURE__*/React__default['default'].createElement(SummaryItemWrapper, Object.assign({
42822
+ breakpoint: breakpoint
42823
+ }, rest), /*#__PURE__*/React__default['default'].createElement(Text, {
42824
+ fontWeight: "medium",
42825
+ fontSize: !matches ? "heading4" : undefined
42826
+ }, value), status);
42827
+ };
42828
+
42829
+ var Divider$1 = styled__default['default'](Box).withConfig({
42830
+ displayName: "SummaryDivider__Divider",
42831
+ componentId: "sc-1amkaa8-0"
42832
+ })(function (_ref) {
42833
+ var _ref2;
42834
+
42835
+ var theme = _ref.theme,
42836
+ breakpoint = _ref.breakpoint;
42837
+ return _ref2 = {
42838
+ display: "block",
42839
+ alignSelf: "stretch",
42840
+ width: 1,
42841
+ marginRight: theme.space.x1,
42842
+ marginLeft: theme.space.x1,
42843
+ background: theme.colors.grey
42844
+ }, _ref2["@media (max-width: " + breakpoint + "px)"] = {
42845
+ display: "none"
42846
+ }, _ref2;
42847
+ });
42848
+
42849
+ var SummaryDivider = function SummaryDivider(props) {
42850
+ var _useSummaryContext = useSummaryContext(),
42851
+ breakpoint = _useSummaryContext.breakpoint;
42852
+
42853
+ return /*#__PURE__*/React__default['default'].createElement(Divider$1, Object.assign({
42854
+ breakpoint: pixelDigitsFrom$1(breakpoint)
42855
+ }, props));
42856
+ };
42857
+
42702
42858
  var StatelessNavBarDropdownMenuClass = /*#__PURE__*/function (_React$Component) {
42703
42859
  _inheritsLoose__default['default'](StatelessNavBarDropdownMenuClass, _React$Component);
42704
42860
 
@@ -50749,24 +50905,6 @@
50749
50905
  }, children));
50750
50906
  };
50751
50907
 
50752
- var useMediaQuery = function useMediaQuery(query) {
50753
- var _useState = React.useState(window.matchMedia(query).matches),
50754
- matches = _useState[0],
50755
- setMatches = _useState[1];
50756
-
50757
- React.useEffect(function () {
50758
- var handler = function handler(e) {
50759
- setMatches(e.matches);
50760
- };
50761
-
50762
- window.matchMedia(query).addEventListener("change", handler);
50763
- return function () {
50764
- window.removeEventListener("change", handler);
50765
- };
50766
- }, []);
50767
- return matches;
50768
- };
50769
-
50770
50908
  var Header = function Header(_a) {
50771
50909
  var _b, _c;
50772
50910
 
@@ -51248,6 +51386,9 @@
51248
51386
  exports.SmallNavBar = SmallNavBar;
51249
51387
  exports.SortingTable = SortingTable;
51250
51388
  exports.StatusIndicator = StatusIndicator;
51389
+ exports.Summary = Summary;
51390
+ exports.SummaryDivider = SummaryDivider;
51391
+ exports.SummaryItem = SummaryItem;
51251
51392
  exports.Switch = Switch;
51252
51393
  exports.Switcher = Switcher;
51253
51394
  exports.Tab = Tab;
@@ -42673,6 +42673,162 @@ Toast.defaultProps = {
42673
42673
  onHidden: function onHidden() {}
42674
42674
  };
42675
42675
 
42676
+ var SummaryContext = /*#__PURE__*/createContext(undefined);
42677
+ function useSummaryContext() {
42678
+ var context = useContext(SummaryContext);
42679
+
42680
+ if (!context) {
42681
+ throw new Error("Summary compound components cannot be rendered outside the Summary component");
42682
+ }
42683
+
42684
+ return context;
42685
+ }
42686
+ var SummaryContextProvider = function SummaryContextProvider(_ref) {
42687
+ var breakpoint = _ref.breakpoint,
42688
+ children = _ref.children;
42689
+ return /*#__PURE__*/React__default.createElement(SummaryContext.Provider, {
42690
+ value: {
42691
+ breakpoint: breakpoint
42692
+ }
42693
+ }, children);
42694
+ };
42695
+
42696
+ var SummaryWrapper = styled(Box).withConfig({
42697
+ displayName: "Summary__SummaryWrapper",
42698
+ componentId: "sc-1hzufqo-0"
42699
+ })(function (_ref) {
42700
+ var _ref2;
42701
+
42702
+ var theme = _ref.theme,
42703
+ breakpoint = _ref.breakpoint;
42704
+ return _ref2 = {
42705
+ display: "flex",
42706
+ background: theme.colors.white,
42707
+ gap: theme.space.x2,
42708
+ paddingTop: theme.space.x1,
42709
+ paddingBottom: theme.space.x1,
42710
+ paddingLeft: theme.space.x2,
42711
+ paddingRight: theme.space.x2,
42712
+ borderRadius: theme.radii.medium,
42713
+ width: "fit-content"
42714
+ }, _ref2["@media (max-width: " + breakpoint + "px)"] = {
42715
+ background: "none",
42716
+ flexFlow: "wrap",
42717
+ padding: 0,
42718
+ paddingTop: theme.space.x2,
42719
+ rowGap: 0
42720
+ }, _ref2;
42721
+ });
42722
+ var DEFAULT_BREAKPOINT = Theme.breakpoints.medium;
42723
+
42724
+ var Summary = function Summary(_a) {
42725
+ var _a$breakpoint = _a.breakpoint,
42726
+ breakpoint = _a$breakpoint === void 0 ? DEFAULT_BREAKPOINT : _a$breakpoint,
42727
+ children = _a.children,
42728
+ rest = __rest(_a, ["breakpoint", "children"]);
42729
+
42730
+ var breakpointPx = pixelDigitsFrom$1(breakpoint);
42731
+ return /*#__PURE__*/React__default.createElement(SummaryContextProvider, {
42732
+ breakpoint: breakpointPx
42733
+ }, /*#__PURE__*/React__default.createElement(SummaryWrapper, Object.assign({
42734
+ breakpoint: breakpointPx
42735
+ }, rest), children));
42736
+ };
42737
+
42738
+ function useMediaQuery(query) {
42739
+ var isUnsupported = typeof window === "undefined" || typeof window.matchMedia === "undefined";
42740
+
42741
+ var getMatches = function getMatches(query) {
42742
+ if (isUnsupported) {
42743
+ return false;
42744
+ }
42745
+
42746
+ return window.matchMedia(query).matches;
42747
+ };
42748
+
42749
+ var _useState = useState(getMatches(query)),
42750
+ matches = _useState[0],
42751
+ setMatches = _useState[1];
42752
+
42753
+ function handleChange() {
42754
+ setMatches(getMatches(query));
42755
+ }
42756
+
42757
+ useEffect(function () {
42758
+ if (isUnsupported) return;
42759
+ var matchMedia = window.matchMedia(query);
42760
+ handleChange();
42761
+ matchMedia.addEventListener("change", handleChange);
42762
+ return function () {
42763
+ matchMedia.removeEventListener("change", handleChange);
42764
+ };
42765
+ }, [query]);
42766
+ return matches;
42767
+ }
42768
+
42769
+ var SummaryItemWrapper = styled(Flex).withConfig({
42770
+ displayName: "SummaryItem__SummaryItemWrapper",
42771
+ componentId: "kqzify-0"
42772
+ })(function (_ref) {
42773
+ var _ref2;
42774
+
42775
+ var theme = _ref.theme,
42776
+ breakpoint = _ref.breakpoint;
42777
+ return _ref2 = {
42778
+ gap: theme.space.half,
42779
+ flexDirection: "column"
42780
+ }, _ref2["@media (max-width: " + breakpoint + "px)"] = {
42781
+ flexDirection: "row"
42782
+ }, _ref2;
42783
+ });
42784
+
42785
+ var SummaryItem = function SummaryItem(_a) {
42786
+ var value = _a.value,
42787
+ status = _a.status,
42788
+ rest = __rest(_a, ["value", "status"]);
42789
+
42790
+ var _useSummaryContext = useSummaryContext(),
42791
+ breakpoint = _useSummaryContext.breakpoint;
42792
+
42793
+ var matches = useMediaQuery("(max-width: " + breakpoint + "px)");
42794
+ delete rest["children"];
42795
+ return /*#__PURE__*/React__default.createElement(SummaryItemWrapper, Object.assign({
42796
+ breakpoint: breakpoint
42797
+ }, rest), /*#__PURE__*/React__default.createElement(Text, {
42798
+ fontWeight: "medium",
42799
+ fontSize: !matches ? "heading4" : undefined
42800
+ }, value), status);
42801
+ };
42802
+
42803
+ var Divider$1 = styled(Box).withConfig({
42804
+ displayName: "SummaryDivider__Divider",
42805
+ componentId: "sc-1amkaa8-0"
42806
+ })(function (_ref) {
42807
+ var _ref2;
42808
+
42809
+ var theme = _ref.theme,
42810
+ breakpoint = _ref.breakpoint;
42811
+ return _ref2 = {
42812
+ display: "block",
42813
+ alignSelf: "stretch",
42814
+ width: 1,
42815
+ marginRight: theme.space.x1,
42816
+ marginLeft: theme.space.x1,
42817
+ background: theme.colors.grey
42818
+ }, _ref2["@media (max-width: " + breakpoint + "px)"] = {
42819
+ display: "none"
42820
+ }, _ref2;
42821
+ });
42822
+
42823
+ var SummaryDivider = function SummaryDivider(props) {
42824
+ var _useSummaryContext = useSummaryContext(),
42825
+ breakpoint = _useSummaryContext.breakpoint;
42826
+
42827
+ return /*#__PURE__*/React__default.createElement(Divider$1, Object.assign({
42828
+ breakpoint: pixelDigitsFrom$1(breakpoint)
42829
+ }, props));
42830
+ };
42831
+
42676
42832
  var StatelessNavBarDropdownMenuClass = /*#__PURE__*/function (_React$Component) {
42677
42833
  _inheritsLoose$2(StatelessNavBarDropdownMenuClass, _React$Component);
42678
42834
 
@@ -50723,24 +50879,6 @@ var ApplicationFrame = function ApplicationFrame(_a) {
50723
50879
  }, children));
50724
50880
  };
50725
50881
 
50726
- var useMediaQuery = function useMediaQuery(query) {
50727
- var _useState = useState(window.matchMedia(query).matches),
50728
- matches = _useState[0],
50729
- setMatches = _useState[1];
50730
-
50731
- useEffect(function () {
50732
- var handler = function handler(e) {
50733
- setMatches(e.matches);
50734
- };
50735
-
50736
- window.matchMedia(query).addEventListener("change", handler);
50737
- return function () {
50738
- window.removeEventListener("change", handler);
50739
- };
50740
- }, []);
50741
- return matches;
50742
- };
50743
-
50744
50882
  var Header = function Header(_a) {
50745
50883
  var _b, _c;
50746
50884
 
@@ -51146,4 +51284,4 @@ var SortingTable = function SortingTable(_a) {
51146
51284
  }, props));
51147
51285
  };
51148
51286
 
51149
- export { ALL_NDS_LOCALES, Alert, AnimatedBox, ApplicationFrame, AsyncSelect, Box, BrandLogoContainer, NavBar as BrandedNavBar, Branding, Breadcrumbs, Button, ButtonGroup, Card, CardSet, Checkbox, CheckboxGroup, ControlIcon, DangerButton, DatePicker, DateRange, DesktopMenu, Divider, DropdownButton, DropdownItem, DropdownLink, DropdownMenu, DropdownText, EnvironmentBanner, Field, FieldLabel, Fieldset, Flex, Form, FormSection, Header, Heading1, Heading2, Heading3, Heading4, HelpText, Icon, IconicButton, InlineIcon, InlineValidation, Input$1 as Input, Link, List, ListItem, LoadingAnimation, MenuTrigger, Modal, NDSProvider, NavBar$1 as NavBar, NavBarBackground, Overlay, Page, Pagination, PrimaryButton, QuietButton, Radio, RadioGroup, RangeContainer, RequirementText, ReactSelect as Select, SelectClearIndicator, SelectContainer$1 as SelectContainer, SelectControl, SelectDropdownIndicator, SelectInput, SelectMenu, SelectMultiValue, SelectOption, Sidebar, SmallNavBar, SortingTable, StatusIndicator, Switch, Switcher, Tab, Table, Tabs, Text, Textarea, TimePicker, TimeRange, Toast, ToggleComponent as Toggle, Tooltip, TruncatedText, addStyledProps, Theme as theme, useWindowDimensions };
51287
+ export { ALL_NDS_LOCALES, Alert, AnimatedBox, ApplicationFrame, AsyncSelect, Box, BrandLogoContainer, NavBar as BrandedNavBar, Branding, Breadcrumbs, Button, ButtonGroup, Card, CardSet, Checkbox, CheckboxGroup, ControlIcon, DangerButton, DatePicker, DateRange, DesktopMenu, Divider, DropdownButton, DropdownItem, DropdownLink, DropdownMenu, DropdownText, EnvironmentBanner, Field, FieldLabel, Fieldset, Flex, Form, FormSection, Header, Heading1, Heading2, Heading3, Heading4, HelpText, Icon, IconicButton, InlineIcon, InlineValidation, Input$1 as Input, Link, List, ListItem, LoadingAnimation, MenuTrigger, Modal, NDSProvider, NavBar$1 as NavBar, NavBarBackground, Overlay, Page, Pagination, PrimaryButton, QuietButton, Radio, RadioGroup, RangeContainer, RequirementText, ReactSelect as Select, SelectClearIndicator, SelectContainer$1 as SelectContainer, SelectControl, SelectDropdownIndicator, SelectInput, SelectMenu, SelectMultiValue, SelectOption, Sidebar, SmallNavBar, SortingTable, StatusIndicator, Summary, SummaryDivider, SummaryItem, Switch, Switcher, Tab, Table, Tabs, Text, Textarea, TimePicker, TimeRange, Toast, ToggleComponent as Toggle, Tooltip, TruncatedText, addStyledProps, Theme as theme, useWindowDimensions };
@@ -11,6 +11,9 @@ declare const _default: {
11
11
  title: string;
12
12
  parameters: {
13
13
  layout: string;
14
+ chromatic: {
15
+ viewports: number[];
16
+ };
14
17
  };
15
18
  };
16
19
  export default _default;
@@ -3,14 +3,5 @@ export declare function Default(): JSX.Element;
3
3
  export declare function WithMainInfoOnly(): JSX.Element;
4
4
  declare const _default: {
5
5
  title: string;
6
- parameters: {
7
- backgrounds: {
8
- default: string;
9
- values: {
10
- name: string;
11
- value: string;
12
- }[];
13
- };
14
- };
15
6
  };
16
7
  export default _default;
@@ -1 +1,3 @@
1
1
  export { default as Summary } from "./Summary";
2
+ export { default as SummaryItem } from "./SummaryItem";
3
+ export { default as SummaryDivider } from "./SummaryDivider";
@@ -0,0 +1,2 @@
1
+ import useMediaQuery from "./useMediaQuery";
2
+ export default useMediaQuery;
@@ -0,0 +1,2 @@
1
+ declare function useMediaQuery(query: string): boolean;
2
+ export default useMediaQuery;
@@ -43,6 +43,7 @@ export { Breadcrumbs } from "./Breadcrumbs";
43
43
  export { ALL_NDS_LOCALES } from "./locales.const";
44
44
  export { TruncatedText } from "./TruncatedText";
45
45
  export { Toast } from "./Toast";
46
+ export { Summary, SummaryItem, SummaryDivider } from "./Summary/index";
46
47
  export { BrandedNavBar, MenuTrigger, EnvironmentBanner, NavBarBackground, BrandLogoContainer, DesktopMenu, SmallNavBar, } from "./BrandedNavBar";
47
48
  export type { MenuTriggerProps, EnvironmentBannerProps, NavBarBackgroundProps, BrandLogoContainerProps, DesktopMenuProps, SmallNavBarProps, RenderMenuButtonProps, } from "./BrandedNavBar";
48
49
  export { AsyncSelect } from "./AsyncSelect";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nulogy/components",
3
- "version": "8.4.1",
3
+ "version": "8.4.2",
4
4
  "description": "Component library for the Nulogy Design System - http://nulogy.design",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -1,2 +0,0 @@
1
- declare const useMediaQuery: (query: string) => boolean;
2
- export default useMediaQuery;