@proyecto-viviana/solidaria-components 0.0.2 → 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.js CHANGED
@@ -1,8 +1,9 @@
1
- import { createMemo, splitProps, createContext, useContext } from 'solid-js';
1
+ import { createContext, createMemo, splitProps, useContext } from 'solid-js';
2
2
  import { createComponent, Dynamic, mergeProps, template, spread, insert, use } from 'solid-js/web';
3
- import { createButton, createFocusRing, createHover, createSwitch, createCheckboxGroupItem, createCheckbox, createCheckboxGroup, createRadioGroup, createRadio, createTextField, createLink, createProgressBar, createSeparator } from '@proyecto-viviana/solidaria';
3
+ import { createButton, createFocusRing, createHover, createSwitch, createCheckboxGroup, createCheckboxGroupItem, createCheckbox, createRadioGroup, createTextField, createLink, createProgressBar, createSeparator, createRadio } from '@proyecto-viviana/solidaria';
4
4
  import { createToggleState, createCheckboxGroupState, createRadioGroupState, createTextFieldState } from '@proyecto-viviana/solid-stately';
5
5
 
6
+ // src/utils.tsx
6
7
  function useRenderProps(props, values) {
7
8
  return createMemo(() => {
8
9
  const currentValues = values();
@@ -64,8 +65,7 @@ function filterDOMProps(props, options = {}) {
64
65
  }
65
66
  return result;
66
67
  }
67
-
68
- const visuallyHiddenStyles = {
68
+ var visuallyHiddenStyles = {
69
69
  border: "0",
70
70
  clip: "rect(0 0 0 0)",
71
71
  "clip-path": "inset(50%)",
@@ -91,9 +91,8 @@ function VisuallyHidden(props) {
91
91
  }
92
92
  }));
93
93
  }
