@grantbii/design-system 1.29.0 → 3.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.
Files changed (35) hide show
  1. package/README.md +17 -4
  2. package/core/archive/index.d.ts +0 -1
  3. package/core/archive/index.js +0 -1
  4. package/core/archive/index.js.map +1 -1
  5. package/core/molecules/Badge.js +6 -9
  6. package/core/molecules/Badge.js.map +1 -1
  7. package/core/molecules/Toast.d.ts +20 -0
  8. package/core/molecules/Toast.js +239 -0
  9. package/core/molecules/Toast.js.map +1 -0
  10. package/core/molecules/Tooltip.d.ts +20 -0
  11. package/core/molecules/Tooltip.js +182 -0
  12. package/core/molecules/Tooltip.js.map +1 -0
  13. package/core/molecules/index.d.ts +2 -0
  14. package/core/molecules/index.js +2 -0
  15. package/core/molecules/index.js.map +1 -1
  16. package/core/organisms/Dropdown.d.ts +13 -7
  17. package/core/organisms/Dropdown.js +111 -12
  18. package/core/organisms/Dropdown.js.map +1 -1
  19. package/package.json +12 -12
  20. package/stories/molecules/Toast.stories.d.ts +9 -0
  21. package/stories/molecules/Toast.stories.js +106 -0
  22. package/stories/molecules/Toast.stories.js.map +1 -0
  23. package/stories/molecules/Tooltip.stories.d.ts +11 -0
  24. package/stories/molecules/Tooltip.stories.js +33 -0
  25. package/stories/molecules/Tooltip.stories.js.map +1 -0
  26. package/stories/organisms/Dropdown.stories.d.ts +4 -2
  27. package/stories/organisms/Dropdown.stories.js +75 -18
  28. package/stories/organisms/Dropdown.stories.js.map +1 -1
  29. package/tsconfig.tsbuildinfo +1 -1
  30. package/core/archive/TallyModal.d.ts +0 -9
  31. package/core/archive/TallyModal.js +0 -46
  32. package/core/archive/TallyModal.js.map +0 -1
  33. package/stories/archive/TallyModal.stories.d.ts +0 -12
  34. package/stories/archive/TallyModal.stories.js +0 -20
  35. package/stories/archive/TallyModal.stories.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Dropdown.stories.js","sourceRoot":"","sources":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QACJ,UAAU,EAAE,IAAI;KACjB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAU;IACjC,IAAI,EAAE;QACJ,UAAU,EAAE,KAAK;KAClB;CACF,CAAC","sourcesContent":["import { Dropdown, enumToOptions, type DropdownProps } from \"@/.\";\nimport { Objective } from \"@grantbii/ui-core/grant/enums\";\nimport { parseEnum } from \"@grantbii/ui-core/enums\";\nimport type { Meta, StoryObj } from \"@storybook/nextjs-vite\";\nimport { useState } from \"react\";\n\ntype ExampleProps = {\n controlled: boolean;\n};\n\nconst DropdownExample = ({ controlled }: ExampleProps) => {\n const [selectedObjective, setSelectedObjective] = useState(Objective.UNKNOWN);\n\n const controlledProps: DropdownProps = {\n ...baseProps,\n value: selectedObjective === Objective.UNKNOWN ? \"\" : selectedObjective,\n onChange: (event) =>\n setSelectedObjective(parseEnum(event.target.value, Objective)),\n };\n\n return <Dropdown {...(controlled ? controlledProps : uncontrolledProps)} />;\n};\n\nconst baseProps: DropdownProps = {\n options: enumToOptions(Objective),\n defaultLabel: \"Select grant objective\",\n};\n\nconst uncontrolledProps: DropdownProps = {\n ...baseProps,\n defaultValue: \"\",\n};\n\nconst meta: Meta<typeof DropdownExample> = {\n title: \"Organisms/Dropdown\",\n component: DropdownExample,\n tags: [\"autodocs\"],\n};\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\nexport const Controlled: Story = {\n args: {\n controlled: true,\n },\n};\n\nexport const Uncontrolled: Story = {\n args: {\n controlled: false,\n },\n};\n"]}
