@abdellatifui/react 3.2.90 → 3.2.92

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/nextgen.css CHANGED
@@ -98,7 +98,10 @@
98
98
  .abdellatifuimap .maplibregl-ctrl *{
99
99
  border-radius: 100px;
100
100
  cursor: default !important;
101
- }/*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */
101
+ }.css-opacity-0 {
102
+ opacity: 0 !important;
103
+ }
104
+ /*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */
102
105
  /*! Generated by Font Squirrel (https://www.fontsquirrel.com) on May 13, 2024 */
103
106
  @layer properties {
104
107
  @supports (((-webkit-hyphens: none)) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color: rgb(from red r g b)))) {
package/dist/nextgen.d.ts CHANGED
@@ -72,6 +72,7 @@ export declare interface AccordionItemProps {
72
72
  disabled?: boolean;
73
73
  className?: string;
74
74
  defaultOpen?: boolean;
75
+ delay?: number;
75
76
  onOpen?: (params: {
76
77
  value: any;
77
78
  props: any;
@@ -211,6 +212,7 @@ export declare interface CheckboxItemProps {
211
212
  onChecked?: (ref: default_2.RefObject<any>, state: boolean) => void;
212
213
  onUnChecked?: (ref: default_2.RefObject<any>, state: boolean) => void;
213
214
  defaultChecked?: boolean;
215
+ checked?: boolean;
214
216
  variant?: 'primary' | 'secondary';
215
217
  border?: boolean | 'ghost';
216
218
  checkboxProps?: any;
package/dist/nextgen.js CHANGED
@@ -6463,7 +6463,6 @@ const ModelComponent = forwardRef((props, ref) => {
6463
6463
  animationDuration = 0.2
6464
6464
  } = props;
6465
6465
  const handleClose = useCallback((event) => {
6466
- console.log(event);
6467
6466
  onClose({ open, ref, container, children, props, _children, id, event });
6468
6467
  setTimeout(() => {
6469
6468
  $(ref3.current).addClass("opacity-0");
@@ -24049,6 +24048,7 @@ const vrs$c = cva("px-1", {
24049
24048
  const AccordionItem = (props) => {
24050
24049
  const key = useGeneratedId(5, false, false);
24051
24050
  const ref = useRef();
24051
+ const contentRef = useRef();
24052
24052
  const refTrigger = useRef();
24053
24053
  const {
24054
24054
  value = key,
@@ -24060,7 +24060,8 @@ const AccordionItem = (props) => {
24060
24060
  onClose = () => {
24061
24061
  },
24062
24062
  defaultOpen = false,
24063
- disabled = false
24063
+ disabled = false,
24064
+ delay = 0
24064
24065
  } = props;
24065
24066
  const { updateApi, options: options2 } = useContext(AccordionContext);
24066
24067
  const id = useGeneratedId(5, true, false);
@@ -24069,8 +24070,12 @@ const AccordionItem = (props) => {
24069
24070
  const form = { ...props, open: isOpen, ref, refTrigger };
24070
24071
  if (isOpen) {
24071
24072
  onOpen(form);
24073
+ setTimeout(() => {
24074
+ $(contentRef.current).find("div").first().removeClass("css-opacity-0");
24075
+ }, delay);
24072
24076
  }
24073
24077
  if (!isOpen) {
24078
+ $(contentRef.current).find("div").first().addClass("css-opacity-0");
24074
24079
  onClose(form);
24075
24080
  }
24076
24081
  updateApi((prev) => ({ ...prev, ...form }));
@@ -24083,13 +24088,29 @@ const AccordionItem = (props) => {
24083
24088
  }, 100);
24084
24089
  }
24085
24090
  }, [defaultOpen]);
24086
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem$1, { ref, id, onClick: handleClick, className: cn(vrs$c({
24087
- disabled,
24088
- border: options2.border
24089
- }), className), disabled, value, children: [
24090
- /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { ref: refTrigger, children: header }),
24091
- /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionContent, { children })
24092
- ] }, key);
24091
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
24092
+ AccordionItem$1,
24093
+ {
24094
+ ref,
24095
+ id,
24096
+ onClick: handleClick,
24097
+ className: cn(vrs$c({ disabled, border: options2.border }), className),
24098
+ disabled,
24099
+ value,
24100
+ children: [
24101
+ /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { ref: refTrigger, children: header }),
24102
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
24103
+ AccordionContent,
24104
+ {
24105
+ className: "css-opacity-0",
24106
+ ref: contentRef,
24107
+ children
24108
+ }
24109
+ )
24110
+ ]
24111
+ },
24112
+ key
24113
+ );
24093
24114
  };
24094
24115
  const CopyButton = forwardRef((props, ref) => {
24095
24116
  const [icon, setIcon] = useState(/* @__PURE__ */ jsxRuntimeExports.jsx(Copy, { size: 16 }));
@@ -29016,26 +29037,30 @@ const ToggleItem = (props) => {
29016
29037
  toggleProps = {},
29017
29038
  onContextMenu,
29018
29039
  disabled,
29019
- value
29040
+ value,
29041
+ pressed: controlledPressed
29042
+ // Added
29020
29043
  } = props;
29021
- const [pressed, setPressed] = useState(false);
29044
+ const [internalPressed, setInternalPressed] = useState(defaultChecked);
29045
+ const pressed = controlledPressed !== void 0 ? controlledPressed : internalPressed;
29022
29046
  const api = useMemo(() => {
29023
29047
  return {
29024
29048
  id,
29025
29049
  ref: ref2,
29026
29050
  state: !pressed,
29027
- setPressedState: setPressed,
29051
+ setPressedState: setInternalPressed,
29028
29052
  props,
29029
29053
  data,
29030
29054
  value
29031
29055
  };
29032
29056
  }, [id, ref2.current, pressed, data]);
29033
29057
  const handleOnChange = useCallback((state) => {
29034
- if (disabled) return;
29058
+ if (controlledPressed === void 0) {
29059
+ setInternalPressed(state);
29060
+ }
29035
29061
  if (api_groupChange) {
29036
- api_groupChange(api);
29062
+ api_groupChange({ ...api, state });
29037
29063
  }
29038
- setPressed(state);
29039
29064
  onChange(ref2, state);
29040
29065
  if (state) {
29041
29066
  onPressed(ref2, state);
@@ -29043,12 +29068,12 @@ const ToggleItem = (props) => {
29043
29068
  if (!state) {
29044
29069
  onUnPressed(ref2, state);
29045
29070
  }
29046
- }, [pressed, id]);
29071
+ }, [controlledPressed, api_groupChange, api, onChange, onPressed, onUnPressed]);
29047
29072
  useEffect(() => {
29048
- if (defaultChecked) {
29049
- handleOnChange(true);
29073
+ if (defaultChecked && api_groupChange) {
29074
+ api_groupChange({ ...api, state: true });
29050
29075
  }
29051
- }, [defaultChecked]);
29076
+ }, []);
29052
29077
  useEffect(() => {
29053
29078
  if (ref2.current && rootref && id) {
29054
29079
  itemsRef?.current?.items.push(api);
@@ -29142,27 +29167,30 @@ const CheckboxItem = (props) => {
29142
29167
  onUnChecked = () => {
29143
29168
  },
29144
29169
  defaultChecked = false,
29170
+ checked: controlledChecked,
29145
29171
  variant = "primary",
29146
29172
  checkboxProps = {},
29147
29173
  disabled,
29148
29174
  value,
29149
29175
  checkboxClassName
29150
29176
  } = props;
29151
- const [checked, setChecked] = useState(false);
29177
+ const [internalChecked, setInternalChecked] = useState(defaultChecked || false);
29178
+ const checked = controlledChecked !== void 0 ? controlledChecked : internalChecked;
29152
29179
  const api = useMemo(() => {
29153
29180
  return {
29154
29181
  id,
29155
29182
  ref: ref2,
29156
29183
  state: checked,
29157
- setCheckedState: setChecked,
29184
+ setCheckedState: setInternalChecked,
29158
29185
  props,
29159
29186
  data,
29160
29187
  value
29161
29188
  };
29162
29189
  }, [id, ref2.current, checked, data, props, value]);
29163
29190
  const handleOnChange = useCallback((state) => {
29164
- if (disabled) return;
29165
- setChecked(state);
29191
+ if (controlledChecked === void 0) {
29192
+ setInternalChecked(state);
29193
+ }
29166
29194
  if (api_groupChange) {
29167
29195
  api_groupChange({ ...api, state });
29168
29196
  }
@@ -29172,10 +29200,10 @@ const CheckboxItem = (props) => {
29172
29200
  } else {
29173
29201
  onUnChecked(ref2, state);
29174
29202
  }
29175
- }, [disabled, api_groupChange, api, onChange, onChecked, onUnChecked]);
29203
+ }, [controlledChecked, api_groupChange, api, onChange, onChecked, onUnChecked]);
29176
29204
  useEffect(() => {
29177
- if (defaultChecked) {
29178
- handleOnChange(true);
29205
+ if (defaultChecked && api_groupChange) {
29206
+ api_groupChange({ ...api, state: true });
29179
29207
  }
29180
29208
  }, []);
29181
29209
  useEffect(() => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@abdellatifui/react",
3
3
  "private": false,
4
- "version": "3.2.90",
4
+ "version": "3.2.92",
5
5
  "type": "module",
6
6
  "types": "dist/nextgen.d.ts",
7
7
  "files": [