@luscii-healthtech/web-ui 28.8.0 → 28.8.1

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.
@@ -0,0 +1,24 @@
1
+ /// <reference types="react" />
2
+ export interface SwitchProps {
3
+ /**
4
+ * ID used for semantic targeting, as can be used in attributes like `<label htmlFor="some-id">`.
5
+ */
6
+ id?: string;
7
+ /**
8
+ * Set the value.
9
+ * Same as `checked` on `<input type="checkbox" />`.
10
+ */
11
+ checked?: boolean;
12
+ /**
13
+ * Disallow the user to change the checkbox value.
14
+ * Same as `disabled` on `<input type="checkbox" />`.
15
+ */
16
+ disabled?: boolean;
17
+ /**
18
+ * The name that the value of the checkbox will be associated with.
19
+ * Same as `name` on `<input type="checkbox" />`.
20
+ */
21
+ name?: string;
22
+ onChange?: (checked: boolean) => void;
23
+ }
24
+ export declare const Switch: (props: SwitchProps) => JSX.Element;
package/dist/index.d.ts CHANGED
@@ -62,6 +62,7 @@ export { SettingsMenuButton } from "./components/SettingsMenuButton/SettingsMenu
62
62
  export { Spinner } from "./components/Spinner/Spinner";
63
63
  export { Steps } from "./components/Steps/Steps";
64
64
  export { default as Switcher } from "./components/Switcher/Switcher";
65
+ export { Switch } from "./components/Switch/Switch";
65
66
  export { default as Image } from "./components/Image/Image";
66
67
  export { MediaPicker, type TargetProps, } from "./components/MediaPicker/MediaPicker";
67
68
  export { Stack } from "./components/Stack/Stack";
@@ -27,6 +27,7 @@ var tailwindMerge = require('tailwind-merge');
27
27
  var ReactSelect = require('react-select');
28
28
  var groupBy = require('lodash/groupBy');
29
29
  var debounce = require('lodash.debounce');
30
+ var RadixSwitch = require('@radix-ui/react-switch');
30
31
  var reactLazyLoadImageComponent = require('react-lazy-load-image-component');
31
32
  var Quill = require('quill');
32
33
  require('quill/dist/quill.snow.css');
@@ -67,6 +68,7 @@ var FlyOutMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(FlyOutMenuPr
67
68
  var ReactSelect__default = /*#__PURE__*/_interopDefault(ReactSelect);
68
69
  var groupBy__default = /*#__PURE__*/_interopDefault(groupBy);
69
70
  var debounce__default = /*#__PURE__*/_interopDefault(debounce);
71
+ var RadixSwitch__namespace = /*#__PURE__*/_interopNamespace(RadixSwitch);
70
72
  var Quill__default = /*#__PURE__*/_interopDefault(Quill);
71
73
  var ToggleGroup__namespace = /*#__PURE__*/_interopNamespace(ToggleGroup);
72
74
 
@@ -5054,6 +5056,24 @@ Switcher.propTypes = {
5054
5056
  itemClassName: PropTypes__default.default.string
5055
5057
  };
5056
5058
 
5059
+ const Switch = (props) => {
5060
+ const { id, name, onChange, checked = false, disabled } = props;
5061
+ const handleChange = (checkedChanged) => {
5062
+ onChange === null || onChange === void 0 ? void 0 : onChange(checkedChanged);
5063
+ };
5064
+ const enabled = !disabled;
5065
+ return React__namespace.default.createElement(
5066
+ RadixSwitch__namespace.Root,
5067
+ { id, name, checked, disabled, onCheckedChange: handleChange, className: classNames__default.default("ui-h-[28px] ui-w-[56px]", "ui-relative ui-rounded-full ui-outline-none", {
5068
+ "ui-cursor-pointer": enabled,
5069
+ "ui-cursor-not-allowed": disabled,
5070
+ "ui-bg-secondary-dark data-[state=checked]:ui-bg-green-400": enabled,
5071
+ "ui-bg-slate-200": disabled
5072
+ }) },
5073
+ React__namespace.default.createElement(RadixSwitch__namespace.Thumb, { className: classNames__default.default("ui-h-[20px] ui-w-[20px]", "ui-bg-white", "ui-transition-transform ui-duration-100 ui-will-change-transform ", "ui-translate-x-1 data-[state=checked]:ui-translate-x-[32px]", "ui-block ui-rounded-full") })
5074
+ );
5075
+ };
5076
+
5057
5077
  var img = "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 18 18' fill='none'%3e%3cpath d='M18 16V2C18 0.9 17.1 0 16 0H2C0.9 0 0 0.9 0 2V16C0 17.1 0.9 18 2 18H16C17.1 18 18 17.1 18 16ZM5.9 10.98L8 13.51L11.1 9.52C11.3 9.26 11.7 9.26 11.9 9.53L15.41 14.21C15.66 14.54 15.42 15.01 15.01 15.01H3.02C2.6 15.01 2.37 14.53 2.63 14.2L5.12 11C5.31 10.74 5.69 10.73 5.9 10.98Z' fill='%23D1D5DB'/%3e%3c/svg%3e";
5058
5078
 
5059
5079
  const Image$1 = (_a) => {
@@ -6521,6 +6541,7 @@ exports.Steps = Steps;
6521
6541
  exports.StyledInput = StyledInput;
6522
6542
  exports.StyledOrderedList = StyledOrderedList;
6523
6543
  exports.StyledUnorderedList = StyledUnorderedList;
6544
+ exports.Switch = Switch;
6524
6545
  exports.Switcher = Switcher;
6525
6546
  exports.TOASTER_TYPE_OPTIONS = TOASTER_TYPE_OPTIONS;
6526
6547
  exports.Tabbar = Tabbar;