azeriand-library 1.16.0 → 1.17.0

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.
@@ -1,11 +1,19 @@
1
1
  import { ReactNode } from 'react';
2
2
  type ThemeMode = 'dark' | 'light';
3
+ type CardProps = {
4
+ theme?: ThemeMode;
5
+ color?: string;
6
+ intensity?: number;
7
+ appearance?: 'glass' | 'mate' | 'outlined' | 'ghost';
8
+ };
3
9
  type ThemeContext = {
4
10
  theme: ThemeMode;
5
11
  setTheme: (val: ThemeMode) => void;
12
+ cardDefaults: CardProps;
6
13
  };
7
14
  export declare const ThemeContext: import('react').Context<ThemeContext>;
8
- export declare function ThemeContextComponent({ children }: {
15
+ export declare function ThemeContextComponent({ children, defaultTheme }: {
9
16
  children: ReactNode;
17
+ defaultTheme?: CardProps;
10
18
  }): import("react/jsx-runtime").JSX.Element;
11
19
  export {};
package/dist/index.esm.js CHANGED
@@ -2484,7 +2484,7 @@ process.env.NODE_ENV !== "production" ? GlobalStyles$1.propTypes = {
2484
2484
  styles: PropTypes.oneOfType([PropTypes.array, PropTypes.string, PropTypes.object, PropTypes.func])
2485
2485
  } : void 0;
2486
2486
  /**
2487
- * @mui/styled-engine v7.3.3
2487
+ * @mui/styled-engine v7.3.7
2488
2488
  *
2489
2489
  * @license MIT
2490
2490
  * This source code is licensed under the MIT license found in the
@@ -5113,7 +5113,7 @@ function InitColorSchemeScript(options) {
5113
5113
  }
5114
5114
  setter += `
5115
5115
  ${colorSchemeNode}.setAttribute('${attr}'.replace('%s', colorScheme), ${value ? `${value}.replace('%s', colorScheme)` : '""'});`;
5116
- } else {
5116
+ } else if (attribute !== ".%s") {
5117
5117
  setter += `${colorSchemeNode}.setAttribute('${attribute}', colorScheme);`;
5118
5118
  }
5119
5119
  return /* @__PURE__ */ jsx$1("script", {
@@ -8629,6 +8629,9 @@ function elementTypeAcceptingRef(props, propName, componentName, location, propF
8629
8629
  if (typeof propValue === "function" && !isClassComponent$1(propValue)) {
8630
8630
  warningHint = "Did you accidentally provide a plain function component instead?";
8631
8631
  }
8632
+ if (propValue === React.Fragment) {
8633
+ warningHint = "Did you accidentally provide a React.Fragment instead?";
8634
+ }
8632
8635
  if (warningHint !== void 0) {
8633
8636
  return new Error(`Invalid ${location} \`${safePropName}\` supplied to \`${componentName}\`. Expected an element type that can hold a ref. ${warningHint} For more information see https://mui.com/r/caveat-with-refs-guide`);
8634
8637
  }
@@ -10287,7 +10290,8 @@ const ButtonBase = /* @__PURE__ */ React.forwardRef(function ButtonBase2(inProps
10287
10290
  }
10288
10291
  const buttonProps = {};
10289
10292
  if (ComponentProp === "button") {
10290
- buttonProps.type = type === void 0 ? "button" : type;
10293
+ const hasFormAttributes = !!other.formAction;
10294
+ buttonProps.type = type === void 0 && !hasFormAttributes ? "button" : type;
10291
10295
  buttonProps.disabled = disabled;
10292
10296
  } else {
10293
10297
  if (!other.href && !other.to) {
@@ -10415,6 +10419,10 @@ process.env.NODE_ENV !== "production" ? ButtonBase.propTypes = {
10415
10419
  * if needed.
10416
10420
  */
10417
10421
  focusVisibleClassName: PropTypes.string,
10422
+ /**
10423
+ * @ignore
10424
+ */
10425
+ formAction: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
10418
10426
  /**
10419
10427
  * @ignore
10420
10428
  */
@@ -11449,7 +11457,10 @@ const DAY_MARGIN = 2;
11449
11457
  const DIALOG_WIDTH = 320;
11450
11458
  const MAX_CALENDAR_HEIGHT = 280;
11451
11459
  const VIEW_HEIGHT = 336;
11452
- const PickerViewRoot = styled("div")({
11460
+ const PickerViewRoot = styled("div", {
11461
+ slot: "internal",
11462
+ shouldForwardProp: void 0
11463
+ })({
11453
11464
  overflow: "hidden",
11454
11465
  width: DIALOG_WIDTH,
11455
11466
  maxHeight: VIEW_HEIGHT,
@@ -11703,7 +11714,7 @@ const overridesResolver = (props, styles2) => {
11703
11714
  const {
11704
11715
  ownerState
11705
11716
  } = props;
11706
- return [styles2.root, !ownerState.disableMargin && styles2.dayWithMargin, !ownerState.disableHighlightToday && ownerState.isDayCurrent && styles2.today, !ownerState.isDayOutsideMonth && ownerState.showDaysOutsideCurrentMonth && styles2.dayOutsideMonth, ownerState.isDayOutsideMonth && !ownerState.showDaysOutsideCurrentMonth && styles2.hiddenDaySpacingFiller];
11717
+ return [styles2.root, !ownerState.disableMargin && styles2.dayWithMargin, !ownerState.disableHighlightToday && ownerState.isDayCurrent && styles2.today, ownerState.isDayOutsideMonth && ownerState.showDaysOutsideCurrentMonth && styles2.dayOutsideMonth, ownerState.isDayOutsideMonth && !ownerState.showDaysOutsideCurrentMonth && styles2.hiddenDaySpacingFiller];
11707
11718
  };
11708
11719
  const PickersDayRoot = styled(ButtonBase, {
11709
11720
  name: "MuiPickersDay",
@@ -12347,7 +12358,11 @@ const useCalendarState = (params) => {
12347
12358
  const [calendarState, dispatch] = React.useReducer(reducerFn, {
12348
12359
  isMonthSwitchingAnimating: false,
12349
12360
  focusedDay: referenceDate,
12350
- currentMonth: adapter.startOfMonth(referenceDate),
12361
+ // Keep the time from the reference date when computing the current month anchor.
12362
+ // Using startOfMonth would reset the time to 00:00 which breaks expectations
12363
+ // that month selections preserve the referenceDate time when no value is provided.
12364
+ // See tests: "should use `referenceDate` when no value defined".
12365
+ currentMonth: adapter.setDate(referenceDate, 1),
12351
12366
  slideDirection: "left"
12352
12367
  });
12353
12368
  const isDateDisabled = useIsDateDisabled({
@@ -13254,7 +13269,8 @@ const MonthCalendar = /* @__PURE__ */ React.forwardRef(function MonthCalendar2(i
13254
13269
  return;
13255
13270
  }
13256
13271
  const currentValue = value && currentMonth && !adapter.isSameYear(value, currentMonth) ? adapter.setYear(value, adapter.getYear(currentMonth)) : value;
13257
- const newDate = adapter.setMonth(currentValue ?? referenceDate, month);
13272
+ const baseDateForMonth = currentValue ?? currentMonth ?? referenceDate;
13273
+ const newDate = adapter.setMonth(baseDateForMonth, month);
13258
13274
  handleValueChange(newDate);
13259
13275
  });
13260
13276
  const focusMonth = useEventCallback((month) => {
@@ -14739,7 +14755,7 @@ function warnOnce(message, gravity = "warning") {
14739
14755
  }
14740
14756
  }
14741
14757
  var dayjs_min = { exports: {} };
14742
- (function(module, exports) {
14758
+ (function(module, exports$1) {
14743
14759
  !function(t, e) {
14744
14760
  module.exports = e();
14745
14761
  }(commonjsGlobal, function() {
@@ -15017,7 +15033,7 @@ var dayjs_min = { exports: {} };
15017
15033
  var dayjs_minExports = dayjs_min.exports;
15018
15034
  const dayjs = /* @__PURE__ */ getDefaultExportFromCjs(dayjs_minExports);
15019
15035
  var weekOfYear = { exports: {} };
15020
- (function(module, exports) {
15036
+ (function(module, exports$1) {
15021
15037
  !function(e, t) {
15022
15038
  module.exports = t();
15023
15039
  }(commonjsGlobal, function() {
@@ -15042,7 +15058,7 @@ var weekOfYear = { exports: {} };
15042
15058
  var weekOfYearExports = weekOfYear.exports;
15043
15059
  const weekOfYearPlugin = /* @__PURE__ */ getDefaultExportFromCjs(weekOfYearExports);
15044
15060
  var customParseFormat = { exports: {} };
15045
- (function(module, exports) {
15061
+ (function(module, exports$1) {
15046
15062
  !function(e, t) {
15047
15063
  module.exports = t();
15048
15064
  }(commonjsGlobal, function() {
@@ -15167,7 +15183,7 @@ var customParseFormat = { exports: {} };
15167
15183
  var customParseFormatExports = customParseFormat.exports;
15168
15184
  const customParseFormatPlugin = /* @__PURE__ */ getDefaultExportFromCjs(customParseFormatExports);
15169
15185
  var localizedFormat = { exports: {} };
15170
- (function(module, exports) {
15186
+ (function(module, exports$1) {
15171
15187
  !function(e, t) {
15172
15188
  module.exports = t();
15173
15189
  }(commonjsGlobal, function() {
@@ -15192,7 +15208,7 @@ var localizedFormat = { exports: {} };
15192
15208
  var localizedFormatExports = localizedFormat.exports;
15193
15209
  const localizedFormatPlugin = /* @__PURE__ */ getDefaultExportFromCjs(localizedFormatExports);
15194
15210
  var isBetween = { exports: {} };
15195
- (function(module, exports) {
15211
+ (function(module, exports$1) {
15196
15212
  !function(e, i) {
15197
15213
  module.exports = i();
15198
15214
  }(commonjsGlobal, function() {
@@ -15207,7 +15223,7 @@ var isBetween = { exports: {} };
15207
15223
  var isBetweenExports = isBetween.exports;
15208
15224
  const isBetweenPlugin = /* @__PURE__ */ getDefaultExportFromCjs(isBetweenExports);
15209
15225
  var advancedFormat = { exports: {} };
15210
- (function(module, exports) {
15226
+ (function(module, exports$1) {
15211
15227
  !function(e, t) {
15212
15228
  module.exports = t();
15213
15229
  }(commonjsGlobal, function() {
@@ -15739,20 +15755,31 @@ class AdapterDayjs {
15739
15755
  }
15740
15756
  }
15741
15757
  const DEFAULT_THEME = "dark";
15742
- const ThemeContext = createContext({ theme: DEFAULT_THEME, setTheme: () => {
15743
- } });
15744
- function ThemeContextComponent({ children }) {
15745
- const [theme, setTheme] = useState(DEFAULT_THEME);
15746
- return /* @__PURE__ */ jsx$1(ThemeContext.Provider, { value: { theme, setTheme }, children: /* @__PURE__ */ jsx$1(LocalizationProvider, { dateAdapter: AdapterDayjs, children }) });
15758
+ const DEFAULT_CARD_PROPS = {
15759
+ theme: DEFAULT_THEME,
15760
+ color: "gray",
15761
+ intensity: 400,
15762
+ appearance: "glass"
15763
+ };
15764
+ const ThemeContext = createContext({
15765
+ theme: DEFAULT_THEME,
15766
+ setTheme: () => {
15767
+ },
15768
+ cardDefaults: DEFAULT_CARD_PROPS
15769
+ });
15770
+ function ThemeContextComponent({ children, defaultTheme: defaultTheme2 }) {
15771
+ const [theme, setTheme] = useState((defaultTheme2 == null ? void 0 : defaultTheme2.theme) || DEFAULT_THEME);
15772
+ const [cardDefaults] = useState({ ...DEFAULT_CARD_PROPS, ...defaultTheme2 });
15773
+ return /* @__PURE__ */ jsx$1(ThemeContext.Provider, { value: { theme, setTheme, cardDefaults }, children: /* @__PURE__ */ jsx$1(LocalizationProvider, { dateAdapter: AdapterDayjs, children }) });
15747
15774
  }
15748
15775
  function Card({
15749
15776
  as,
15750
15777
  children,
15751
15778
  noPadding,
15752
15779
  noBlur = false,
15753
- appearance = "glass",
15780
+ appearance,
15754
15781
  blur = 10,
15755
- color: color2 = "neutral",
15782
+ color: color2,
15756
15783
  intensity,
15757
15784
  dark: dark2 = true,
15758
15785
  onClick,
@@ -15763,16 +15790,22 @@ function Card({
15763
15790
  const Component = as || "article";
15764
15791
  let [classNames, setClassNames] = useState("");
15765
15792
  let [cardStyle, setCardStyle] = useState({});
15766
- const { theme } = useContext(ThemeContext);
15793
+ const { theme, cardDefaults } = useContext(ThemeContext);
15794
+ const mergedProps = {
15795
+ appearance: appearance || cardDefaults.appearance,
15796
+ color: color2 || cardDefaults.color,
15797
+ intensity: intensity || cardDefaults.intensity,
15798
+ dark: dark2 !== void 0 ? dark2 : cardDefaults.theme
15799
+ };
15767
15800
  useEffect(() => {
15768
- let intensityValue = intensity;
15801
+ let intensityValue = mergedProps.intensity;
15769
15802
  if (intensityValue === void 0) {
15770
15803
  intensityValue = theme === "dark" ? 600 : 300;
15771
15804
  }
15772
15805
  setCardStyle({
15773
- "--glass-color": `var(--color-${color2}-${intensityValue})`,
15774
- "--card-text-color": `var(--color-${color2}-${dark2 ? "100" : "800"})`,
15775
- backdropFilter: appearance === "glass" && !noBlur ? `blur(${blur}px)` : void 0,
15806
+ "--glass-color": `var(--color-${mergedProps.color}-${intensityValue})`,
15807
+ "--card-text-color": `var(--color-${mergedProps.color}-${mergedProps.dark ? "100" : "800"})`,
15808
+ backdropFilter: mergedProps.appearance === "glass" && !noBlur ? `blur(${blur}px)` : void 0,
15776
15809
  ...style2
15777
15810
  });
15778
15811
  let rounded = "rounded-md";
@@ -15782,15 +15815,15 @@ function Card({
15782
15815
  rounded = roundedMatch[roundedMatch.length - 1];
15783
15816
  }
15784
15817
  }
15785
- setClassNames(`card ${rounded} ${appearance} ${className} ${noPadding ? "" : "p-[2rem]"}`);
15818
+ setClassNames(`card ${rounded} ${mergedProps.appearance} ${className} ${noPadding ? "" : "p-[2rem]"}`);
15786
15819
  }, [color2, intensity, dark2, appearance, noBlur, className, theme]);
15787
15820
  return /* @__PURE__ */ jsx$1(Component, { className: classNames, style: cardStyle, onClick, ...rest, children });
15788
15821
  }
15789
15822
  function Button({ children, label, icon, position: position2 = "left", onClick, size, className, ...cardProps }) {
15790
15823
  let defaultCardClassNames = "flex justify-center items-center gap-x-[0.40rem] box-border cursor-pointer w-fit ";
15791
- let specificCardClassNames = "min-w-[2.5rem] px-[1rem] py-1";
15824
+ let specificCardClassNames = "min-w-[2.5rem] px-4 py-2.5";
15792
15825
  if (size === "sm") {
15793
- specificCardClassNames = "min-w-auto text-xs px-[0.5rem] py-1";
15826
+ specificCardClassNames = "min-w-auto text-xs px-2.5 py-1.5";
15794
15827
  className = `${className}`;
15795
15828
  }
15796
15829
  if (icon && !label) {
@@ -15973,8 +16006,8 @@ function Checkbox({ label, checkedDefault = false, onChange }) {
15973
16006
  setChecked(newValue);
15974
16007
  onChange(newValue);
15975
16008
  }
15976
- return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5 w-fit", onClick: checkboxClicked, children: [
15977
- /* @__PURE__ */ jsx$1(Button, { icon: checked ? /* @__PURE__ */ jsx$1(FaCheck, {}) : null }),
16009
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-[0.5rem]", onClick: checkboxClicked, children: [
16010
+ /* @__PURE__ */ jsx$1(Button, { icon: checked ? /* @__PURE__ */ jsx$1(FaCheck, {}) : null, className: "min-w-[2rem] min-h-[2rem]" }),
15978
16011
  label
15979
16012
  ] });
15980
16013
  }
@@ -16020,7 +16053,7 @@ function Calendar({ selectedDates, ...cardProps }) {
16020
16053
  mode: "dark"
16021
16054
  }
16022
16055
  });
16023
- return /* @__PURE__ */ jsx$1(Card, { appearance: cardProps.appearance ?? "ghost", noPadding: true, ...cardProps, children: /* @__PURE__ */ jsx$1(ThemeProvider, { theme, children: /* @__PURE__ */ jsx$1(
16056
+ return /* @__PURE__ */ jsx$1(Card, { appearance: cardProps.appearance ?? "ghost", noPadding: true, ...cardProps, className: "w-fit px-5 pt-7", children: /* @__PURE__ */ jsx$1(ThemeProvider, { theme, children: /* @__PURE__ */ jsx$1(
16024
16057
  DateCalendar,
16025
16058
  {
16026
16059
  slots: { day: CustomDay },