opus-toolkit-components 1.8.2 → 1.8.4

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,12 @@
1
- export interface CookieBannerProps {
2
- logo?: string;
3
- policyTxt?: string;
4
- linkTxt?: string;
5
- isVisible?: boolean;
6
- onAccept?: () => void;
7
- onLearnMore?: () => void;
8
- intent?: string;
9
- }
10
-
11
- export const CookieBanner: React.ComponentType<CookieBannerProps>;
1
+ export interface CookieBannerProps {
2
+ logo?: string;
3
+ policyTxt?: string;
4
+ linkTxt?: string;
5
+ isVisible?: boolean;
6
+ onAccept?: () => void;
7
+ onLearnMore?: () => void;
8
+ intent?: string;
9
+ children?: React.ReactNode;
10
+ }
11
+
12
+ export const CookieBanner: React.ComponentType<CookieBannerProps>;
@@ -1,23 +1,25 @@
1
- export interface DatePickerChangeEvent {
2
- target: {
3
- name: string;
4
- value: string;
5
- };
6
- }
7
-
8
- export interface DatePickerProps extends React.HTMLAttributes<HTMLDivElement> {
9
- initialDate?: string;
10
- label?: string;
11
- isValid?: boolean;
12
- errorMessage?: string;
13
- name?: string;
14
- onChange?: (event: DatePickerChangeEvent) => void;
15
- value?: string;
16
- className?: string;
17
- title?: string;
18
- required?: boolean;
19
- dataCy?: string;
20
- disabled?: boolean;
21
- }
22
-
23
- export const DatePicker: React.ComponentType<DatePickerProps>;
1
+ export interface DatePickerChangeEvent {
2
+ target: {
3
+ name: string;
4
+ value: string;
5
+ };
6
+ }
7
+
8
+ export interface DatePickerProps extends React.HTMLAttributes<HTMLDivElement> {
9
+ initialDate?: string;
10
+ label?: string;
11
+ isValid?: boolean;
12
+ errorMessage?: string;
13
+ name?: string;
14
+ onChange?: (event: DatePickerChangeEvent) => void;
15
+ value?: string;
16
+ className?: string;
17
+ title?: string;
18
+ required?: boolean;
19
+ dataCy?: string;
20
+ disabled?: boolean;
21
+ minDate?: string;
22
+ maxDate?: string;
23
+ }
24
+
25
+ export const DatePicker: React.ComponentType<DatePickerProps>;
package/lib/main.js CHANGED
@@ -24577,7 +24577,8 @@ const CookieBanner = _ref => {
24577
24577
  isVisible = true,
24578
24578
  onAccept = () => {},
24579
24579
  onLearnMore = () => {},
24580
- intent = "brandSecondary"
24580
+ intent = "brandSecondary",
24581
+ children
24581
24582
  } = _ref;
24582
24583
  const [show, setShow] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false);
24583
24584
  const [render, setRender] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(isVisible);
@@ -24600,6 +24601,20 @@ const CookieBanner = _ref => {
24600
24601
  }
24601
24602
  }, [imageLoaded, render]);
24602
24603
  if (!render) return null;
24604
+ const defaultActions = /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.Fragment, {
24605
+ children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_Buttons_Button__WEBPACK_IMPORTED_MODULE_2__["default"], {
24606
+ rank: "primary",
24607
+ text: "Accept",
24608
+ onClick: onAccept
24609
+ }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_Buttons_Button__WEBPACK_IMPORTED_MODULE_2__["default"], {
24610
+ rank: "secondary",
24611
+ text: linkTxt,
24612
+ onClick: e => {
24613
+ e.preventDefault();
24614
+ onLearnMore();
24615
+ }
24616
+ })]
24617
+ });
24603
24618
  return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(_Cards_Card__WEBPACK_IMPORTED_MODULE_1__["default"], {
24604
24619
  intent: intent,
24605
24620
  className: "items-center justify-between space-x-4 p-4 transition-all duration-300 ease-in-out md:flex ".concat(show ? "translate-y-0 opacity-100" : "translate-y-3 opacity-0", " "),
@@ -24618,20 +24633,9 @@ const CookieBanner = _ref => {
24618
24633
  className: "mr-4",
24619
24634
  children: policyTxt
24620
24635
  })]
24621
- }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("div", {
24636
+ }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("div", {
24622
24637
  className: "flex items-center space-x-4",
24623
- children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_Buttons_Button__WEBPACK_IMPORTED_MODULE_2__["default"], {
24624
- rank: "primary",
24625
- text: "Accept",
24626
- onClick: onAccept
24627
- }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_Buttons_Button__WEBPACK_IMPORTED_MODULE_2__["default"], {
24628
- rank: "secondary",
24629
- text: linkTxt,
24630
- onClick: e => {
24631
- e.preventDefault();
24632
- onLearnMore();
24633
- }
24634
- })]
24638
+ children: children || defaultActions
24635
24639
  })]
24636
24640
  });
24637
24641
  };
