@proyecto-viviana/solid-stately 0.0.1 → 0.0.3

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/index.d.ts CHANGED
@@ -1,6 +1,263 @@
1
- export { createToggleState, type ToggleStateOptions, type ToggleState, } from './toggle';
2
- export { createTextFieldState, type TextFieldStateOptions, type TextFieldState, } from './textfield';
3
- export { createCheckboxGroupState, type CheckboxGroupProps, type CheckboxGroupState, } from './checkbox';
4
- export { createRadioGroupState, radioGroupSyncVersion, type RadioGroupProps, type RadioGroupState, } from './radio';
5
- export { createIsSSR, createId, canUseDOM } from './ssr';
6
- export { access, isAccessor, type MaybeAccessor, type MaybeAccessorValue } from './utils';
1
+ import { Accessor } from 'solid-js';
2
+
3
+ /**
4
+ * Reactivity utilities for Solid Stately
5
+ *
6
+ * Provides type-safe utilities for working with SolidJS reactivity patterns.
7
+ */
8
+
9
+ /**
10
+ * A value that may be either a raw value or an accessor function.
11
+ * This is a common pattern in SolidJS for props that may be reactive.
12
+ */
13
+ type MaybeAccessor<T> = T | Accessor<T>;
14
+ /**
15
+ * Unwraps a MaybeAccessor to get the underlying value.
16
+ * If the input is a function, it calls it to get the value.
17
+ * Otherwise, it returns the value directly.
18
+ *
19
+ * @param value - The value or accessor to unwrap.
20
+ */
21
+ declare function access<T>(value: MaybeAccessor<T>): T;
22
+ /**
23
+ * A value that may be undefined or an accessor that returns the value or undefined.
24
+ */
25
+ type MaybeAccessorValue<T> = T | undefined | Accessor<T | undefined>;
26
+ /**
27
+ * Checks if a value is an accessor function.
28
+ */
29
+ declare function isAccessor<T>(value: MaybeAccessor<T>): value is Accessor<T>;
30
+
31
+ /**
32
+ * Toggle state for Solid Stately
33
+ *
34
+ * Provides state management for toggle components like checkboxes and switches.
35
+ *
36
+ * This is a 1:1 port of @react-stately/toggle's useToggleState.
37
+ */
38
+
39
+ interface ToggleStateOptions {
40
+ /** Whether the element should be selected (controlled). */
41
+ isSelected?: boolean;
42
+ /** Whether the element should be selected by default (uncontrolled). */
43
+ defaultSelected?: boolean;
44
+ /** Handler that is called when the element's selection state changes. */
45
+ onChange?: (isSelected: boolean) => void;
46
+ /** Whether the element is read only. */
47
+ isReadOnly?: boolean;
48
+ }
49
+ interface ToggleState {
50
+ /** Whether the toggle is selected. */
51
+ readonly isSelected: Accessor<boolean>;
52
+ /** Whether the toggle is selected by default. */
53
+ readonly defaultSelected: boolean;
54
+ /** Updates selection state. */
55
+ setSelected(isSelected: boolean): void;
56
+ /** Toggle the selection state. */
57
+ toggle(): void;
58
+ }
59
+ /**
60
+ * Provides state management for toggle components like checkboxes and switches.
61
+ */
62
+ declare function createToggleState(props?: MaybeAccessor<ToggleStateOptions>): ToggleState;
63
+
64
+ /**
65
+ * TextField state for Solid Stately
66
+ *
67
+ * Provides state management for text input components.
68
+ *
69
+ * This is a port of @react-stately/utils's useControlledState pattern
70
+ * as used by @react-aria/textfield.
71
+ */
72
+
73
+ interface TextFieldStateOptions {
74
+ /** The current value (controlled). */
75
+ value?: string;
76
+ /** The default value (uncontrolled). */
77
+ defaultValue?: string;
78
+ /** Handler that is called when the value changes. */
79
+ onChange?: (value: string) => void;
80
+ }
81
+ interface TextFieldState {
82
+ /** The current value of the text field. */
83
+ readonly value: Accessor<string>;
84
+ /** Sets the value of the text field. */
85
+ setValue(value: string): void;
86
+ }
87
+ /**
88
+ * Provides state management for text input components.
89
+ * Supports both controlled and uncontrolled modes.
90
+ */
91
+ declare function createTextFieldState(props?: MaybeAccessor<TextFieldStateOptions>): TextFieldState;
92
+
93
+ /**
94
+ * Checkbox group state for Solid Stately
95
+ *
96
+ * Provides state management for a checkbox group component.
97
+ * Provides a name for the group, and manages selection and focus state.
98
+ *
99
+ * This is a 1:1 port of @react-stately/checkbox's useCheckboxGroupState.
100
+ */
101
+
102
+ interface CheckboxGroupProps {
103
+ /** The current selected values (controlled). */
104
+ value?: string[];
105
+ /** The default selected values (uncontrolled). */
106
+ defaultValue?: string[];
107
+ /** Handler that is called when the value changes. */
108
+ onChange?: (value: string[]) => void;
109
+ /** Whether the checkbox group is disabled. */
110
+ isDisabled?: boolean;
111
+ /** Whether the checkbox group is read only. */
112
+ isReadOnly?: boolean;
113
+ /** Whether the checkbox group is required. */
114
+ isRequired?: boolean;
115
+ /** Whether the checkbox group is invalid. */
116
+ isInvalid?: boolean;
117
+ /** The name of the checkbox group, used when submitting an HTML form. */
118
+ name?: string;
119
+ /** The form to associate the checkbox group with. */
120
+ form?: string;
121
+ /** The label for the checkbox group. */
122
+ label?: string;
123
+ /** Handler that is called when the checkbox group receives focus. */
124
+ onFocus?: (e: FocusEvent) => void;
125
+ /** Handler that is called when the checkbox group loses focus. */
126
+ onBlur?: (e: FocusEvent) => void;
127
+ /** Handler that is called when the checkbox group's focus status changes. */
128
+ onFocusChange?: (isFocused: boolean) => void;
129
+ }
130
+ interface CheckboxGroupState {
131
+ /** Current selected values. */
132
+ readonly value: Accessor<readonly string[]>;
133
+ /** Default selected values. */
134
+ readonly defaultValue: readonly string[];
135
+ /** Whether the checkbox group is disabled. */
136
+ readonly isDisabled: boolean;
137
+ /** Whether the checkbox group is read only. */
138
+ readonly isReadOnly: boolean;
139
+ /** Whether the checkbox group is invalid. */
140
+ readonly isInvalid: boolean;
141
+ /**
142
+ * Whether the checkboxes in the group are required.
143
+ * This changes to false once at least one item is selected.
144
+ */
145
+ readonly isRequired: Accessor<boolean>;
146
+ /** Returns whether the given value is selected. */
147
+ isSelected(value: string): boolean;
148
+ /** Sets the selected values. */
149
+ setValue(value: string[]): void;
150
+ /** Adds a value to the set of selected values. */
151
+ addValue(value: string): void;
152
+ /** Removes a value from the set of selected values. */
153
+ removeValue(value: string): void;
154
+ /** Toggles a value in the set of selected values. */
155
+ toggleValue(value: string): void;
156
+ }
157
+ /**
158
+ * Provides state management for a checkbox group component.
159
+ * Provides a name for the group, and manages selection and focus state.
160
+ */
161
+ declare function createCheckboxGroupState(props?: MaybeAccessor<CheckboxGroupProps>): CheckboxGroupState;
162
+
163
+ /**
164
+ * Radio group state for Solid Stately
165
+ *
166
+ * Provides state management for a radio group component.
167
+ * Provides a name for the group, and manages selection and focus state.
168
+ *
169
+ * This is a 1:1 port of @react-stately/radio's useRadioGroupState.
170
+ */
171
+
172
+ interface RadioGroupProps {
173
+ /** The current selected value (controlled). */
174
+ value?: string | null;
175
+ /** The default selected value (uncontrolled). */
176
+ defaultValue?: string | null;
177
+ /** Handler that is called when the value changes. */
178
+ onChange?: (value: string) => void;
179
+ /** Whether the radio group is disabled. */
180
+ isDisabled?: boolean;
181
+ /** Whether the radio group is read only. */
182
+ isReadOnly?: boolean;
183
+ /** Whether the radio group is required. */
184
+ isRequired?: boolean;
185
+ /** Whether the radio group is invalid. */
186
+ isInvalid?: boolean;
187
+ /** The name of the radio group, used when submitting an HTML form. */
188
+ name?: string;
189
+ /** The form to associate the radio group with. */
190
+ form?: string;
191
+ /** The label for the radio group. */
192
+ label?: string;
193
+ /** Orientation of the radio group. */
194
+ orientation?: 'horizontal' | 'vertical';
195
+ /** Handler that is called when the radio group receives focus. */
196
+ onFocus?: (e: FocusEvent) => void;
197
+ /** Handler that is called when the radio group loses focus. */
198
+ onBlur?: (e: FocusEvent) => void;
199
+ /** Handler that is called when the radio group's focus status changes. */
200
+ onFocusChange?: (isFocused: boolean) => void;
201
+ }
202
+ interface RadioGroupState {
203
+ /** The name for the group, used for native form submission. */
204
+ readonly name: string;
205
+ /** Whether the radio group is disabled. */
206
+ readonly isDisabled: boolean;
207
+ /** Whether the radio group is read only. */
208
+ readonly isReadOnly: boolean;
209
+ /** Whether the radio group is required. */
210
+ readonly isRequired: boolean;
211
+ /** Whether the radio group is invalid. */
212
+ readonly isInvalid: boolean;
213
+ /** The currently selected value. */
214
+ readonly selectedValue: Accessor<string | null>;
215
+ /** The default selected value. */
216
+ readonly defaultSelectedValue: string | null;
217
+ /** Sets the selected value. */
218
+ setSelectedValue(value: string | null): void;
219
+ /** The value of the last focused radio. */
220
+ readonly lastFocusedValue: Accessor<string | null>;
221
+ /** Sets the last focused value. */
222
+ setLastFocusedValue(value: string | null): void;
223
+ }
224
+ /**
225
+ * Internal WeakMap to store sync version accessors for each radio group state.
226
+ * This is used by createRadio to trigger DOM sync when native radio behavior
227
+ * causes the DOM checked state to desync from our reactive state.
228
+ *
229
+ * This is kept separate from RadioGroupState to maintain API parity with React-Stately.
230
+ * @internal
231
+ */
232
+ declare const radioGroupSyncVersion: WeakMap<RadioGroupState, Accessor<number>>;
233
+ /**
234
+ * Provides state management for a radio group component.
235
+ * Provides a name for the group, and manages selection and focus state.
236
+ */
237
+ declare function createRadioGroupState(props?: MaybeAccessor<RadioGroupProps>): RadioGroupState;
238
+
239
+ /**
240
+ * SSR utilities for Solid Stately
241
+ *
242
+ * SolidJS has built-in SSR support with `isServer` and `createUniqueId()`.
243
+ * These utilities provide a consistent API matching React-Stately's patterns.
244
+ */
245
+ /**
246
+ * Returns whether the component is currently being server side rendered.
247
+ * Can be used to delay browser-specific rendering until after hydration.
248
+ */
249
+ declare function createIsSSR(): boolean;
250
+ /**
251
+ * Generate a unique ID that is stable across server and client.
252
+ * Uses SolidJS's built-in createUniqueId which handles SSR correctly.
253
+ *
254
+ * @param defaultId - Optional default ID to use instead of generating one.
255
+ */
256
+ declare function createId(defaultId?: string): string;
257
+ /**
258
+ * Check if we can use DOM APIs.
259
+ * This is useful for code that needs to run only in the browser.
260
+ */
261
+ declare const canUseDOM: boolean;
262
+
263
+ export { type CheckboxGroupProps, type CheckboxGroupState, type MaybeAccessor, type MaybeAccessorValue, type RadioGroupProps, type RadioGroupState, type TextFieldState, type TextFieldStateOptions, type ToggleState, type ToggleStateOptions, access, canUseDOM, createCheckboxGroupState, createId, createIsSSR, createRadioGroupState, createTextFieldState, createToggleState, isAccessor, radioGroupSyncVersion };
package/dist/index.js CHANGED
@@ -1,11 +1,17 @@
1
- import { createSignal, createUniqueId, untrack } from "solid-js";
2
- import { isServer } from "solid-js/web";
1
+ import { createSignal, createUniqueId, untrack } from 'solid-js';
2
+ import { isServer } from 'solid-js/web';
3
+
4
+ // src/toggle/createToggleState.ts
5
+
6
+ // src/utils/reactivity.ts
3
7
  function access(value) {
4
8
  return typeof value === "function" ? value() : value;
5
9
  }
