@unicef/material-ui 2.0.1 → 2.0.3

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/lib/prod.js CHANGED
@@ -7523,7 +7523,72 @@ function ThemeProvider({
7523
7523
  });
7524
7524
  }
7525
7525
 
7526
- var unicef = {
7526
+ // default
7527
+ const enUS$1 = {
7528
+ /*
7529
+ components: {
7530
+ MuiBreadcrumbs: { defaultProps: {
7531
+ expandText: 'Show path',
7532
+ }},
7533
+ MuiTablePagination: { defaultProps: {
7534
+ getItemAriaLabel: (type) => {
7535
+ if (type === 'first') {
7536
+ return 'Go to first page';
7537
+ }
7538
+ if (type === 'last') {
7539
+ return 'Go to last page';
7540
+ }
7541
+ if (type === 'next') {
7542
+ return 'Go to next page';
7543
+ }
7544
+ // if (type === 'previous') {
7545
+ return 'Go to previous page';
7546
+ },
7547
+ labelRowsPerPage: 'Rows per page:',
7548
+ labelDisplayedRows: ({ from, to, count }) =>
7549
+ `${from}–${to} of ${count !== -1 ? count : `more than ${to}`}`,
7550
+ }},
7551
+ MuiRating: { defaultProps: {
7552
+ getLabelText: value => `${value} Star${value !== 1 ? 's' : ''}`,
7553
+ emptyLabelText: 'Empty',
7554
+ }},
7555
+ MuiAutocomplete: { defaultProps: {
7556
+ clearText: 'Clear',
7557
+ closeText: 'Close',
7558
+ loadingText: 'Loading…',
7559
+ noOptionsText: 'No options',
7560
+ openText: 'Open',
7561
+ }},
7562
+ MuiAlert: { defaultProps: {
7563
+ closeText: 'Close',
7564
+ }},
7565
+ MuiPagination: { defaultProps: {
7566
+ 'aria-label': 'Pagination navigation',
7567
+ getItemAriaLabel: (type, page, selected) => {
7568
+ if (type === 'page') {
7569
+ return `${selected ? '' : 'Go to '}page ${page}`;
7570
+ }
7571
+ if (type === 'first') {
7572
+ return 'Go to first page';
7573
+ }
7574
+ if (type === 'last') {
7575
+ return 'Go to last page';
7576
+ }
7577
+ if (type === 'next') {
7578
+ return 'Go to next page';
7579
+ }
7580
+ // if (type === 'previous') {
7581
+ return 'Go to previous page';
7582
+ },
7583
+ }},
7584
+ },
7585
+ */
7586
+ };
7587
+
7588
+ /**
7589
+ * UNICEF color palette.
7590
+ */
7591
+ var unicefColors = {
7527
7592
  blue: '#1CABE2',
7528
7593
  darkBlue: '#374EA2',
7529
7594
  purple: '#6A3674',
@@ -7534,70 +7599,99 @@ var unicef = {
7534
7599
  green: '#80BD41',
7535
7600
  darkGreen: '#00833D'
7536
7601
  };
7537
- var theme = createTheme({
7538
- typography: {
7539
- useNextVariants: true,
7540
- fontFamily: ['Roboto', 'Helvetica', 'Arial', 'sans-serif'].join(',')
7541
- },
7542
- spacing: 8,
7543
- palette: {
7544
- primary: {
7545
- main: unicef.darkBlue
7602
+
7603
+ /**
7604
+ * Creates a customized MUI theme with UNICEF color palette.
7605
+ *
7606
+ * Applies UNICEF color palette, typography, and component overrides
7607
+ * on top of MUI's default theme. Supports locale-specific configurations
7608
+ * for internationalized applications.
7609
+ *
7610
+ * @param {object} [locale=enUS] - MUI locale object for localized component text.
7611
+ * @returns A fully configured MUI theme instance.
7612
+ *
7613
+ * @example
7614
+ * import { createUnicefMuiTheme } from '@unicef/material-ui'
7615
+ * import { frFR } from '@mui/material/locale'
7616
+ *
7617
+ * const theme = createUnicefMuiTheme(frFR)
7618
+ */
7619
+ var createUnicefMuiTheme = function createUnicefMuiTheme() {
7620
+ var locale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : enUS$1;
7621
+ var theme = createTheme({
7622
+ typography: {
7623
+ useNextVariants: true,
7624
+ fontFamily: ['Roboto', 'Helvetica', 'Arial', 'sans-serif'].join(',')
7546
7625
  },
7547
- secondary: {
7548
- main: unicef.blue
7626
+ spacing: 8,
7627
+ palette: {
7628
+ primary: {
7629
+ main: unicefColors.darkBlue
7630
+ },
7631
+ secondary: {
7632
+ main: unicefColors.blue
7633
+ },
7634
+ error: {
7635
+ main: unicefColors.red
7636
+ },
7637
+ unicef: unicefColors,
7638
+ unicefBlue: unicefColors.blue
7549
7639
  },
7550
- error: {
7551
- main: unicef.red
7640
+ unicefBlue: unicefColors.blue,
7641
+ mixins: {
7642
+ toolbar: {}
7552
7643
  },
7553
- unicef: unicef,
7554
- unicefBlue: unicef.blue
7555
- },
7556
- unicefBlue: unicef.blue,
7557
- mixins: {
7558
- toolbar: {}
7559
- },
7560
- shape: {
7561
- borderRadius: 4
7562
- },
7563
- components: {
7564
- // Name of the component
7565
- MuiButtonBase: {
7566
- defaultProps: {
7567
- // The props to change the default for.
7568
- disableRipple: true // No more ripple, on the whole application 💣!
7569
- }
7644
+ shape: {
7645
+ borderRadius: 4
7570
7646
  },
7571
- MuiDrawer: {
7572
- styleOverrides: {
7573
- paper: {
7574
- minWidth: 256
7647
+ // Component-level style overrides and default prop customizations
7648
+ components: {
7649
+ MuiButtonBase: {
7650
+ defaultProps: {
7651
+ // The props to change the default for.
7652
+ disableRipple: true // No more ripple, on the whole application 💣!
7575
7653
  }
7576
- }
7577
- },
7578
- MuiInputBase: {
7579
- styleOverrides: {
7580
- root: {
7581
- backgroundColor: 'white'
7654
+ },
7655
+ MuiDrawer: {
7656
+ styleOverrides: {
7657
+ paper: {
7658
+ minWidth: 256
7659
+ }
7582
7660
  }
7583
- }
7584
- },
7585
- MuiTab: {
7586
- styleOverrides: {
7587
- root: {
7588
- minWidth: 160
7661
+ },
7662
+ MuiInputBase: {
7663
+ styleOverrides: {
7664
+ root: {
7665
+ backgroundColor: 'white'
7666
+ }
7589
7667
  }
7590
- }
7591
- },
7592
- MuiAppBar: {
7593
- styleOverrides: {
7594
- root: {
7595
- zIndex: 1200
7668
+ },
7669
+ MuiTab: {
7670
+ styleOverrides: {
7671
+ root: {
7672
+ minWidth: 160
7673
+ }
7674
+ }
7675
+ },
7676
+ MuiAppBar: {
7677
+ styleOverrides: {
7678
+ root: {
7679
+ zIndex: 1200
7680
+ }
7596
7681
  }
7597
7682
  }
7598
7683
  }
7599
- }
7600
- });
7684
+ }, locale);
7685
+ return theme;
7686
+ };
7687
+
7688
+ /**
7689
+ * Default UNICEF MUI theme instance (English locale).
7690
+ *
7691
+ * Wrap your application with `<ThemeProvider theme={theme}>` to apply
7692
+ * UNICEF brand styles throughout the component tree.
7693
+ */
7694
+ var theme = createUnicefMuiTheme();
7601
7695
 
7602
7696
  ClassNameGenerator$1.configure(function (componentName) {
7603
7697
  return "Uni-".concat(componentName);
@@ -33055,14 +33149,13 @@ var classes$k = {
33055
33149
  };
33056
33150
  var StyledChip = styled$1(Chip$1)(function (_ref) {
33057
33151
  var theme = _ref.theme;
33058
- return _defineProperty$1(_defineProperty$1(_defineProperty$1(_defineProperty$1(_defineProperty$1(_defineProperty$1({}, "&.".concat(classes$k.chip), {
33152
+ return _defineProperty$1(_defineProperty$1(_defineProperty$1(_defineProperty$1(_defineProperty$1(_defineProperty$1({}, "&.".concat(classes$k.chip), _defineProperty$1({
33059
33153
  marginRight: theme.spacing(0.5),
33060
33154
  marginTop: theme.spacing(0.25),
33061
- maxWidth: '90%',
33062
- '& .Uni-MuiChip-deleteIcon': {
33063
- display: 'flex'
33064
- }
33065
- }), "&.".concat(classes$k.chipFocused), {
33155
+ maxWidth: '90%'
33156
+ }, "& .".concat(chipClasses$1.deleteIcon), {
33157
+ display: 'flex'
33158
+ })), "&.".concat(classes$k.chipFocused), {
33066
33159
  backgroundColor: emphasize(theme.palette.mode === 'light' ? theme.palette.grey[300] : theme.palette.grey[700], 0.08)
33067
33160
  }), "& .".concat(classes$k.avatar), {
33068
33161
  width: 24,
@@ -61399,7 +61492,9 @@ function UInfiniteScroll(_ref) {
61399
61492
  onEndOfScroll = _ref.onEndOfScroll;
61400
61493
  var divElement = useRef();
61401
61494
  useEffect(function () {
61402
- window.onscroll = function () {
61495
+ // Guard against SSR environments where window is not available
61496
+ if (typeof window === 'undefined') return;
61497
+ var handleScroll = function handleScroll() {
61403
61498
  //window.innerHeight: is the height of the window
61404
61499
  //window.pageYOffset is the current scroll offset position
61405
61500
  // counting from the the top of the screen
@@ -61409,7 +61504,11 @@ function UInfiniteScroll(_ref) {
61409
61504
  onEndOfScroll();
61410
61505
  }
61411
61506
  };
61412
- });
61507
+ window.addEventListener('scroll', handleScroll);
61508
+ return function () {
61509
+ window.removeEventListener('scroll', handleScroll);
61510
+ };
61511
+ }, [offset, onEndOfScroll]);
61413
61512
  return /*#__PURE__*/React__default.createElement(Box$1, {
61414
61513
  ref: divElement
61415
61514
  });
@@ -62985,5 +63084,5 @@ UAriaHiddenText.propTypes = {
62985
63084
  text: PropTypes.string
62986
63085
  };
62987
63086
 
62988
- export { ActiveAutoComplete, ActiveCurrencyField, ActiveDatePicker, ActiveDateTimePicker, ActiveDesktopDatePicker, ActiveDesktopDateTimePicker, ActiveDesktopTimePicker, ActiveFormCoordinateField, ActiveFormPositiveInteger, ActiveFormSelect, ActiveFormTextField, ActiveMobileDatePicker, ActiveMobileDateTimePicker, ActiveMobileTimePicker, ActiveTimePicker, UAriaHiddenText, UAriaLive, UAsyncBadge, UAutoComplete, UAvatarImage, UBreadcrumbs, UButton, UConfirmationButton, UContent, UCoordinateField, UCurrencyField, UDatePicker, UDateTimePicker, UDesktopDatePicker, UDesktopDateTimePicker, UDesktopTimePicker, UErrorAlert, UGraphPeoplePicker, UHeader, UHeaderLeftMenu, UHeaderMainMenu, UHeaderRightButtons, UIconPicker, UInfiniteScroll, ULayout, UMobileDatePicker, UMobileDateTimePicker, UMobileTimePicker, UNICEFStyleProvider, UNavbarCenter, UPageLoadingProgress, UPeoplePicker, UPositiveInteger, URadioButtons, USearchBox, USelectPicker, USideBar, UTextField, UTimePicker, UValidatorComponent, UValidatorForm, theme };
63087
+ export { ActiveAutoComplete, ActiveCurrencyField, ActiveDatePicker, ActiveDateTimePicker, ActiveDesktopDatePicker, ActiveDesktopDateTimePicker, ActiveDesktopTimePicker, ActiveFormCoordinateField, ActiveFormPositiveInteger, ActiveFormSelect, ActiveFormTextField, ActiveMobileDatePicker, ActiveMobileDateTimePicker, ActiveMobileTimePicker, ActiveTimePicker, UAriaHiddenText, UAriaLive, UAsyncBadge, UAutoComplete, UAvatarImage, UBreadcrumbs, UButton, UConfirmationButton, UContent, UCoordinateField, UCurrencyField, UDatePicker, UDateTimePicker, UDesktopDatePicker, UDesktopDateTimePicker, UDesktopTimePicker, UErrorAlert, UGraphPeoplePicker, UHeader, UHeaderLeftMenu, UHeaderMainMenu, UHeaderRightButtons, UIconPicker, UInfiniteScroll, ULayout, UMobileDatePicker, UMobileDateTimePicker, UMobileTimePicker, UNICEFStyleProvider, UNavbarCenter, UPageLoadingProgress, UPeoplePicker, UPositiveInteger, URadioButtons, USearchBox, USelectPicker, USideBar, UTextField, UTimePicker, UValidatorComponent, UValidatorForm, createUnicefMuiTheme, theme, unicefColors };
62989
63088
  //# sourceMappingURL=prod.js.map