mytek-components 1.0.7 → 1.0.8

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.es.js CHANGED
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
  import * as React from "react";
5
- import React__default, { useState, useRef, useEffect, isValidElement, cloneElement, Children, useContext, useMemo, useCallback, useLayoutEffect, createContext } from "react";
5
+ import React__default, { useState, useRef, useEffect, isValidElement, cloneElement, Children, useCallback, useContext, useMemo, useLayoutEffect, createContext } from "react";
6
6
  import emStyled from "@emotion/styled";
7
7
  import { keyframes } from "@emotion/react";
8
8
  import ReactDOM from "react-dom";
@@ -10529,6 +10529,187 @@ const RadioButton = ({
10529
10529
  }
10530
10530
  );
10531
10531
  };
10532
+ function FaCheck(props) {
10533
+ return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z" }, "child": [] }] })(props);
10534
+ }
10535
+ function FaChevronDown(props) {
10536
+ return GenIcon({ "attr": { "viewBox": "0 0 448 512" }, "child": [{ "tag": "path", "attr": { "d": "M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z" }, "child": [] }] })(props);
10537
+ }
10538
+ function FaChevronUp(props) {
10539
+ return GenIcon({ "attr": { "viewBox": "0 0 448 512" }, "child": [{ "tag": "path", "attr": { "d": "M240.971 130.524l194.343 194.343c9.373 9.373 9.373 24.569 0 33.941l-22.667 22.667c-9.357 9.357-24.522 9.375-33.901.04L224 227.495 69.255 381.516c-9.379 9.335-24.544 9.317-33.901-.04l-22.667-22.667c-9.373-9.373-9.373-24.569 0-33.941L207.03 130.525c9.372-9.373 24.568-9.373 33.941-.001z" }, "child": [] }] })(props);
10540
+ }
10541
+ const ComboDropdown = ({
10542
+ label,
10543
+ options = [],
10544
+ placeholder = "",
10545
+ onChange,
10546
+ name,
10547
+ value,
10548
+ error,
10549
+ disabled,
10550
+ height: height2 = "40px",
10551
+ isPassword = false,
10552
+ mode = "both",
10553
+ isRequired = false,
10554
+ optionLabelKey = "label",
10555
+ optionValueKey = "value"
10556
+ }) => {
10557
+ const [inputValue, setInputValue] = useState("");
10558
+ const [filteredOptions, setFilteredOptions] = useState([]);
10559
+ const [showDropdown, setShowDropdown] = useState(false);
10560
+ const [highlightIndex, setHighlightIndex] = useState(-1);
10561
+ const inputRef = useRef();
10562
+ const wrapperRef = useRef();
10563
+ useEffect(() => {
10564
+ const selected = options.find(
10565
+ (opt) => (typeof opt === "object" ? opt[optionValueKey] : opt) === value
10566
+ );
10567
+ if (selected) {
10568
+ const label2 = typeof selected === "object" ? selected[optionLabelKey] : selected;
10569
+ setInputValue(label2);
10570
+ } else {
10571
+ setInputValue("");
10572
+ }
10573
+ }, [value, options, optionLabelKey, optionValueKey]);
10574
+ useEffect(() => {
10575
+ const handleClickOutside = (event) => {
10576
+ if (wrapperRef.current && !wrapperRef.current.contains(event.target)) {
10577
+ setShowDropdown(false);
10578
+ }
10579
+ };
10580
+ document.addEventListener("mousedown", handleClickOutside);
10581
+ return () => document.removeEventListener("mousedown", handleClickOutside);
10582
+ }, []);
10583
+ const normalizeOptions = (opts) => opts.map((opt) => {
10584
+ if (typeof opt === "string") return { label: opt, value: opt };
10585
+ return {
10586
+ label: opt[optionLabelKey],
10587
+ value: opt[optionValueKey]
10588
+ };
10589
+ });
10590
+ const handleInputChange = (e) => {
10591
+ const val = e.target.value;
10592
+ setInputValue(val);
10593
+ if (mode !== "select" && onChange) {
10594
+ onChange(name, val);
10595
+ }
10596
+ if (mode !== "type") {
10597
+ const normalized = normalizeOptions(options);
10598
+ const filtered = normalized.filter(
10599
+ (opt) => {
10600
+ var _a;
10601
+ return (_a = opt.label) == null ? void 0 : _a.toLowerCase().includes(val.toLowerCase());
10602
+ }
10603
+ );
10604
+ setFilteredOptions(filtered);
10605
+ setShowDropdown(true);
10606
+ setHighlightIndex(-1);
10607
+ }
10608
+ };
10609
+ const handleSelect = (val, label2) => {
10610
+ setInputValue(label2);
10611
+ if (onChange) {
10612
+ onChange(name, val);
10613
+ }
10614
+ setShowDropdown(false);
10615
+ setHighlightIndex(-1);
10616
+ };
10617
+ const handleKeyDown = (e) => {
10618
+ if (!showDropdown || filteredOptions.length === 0) return;
10619
+ if (e.key === "ArrowDown") {
10620
+ e.preventDefault();
10621
+ setHighlightIndex((prev) => prev < filteredOptions.length - 1 ? prev + 1 : 0);
10622
+ }
10623
+ if (e.key === "ArrowUp") {
10624
+ e.preventDefault();
10625
+ setHighlightIndex((prev) => prev > 0 ? prev - 1 : filteredOptions.length - 1);
10626
+ }
10627
+ if (e.key === "Enter" && highlightIndex >= 0) {
10628
+ e.preventDefault();
10629
+ const selected = filteredOptions[highlightIndex];
10630
+ handleSelect(selected.value, selected.label);
10631
+ }
10632
+ };
10633
+ const getPlaceholder = () => {
10634
+ if (placeholder) return placeholder;
10635
+ if (mode === "select") return "Select an option...";
10636
+ if (mode === "type") return "Type a value...";
10637
+ return "Select or type...";
10638
+ };
10639
+ const toggleDropdown = () => {
10640
+ if (disabled) return;
10641
+ if (!showDropdown && mode !== "type") {
10642
+ setFilteredOptions(normalizeOptions(options));
10643
+ }
10644
+ setShowDropdown((prev) => {
10645
+ var _a;
10646
+ if (!prev) (_a = inputRef.current) == null ? void 0 : _a.focus();
10647
+ return !prev;
10648
+ });
10649
+ };
10650
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: wrapperRef, className: "mb-4 w-full relative", children: [
10651
+ label && /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: [
10652
+ label,
10653
+ " ",
10654
+ isRequired && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-red-500", children: "*" })
10655
+ ] }),
10656
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex items-center", children: [
10657
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
10658
+ "input",
10659
+ {
10660
+ ref: inputRef,
10661
+ type: isPassword ? "password" : "text",
10662
+ placeholder: getPlaceholder(),
10663
+ className: `w-full border rounded-sm px-3 pr-8 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-green-200 ${error ? "border-red-500" : "border-green-500"} ${disabled ? "bg-gray-100 cursor-not-allowed" : ""}`,
10664
+ name,
10665
+ value: inputValue,
10666
+ onChange: handleInputChange,
10667
+ onFocus: () => {
10668
+ if (mode !== "type") {
10669
+ setFilteredOptions(normalizeOptions(options));
10670
+ setShowDropdown(true);
10671
+ }
10672
+ },
10673
+ onClick: () => {
10674
+ if (mode !== "type") {
10675
+ setFilteredOptions(normalizeOptions(options));
10676
+ setShowDropdown(true);
10677
+ }
10678
+ },
10679
+ onKeyDown: handleKeyDown,
10680
+ disabled,
10681
+ readOnly: mode === "select",
10682
+ autoComplete: "off",
10683
+ style: { height: height2 }
10684
+ }
10685
+ ),
10686
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
10687
+ "div",
10688
+ {
10689
+ onClick: toggleDropdown,
10690
+ onMouseDown: (e) => e.preventDefault(),
10691
+ className: "absolute right-2 top-1/2 transform -translate-y-1/2 cursor-pointer text-gray-600",
10692
+ children: showDropdown ? /* @__PURE__ */ jsxRuntimeExports.jsx(FaChevronUp, { size: 12 }) : /* @__PURE__ */ jsxRuntimeExports.jsx(FaChevronDown, { size: 12 })
10693
+ }
10694
+ )
10695
+ ] }),
10696
+ showDropdown && filteredOptions.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "absolute z-10 w-full mt-1 bg-white border border-gray-300 rounded-md max-h-52 overflow-y-auto shadow-md", children: filteredOptions.map((opt, index) => {
10697
+ const isSelected = opt.value === value;
10698
+ const isHighlighted = index === highlightIndex;
10699
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
10700
+ "li",
10701
+ {
10702
+ onMouseDown: (e) => e.preventDefault(),
10703
+ onClick: () => handleSelect(opt.value, opt.label),
10704
+ className: `px-3 py-2 text-sm cursor-pointer ${isHighlighted ? "bg-gray-200" : isSelected ? "" : "bg-white"} ${isSelected ? "bg-[#dee2e6] text-black" : ""}`,
10705
+ children: opt.label
10706
+ },
10707
+ index
10708
+ );
10709
+ }) }),
10710
+ error && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-red-500 text-sm mt-1", children: error })
10711
+ ] });
10712
+ };
10532
10713
  var classnames = { exports: {} };
10533
10714
  /*!
10534
10715
  Copyright (c) 2018 Jed Watson.
@@ -10594,34 +10775,23 @@ function requireClassnames() {
10594
10775
  }
10595
10776
  var classnamesExports = requireClassnames();
10596
10777
  const classNames = /* @__PURE__ */ getDefaultExportFromCjs(classnamesExports);
10597
- const propTypes$1 = {
10598
- /**
10599
- * Specify whether the feedback is for valid or invalid fields
10600
- *
10601
- * @type {('valid'|'invalid')}
10602
- */
10603
- type: PropTypes.string,
10604
- /** Display feedback as a tooltip. */
10605
- tooltip: PropTypes.bool,
10606
- as: PropTypes.elementType
10607
- };
10608
- const Feedback = /* @__PURE__ */ React.forwardRef(
10609
- // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
10610
- ({
10611
- as: Component = "div",
10612
- className,
10613
- type = "valid",
10614
- tooltip = false,
10615
- ...props
10616
- }, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx(Component, {
10617
- ...props,
10618
- ref,
10619
- className: classNames(className, `${type}-${tooltip ? "tooltip" : "feedback"}`)
10620
- })
10621
- );
10622
- Feedback.displayName = "Feedback";
10623
- Feedback.propTypes = propTypes$1;
10624
- const FormContext = /* @__PURE__ */ React.createContext({});
10778
+ function useUncontrolledProp(propValue, defaultValue, handler) {
10779
+ var wasPropRef = useRef(propValue !== void 0);
10780
+ var _useState = useState(defaultValue), stateValue = _useState[0], setState = _useState[1];
10781
+ var isProp = propValue !== void 0;
10782
+ var wasProp = wasPropRef.current;
10783
+ wasPropRef.current = isProp;
10784
+ if (!isProp && wasProp && stateValue !== defaultValue) {
10785
+ setState(defaultValue);
10786
+ }
10787
+ return [isProp ? propValue : stateValue, useCallback(function(value) {
10788
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
10789
+ args[_key - 1] = arguments[_key];
10790
+ }
10791
+ if (handler) handler.apply(void 0, [value].concat(args));
10792
+ setState(value);
10793
+ }, [handler])];
10794
+ }
10625
10795
  const DEFAULT_BREAKPOINTS = ["xxl", "xl", "lg", "md", "sm", "xs"];
10626
10796
  const DEFAULT_MIN_BREAKPOINT = "xs";
