@mich8060/unified-design-system 0.1.10
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/LICENSE +21 -0
- package/README.lib.md +103 -0
- package/README.md +265 -0
- package/dist/LICENSE +21 -0
- package/dist/README.md +103 -0
- package/dist/package.json +49 -0
- package/dist/styles.css +20544 -0
- package/dist/uds-components.es.js +67031 -0
- package/dist/uds-components.es.js.map +1 -0
- package/dist/uds-components.umd.js +67048 -0
- package/dist/uds-components.umd.js.map +1 -0
- package/package.json +158 -0
- package/src/styles/_typography.scss +932 -0
- package/src/styles/_utilities.scss +3738 -0
- package/src/styles/_variables.scss +620 -0
- package/src/styles/prism-custom.css +204 -0
- package/src/styles/prism-custom.scss +205 -0
- package/src/styles/tokens.css +1463 -0
- package/src/styles/tokens.scss +1116 -0
- package/src/ui/Accordion/Accordion.ai.md +69 -0
- package/src/ui/Accordion/Accordion.scss +87 -0
- package/src/ui/Accordion/Accordion.spec.ts +25 -0
- package/src/ui/Accordion/Accordion.stories.tsx +46 -0
- package/src/ui/Accordion/Accordion.test.tsx +54 -0
- package/src/ui/Accordion/Accordion.tsx +73 -0
- package/src/ui/Accordion/Accordion.types.ts +15 -0
- package/src/ui/Accordion/index.js +1 -0
- package/src/ui/ActionMenu/ActionMenu.ai.md +106 -0
- package/src/ui/ActionMenu/ActionMenu.jsx +437 -0
- package/src/ui/ActionMenu/ActionMenu.scss +252 -0
- package/src/ui/ActionMenu/ActionMenu.spec.ts +12 -0
- package/src/ui/ActionMenu/ActionMenu.stories.jsx +14 -0
- package/src/ui/ActionMenu/ActionMenu.stories.tsx +124 -0
- package/src/ui/ActionMenu/ActionMenu.test.tsx +1 -0
- package/src/ui/ActionMenu/ActionMenu.tsx +6 -0
- package/src/ui/ActionMenu/ActionMenu.types.ts +3 -0
- package/src/ui/ActionMenu/index.js +1 -0
- package/src/ui/Avatar/Avatar.ai.md +54 -0
- package/src/ui/Avatar/Avatar.jsx +49 -0
- package/src/ui/Avatar/Avatar.scss +87 -0
- package/src/ui/Avatar/Avatar.spec.ts +12 -0
- package/src/ui/Avatar/Avatar.stories.jsx +14 -0
- package/src/ui/Avatar/Avatar.stories.tsx +14 -0
- package/src/ui/Avatar/Avatar.test.tsx +1 -0
- package/src/ui/Avatar/Avatar.tsx +6 -0
- package/src/ui/Avatar/Avatar.types.ts +3 -0
- package/src/ui/Avatar/index.js +1 -0
- package/src/ui/Badge/Badge.ai.md +37 -0
- package/src/ui/Badge/Badge.jsx +64 -0
- package/src/ui/Badge/Badge.scss +84 -0
- package/src/ui/Badge/Badge.spec.ts +12 -0
- package/src/ui/Badge/Badge.stories.jsx +14 -0
- package/src/ui/Badge/Badge.stories.tsx +14 -0
- package/src/ui/Badge/Badge.test.tsx +1 -0
- package/src/ui/Badge/Badge.tsx +6 -0
- package/src/ui/Badge/Badge.types.ts +3 -0
- package/src/ui/Badge/index.js +1 -0
- package/src/ui/Branding/Branding.ai.md +81 -0
- package/src/ui/Branding/Branding.jsx +127 -0
- package/src/ui/Branding/Branding.scss +57 -0
- package/src/ui/Branding/Branding.spec.ts +12 -0
- package/src/ui/Branding/Branding.stories.jsx +14 -0
- package/src/ui/Branding/Branding.stories.tsx +14 -0
- package/src/ui/Branding/Branding.test.tsx +1 -0
- package/src/ui/Branding/Branding.tsx +6 -0
- package/src/ui/Branding/Branding.types.ts +3 -0
- package/src/ui/Branding/index.js +1 -0
- package/src/ui/Breadcrumb/Breadcrumb.ai.md +50 -0
- package/src/ui/Breadcrumb/Breadcrumb.jsx +167 -0
- package/src/ui/Breadcrumb/Breadcrumb.scss +46 -0
- package/src/ui/Breadcrumb/Breadcrumb.spec.ts +12 -0
- package/src/ui/Breadcrumb/Breadcrumb.stories.jsx +26 -0
- package/src/ui/Breadcrumb/Breadcrumb.stories.tsx +14 -0
- package/src/ui/Breadcrumb/Breadcrumb.test.tsx +1 -0
- package/src/ui/Breadcrumb/Breadcrumb.tsx +6 -0
- package/src/ui/Breadcrumb/Breadcrumb.types.ts +3 -0
- package/src/ui/Breadcrumb/index.js +2 -0
- package/src/ui/Button/Button.ai.md +122 -0
- package/src/ui/Button/Button.figma.tsx +49 -0
- package/src/ui/Button/Button.scss +188 -0
- package/src/ui/Button/Button.spec.ts +52 -0
- package/src/ui/Button/Button.stories.tsx +199 -0
- package/src/ui/Button/Button.test.tsx +85 -0
- package/src/ui/Button/Button.tsx +131 -0
- package/src/ui/Button/Button.types.ts +32 -0
- package/src/ui/Button/index.js +1 -0
- package/src/ui/Calendar/Calendar.ai.md +151 -0
- package/src/ui/Calendar/Calendar.jsx +504 -0
- package/src/ui/Calendar/Calendar.scss +451 -0
- package/src/ui/Calendar/Calendar.spec.ts +12 -0
- package/src/ui/Calendar/Calendar.stories.jsx +14 -0
- package/src/ui/Calendar/Calendar.stories.tsx +14 -0
- package/src/ui/Calendar/Calendar.test.tsx +1 -0
- package/src/ui/Calendar/Calendar.tsx +6 -0
- package/src/ui/Calendar/Calendar.types.ts +3 -0
- package/src/ui/Calendar/index.js +1 -0
- package/src/ui/Card/Card.ai.md +41 -0
- package/src/ui/Card/Card.jsx +25 -0
- package/src/ui/Card/Card.scss +47 -0
- package/src/ui/Card/Card.spec.ts +12 -0
- package/src/ui/Card/Card.stories.jsx +28 -0
- package/src/ui/Card/Card.stories.tsx +14 -0
- package/src/ui/Card/Card.test.tsx +1 -0
- package/src/ui/Card/Card.tsx +6 -0
- package/src/ui/Card/Card.types.ts +3 -0
- package/src/ui/Card/index.js +1 -0
- package/src/ui/Checkbox/Checkbox.ai.md +50 -0
- package/src/ui/Checkbox/Checkbox.jsx +73 -0
- package/src/ui/Checkbox/Checkbox.scss +115 -0
- package/src/ui/Checkbox/Checkbox.spec.ts +12 -0
- package/src/ui/Checkbox/Checkbox.stories.jsx +14 -0
- package/src/ui/Checkbox/Checkbox.stories.tsx +14 -0
- package/src/ui/Checkbox/Checkbox.test.tsx +1 -0
- package/src/ui/Checkbox/Checkbox.tsx +6 -0
- package/src/ui/Checkbox/Checkbox.types.ts +3 -0
- package/src/ui/Checkbox/index.js +1 -0
- package/src/ui/Chip/Chip.ai.md +43 -0
- package/src/ui/Chip/Chip.jsx +102 -0
- package/src/ui/Chip/Chip.scss +118 -0
- package/src/ui/Chip/Chip.spec.ts +12 -0
- package/src/ui/Chip/Chip.stories.jsx +14 -0
- package/src/ui/Chip/Chip.stories.tsx +14 -0
- package/src/ui/Chip/Chip.test.tsx +1 -0
- package/src/ui/Chip/Chip.tsx +6 -0
- package/src/ui/Chip/Chip.types.ts +3 -0
- package/src/ui/Chip/index.js +1 -0
- package/src/ui/Datepicker/Datepicker.ai.md +45 -0
- package/src/ui/Datepicker/Datepicker.jsx +330 -0
- package/src/ui/Datepicker/Datepicker.scss +206 -0
- package/src/ui/Datepicker/Datepicker.spec.ts +12 -0
- package/src/ui/Datepicker/Datepicker.stories.jsx +14 -0
- package/src/ui/Datepicker/Datepicker.stories.tsx +14 -0
- package/src/ui/Datepicker/Datepicker.test.tsx +1 -0
- package/src/ui/Datepicker/Datepicker.tsx +6 -0
- package/src/ui/Datepicker/Datepicker.types.ts +3 -0
- package/src/ui/Datepicker/index.js +2 -0
- package/src/ui/Divider/Divider.ai.md +34 -0
- package/src/ui/Divider/Divider.jsx +89 -0
- package/src/ui/Divider/Divider.scss +116 -0
- package/src/ui/Divider/Divider.spec.ts +12 -0
- package/src/ui/Divider/Divider.stories.jsx +14 -0
- package/src/ui/Divider/Divider.stories.tsx +14 -0
- package/src/ui/Divider/Divider.test.tsx +1 -0
- package/src/ui/Divider/Divider.tsx +6 -0
- package/src/ui/Divider/Divider.types.ts +3 -0
- package/src/ui/Divider/index.js +1 -0
- package/src/ui/DotStatus/DotStatus.ai.md +36 -0
- package/src/ui/DotStatus/DotStatus.jsx +64 -0
- package/src/ui/DotStatus/DotStatus.scss +87 -0
- package/src/ui/DotStatus/DotStatus.spec.ts +12 -0
- package/src/ui/DotStatus/DotStatus.stories.jsx +14 -0
- package/src/ui/DotStatus/DotStatus.stories.tsx +14 -0
- package/src/ui/DotStatus/DotStatus.test.tsx +1 -0
- package/src/ui/DotStatus/DotStatus.tsx +6 -0
- package/src/ui/DotStatus/DotStatus.types.ts +3 -0
- package/src/ui/DotStatus/index.js +1 -0
- package/src/ui/Dropdown/Dropdown.ai.md +118 -0
- package/src/ui/Dropdown/Dropdown.scss +129 -0
- package/src/ui/Dropdown/Dropdown.spec.ts +54 -0
- package/src/ui/Dropdown/Dropdown.stories.tsx +59 -0
- package/src/ui/Dropdown/Dropdown.test.tsx +37 -0
- package/src/ui/Dropdown/Dropdown.tsx +119 -0
- package/src/ui/Dropdown/Dropdown.types.ts +25 -0
- package/src/ui/Dropdown/index.js +1 -0
- package/src/ui/EventCard/EventCard.ai.md +101 -0
- package/src/ui/EventCard/EventCard.jsx +92 -0
- package/src/ui/EventCard/EventCard.scss +186 -0
- package/src/ui/EventCard/EventCard.spec.ts +12 -0
- package/src/ui/EventCard/EventCard.stories.jsx +14 -0
- package/src/ui/EventCard/EventCard.stories.tsx +14 -0
- package/src/ui/EventCard/EventCard.test.tsx +1 -0
- package/src/ui/EventCard/EventCard.tsx +6 -0
- package/src/ui/EventCard/EventCard.types.ts +3 -0
- package/src/ui/EventCard/index.js +1 -0
- package/src/ui/Field/Field.ai.md +69 -0
- package/src/ui/Field/Field.jsx +89 -0
- package/src/ui/Field/Field.scss +76 -0
- package/src/ui/Field/Field.spec.ts +12 -0
- package/src/ui/Field/Field.stories.jsx +14 -0
- package/src/ui/Field/Field.stories.tsx +14 -0
- package/src/ui/Field/Field.test.tsx +1 -0
- package/src/ui/Field/Field.tsx +6 -0
- package/src/ui/Field/Field.types.ts +3 -0
- package/src/ui/Field/index.js +1 -0
- package/src/ui/FileUpload/FileUpload.ai.md +38 -0
- package/src/ui/FileUpload/FileUpload.figma.tsx +28 -0
- package/src/ui/FileUpload/FileUpload.jsx +153 -0
- package/src/ui/FileUpload/FileUpload.scss +78 -0
- package/src/ui/FileUpload/FileUpload.spec.ts +12 -0
- package/src/ui/FileUpload/FileUpload.stories.jsx +14 -0
- package/src/ui/FileUpload/FileUpload.stories.tsx +14 -0
- package/src/ui/FileUpload/FileUpload.test.tsx +1 -0
- package/src/ui/FileUpload/FileUpload.tsx +6 -0
- package/src/ui/FileUpload/FileUpload.types.ts +3 -0
- package/src/ui/FileUpload/index.js +2 -0
- package/src/ui/Flex/Flex.ai.md +130 -0
- package/src/ui/Flex/Flex.jsx +53 -0
- package/src/ui/Flex/Flex.scss +119 -0
- package/src/ui/Flex/Flex.spec.ts +12 -0
- package/src/ui/Flex/Flex.stories.jsx +14 -0
- package/src/ui/Flex/Flex.stories.tsx +14 -0
- package/src/ui/Flex/Flex.test.tsx +1 -0
- package/src/ui/Flex/Flex.tsx +6 -0
- package/src/ui/Flex/Flex.types.ts +3 -0
- package/src/ui/Flex/index.js +1 -0
- package/src/ui/Icon/Icon.ai.md +46 -0
- package/src/ui/Icon/Icon.figma.tsx +22 -0
- package/src/ui/Icon/Icon.jsx +47 -0
- package/src/ui/Icon/Icon.scss +1 -0
- package/src/ui/Icon/Icon.spec.ts +12 -0
- package/src/ui/Icon/Icon.stories.jsx +14 -0
- package/src/ui/Icon/Icon.stories.tsx +14 -0
- package/src/ui/Icon/Icon.test.tsx +1 -0
- package/src/ui/Icon/Icon.tsx +6 -0
- package/src/ui/Icon/Icon.types.ts +3 -0
- package/src/ui/Icon/index.js +1 -0
- package/src/ui/ImageAspect/ImageAspect.ai.md +37 -0
- package/src/ui/ImageAspect/ImageAspect.jsx +56 -0
- package/src/ui/ImageAspect/ImageAspect.scss +62 -0
- package/src/ui/ImageAspect/ImageAspect.spec.ts +12 -0
- package/src/ui/ImageAspect/ImageAspect.stories.jsx +14 -0
- package/src/ui/ImageAspect/ImageAspect.stories.tsx +14 -0
- package/src/ui/ImageAspect/ImageAspect.test.tsx +1 -0
- package/src/ui/ImageAspect/ImageAspect.tsx +6 -0
- package/src/ui/ImageAspect/ImageAspect.types.ts +3 -0
- package/src/ui/ImageAspect/index.js +1 -0
- package/src/ui/Input/Input.ai.md +89 -0
- package/src/ui/Input/Input.figma.tsx +35 -0
- package/src/ui/Input/Input.scss +126 -0
- package/src/ui/Input/Input.spec.ts +54 -0
- package/src/ui/Input/Input.stories.tsx +72 -0
- package/src/ui/Input/Input.test.tsx +70 -0
- package/src/ui/Input/Input.tsx +91 -0
- package/src/ui/Input/Input.types.ts +22 -0
- package/src/ui/Input/index.js +2 -0
- package/src/ui/Key/Key.ai.md +31 -0
- package/src/ui/Key/Key.jsx +37 -0
- package/src/ui/Key/Key.scss +31 -0
- package/src/ui/Key/Key.spec.ts +12 -0
- package/src/ui/Key/Key.stories.jsx +14 -0
- package/src/ui/Key/Key.stories.tsx +14 -0
- package/src/ui/Key/Key.test.tsx +1 -0
- package/src/ui/Key/Key.tsx +6 -0
- package/src/ui/Key/Key.types.ts +3 -0
- package/src/ui/Key/index.js +1 -0
- package/src/ui/Menu/Menu.jsx +232 -0
- package/src/ui/Menu/Menu.scss +370 -0
- package/src/ui/Menu/Menu.spec.ts +12 -0
- package/src/ui/Menu/Menu.stories.jsx +41 -0
- package/src/ui/Menu/Menu.stories.tsx +14 -0
- package/src/ui/Menu/Menu.test.tsx +1 -0
- package/src/ui/Menu/Menu.tsx +6 -0
- package/src/ui/Menu/Menu.types.ts +3 -0
- package/src/ui/Menu/index.js +1 -0
- package/src/ui/MicroCalendar/MicroCalendar.ai.md +35 -0
- package/src/ui/MicroCalendar/MicroCalendar.jsx +393 -0
- package/src/ui/MicroCalendar/MicroCalendar.scss +289 -0
- package/src/ui/MicroCalendar/MicroCalendar.spec.ts +12 -0
- package/src/ui/MicroCalendar/MicroCalendar.stories.jsx +14 -0
- package/src/ui/MicroCalendar/MicroCalendar.stories.tsx +14 -0
- package/src/ui/MicroCalendar/MicroCalendar.test.tsx +1 -0
- package/src/ui/MicroCalendar/MicroCalendar.tsx +6 -0
- package/src/ui/MicroCalendar/MicroCalendar.types.ts +3 -0
- package/src/ui/MicroCalendar/index.js +1 -0
- package/src/ui/Modal/Modal.ai.md +150 -0
- package/src/ui/Modal/Modal.jsx +173 -0
- package/src/ui/Modal/Modal.scss +179 -0
- package/src/ui/Modal/Modal.spec.ts +12 -0
- package/src/ui/Modal/Modal.stories.jsx +14 -0
- package/src/ui/Modal/Modal.stories.tsx +14 -0
- package/src/ui/Modal/Modal.test.tsx +1 -0
- package/src/ui/Modal/Modal.tsx +6 -0
- package/src/ui/Modal/Modal.types.ts +3 -0
- package/src/ui/Modal/index.js +1 -0
- package/src/ui/Pagination/Pagination.ai.md +30 -0
- package/src/ui/Pagination/Pagination.jsx +237 -0
- package/src/ui/Pagination/Pagination.scss +182 -0
- package/src/ui/Pagination/Pagination.spec.ts +12 -0
- package/src/ui/Pagination/Pagination.stories.jsx +14 -0
- package/src/ui/Pagination/Pagination.stories.tsx +14 -0
- package/src/ui/Pagination/Pagination.test.tsx +1 -0
- package/src/ui/Pagination/Pagination.tsx +6 -0
- package/src/ui/Pagination/Pagination.types.ts +3 -0
- package/src/ui/Pagination/index.js +1 -0
- package/src/ui/PillToggle/PillToggle.ai.md +44 -0
- package/src/ui/PillToggle/PillToggle.jsx +56 -0
- package/src/ui/PillToggle/PillToggle.scss +84 -0
- package/src/ui/PillToggle/PillToggle.spec.ts +12 -0
- package/src/ui/PillToggle/PillToggle.stories.jsx +14 -0
- package/src/ui/PillToggle/PillToggle.stories.tsx +14 -0
- package/src/ui/PillToggle/PillToggle.test.tsx +1 -0
- package/src/ui/PillToggle/PillToggle.tsx +6 -0
- package/src/ui/PillToggle/PillToggle.types.ts +3 -0
- package/src/ui/PillToggle/index.js +1 -0
- package/src/ui/Playground/Playground.ai.md +96 -0
- package/src/ui/Playground/Playground.jsx +524 -0
- package/src/ui/Playground/Playground.scss +310 -0
- package/src/ui/Playground/Playground.spec.ts +12 -0
- package/src/ui/Playground/Playground.stories.jsx +14 -0
- package/src/ui/Playground/Playground.stories.tsx +14 -0
- package/src/ui/Playground/Playground.test.tsx +1 -0
- package/src/ui/Playground/Playground.tsx +6 -0
- package/src/ui/Playground/Playground.types.ts +3 -0
- package/src/ui/Playground/index.js +2 -0
- package/src/ui/ProgressCircle/ProgressCircle.ai.md +36 -0
- package/src/ui/ProgressCircle/ProgressCircle.jsx +147 -0
- package/src/ui/ProgressCircle/ProgressCircle.scss +143 -0
- package/src/ui/ProgressCircle/ProgressCircle.spec.ts +12 -0
- package/src/ui/ProgressCircle/ProgressCircle.stories.jsx +14 -0
- package/src/ui/ProgressCircle/ProgressCircle.stories.tsx +14 -0
- package/src/ui/ProgressCircle/ProgressCircle.test.tsx +1 -0
- package/src/ui/ProgressCircle/ProgressCircle.tsx +6 -0
- package/src/ui/ProgressCircle/ProgressCircle.types.ts +3 -0
- package/src/ui/ProgressCircle/index.js +1 -0
- package/src/ui/ProgressIndicator/ProgressIndicator.ai.md +27 -0
- package/src/ui/ProgressIndicator/ProgressIndicator.jsx +92 -0
- package/src/ui/ProgressIndicator/ProgressIndicator.scss +133 -0
- package/src/ui/ProgressIndicator/ProgressIndicator.spec.ts +12 -0
- package/src/ui/ProgressIndicator/ProgressIndicator.stories.jsx +14 -0
- package/src/ui/ProgressIndicator/ProgressIndicator.stories.tsx +14 -0
- package/src/ui/ProgressIndicator/ProgressIndicator.test.tsx +1 -0
- package/src/ui/ProgressIndicator/ProgressIndicator.tsx +6 -0
- package/src/ui/ProgressIndicator/ProgressIndicator.types.ts +3 -0
- package/src/ui/ProgressIndicator/index.js +1 -0
- package/src/ui/Radio/Radio.ai.md +53 -0
- package/src/ui/Radio/Radio.jsx +57 -0
- package/src/ui/Radio/Radio.scss +89 -0
- package/src/ui/Radio/Radio.spec.ts +12 -0
- package/src/ui/Radio/Radio.stories.jsx +14 -0
- package/src/ui/Radio/Radio.stories.tsx +14 -0
- package/src/ui/Radio/Radio.test.tsx +1 -0
- package/src/ui/Radio/Radio.tsx +6 -0
- package/src/ui/Radio/Radio.types.ts +3 -0
- package/src/ui/Radio/index.js +1 -0
- package/src/ui/Slider/Slider.ai.md +33 -0
- package/src/ui/Slider/Slider.jsx +283 -0
- package/src/ui/Slider/Slider.scss +156 -0
- package/src/ui/Slider/Slider.spec.ts +12 -0
- package/src/ui/Slider/Slider.stories.jsx +14 -0
- package/src/ui/Slider/Slider.stories.tsx +14 -0
- package/src/ui/Slider/Slider.test.tsx +1 -0
- package/src/ui/Slider/Slider.tsx +6 -0
- package/src/ui/Slider/Slider.types.ts +3 -0
- package/src/ui/Slider/index.js +1 -0
- package/src/ui/Status/Status.ai.md +36 -0
- package/src/ui/Status/Status.jsx +66 -0
- package/src/ui/Status/Status.scss +90 -0
- package/src/ui/Status/Status.spec.ts +12 -0
- package/src/ui/Status/Status.stories.jsx +14 -0
- package/src/ui/Status/Status.stories.tsx +14 -0
- package/src/ui/Status/Status.test.tsx +1 -0
- package/src/ui/Status/Status.tsx +6 -0
- package/src/ui/Status/Status.types.ts +3 -0
- package/src/ui/Status/index.js +1 -0
- package/src/ui/Steps/Steps.ai.md +56 -0
- package/src/ui/Steps/Steps.jsx +201 -0
- package/src/ui/Steps/Steps.scss +240 -0
- package/src/ui/Steps/Steps.spec.ts +12 -0
- package/src/ui/Steps/Steps.stories.jsx +14 -0
- package/src/ui/Steps/Steps.stories.tsx +14 -0
- package/src/ui/Steps/Steps.test.tsx +1 -0
- package/src/ui/Steps/Steps.tsx +6 -0
- package/src/ui/Steps/Steps.types.ts +3 -0
- package/src/ui/Steps/index.js +1 -0
- package/src/ui/Table/Table.ai.md +108 -0
- package/src/ui/Table/Table.jsx +143 -0
- package/src/ui/Table/Table.scss +90 -0
- package/src/ui/Table/Table.spec.ts +12 -0
- package/src/ui/Table/Table.stories.jsx +14 -0
- package/src/ui/Table/Table.stories.tsx +14 -0
- package/src/ui/Table/Table.test.tsx +1 -0
- package/src/ui/Table/Table.tsx +6 -0
- package/src/ui/Table/Table.types.ts +3 -0
- package/src/ui/Table/index.js +1 -0
- package/src/ui/Tabs/TabItem.jsx +80 -0
- package/src/ui/Tabs/Tabs.ai.md +52 -0
- package/src/ui/Tabs/Tabs.figma.tsx +30 -0
- package/src/ui/Tabs/Tabs.jsx +318 -0
- package/src/ui/Tabs/Tabs.scss +164 -0
- package/src/ui/Tabs/Tabs.spec.ts +12 -0
- package/src/ui/Tabs/Tabs.stories.jsx +18 -0
- package/src/ui/Tabs/Tabs.stories.tsx +14 -0
- package/src/ui/Tabs/Tabs.test.tsx +1 -0
- package/src/ui/Tabs/Tabs.tsx +6 -0
- package/src/ui/Tabs/Tabs.types.ts +3 -0
- package/src/ui/Tabs/index.js +3 -0
- package/src/ui/Tag/Tag.ai.md +59 -0
- package/src/ui/Tag/Tag.figma.tsx +29 -0
- package/src/ui/Tag/Tag.jsx +93 -0
- package/src/ui/Tag/Tag.scss +258 -0
- package/src/ui/Tag/Tag.spec.ts +12 -0
- package/src/ui/Tag/Tag.stories.jsx +14 -0
- package/src/ui/Tag/Tag.stories.tsx +14 -0
- package/src/ui/Tag/Tag.test.tsx +1 -0
- package/src/ui/Tag/Tag.tsx +6 -0
- package/src/ui/Tag/Tag.types.ts +3 -0
- package/src/ui/Tag/index.js +2 -0
- package/src/ui/Textarea/Textarea.ai.md +40 -0
- package/src/ui/Textarea/Textarea.figma.tsx +35 -0
- package/src/ui/Textarea/Textarea.jsx +68 -0
- package/src/ui/Textarea/Textarea.scss +71 -0
- package/src/ui/Textarea/Textarea.spec.ts +12 -0
- package/src/ui/Textarea/Textarea.stories.jsx +14 -0
- package/src/ui/Textarea/Textarea.stories.tsx +14 -0
- package/src/ui/Textarea/Textarea.test.tsx +1 -0
- package/src/ui/Textarea/Textarea.tsx +6 -0
- package/src/ui/Textarea/Textarea.types.ts +3 -0
- package/src/ui/Textarea/index.js +2 -0
- package/src/ui/Toast/Toast.ai.md +47 -0
- package/src/ui/Toast/Toast.jsx +75 -0
- package/src/ui/Toast/Toast.scss +132 -0
- package/src/ui/Toast/Toast.spec.ts +12 -0
- package/src/ui/Toast/Toast.stories.jsx +14 -0
- package/src/ui/Toast/Toast.stories.tsx +14 -0
- package/src/ui/Toast/Toast.test.tsx +1 -0
- package/src/ui/Toast/Toast.tsx +6 -0
- package/src/ui/Toast/Toast.types.ts +3 -0
- package/src/ui/Toast/index.js +2 -0
- package/src/ui/Toggle/Toggle.ai.md +37 -0
- package/src/ui/Toggle/Toggle.jsx +73 -0
- package/src/ui/Toggle/Toggle.scss +139 -0
- package/src/ui/Toggle/Toggle.spec.ts +12 -0
- package/src/ui/Toggle/Toggle.stories.jsx +14 -0
- package/src/ui/Toggle/Toggle.stories.tsx +14 -0
- package/src/ui/Toggle/Toggle.test.tsx +1 -0
- package/src/ui/Toggle/Toggle.tsx +6 -0
- package/src/ui/Toggle/Toggle.types.ts +3 -0
- package/src/ui/Toggle/index.js +1 -0
- package/src/ui/Tooltip/Tooltip.ai.md +33 -0
- package/src/ui/Tooltip/Tooltip.figma.tsx +24 -0
- package/src/ui/Tooltip/Tooltip.jsx +125 -0
- package/src/ui/Tooltip/Tooltip.scss +80 -0
- package/src/ui/Tooltip/Tooltip.spec.ts +12 -0
- package/src/ui/Tooltip/Tooltip.stories.jsx +14 -0
- package/src/ui/Tooltip/Tooltip.stories.tsx +14 -0
- package/src/ui/Tooltip/Tooltip.test.tsx +1 -0
- package/src/ui/Tooltip/Tooltip.tsx +6 -0
- package/src/ui/Tooltip/Tooltip.types.ts +3 -0
- package/src/ui/Tooltip/index.js +2 -0
- package/src/ui/UDS/UDS.jsx +52 -0
- package/src/ui/UDS/UDS.scss +49 -0
- package/src/ui/UDS/UDS.spec.ts +12 -0
- package/src/ui/UDS/UDS.stories.jsx +22 -0
- package/src/ui/UDS/UDS.stories.tsx +14 -0
- package/src/ui/UDS/UDS.test.tsx +1 -0
- package/src/ui/UDS/UDS.tsx +6 -0
- package/src/ui/UDS/UDS.types.ts +3 -0
- package/src/ui/UDS/index.js +1 -0
- package/src/ui/_spec/createMetaFromSpec.ts +35 -0
- package/src/ui/_spec/createStoryArgsFromSpec.ts +8 -0
- package/src/ui/_spec/generated/spec-props-reference.md +55 -0
- package/src/ui/_spec/specStorySync.test.ts +73 -0
- package/src/ui/_spec/types.ts +21 -0
- package/src/ui/index.js +66 -0
|
@@ -0,0 +1,524 @@
|
|
|
1
|
+
import React, { useState, useCallback } from "react";
|
|
2
|
+
import Icon from "../Icon/Icon";
|
|
3
|
+
import Button from "../Button/Button";
|
|
4
|
+
import ActionMenu from "../ActionMenu/ActionMenu";
|
|
5
|
+
import "./Playground.scss";
|
|
6
|
+
|
|
7
|
+
// Common icon names for dropdown (subset of most commonly used icons)
|
|
8
|
+
const COMMON_ICONS = [
|
|
9
|
+
"Placeholder",
|
|
10
|
+
"ArrowRight",
|
|
11
|
+
"ArrowLeft",
|
|
12
|
+
"ArrowUp",
|
|
13
|
+
"ArrowDown",
|
|
14
|
+
"Check",
|
|
15
|
+
"Close",
|
|
16
|
+
"X",
|
|
17
|
+
"Plus",
|
|
18
|
+
"Minus",
|
|
19
|
+
"Edit",
|
|
20
|
+
"Pencil",
|
|
21
|
+
"Trash",
|
|
22
|
+
"Search",
|
|
23
|
+
"MagnifyingGlass",
|
|
24
|
+
"Settings",
|
|
25
|
+
"Gear",
|
|
26
|
+
"User",
|
|
27
|
+
"Users",
|
|
28
|
+
"Home",
|
|
29
|
+
"House",
|
|
30
|
+
"Star",
|
|
31
|
+
"Heart",
|
|
32
|
+
"Bookmark",
|
|
33
|
+
"Share",
|
|
34
|
+
"Download",
|
|
35
|
+
"Upload",
|
|
36
|
+
"Copy",
|
|
37
|
+
"CopySimple",
|
|
38
|
+
"Code",
|
|
39
|
+
"GearSix",
|
|
40
|
+
"List",
|
|
41
|
+
"SquaresFour",
|
|
42
|
+
"DiamondsFour",
|
|
43
|
+
"CirclesThree",
|
|
44
|
+
"CaretDown",
|
|
45
|
+
"CaretUp",
|
|
46
|
+
"CaretLeft",
|
|
47
|
+
"CaretRight",
|
|
48
|
+
"Info",
|
|
49
|
+
"Warning",
|
|
50
|
+
"CheckCircle",
|
|
51
|
+
"XCircle",
|
|
52
|
+
"Bell",
|
|
53
|
+
"Notification",
|
|
54
|
+
"Mail",
|
|
55
|
+
"Phone",
|
|
56
|
+
"Calendar",
|
|
57
|
+
"Clock",
|
|
58
|
+
"Image",
|
|
59
|
+
"File",
|
|
60
|
+
"Folder",
|
|
61
|
+
"Lock",
|
|
62
|
+
"Unlock",
|
|
63
|
+
"Eye",
|
|
64
|
+
"EyeSlash",
|
|
65
|
+
"Filter",
|
|
66
|
+
"Sort",
|
|
67
|
+
"Grid",
|
|
68
|
+
"Menu",
|
|
69
|
+
"More",
|
|
70
|
+
"DotsThree",
|
|
71
|
+
];
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Playground component for interactive component prop manipulation
|
|
75
|
+
* Matches Figma design with Canvas + Inspector/Code Panel layout
|
|
76
|
+
* @param {React.Component} component - The component to render
|
|
77
|
+
* @param {object} propDefinitions - Object defining props and their controls
|
|
78
|
+
* @param {string} title - Optional title for the playground
|
|
79
|
+
* @param {object} initialProps - Initial prop values
|
|
80
|
+
* @param {function} renderComponent - Optional custom render function
|
|
81
|
+
*/
|
|
82
|
+
export default function Playground({
|
|
83
|
+
component: Component,
|
|
84
|
+
propDefinitions = {},
|
|
85
|
+
title = "Playground",
|
|
86
|
+
initialProps = {},
|
|
87
|
+
renderComponent,
|
|
88
|
+
}) {
|
|
89
|
+
const [viewMode, setViewMode] = useState("inspector"); // 'inspector' or 'code'
|
|
90
|
+
|
|
91
|
+
// Initialize state with defaults from propDefinitions
|
|
92
|
+
const getInitialState = () => {
|
|
93
|
+
const state = { ...initialProps };
|
|
94
|
+
Object.keys(propDefinitions).forEach((key) => {
|
|
95
|
+
if (state[key] === undefined) {
|
|
96
|
+
// Check if this is an icon prop
|
|
97
|
+
const isIconProp =
|
|
98
|
+
key.toLowerCase().includes("icon") ||
|
|
99
|
+
propDefinitions[key].type === "icon";
|
|
100
|
+
const propDefault = propDefinitions[key].default;
|
|
101
|
+
|
|
102
|
+
if (isIconProp && (propDefault === undefined || propDefault === "")) {
|
|
103
|
+
// For icon props, default to 'Placeholder' if no default or empty string
|
|
104
|
+
state[key] = "Placeholder";
|
|
105
|
+
} else if (propDefault !== undefined) {
|
|
106
|
+
state[key] = propDefault;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
return state;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const [props, setProps] = useState(getInitialState);
|
|
114
|
+
|
|
115
|
+
const updateProp = useCallback((key, value) => {
|
|
116
|
+
setProps((prev) => ({ ...prev, [key]: value }));
|
|
117
|
+
}, []);
|
|
118
|
+
|
|
119
|
+
const resetProps = useCallback(() => {
|
|
120
|
+
setProps(getInitialState());
|
|
121
|
+
}, []);
|
|
122
|
+
|
|
123
|
+
const copyCode = useCallback(() => {
|
|
124
|
+
const componentName = Component?.name || "Component";
|
|
125
|
+
const propsString = Object.entries(props)
|
|
126
|
+
.filter(
|
|
127
|
+
([_, v]) =>
|
|
128
|
+
v !== undefined && v !== null && v !== "" && v !== "Placeholder",
|
|
129
|
+
)
|
|
130
|
+
.map(([k, v]) => {
|
|
131
|
+
if (typeof v === "string") return `${k}="${v}"`;
|
|
132
|
+
if (typeof v === "boolean") return v ? k : `${k}={false}`;
|
|
133
|
+
return `${k}={${JSON.stringify(v)}}`;
|
|
134
|
+
})
|
|
135
|
+
.join(" ");
|
|
136
|
+
|
|
137
|
+
const code = `<${componentName}${propsString ? " " + propsString : ""} />`;
|
|
138
|
+
navigator.clipboard.writeText(code);
|
|
139
|
+
}, [props, Component]);
|
|
140
|
+
|
|
141
|
+
const renderControl = (key, definition) => {
|
|
142
|
+
const { type, label, options, min, max, step, placeholder, section } =
|
|
143
|
+
definition;
|
|
144
|
+
|
|
145
|
+
// Check if this is an icon prop
|
|
146
|
+
const isIconProp = key.toLowerCase().includes("icon") || type === "icon";
|
|
147
|
+
|
|
148
|
+
// For icon props, use Placeholder as default if not set or if default is empty string
|
|
149
|
+
const propDefault = definition.default;
|
|
150
|
+
const defaultValue =
|
|
151
|
+
isIconProp && (propDefault === undefined || propDefault === "")
|
|
152
|
+
? "Placeholder"
|
|
153
|
+
: (propDefault ?? "");
|
|
154
|
+
const value = props[key] ?? defaultValue;
|
|
155
|
+
|
|
156
|
+
// If it's an icon prop and no options provided, use icon options
|
|
157
|
+
const iconOptions =
|
|
158
|
+
isIconProp && !options
|
|
159
|
+
? COMMON_ICONS.map((icon) => ({ value: icon, label: icon }))
|
|
160
|
+
: options;
|
|
161
|
+
|
|
162
|
+
switch (type) {
|
|
163
|
+
case "icon":
|
|
164
|
+
case "select":
|
|
165
|
+
const availableOptions = iconOptions || options || [];
|
|
166
|
+
const selectedOption =
|
|
167
|
+
availableOptions.find((opt) => opt.value === value) ||
|
|
168
|
+
availableOptions[0];
|
|
169
|
+
const selectedLabel = selectedOption
|
|
170
|
+
? selectedOption.label || selectedOption.value
|
|
171
|
+
: value || "Select...";
|
|
172
|
+
|
|
173
|
+
const menuItems = availableOptions.map((opt) => ({
|
|
174
|
+
id: opt.value,
|
|
175
|
+
label: opt.label || opt.value,
|
|
176
|
+
onClick: () => updateProp(key, opt.value),
|
|
177
|
+
}));
|
|
178
|
+
|
|
179
|
+
return (
|
|
180
|
+
<div key={key} className="playground__field">
|
|
181
|
+
<div className="playground__field-head">
|
|
182
|
+
<label
|
|
183
|
+
className="playground__field-label"
|
|
184
|
+
htmlFor={`playground-${key}`}
|
|
185
|
+
>
|
|
186
|
+
{label || key}
|
|
187
|
+
</label>
|
|
188
|
+
</div>
|
|
189
|
+
<div className="playground__field-body">
|
|
190
|
+
<ActionMenu
|
|
191
|
+
trigger={
|
|
192
|
+
<button
|
|
193
|
+
type="button"
|
|
194
|
+
className="playground__select-trigger"
|
|
195
|
+
aria-label={label || key}
|
|
196
|
+
>
|
|
197
|
+
<span className="playground__select-value">
|
|
198
|
+
{selectedLabel}
|
|
199
|
+
</span>
|
|
200
|
+
<Icon name="CaretDown" size={16} appearance="regular" />
|
|
201
|
+
</button>
|
|
202
|
+
}
|
|
203
|
+
items={menuItems}
|
|
204
|
+
placement="bottom-start"
|
|
205
|
+
/>
|
|
206
|
+
</div>
|
|
207
|
+
</div>
|
|
208
|
+
);
|
|
209
|
+
|
|
210
|
+
case "boolean":
|
|
211
|
+
// Boolean props go in States section
|
|
212
|
+
return (
|
|
213
|
+
<div key={key} className="playground__state-item">
|
|
214
|
+
<label className="playground__state-label">{label || key}</label>
|
|
215
|
+
<input
|
|
216
|
+
type="checkbox"
|
|
217
|
+
className="playground__checkbox"
|
|
218
|
+
checked={value}
|
|
219
|
+
onChange={(e) => updateProp(key, e.target.checked)}
|
|
220
|
+
/>
|
|
221
|
+
</div>
|
|
222
|
+
);
|
|
223
|
+
|
|
224
|
+
case "number":
|
|
225
|
+
return (
|
|
226
|
+
<div key={key} className="playground__field">
|
|
227
|
+
<div className="playground__field-head">
|
|
228
|
+
<label
|
|
229
|
+
className="playground__field-label"
|
|
230
|
+
htmlFor={`playground-${key}`}
|
|
231
|
+
>
|
|
232
|
+
{label || key}
|
|
233
|
+
</label>
|
|
234
|
+
</div>
|
|
235
|
+
<div className="playground__field-body">
|
|
236
|
+
<input
|
|
237
|
+
id={`playground-${key}`}
|
|
238
|
+
type="number"
|
|
239
|
+
className="playground__input"
|
|
240
|
+
value={value}
|
|
241
|
+
min={min}
|
|
242
|
+
max={max}
|
|
243
|
+
step={step}
|
|
244
|
+
onChange={(e) => updateProp(key, Number(e.target.value))}
|
|
245
|
+
/>
|
|
246
|
+
</div>
|
|
247
|
+
</div>
|
|
248
|
+
);
|
|
249
|
+
|
|
250
|
+
case "text":
|
|
251
|
+
case "string":
|
|
252
|
+
default:
|
|
253
|
+
// If it's an icon prop but type is string, convert to ActionMenu
|
|
254
|
+
if (isIconProp) {
|
|
255
|
+
const availableOptions = iconOptions || [];
|
|
256
|
+
const selectedOption =
|
|
257
|
+
availableOptions.find((opt) => opt.value === value) ||
|
|
258
|
+
availableOptions[0];
|
|
259
|
+
const selectedLabel = selectedOption
|
|
260
|
+
? selectedOption.label || selectedOption.value
|
|
261
|
+
: value || "Placeholder";
|
|
262
|
+
|
|
263
|
+
const menuItems = availableOptions.map((opt) => ({
|
|
264
|
+
id: opt.value,
|
|
265
|
+
label: opt.label || opt.value,
|
|
266
|
+
onClick: () => updateProp(key, opt.value),
|
|
267
|
+
}));
|
|
268
|
+
|
|
269
|
+
return (
|
|
270
|
+
<div key={key} className="playground__field">
|
|
271
|
+
<div className="playground__field-head">
|
|
272
|
+
<label
|
|
273
|
+
className="playground__field-label"
|
|
274
|
+
htmlFor={`playground-${key}`}
|
|
275
|
+
>
|
|
276
|
+
{label || key}
|
|
277
|
+
</label>
|
|
278
|
+
</div>
|
|
279
|
+
<div className="playground__field-body">
|
|
280
|
+
<ActionMenu
|
|
281
|
+
trigger={
|
|
282
|
+
<button
|
|
283
|
+
type="button"
|
|
284
|
+
className="playground__select-trigger"
|
|
285
|
+
aria-label={label || key}
|
|
286
|
+
>
|
|
287
|
+
<span className="playground__select-value">
|
|
288
|
+
{selectedLabel}
|
|
289
|
+
</span>
|
|
290
|
+
<Icon name="CaretDown" size={16} appearance="regular" />
|
|
291
|
+
</button>
|
|
292
|
+
}
|
|
293
|
+
items={menuItems}
|
|
294
|
+
placement="bottom-start"
|
|
295
|
+
/>
|
|
296
|
+
</div>
|
|
297
|
+
</div>
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return (
|
|
302
|
+
<div key={key} className="playground__field">
|
|
303
|
+
<div className="playground__field-head">
|
|
304
|
+
<label
|
|
305
|
+
className="playground__field-label"
|
|
306
|
+
htmlFor={`playground-${key}`}
|
|
307
|
+
>
|
|
308
|
+
{label || key}
|
|
309
|
+
</label>
|
|
310
|
+
</div>
|
|
311
|
+
<div className="playground__field-body">
|
|
312
|
+
<input
|
|
313
|
+
id={`playground-${key}`}
|
|
314
|
+
type="text"
|
|
315
|
+
className="playground__input"
|
|
316
|
+
value={value}
|
|
317
|
+
placeholder={placeholder}
|
|
318
|
+
onChange={(e) => updateProp(key, e.target.value)}
|
|
319
|
+
/>
|
|
320
|
+
</div>
|
|
321
|
+
</div>
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
// Separate props into properties and states
|
|
327
|
+
const properties = Object.entries(propDefinitions).filter(
|
|
328
|
+
([_, def]) => def.type !== "boolean",
|
|
329
|
+
);
|
|
330
|
+
const states = Object.entries(propDefinitions).filter(
|
|
331
|
+
([_, def]) => def.type === "boolean",
|
|
332
|
+
);
|
|
333
|
+
|
|
334
|
+
// Generate code string with syntax highlighting
|
|
335
|
+
const componentName = Component?.name || "Component";
|
|
336
|
+
const propsString = Object.entries(props)
|
|
337
|
+
.filter(
|
|
338
|
+
([_, v]) =>
|
|
339
|
+
v !== undefined && v !== null && v !== "" && v !== "Placeholder",
|
|
340
|
+
)
|
|
341
|
+
.map(([k, v]) => {
|
|
342
|
+
if (typeof v === "string") return ` ${k}="${v}"`;
|
|
343
|
+
if (typeof v === "boolean")
|
|
344
|
+
return v ? ` ${k}` : ` ${k}={false}`;
|
|
345
|
+
return ` ${k}={${JSON.stringify(v)}}`;
|
|
346
|
+
})
|
|
347
|
+
.join("\n");
|
|
348
|
+
|
|
349
|
+
const codeString = `import { ${componentName} } from '@/components/${componentName}';
|
|
350
|
+
|
|
351
|
+
export function Example() {
|
|
352
|
+
return (
|
|
353
|
+
<${componentName}${propsString ? "\n" + propsString + "\n " : " "}/> );
|
|
354
|
+
}`;
|
|
355
|
+
|
|
356
|
+
// Simple syntax highlighting function
|
|
357
|
+
const highlightCode = (code) => {
|
|
358
|
+
let highlighted = code;
|
|
359
|
+
// Highlight keywords
|
|
360
|
+
highlighted = highlighted.replace(
|
|
361
|
+
/\b(import|export|function|return|from)\b/g,
|
|
362
|
+
'<span style="color: #c085fd;">$1</span>',
|
|
363
|
+
);
|
|
364
|
+
// Highlight strings (handle escaped quotes)
|
|
365
|
+
highlighted = highlighted.replace(
|
|
366
|
+
/(['"])((?:\\.|(?!\1)[^\\])*?)\1/g,
|
|
367
|
+
'<span style="color: #4ade80;">$1$2$1</span>',
|
|
368
|
+
);
|
|
369
|
+
// Highlight JSX tags
|
|
370
|
+
highlighted = highlighted.replace(
|
|
371
|
+
/<(\/?)([A-Z][a-zA-Z0-9]*)/g,
|
|
372
|
+
'<span style="color: #f87070;"><$1$2</span>',
|
|
373
|
+
);
|
|
374
|
+
// Highlight component names (capitalized words)
|
|
375
|
+
highlighted = highlighted.replace(
|
|
376
|
+
/\b([A-Z][a-zA-Z0-9]*)\b(?=\s*[={])/g,
|
|
377
|
+
'<span style="color: #61a5fa;">$1</span>',
|
|
378
|
+
);
|
|
379
|
+
// Highlight attributes
|
|
380
|
+
highlighted = highlighted.replace(
|
|
381
|
+
/(\w+)=/g,
|
|
382
|
+
'<span style="color: #ca8a04;">$1</span>=',
|
|
383
|
+
);
|
|
384
|
+
return highlighted;
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
return (
|
|
388
|
+
<div className="playground">
|
|
389
|
+
<div className="playground__container">
|
|
390
|
+
{/* Canvas */}
|
|
391
|
+
<div className="playground__canvas">
|
|
392
|
+
<div className="playground__canvas-content">
|
|
393
|
+
{renderComponent ? (
|
|
394
|
+
renderComponent(props)
|
|
395
|
+
) : (
|
|
396
|
+
<Component {...props} />
|
|
397
|
+
)}
|
|
398
|
+
</div>
|
|
399
|
+
{/* Floating Action Bar */}
|
|
400
|
+
<div className="playground__actions">
|
|
401
|
+
<Button
|
|
402
|
+
appearance={viewMode === "code" ? "primary" : "text"}
|
|
403
|
+
layout="icon-only"
|
|
404
|
+
size="small"
|
|
405
|
+
icon="Code"
|
|
406
|
+
aria-label="Show code"
|
|
407
|
+
onClick={() => setViewMode("code")}
|
|
408
|
+
/>
|
|
409
|
+
<div className="playground__actions-divider" />
|
|
410
|
+
<Button
|
|
411
|
+
appearance={viewMode === "inspector" ? "primary" : "text"}
|
|
412
|
+
layout="icon-only"
|
|
413
|
+
size="small"
|
|
414
|
+
icon="GearSix"
|
|
415
|
+
aria-label="Show inspector"
|
|
416
|
+
onClick={() => setViewMode("inspector")}
|
|
417
|
+
/>
|
|
418
|
+
</div>
|
|
419
|
+
</div>
|
|
420
|
+
|
|
421
|
+
{/* Inspector/Code Panel */}
|
|
422
|
+
<div className="playground__panel">
|
|
423
|
+
{viewMode === "inspector" ? (
|
|
424
|
+
<>
|
|
425
|
+
{/* Inspector Header */}
|
|
426
|
+
<div className="playground__panel-header">
|
|
427
|
+
<div className="playground__panel-header-content">
|
|
428
|
+
<div className="playground__panel-title-row">
|
|
429
|
+
<Icon name="GearSix" size={16} appearance="bold" />
|
|
430
|
+
<h3 className="playground__panel-title">Inspector</h3>
|
|
431
|
+
</div>
|
|
432
|
+
<p className="playground__panel-subtitle">
|
|
433
|
+
Customize component properties
|
|
434
|
+
</p>
|
|
435
|
+
</div>
|
|
436
|
+
</div>
|
|
437
|
+
|
|
438
|
+
{/* Inspector Content */}
|
|
439
|
+
<div className="playground__panel-content">
|
|
440
|
+
{/* Properties Section */}
|
|
441
|
+
{properties.length > 0 && (
|
|
442
|
+
<div className="playground__section">
|
|
443
|
+
<div className="playground__section-title">
|
|
444
|
+
<Icon name="SquaresFour" size={16} appearance="bold" />
|
|
445
|
+
<span>Properties</span>
|
|
446
|
+
</div>
|
|
447
|
+
<div className="playground__section-content">
|
|
448
|
+
{properties.map(([key, definition]) =>
|
|
449
|
+
renderControl(key, definition),
|
|
450
|
+
)}
|
|
451
|
+
</div>
|
|
452
|
+
</div>
|
|
453
|
+
)}
|
|
454
|
+
|
|
455
|
+
{/* States Section */}
|
|
456
|
+
{states.length > 0 && (
|
|
457
|
+
<div className="playground__section">
|
|
458
|
+
<div className="playground__section-title">
|
|
459
|
+
<Icon name="SquaresFour" size={16} appearance="bold" />
|
|
460
|
+
<span>States</span>
|
|
461
|
+
</div>
|
|
462
|
+
<div className="playground__section-content">
|
|
463
|
+
<div className="playground__states-list">
|
|
464
|
+
{states.map(([key, definition]) =>
|
|
465
|
+
renderControl(key, definition),
|
|
466
|
+
)}
|
|
467
|
+
</div>
|
|
468
|
+
</div>
|
|
469
|
+
</div>
|
|
470
|
+
)}
|
|
471
|
+
</div>
|
|
472
|
+
</>
|
|
473
|
+
) : (
|
|
474
|
+
<>
|
|
475
|
+
{/* Code Header */}
|
|
476
|
+
<div className="playground__panel-header">
|
|
477
|
+
<div className="playground__panel-header-content">
|
|
478
|
+
<div className="playground__panel-title-row">
|
|
479
|
+
<h3 className="playground__panel-title">Component Code</h3>
|
|
480
|
+
</div>
|
|
481
|
+
<p className="playground__panel-subtitle">
|
|
482
|
+
Copy and paste into your project
|
|
483
|
+
</p>
|
|
484
|
+
</div>
|
|
485
|
+
<Button
|
|
486
|
+
appearance="outline"
|
|
487
|
+
layout="icon-left"
|
|
488
|
+
size="small"
|
|
489
|
+
icon="CopySimple"
|
|
490
|
+
label="Copy"
|
|
491
|
+
onClick={copyCode}
|
|
492
|
+
/>
|
|
493
|
+
</div>
|
|
494
|
+
|
|
495
|
+
{/* Code Content */}
|
|
496
|
+
<div className="playground__code-container">
|
|
497
|
+
<div className="playground__code-block">
|
|
498
|
+
<pre className="playground__code-pre">
|
|
499
|
+
<code
|
|
500
|
+
className="playground__code"
|
|
501
|
+
dangerouslySetInnerHTML={{
|
|
502
|
+
__html: highlightCode(codeString),
|
|
503
|
+
}}
|
|
504
|
+
/>
|
|
505
|
+
</pre>
|
|
506
|
+
</div>
|
|
507
|
+
</div>
|
|
508
|
+
|
|
509
|
+
{/* Pro Tips */}
|
|
510
|
+
<div className="playground__pro-tips">
|
|
511
|
+
<p className="playground__pro-tips-title">Pro Tips:</p>
|
|
512
|
+
<ul className="playground__pro-tips-list">
|
|
513
|
+
<li>Customize props in the inspector to update the code</li>
|
|
514
|
+
<li>All components are fully typed with TypeScript</li>
|
|
515
|
+
<li>Use Cmd/Ctrl + K to toggle the panel</li>
|
|
516
|
+
</ul>
|
|
517
|
+
</div>
|
|
518
|
+
</>
|
|
519
|
+
)}
|
|
520
|
+
</div>
|
|
521
|
+
</div>
|
|
522
|
+
</div>
|
|
523
|
+
);
|
|
524
|
+
}
|