94
-
95
- var _tmpl$$5 = /* @__PURE__ */ template(`<button>`);
96
- const ButtonContext = createContext(null);
94
+ var _tmpl$ = /* @__PURE__ */ template(`<button>`);
95
+ var ButtonContext = createContext(null);
97
96
  function Button(props) {
98
97
  const [local, ariaProps] = splitProps(props, ["children", "class", "style", "slot"]);
99
98
  const resolveDisabled = () => {
@@ -163,7 +162,7 @@ function Button(props) {
163
162
  return rest;
164
163
  };
165
164
  return (() => {
166
- var _el$ = _tmpl$$5();
165
+ var _el$ = _tmpl$();
167
166
  spread(_el$, mergeProps(domProps, cleanButtonProps, cleanFocusProps, cleanHoverProps, {
168
167
  get ["class"]() {
169
168
  return renderProps().class;
@@ -191,9 +190,9 @@ function Button(props) {
191
190
  return _el$;
192
191
  })();
193
192
  }
194
-
195
- var _tmpl$$4 = /* @__PURE__ */ template(`<input>`), _tmpl$2$3 = /* @__PURE__ */ template(`<label>`);
196
- const ToggleSwitchContext = createContext(null);
193
+ var _tmpl$2 = /* @__PURE__ */ template(`<input>`);
194
+ var _tmpl$22 = /* @__PURE__ */ template(`<label>`);
195
+ var ToggleSwitchContext = createContext(null);
197
196
  function ToggleSwitch(props) {
198
197
  let inputRef = null;
199
198
  const [local, ariaProps] = splitProps(props, ["children", "class", "style", "slot"]);
@@ -281,7 +280,7 @@ function ToggleSwitch(props) {
281
280
  return rest;
282
281
  };
283
282
  return (() => {
284
- var _el$ = _tmpl$2$3();
283
+ var _el$ = _tmpl$22();
285
284
  spread(_el$, mergeProps(domProps, cleanLabelProps, cleanHoverProps, {
286
285
  get ["class"]() {
287
286
  return renderProps().class;
@@ -313,7 +312,7 @@ function ToggleSwitch(props) {
313
312
  }), false, true);
314
313
  insert(_el$, createComponent(VisuallyHidden, {
315
314
  get children() {
316
- var _el$2 = _tmpl$$4();
315
+ var _el$2 = _tmpl$2();
317
316
  use((el) => inputRef = el, _el$2);
318
317
  spread(_el$2, mergeProps(cleanInputProps, cleanFocusProps), false, false);
319
318
  return _el$2;
@@ -323,11 +322,12 @@ function ToggleSwitch(props) {
323
322
  return _el$;
324
323
  })();
325
324
  }
326
-
327
- var _tmpl$$3 = /* @__PURE__ */ template(`<div>`), _tmpl$2$2 = /* @__PURE__ */ template(`<input>`), _tmpl$3$2 = /* @__PURE__ */ template(`<label>`);
328
- const CheckboxGroupContext = createContext(null);
329
- const CheckboxGroupStateContext = createContext(null);
330
- const CheckboxContext = createContext(null);
325
+ var _tmpl$3 = /* @__PURE__ */ template(`<div>`);
326
+ var _tmpl$23 = /* @__PURE__ */ template(`<input>`);
327
+ var _tmpl$32 = /* @__PURE__ */ template(`<label>`);
328
+ var CheckboxGroupContext = createContext(null);
329
+ var CheckboxGroupStateContext = createContext(null);
330
+ var CheckboxContext = createContext(null);
331
331
  function CheckboxGroup(props) {
332
332
  const [local, ariaProps] = splitProps(props, ["children", "class", "style", "slot"]);
333
333
  const state = createCheckboxGroupState({
@@ -380,7 +380,7 @@ function CheckboxGroup(props) {
380
380
  return createComponent(CheckboxGroupStateContext.Provider, {
381
381
  value: state,
382
382
  get children() {
383
- var _el$ = _tmpl$$3();
383
+ var _el$ = _tmpl$3();
384
384
  spread(_el$, mergeProps(domProps, cleanGroupProps, {
385
385
  get ["class"]() {
386
386
  return renderProps().class;
@@ -526,7 +526,7 @@ function Checkbox(props) {
526
526
  return rest;
527
527
  };
528
528
  return (() => {
529
- var _el$2 = _tmpl$3$2();
529
+ var _el$2 = _tmpl$32();
530
530
  spread(_el$2, mergeProps(domProps, cleanLabelProps, cleanHoverProps, {
531
531
  get ["class"]() {
532
532
  return renderProps().class;
@@ -561,7 +561,7 @@ function Checkbox(props) {
561
561
  }), false, true);
562
562
  insert(_el$2, createComponent(VisuallyHidden, {
563
563
  get children() {
564
- var _el$3 = _tmpl$2$2();
564
+ var _el$3 = _tmpl$23();
565
565
  use((el) => inputRef = el, _el$3);
566
566
  spread(_el$3, mergeProps(cleanInputProps, cleanFocusProps), false, false);
567
567
  return _el$3;
@@ -571,11 +571,12 @@ function Checkbox(props) {
571
571
  return _el$2;
572
572
  })();
573
573
  }
574
-
575
- var _tmpl$$2 = /* @__PURE__ */ template(`<div>`), _tmpl$2$1 = /* @__PURE__ */ template(`<input>`), _tmpl$3$1 = /* @__PURE__ */ template(`<label>`);
576
- const RadioGroupContext = createContext(null);
577
- const RadioGroupStateContext = createContext(null);
578
- const RadioContext = createContext(null);
574
+ var _tmpl$4 = /* @__PURE__ */ template(`<div>`);
575
+ var _tmpl$24 = /* @__PURE__ */ template(`<input>`);
576
+ var _tmpl$33 = /* @__PURE__ */ template(`<label>`);
577
+ var RadioGroupContext = createContext(null);
578
+ var RadioGroupStateContext = createContext(null);
579
+ var RadioContext = createContext(null);
579
580
  function RadioGroup(props) {
580
581
  const [local, ariaProps] = splitProps(props, ["children", "class", "style", "slot"]);
581
582
  const state = createRadioGroupState({
@@ -629,7 +630,7 @@ function RadioGroup(props) {
629
630
  return createComponent(RadioGroupStateContext.Provider, {
630
631
  value: state,
631
632
  get children() {
632
- var _el$ = _tmpl$$2();
633
+ var _el$ = _tmpl$4();
633
634
  spread(_el$, mergeProps(domProps, cleanGroupProps, {
634
635
  get ["class"]() {
635
636
  return renderProps().class;
@@ -736,7 +737,7 @@ function RadioImpl(props) {
736
737
  return rest;
737
738
  };
738
739
  return (() => {
739
- var _el$2 = _tmpl$3$1();
740
+ var _el$2 = _tmpl$33();
740
741
  spread(_el$2, mergeProps(domProps, cleanLabelProps, cleanHoverProps, {
741
742
  get ["class"]() {
742
743
  return renderProps().class;
@@ -774,7 +775,7 @@ function RadioImpl(props) {
774
775
  }), false, true);
775
776
  insert(_el$2, createComponent(VisuallyHidden, {
776
777
  get children() {
777
- var _el$3 = _tmpl$2$1();
778
+ var _el$3 = _tmpl$24();
778
779
  use((el) => inputRef = el, _el$3);
779
780
  spread(_el$3, mergeProps(cleanInputProps, cleanFocusProps), false, false);
780
781
  return _el$3;
@@ -785,7 +786,7 @@ function RadioImpl(props) {
785
786
  })();
786
787
  }
787
788
  function Radio(props) {
788
- return (() => {
789
+ return () => {
789
790
  const state = useContext(RadioGroupStateContext);
790
791
  if (!state) {
791
792
  throw new Error("Radio must be used within a RadioGroup");
@@ -794,11 +795,13 @@ function Radio(props) {
794
795
  radioProps: props,
795
796
  state
796
797
  });
797
- });
798
+ };
798
799
  }
799
-
800
- var _tmpl$$1 = /* @__PURE__ */ template(`<label>`), _tmpl$2 = /* @__PURE__ */ template(`<input>`), _tmpl$3 = /* @__PURE__ */ template(`<textarea>`), _tmpl$4 = /* @__PURE__ */ template(`<div>`);
801
- const TextFieldContext = createContext(null);
800
+ var _tmpl$5 = /* @__PURE__ */ template(`<label>`);
801
+ var _tmpl$25 = /* @__PURE__ */ template(`<input>`);
802
+ var _tmpl$34 = /* @__PURE__ */ template(`<textarea>`);
803
+ var _tmpl$42 = /* @__PURE__ */ template(`<div>`);
804
+ var TextFieldContext = createContext(null);
802
805
  function Label(props) {
803
806
  const context = useContext(TextFieldContext);
804
807
  const mergedProps = () => {
@@ -815,7 +818,7 @@ function Label(props) {
815
818
  return props;
816
819
  };
817
820
  return (() => {
818
- var _el$ = _tmpl$$1();
821
+ var _el$ = _tmpl$5();
819
822
  spread(_el$, mergeProps(mergedProps), false, true);
820
823
  insert(_el$, () => props.children);
821
824
  return _el$;
@@ -837,7 +840,7 @@ function Input(props) {
837
840
  return props;
838
841
  };
839
842
  return (() => {
840
- var _el$2 = _tmpl$2();
843
+ var _el$2 = _tmpl$25();
841
844
  spread(_el$2, mergeProps(mergedProps), false, false);
842
845
  return _el$2;
843
846
  })();
@@ -859,7 +862,7 @@ function TextArea(props) {
859
862
  return props;
860
863
  };
861
864
  return (() => {
862
- var _el$3 = _tmpl$3();
865
+ var _el$3 = _tmpl$34();
863
866
  spread(_el$3, mergeProps(mergedProps), false, false);
864
867
  return _el$3;
865
868
  })();
@@ -937,7 +940,7 @@ function TextField(props) {
937
940
  return createComponent(TextFieldContext.Provider, {
938
941
  value: contextValue,
939
942
  get children() {
940
- var _el$4 = _tmpl$4();
943
+ var _el$4 = _tmpl$42();
941
944
  spread(_el$4, mergeProps(domProps, cleanHoverProps, {
942
945
  get ["class"]() {
943
946
  return renderProps().class;
@@ -972,8 +975,7 @@ function TextField(props) {
972
975
  }
973
976
  });
974
977
  }
975
-
976
- const LinkContext = createContext(null);
978
+ var LinkContext = createContext(null);
977
979
  function Link(props) {
978
980
  const [local, ariaProps] = splitProps(props, ["children", "class", "style", "slot", "onHoverStart", "onHoverEnd", "onHoverChange"]);
979
981
  const elementType = () => {
@@ -1135,9 +1137,8 @@ function Link(props) {
1135
1137
  }
1136
1138
  }));
1137
1139
  }
1138
-
1139
- var _tmpl$ = /* @__PURE__ */ template(`<div>`);
1140
- const ProgressBarContext = createContext(null);
1140
+ var _tmpl$6 = /* @__PURE__ */ template(`<div>`);
1141
+ var ProgressBarContext = createContext(null);
1141
1142
  function clamp(value, min, max) {
1142
1143
  return Math.min(Math.max(value, min), max);
1143
1144
  }
@@ -1207,7 +1208,7 @@ function ProgressBar(props) {
1207
1208
  global: true
1208
1209
  }));
1209
1210
  return (() => {
1210
- var _el$ = _tmpl$();
1211
+ var _el$ = _tmpl$6();
1211
1212
  spread(_el$, mergeProps(domProps, () => progressAria.progressBarProps, {
1212
1213
  get ["class"]() {
1213
1214
  return renderProps().class;
@@ -1223,8 +1224,7 @@ function ProgressBar(props) {
1223
1224
  return _el$;
1224
1225
  })();
1225
1226
  }
1226
-
1227
- const SeparatorContext = createContext(null);
1227
+ var SeparatorContext = createContext(null);
1228
1228
  function Separator(props) {
1229
1229
  const [local, ariaProps] = splitProps(props, ["class", "style", "slot"]);
1230
1230
  const elementType = createMemo(() => {