10627
10797
  const ThemeContext = /* @__PURE__ */ React.createContext({
@@ -10657,1286 +10827,715 @@ function useIsRTL() {
10657
10827
  } = useContext(ThemeContext);
10658
10828
  return dir === "rtl";
10659
10829
  }
10660
- const FormCheckInput = /* @__PURE__ */ React.forwardRef(({
10661
- id,
10662
- bsPrefix,
10663
- className,
10664
- type = "checkbox",
10665
- isValid = false,
10666
- isInvalid = false,
10667
- // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
10668
- as: Component = "input",
10669
- ...props
10670
- }, ref) => {
10671
- const {
10672
- controlId
10673
- } = useContext(FormContext);
10674
- bsPrefix = useBootstrapPrefix(bsPrefix, "form-check-input");
10675
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Component, {
10676
- ...props,
10677
- ref,
10678
- type,
10679
- id: id || controlId,
10680
- className: classNames(className, bsPrefix, isValid && "is-valid", isInvalid && "is-invalid")
10681
- });
10682
- });
10683
- FormCheckInput.displayName = "FormCheckInput";
10684
- const FormCheckLabel = /* @__PURE__ */ React.forwardRef(({
10685
- bsPrefix,
10686
- className,
10687
- htmlFor,
10688
- ...props
10689
- }, ref) => {
10690
- const {
10691
- controlId
10692
- } = useContext(FormContext);
10693
- bsPrefix = useBootstrapPrefix(bsPrefix, "form-check-label");
10694
- return /* @__PURE__ */ jsxRuntimeExports.jsx("label", {
10695
- ...props,
10696
- ref,
10697
- htmlFor: htmlFor || controlId,
10698
- className: classNames(className, bsPrefix)
10699
- });
10700
- });
10701
- FormCheckLabel.displayName = "FormCheckLabel";
10702
- function hasChildOfType(children, type) {
10703
- return React.Children.toArray(children).some((child) => /* @__PURE__ */ React.isValidElement(child) && child.type === type);
10830
+ function ownerDocument(node) {
10831
+ return node && node.ownerDocument || document;
10704
10832
  }
10705
- const FormCheck = /* @__PURE__ */ React.forwardRef(({
10706
- id,
10707
- bsPrefix,
10708
- bsSwitchPrefix,
10709
- inline = false,
10710
- reverse = false,
10711
- disabled = false,
10712
- isValid = false,
10713
- isInvalid = false,
10714
- feedbackTooltip = false,
10715
- feedback,
10716
- feedbackType,
10717
- className,
10718
- style: style2,
10719
- title = "",
10720
- type = "checkbox",
10721
- label,
10722
- children,
10723
- // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
10724
- as = "input",
10725
- ...props
10726
- }, ref) => {
10727
- bsPrefix = useBootstrapPrefix(bsPrefix, "form-check");
10728
- bsSwitchPrefix = useBootstrapPrefix(bsSwitchPrefix, "form-switch");
10729
- const {
10730
- controlId
10731
- } = useContext(FormContext);
10732
- const innerFormContext = useMemo(() => ({
10733
- controlId: id || controlId
10734
- }), [controlId, id]);
10735
- const hasLabel = !children && label != null && label !== false || hasChildOfType(children, FormCheckLabel);
10736
- const input = /* @__PURE__ */ jsxRuntimeExports.jsx(FormCheckInput, {
10737
- ...props,
10738
- type: type === "switch" ? "checkbox" : type,
10739
- ref,
10740
- isValid,
10741
- isInvalid,
10742
- disabled,
10743
- as
10744
- });
10745
- return /* @__PURE__ */ jsxRuntimeExports.jsx(FormContext.Provider, {
10746
- value: innerFormContext,
10747
- children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
10748
- style: style2,
10749
- className: classNames(className, hasLabel && bsPrefix, inline && `${bsPrefix}-inline`, reverse && `${bsPrefix}-reverse`, type === "switch" && bsSwitchPrefix),
10750
- children: children || /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
10751
- children: [input, hasLabel && /* @__PURE__ */ jsxRuntimeExports.jsx(FormCheckLabel, {
10752
- title,
10753
- children: label
10754
- }), feedback && /* @__PURE__ */ jsxRuntimeExports.jsx(Feedback, {
10755
- type: feedbackType,
10756
- tooltip: feedbackTooltip,
10757
- children: feedback
10758
- })]
10759
- })
10760
- })
10761
- });
10762
- });
10763
- FormCheck.displayName = "FormCheck";
10764
- const FormCheck$1 = Object.assign(FormCheck, {
10765
- Input: FormCheckInput,
10766
- Label: FormCheckLabel
10767
- });
10768
- var warning_1;
10769
- var hasRequiredWarning;
10770
- function requireWarning() {
10771
- if (hasRequiredWarning) return warning_1;
10772
- hasRequiredWarning = 1;
10773
- var __DEV__ = process.env.NODE_ENV !== "production";
10774
- var warning2 = function() {
10775
- };
10776
- if (__DEV__) {
10777
- var printWarning = function printWarning2(format, args) {
10778
- var len = arguments.length;
10779
- args = new Array(len > 1 ? len - 1 : 0);
10780
- for (var key = 1; key < len; key++) {
10781
- args[key - 1] = arguments[key];
10782
- }
10783
- var argIndex = 0;
10784
- var message = "Warning: " + format.replace(/%s/g, function() {
10785
- return args[argIndex++];
10786
- });
10787
- if (typeof console !== "undefined") {
10788
- console.error(message);
10789
- }
10790
- try {
10791
- throw new Error(message);
10792
- } catch (x) {
10793
- }
10794
- };
10795
- warning2 = function(condition, format, args) {
10796
- var len = arguments.length;
10797
- args = new Array(len > 2 ? len - 2 : 0);
10798
- for (var key = 2; key < len; key++) {
10799
- args[key - 2] = arguments[key];
10800
- }
10801
- if (format === void 0) {
10802
- throw new Error(
10803
- "`warning(condition, format, ...args)` requires a warning message argument"
10804
- );
10805
- }
10806
- if (!condition) {
10807
- printWarning.apply(null, [format].concat(args));
10808
- }
10809
- };
10810
- }
10811
- warning_1 = warning2;
10812
- return warning_1;
10833
+ function ownerWindow(node) {
10834
+ var doc = ownerDocument(node);
10835
+ return doc && doc.defaultView || window;
10813
10836
  }
10814
- var warningExports = requireWarning();
10815
- const warning = /* @__PURE__ */ getDefaultExportFromCjs(warningExports);
10816
- const FormControl = /* @__PURE__ */ React.forwardRef(({
10817
- bsPrefix,
10818
- type,
10819
- size,
10820
- htmlSize,
10821
- id,
10822
- className,
10823
- isValid = false,
10824
- isInvalid = false,
10825
- plaintext,
10826
- readOnly,
10827
- // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
10828
- as: Component = "input",
10829
- ...props
10830
- }, ref) => {
10831
- const {
10832
- controlId
10833
- } = useContext(FormContext);
10834
- bsPrefix = useBootstrapPrefix(bsPrefix, "form-control");
10835
- process.env.NODE_ENV !== "production" ? warning(controlId == null || !id, "`controlId` is ignored on `<FormControl>` when `id` is specified.") : void 0;
10836
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Component, {
10837
- ...props,
10838
- type,
10839
- size: htmlSize,
10840
- ref,
10841
- readOnly,
10842
- id: id || controlId,
10843
- className: classNames(className, plaintext ? `${bsPrefix}-plaintext` : bsPrefix, size && `${bsPrefix}-${size}`, type === "color" && `${bsPrefix}-color`, isValid && "is-valid", isInvalid && "is-invalid")
10844
- });
10845
- });
10846
- FormControl.displayName = "FormControl";
10847
- const FormControl$1 = Object.assign(FormControl, {
10848
- Feedback
10849
- });
10850
- const FormFloating = /* @__PURE__ */ React.forwardRef(({
10851
- className,
10852
- bsPrefix,
10853
- as: Component = "div",
10854
- ...props
10855
- }, ref) => {
10856
- bsPrefix = useBootstrapPrefix(bsPrefix, "form-floating");
10857
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Component, {
10858
- ref,
10859
- className: classNames(className, bsPrefix),
10860
- ...props
10861
- });
10862
- });
10863
- FormFloating.displayName = "FormFloating";
10864
- const FormGroup = /* @__PURE__ */ React.forwardRef(({
10865
- controlId,
10866
- // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
10867
- as: Component = "div",
10868
- ...props
10869
- }, ref) => {
10870
- const context2 = useMemo(() => ({
10871
- controlId
10872
- }), [controlId]);
10873
- return /* @__PURE__ */ jsxRuntimeExports.jsx(FormContext.Provider, {
10874
- value: context2,
10875
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Component, {
10876
- ...props,
10877
- ref
10878
- })
10879
- });
10880
- });
10881
- FormGroup.displayName = "FormGroup";
10882
- function useCol({
10883
- as,
10884
- bsPrefix,
10885
- className,
10886
- ...props
10887
- }) {
10888
- bsPrefix = useBootstrapPrefix(bsPrefix, "col");
10889
- const breakpoints = useBootstrapBreakpoints();
10890
- const minBreakpoint = useBootstrapMinBreakpoint();
10891
- const spans = [];
10892
- const classes = [];
10893
- breakpoints.forEach((brkPoint) => {
10894
- const propValue = props[brkPoint];
10895
- delete props[brkPoint];
10896
- let span;
10897
- let offset2;
10898
- let order2;
10899
- if (typeof propValue === "object" && propValue != null) {
10900
- ({
10901
- span,
10902
- offset: offset2,
10903
- order: order2
10904
- } = propValue);
10837
+ function getComputedStyle(node, psuedoElement) {
10838
+ return ownerWindow(node).getComputedStyle(node, psuedoElement);
10839
+ }
10840
+ var rUpper = /([A-Z])/g;
10841
+ function hyphenate(string) {
10842
+ return string.replace(rUpper, "-$1").toLowerCase();
10843
+ }
10844
+ var msPattern = /^ms-/;
10845
+ function hyphenateStyleName(string) {
10846
+ return hyphenate(string).replace(msPattern, "-ms-");
10847
+ }
10848
+ var supportedTransforms = /^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i;
10849
+ function isTransform(value) {
10850
+ return !!(value && supportedTransforms.test(value));
10851
+ }
10852
+ function style(node, property) {
10853
+ var css = "";
10854
+ var transforms = "";
10855
+ if (typeof property === "string") {
10856
+ return node.style.getPropertyValue(hyphenateStyleName(property)) || getComputedStyle(node).getPropertyValue(hyphenateStyleName(property));
10857
+ }
10858
+ Object.keys(property).forEach(function(key) {
10859
+ var value = property[key];
10860
+ if (!value && value !== 0) {
10861
+ node.style.removeProperty(hyphenateStyleName(key));
10862
+ } else if (isTransform(key)) {
10863
+ transforms += key + "(" + value + ") ";
10905
10864
  } else {
10906
- span = propValue;
10865
+ css += hyphenateStyleName(key) + ": " + value + ";";
10907
10866
  }
10908
- const infix = brkPoint !== minBreakpoint ? `-${brkPoint}` : "";
10909
- if (span) spans.push(span === true ? `${bsPrefix}${infix}` : `${bsPrefix}${infix}-${span}`);
10910
- if (order2 != null) classes.push(`order${infix}-${order2}`);
10911
- if (offset2 != null) classes.push(`offset${infix}-${offset2}`);
10912
10867
  });
10913
- return [{
10914
- ...props,
10915
- className: classNames(className, ...spans, ...classes)
10916
- }, {
10917
- as,
10918
- bsPrefix,
10919
- spans
10920
- }];
10868
+ if (transforms) {
10869
+ css += "transform: " + transforms + ";";
10870
+ }
10871
+ node.style.cssText += ";" + css;
10921
10872
  }
10922
- const Col = /* @__PURE__ */ React.forwardRef(
10923
- // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
10924
- (props, ref) => {
10925
- const [{
10926
- className,
10927
- ...colProps
10928
- }, {
10929
- as: Component = "div",
10930
- bsPrefix,
10931
- spans
10932
- }] = useCol(props);
10933
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Component, {
10934
- ...colProps,
10935
- ref,
10936
- className: classNames(className, !spans.length && bsPrefix)
10937
- });
10873
+ function isEscKey(e) {
10874
+ return e.code === "Escape" || e.keyCode === 27;
10875
+ }
10876
+ function getReactVersion() {
10877
+ const parts = React.version.split(".");
10878
+ return {
10879
+ major: +parts[0],
10880
+ minor: +parts[1],
10881
+ patch: +parts[2]
10882
+ };
10883
+ }
10884
+ function getChildRef(element) {
10885
+ if (!element || typeof element === "function") {
10886
+ return null;
10938
10887
  }
10939
- );
10940
- Col.displayName = "Col";
10941
- const FormLabel = /* @__PURE__ */ React.forwardRef(({
10942
- // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
10943
- as: Component = "label",
10944
- bsPrefix,
10945
- column = false,
10946
- visuallyHidden = false,
10947
- className,
10948
- htmlFor,
10949
- ...props
10950
- }, ref) => {
10951
10888
  const {
10952
- controlId
10953
- } = useContext(FormContext);
10954
- bsPrefix = useBootstrapPrefix(bsPrefix, "form-label");
10955
- let columnClass = "col-form-label";
10956
- if (typeof column === "string") columnClass = `${columnClass} ${columnClass}-${column}`;
10957
- const classes = classNames(className, bsPrefix, visuallyHidden && "visually-hidden", column && columnClass);
10958
- process.env.NODE_ENV !== "production" ? warning(controlId == null || !htmlFor, "`controlId` is ignored on `<FormLabel>` when `htmlFor` is specified.") : void 0;
10959
- htmlFor = htmlFor || controlId;
10960
- if (column) return /* @__PURE__ */ jsxRuntimeExports.jsx(Col, {
10961
- ref,
10962
- as: "label",
10963
- className: classes,
10964
- htmlFor,
10965
- ...props
10966
- });
10967
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Component, {
10968
- ref,
10969
- className: classes,
10970
- htmlFor,
10971
- ...props
10889
+ major
10890
+ } = getReactVersion();
10891
+ const childRef = major >= 19 ? element.props.ref : element.ref;
10892
+ return childRef;
10893
+ }
10894
+ const canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);
10895
+ var optionsSupported = false;
10896
+ var onceSupported = false;
10897
+ try {
10898
+ var options = {
10899
+ get passive() {
10900
+ return optionsSupported = true;
10901
+ },
10902
+ get once() {
10903
+ return onceSupported = optionsSupported = true;
10904
+ }
10905
+ };
10906
+ if (canUseDOM) {
10907
+ window.addEventListener("test", options, options);
10908
+ window.removeEventListener("test", options, true);
10909
+ }
10910
+ } catch (e) {
10911
+ }
10912
+ function addEventListener(node, eventName, handler, options) {
10913
+ if (options && typeof options !== "boolean" && !onceSupported) {
10914
+ var once = options.once, capture = options.capture;
10915
+ var wrappedHandler = handler;
10916
+ if (!onceSupported && once) {
10917
+ wrappedHandler = handler.__once || function onceHandler(event) {
10918
+ this.removeEventListener(eventName, onceHandler, capture);
10919
+ handler.call(this, event);
10920
+ };
10921
+ handler.__once = wrappedHandler;
10922
+ }
10923
+ node.addEventListener(eventName, wrappedHandler, optionsSupported ? options : capture);
10924
+ }
10925
+ node.addEventListener(eventName, handler, options);
10926
+ }
10927
+ function removeEventListener(node, eventName, handler, options) {
10928
+ var capture = options && typeof options !== "boolean" ? options.capture : options;
10929
+ node.removeEventListener(eventName, handler, capture);
10930
+ if (handler.__once) {
10931
+ node.removeEventListener(eventName, handler.__once, capture);
10932
+ }
10933
+ }
10934
+ function listen(node, eventName, handler, options) {
10935
+ addEventListener(node, eventName, handler, options);
10936
+ return function() {
10937
+ removeEventListener(node, eventName, handler, options);
10938
+ };
10939
+ }
10940
+ function triggerEvent(node, eventName, bubbles, cancelable) {
10941
+ if (cancelable === void 0) {
10942
+ cancelable = true;
10943
+ }
10944
+ if (node) {
10945
+ var event = document.createEvent("HTMLEvents");
10946
+ event.initEvent(eventName, bubbles, cancelable);
10947
+ node.dispatchEvent(event);
10948
+ }
10949
+ }
10950
+ function parseDuration$1(node) {
10951
+ var str = style(node, "transitionDuration") || "";
10952
+ var mult = str.indexOf("ms") === -1 ? 1e3 : 1;
10953
+ return parseFloat(str) * mult;
10954
+ }
10955
+ function emulateTransitionEnd(element, duration2, padding2) {
10956
+ if (padding2 === void 0) {
10957
+ padding2 = 5;
10958
+ }
10959
+ var called = false;
10960
+ var handle = setTimeout(function() {
10961
+ if (!called) triggerEvent(element, "transitionend", true);
10962
+ }, duration2 + padding2);
10963
+ var remove = listen(element, "transitionend", function() {
10964
+ called = true;
10965
+ }, {
10966
+ once: true
10972
10967
  });
10973
- });
10974
- FormLabel.displayName = "FormLabel";
10975
- const FormRange = /* @__PURE__ */ React.forwardRef(({
10976
- bsPrefix,
10977
- className,
10978
- id,
10968
+ return function() {
10969
+ clearTimeout(handle);
10970
+ remove();
10971
+ };
10972
+ }
10973
+ function transitionEnd(element, handler, duration2, padding2) {
10974
+ if (duration2 == null) duration2 = parseDuration$1(element) || 0;
10975
+ var removeEmulate = emulateTransitionEnd(element, duration2, padding2);
10976
+ var remove = listen(element, "transitionend", handler);
10977
+ return function() {
10978
+ removeEmulate();
10979
+ remove();
10980
+ };
10981
+ }
10982
+ function parseDuration(node, property) {
10983
+ const str = style(node, property) || "";
10984
+ const mult = str.indexOf("ms") === -1 ? 1e3 : 1;
10985
+ return parseFloat(str) * mult;
10986
+ }
10987
+ function transitionEndListener(element, handler) {
10988
+ const duration2 = parseDuration(element, "transitionDuration");
10989
+ const delay = parseDuration(element, "transitionDelay");
10990
+ const remove = transitionEnd(element, (e) => {
10991
+ if (e.target === element) {
10992
+ remove();
10993
+ handler(e);
10994
+ }
10995
+ }, duration2 + delay);
10996
+ }
10997
+ function triggerBrowserReflow(node) {
10998
+ node.offsetHeight;
10999
+ }
11000
+ const toFnRef$1 = (ref) => !ref || typeof ref === "function" ? ref : (value) => {
11001
+ ref.current = value;
11002
+ };
11003
+ function mergeRefs$1(refA, refB) {
11004
+ const a = toFnRef$1(refA);
11005
+ const b = toFnRef$1(refB);
11006
+ return (value) => {
11007
+ if (a) a(value);
11008
+ if (b) b(value);
11009
+ };
11010
+ }
11011
+ function useMergedRefs$1(refA, refB) {
11012
+ return useMemo(() => mergeRefs$1(refA, refB), [refA, refB]);
11013
+ }
11014
+ function safeFindDOMNode(componentOrElement) {
11015
+ if (componentOrElement && "setState" in componentOrElement) {
11016
+ return ReactDOM.findDOMNode(componentOrElement);
11017
+ }
11018
+ return componentOrElement != null ? componentOrElement : null;
11019
+ }
11020
+ const TransitionWrapper = /* @__PURE__ */ React__default.forwardRef(({
11021
+ onEnter,
11022
+ onEntering,
11023
+ onEntered,
11024
+ onExit,
11025
+ onExiting,
11026
+ onExited,
11027
+ addEndListener,
11028
+ children,
11029
+ childRef,
10979
11030
  ...props
10980
11031
  }, ref) => {
10981
- const {
10982
- controlId
10983
- } = useContext(FormContext);
10984
- bsPrefix = useBootstrapPrefix(bsPrefix, "form-range");
10985
- return /* @__PURE__ */ jsxRuntimeExports.jsx("input", {
10986
- ...props,
10987
- type: "range",
11032
+ const nodeRef = useRef(null);
11033
+ const mergedRef = useMergedRefs$1(nodeRef, childRef);
11034
+ const attachRef = (r2) => {
11035
+ mergedRef(safeFindDOMNode(r2));
11036
+ };
11037
+ const normalize = (callback) => (param) => {
11038
+ if (callback && nodeRef.current) {
11039
+ callback(nodeRef.current, param);
11040
+ }
11041
+ };
11042
+ const handleEnter = useCallback(normalize(onEnter), [onEnter]);
11043
+ const handleEntering = useCallback(normalize(onEntering), [onEntering]);
11044
+ const handleEntered = useCallback(normalize(onEntered), [onEntered]);
11045
+ const handleExit = useCallback(normalize(onExit), [onExit]);
11046
+ const handleExiting = useCallback(normalize(onExiting), [onExiting]);
11047
+ const handleExited = useCallback(normalize(onExited), [onExited]);
11048
+ const handleAddEndListener = useCallback(normalize(addEndListener), [addEndListener]);
11049
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Transition, {
10988
11050
  ref,
10989
- className: classNames(className, bsPrefix),
10990
- id: id || controlId
10991
- });
10992
- });
10993
- FormRange.displayName = "FormRange";
10994
- const FormSelect = /* @__PURE__ */ React.forwardRef(({
10995
- bsPrefix,
10996
- size,
10997
- htmlSize,
10998
- className,
10999
- isValid = false,
11000
- isInvalid = false,
11001
- id,
11002
- ...props
11003
- }, ref) => {
11004
- const {
11005
- controlId
11006
- } = useContext(FormContext);
11007
- bsPrefix = useBootstrapPrefix(bsPrefix, "form-select");
11008
- return /* @__PURE__ */ jsxRuntimeExports.jsx("select", {
11009
11051
  ...props,
11010
- size: htmlSize,
11011
- ref,
11012
- className: classNames(className, bsPrefix, size && `${bsPrefix}-${size}`, isValid && `is-valid`, isInvalid && `is-invalid`),
11013
- id: id || controlId
11052
+ onEnter: handleEnter,
11053
+ onEntered: handleEntered,
11054
+ onEntering: handleEntering,
11055
+ onExit: handleExit,
11056
+ onExited: handleExited,
11057
+ onExiting: handleExiting,
11058
+ addEndListener: handleAddEndListener,
11059
+ nodeRef,
11060
+ children: typeof children === "function" ? (status, innerProps) => (
11061
+ // TODO: Types for RTG missing innerProps, so need to cast.
11062
+ children(status, {
11063
+ ...innerProps,
11064
+ ref: attachRef
11065
+ })
11066
+ ) : /* @__PURE__ */ React__default.cloneElement(children, {
11067
+ ref: attachRef
11068
+ })
11014
11069
  });
11015
11070
  });
11016
- FormSelect.displayName = "FormSelect";
11017
- const FormText = /* @__PURE__ */ React.forwardRef(
11018
- // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
11019
- ({
11020
- bsPrefix,
11021
- className,
11022
- as: Component = "small",
11023
- muted,
11024
- ...props
11025
- }, ref) => {
11026
- bsPrefix = useBootstrapPrefix(bsPrefix, "form-text");
11027
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Component, {
11028
- ...props,
11029
- ref,
11030
- className: classNames(className, bsPrefix, muted && "text-muted")
11031
- });
11032
- }
11033
- );
11034
- FormText.displayName = "FormText";
11035
- const Switch = /* @__PURE__ */ React.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx(FormCheck$1, {
11036
- ...props,
11037
- ref,
11038
- type: "switch"
11039
- }));
11040
- Switch.displayName = "Switch";
11041
- const Switch$1 = Object.assign(Switch, {
11042
- Input: FormCheck$1.Input,
11043
- Label: FormCheck$1.Label
11044
- });
11045
- const FloatingLabel = /* @__PURE__ */ React.forwardRef(({
11046
- bsPrefix,
11071
+ TransitionWrapper.displayName = "TransitionWrapper";
11072
+ function useCommittedRef$1(value) {
11073
+ const ref = useRef(value);
11074
+ useEffect(() => {
11075
+ ref.current = value;
11076
+ }, [value]);
11077
+ return ref;
11078
+ }
11079
+ function useEventCallback$1(fn2) {
11080
+ const ref = useCommittedRef$1(fn2);
11081
+ return useCallback(function(...args) {
11082
+ return ref.current && ref.current(...args);
11083
+ }, [ref]);
11084
+ }
11085
+ function useCallbackRef() {
11086
+ return useState(null);
11087
+ }
11088
+ function useCommittedRef(value) {
11089
+ const ref = useRef(value);
11090
+ useEffect(() => {
11091
+ ref.current = value;
11092
+ }, [value]);
11093
+ return ref;
11094
+ }
11095
+ function useEventCallback(fn2) {
11096
+ const ref = useCommittedRef(fn2);
11097
+ return useCallback(function(...args) {
11098
+ return ref.current && ref.current(...args);
11099
+ }, [ref]);
11100
+ }
11101
+ function useMounted$1() {
11102
+ const mounted = useRef(true);
11103
+ const isMounted = useRef(() => mounted.current);
11104
+ useEffect(() => {
11105
+ mounted.current = true;
11106
+ return () => {
11107
+ mounted.current = false;
11108
+ };
11109
+ }, []);
11110
+ return isMounted.current;
11111
+ }
11112
+ const isReactNative$1 = typeof global !== "undefined" && // @ts-ignore
11113
+ global.navigator && // @ts-ignore
11114
+ global.navigator.product === "ReactNative";
11115
+ const isDOM$1 = typeof document !== "undefined";
11116
+ const useIsomorphicEffect$1 = isDOM$1 || isReactNative$1 ? useLayoutEffect : useEffect;
11117
+ const fadeStyles = {
11118
+ [ENTERING]: "show",
11119
+ [ENTERED]: "show"
11120
+ };
11121
+ const Fade = /* @__PURE__ */ React.forwardRef(({
11047
11122
  className,
11048
11123
  children,
11049
- controlId,
11050
- label,
11051
- ...props
11124
+ transitionClasses = {},
11125
+ onEnter,
11126
+ ...rest
11052
11127
  }, ref) => {
11053
- bsPrefix = useBootstrapPrefix(bsPrefix, "form-floating");
11054
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(FormGroup, {
11128
+ const props = {
11129
+ in: false,
11130
+ timeout: 300,
11131
+ mountOnEnter: false,
11132
+ unmountOnExit: false,
11133
+ appear: false,
11134
+ ...rest
11135
+ };
11136
+ const handleEnter = useCallback((node, isAppearing) => {
11137
+ triggerBrowserReflow(node);
11138
+ onEnter == null || onEnter(node, isAppearing);
11139
+ }, [onEnter]);
11140
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(TransitionWrapper, {
11055
11141
  ref,
11056
- className: classNames(className, bsPrefix),
11057
- controlId,
11142
+ addEndListener: transitionEndListener,
11058
11143
  ...props,
11059
- children: [children, /* @__PURE__ */ jsxRuntimeExports.jsx("label", {
11060
- htmlFor: controlId,
11061
- children: label
11062
- })]
11144
+ onEnter: handleEnter,
11145
+ childRef: getChildRef(children),
11146
+ children: (status, innerProps) => /* @__PURE__ */ React.cloneElement(children, {
11147
+ ...innerProps,
11148
+ className: classNames("fade", className, children.props.className, fadeStyles[status], transitionClasses[status])
11149
+ })
11063
11150
  });
11064
11151
  });
11065
- FloatingLabel.displayName = "FloatingLabel";
11066
- const propTypes = {
11067
- /**
11068
- * The Form `ref` will be forwarded to the underlying element,
11069
- * which means, unless it's rendered `as` a composite component,
11070
- * it will be a DOM node, when resolved.
11071
- *
11072
- * @type {ReactRef}
11073
- * @alias ref
11074
- */
11075
- _ref: PropTypes.any,
11076
- /**
11077
- * Mark a form as having been validated. Setting it to `true` will
11078
- * toggle any validation styles on the forms elements.
11079
- */
11080
- validated: PropTypes.bool,
11081
- as: PropTypes.elementType
11082
- };
11083
- const Form = /* @__PURE__ */ React.forwardRef(({
11084
- className,
11085
- validated,
11086
- // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
11087
- as: Component = "form",
11088
- ...props
11089
- }, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx(Component, {
11090
- ...props,
11091
- ref,
11092
- className: classNames(className, validated && "was-validated")
11093
- }));
11094
- Form.displayName = "Form";
11095
- Form.propTypes = propTypes;
11096
- const Form$1 = Object.assign(Form, {
11097
- Group: FormGroup,
11098
- Control: FormControl$1,
11099
- Floating: FormFloating,
11100
- Check: FormCheck$1,
11101
- Switch: Switch$1,
11102
- Label: FormLabel,
11103
- Text: FormText,
11104
- Range: FormRange,
11105
- Select: FormSelect,
11106
- FloatingLabel
11107
- });
11108
- function FaCheck(props) {
11109
- return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z" }, "child": [] }] })(props);
11152
+ Fade.displayName = "Fade";
11153
+ function useMounted() {
11154
+ const mounted = useRef(true);
11155
+ const isMounted = useRef(() => mounted.current);
11156
+ useEffect(() => {
11157
+ mounted.current = true;
11158
+ return () => {
11159
+ mounted.current = false;
11160
+ };
11161
+ }, []);
11162
+ return isMounted.current;
11110
11163
  }
11111
- function FaChevronDown(props) {
11112
- return GenIcon({ "attr": { "viewBox": "0 0 448 512" }, "child": [{ "tag": "path", "attr": { "d": "M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z" }, "child": [] }] })(props);
11164
+ function useUpdatedRef(value) {
11165
+ const valueRef = useRef(value);
11166
+ valueRef.current = value;
11167
+ return valueRef;
11113
11168
  }
11114
- function FaChevronUp(props) {
11115
- return GenIcon({ "attr": { "viewBox": "0 0 448 512" }, "child": [{ "tag": "path", "attr": { "d": "M240.971 130.524l194.343 194.343c9.373 9.373 9.373 24.569 0 33.941l-22.667 22.667c-9.357 9.357-24.522 9.375-33.901.04L224 227.495 69.255 381.516c-9.379 9.335-24.544 9.317-33.901-.04l-22.667-22.667c-9.373-9.373-9.373-24.569 0-33.941L207.03 130.525c9.372-9.373 24.568-9.373 33.941-.001z" }, "child": [] }] })(props);
11169
+ function useWillUnmount(fn2) {
11170
+ const onUnmount = useUpdatedRef(fn2);
11171
+ useEffect(() => () => onUnmount.current(), []);
11116
11172
  }
11117
- const ComboDropdown = ({
11118
- label,
11119
- options = [],
11120
- placeholder = "",
11121
- onChange,
11122
- name,
11123
- value,
11124
- error,
11125
- disabled,
11126
- height: height2 = "40px",
11127
- isPassword = false,
11128
- mode = "both",
11129
- // 'select' | 'type' | 'both'
11130
- isRequired = false,
11131
- selectedBgColor = "#dee2e6",
11132
- selectedTextColor = "black",
11133
- optionLabelKey = "label",
11134
- optionValueKey = "value"
11135
- }) => {
11136
- const [inputValue, setInputValue] = useState("");
11137
- const [filteredOptions, setFilteredOptions] = useState([]);
11138
- const [showDropdown, setShowDropdown] = useState(false);
11139
- const [highlightIndex, setHighlightIndex] = useState(-1);
11140
- const inputRef = useRef();
11141
- const wrapperRef = useRef();
11142
- useEffect(() => {
11143
- const matchedOption = options.find(
11144
- (opt) => typeof opt === "string" ? opt === value : opt[optionValueKey] === value
11145
- );
11146
- const label2 = typeof matchedOption === "string" ? matchedOption : (matchedOption == null ? void 0 : matchedOption[optionLabelKey]) || "";
11147
- setInputValue(label2);
11148
- if (mode !== "type") {
11149
- setFilteredOptions(normalizeOptions(options));
11150
- }
11151
- }, [value, options]);
11152
- const normalizeOptions = (opts) => {
11153
- return opts.map((opt) => {
11154
- if (typeof opt === "string") {
11155
- return { label: opt, value: opt };
11156
- }
11157
- return {
11158
- label: opt[optionLabelKey],
11159
- value: opt[optionValueKey]
11160
- };
11161
- });
11162
- };
11163
- const handleInputChange = (e) => {
11164
- const val = e.target.value;
11165
- setInputValue(val);
11166
- if (mode !== "select") {
11167
- if (name) onChange(name, val);
11168
- else onChange(val);
11169
- }
11170
- if (mode !== "type") {
11171
- const normalized = normalizeOptions(options);
11172
- const filtered = normalized.filter(
11173
- (opt) => {
11174
- var _a;
11175
- return (_a = opt.label) == null ? void 0 : _a.toLowerCase().includes(val.toLowerCase());
11176
- }
11177
- );
11178
- setFilteredOptions(filtered);
11179
- setShowDropdown(true);
11180
- setHighlightIndex(-1);
11181
- }
11182
- };
11183
- const handleSelect = (val, label2) => {
11184
- setInputValue(label2);
11185
- if (name) {
11186
- onChange(name, val);
11187
- } else {
11188
- onChange(val);
11189
- }
11190
- setShowDropdown(false);
11191
- setHighlightIndex(-1);
11192
- };
11193
- const handleKeyDown = (e) => {
11194
- if (!showDropdown || filteredOptions.length === 0) return;
11195
- if (e.key === "ArrowDown") {
11196
- e.preventDefault();
11197
- setHighlightIndex(
11198
- (prev) => prev < filteredOptions.length - 1 ? prev + 1 : 0
11199
- );
11200
- }
11201
- if (e.key === "ArrowUp") {
11202
- e.preventDefault();
11203
- setHighlightIndex(
11204
- (prev) => prev > 0 ? prev - 1 : filteredOptions.length - 1
11205
- );
11206
- }
11207
- if (e.key === "Enter") {
11208
- e.preventDefault();
11209
- if (highlightIndex >= 0) {
11210
- const selected = filteredOptions[highlightIndex];
11211
- handleSelect(selected.value, selected.label);
11173
+ const MAX_DELAY_MS = 2 ** 31 - 1;
11174
+ function setChainedTimeout(handleRef, fn2, timeoutAtMs) {
11175
+ const delayMs = timeoutAtMs - Date.now();
11176
+ handleRef.current = delayMs <= MAX_DELAY_MS ? setTimeout(fn2, delayMs) : setTimeout(() => setChainedTimeout(handleRef, fn2, timeoutAtMs), MAX_DELAY_MS);
11177
+ }
11178
+ function useTimeout() {
11179
+ const isMounted = useMounted();
11180
+ const handleRef = useRef();
11181
+ useWillUnmount(() => clearTimeout(handleRef.current));
11182
+ return useMemo(() => {
11183
+ const clear = () => clearTimeout(handleRef.current);
11184
+ function set(fn2, delayMs = 0) {
11185
+ if (!isMounted()) return;
11186
+ clear();
11187
+ if (delayMs <= MAX_DELAY_MS) {
11188
+ handleRef.current = setTimeout(fn2, delayMs);
11189
+ } else {
11190
+ setChainedTimeout(handleRef, fn2, Date.now() + delayMs);
11212
11191
  }
11213
11192
  }
11214
- };
11215
- const getPlaceholder = () => {
11216
- if (placeholder) return placeholder;
11217
- if (mode === "select") return "Select an option...";
11218
- if (mode === "type") return "Type a value...";
11219
- return "Select or type...";
11220
- };
11221
- const toggleDropdown = () => {
11222
- if (disabled) return;
11223
- if (!showDropdown && mode !== "type") {
11224
- setFilteredOptions(normalizeOptions(options));
11225
- }
11226
- setShowDropdown((prev) => {
11227
- var _a;
11228
- const willShow = !prev;
11229
- if (willShow) (_a = inputRef.current) == null ? void 0 : _a.focus();
11230
- return willShow;
11231
- });
11232
- };
11233
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(Form$1.Group, { ref: wrapperRef, className: "mb-3 position-relative", children: [
11234
- label && /* @__PURE__ */ jsxRuntimeExports.jsxs(Form$1.Label, { style: { display: "flex", fontWeight: "500", fontSize: "14px", lineHeight: "20px", color: "#212529", textTransform: "capitalize", marginBottom: "0.5rem" }, children: [
11235
- label,
11236
- isRequired && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { color: "red" }, children: "*" })
11237
- ] }),
11238
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "d-flex position-relative", children: [
11239
- /* @__PURE__ */ jsxRuntimeExports.jsx(
11240
- Form$1.Control,
11241
- {
11242
- ref: inputRef,
11243
- type: isPassword ? "password" : "text",
11244
- placeholder: getPlaceholder(),
11245
- style: {
11246
- borderColor: "#12AB5B",
11247
- height: height2,
11248
- paddingRight: "2rem"
11249
- },
11250
- name,
11251
- value: inputValue,
11252
- onChange: handleInputChange,
11253
- onFocus: () => {
11254
- if (mode !== "type") {
11255
- setFilteredOptions(normalizeOptions(options));
11256
- setShowDropdown(true);
11257
- }
11258
- },
11259
- onClick: () => {
11260
- if (mode !== "type") {
11261
- setFilteredOptions(normalizeOptions(options));
11262
- setShowDropdown(true);
11263
- }
11264
- },
11265
- onKeyDown: handleKeyDown,
11266
- isInvalid: !!error,
11267
- disabled,
11268
- readOnly: mode === "select",
11269
- autoComplete: "off"
11270
- }
11271
- ),
11272
- /* @__PURE__ */ jsxRuntimeExports.jsx(
11273
- "div",
11274
- {
11275
- className: "position-absolute end-0 top-0 d-flex align-items-center justify-content-center",
11276
- onMouseDown: (e) => e.preventDefault(),
11277
- onClick: toggleDropdown,
11278
- style: {
11279
- width: "2rem",
11280
- height: height2,
11281
- cursor: "pointer",
11282
- border: "1px solid #12AB5B",
11283
- borderLeft: "none",
11284
- borderTopRightRadius: "0.375rem",
11285
- borderBottomRightRadius: "0.375rem",
11286
- background: "#fff"
11287
- },
11288
- children: showDropdown ? /* @__PURE__ */ jsxRuntimeExports.jsx(FaChevronUp, { size: 12 }) : /* @__PURE__ */ jsxRuntimeExports.jsx(FaChevronDown, { size: 12 })
11289
- }
11290
- )
11291
- ] }),
11292
- showDropdown && filteredOptions.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
11293
- "ul",
11294
- {
11295
- className: "list-group position-absolute w-100 z-3",
11296
- style: { maxHeight: "200px", overflowY: "auto", boxShadow: "5px 5px 15px lightgray" },
11297
- children: filteredOptions.map((opt, index) => {
11298
- const isSelected = opt.value === value;
11299
- const isHighlighted = index === highlightIndex;
11300
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
11301
- "li",
11302
- {
11303
- className: "list-group-item list-group-item-action",
11304
- onMouseDown: (e) => e.preventDefault(),
11305
- onClick: () => handleSelect(opt.value, opt.label),
11306
- style: {
11307
- cursor: "pointer",
11308
- fontSize: "12px",
11309
- textAlign: "left",
11310
- backgroundColor: isHighlighted ? "#e9ecef" : isSelected ? selectedBgColor : "white",
11311
- color: isSelected ? selectedTextColor : "black",
11312
- padding: "8px 12px"
11313
- },
11314
- children: opt.label
11315
- },
11316
- index
11317
- );
11318
- })
11319
- }
11320
- ),
11321
- error && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "invalid-feedback d-block", children: error })
11322
- ] });
11323
- };
11324
- function useUncontrolledProp(propValue, defaultValue, handler) {
11325
- var wasPropRef = useRef(propValue !== void 0);
11326
- var _useState = useState(defaultValue), stateValue = _useState[0], setState = _useState[1];
11327
- var isProp = propValue !== void 0;
11328
- var wasProp = wasPropRef.current;
11329
- wasPropRef.current = isProp;
11330
- if (!isProp && wasProp && stateValue !== defaultValue) {
11331
- setState(defaultValue);
11332
- }
11333
- return [isProp ? propValue : stateValue, useCallback(function(value) {
11334
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
11335
- args[_key - 1] = arguments[_key];
11336
- }
11337
- if (handler) handler.apply(void 0, [value].concat(args));
11338
- setState(value);
11339
- }, [handler])];
11340
- }
11341
- function ownerDocument(node) {
11342
- return node && node.ownerDocument || document;
11343
- }
11344
- function ownerWindow(node) {
11345
- var doc = ownerDocument(node);
11346
- return doc && doc.defaultView || window;
11347
- }
11348
- function getComputedStyle(node, psuedoElement) {
11349
- return ownerWindow(node).getComputedStyle(node, psuedoElement);
11350
- }
11351
- var rUpper = /([A-Z])/g;
11352
- function hyphenate(string) {
11353
- return string.replace(rUpper, "-$1").toLowerCase();
11354
- }
11355
- var msPattern = /^ms-/;
11356
- function hyphenateStyleName(string) {
11357
- return hyphenate(string).replace(msPattern, "-ms-");
11193
+ return {
11194
+ set,
11195
+ clear,
11196
+ handleRef
11197
+ };
11198
+ }, []);
11358
11199
  }
11359
- var supportedTransforms = /^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i;
11360
- function isTransform(value) {
11361
- return !!(value && supportedTransforms.test(value));
11200
+ function hasChildOfType(children, type) {
11201
+ return React.Children.toArray(children).some((child) => /* @__PURE__ */ React.isValidElement(child) && child.type === type);
11362
11202
  }
11363
- function style(node, property) {
11364
- var css = "";
11365
- var transforms = "";
11366
- if (typeof property === "string") {
11367
- return node.style.getPropertyValue(hyphenateStyleName(property)) || getComputedStyle(node).getPropertyValue(hyphenateStyleName(property));
11368
- }
11369
- Object.keys(property).forEach(function(key) {
11370
- var value = property[key];
11371
- if (!value && value !== 0) {
11372
- node.style.removeProperty(hyphenateStyleName(key));
11373
- } else if (isTransform(key)) {
11374
- transforms += key + "(" + value + ") ";
11203
+ function useCol({
11204
+ as,
11205
+ bsPrefix,
11206
+ className,
11207
+ ...props
11208
+ }) {
11209
+ bsPrefix = useBootstrapPrefix(bsPrefix, "col");
11210
+ const breakpoints = useBootstrapBreakpoints();
11211
+ const minBreakpoint = useBootstrapMinBreakpoint();
11212
+ const spans = [];
11213
+ const classes = [];
11214
+ breakpoints.forEach((brkPoint) => {
11215
+ const propValue = props[brkPoint];
11216
+ delete props[brkPoint];
11217
+ let span;
11218
+ let offset2;
11219
+ let order2;
11220
+ if (typeof propValue === "object" && propValue != null) {
11221
+ ({
11222
+ span,
11223
+ offset: offset2,
11224
+ order: order2
11225
+ } = propValue);
11375
11226
  } else {
11376
- css += hyphenateStyleName(key) + ": " + value + ";";
11227
+ span = propValue;
11377
11228
  }
11229
+ const infix = brkPoint !== minBreakpoint ? `-${brkPoint}` : "";
11230
+ if (span) spans.push(span === true ? `${bsPrefix}${infix}` : `${bsPrefix}${infix}-${span}`);
11231
+ if (order2 != null) classes.push(`order${infix}-${order2}`);
11232
+ if (offset2 != null) classes.push(`offset${infix}-${offset2}`);
11378
11233
  });
11379
- if (transforms) {
11380
- css += "transform: " + transforms + ";";
11381
- }
11382
- node.style.cssText += ";" + css;
11383
- }
11384
- function isEscKey(e) {
11385
- return e.code === "Escape" || e.keyCode === 27;
11386
- }
11387
- function getReactVersion() {
11388
- const parts = React.version.split(".");
11389
- return {
11390
- major: +parts[0],
11391
- minor: +parts[1],
11392
- patch: +parts[2]
11393
- };
11234
+ return [{
11235
+ ...props,
11236
+ className: classNames(className, ...spans, ...classes)
11237
+ }, {
11238
+ as,
11239
+ bsPrefix,
11240
+ spans
11241
+ }];
11394
11242
  }
11395
- function getChildRef(element) {
11396
- if (!element || typeof element === "function") {
11397
- return null;
11243
+ const Col = /* @__PURE__ */ React.forwardRef(
11244
+ // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
11245
+ (props, ref) => {
11246
+ const [{
11247
+ className,
11248
+ ...colProps
11249
+ }, {
11250
+ as: Component = "div",
11251
+ bsPrefix,
11252
+ spans
11253
+ }] = useCol(props);
11254
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Component, {
11255
+ ...colProps,
11256
+ ref,
11257
+ className: classNames(className, !spans.length && bsPrefix)
11258
+ });
11398
11259
  }
11399
- const {
11400
- major
11401
- } = getReactVersion();
11402
- const childRef = major >= 19 ? element.props.ref : element.ref;
11403
- return childRef;
11404
- }
11405
- const canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);
11406
- var optionsSupported = false;
11407
- var onceSupported = false;
11408
- try {
11409
- var options = {
11410
- get passive() {
11411
- return optionsSupported = true;
11412
- },
11413
- get once() {
11414
- return onceSupported = optionsSupported = true;
11415
- }
11416
- };
11417
- if (canUseDOM) {
11418
- window.addEventListener("test", options, options);
11419
- window.removeEventListener("test", options, true);
11260
+ );
11261
+ Col.displayName = "Col";
11262
+ var has = Object.prototype.hasOwnProperty;
11263
+ function find(iter, tar, key) {
11264
+ for (key of iter.keys()) {
11265
+ if (dequal(key, tar)) return key;
11420
11266
  }
11421
- } catch (e) {
11422
11267
  }
11423
- function addEventListener(node, eventName, handler, options) {
11424
- if (options && typeof options !== "boolean" && !onceSupported) {
11425
- var once = options.once, capture = options.capture;
11426
- var wrappedHandler = handler;
11427
- if (!onceSupported && once) {
11428
- wrappedHandler = handler.__once || function onceHandler(event) {
11429
- this.removeEventListener(eventName, onceHandler, capture);
11430
- handler.call(this, event);
11431
- };
11432
- handler.__once = wrappedHandler;
11268
+ function dequal(foo, bar) {
11269
+ var ctor, len, tmp;
11270
+ if (foo === bar) return true;
11271
+ if (foo && bar && (ctor = foo.constructor) === bar.constructor) {
11272
+ if (ctor === Date) return foo.getTime() === bar.getTime();
11273
+ if (ctor === RegExp) return foo.toString() === bar.toString();
11274
+ if (ctor === Array) {
11275
+ if ((len = foo.length) === bar.length) {
11276
+ while (len-- && dequal(foo[len], bar[len])) ;
11277
+ }
11278
+ return len === -1;
11279
+ }
11280
+ if (ctor === Set) {
11281
+ if (foo.size !== bar.size) {
11282
+ return false;
11283
+ }
11284
+ for (len of foo) {
11285
+ tmp = len;
11286
+ if (tmp && typeof tmp === "object") {
11287
+ tmp = find(bar, tmp);
11288
+ if (!tmp) return false;
11289
+ }
11290
+ if (!bar.has(tmp)) return false;
11291
+ }
11292
+ return true;
11293
+ }
11294
+ if (ctor === Map) {
11295
+ if (foo.size !== bar.size) {
11296
+ return false;
11297
+ }
11298
+ for (len of foo) {
11299
+ tmp = len[0];
11300
+ if (tmp && typeof tmp === "object") {
11301
+ tmp = find(bar, tmp);
11302
+ if (!tmp) return false;
11303
+ }
11304
+ if (!dequal(len[1], bar.get(tmp))) {
11305
+ return false;
11306
+ }
11307
+ }
11308
+ return true;
11309
+ }
11310
+ if (ctor === ArrayBuffer) {
11311
+ foo = new Uint8Array(foo);
11312
+ bar = new Uint8Array(bar);
11313
+ } else if (ctor === DataView) {
11314
+ if ((len = foo.byteLength) === bar.byteLength) {
11315
+ while (len-- && foo.getInt8(len) === bar.getInt8(len)) ;
11316
+ }
11317
+ return len === -1;
11318
+ }
11319
+ if (ArrayBuffer.isView(foo)) {
11320
+ if ((len = foo.byteLength) === bar.byteLength) {
11321
+ while (len-- && foo[len] === bar[len]) ;
11322
+ }
11323
+ return len === -1;
11324
+ }
11325
+ if (!ctor || typeof foo === "object") {
11326
+ len = 0;
11327
+ for (ctor in foo) {
11328
+ if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
11329
+ if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;
11330
+ }
11331
+ return Object.keys(bar).length === len;
11433
11332
  }
11434
- node.addEventListener(eventName, wrappedHandler, optionsSupported ? options : capture);
11435
- }
11436
- node.addEventListener(eventName, handler, options);
11437
- }
11438
- function removeEventListener(node, eventName, handler, options) {
11439
- var capture = options && typeof options !== "boolean" ? options.capture : options;
11440
- node.removeEventListener(eventName, handler, capture);
11441
- if (handler.__once) {
11442
- node.removeEventListener(eventName, handler.__once, capture);
11443
- }
11444
- }
11445
- function listen(node, eventName, handler, options) {
11446
- addEventListener(node, eventName, handler, options);
11447
- return function() {
11448
- removeEventListener(node, eventName, handler, options);
11449
- };
11450
- }
11451
- function triggerEvent(node, eventName, bubbles, cancelable) {
11452
- if (cancelable === void 0) {
11453
- cancelable = true;
11454
- }
11455
- if (node) {
11456
- var event = document.createEvent("HTMLEvents");
11457
- event.initEvent(eventName, bubbles, cancelable);
11458
- node.dispatchEvent(event);
11459
11333
  }
11334
+ return foo !== foo && bar !== bar;
11460
11335
  }
11461
- function parseDuration$1(node) {
11462
- var str = style(node, "transitionDuration") || "";
11463
- var mult = str.indexOf("ms") === -1 ? 1e3 : 1;
11464
- return parseFloat(str) * mult;
11336
+ function useSafeState(state) {
11337
+ const isMounted = useMounted$1();
11338
+ return [state[0], useCallback((nextState) => {
11339
+ if (!isMounted()) return;
11340
+ return state[1](nextState);
11341
+ }, [isMounted, state[1]])];
11465
11342
  }
11466
- function emulateTransitionEnd(element, duration2, padding2) {
11467
- if (padding2 === void 0) {
11468
- padding2 = 5;
11343
+ const createPopper = popperGenerator({
11344
+ defaultModifiers: [hide$1, popperOffsets$1, computeStyles$1, eventListeners, offset$1, flip$1, preventOverflow$1, arrow$1]
11345
+ });
11346
+ const _excluded$2 = ["enabled", "placement", "strategy", "modifiers"];
11347
+ function _objectWithoutPropertiesLoose$2(r2, e) {
11348
+ if (null == r2) return {};
11349
+ var t = {};
11350
+ for (var n in r2) if ({}.hasOwnProperty.call(r2, n)) {
11351
+ if (e.indexOf(n) >= 0) continue;
11352
+ t[n] = r2[n];
11469
11353
  }
11470
- var called = false;
11471
- var handle = setTimeout(function() {
11472
- if (!called) triggerEvent(element, "transitionend", true);
11473
- }, duration2 + padding2);
11474
- var remove = listen(element, "transitionend", function() {
11475
- called = true;
11476
- }, {
11477
- once: true
11478
- });
11479
- return function() {
11480
- clearTimeout(handle);
11481
- remove();
11482
- };
11483
- }
11484
- function transitionEnd(element, handler, duration2, padding2) {
11485
- if (duration2 == null) duration2 = parseDuration$1(element) || 0;
11486
- var removeEmulate = emulateTransitionEnd(element, duration2, padding2);
11487
- var remove = listen(element, "transitionend", handler);
11488
- return function() {
11489
- removeEmulate();
11490
- remove();
11491
- };
11492
- }
11493
- function parseDuration(node, property) {
11494
- const str = style(node, property) || "";
11495
- const mult = str.indexOf("ms") === -1 ? 1e3 : 1;
11496
- return parseFloat(str) * mult;
11497
- }
11498
- function transitionEndListener(element, handler) {
11499
- const duration2 = parseDuration(element, "transitionDuration");
11500
- const delay = parseDuration(element, "transitionDelay");
11501
- const remove = transitionEnd(element, (e) => {
11502
- if (e.target === element) {
11503
- remove();
11504
- handler(e);
11505
- }
11506
- }, duration2 + delay);
11507
- }
11508
- function triggerBrowserReflow(node) {
11509
- node.offsetHeight;
11354
+ return t;
11510
11355
  }
11511
- const toFnRef$1 = (ref) => !ref || typeof ref === "function" ? ref : (value) => {
11512
- ref.current = value;
11356
+ const disabledApplyStylesModifier = {
11357
+ name: "applyStyles",
11358
+ enabled: false,
11359
+ phase: "afterWrite",
11360
+ fn: () => void 0
11513
11361
  };
11514
- function mergeRefs$1(refA, refB) {
11515
- const a = toFnRef$1(refA);
11516
- const b = toFnRef$1(refB);
11517
- return (value) => {
11518
- if (a) a(value);
11519
- if (b) b(value);
11520
- };
11521
- }
11522
- function useMergedRefs$1(refA, refB) {
11523
- return useMemo(() => mergeRefs$1(refA, refB), [refA, refB]);
11524
- }
11525
- function safeFindDOMNode(componentOrElement) {
11526
- if (componentOrElement && "setState" in componentOrElement) {
11527
- return ReactDOM.findDOMNode(componentOrElement);
11362
+ const ariaDescribedByModifier = {
11363
+ name: "ariaDescribedBy",
11364
+ enabled: true,
11365
+ phase: "afterWrite",
11366
+ effect: ({
11367
+ state
11368
+ }) => () => {
11369
+ const {
11370
+ reference: reference2,
11371
+ popper: popper2
11372
+ } = state.elements;
11373
+ if ("removeAttribute" in reference2) {
11374
+ const ids = (reference2.getAttribute("aria-describedby") || "").split(",").filter((id) => id.trim() !== popper2.id);
11375
+ if (!ids.length) reference2.removeAttribute("aria-describedby");
11376
+ else reference2.setAttribute("aria-describedby", ids.join(","));
11377
+ }
11378
+ },
11379
+ fn: ({
11380
+ state
11381
+ }) => {
11382
+ var _popper$getAttribute;
11383
+ const {
11384
+ popper: popper2,
11385
+ reference: reference2
11386
+ } = state.elements;
11387
+ const role = (_popper$getAttribute = popper2.getAttribute("role")) == null ? void 0 : _popper$getAttribute.toLowerCase();
11388
+ if (popper2.id && role === "tooltip" && "setAttribute" in reference2) {
11389
+ const ids = reference2.getAttribute("aria-describedby");
11390
+ if (ids && ids.split(",").indexOf(popper2.id) !== -1) {
11391
+ return;
11392
+ }
11393
+ reference2.setAttribute("aria-describedby", ids ? `${ids},${popper2.id}` : popper2.id);
11394
+ }
11528
11395
  }
11529
- return componentOrElement != null ? componentOrElement : null;
11530
- }
11531
- const TransitionWrapper = /* @__PURE__ */ React__default.forwardRef(({
11532
- onEnter,
11533
- onEntering,
11534
- onEntered,
11535
- onExit,
11536
- onExiting,
11537
- onExited,
11538
- addEndListener,
11539
- children,
11540
- childRef,
11541
- ...props
11542
- }, ref) => {
11543
- const nodeRef = useRef(null);
11544
- const mergedRef = useMergedRefs$1(nodeRef, childRef);
11545
- const attachRef = (r2) => {
11546
- mergedRef(safeFindDOMNode(r2));
11547
- };
11548
- const normalize = (callback) => (param) => {
11549
- if (callback && nodeRef.current) {
11550
- callback(nodeRef.current, param);
11396
+ };
11397
+ const EMPTY_MODIFIERS = [];
11398
+ function usePopper(referenceElement, popperElement, _ref = {}) {
11399
+ let {
11400
+ enabled = true,
11401
+ placement = "bottom",
11402
+ strategy = "absolute",
11403
+ modifiers = EMPTY_MODIFIERS
11404
+ } = _ref, config2 = _objectWithoutPropertiesLoose$2(_ref, _excluded$2);
11405
+ const prevModifiers = useRef(modifiers);
11406
+ const popperInstanceRef = useRef();
11407
+ const update = useCallback(() => {
11408
+ var _popperInstanceRef$cu;
11409
+ (_popperInstanceRef$cu = popperInstanceRef.current) == null ? void 0 : _popperInstanceRef$cu.update();
11410
+ }, []);
11411
+ const forceUpdate = useCallback(() => {
11412
+ var _popperInstanceRef$cu2;
11413
+ (_popperInstanceRef$cu2 = popperInstanceRef.current) == null ? void 0 : _popperInstanceRef$cu2.forceUpdate();
11414
+ }, []);
11415
+ const [popperState, setState] = useSafeState(useState({
11416
+ placement,
11417
+ update,
11418
+ forceUpdate,
11419
+ attributes: {},
11420
+ styles: {
11421
+ popper: {},
11422
+ arrow: {}
11551
11423
  }
11552
- };
11553
- const handleEnter = useCallback(normalize(onEnter), [onEnter]);
11554
- const handleEntering = useCallback(normalize(onEntering), [onEntering]);
11555
- const handleEntered = useCallback(normalize(onEntered), [onEntered]);
11556
- const handleExit = useCallback(normalize(onExit), [onExit]);
11557
- const handleExiting = useCallback(normalize(onExiting), [onExiting]);
11558
- const handleExited = useCallback(normalize(onExited), [onExited]);
11559
- const handleAddEndListener = useCallback(normalize(addEndListener), [addEndListener]);
11560
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Transition, {
11561
- ref,
11562
- ...props,
11563
- onEnter: handleEnter,
11564
- onEntered: handleEntered,
11565
- onEntering: handleEntering,
11566
- onExit: handleExit,
11567
- onExited: handleExited,
11568
- onExiting: handleExiting,
11569
- addEndListener: handleAddEndListener,
11570
- nodeRef,
11571
- children: typeof children === "function" ? (status, innerProps) => (
11572
- // TODO: Types for RTG missing innerProps, so need to cast.
11573
- children(status, {
11574
- ...innerProps,
11575
- ref: attachRef
11576
- })
11577
- ) : /* @__PURE__ */ React__default.cloneElement(children, {
11578
- ref: attachRef
11579
- })
11580
- });
11581
- });
11582
- TransitionWrapper.displayName = "TransitionWrapper";
11583
- function useCommittedRef$1(value) {
11584
- const ref = useRef(value);
11585
- useEffect(() => {
11586
- ref.current = value;
11587
- }, [value]);
11588
- return ref;
11589
- }
11590
- function useEventCallback$1(fn2) {
11591
- const ref = useCommittedRef$1(fn2);
11592
- return useCallback(function(...args) {
11593
- return ref.current && ref.current(...args);
11594
- }, [ref]);
11595
- }
11596
- function useCallbackRef() {
11597
- return useState(null);
11598
- }
11599
- function useCommittedRef(value) {
11600
- const ref = useRef(value);
11601
- useEffect(() => {
11602
- ref.current = value;
11603
- }, [value]);
11604
- return ref;
11605
- }
11606
- function useEventCallback(fn2) {
11607
- const ref = useCommittedRef(fn2);
11608
- return useCallback(function(...args) {
11609
- return ref.current && ref.current(...args);
11610
- }, [ref]);
11611
- }
11612
- function useMounted$1() {
11613
- const mounted = useRef(true);
11614
- const isMounted = useRef(() => mounted.current);
11424
+ }));
11425
+ const updateModifier = useMemo(() => ({
11426
+ name: "updateStateModifier",
11427
+ enabled: true,
11428
+ phase: "write",
11429
+ requires: ["computeStyles"],
11430
+ fn: ({
11431
+ state
11432
+ }) => {
11433
+ const styles = {};
11434
+ const attributes = {};
11435
+ Object.keys(state.elements).forEach((element) => {
11436
+ styles[element] = state.styles[element];
11437
+ attributes[element] = state.attributes[element];
11438
+ });
11439
+ setState({
11440
+ state,
11441
+ styles,
11442
+ attributes,
11443
+ update,
11444
+ forceUpdate,
11445
+ placement: state.placement
11446
+ });
11447
+ }
11448
+ }), [update, forceUpdate, setState]);
11449
+ const nextModifiers = useMemo(() => {
11450
+ if (!dequal(prevModifiers.current, modifiers)) {
11451
+ prevModifiers.current = modifiers;
11452
+ }
11453
+ return prevModifiers.current;
11454
+ }, [modifiers]);
11615
11455
  useEffect(() => {
11616
- mounted.current = true;
11617
- return () => {
11618
- mounted.current = false;
11619
- };
11620
- }, []);
11621
- return isMounted.current;
11622
- }
11623
- const isReactNative$1 = typeof global !== "undefined" && // @ts-ignore
11624
- global.navigator && // @ts-ignore
11625
- global.navigator.product === "ReactNative";
11626
- const isDOM$1 = typeof document !== "undefined";
11627
- const useIsomorphicEffect$1 = isDOM$1 || isReactNative$1 ? useLayoutEffect : useEffect;
11628
- const fadeStyles = {
11629
- [ENTERING]: "show",
11630
- [ENTERED]: "show"
11631
- };
11632
- const Fade = /* @__PURE__ */ React.forwardRef(({
11633
- className,
11634
- children,
11635
- transitionClasses = {},
11636
- onEnter,
11637
- ...rest
11638
- }, ref) => {
11639
- const props = {
11640
- in: false,
11641
- timeout: 300,
11642
- mountOnEnter: false,
11643
- unmountOnExit: false,
11644
- appear: false,
11645
- ...rest
11646
- };
11647
- const handleEnter = useCallback((node, isAppearing) => {
11648
- triggerBrowserReflow(node);
11649
- onEnter == null || onEnter(node, isAppearing);
11650
- }, [onEnter]);
11651
- return /* @__PURE__ */ jsxRuntimeExports.jsx(TransitionWrapper, {
11652
- ref,
11653
- addEndListener: transitionEndListener,
11654
- ...props,
11655
- onEnter: handleEnter,
11656
- childRef: getChildRef(children),
11657
- children: (status, innerProps) => /* @__PURE__ */ React.cloneElement(children, {
11658
- ...innerProps,
11659
- className: classNames("fade", className, children.props.className, fadeStyles[status], transitionClasses[status])
11660
- })
11661
- });
11662
- });
11663
- Fade.displayName = "Fade";
11664
- function useMounted() {
11665
- const mounted = useRef(true);
11666
- const isMounted = useRef(() => mounted.current);
11456
+ if (!popperInstanceRef.current || !enabled) return;
11457
+ popperInstanceRef.current.setOptions({
11458
+ placement,
11459
+ strategy,
11460
+ modifiers: [...nextModifiers, updateModifier, disabledApplyStylesModifier]
11461
+ });
11462
+ }, [strategy, placement, updateModifier, enabled, nextModifiers]);
11667
11463
  useEffect(() => {
11668
- mounted.current = true;
11464
+ if (!enabled || referenceElement == null || popperElement == null) {
11465
+ return void 0;
11466
+ }
11467
+ popperInstanceRef.current = createPopper(referenceElement, popperElement, Object.assign({}, config2, {
11468
+ placement,
11469
+ strategy,
11470
+ modifiers: [...nextModifiers, ariaDescribedByModifier, updateModifier]
11471
+ }));
11669
11472
  return () => {
11670
- mounted.current = false;
11671
- };
11672
- }, []);
11673
- return isMounted.current;
11674
- }
11675
- function useUpdatedRef(value) {
11676
- const valueRef = useRef(value);
11677
- valueRef.current = value;
11678
- return valueRef;
11679
- }
11680
- function useWillUnmount(fn2) {
11681
- const onUnmount = useUpdatedRef(fn2);
11682
- useEffect(() => () => onUnmount.current(), []);
11683
- }
11684
- const MAX_DELAY_MS = 2 ** 31 - 1;
11685
- function setChainedTimeout(handleRef, fn2, timeoutAtMs) {
11686
- const delayMs = timeoutAtMs - Date.now();
11687
- handleRef.current = delayMs <= MAX_DELAY_MS ? setTimeout(fn2, delayMs) : setTimeout(() => setChainedTimeout(handleRef, fn2, timeoutAtMs), MAX_DELAY_MS);
11688
- }
11689
- function useTimeout() {
11690
- const isMounted = useMounted();
11691
- const handleRef = useRef();
11692
- useWillUnmount(() => clearTimeout(handleRef.current));
11693
- return useMemo(() => {
11694
- const clear = () => clearTimeout(handleRef.current);
11695
- function set(fn2, delayMs = 0) {
11696
- if (!isMounted()) return;
11697
- clear();
11698
- if (delayMs <= MAX_DELAY_MS) {
11699
- handleRef.current = setTimeout(fn2, delayMs);
11700
- } else {
11701
- setChainedTimeout(handleRef, fn2, Date.now() + delayMs);
11473
+ if (popperInstanceRef.current != null) {
11474
+ popperInstanceRef.current.destroy();
11475
+ popperInstanceRef.current = void 0;
11476
+ setState((s) => Object.assign({}, s, {
11477
+ attributes: {},
11478
+ styles: {
11479
+ popper: {}
11480
+ }
11481
+ }));
11702
11482
  }
11703
- }
11704
- return {
11705
- set,
11706
- clear,
11707
- handleRef
11708
11483
  };
11709
- }, []);
11484
+ }, [enabled, referenceElement, popperElement]);
11485
+ return popperState;
11710
11486
  }
11711
- var has = Object.prototype.hasOwnProperty;
11712
- function find(iter, tar, key) {
11713
- for (key of iter.keys()) {
11714
- if (dequal(key, tar)) return key;
11715
- }
11487
+ function contains(context2, node) {
11488
+ if (context2.contains) return context2.contains(node);
11489
+ if (context2.compareDocumentPosition) return context2 === node || !!(context2.compareDocumentPosition(node) & 16);
11716
11490
  }
11717
- function dequal(foo, bar) {
11718
- var ctor, len, tmp;
11719
- if (foo === bar) return true;
11720
- if (foo && bar && (ctor = foo.constructor) === bar.constructor) {
11721
- if (ctor === Date) return foo.getTime() === bar.getTime();
11722
- if (ctor === RegExp) return foo.toString() === bar.toString();
11723
- if (ctor === Array) {
11724
- if ((len = foo.length) === bar.length) {
11725
- while (len-- && dequal(foo[len], bar[len])) ;
11491
+ var warning_1;
11492
+ var hasRequiredWarning;
11493
+ function requireWarning() {
11494
+ if (hasRequiredWarning) return warning_1;
11495
+ hasRequiredWarning = 1;
11496
+ var __DEV__ = process.env.NODE_ENV !== "production";
11497
+ var warning2 = function() {
11498
+ };
11499
+ if (__DEV__) {
11500
+ var printWarning = function printWarning2(format, args) {
11501
+ var len = arguments.length;
11502
+ args = new Array(len > 1 ? len - 1 : 0);
11503
+ for (var key = 1; key < len; key++) {
11504
+ args[key - 1] = arguments[key];
11726
11505
  }
11727
- return len === -1;
11728
- }
11729
- if (ctor === Set) {
11730
- if (foo.size !== bar.size) {
11731
- return false;
11506
+ var argIndex = 0;
11507
+ var message = "Warning: " + format.replace(/%s/g, function() {
11508
+ return args[argIndex++];
11509
+ });
11510
+ if (typeof console !== "undefined") {
11511
+ console.error(message);
11732
11512
  }
11733
- for (len of foo) {
11734
- tmp = len;
11735
- if (tmp && typeof tmp === "object") {
11736
- tmp = find(bar, tmp);
11737
- if (!tmp) return false;
11738
- }
11739
- if (!bar.has(tmp)) return false;
11513
+ try {
11514
+ throw new Error(message);
11515
+ } catch (x) {
11740
11516
  }
11741
- return true;
11742
- }
11743
- if (ctor === Map) {
11744
- if (foo.size !== bar.size) {
11745
- return false;
11517
+ };
11518
+ warning2 = function(condition, format, args) {
11519
+ var len = arguments.length;
11520
+ args = new Array(len > 2 ? len - 2 : 0);
11521
+ for (var key = 2; key < len; key++) {
11522
+ args[key - 2] = arguments[key];
11746
11523
  }
11747
- for (len of foo) {
11748
- tmp = len[0];
11749
- if (tmp && typeof tmp === "object") {
11750
- tmp = find(bar, tmp);
11751
- if (!tmp) return false;
11752
- }
11753
- if (!dequal(len[1], bar.get(tmp))) {
11754
- return false;
11755
- }
11524
+ if (format === void 0) {
11525
+ throw new Error(
11526
+ "`warning(condition, format, ...args)` requires a warning message argument"
11527
+ );
11756
11528
  }
11757
- return true;
11758
- }
11759
- if (ctor === ArrayBuffer) {
11760
- foo = new Uint8Array(foo);
11761
- bar = new Uint8Array(bar);
11762
- } else if (ctor === DataView) {
11763
- if ((len = foo.byteLength) === bar.byteLength) {
11764
- while (len-- && foo.getInt8(len) === bar.getInt8(len)) ;
11765
- }
11766
- return len === -1;
11767
- }
11768
- if (ArrayBuffer.isView(foo)) {
11769
- if ((len = foo.byteLength) === bar.byteLength) {
11770
- while (len-- && foo[len] === bar[len]) ;
11771
- }
11772
- return len === -1;
11773
- }
11774
- if (!ctor || typeof foo === "object") {
11775
- len = 0;
11776
- for (ctor in foo) {
11777
- if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
11778
- if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;
11779
- }
11780
- return Object.keys(bar).length === len;
11781
- }
11782
- }
11783
- return foo !== foo && bar !== bar;
11784
- }
11785
- function useSafeState(state) {
11786
- const isMounted = useMounted$1();
11787
- return [state[0], useCallback((nextState) => {
11788
- if (!isMounted()) return;
11789
- return state[1](nextState);
11790
- }, [isMounted, state[1]])];
11791
- }
11792
- const createPopper = popperGenerator({
11793
- defaultModifiers: [hide$1, popperOffsets$1, computeStyles$1, eventListeners, offset$1, flip$1, preventOverflow$1, arrow$1]
11794
- });
11795
- const _excluded$2 = ["enabled", "placement", "strategy", "modifiers"];
11796
- function _objectWithoutPropertiesLoose$2(r2, e) {
11797
- if (null == r2) return {};
11798
- var t = {};
11799
- for (var n in r2) if ({}.hasOwnProperty.call(r2, n)) {
11800
- if (e.indexOf(n) >= 0) continue;
11801
- t[n] = r2[n];
11802
- }
11803
- return t;
11804
- }
11805
- const disabledApplyStylesModifier = {
11806
- name: "applyStyles",
11807
- enabled: false,
11808
- phase: "afterWrite",
11809
- fn: () => void 0
11810
- };
11811
- const ariaDescribedByModifier = {
11812
- name: "ariaDescribedBy",
11813
- enabled: true,
11814
- phase: "afterWrite",
11815
- effect: ({
11816
- state
11817
- }) => () => {
11818
- const {
11819
- reference: reference2,
11820
- popper: popper2
11821
- } = state.elements;
11822
- if ("removeAttribute" in reference2) {
11823
- const ids = (reference2.getAttribute("aria-describedby") || "").split(",").filter((id) => id.trim() !== popper2.id);
11824
- if (!ids.length) reference2.removeAttribute("aria-describedby");
11825
- else reference2.setAttribute("aria-describedby", ids.join(","));
11826
- }
11827
- },
11828
- fn: ({
11829
- state
11830
- }) => {
11831
- var _popper$getAttribute;
11832
- const {
11833
- popper: popper2,
11834
- reference: reference2
11835
- } = state.elements;
11836
- const role = (_popper$getAttribute = popper2.getAttribute("role")) == null ? void 0 : _popper$getAttribute.toLowerCase();
11837
- if (popper2.id && role === "tooltip" && "setAttribute" in reference2) {
11838
- const ids = reference2.getAttribute("aria-describedby");
11839
- if (ids && ids.split(",").indexOf(popper2.id) !== -1) {
11840
- return;
11841
- }
11842
- reference2.setAttribute("aria-describedby", ids ? `${ids},${popper2.id}` : popper2.id);
11843
- }
11844
- }
11845
- };
11846
- const EMPTY_MODIFIERS = [];
11847
- function usePopper(referenceElement, popperElement, _ref = {}) {
11848
- let {
11849
- enabled = true,
11850
- placement = "bottom",
11851
- strategy = "absolute",
11852
- modifiers = EMPTY_MODIFIERS
11853
- } = _ref, config2 = _objectWithoutPropertiesLoose$2(_ref, _excluded$2);
11854
- const prevModifiers = useRef(modifiers);
11855
- const popperInstanceRef = useRef();
11856
- const update = useCallback(() => {
11857
- var _popperInstanceRef$cu;
11858
- (_popperInstanceRef$cu = popperInstanceRef.current) == null ? void 0 : _popperInstanceRef$cu.update();
11859
- }, []);
11860
- const forceUpdate = useCallback(() => {
11861
- var _popperInstanceRef$cu2;
11862
- (_popperInstanceRef$cu2 = popperInstanceRef.current) == null ? void 0 : _popperInstanceRef$cu2.forceUpdate();
11863
- }, []);
11864
- const [popperState, setState] = useSafeState(useState({
11865
- placement,
11866
- update,
11867
- forceUpdate,
11868
- attributes: {},
11869
- styles: {
11870
- popper: {},
11871
- arrow: {}
11872
- }
11873
- }));
11874
- const updateModifier = useMemo(() => ({
11875
- name: "updateStateModifier",
11876
- enabled: true,
11877
- phase: "write",
11878
- requires: ["computeStyles"],
11879
- fn: ({
11880
- state
11881
- }) => {
11882
- const styles = {};
11883
- const attributes = {};
11884
- Object.keys(state.elements).forEach((element) => {
11885
- styles[element] = state.styles[element];
11886
- attributes[element] = state.attributes[element];
11887
- });
11888
- setState({
11889
- state,
11890
- styles,
11891
- attributes,
11892
- update,
11893
- forceUpdate,
11894
- placement: state.placement
11895
- });
11896
- }
11897
- }), [update, forceUpdate, setState]);
11898
- const nextModifiers = useMemo(() => {
11899
- if (!dequal(prevModifiers.current, modifiers)) {
11900
- prevModifiers.current = modifiers;
11901
- }
11902
- return prevModifiers.current;
11903
- }, [modifiers]);
11904
- useEffect(() => {
11905
- if (!popperInstanceRef.current || !enabled) return;
11906
- popperInstanceRef.current.setOptions({
11907
- placement,
11908
- strategy,
11909
- modifiers: [...nextModifiers, updateModifier, disabledApplyStylesModifier]
11910
- });
11911
- }, [strategy, placement, updateModifier, enabled, nextModifiers]);
11912
- useEffect(() => {
11913
- if (!enabled || referenceElement == null || popperElement == null) {
11914
- return void 0;
11915
- }
11916
- popperInstanceRef.current = createPopper(referenceElement, popperElement, Object.assign({}, config2, {
11917
- placement,
11918
- strategy,
11919
- modifiers: [...nextModifiers, ariaDescribedByModifier, updateModifier]
11920
- }));
11921
- return () => {
11922
- if (popperInstanceRef.current != null) {
11923
- popperInstanceRef.current.destroy();
11924
- popperInstanceRef.current = void 0;
11925
- setState((s) => Object.assign({}, s, {
11926
- attributes: {},
11927
- styles: {
11928
- popper: {}
11929
- }
11930
- }));
11529
+ if (!condition) {
11530
+ printWarning.apply(null, [format].concat(args));
11931
11531
  }
11932
11532
  };
11933
- }, [enabled, referenceElement, popperElement]);
11934
- return popperState;
11935
- }
11936
- function contains(context2, node) {
11937
- if (context2.contains) return context2.contains(node);
11938
- if (context2.compareDocumentPosition) return context2 === node || !!(context2.compareDocumentPosition(node) & 16);
11533
+ }
11534
+ warning_1 = warning2;
11535
+ return warning_1;
11939
11536
  }
11537
+ var warningExports = requireWarning();
11538
+ const warning = /* @__PURE__ */ getDefaultExportFromCjs(warningExports);
11940
11539
  const noop$1 = () => {
11941
11540
  };
11942
11541
  function isLeftClickEvent(event) {
@@ -12079,6 +11678,372 @@ const isDOM = typeof document !== "undefined";
12079
11678
  const useIsomorphicEffect = isDOM || isReactNative ? useLayoutEffect : useEffect;
12080
11679
  const context = /* @__PURE__ */ React.createContext(null);
12081
11680
  context.displayName = "InputGroupContext";
11681
+ const propTypes$1 = {
11682
+ /**
11683
+ * Specify whether the feedback is for valid or invalid fields
11684
+ *
11685
+ * @type {('valid'|'invalid')}
11686
+ */
11687
+ type: PropTypes.string,
11688
+ /** Display feedback as a tooltip. */
11689
+ tooltip: PropTypes.bool,
11690
+ as: PropTypes.elementType
11691
+ };
11692
+ const Feedback = /* @__PURE__ */ React.forwardRef(
11693
+ // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
11694
+ ({
11695
+ as: Component = "div",
11696
+ className,
11697
+ type = "valid",
11698
+ tooltip = false,
11699
+ ...props
11700
+ }, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx(Component, {
11701
+ ...props,
11702
+ ref,
11703
+ className: classNames(className, `${type}-${tooltip ? "tooltip" : "feedback"}`)
11704
+ })
11705
+ );
11706
+ Feedback.displayName = "Feedback";
11707
+ Feedback.propTypes = propTypes$1;
11708
+ const FormContext = /* @__PURE__ */ React.createContext({});
11709
+ const FormCheckInput = /* @__PURE__ */ React.forwardRef(({
11710
+ id,
11711
+ bsPrefix,
11712
+ className,
11713
+ type = "checkbox",
11714
+ isValid = false,
11715
+ isInvalid = false,
11716
+ // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
11717
+ as: Component = "input",
11718
+ ...props
11719
+ }, ref) => {
11720
+ const {
11721
+ controlId
11722
+ } = useContext(FormContext);
11723
+ bsPrefix = useBootstrapPrefix(bsPrefix, "form-check-input");
11724
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Component, {
11725
+ ...props,
11726
+ ref,
11727
+ type,
11728
+ id: id || controlId,
11729
+ className: classNames(className, bsPrefix, isValid && "is-valid", isInvalid && "is-invalid")
11730
+ });
11731
+ });
11732
+ FormCheckInput.displayName = "FormCheckInput";
11733
+ const FormCheckLabel = /* @__PURE__ */ React.forwardRef(({
11734
+ bsPrefix,
11735
+ className,
11736
+ htmlFor,
11737
+ ...props
11738
+ }, ref) => {
11739
+ const {
11740
+ controlId
11741
+ } = useContext(FormContext);
11742
+ bsPrefix = useBootstrapPrefix(bsPrefix, "form-check-label");
11743
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("label", {
11744
+ ...props,
11745
+ ref,
11746
+ htmlFor: htmlFor || controlId,
11747
+ className: classNames(className, bsPrefix)
11748
+ });
11749
+ });
11750
+ FormCheckLabel.displayName = "FormCheckLabel";
11751
+ const FormCheck = /* @__PURE__ */ React.forwardRef(({
11752
+ id,
11753
+ bsPrefix,
11754
+ bsSwitchPrefix,
11755
+ inline = false,
11756
+ reverse = false,
11757
+ disabled = false,
11758
+ isValid = false,
11759
+ isInvalid = false,
11760
+ feedbackTooltip = false,
11761
+ feedback,
11762
+ feedbackType,
11763
+ className,
11764
+ style: style2,
11765
+ title = "",
11766
+ type = "checkbox",
11767
+ label,
11768
+ children,
11769
+ // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
11770
+ as = "input",
11771
+ ...props
11772
+ }, ref) => {
11773
+ bsPrefix = useBootstrapPrefix(bsPrefix, "form-check");
11774
+ bsSwitchPrefix = useBootstrapPrefix(bsSwitchPrefix, "form-switch");
11775
+ const {
11776
+ controlId
11777
+ } = useContext(FormContext);
11778
+ const innerFormContext = useMemo(() => ({
11779
+ controlId: id || controlId
11780
+ }), [controlId, id]);
11781
+ const hasLabel = !children && label != null && label !== false || hasChildOfType(children, FormCheckLabel);
11782
+ const input = /* @__PURE__ */ jsxRuntimeExports.jsx(FormCheckInput, {
11783
+ ...props,
11784
+ type: type === "switch" ? "checkbox" : type,
11785
+ ref,
11786
+ isValid,
11787
+ isInvalid,
11788
+ disabled,
11789
+ as
11790
+ });
11791
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(FormContext.Provider, {
11792
+ value: innerFormContext,
11793
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
11794
+ style: style2,
11795
+ className: classNames(className, hasLabel && bsPrefix, inline && `${bsPrefix}-inline`, reverse && `${bsPrefix}-reverse`, type === "switch" && bsSwitchPrefix),
11796
+ children: children || /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
11797
+ children: [input, hasLabel && /* @__PURE__ */ jsxRuntimeExports.jsx(FormCheckLabel, {
11798
+ title,
11799
+ children: label
11800
+ }), feedback && /* @__PURE__ */ jsxRuntimeExports.jsx(Feedback, {
11801
+ type: feedbackType,
11802
+ tooltip: feedbackTooltip,
11803
+ children: feedback
11804
+ })]
11805
+ })
11806
+ })
11807
+ });
11808
+ });
11809
+ FormCheck.displayName = "FormCheck";
11810
+ const FormCheck$1 = Object.assign(FormCheck, {
11811
+ Input: FormCheckInput,
11812
+ Label: FormCheckLabel
11813
+ });
11814
+ const FormControl = /* @__PURE__ */ React.forwardRef(({
11815
+ bsPrefix,
11816
+ type,
11817
+ size,
11818
+ htmlSize,
11819
+ id,
11820
+ className,
11821
+ isValid = false,
11822
+ isInvalid = false,
11823
+ plaintext,
11824
+ readOnly,
11825
+ // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
11826
+ as: Component = "input",
11827
+ ...props
11828
+ }, ref) => {
11829
+ const {
11830
+ controlId
11831
+ } = useContext(FormContext);
11832
+ bsPrefix = useBootstrapPrefix(bsPrefix, "form-control");
11833
+ process.env.NODE_ENV !== "production" ? warning(controlId == null || !id, "`controlId` is ignored on `<FormControl>` when `id` is specified.") : void 0;
11834
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Component, {
11835
+ ...props,
11836
+ type,
11837
+ size: htmlSize,
11838
+ ref,
11839
+ readOnly,
11840
+ id: id || controlId,
11841
+ className: classNames(className, plaintext ? `${bsPrefix}-plaintext` : bsPrefix, size && `${bsPrefix}-${size}`, type === "color" && `${bsPrefix}-color`, isValid && "is-valid", isInvalid && "is-invalid")
11842
+ });
11843
+ });
11844
+ FormControl.displayName = "FormControl";
11845
+ const FormControl$1 = Object.assign(FormControl, {
11846
+ Feedback
11847
+ });
11848
+ const FormFloating = /* @__PURE__ */ React.forwardRef(({
11849
+ className,
11850
+ bsPrefix,
11851
+ as: Component = "div",
11852
+ ...props
11853
+ }, ref) => {
11854
+ bsPrefix = useBootstrapPrefix(bsPrefix, "form-floating");
11855
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Component, {
11856
+ ref,
11857
+ className: classNames(className, bsPrefix),
11858
+ ...props
11859
+ });
11860
+ });
11861
+ FormFloating.displayName = "FormFloating";
11862
+ const FormGroup = /* @__PURE__ */ React.forwardRef(({
11863
+ controlId,
11864
+ // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
11865
+ as: Component = "div",
11866
+ ...props
11867
+ }, ref) => {
11868
+ const context2 = useMemo(() => ({
11869
+ controlId
11870
+ }), [controlId]);
11871
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(FormContext.Provider, {
11872
+ value: context2,
11873
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Component, {
11874
+ ...props,
11875
+ ref
11876
+ })
11877
+ });
11878
+ });
11879
+ FormGroup.displayName = "FormGroup";
11880
+ const FormLabel = /* @__PURE__ */ React.forwardRef(({
11881
+ // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
11882
+ as: Component = "label",
11883
+ bsPrefix,
11884
+ column = false,
11885
+ visuallyHidden = false,
11886
+ className,
11887
+ htmlFor,
11888
+ ...props
11889
+ }, ref) => {
11890
+ const {
11891
+ controlId
11892
+ } = useContext(FormContext);
11893
+ bsPrefix = useBootstrapPrefix(bsPrefix, "form-label");
11894
+ let columnClass = "col-form-label";
11895
+ if (typeof column === "string") columnClass = `${columnClass} ${columnClass}-${column}`;
11896
+ const classes = classNames(className, bsPrefix, visuallyHidden && "visually-hidden", column && columnClass);
11897
+ process.env.NODE_ENV !== "production" ? warning(controlId == null || !htmlFor, "`controlId` is ignored on `<FormLabel>` when `htmlFor` is specified.") : void 0;
11898
+ htmlFor = htmlFor || controlId;
11899
+ if (column) return /* @__PURE__ */ jsxRuntimeExports.jsx(Col, {
11900
+ ref,
11901
+ as: "label",
11902
+ className: classes,
11903
+ htmlFor,
11904
+ ...props
11905
+ });
11906
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Component, {
11907
+ ref,
11908
+ className: classes,
11909
+ htmlFor,
11910
+ ...props
11911
+ });
11912
+ });
11913
+ FormLabel.displayName = "FormLabel";
11914
+ const FormRange = /* @__PURE__ */ React.forwardRef(({
11915
+ bsPrefix,
11916
+ className,
11917
+ id,
11918
+ ...props
11919
+ }, ref) => {
11920
+ const {
11921
+ controlId
11922
+ } = useContext(FormContext);
11923
+ bsPrefix = useBootstrapPrefix(bsPrefix, "form-range");
11924
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("input", {
11925
+ ...props,
11926
+ type: "range",
11927
+ ref,
11928
+ className: classNames(className, bsPrefix),
11929
+ id: id || controlId
11930
+ });
11931
+ });
11932
+ FormRange.displayName = "FormRange";
11933
+ const FormSelect = /* @__PURE__ */ React.forwardRef(({
11934
+ bsPrefix,
11935
+ size,
11936
+ htmlSize,
11937
+ className,
11938
+ isValid = false,
11939
+ isInvalid = false,
11940
+ id,
11941
+ ...props
11942
+ }, ref) => {
11943
+ const {
11944
+ controlId
11945
+ } = useContext(FormContext);
11946
+ bsPrefix = useBootstrapPrefix(bsPrefix, "form-select");
11947
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("select", {
11948
+ ...props,
11949
+ size: htmlSize,
11950
+ ref,
11951
+ className: classNames(className, bsPrefix, size && `${bsPrefix}-${size}`, isValid && `is-valid`, isInvalid && `is-invalid`),
11952
+ id: id || controlId
11953
+ });
11954
+ });
11955
+ FormSelect.displayName = "FormSelect";
11956
+ const FormText = /* @__PURE__ */ React.forwardRef(
11957
+ // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
11958
+ ({
11959
+ bsPrefix,
11960
+ className,
11961
+ as: Component = "small",
11962
+ muted,
11963
+ ...props
11964
+ }, ref) => {
11965
+ bsPrefix = useBootstrapPrefix(bsPrefix, "form-text");
11966
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Component, {
11967
+ ...props,
11968
+ ref,
11969
+ className: classNames(className, bsPrefix, muted && "text-muted")
11970
+ });
11971
+ }
11972
+ );
11973
+ FormText.displayName = "FormText";
11974
+ const Switch = /* @__PURE__ */ React.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx(FormCheck$1, {
11975
+ ...props,
11976
+ ref,
11977
+ type: "switch"
11978
+ }));
11979
+ Switch.displayName = "Switch";
11980
+ const Switch$1 = Object.assign(Switch, {
11981
+ Input: FormCheck$1.Input,
11982
+ Label: FormCheck$1.Label
11983
+ });
11984
+ const FloatingLabel = /* @__PURE__ */ React.forwardRef(({
11985
+ bsPrefix,
11986
+ className,
11987
+ children,
11988
+ controlId,
11989
+ label,
11990
+ ...props
11991
+ }, ref) => {
11992
+ bsPrefix = useBootstrapPrefix(bsPrefix, "form-floating");
11993
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(FormGroup, {
11994
+ ref,
11995
+ className: classNames(className, bsPrefix),
11996
+ controlId,
11997
+ ...props,
11998
+ children: [children, /* @__PURE__ */ jsxRuntimeExports.jsx("label", {
11999
+ htmlFor: controlId,
12000
+ children: label
12001
+ })]
12002
+ });
12003
+ });
12004
+ FloatingLabel.displayName = "FloatingLabel";
12005
+ const propTypes = {
12006
+ /**
12007
+ * The Form `ref` will be forwarded to the underlying element,
12008
+ * which means, unless it's rendered `as` a composite component,
12009
+ * it will be a DOM node, when resolved.
12010
+ *
12011
+ * @type {ReactRef}
12012
+ * @alias ref
12013
+ */
12014
+ _ref: PropTypes.any,
12015
+ /**
12016
+ * Mark a form as having been validated. Setting it to `true` will
12017
+ * toggle any validation styles on the forms elements.
12018
+ */
12019
+ validated: PropTypes.bool,
12020
+ as: PropTypes.elementType
12021
+ };
12022
+ const Form = /* @__PURE__ */ React.forwardRef(({
12023
+ className,
12024
+ validated,
12025
+ // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
12026
+ as: Component = "form",
12027
+ ...props
12028
+ }, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx(Component, {
12029
+ ...props,
12030
+ ref,
12031
+ className: classNames(className, validated && "was-validated")
12032
+ }));
12033
+ Form.displayName = "Form";
12034
+ Form.propTypes = propTypes;
12035
+ const Form$1 = Object.assign(Form, {
12036
+ Group: FormGroup,
12037
+ Control: FormControl$1,
12038
+ Floating: FormFloating,
12039
+ Check: FormCheck$1,
12040
+ Switch: Switch$1,
12041
+ Label: FormLabel,
12042
+ Text: FormText,
12043
+ Range: FormRange,
12044
+ Select: FormSelect,
12045
+ FloatingLabel
12046
+ });
12082
12047
  const InputGroupText = /* @__PURE__ */ React.forwardRef(({
12083
12048
  className,
12084
12049
  bsPrefix,