6
10
  function isAccessor(value) {
7
11
  return typeof value === "function";
8
12
  }
13
+
14
+ // src/toggle/createToggleState.ts
9
15
  function createToggleState(props = {}) {
10
16
  const getProps = () => access(props);
11
17
  const initialProps = getProps();
@@ -17,7 +23,6 @@ function createToggleState(props = {}) {
17
23
  return isControlled() ? p.isSelected ?? false : internalSelected();
18
24
  };
19
25
  function setSelected(value) {
20
- var _a;
21
26
  const p = getProps();
22
27
  if (p.isReadOnly) {
23
28
  return;
@@ -25,7 +30,7 @@ function createToggleState(props = {}) {
25
30
  if (!isControlled()) {
26
31
  setInternalSelected(value);
27
32
  }
28
- (_a = p.onChange) == null ? void 0 : _a.call(p, value);
33
+ p.onChange?.(value);
29
34
  }
30
35
  function toggle() {
31
36
  const p = getProps();
@@ -52,12 +57,11 @@ function createTextFieldState(props = {}) {
52
57
  return isControlled() ? p.value ?? "" : internalValue();
53
58
  };
54
59
  function setValue(newValue) {
55
- var _a;
56
60
  const p = getProps();
57
61
  if (!isControlled()) {
58
62
  setInternalValue(newValue);
59
63
  }
60
- (_a = p.onChange) == null ? void 0 : _a.call(p, newValue);
64
+ p.onChange?.(newValue);
61
65
  }
62
66
  return {
63
67
  value,
@@ -82,7 +86,6 @@ function createCheckboxGroupState(props = {}) {
82
86
  return getProps().isInvalid ?? false;
83
87
  };
84
88
  function setValue(newValue) {
85
- var _a;
86
89
  const p = getProps();
87
90
  if (p.isReadOnly || p.isDisabled) {
88
91
  return;
@@ -90,7 +93,7 @@ function createCheckboxGroupState(props = {}) {
90
93
  if (!isControlled()) {
91
94
  setInternalValue(newValue);
92
95
  }
93
- (_a = p.onChange) == null ? void 0 : _a.call(p, newValue);
96
+ p.onChange?.(newValue);
94
97
  }
95
98
  function isSelected(checkValue) {
96
99
  return value().includes(checkValue);
@@ -156,8 +159,10 @@ function createId(defaultId) {
156
159
  }
157
160
  return `solid-stately-${createUniqueId()}`;
158
161
  }
159
- const canUseDOM = !isServer;
160
- const radioGroupSyncVersion = /* @__PURE__ */ new WeakMap();
162
+ var canUseDOM = !isServer;
163
+
164
+ // src/radio/createRadioGroupState.ts
165
+ var radioGroupSyncVersion = /* @__PURE__ */ new WeakMap();
161
166
  function createRadioGroupState(props = {}) {
162
167
  const getProps = () => access(props);
163
168
  const initialProps = untrack(() => getProps());
@@ -179,7 +184,6 @@ function createRadioGroupState(props = {}) {
179
184
  return getProps().isInvalid ?? false;
180
185
  };
181
186
  function setSelectedValue(value) {
182
- var _a;
183
187
  const p = getProps();
184
188
  if (p.isReadOnly || p.isDisabled) {
185
189
  return;
@@ -189,7 +193,7 @@ function createRadioGroupState(props = {}) {
189
193
  setInternalValue(value);
190
194
  }
191
195
  if (value != null) {
192
- (_a = p.onChange) == null ? void 0 : _a.call(p, value);
196
+ p.onChange?.(value);
193
197
  }
194
198
  }
195
199
  function setLastFocusedValue(value) {
@@ -218,16 +222,5 @@ function createRadioGroupState(props = {}) {
218
222
  radioGroupSyncVersion.set(state, syncVersion);
219
223
  return state;
220
224
  }
221
- export {
222
- access,
223
- canUseDOM,
224
- createCheckboxGroupState,
225
- createId,
226
- createIsSSR,
227
- createRadioGroupState,
228
- createTextFieldState,
229
- createToggleState,
230
- isAccessor,
231
- radioGroupSyncVersion
232
- };
233
- //# sourceMappingURL=index.js.map
225
+
226
+ export { access, canUseDOM, createCheckboxGroupState, createId, createIsSSR, createRadioGroupState, createTextFieldState, createToggleState, isAccessor, radioGroupSyncVersion };
package/dist/index.jsx ADDED
@@ -0,0 +1,247 @@
1
+ // src/toggle/createToggleState.ts
2
+ import { createSignal } from "solid-js";
3
+
4
+ // src/utils/reactivity.ts
5
+ function access(value) {
6
+ return typeof value === "function" ? value() : value;
7
+ }
8
+ function isAccessor(value) {
9
+ return typeof value === "function";
10
+ }
11
+
12
+ // src/toggle/createToggleState.ts
13
+ function createToggleState(props = {}) {
14
+ const getProps = () => access(props);
15
+ const initialProps = getProps();
16
+ const initialSelected = initialProps.isSelected ?? initialProps.defaultSelected ?? false;
17
+ const [internalSelected, setInternalSelected] = createSignal(initialSelected);
18
+ const isControlled = () => getProps().isSelected !== void 0;
19
+ const isSelected = () => {
20
+ const p = getProps();
21
+ return isControlled() ? p.isSelected ?? false : internalSelected();
22
+ };
23
+ function setSelected(value) {
24
+ const p = getProps();
25
+ if (p.isReadOnly) {
26
+ return;
27
+ }
28
+ if (!isControlled()) {
29
+ setInternalSelected(value);
30
+ }
31
+ p.onChange?.(value);
32
+ }
33
+ function toggle() {
34
+ const p = getProps();
35
+ if (p.isReadOnly) {
36
+ return;
37
+ }
38
+ setSelected(!isSelected());
39
+ }
40
+ return {
41
+ isSelected,
42
+ defaultSelected: initialProps.defaultSelected ?? initialSelected,
43
+ setSelected,
44
+ toggle
45
+ };
46
+ }
47
+
48
+ // src/textfield/createTextFieldState.ts
49
+ import { createSignal as createSignal2 } from "solid-js";
50
+ function createTextFieldState(props = {}) {
51
+ const getProps = () => access(props);
52
+ const initialProps = getProps();
53
+ const initialValue = initialProps.value ?? initialProps.defaultValue ?? "";
54
+ const [internalValue, setInternalValue] = createSignal2(initialValue);
55
+ const isControlled = () => getProps().value !== void 0;
56
+ const value = () => {
57
+ const p = getProps();
58
+ return isControlled() ? p.value ?? "" : internalValue();
59
+ };
60
+ function setValue(newValue) {
61
+ const p = getProps();
62
+ if (!isControlled()) {
63
+ setInternalValue(newValue);
64
+ }
65
+ p.onChange?.(newValue);
66
+ }
67
+ return {
68
+ value,
69
+ setValue
70
+ };
71
+ }
72
+
73
+ // src/checkbox/createCheckboxGroupState.ts
74
+ import { createSignal as createSignal3 } from "solid-js";
75
+ function createCheckboxGroupState(props = {}) {
76
+ const getProps = () => access(props);
77
+ const initialProps = getProps();
78
+ const initialValue = initialProps.value ?? initialProps.defaultValue ?? [];
79
+ const [internalValue, setInternalValue] = createSignal3(initialValue);
80
+ const isControlled = () => getProps().value !== void 0;
81
+ const value = () => {
82
+ const p = getProps();
83
+ return isControlled() ? p.value ?? [] : internalValue();
84
+ };
85
+ const isRequired = () => {
86
+ const p = getProps();
87
+ return !!p.isRequired && value().length === 0;
88
+ };
89
+ const isInvalid = () => {
90
+ return getProps().isInvalid ?? false;
91
+ };
92
+ function setValue(newValue) {
93
+ const p = getProps();
94
+ if (p.isReadOnly || p.isDisabled) {
95
+ return;
96
+ }
97
+ if (!isControlled()) {
98
+ setInternalValue(newValue);
99
+ }
100
+ p.onChange?.(newValue);
101
+ }
102
+ function isSelected(checkValue) {
103
+ return value().includes(checkValue);
104
+ }
105
+ function addValue(addVal) {
106
+ const p = getProps();
107
+ if (p.isReadOnly || p.isDisabled) {
108
+ return;
109
+ }
110
+ const current = value();
111
+ if (!current.includes(addVal)) {
112
+ setValue([...current, addVal]);
113
+ }
114
+ }
115
+ function removeValue(removeVal) {
116
+ const p = getProps();
117
+ if (p.isReadOnly || p.isDisabled) {
118
+ return;
119
+ }
120
+ const current = value();
121
+ if (current.includes(removeVal)) {
122
+ setValue(current.filter((v) => v !== removeVal));
123
+ }
124
+ }
125
+ function toggleValue(toggleVal) {
126
+ const p = getProps();
127
+ if (p.isReadOnly || p.isDisabled) {
128
+ return;
129
+ }
130
+ const current = value();
131
+ if (current.includes(toggleVal)) {
132
+ setValue(current.filter((v) => v !== toggleVal));
133
+ } else {
134
+ setValue([...current, toggleVal]);
135
+ }
136
+ }
137
+ return {
138
+ value,
139
+ defaultValue: initialProps.defaultValue ?? initialValue,
140
+ get isDisabled() {
141
+ return getProps().isDisabled ?? false;
142
+ },
143
+ get isReadOnly() {
144
+ return getProps().isReadOnly ?? false;
145
+ },
146
+ get isInvalid() {
147
+ return isInvalid();
148
+ },
149
+ isRequired,
150
+ isSelected,
151
+ setValue,
152
+ addValue,
153
+ removeValue,
154
+ toggleValue
155
+ };
156
+ }
157
+
158
+ // src/radio/createRadioGroupState.ts
159
+ import { createSignal as createSignal4, untrack } from "solid-js";
160
+
161
+ // src/ssr/index.ts
162
+ import { createUniqueId } from "solid-js";
163
+ import { isServer } from "solid-js/web";
164
+ function createIsSSR() {
165
+ return isServer;
166
+ }
167
+ function createId(defaultId) {
168
+ if (defaultId) {
169
+ return defaultId;
170
+ }
171
+ return `solid-stately-${createUniqueId()}`;
172
+ }
173
+ var canUseDOM = !isServer;
174
+
175
+ // src/radio/createRadioGroupState.ts
176
+ var radioGroupSyncVersion = /* @__PURE__ */ new WeakMap();
177
+ function createRadioGroupState(props = {}) {
178
+ const getProps = () => access(props);
179
+ const initialProps = untrack(() => getProps());
180
+ const name = initialProps.name || `radio-group-${createId()}`;
181
+ const [internalValue, setInternalValue] = createSignal4(
182
+ initialProps.defaultValue ?? null
183
+ );
184
+ const [lastFocusedValue, setLastFocusedValueInternal] = createSignal4(null);
185
+ const [syncVersion, setSyncVersion] = createSignal4(0);
186
+ const isControlled = () => getProps().value !== void 0;
187
+ const selectedValue = () => {
188
+ const p = getProps();
189
+ if (p.value !== void 0) {
190
+ return p.value ?? null;
191
+ }
192
+ return internalValue();
193
+ };
194
+ const isInvalid = () => {
195
+ return getProps().isInvalid ?? false;
196
+ };
197
+ function setSelectedValue(value) {
198
+ const p = getProps();
199
+ if (p.isReadOnly || p.isDisabled) {
200
+ return;
201
+ }
202
+ setSyncVersion((v) => v + 1);
203
+ if (!isControlled()) {
204
+ setInternalValue(value);
205
+ }
206
+ if (value != null) {
207
+ p.onChange?.(value);
208
+ }
209
+ }
210
+ function setLastFocusedValue(value) {
211
+ setLastFocusedValueInternal(value);
212
+ }
213
+ const state = {
214
+ name,
215
+ selectedValue,
216
+ defaultSelectedValue: initialProps.defaultValue ?? null,
217
+ setSelectedValue,
218
+ lastFocusedValue,
219
+ setLastFocusedValue,
220
+ get isDisabled() {
221
+ return getProps().isDisabled ?? false;
222
+ },
223
+ get isReadOnly() {
224
+ return getProps().isReadOnly ?? false;
225
+ },
226
+ get isRequired() {
227
+ return getProps().isRequired ?? false;
228
+ },
229
+ get isInvalid() {
230
+ return isInvalid();
231
+ }
232
+ };
233
+ radioGroupSyncVersion.set(state, syncVersion);
234
+ return state;
235
+ }
236
+ export {
237
+ access,
238
+ canUseDOM,
239
+ createCheckboxGroupState,
240
+ createId,
241
+ createIsSSR,
242
+ createRadioGroupState,
243
+ createTextFieldState,
244
+ createToggleState,
245
+ isAccessor,
246
+ radioGroupSyncVersion
247
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proyecto-viviana/solid-stately",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "A 1-1 SolidJS port of React Stately - headless state management for UI components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -8,25 +8,28 @@
8
8
  "types": "./dist/index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
- "solid": "./dist/index.js",
11
+ "solid": "./dist/index.jsx",
12
12
  "import": "./dist/index.js",
13
13
  "types": "./dist/index.d.ts"
14
14
  }
15
15
  },
16
16
  "files": [
17
- "dist"
17
+ "dist",
18
+ "src"
18
19
  ],
19
20
  "sideEffects": false,
20
21
  "scripts": {
21
- "build": "rimraf dist tsconfig.build.tsbuildinfo && vite build && tsc -p tsconfig.build.json",
22
- "dev": "vite build --watch",
22
+ "build": "tsup",
23
+ "dev": "tsup --watch",
23
24
  "prepublishOnly": "bun run build"
24
25
  },
25
26
  "peerDependencies": {
26
27
  "solid-js": "^1.9.0"
27
28
  },
28
29
  "devDependencies": {
29
- "solid-js": "^1.9.10"
30
+ "esbuild-plugin-solid": "^0.6.0",
31
+ "solid-js": "^1.9.10",
32
+ "tsup": "^8.0.0"
30
33
  },
31
34
  "keywords": [
32
35
  "solid",