@pure-ds/storybook 0.4.25 → 0.4.26

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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "generatedAt": "2026-01-16T15:17:15.159Z",
2
+ "generatedAt": "2026-01-16T15:44:04.960Z",
3
3
  "sources": {
4
4
  "customElements": "custom-elements.json",
5
5
  "ontology": "src\\js\\pds-core\\pds-ontology.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pure-ds/storybook",
3
- "version": "0.4.25",
3
+ "version": "0.4.26",
4
4
  "description": "Storybook showcase for Pure Design System with live configuration",
5
5
  "type": "module",
6
6
  "private": false,
@@ -37,7 +37,7 @@
37
37
  "pds:build-icons": "pds-build-icons"
38
38
  },
39
39
  "peerDependencies": {
40
- "@pure-ds/core": "^0.4.25"
40
+ "@pure-ds/core": "^0.4.26"
41
41
  },
42
42
  "dependencies": {
43
43
  "@custom-elements-manifest/analyzer": "^0.11.0",
@@ -691,15 +691,33 @@ const simpleSchema = {
691
691
  type: "string",
692
692
  format: "date",
693
693
  title: "Date of Birth",
694
+ examples: ["1990-01-15"],
694
695
  },
695
696
  newsletter: {
696
697
  type: "boolean",
697
698
  title: "Subscribe to newsletter",
699
+ default: false,
698
700
  },
699
701
  },
700
702
  required: ["name", "email"],
701
703
  };
702
704
 
705
+ // UI Schema with icons for better UX
706
+ const simpleUiSchema = {
707
+ "/name": {
708
+ "ui:icon": "user",
709
+ "ui:iconPosition": "start",
710
+ },
711
+ "/email": {
712
+ "ui:icon": "envelope",
713
+ "ui:iconPosition": "start",
714
+ },
715
+ "/dateOfBirth": {
716
+ "ui:icon": "calendar",
717
+ "ui:iconPosition": "start",
718
+ },
719
+ };
720
+
703
721
  const complexSchema = {
704
722
  type: "object",
705
723
  properties: {
@@ -744,17 +762,52 @@ const complexSchema = {
744
762
 
745
763
  export const SimpleForm = {
746
764
  render: () => {
765
+ const handleSubmit = async (e) => {
766
+ // Add btn-working class to show loading state
767
+ const submitBtn = e.target.querySelector('button[type="submit"]');
768
+ submitBtn?.classList.add('btn-working');
769
+
770
+ try {
771
+ // Simulate async submission (2 second delay)
772
+ await new Promise(resolve => setTimeout(resolve, 2000));
773
+ await toastFormData(e.detail);
774
+ } finally {
775
+ submitBtn?.classList.remove('btn-working');
776
+ }
777
+ };
778
+
747
779
  return html`
748
780
  <pds-form
749
781
  data-required
750
782
  .jsonSchema=${simpleSchema}
751
- @pw:submit=${(e) => toastFormData(e.detail)}
783
+ .uiSchema=${simpleUiSchema}
784
+ @pw:submit=${handleSubmit}
752
785
  ></pds-form>
753
786
  `;
754
787
  },
755
788
  };
756
789
 
757
790
  const complexUiSchema = {
791
+ "/personalInfo/firstName": {
792
+ "ui:icon": "user",
793
+ "ui:iconPosition": "start",
794
+ },
795
+ "/personalInfo/lastName": {
796
+ "ui:icon": "user",
797
+ "ui:iconPosition": "start",
798
+ },
799
+ "/personalInfo/dateOfBirth": {
800
+ "ui:icon": "calendar",
801
+ "ui:iconPosition": "start",
802
+ },
803
+ "/address/street": {
804
+ "ui:icon": "map-pin",
805
+ "ui:iconPosition": "start",
806
+ },
807
+ "/address/city": {
808
+ "ui:icon": "building",
809
+ "ui:iconPosition": "start",
810
+ },
758
811
  "address/country": {
759
812
  "ui:class": "buttons"
760
813
  },
@@ -765,11 +818,23 @@ const complexUiSchema = {
765
818
 
766
819
  export const ComplexForm = {
767
820
  render: () => {
821
+ const handleSubmit = async (e) => {
822
+ const submitBtn = e.target.querySelector('button[type="submit"]');
823
+ submitBtn?.classList.add('btn-working');
824
+
825
+ try {
826
+ await new Promise(resolve => setTimeout(resolve, 2000));
827
+ await toastFormData(e.detail);
828
+ } finally {
829
+ submitBtn?.classList.remove('btn-working');
830
+ }
831
+ };
832
+
768
833
  return html`
769
834
  <pds-form
770
835
  .jsonSchema=${complexSchema}
771
836
  .uiSchema=${complexUiSchema}
772
- @pw:submit=${(e) => toastFormData(e.detail)}
837
+ @pw:submit=${handleSubmit}
773
838
  ></pds-form>
774
839
  `;
775
840
  },
@@ -790,13 +855,26 @@ export const WithInitialData = {
790
855
  newsletter: true,
791
856
  };
792
857
 
858
+ const handleSubmit = async (e) => {
859
+ const submitBtn = e.target.querySelector('button[type="submit"]');
860
+ submitBtn?.classList.add('btn-working');
861
+
862
+ try {
863
+ await new Promise(resolve => setTimeout(resolve, 2000));
864
+ await toastFormData(e.detail);
865
+ } finally {
866
+ submitBtn?.classList.remove('btn-working');
867
+ }
868
+ };
869
+
793
870
  return html`
794
871
  <pds-form
795
872
  .jsonSchema=${simpleSchema}
873
+ .uiSchema=${simpleUiSchema}
796
874
  .values=${initialValues}
797
875
  .options=${options}
798
876
  @pw:value-change=${(e) => console.log("?? Value changed:", e.detail)}
799
- @pw:submit=${(e) => toastFormData(e.detail)}
877
+ @pw:submit=${handleSubmit}
800
878
  ></pds-form>
801
879
  `;
802
880
  },