1
+ {"version":3,"file":"Dropdown.stories.js","sourceRoot":"","sources":["../../../stories/organisms/Dropdown.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAsB,MAAM,KAAK,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE1D,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,EAAE,EA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CAAC,OAAO,CAAC,CAAC;QAC/B,MAAM,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACxD,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,iBAAiB,CAAC,wBAAwB,CAAC,CAAC;IACxE,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAU,EAAE,CAAC;AAEtC,MAAM,CAAC,MAAM,UAAU,GAAU;IAC/B,IAAI,EAAE;QACJ,KAAK,EAAE,aAAa;KACrB;CACF,CAAC","sourcesContent":["import { Dropdown, enumToOptions, type DropdownProps } from \"@/.\";\nimport { Objective } from \"@grantbii/ui-core/grant/enums\";\nimport type { Meta, StoryObj } from \"@storybook/nextjs-vite\";\nimport { useState } from \"react\";\nimport { expect, fn, userEvent, within } from \"storybook/test\";\n\ntype ExampleProps = DropdownProps & {\n controlled: boolean;\n};\n\nconst DropdownExample = ({ controlled, onChange, ...props }: ExampleProps) => {\n const [value, setValue] = useState(props.defaultValue ?? \"\");\n\n const handleChange = (nextValue: string) => {\n setValue(nextValue);\n onChange?.(nextValue);\n };\n\n return (\n <Dropdown\n {...props}\n {...(controlled\n ? { value: props.value ?? value, onChange: handleChange }\n : { onChange })}\n />\n );\n};\n\nconst meta: Meta<typeof DropdownExample> = {\n title: \"Organisms/Dropdown\",\n component: DropdownExample,\n tags: [\"autodocs\"],\n args: {\n controlled: false,\n options: enumToOptions(Objective).slice(0, 5),\n placeholder: \"Select grant objective\",\n defaultValue: \"\",\n disabled: false,\n width: 320,\n name: \"objective\",\n onChange: fn(),\n },\n argTypes: {\n controlled: {\n description:\n \"Controls whether the selected value is managed by React state or by the Dropdown itself.\",\n table: { defaultValue: { summary: \"false\" } },\n },\n options: {\n description: \"Options displayed in the dropdown panel.\",\n control: \"object\",\n },\n placeholder: {\n description: \"Label displayed when no option is selected.\",\n table: { defaultValue: { summary: '\"Select an option\"' } },\n control: \"text\",\n },\n value: {\n description: \"Selected value when the Dropdown is controlled.\",\n control: \"text\",\n },\n defaultValue: {\n description: \"Initial selected value when the Dropdown is uncontrolled.\",\n table: { defaultValue: { summary: '\"\"' } },\n control: \"text\",\n },\n onChange: {\n description: \"Called with the selected option value.\",\n control: false,\n },\n disabled: {\n description: \"Disables the dropdown trigger and form value.\",\n table: { defaultValue: { summary: \"false\" } },\n control: \"boolean\",\n },\n width: {\n description: \"Width of the trigger and dropdown container.\",\n table: { defaultValue: { summary: '\"100%\"' } },\n control: \"text\",\n },\n name: {\n description: \"Form field name used to submit the selected value.\",\n control: \"text\",\n },\n form: {\n description: \"ID of the form associated with the hidden form field.\",\n control: \"text\",\n },\n },\n};\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\nexport const Controlled: Story = {\n args: {\n controlled: true,\n },\n play: async ({ canvasElement }) => {\n const canvas = within(canvasElement);\n const trigger = canvas.getByRole(\"button\");\n await userEvent.click(trigger);\n await userEvent.click(canvas.getAllByRole(\"option\")[0]);\n await expect(trigger).not.toHaveTextContent(\"Select grant objective\");\n },\n};\n\nexport const Uncontrolled: Story = {};\n\nexport const FitContent: Story = {\n args: {\n width: \"fit-content\",\n },\n};\n"]}