@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.cjs CHANGED
@@ -7543,7 +7543,72 @@ function ThemeProvider({
7543
7543
  });
7544
7544
  }
7545
7545
 
7546
- var unicef = {
7546
+ // default
7547
+ const enUS$1 = {
7548
+ /*
7549
+ components: {
7550
+ MuiBreadcrumbs: { defaultProps: {
7551
+ expandText: 'Show path',
7552
+ }},
7553
+ MuiTablePagination: { defaultProps: {
7554
+ getItemAriaLabel: (type) => {
7555
+ if (type === 'first') {
7556
+ return 'Go to first page';
7557
+ }
7558
+ if (type === 'last') {
7559
+ return 'Go to last page';
7560
+ }
7561
+ if (type === 'next') {
7562
+ return 'Go to next page';
7563
+ }
7564
+ // if (type === 'previous') {
7565
+ return 'Go to previous page';
7566
+ },
7567
+ labelRowsPerPage: 'Rows per page:',
7568
+ labelDisplayedRows: ({ from, to, count }) =>
7569
+ `${from}–${to} of ${count !== -1 ? count : `more than ${to}`}`,
7570
+ }},
7571
+ MuiRating: { defaultProps: {
7572
+ getLabelText: value => `${value} Star${value !== 1 ? 's' : ''}`,
7573
+ emptyLabelText: 'Empty',
7574
+ }},
7575
+ MuiAutocomplete: { defaultProps: {
7576
+ clearText: 'Clear',
7577
+ closeText: 'Close',
7578
+ loadingText: 'Loading…',
7579
+ noOptionsText: 'No options',
7580
+ openText: 'Open',
7581
+ }},
7582
+ MuiAlert: { defaultProps: {
7583
+ closeText: 'Close',
7584
+ }},
7585
+ MuiPagination: { defaultProps: {
7586
+ 'aria-label': 'Pagination navigation',
7587
+ getItemAriaLabel: (type, page, selected) => {
7588
+ if (type === 'page') {
7589
+ return `${selected ? '' : 'Go to '}page ${page}`;
7590
+ }
7591
+ if (type === 'first') {
7592
+ return 'Go to first page';
7593
+ }
7594
+ if (type === 'last') {
7595
+ return 'Go to last page';
7596
+ }
7597
+ if (type === 'next') {
7598
+ return 'Go to next page';
7599
+ }
7600
+ // if (type === 'previous') {
7601
+ return 'Go to previous page';
7602
+ },
7603
+ }},
7604
+ },
7605
+ */
7606
+ };
7607
+
7608
+ /**
7609
+ * UNICEF color palette.
7610
+ */
7611
+ var unicefColors = {
7547
7612
  blue: '#1CABE2',
7548
7613
  darkBlue: '#374EA2',
7549
7614
  purple: '#6A3674',
@@ -7554,70 +7619,99 @@ var unicef = {
7554
7619
  green: '#80BD41',
7555
7620
  darkGreen: '#00833D'
7556
7621
  };
7557
- var theme = createTheme({
7558
- typography: {
7559
- useNextVariants: true,
7560
- fontFamily: ['Roboto', 'Helvetica', 'Arial', 'sans-serif'].join(',')
7561
- },
7562
- spacing: 8,
7563
- palette: {
7564
- primary: {
7565
- main: unicef.darkBlue
7622
+
7623
+ /**
7624
+ * Creates a customized MUI theme with UNICEF color palette.
7625
+ *
7626
+ * Applies UNICEF color palette, typography, and component overrides
7627
+ * on top of MUI's default theme. Supports locale-specific configurations
7628
+ * for internationalized applications.
7629
+ *
7630
+ * @param {object} [locale=enUS] - MUI locale object for localized component text.
7631
+ * @returns A fully configured MUI theme instance.
7632
+ *
7633
+ * @example
7634
+ * import { createUnicefMuiTheme } from '@unicef/material-ui'
7635
+ * import { frFR } from '@mui/material/locale'
7636
+ *
7637
+ * const theme = createUnicefMuiTheme(frFR)
7638
+ */
7639
+ var createUnicefMuiTheme = function createUnicefMuiTheme() {
7640
+ var locale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : enUS$1;
7641
+ var theme = createTheme({
7642
+ typography: {
7643
+ useNextVariants: true,
7644
+ fontFamily: ['Roboto', 'Helvetica', 'Arial', 'sans-serif'].join(',')
7566
7645
  },
7567
- secondary: {
7568
- main: unicef.blue
7646
+ spacing: 8,
7647
+ palette: {
7648
+ primary: {
7649
+ main: unicefColors.darkBlue
7650
+ },
7651
+ secondary: {
7652
+ main: unicefColors.blue
7653
+ },
7654
+ error: {
7655
+ main: unicefColors.red
7656
+ },
7657
+ unicef: unicefColors,
7658
+ unicefBlue: unicefColors.blue
7569
7659
  },
7570
- error: {
7571
- main: unicef.red
7660
+ unicefBlue: unicefColors.blue,
7661
+ mixins: {
7662
+ toolbar: {}
7572
7663
  },
7573
- unicef: unicef,
7574
- unicefBlue: unicef.blue
7575
- },
7576
- unicefBlue: unicef.blue,
7577
- mixins: {
7578
- toolbar: {}
7579
- },
7580
- shape: {
7581
- borderRadius: 4
7582
- },
7583
- components: {
7584
- // Name of the component
7585
- MuiButtonBase: {
7586
- defaultProps: {
7587
- // The props to change the default for.
7588
- disableRipple: true // No more ripple, on the whole application 💣!
7589
- }
7664
+ shape: {
7665
+ borderRadius: 4
7590
7666
  },
7591
- MuiDrawer: {
7592
- styleOverrides: {
7593
- paper: {
7594
- minWidth: 256
7667
+ // Component-level style overrides and default prop customizations
7668
+ components: {
7669
+ MuiButtonBase: {
7670
+ defaultProps: {
7671
+ // The props to change the default for.
7672
+ disableRipple: true // No more ripple, on the whole application 💣!
7595
7673
  }
7596
- }
7597
- },
7598
- MuiInputBase: {
7599
- styleOverrides: {
7600
- root: {
7601
- backgroundColor: 'white'
7674
+ },
7675
+ MuiDrawer: {
7676
+ styleOverrides: {
7677
+ paper: {
7678
+ minWidth: 256
7679
+ }
7602
7680
  }
7603
- }
7604
- },
7605
- MuiTab: {
7606
- styleOverrides: {
7607
- root: {
7608
- minWidth: 160
7681
+ },
7682
+ MuiInputBase: {
7683
+ styleOverrides: {
7684
+ root: {
7685
+ backgroundColor: 'white'
7686
+ }
7609
7687
  }
7610
- }
7611
- },
7612
- MuiAppBar: {
7613
- styleOverrides: {
7614
- root: {
7615
- zIndex: 1200
7688
+ },
7689
+ MuiTab: {
7690
+ styleOverrides: {
7691
+ root: {
7692
+ minWidth: 160
7693
+ }
7694
+ }
7695
+ },
7696
+ MuiAppBar: {
7697
+ styleOverrides: {
7698
+ root: {
7699
+ zIndex: 1200
7700
+ }
7616
7701
  }
7617
7702
  }
7618
7703
  }
7619
- }
7620
- });
7704
+ }, locale);
7705
+ return theme;
7706
+ };
7707
+
7708
+ /**
7709
+ * Default UNICEF MUI theme instance (English locale).
7710
+ *
7711
+ * Wrap your application with `<ThemeProvider theme={theme}>` to apply
7712
+ * UNICEF brand styles throughout the component tree.
7713
+ */
7714
+ var theme = createUnicefMuiTheme();
7621
7715
 
7622
7716
  ClassNameGenerator$1.configure(function (componentName) {
7623
7717
  return "Uni-".concat(componentName);
@@ -33075,14 +33169,13 @@ var classes$k = {
33075
33169
  };
33076
33170
  var StyledChip = styled$1(Chip$1)(function (_ref) {
33077
33171
  var theme = _ref.theme;
33078
- return _defineProperty$1(_defineProperty$1(_defineProperty$1(_defineProperty$1(_defineProperty$1(_defineProperty$1({}, "&.".concat(classes$k.chip), {
33172
+ return _defineProperty$1(_defineProperty$1(_defineProperty$1(_defineProperty$1(_defineProperty$1(_defineProperty$1({}, "&.".concat(classes$k.chip), _defineProperty$1({
33079
33173
  marginRight: theme.spacing(0.5),
33080
33174
  marginTop: theme.spacing(0.25),
33081
- maxWidth: '90%',
33082
- '& .Uni-MuiChip-deleteIcon': {
33083
- display: 'flex'
33084
- }
33085
- }), "&.".concat(classes$k.chipFocused), {
33175
+ maxWidth: '90%'
33176
+ }, "& .".concat(chipClasses$1.deleteIcon), {
33177
+ display: 'flex'
33178
+ })), "&.".concat(classes$k.chipFocused), {
33086
33179
  backgroundColor: emphasize(theme.palette.mode === 'light' ? theme.palette.grey[300] : theme.palette.grey[700], 0.08)
33087
33180
  }), "& .".concat(classes$k.avatar), {
33088
33181
  width: 24,
@@ -61419,7 +61512,9 @@ function UInfiniteScroll(_ref) {
61419
61512
  onEndOfScroll = _ref.onEndOfScroll;
61420
61513
  var divElement = React.useRef();
61421
61514
  React.useEffect(function () {
61422
- window.onscroll = function () {
61515
+ // Guard against SSR environments where window is not available
61516
+ if (typeof window === 'undefined') return;
61517
+ var handleScroll = function handleScroll() {
61423
61518
  //window.innerHeight: is the height of the window
61424
61519
  //window.pageYOffset is the current scroll offset position
61425
61520
  // counting from the the top of the screen
@@ -61429,7 +61524,11 @@ function UInfiniteScroll(_ref) {
61429
61524
  onEndOfScroll();
61430
61525
  }
61431
61526
  };
61432
- });
61527
+ window.addEventListener('scroll', handleScroll);
61528
+ return function () {
61529
+ window.removeEventListener('scroll', handleScroll);
61530
+ };
61531
+ }, [offset, onEndOfScroll]);
61433
61532
  return /*#__PURE__*/React.createElement(Box$1, {
61434
61533
  ref: divElement
61435
61534
  });
@@ -63061,5 +63160,7 @@ exports.UTextField = UTextField;
63061
63160
  exports.UTimePicker = UTimePicker;
63062
63161
  exports.UValidatorComponent = UValidatorComponent;
63063
63162
  exports.UValidatorForm = UValidatorForm;
63163
+ exports.createUnicefMuiTheme = createUnicefMuiTheme;
63064
63164
  exports.theme = theme;
63165
+ exports.unicefColors = unicefColors;
63065
63166
  //# sourceMappingURL=prod.cjs.map