@@ -46831,50 +46835,56 @@ __webpack_require__.r(__webpack_exports__);
46831
46835
 
46832
46836
 
46833
46837
 
46834
- /**
46835
- * Custom change event type used by your date components.
46836
- * @typedef {{ target: { name: string, value: string } }} DatePickerChangeEvent
46838
+ /**
46839
+ * Custom change event type used by your date components.
46840
+ * @typedef {{ target: { name: string, value: string } }} DatePickerChangeEvent
46837
46841
  */
46838
46842
 
46839
- /**
46840
- * Props for DatePicker.
46841
- *
46842
- * @typedef {Object} DatePickerProps
46843
- *
46844
- * @property {string} [initialDate]
46845
- * Initial date value (ISO or human-readable). Converted internally.
46846
- *
46847
- * @property {string} [label]
46848
- * Label above the input.
46849
- *
46850
- * @property {boolean} [isValid]
46851
- * Controls validation styles + error message display.
46852
- *
46853
- * @property {string} [errorMessage]
46854
- * Message shown when isValid = false.
46855
- *
46856
- * @property {string} [name]
46857
- * Input field name and event target name.
46858
- *
46859
- * @property {(event: DatePickerChangeEvent) => void} [onChange]
46860
- * Custom event format with `event.target.name` & `event.target.value` in ISO.
46861
- *
46862
- * @property {string} [value]
46863
- * External controlled value (ISO or slash-format). Normalized automatically.
46864
- *
46865
- * @property {string} [className]
46866
- *
46867
- * @property {string} [title]
46868
- *
46869
- * @property {boolean} [required]
46870
- *
46871
- * @property {string} [dataCy]
46872
- *
46873
- * @property {boolean} [disabled]
46843
+ /**
46844
+ * Props for DatePicker.
46845
+ *
46846
+ * @typedef {Object} DatePickerProps
46847
+ *
46848
+ * @property {string} [initialDate]
46849
+ * Initial date value (ISO or human-readable). Converted internally.
46850
+ *
46851
+ * @property {string} [label]
46852
+ * Label above the input.
46853
+ *
46854
+ * @property {boolean} [isValid]
46855
+ * Controls validation styles + error message display.
46856
+ *
46857
+ * @property {string} [errorMessage]
46858
+ * Message shown when isValid = false.
46859
+ *
46860
+ * @property {string} [name]
46861
+ * Input field name and event target name.
46862
+ *
46863
+ * @property {(event: DatePickerChangeEvent) => void} [onChange]
46864
+ * Custom event format with `event.target.name` & `event.target.value` in ISO.
46865
+ *
46866
+ * @property {string} [value]
46867
+ * External controlled value (ISO or slash-format). Normalized automatically.
46868
+ *
46869
+ * @property {string} [className]
46870
+ *
46871
+ * @property {string} [title]
46872
+ *
46873
+ * @property {boolean} [required]
46874
+ *
46875
+ * @property {string} [dataCy]
46876
+ *
46877
+ * @property {boolean} [disabled]
46878
+ *
46879
+ * @property {string} [minDate]
46880
+ * Minimum selectable date (ISO or slash-format). Normalized automatically.
46881
+ *
46882
+ * @property {string} [maxDate]
46883
+ * Maximum selectable date (ISO or slash-format). Normalized automatically.
46874
46884
  */
46875
46885
 
46876
- /**
46877
- * @param {DatePickerProps & React.HTMLAttributes<HTMLDivElement>} props
46886
+ /**
46887
+ * @param {DatePickerProps & React.HTMLAttributes<HTMLDivElement>} props
46878
46888
  */
46879
46889
 
46880
46890
  function DatePicker(_ref) {
@@ -46890,7 +46900,9 @@ function DatePicker(_ref) {
46890
46900
  title = "",
46891
46901
  required = false,
46892
46902
  dataCy,
46893
- disabled = false
46903
+ disabled = false,
46904
+ minDate,
46905
+ maxDate
46894
46906
  } = _ref;
46895
46907
  const [selectedDate, setSelectedDate] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)("");
46896
46908
  const inputRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
@@ -46920,6 +46932,8 @@ function DatePicker(_ref) {
46920
46932
  setSelectedDate(newDate);
46921
46933
  }
46922
46934
  }, [value, initialDate]);
46935
+ const normalizedMinDate = normalizeToInputFormat(minDate);
46936
+ const normalizedMaxDate = normalizeToInputFormat(maxDate);
46923
46937
  const handleDateChange = e => {
46924
46938
  const rawValue = e.target.value; // yyyy-MM-dd
46925
46939
  setSelectedDate(rawValue);
@@ -46954,6 +46968,8 @@ function DatePicker(_ref) {
46954
46968
  name: name,
46955
46969
  ref: inputRef,
46956
46970
  value: selectedDate,
46971
+ min: normalizedMinDate,
46972
+ max: normalizedMaxDate,
46957
46973
  title: title,
46958
46974
  onChange: handleDateChange,
46959
46975
  required: required,