@flipdish/ui-library 0.2.1
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/README.md +338 -0
- package/dist/components/atoms/Avatar/avatar.utils.d.ts +10 -0
- package/dist/components/atoms/Avatar/avatar.utils.d.ts.map +1 -0
- package/dist/components/atoms/Avatar/components/avatar-add-button.d.ts +9 -0
- package/dist/components/atoms/Avatar/components/avatar-add-button.d.ts.map +1 -0
- package/dist/components/atoms/Avatar/components/avatar-company-icon.d.ts +8 -0
- package/dist/components/atoms/Avatar/components/avatar-company-icon.d.ts.map +1 -0
- package/dist/components/atoms/Avatar/components/avatar-count.cjs +9 -0
- package/dist/components/atoms/Avatar/components/avatar-count.cjs.map +1 -0
- package/dist/components/atoms/Avatar/components/avatar-count.d.ts +7 -0
- package/dist/components/atoms/Avatar/components/avatar-count.d.ts.map +1 -0
- package/dist/components/atoms/Avatar/components/avatar-count.js +7 -0
- package/dist/components/atoms/Avatar/components/avatar-count.js.map +1 -0
- package/dist/components/atoms/Avatar/components/avatar-online-indicator.cjs +21 -0
- package/dist/components/atoms/Avatar/components/avatar-online-indicator.cjs.map +1 -0
- package/dist/components/atoms/Avatar/components/avatar-online-indicator.d.ts +8 -0
- package/dist/components/atoms/Avatar/components/avatar-online-indicator.d.ts.map +1 -0
- package/dist/components/atoms/Avatar/components/avatar-online-indicator.js +19 -0
- package/dist/components/atoms/Avatar/components/avatar-online-indicator.js.map +1 -0
- package/dist/components/atoms/Avatar/components/verified-tick.cjs +21 -0
- package/dist/components/atoms/Avatar/components/verified-tick.cjs.map +1 -0
- package/dist/components/atoms/Avatar/components/verified-tick.d.ts +7 -0
- package/dist/components/atoms/Avatar/components/verified-tick.d.ts.map +1 -0
- package/dist/components/atoms/Avatar/components/verified-tick.js +19 -0
- package/dist/components/atoms/Avatar/components/verified-tick.js.map +1 -0
- package/dist/components/atoms/Avatar/index.cjs +54 -0
- package/dist/components/atoms/Avatar/index.cjs.map +1 -0
- package/dist/components/atoms/Avatar/index.d.ts +65 -0
- package/dist/components/atoms/Avatar/index.d.ts.map +1 -0
- package/dist/components/atoms/Avatar/index.js +52 -0
- package/dist/components/atoms/Avatar/index.js.map +1 -0
- package/dist/components/atoms/Badge/badge.types.cjs +10 -0
- package/dist/components/atoms/Badge/badge.types.cjs.map +1 -0
- package/dist/components/atoms/Badge/badge.types.d.ts +22 -0
- package/dist/components/atoms/Badge/badge.types.d.ts.map +1 -0
- package/dist/components/atoms/Badge/badge.types.js +8 -0
- package/dist/components/atoms/Badge/badge.types.js.map +1 -0
- package/dist/components/atoms/Badge/index.cjs +274 -0
- package/dist/components/atoms/Badge/index.cjs.map +1 -0
- package/dist/components/atoms/Badge/index.d.ts +129 -0
- package/dist/components/atoms/Badge/index.d.ts.map +1 -0
- package/dist/components/atoms/Badge/index.js +265 -0
- package/dist/components/atoms/Badge/index.js.map +1 -0
- package/dist/components/atoms/Button/index.cjs +164 -0
- package/dist/components/atoms/Button/index.cjs.map +1 -0
- package/dist/components/atoms/Button/index.d.ts +111 -0
- package/dist/components/atoms/Button/index.d.ts.map +1 -0
- package/dist/components/atoms/Button/index.js +161 -0
- package/dist/components/atoms/Button/index.js.map +1 -0
- package/dist/components/atoms/Checkbox/index.cjs +35 -0
- package/dist/components/atoms/Checkbox/index.cjs.map +1 -0
- package/dist/components/atoms/Checkbox/index.d.ts +26 -0
- package/dist/components/atoms/Checkbox/index.d.ts.map +1 -0
- package/dist/components/atoms/Checkbox/index.js +32 -0
- package/dist/components/atoms/Checkbox/index.js.map +1 -0
- package/dist/components/atoms/Divider/index.cjs +17 -0
- package/dist/components/atoms/Divider/index.cjs.map +1 -0
- package/dist/components/atoms/Divider/index.d.ts +17 -0
- package/dist/components/atoms/Divider/index.d.ts.map +1 -0
- package/dist/components/atoms/Divider/index.js +15 -0
- package/dist/components/atoms/Divider/index.js.map +1 -0
- package/dist/components/atoms/Dot/index.cjs +29 -0
- package/dist/components/atoms/Dot/index.cjs.map +1 -0
- package/dist/components/atoms/Dot/index.d.ts +10 -0
- package/dist/components/atoms/Dot/index.d.ts.map +1 -0
- package/dist/components/atoms/Dot/index.js +27 -0
- package/dist/components/atoms/Dot/index.js.map +1 -0
- package/dist/components/atoms/FeaturedIcon/index.cjs +122 -0
- package/dist/components/atoms/FeaturedIcon/index.cjs.map +1 -0
- package/dist/components/atoms/FeaturedIcon/index.d.ts +15 -0
- package/dist/components/atoms/FeaturedIcon/index.d.ts.map +1 -0
- package/dist/components/atoms/FeaturedIcon/index.js +120 -0
- package/dist/components/atoms/FeaturedIcon/index.js.map +1 -0
- package/dist/components/atoms/Input/components/hint-text.cjs +17 -0
- package/dist/components/atoms/Input/components/hint-text.cjs.map +1 -0
- package/dist/components/atoms/Input/components/hint-text.d.ts +15 -0
- package/dist/components/atoms/Input/components/hint-text.d.ts.map +1 -0
- package/dist/components/atoms/Input/components/hint-text.js +15 -0
- package/dist/components/atoms/Input/components/hint-text.js.map +1 -0
- package/dist/components/atoms/Input/components/label.cjs +28 -0
- package/dist/components/atoms/Input/components/label.cjs.map +1 -0
- package/dist/components/atoms/Input/components/label.d.ts +16 -0
- package/dist/components/atoms/Input/components/label.d.ts.map +1 -0
- package/dist/components/atoms/Input/components/label.js +26 -0
- package/dist/components/atoms/Input/components/label.js.map +1 -0
- package/dist/components/atoms/Input/index.cjs +78 -0
- package/dist/components/atoms/Input/index.cjs.map +1 -0
- package/dist/components/atoms/Input/index.d.ts +60 -0
- package/dist/components/atoms/Input/index.d.ts.map +1 -0
- package/dist/components/atoms/Input/index.js +72 -0
- package/dist/components/atoms/Input/index.js.map +1 -0
- package/dist/components/atoms/LoadingIndicator/index.cjs +54 -0
- package/dist/components/atoms/LoadingIndicator/index.cjs.map +1 -0
- package/dist/components/atoms/LoadingIndicator/index.d.ts +24 -0
- package/dist/components/atoms/LoadingIndicator/index.d.ts.map +1 -0
- package/dist/components/atoms/LoadingIndicator/index.js +52 -0
- package/dist/components/atoms/LoadingIndicator/index.js.map +1 -0
- package/dist/components/atoms/RadioButton/index.cjs +43 -0
- package/dist/components/atoms/RadioButton/index.cjs.map +1 -0
- package/dist/components/atoms/RadioButton/index.d.ts +33 -0
- package/dist/components/atoms/RadioButton/index.d.ts.map +1 -0
- package/dist/components/atoms/RadioButton/index.js +39 -0
- package/dist/components/atoms/RadioButton/index.js.map +1 -0
- package/dist/components/atoms/Toggle/index.cjs +63 -0
- package/dist/components/atoms/Toggle/index.cjs.map +1 -0
- package/dist/components/atoms/Toggle/index.d.ts +26 -0
- package/dist/components/atoms/Toggle/index.d.ts.map +1 -0
- package/dist/components/atoms/Toggle/index.js +60 -0
- package/dist/components/atoms/Toggle/index.js.map +1 -0
- package/dist/components/atoms/Tooltip/index.cjs +22 -0
- package/dist/components/atoms/Tooltip/index.cjs.map +1 -0
- package/dist/components/atoms/Tooltip/index.d.ts +30 -0
- package/dist/components/atoms/Tooltip/index.d.ts.map +1 -0
- package/dist/components/atoms/Tooltip/index.js +19 -0
- package/dist/components/atoms/Tooltip/index.js.map +1 -0
- package/dist/components/molecules/Breadcrumbs/components/breadcrumb-account-item.cjs +22 -0
- package/dist/components/molecules/Breadcrumbs/components/breadcrumb-account-item.cjs.map +1 -0
- package/dist/components/molecules/Breadcrumbs/components/breadcrumb-account-item.d.ts +13 -0
- package/dist/components/molecules/Breadcrumbs/components/breadcrumb-account-item.d.ts.map +1 -0
- package/dist/components/molecules/Breadcrumbs/components/breadcrumb-account-item.js +20 -0
- package/dist/components/molecules/Breadcrumbs/components/breadcrumb-account-item.js.map +1 -0
- package/dist/components/molecules/Breadcrumbs/components/breadcrumb-item.cjs +44 -0
- package/dist/components/molecules/Breadcrumbs/components/breadcrumb-item.cjs.map +1 -0
- package/dist/components/molecules/Breadcrumbs/components/breadcrumb-item.d.ts +19 -0
- package/dist/components/molecules/Breadcrumbs/components/breadcrumb-item.d.ts.map +1 -0
- package/dist/components/molecules/Breadcrumbs/components/breadcrumb-item.js +42 -0
- package/dist/components/molecules/Breadcrumbs/components/breadcrumb-item.js.map +1 -0
- package/dist/components/molecules/Breadcrumbs/index.cjs +38 -0
- package/dist/components/molecules/Breadcrumbs/index.cjs.map +1 -0
- package/dist/components/molecules/Breadcrumbs/index.d.ts +25 -0
- package/dist/components/molecules/Breadcrumbs/index.d.ts.map +1 -0
- package/dist/components/molecules/Breadcrumbs/index.js +35 -0
- package/dist/components/molecules/Breadcrumbs/index.js.map +1 -0
- package/dist/components/molecules/ButtonGroup/index.cjs +64 -0
- package/dist/components/molecules/ButtonGroup/index.cjs.map +1 -0
- package/dist/components/molecules/ButtonGroup/index.d.ts +51 -0
- package/dist/components/molecules/ButtonGroup/index.d.ts.map +1 -0
- package/dist/components/molecules/ButtonGroup/index.js +60 -0
- package/dist/components/molecules/ButtonGroup/index.js.map +1 -0
- package/dist/components/molecules/Dropdown/index.cjs +66 -0
- package/dist/components/molecules/Dropdown/index.cjs.map +1 -0
- package/dist/components/molecules/Dropdown/index.d.ts +39 -0
- package/dist/components/molecules/Dropdown/index.d.ts.map +1 -0
- package/dist/components/molecules/Dropdown/index.js +64 -0
- package/dist/components/molecules/Dropdown/index.js.map +1 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-avatar.cjs +14 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-avatar.cjs.map +1 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-avatar.d.ts +16 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-avatar.d.ts.map +1 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-avatar.js +12 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-avatar.js.map +1 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-checkbox.cjs +13 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-checkbox.cjs.map +1 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-checkbox.d.ts +9 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-checkbox.d.ts.map +1 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-checkbox.js +11 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-checkbox.js.map +1 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-icon-card.cjs +15 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-icon-card.cjs.map +1 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-icon-card.d.ts +21 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-icon-card.d.ts.map +1 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-icon-card.js +13 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-icon-card.js.map +1 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-icon-simple.cjs +14 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-icon-simple.cjs.map +1 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-icon-simple.d.ts +9 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-icon-simple.d.ts.map +1 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-icon-simple.js +12 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-icon-simple.js.map +1 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-payment-icon.cjs +14 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-payment-icon.cjs.map +1 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-payment-icon.d.ts +16 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-payment-icon.d.ts.map +1 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-payment-icon.js +12 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-payment-icon.js.map +1 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-radio-button.cjs +12 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-radio-button.cjs.map +1 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-radio-button.d.ts +9 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-radio-button.d.ts.map +1 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-radio-button.js +10 -0
- package/dist/components/molecules/RadioGroup/components/radio-group-radio-button.js.map +1 -0
- package/dist/components/molecules/RadioGroup/index.cjs +18 -0
- package/dist/components/molecules/RadioGroup/index.cjs.map +1 -0
- package/dist/components/molecules/RadioGroup/index.d.ts +7 -0
- package/dist/components/molecules/RadioGroup/index.d.ts.map +1 -0
- package/dist/components/molecules/RadioGroup/index.js +7 -0
- package/dist/components/molecules/RadioGroup/index.js.map +1 -0
- package/dist/components/molecules/RadioGroup/radioGroup.types.d.ts +12 -0
- package/dist/components/molecules/RadioGroup/radioGroup.types.d.ts.map +1 -0
- package/dist/components/molecules/SectionHeader/index.cjs +20 -0
- package/dist/components/molecules/SectionHeader/index.cjs.map +1 -0
- package/dist/components/molecules/SectionHeader/index.d.ts +9 -0
- package/dist/components/molecules/SectionHeader/index.d.ts.map +1 -0
- package/dist/components/molecules/SectionHeader/index.js +18 -0
- package/dist/components/molecules/SectionHeader/index.js.map +1 -0
- package/dist/components/molecules/Select/components/combobox.cjs +47 -0
- package/dist/components/molecules/Select/components/combobox.cjs.map +1 -0
- package/dist/components/molecules/Select/components/combobox.d.ts +15 -0
- package/dist/components/molecules/Select/components/combobox.d.ts.map +1 -0
- package/dist/components/molecules/Select/components/combobox.js +45 -0
- package/dist/components/molecules/Select/components/combobox.js.map +1 -0
- package/dist/components/molecules/Select/components/popover.cjs +14 -0
- package/dist/components/molecules/Select/components/popover.cjs.map +1 -0
- package/dist/components/molecules/Select/components/popover.d.ts +8 -0
- package/dist/components/molecules/Select/components/popover.d.ts.map +1 -0
- package/dist/components/molecules/Select/components/popover.js +12 -0
- package/dist/components/molecules/Select/components/popover.js.map +1 -0
- package/dist/components/molecules/Select/components/select-item.cjs +54 -0
- package/dist/components/molecules/Select/components/select-item.cjs.map +1 -0
- package/dist/components/molecules/Select/components/select-item.d.ts +11 -0
- package/dist/components/molecules/Select/components/select-item.d.ts.map +1 -0
- package/dist/components/molecules/Select/components/select-item.js +52 -0
- package/dist/components/molecules/Select/components/select-item.js.map +1 -0
- package/dist/components/molecules/Select/components/select-shared.cjs +20 -0
- package/dist/components/molecules/Select/components/select-shared.cjs.map +1 -0
- package/dist/components/molecules/Select/components/select-shared.d.ts +59 -0
- package/dist/components/molecules/Select/components/select-shared.d.ts.map +1 -0
- package/dist/components/molecules/Select/components/select-shared.js +17 -0
- package/dist/components/molecules/Select/components/select-shared.js.map +1 -0
- package/dist/components/molecules/Select/index.cjs +37 -0
- package/dist/components/molecules/Select/index.cjs.map +1 -0
- package/dist/components/molecules/Select/index.d.ts +19 -0
- package/dist/components/molecules/Select/index.d.ts.map +1 -0
- package/dist/components/molecules/Select/index.js +33 -0
- package/dist/components/molecules/Select/index.js.map +1 -0
- package/dist/components/organisms/PageHeader/components/page-header-simple.cjs +14 -0
- package/dist/components/organisms/PageHeader/components/page-header-simple.cjs.map +1 -0
- package/dist/components/organisms/PageHeader/components/page-header-simple.d.ts +24 -0
- package/dist/components/organisms/PageHeader/components/page-header-simple.d.ts.map +1 -0
- package/dist/components/organisms/PageHeader/components/page-header-simple.js +12 -0
- package/dist/components/organisms/PageHeader/components/page-header-simple.js.map +1 -0
- package/dist/components/organisms/PageHeader/index.cjs +8 -0
- package/dist/components/organisms/PageHeader/index.cjs.map +1 -0
- package/dist/components/organisms/PageHeader/index.d.ts +7 -0
- package/dist/components/organisms/PageHeader/index.d.ts.map +1 -0
- package/dist/components/organisms/PageHeader/index.js +2 -0
- package/dist/components/organisms/PageHeader/index.js.map +1 -0
- package/dist/components/templates/NotFoundPage/index.cjs +19 -0
- package/dist/components/templates/NotFoundPage/index.cjs.map +1 -0
- package/dist/components/templates/NotFoundPage/index.d.ts +25 -0
- package/dist/components/templates/NotFoundPage/index.d.ts.map +1 -0
- package/dist/components/templates/NotFoundPage/index.js +17 -0
- package/dist/components/templates/NotFoundPage/index.js.map +1 -0
- package/dist/components/templates/PageLayout/index.cjs +30 -0
- package/dist/components/templates/PageLayout/index.cjs.map +1 -0
- package/dist/components/templates/PageLayout/index.d.ts +43 -0
- package/dist/components/templates/PageLayout/index.d.ts.map +1 -0
- package/dist/components/templates/PageLayout/index.js +28 -0
- package/dist/components/templates/PageLayout/index.js.map +1 -0
- package/dist/hooks/useResizeObserver/index.cjs +47 -0
- package/dist/hooks/useResizeObserver/index.cjs.map +1 -0
- package/dist/hooks/useResizeObserver/index.d.ts +25 -0
- package/dist/hooks/useResizeObserver/index.d.ts.map +1 -0
- package/dist/hooks/useResizeObserver/index.js +45 -0
- package/dist/hooks/useResizeObserver/index.js.map +1 -0
- package/dist/providers/ErrorBoundary/index.cjs +36 -0
- package/dist/providers/ErrorBoundary/index.cjs.map +1 -0
- package/dist/providers/ErrorBoundary/index.d.ts +32 -0
- package/dist/providers/ErrorBoundary/index.d.ts.map +1 -0
- package/dist/providers/ErrorBoundary/index.js +34 -0
- package/dist/providers/ErrorBoundary/index.js.map +1 -0
- package/dist/src/components/atoms/Avatar/avatar.utils.d.ts +10 -0
- package/dist/src/components/atoms/Avatar/avatar.utils.d.ts.map +1 -0
- package/dist/src/components/atoms/Avatar/components/avatar-add-button.d.ts +9 -0
- package/dist/src/components/atoms/Avatar/components/avatar-add-button.d.ts.map +1 -0
- package/dist/src/components/atoms/Avatar/components/avatar-company-icon.d.ts +8 -0
- package/dist/src/components/atoms/Avatar/components/avatar-company-icon.d.ts.map +1 -0
- package/dist/src/components/atoms/Avatar/components/avatar-count.d.ts +7 -0
- package/dist/src/components/atoms/Avatar/components/avatar-count.d.ts.map +1 -0
- package/dist/src/components/atoms/Avatar/components/avatar-online-indicator.d.ts +8 -0
- package/dist/src/components/atoms/Avatar/components/avatar-online-indicator.d.ts.map +1 -0
- package/dist/src/components/atoms/Avatar/components/verified-tick.d.ts +7 -0
- package/dist/src/components/atoms/Avatar/components/verified-tick.d.ts.map +1 -0
- package/dist/src/components/atoms/Avatar/index.d.ts +65 -0
- package/dist/src/components/atoms/Avatar/index.d.ts.map +1 -0
- package/dist/src/components/atoms/Badge/badge.types.d.ts +22 -0
- package/dist/src/components/atoms/Badge/badge.types.d.ts.map +1 -0
- package/dist/src/components/atoms/Badge/index.d.ts +129 -0
- package/dist/src/components/atoms/Badge/index.d.ts.map +1 -0
- package/dist/src/components/atoms/Button/index.d.ts +111 -0
- package/dist/src/components/atoms/Button/index.d.ts.map +1 -0
- package/dist/src/components/atoms/Checkbox/index.d.ts +26 -0
- package/dist/src/components/atoms/Checkbox/index.d.ts.map +1 -0
- package/dist/src/components/atoms/Divider/index.d.ts +17 -0
- package/dist/src/components/atoms/Divider/index.d.ts.map +1 -0
- package/dist/src/components/atoms/Dot/index.d.ts +5 -0
- package/dist/src/components/atoms/Dot/index.d.ts.map +1 -0
- package/dist/src/components/atoms/FeaturedIcon/index.d.ts +15 -0
- package/dist/src/components/atoms/FeaturedIcon/index.d.ts.map +1 -0
- package/dist/src/components/atoms/Input/components/hint-text.d.ts +15 -0
- package/dist/src/components/atoms/Input/components/hint-text.d.ts.map +1 -0
- package/dist/src/components/atoms/Input/components/label.d.ts +16 -0
- package/dist/src/components/atoms/Input/components/label.d.ts.map +1 -0
- package/dist/src/components/atoms/Input/index.d.ts +60 -0
- package/dist/src/components/atoms/Input/index.d.ts.map +1 -0
- package/dist/src/components/atoms/LoadingIndicator/index.d.ts +19 -0
- package/dist/src/components/atoms/LoadingIndicator/index.d.ts.map +1 -0
- package/dist/src/components/atoms/RadioButton/index.d.ts +33 -0
- package/dist/src/components/atoms/RadioButton/index.d.ts.map +1 -0
- package/dist/src/components/atoms/Toggle/index.d.ts +21 -0
- package/dist/src/components/atoms/Toggle/index.d.ts.map +1 -0
- package/dist/src/components/atoms/Tooltip/index.d.ts +30 -0
- package/dist/src/components/atoms/Tooltip/index.d.ts.map +1 -0
- package/dist/src/components/molecules/Breadcrumbs/components/breadcrumb-account-item.d.ts +13 -0
- package/dist/src/components/molecules/Breadcrumbs/components/breadcrumb-account-item.d.ts.map +1 -0
- package/dist/src/components/molecules/Breadcrumbs/components/breadcrumb-item.d.ts +19 -0
- package/dist/src/components/molecules/Breadcrumbs/components/breadcrumb-item.d.ts.map +1 -0
- package/dist/src/components/molecules/Breadcrumbs/index.d.ts +25 -0
- package/dist/src/components/molecules/Breadcrumbs/index.d.ts.map +1 -0
- package/dist/src/components/molecules/ButtonGroup/index.d.ts +41 -0
- package/dist/src/components/molecules/ButtonGroup/index.d.ts.map +1 -0
- package/dist/src/components/molecules/Dropdown/index.d.ts +35 -0
- package/dist/src/components/molecules/Dropdown/index.d.ts.map +1 -0
- package/dist/src/components/molecules/RadioGroup/components/radio-group-avatar.d.ts +16 -0
- package/dist/src/components/molecules/RadioGroup/components/radio-group-avatar.d.ts.map +1 -0
- package/dist/src/components/molecules/RadioGroup/components/radio-group-checkbox.d.ts +9 -0
- package/dist/src/components/molecules/RadioGroup/components/radio-group-checkbox.d.ts.map +1 -0
- package/dist/src/components/molecules/RadioGroup/components/radio-group-icon-card.d.ts +21 -0
- package/dist/src/components/molecules/RadioGroup/components/radio-group-icon-card.d.ts.map +1 -0
- package/dist/src/components/molecules/RadioGroup/components/radio-group-icon-simple.d.ts +19 -0
- package/dist/src/components/molecules/RadioGroup/components/radio-group-icon-simple.d.ts.map +1 -0
- package/dist/src/components/molecules/RadioGroup/components/radio-group-payment-icon.d.ts +16 -0
- package/dist/src/components/molecules/RadioGroup/components/radio-group-payment-icon.d.ts.map +1 -0
- package/dist/src/components/molecules/RadioGroup/components/radio-group-radio-button.d.ts +9 -0
- package/dist/src/components/molecules/RadioGroup/components/radio-group-radio-button.d.ts.map +1 -0
- package/dist/src/components/molecules/RadioGroup/index.d.ts +7 -0
- package/dist/src/components/molecules/RadioGroup/index.d.ts.map +1 -0
- package/dist/src/components/molecules/RadioGroup/radioGroup.types.d.ts +12 -0
- package/dist/src/components/molecules/RadioGroup/radioGroup.types.d.ts.map +1 -0
- package/dist/src/components/molecules/SectionHeader/index.d.ts +9 -0
- package/dist/src/components/molecules/SectionHeader/index.d.ts.map +1 -0
- package/dist/src/components/molecules/Select/components/combobox.d.ts +15 -0
- package/dist/src/components/molecules/Select/components/combobox.d.ts.map +1 -0
- package/dist/src/components/molecules/Select/components/popover.d.ts +8 -0
- package/dist/src/components/molecules/Select/components/popover.d.ts.map +1 -0
- package/dist/src/components/molecules/Select/components/select-item.d.ts +11 -0
- package/dist/src/components/molecules/Select/components/select-item.d.ts.map +1 -0
- package/dist/src/components/molecules/Select/components/select-shared.d.ts +59 -0
- package/dist/src/components/molecules/Select/components/select-shared.d.ts.map +1 -0
- package/dist/src/components/molecules/Select/index.d.ts +19 -0
- package/dist/src/components/molecules/Select/index.d.ts.map +1 -0
- package/dist/src/components/organisms/PageHeader/components/page-header-simple.d.ts +24 -0
- package/dist/src/components/organisms/PageHeader/components/page-header-simple.d.ts.map +1 -0
- package/dist/src/components/organisms/PageHeader/index.d.ts +2 -0
- package/dist/src/components/organisms/PageHeader/index.d.ts.map +1 -0
- package/dist/src/components/templates/NotFoundPage/index.d.ts +25 -0
- package/dist/src/components/templates/NotFoundPage/index.d.ts.map +1 -0
- package/dist/src/components/templates/PageLayout/index.d.ts +43 -0
- package/dist/src/components/templates/PageLayout/index.d.ts.map +1 -0
- package/dist/src/hooks/useResizeObserver/index.d.ts +25 -0
- package/dist/src/hooks/useResizeObserver/index.d.ts.map +1 -0
- package/dist/src/providers/ErrorBoundary/index.d.ts +32 -0
- package/dist/src/providers/ErrorBoundary/index.d.ts.map +1 -0
- package/dist/src/utilities/cx/index.d.ts +22 -0
- package/dist/src/utilities/cx/index.d.ts.map +1 -0
- package/dist/src/utilities/isReactComponent/index.d.ts +24 -0
- package/dist/src/utilities/isReactComponent/index.d.ts.map +1 -0
- package/dist/src/utilities/renderUtils/index.d.ts +56 -0
- package/dist/src/utilities/renderUtils/index.d.ts.map +1 -0
- package/dist/styles.css +101 -0
- package/dist/utilities/cx/index.cjs +41 -0
- package/dist/utilities/cx/index.cjs.map +1 -0
- package/dist/utilities/cx/index.d.ts +22 -0
- package/dist/utilities/cx/index.d.ts.map +1 -0
- package/dist/utilities/cx/index.js +38 -0
- package/dist/utilities/cx/index.js.map +1 -0
- package/dist/utilities/isReactComponent/index.cjs +40 -0
- package/dist/utilities/isReactComponent/index.cjs.map +1 -0
- package/dist/utilities/isReactComponent/index.d.ts +24 -0
- package/dist/utilities/isReactComponent/index.d.ts.map +1 -0
- package/dist/utilities/isReactComponent/index.js +35 -0
- package/dist/utilities/isReactComponent/index.js.map +1 -0
- package/dist/utilities/renderUtils/index.cjs +122 -0
- package/dist/utilities/renderUtils/index.cjs.map +1 -0
- package/dist/utilities/renderUtils/index.d.ts +56 -0
- package/dist/utilities/renderUtils/index.d.ts.map +1 -0
- package/dist/utilities/renderUtils/index.js +114 -0
- package/dist/utilities/renderUtils/index.js.map +1 -0
- package/package.json +135 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { HelpCircle, InfoCircle, EyeOff, Eye } from '@flipdish/ui-icons';
|
|
3
|
+
import { Tooltip, TooltipTrigger } from '@flipdish/ui-library/components/atoms/Tooltip';
|
|
4
|
+
import { sortCx, cx } from '@flipdish/ui-library/utilities/cx';
|
|
5
|
+
import { createContext, useState, useContext } from 'react';
|
|
6
|
+
import { Group, Input as Input$1, Button, TextField as TextField$1 } from 'react-aria-components';
|
|
7
|
+
import { HintText } from './components/hint-text.js';
|
|
8
|
+
import { Label } from './components/label.js';
|
|
9
|
+
|
|
10
|
+
const InputBase = ({ ref, tooltip, shortcut, groupRef, size = 'md', isInvalid, isDisabled, isRequired, icon: Icon, placeholder, wrapperClassName, tooltipClassName, inputClassName, iconClassName, type = 'text', ...inputProps }) => {
|
|
11
|
+
const [isPasswordVisible, setIsPasswordVisible] = useState(false);
|
|
12
|
+
// Check if the input has a leading icon or a trailing adornment (tooltip, invalid
|
|
13
|
+
// indicator, or the password visibility toggle) so we can reserve right-side padding.
|
|
14
|
+
const hasTrailingIcon = Boolean(tooltip) || Boolean(isInvalid) || type === 'password';
|
|
15
|
+
const hasLeadingIcon = Icon;
|
|
16
|
+
// If the input is inside a `TextFieldContext`, use its context to simplify applying styles
|
|
17
|
+
const context = useContext(TextFieldContext);
|
|
18
|
+
const inputSize = context?.size || size;
|
|
19
|
+
const sizes = sortCx({
|
|
20
|
+
sm: {
|
|
21
|
+
root: cx('px-3 py-2 text-sm', hasLeadingIcon && 'pl-9', hasTrailingIcon && 'pr-9'),
|
|
22
|
+
iconLeading: 'left-3 size-4 stroke-[2.25px]',
|
|
23
|
+
iconTrailing: 'right-3',
|
|
24
|
+
shortcut: 'pr-1.5',
|
|
25
|
+
},
|
|
26
|
+
md: {
|
|
27
|
+
root: cx('px-3 py-2 text-md', hasLeadingIcon && 'pl-10', hasTrailingIcon && 'pr-9'),
|
|
28
|
+
iconLeading: 'left-3 size-5',
|
|
29
|
+
iconTrailing: 'right-3',
|
|
30
|
+
shortcut: 'pr-2',
|
|
31
|
+
},
|
|
32
|
+
lg: {
|
|
33
|
+
root: cx('px-3.5 py-2.5 text-md', hasLeadingIcon && 'pl-10.5', hasTrailingIcon && 'pr-9.5'),
|
|
34
|
+
iconLeading: 'left-3.5 size-5',
|
|
35
|
+
iconTrailing: 'right-3.5',
|
|
36
|
+
shortcut: 'pr-2.5',
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
return (jsxs(Group, { isDisabled, isInvalid, ref: groupRef, className: ({ isFocusWithin, isDisabled, isInvalid }) => cx('group/input relative flex w-full flex-row place-content-center place-items-center rounded-lg bg-primary shadow-xs ring-1 ring-primary transition-shadow duration-100 ease-linear ring-inset', isFocusWithin && !isDisabled && 'ring-2 ring-brand',
|
|
40
|
+
// Disabled state styles
|
|
41
|
+
isDisabled && 'cursor-not-allowed opacity-50', 'group-disabled:cursor-not-allowed group-disabled:opacity-50',
|
|
42
|
+
// Invalid state styles
|
|
43
|
+
isInvalid && 'ring-error_subtle', 'group-invalid:ring-error_subtle',
|
|
44
|
+
// Invalid state with focus-within styles
|
|
45
|
+
isInvalid && isFocusWithin && 'ring-2 ring-error', isFocusWithin && 'group-invalid:ring-2 group-invalid:ring-error', context?.wrapperClassName, wrapperClassName), children: [Icon && (jsx(Icon, { className: cx('pointer-events-none absolute text-fg-quaternary', sizes[inputSize].iconLeading, context?.iconClassName, iconClassName) })), jsx(Input$1, { ...inputProps, ref: ref, required: isRequired, type: type === 'password' && isPasswordVisible ? 'text' : type, placeholder: placeholder, className: cx('m-0 w-full bg-transparent text-primary ring-0 outline-hidden placeholder:text-placeholder autofill:rounded-lg autofill:text-primary disabled:cursor-not-allowed', sizes[inputSize].root, context?.inputClassName, inputClassName) }), tooltip && type !== 'password' && (jsx(Tooltip, { title: tooltip, placement: "top", children: jsx(TooltipTrigger, { className: cx('absolute cursor-pointer text-fg-quaternary transition duration-100 ease-linear group-invalid/input:hidden hover:text-fg-quaternary_hover focus:text-fg-quaternary_hover', sizes[inputSize].iconTrailing, context?.tooltipClassName, tooltipClassName), children: jsx(HelpCircle, { className: "size-4 stroke-[2.25px]" }) }) })), type !== 'password' && (jsx(InfoCircle, { className: cx('pointer-events-none absolute hidden size-4 stroke-[2.25px] text-fg-error-secondary group-invalid/input:block', sizes[inputSize].iconTrailing, context?.tooltipClassName, tooltipClassName) })), type === 'password' && (jsx(Button, { "aria-label": "Toggle password visibility", onClick: () => setIsPasswordVisible(!isPasswordVisible), className: cx('absolute flex cursor-pointer items-center justify-center text-fg-quaternary transition duration-100 ease-linear hover:text-fg-quaternary_hover focus:text-fg-quaternary_hover focus:outline-hidden', sizes[inputSize].iconTrailing), children: isPasswordVisible ? jsx(EyeOff, { className: "size-4 stroke-[2.25px]" }) : jsx(Eye, { className: "size-4 stroke-[2.25px]" }) })), shortcut && (jsx("div", { className: cx('pointer-events-none absolute inset-y-0.5 right-0.5 z-10 hidden items-center rounded-r-[inherit] bg-linear-to-r from-transparent to-bg-primary to-40% pl-8 md:flex', sizes[inputSize].shortcut), children: jsx("span", { "aria-hidden": "true", className: "pointer-events-none rounded px-1 py-px text-xs font-medium text-quaternary ring-1 ring-secondary select-none ring-inset", children: typeof shortcut === 'string' ? shortcut : '⌘K' }) }))] }));
|
|
46
|
+
};
|
|
47
|
+
InputBase.displayName = 'InputBase';
|
|
48
|
+
const TextFieldContext = createContext({});
|
|
49
|
+
const TextField = ({ className, size = 'md', inputClassName, wrapperClassName, iconClassName, tooltipClassName, ...props }) => {
|
|
50
|
+
return (jsx(TextFieldContext.Provider, { value: { inputClassName, wrapperClassName, iconClassName, tooltipClassName, size }, children: jsx(TextField$1, { ...props, "data-input-wrapper": true, "data-input-size": size, className: (state) => cx('group flex h-max w-full flex-col items-start justify-start gap-1.5', typeof className === 'function' ? className(state) : className) }) }));
|
|
51
|
+
};
|
|
52
|
+
TextField.displayName = 'TextField';
|
|
53
|
+
const Input = ({ size = 'md', placeholder, icon: Icon, label, hint, shortcut, hideRequiredIndicator, className, ref, groupRef, tooltip, iconClassName, inputClassName, wrapperClassName, tooltipClassName, type = 'text', ...props }) => {
|
|
54
|
+
return (jsx(TextField, { "aria-label": !label ? placeholder : undefined, ...props, size: size, className: className, children: ({ isRequired, isInvalid }) => (jsxs(Fragment, { children: [label && (jsx(Label, { isRequired: hideRequiredIndicator ? !hideRequiredIndicator : isRequired, isInvalid: isInvalid, children: label })), jsx(InputBase, { ref,
|
|
55
|
+
groupRef,
|
|
56
|
+
size,
|
|
57
|
+
placeholder,
|
|
58
|
+
icon: Icon,
|
|
59
|
+
shortcut,
|
|
60
|
+
isInvalid,
|
|
61
|
+
isRequired,
|
|
62
|
+
iconClassName,
|
|
63
|
+
inputClassName,
|
|
64
|
+
wrapperClassName,
|
|
65
|
+
tooltipClassName,
|
|
66
|
+
tooltip,
|
|
67
|
+
type }), hint && jsx(HintText, { isInvalid: isInvalid, children: hint })] })) }));
|
|
68
|
+
};
|
|
69
|
+
Input.displayName = 'Input';
|
|
70
|
+
|
|
71
|
+
export { HintText, Input, InputBase, Label, TextField };
|
|
72
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/atoms/Input/index.t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IAAA,CAAAM,QAAA,EAAA,EAAA,QAAA,EAAA,CACG,KAAK,KACJJ,GAAA,CAAC,KAAK,EAAA,EAAC,UAAU,EAAE,qBAAqB,GAAG,CAAC,qBAAqB,GAAG,UAAU,EAAE,SAAS,EAAE,SAAS,EAAA,QAAA,EACjG,KAAK,EAAA,CACA,CACT,EAEDA,GAAA,CAAC,SAAS,IAEN,GAAG;oBACH,QAAQ;oBACR,IAAI;oBACJ,WAAW;AACX,oBAAA,IAAI,EAAE,IAAI;oBACV,QAAQ;oBACR,SAAS;oBACT,UAAU;oBACV,aAAa;oBACb,cAAc;oBACd,gBAAgB;oBAChB,gBAAgB;oBAChB,OAAO;AACP,oBAAA,IAAI,GAEN,EAED,IAAI,IAAIA,GAAA,CAAC,QAAQ,EAAA,EAAC,SAAS,EAAE,SAAS,YAAG,IAAI,EAAA,CAAY,IACzD,CACJ,EAAA,CACS;AAEhB;AAEA,KAAK,CAAC,WAAW,GAAG,OAAO;;;;"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var cx = require('@flipdish/ui-library/utilities/cx');
|
|
5
|
+
|
|
6
|
+
const styles = {
|
|
7
|
+
sm: {
|
|
8
|
+
root: 'gap-4',
|
|
9
|
+
label: 'text-sm font-medium',
|
|
10
|
+
spinner: 'size-8',
|
|
11
|
+
},
|
|
12
|
+
md: {
|
|
13
|
+
root: 'gap-4',
|
|
14
|
+
label: 'text-sm font-medium',
|
|
15
|
+
spinner: 'size-12',
|
|
16
|
+
},
|
|
17
|
+
lg: {
|
|
18
|
+
root: 'gap-4',
|
|
19
|
+
label: 'text-lg font-medium',
|
|
20
|
+
spinner: 'size-14',
|
|
21
|
+
},
|
|
22
|
+
xl: {
|
|
23
|
+
root: 'gap-5',
|
|
24
|
+
label: 'text-lg font-medium',
|
|
25
|
+
spinner: 'size-16',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Animated spinner shown while content or an action is in progress, with an optional label.
|
|
30
|
+
*
|
|
31
|
+
* @summary in-progress loading spinner
|
|
32
|
+
*/
|
|
33
|
+
const LoadingIndicator = ({ type = 'line-simple', size = 'sm', label }) => {
|
|
34
|
+
const renderSpinner = () => {
|
|
35
|
+
if (type === 'line-spinner') {
|
|
36
|
+
return (
|
|
37
|
+
// biome-ignore lint/a11y/noSvgWithoutTitle: this is an icon
|
|
38
|
+
jsxRuntime.jsx("svg", { className: cx.cx('animate-spin', styles[size].spinner), viewBox: "0 0 32 32", fill: "none", children: jsxRuntime.jsx("circle", { className: "stroke-fg-brand-primary", cx: "16", cy: "16", r: "14", fill: "none", strokeWidth: "4", strokeDashoffset: "40", strokeDasharray: "100", strokeLinecap: "round" }) }));
|
|
39
|
+
}
|
|
40
|
+
if (type === 'dot-circle') {
|
|
41
|
+
return (
|
|
42
|
+
// biome-ignore lint/a11y/noSvgWithoutTitle: this is an icon
|
|
43
|
+
jsxRuntime.jsxs("svg", { className: cx.cx('animate-spin text-fg-brand-primary', styles[size].spinner), viewBox: "0 0 36 36", fill: "none", children: [jsxRuntime.jsx("path", { d: "M34 18C34 15.8989 33.5861 13.8183 32.7821 11.8771C31.978 9.93586 30.7994 8.17203 29.3137 6.68629C27.828 5.20055 26.0641 4.022 24.1229 3.21793C22.1817 2.41385 20.1011 2 18 2C15.8988 2 13.8183 2.41385 11.8771 3.21793C9.93585 4.022 8.17203 5.20055 6.68629 6.68629C5.20055 8.17203 4.022 9.93586 3.21793 11.8771C2.41385 13.8183 2 15.8989 2 18", stroke: "url(#paint0)", strokeWidth: "4", strokeLinecap: "round", strokeLinejoin: "round", strokeDasharray: "0.1 8" }), jsxRuntime.jsx("path", { d: "M3.21793 24.1229C4.022 26.0641 5.20055 27.828 6.68629 29.3137C8.17203 30.7994 9.93585 31.978 11.8771 32.7821C13.8183 33.5861 15.8988 34 18 34C20.1011 34 22.1817 33.5861 24.1229 32.7821C26.0641 31.978 27.828 30.7994 29.3137 29.3137C30.7994 27.828 31.978 26.0641 32.7821 24.1229", stroke: "url(#paint1)", strokeWidth: "4", strokeLinecap: "round", strokeLinejoin: "round", strokeDasharray: "0.1 8" }), jsxRuntime.jsxs("defs", { children: [jsxRuntime.jsxs("linearGradient", { id: "paint0", x1: "34", y1: "18", x2: "2", y2: "18", gradientUnits: "userSpaceOnUse", children: [jsxRuntime.jsx("stop", { stopColor: "currentColor" }), jsxRuntime.jsx("stop", { offset: "1", stopColor: "currentColor", stopOpacity: "0.5" })] }), jsxRuntime.jsxs("linearGradient", { id: "paint1", x1: "33", y1: "23.5", x2: "3", y2: "24", gradientUnits: "userSpaceOnUse", children: [jsxRuntime.jsx("stop", { stopOpacity: "0", stopColor: "currentColor" }), jsxRuntime.jsx("stop", { offset: "1", stopColor: "currentColor", stopOpacity: "0.48" })] })] })] }));
|
|
44
|
+
}
|
|
45
|
+
// Default case: type === "line-simple"
|
|
46
|
+
return (
|
|
47
|
+
// biome-ignore lint/a11y/noSvgWithoutTitle: this is an icon
|
|
48
|
+
jsxRuntime.jsxs("svg", { className: cx.cx('animate-spin', styles[size].spinner), viewBox: "0 0 32 32", fill: "none", children: [jsxRuntime.jsx("circle", { className: "text-bg-tertiary", cx: "16", cy: "16", r: "14", stroke: "currentColor", strokeWidth: "4" }), jsxRuntime.jsx("circle", { className: "stroke-fg-brand-primary", cx: "16", cy: "16", r: "14", fill: "none", strokeWidth: "4", strokeDashoffset: "75", strokeDasharray: "100", strokeLinecap: "round" })] }));
|
|
49
|
+
};
|
|
50
|
+
return (jsxRuntime.jsxs("div", { className: cx.cx('flex flex-col items-center justify-center', styles[size].root), children: [renderSpinner(), label && jsxRuntime.jsx("span", { className: cx.cx('text-secondary', styles[size].label), children: label })] }));
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
exports.LoadingIndicator = LoadingIndicator;
|
|
54
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/components/atoms/LoadingIndicator/index.tsx"],"sourcesContent":[null],"names":["_jsx","cx","_jsxs"],"mappings":";;;;;AAIA,MAAM,MAAM,GAAG;AACb,IAAA,EAAE,EAAE;AACF,QAAA,IAAI,EAAE,OAAO;AACb,QAAA,KAAK,EAAE,qBAAqB;AAC5B,QAAA,OAAO,EAAE,QAAQ;AAClB,KAAA;AACD,IAAA,EAAE,EAAE;AACF,QAAA,IAAI,EAAE,OAAO;AACb,QAAA,KAAK,EAAE,qBAAqB;AAC5B,QAAA,OAAO,EAAE,SAAS;AACnB,KAAA;AACD,IAAA,EAAE,EAAE;AACF,QAAA,IAAI,EAAE,OAAO;AACb,QAAA,KAAK,EAAE,qBAAqB;AAC5B,QAAA,OAAO,EAAE,SAAS;AACnB,KAAA;AACD,IAAA,EAAE,EAAE;AACF,QAAA,IAAI,EAAE,OAAO;AACb,QAAA,KAAK,EAAE,qBAAqB;AAC5B,QAAA,OAAO,EAAE,SAAS;AACnB,KAAA;CACF;AAmBD;;;;AAIG;AACI,MAAM,gBAAgB,GAAG,CAAC,EAAE,IAAI,GAAG,aAAa,EAAE,IAAI,GAAG,IAAI,EAAE,KAAK,EAAyB,KAAI;IACtG,MAAM,aAAa,GAAG,MAAK;AACzB,QAAA,IAAI,IAAI,KAAK,cAAc,EAAE;YAC3B;;AAEE,YAAAA,cAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAEC,KAAE,CAAC,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,EAAE,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,EAAA,QAAA,EACvFD,cAAA,CAAA,QAAA,EAAA,EACE,SAAS,EAAC,yBAAyB,EACnC,EAAE,EAAC,IAAI,EACP,EAAE,EAAC,IAAI,EACP,CAAC,EAAC,IAAI,EACN,IAAI,EAAC,MAAM,EACX,WAAW,EAAC,GAAG,EACf,gBAAgB,EAAC,IAAI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A,EAAA,CAC/E;AAEV;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
interface LoadingIndicatorProps {
|
|
2
|
+
/**
|
|
3
|
+
* The visual style of the loading indicator.
|
|
4
|
+
* @default 'line-simple'
|
|
5
|
+
*/
|
|
6
|
+
type?: 'line-simple' | 'line-spinner' | 'dot-circle';
|
|
7
|
+
/**
|
|
8
|
+
* The size of the loading indicator.
|
|
9
|
+
* @default 'sm'
|
|
10
|
+
*/
|
|
11
|
+
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
12
|
+
/**
|
|
13
|
+
* Optional text label displayed below the indicator.
|
|
14
|
+
*/
|
|
15
|
+
label?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Animated spinner shown while content or an action is in progress, with an optional label.
|
|
19
|
+
*
|
|
20
|
+
* @summary in-progress loading spinner
|
|
21
|
+
*/
|
|
22
|
+
export declare const LoadingIndicator: ({ type, size, label }: LoadingIndicatorProps) => import("react").JSX.Element;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/LoadingIndicator/index.tsx"],"names":[],"mappings":"AA2BA,UAAU,qBAAqB;IAC7B;;;OAGG;IACH,IAAI,CAAC,EAAE,aAAa,GAAG,cAAc,GAAG,YAAY,CAAC;IACrD;;;OAGG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACjC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,uBAA8C,qBAAqB,gCAiFnG,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { cx } from '@flipdish/ui-library/utilities/cx';
|
|
3
|
+
|
|
4
|
+
const styles = {
|
|
5
|
+
sm: {
|
|
6
|
+
root: 'gap-4',
|
|
7
|
+
label: 'text-sm font-medium',
|
|
8
|
+
spinner: 'size-8',
|
|
9
|
+
},
|
|
10
|
+
md: {
|
|
11
|
+
root: 'gap-4',
|
|
12
|
+
label: 'text-sm font-medium',
|
|
13
|
+
spinner: 'size-12',
|
|
14
|
+
},
|
|
15
|
+
lg: {
|
|
16
|
+
root: 'gap-4',
|
|
17
|
+
label: 'text-lg font-medium',
|
|
18
|
+
spinner: 'size-14',
|
|
19
|
+
},
|
|
20
|
+
xl: {
|
|
21
|
+
root: 'gap-5',
|
|
22
|
+
label: 'text-lg font-medium',
|
|
23
|
+
spinner: 'size-16',
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Animated spinner shown while content or an action is in progress, with an optional label.
|
|
28
|
+
*
|
|
29
|
+
* @summary in-progress loading spinner
|
|
30
|
+
*/
|
|
31
|
+
const LoadingIndicator = ({ type = 'line-simple', size = 'sm', label }) => {
|
|
32
|
+
const renderSpinner = () => {
|
|
33
|
+
if (type === 'line-spinner') {
|
|
34
|
+
return (
|
|
35
|
+
// biome-ignore lint/a11y/noSvgWithoutTitle: this is an icon
|
|
36
|
+
jsx("svg", { className: cx('animate-spin', styles[size].spinner), viewBox: "0 0 32 32", fill: "none", children: jsx("circle", { className: "stroke-fg-brand-primary", cx: "16", cy: "16", r: "14", fill: "none", strokeWidth: "4", strokeDashoffset: "40", strokeDasharray: "100", strokeLinecap: "round" }) }));
|
|
37
|
+
}
|
|
38
|
+
if (type === 'dot-circle') {
|
|
39
|
+
return (
|
|
40
|
+
// biome-ignore lint/a11y/noSvgWithoutTitle: this is an icon
|
|
41
|
+
jsxs("svg", { className: cx('animate-spin text-fg-brand-primary', styles[size].spinner), viewBox: "0 0 36 36", fill: "none", children: [jsx("path", { d: "M34 18C34 15.8989 33.5861 13.8183 32.7821 11.8771C31.978 9.93586 30.7994 8.17203 29.3137 6.68629C27.828 5.20055 26.0641 4.022 24.1229 3.21793C22.1817 2.41385 20.1011 2 18 2C15.8988 2 13.8183 2.41385 11.8771 3.21793C9.93585 4.022 8.17203 5.20055 6.68629 6.68629C5.20055 8.17203 4.022 9.93586 3.21793 11.8771C2.41385 13.8183 2 15.8989 2 18", stroke: "url(#paint0)", strokeWidth: "4", strokeLinecap: "round", strokeLinejoin: "round", strokeDasharray: "0.1 8" }), jsx("path", { d: "M3.21793 24.1229C4.022 26.0641 5.20055 27.828 6.68629 29.3137C8.17203 30.7994 9.93585 31.978 11.8771 32.7821C13.8183 33.5861 15.8988 34 18 34C20.1011 34 22.1817 33.5861 24.1229 32.7821C26.0641 31.978 27.828 30.7994 29.3137 29.3137C30.7994 27.828 31.978 26.0641 32.7821 24.1229", stroke: "url(#paint1)", strokeWidth: "4", strokeLinecap: "round", strokeLinejoin: "round", strokeDasharray: "0.1 8" }), jsxs("defs", { children: [jsxs("linearGradient", { id: "paint0", x1: "34", y1: "18", x2: "2", y2: "18", gradientUnits: "userSpaceOnUse", children: [jsx("stop", { stopColor: "currentColor" }), jsx("stop", { offset: "1", stopColor: "currentColor", stopOpacity: "0.5" })] }), jsxs("linearGradient", { id: "paint1", x1: "33", y1: "23.5", x2: "3", y2: "24", gradientUnits: "userSpaceOnUse", children: [jsx("stop", { stopOpacity: "0", stopColor: "currentColor" }), jsx("stop", { offset: "1", stopColor: "currentColor", stopOpacity: "0.48" })] })] })] }));
|
|
42
|
+
}
|
|
43
|
+
// Default case: type === "line-simple"
|
|
44
|
+
return (
|
|
45
|
+
// biome-ignore lint/a11y/noSvgWithoutTitle: this is an icon
|
|
46
|
+
jsxs("svg", { className: cx('animate-spin', styles[size].spinner), viewBox: "0 0 32 32", fill: "none", children: [jsx("circle", { className: "text-bg-tertiary", cx: "16", cy: "16", r: "14", stroke: "currentColor", strokeWidth: "4" }), jsx("circle", { className: "stroke-fg-brand-primary", cx: "16", cy: "16", r: "14", fill: "none", strokeWidth: "4", strokeDashoffset: "75", strokeDasharray: "100", strokeLinecap: "round" })] }));
|
|
47
|
+
};
|
|
48
|
+
return (jsxs("div", { className: cx('flex flex-col items-center justify-center', styles[size].root), children: [renderSpinner(), label && jsx("span", { className: cx('text-secondary', styles[size].label), children: label })] }));
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export { LoadingIndicator };
|
|
52
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/atoms/LoadingIndicator/index.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs"],"mappings":";;;AAIA,MAAM,MAAM,GAAG;AACb,IAAA,EAAE,EAAE;AACF,QAAA,IAAI,EAAE,OAAO;AACb,QAAA,KAAK,EAAE,qBAAqB;AAC5B,QAAA,OAAO,EAAE,QAAQ;AAClB,KAAA;AACD,IAAA,EAAE,EAAE;AACF,QAAA,IAAI,EAAE,OAAO;AACb,QAAA,KAAK,EAAE,qBAAqB;AAC5B,QAAA,OAAO,EAAE,SAAS;AACnB,KAAA;AACD,IAAA,EAAE,EAAE;AACF,QAAA,IAAI,EAAE,OAAO;AACb,QAAA,KAAK,EAAE,qBAAqB;AAC5B,QAAA,OAAO,EAAE,SAAS;AACnB,KAAA;AACD,IAAA,EAAE,EAAE;AACF,QAAA,IAAI,EAAE,OAAO;AACb,QAAA,KAAK,EAAE,qBAAqB;AAC5B,QAAA,OAAO,EAAE,SAAS;AACnB,KAAA;CACF;AAmBD;;;;AAIG;AACI,MAAM,gBAAgB,GAAG,CAAC,EAAE,IAAI,GAAG,aAAa,EAAE,IAAI,GAAG,IAAI,EAAE,KAAK,EAAyB,KAAI;IACtG,MAAM,aAAa,GAAG,MAAK;AACzB,QAAA,IAAI,IAAI,KAAK,cAAc,EAAE;YAC3B;;AAEE,YAAAA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,EAAE,CAAC,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,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E,CAAC,2CAA2C,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAA,QAAA,EAAA,CAC/E,aAAa,EAAE,EACf,KAAK,IAAID,GAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,EAAA,QAAA,EAAG,KAAK,EAAA,CAAQ,CAAA,EAAA,CAC/E;AAEV;;;;"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var cx = require('@flipdish/ui-library/utilities/cx');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var reactAriaComponents = require('react-aria-components');
|
|
7
|
+
|
|
8
|
+
const RadioGroupContext = React.createContext(null);
|
|
9
|
+
const RadioButtonBase = ({ className, isFocusVisible, isSelected, isDisabled, size = 'sm' }) => {
|
|
10
|
+
return (jsxRuntime.jsx("div", { className: cx.cx('flex size-4 shrink-0 cursor-pointer appearance-none items-center justify-center rounded-full bg-primary ring-1 ring-primary ring-inset', size === 'md' && 'size-5', isSelected && 'bg-brand-solid ring-brand-solid', isDisabled && 'cursor-not-allowed opacity-50', isDisabled && !isSelected && 'bg-tertiary', isFocusVisible && 'outline-2 outline-offset-2 outline-focus-ring', className), children: jsxRuntime.jsx("div", { className: cx.cx('size-1.5 rounded-full bg-fg-white opacity-0 transition-inherit-all', size === 'md' && 'size-2', isSelected && 'opacity-100') }) }));
|
|
11
|
+
};
|
|
12
|
+
RadioButtonBase.displayName = 'RadioButtonBase';
|
|
13
|
+
const RadioButton = ({ label, hint, className, size = 'sm', ...ariaRadioProps }) => {
|
|
14
|
+
const context = React.useContext(RadioGroupContext);
|
|
15
|
+
size = context?.size ?? size;
|
|
16
|
+
const sizes = {
|
|
17
|
+
sm: {
|
|
18
|
+
root: 'gap-2',
|
|
19
|
+
textWrapper: '',
|
|
20
|
+
label: 'text-sm font-medium',
|
|
21
|
+
hint: 'text-sm',
|
|
22
|
+
},
|
|
23
|
+
md: {
|
|
24
|
+
root: 'gap-3',
|
|
25
|
+
textWrapper: 'gap-0.5',
|
|
26
|
+
label: 'text-md font-medium',
|
|
27
|
+
hint: 'text-md',
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
return (jsxRuntime.jsx(reactAriaComponents.Radio, { ...ariaRadioProps, className: (state) => cx.cx('relative flex items-start', state.isDisabled && 'cursor-not-allowed', sizes[size].root, typeof className === 'function' ? className(state) : className), children: ({ isSelected, isDisabled, isFocusVisible }) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(RadioButtonBase, { size: size, isSelected: isSelected, isDisabled: isDisabled, isFocusVisible: isFocusVisible, className: label || hint ? 'mt-0.5' : '' }), (label || hint) && (jsxRuntime.jsxs("div", { className: cx.cx('inline-flex flex-col', sizes[size].textWrapper), children: [label && jsxRuntime.jsx("p", { className: cx.cx('text-secondary select-none', sizes[size].label), children: label }), hint && (
|
|
31
|
+
// biome-ignore lint/a11y/noStaticElementInteractions: This is a hint that is not interactive
|
|
32
|
+
// biome-ignore lint/a11y/useKeyWithClickEvents: This is a hint that is not interactive
|
|
33
|
+
jsxRuntime.jsx("span", { className: cx.cx('text-tertiary', sizes[size].hint), onClick: (event) => event.stopPropagation(), children: hint }))] }))] })) }));
|
|
34
|
+
};
|
|
35
|
+
RadioButton.displayName = 'RadioButton';
|
|
36
|
+
const RadioGroup = ({ children, className, size = 'sm', ...props }) => {
|
|
37
|
+
return (jsxRuntime.jsx(RadioGroupContext.Provider, { value: { size }, children: jsxRuntime.jsx(reactAriaComponents.RadioGroup, { ...props, className: cx.cx('flex flex-col gap-4', className), children: children }) }));
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
exports.RadioButton = RadioButton;
|
|
41
|
+
exports.RadioButtonBase = RadioButtonBase;
|
|
42
|
+
exports.RadioGroup = RadioGroup;
|
|
43
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/components/atoms/RadioButton/index.tsx"],"sourcesContent":[null],"names":["createContext","_jsx","cx","useContext","AriaRadio","_jsxs","_Fragment","AriaRadioGroup"],"mappings":";;;;;;;AAeA,MAAM,iBAAiB,GAAGA,mBAAa,CAA+B,IAAI,CAAC;AAUpE,MAAM,eAAe,GAAG,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,GAAG,IAAI,EAAwB,KAAI;IAC1H,QACEC,cAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAEC,KAAE,CACX,wIAAwI,EACxI,IAAI,KAAK,IAAI,IAAI,QAAQ,EACzB,UAAU,IAAI,iCAAiC,EAC/C,UAAU,IAAI,+BAA+B,EAC7C,UAAU,IAAI,CAAC,UAAU,IAAI,aAAa,EAC1C,cAAc,IAAI,+CAA+C,EACjE,SAAS,CACV,EAAA,QAAA,EAEDD,cAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAEC,KAAE,CAAC,oEAAoE,EAAE,IAAI,KAAK,IAAI,IAAI,QAAQ,EAAE,UAAU,IAAI,aAAa,CAAC,EAAA,CAC3I,EAAA,CACE;AAEV;AACA,eAAe,CAAC,WAAW,GAAG,iBAAiB;MASlC,WAAW,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,cAAc,EAAoB,KAAI;AAC1G,IAAA,MAAM,OAAO,GAAGC,gBAAU,CAAC,iBAAiB,CAAC;AAE7C,IAAA,IAAI,GAAG,OAAO,EAAE,IAAI,IAAI,IAAI;AAE5B,IAAA,MAAM,KAAK,GAAG;AACZ,QAAA,EAAE,EAAE;AACF,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,WAAW,EAAE,EAAE;AACf,YAAA,KAAK,EAAE,qBAAqB;AAC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AI,CAAC,EAAE,OAAO,EAAE,CAAC,KAAK,KAAK,KAAK,CAAC,eAAe,EAAE,EAAA,QAAA,EAChG,IAAI,EAAA,CACA,CACR,IACG,CACP,CAAA,EAAA,CACA,CACJ,EAAA,CACS;AAEhB;AACA,WAAW,CAAC,WAAW,GAAG,aAAa;AAOhC,MAAM,UAAU,GAAG,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,KAAK,EAAmB,KAAI;AAC5F,IAAA,QACED,cAAA,CAAC,iBAAiB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,EAAE,IAAI,EAAE,EAAA,QAAA,EACzCA,eAACM,8BAAc,EAAA,EAAA,GAAK,KAAK,EAAE,SAAS,EAAEL,KAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,EAAA,QAAA,EACvE,QAAQ,EAAA,CACM,EAAA,CACU;AAEjC;;;;;;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ReactNode, type Ref } from 'react';
|
|
2
|
+
import { type RadioGroupProps as AriaRadioGroupProps, type RadioProps as AriaRadioProps } from 'react-aria-components';
|
|
3
|
+
export interface RadioGroupContextType {
|
|
4
|
+
size?: 'sm' | 'md';
|
|
5
|
+
}
|
|
6
|
+
export interface RadioButtonBaseProps {
|
|
7
|
+
size?: 'sm' | 'md';
|
|
8
|
+
className?: string;
|
|
9
|
+
isFocusVisible?: boolean;
|
|
10
|
+
isSelected?: boolean;
|
|
11
|
+
isDisabled?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const RadioButtonBase: {
|
|
14
|
+
({ className, isFocusVisible, isSelected, isDisabled, size }: RadioButtonBaseProps): import("react").JSX.Element;
|
|
15
|
+
displayName: string;
|
|
16
|
+
};
|
|
17
|
+
interface RadioButtonProps extends AriaRadioProps {
|
|
18
|
+
size?: 'sm' | 'md';
|
|
19
|
+
label?: ReactNode;
|
|
20
|
+
hint?: ReactNode;
|
|
21
|
+
ref?: Ref<HTMLLabelElement>;
|
|
22
|
+
}
|
|
23
|
+
export declare const RadioButton: {
|
|
24
|
+
({ label, hint, className, size, ...ariaRadioProps }: RadioButtonProps): import("react").JSX.Element;
|
|
25
|
+
displayName: string;
|
|
26
|
+
};
|
|
27
|
+
interface RadioGroupProps extends RadioGroupContextType, AriaRadioGroupProps {
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
className?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare const RadioGroup: ({ children, className, size, ...props }: RadioGroupProps) => import("react").JSX.Element;
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/RadioButton/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAiB,KAAK,SAAS,EAAE,KAAK,GAAG,EAAc,MAAM,OAAO,CAAC;AAC5E,OAAO,EAGL,KAAK,eAAe,IAAI,mBAAmB,EAC3C,KAAK,UAAU,IAAI,cAAc,EAClC,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACpB;AAID,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,eAAe;kEAAwE,oBAAoB;;CAkBvH,CAAC;AAGF,UAAU,gBAAiB,SAAQ,cAAc;IAC/C,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;CAC7B;AAED,eAAO,MAAM,WAAW;0DAAgE,gBAAgB;;CAyDvG,CAAC;AAGF,UAAU,eAAgB,SAAQ,qBAAqB,EAAE,mBAAmB;IAC1E,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,UAAU,GAAI,yCAAgD,eAAe,gCAQzF,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { cx } from '@flipdish/ui-library/utilities/cx';
|
|
3
|
+
import { createContext, useContext } from 'react';
|
|
4
|
+
import { Radio, RadioGroup as RadioGroup$1 } from 'react-aria-components';
|
|
5
|
+
|
|
6
|
+
const RadioGroupContext = createContext(null);
|
|
7
|
+
const RadioButtonBase = ({ className, isFocusVisible, isSelected, isDisabled, size = 'sm' }) => {
|
|
8
|
+
return (jsx("div", { className: cx('flex size-4 shrink-0 cursor-pointer appearance-none items-center justify-center rounded-full bg-primary ring-1 ring-primary ring-inset', size === 'md' && 'size-5', isSelected && 'bg-brand-solid ring-brand-solid', isDisabled && 'cursor-not-allowed opacity-50', isDisabled && !isSelected && 'bg-tertiary', isFocusVisible && 'outline-2 outline-offset-2 outline-focus-ring', className), children: jsx("div", { className: cx('size-1.5 rounded-full bg-fg-white opacity-0 transition-inherit-all', size === 'md' && 'size-2', isSelected && 'opacity-100') }) }));
|
|
9
|
+
};
|
|
10
|
+
RadioButtonBase.displayName = 'RadioButtonBase';
|
|
11
|
+
const RadioButton = ({ label, hint, className, size = 'sm', ...ariaRadioProps }) => {
|
|
12
|
+
const context = useContext(RadioGroupContext);
|
|
13
|
+
size = context?.size ?? size;
|
|
14
|
+
const sizes = {
|
|
15
|
+
sm: {
|
|
16
|
+
root: 'gap-2',
|
|
17
|
+
textWrapper: '',
|
|
18
|
+
label: 'text-sm font-medium',
|
|
19
|
+
hint: 'text-sm',
|
|
20
|
+
},
|
|
21
|
+
md: {
|
|
22
|
+
root: 'gap-3',
|
|
23
|
+
textWrapper: 'gap-0.5',
|
|
24
|
+
label: 'text-md font-medium',
|
|
25
|
+
hint: 'text-md',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
return (jsx(Radio, { ...ariaRadioProps, className: (state) => cx('relative flex items-start', state.isDisabled && 'cursor-not-allowed', sizes[size].root, typeof className === 'function' ? className(state) : className), children: ({ isSelected, isDisabled, isFocusVisible }) => (jsxs(Fragment, { children: [jsx(RadioButtonBase, { size: size, isSelected: isSelected, isDisabled: isDisabled, isFocusVisible: isFocusVisible, className: label || hint ? 'mt-0.5' : '' }), (label || hint) && (jsxs("div", { className: cx('inline-flex flex-col', sizes[size].textWrapper), children: [label && jsx("p", { className: cx('text-secondary select-none', sizes[size].label), children: label }), hint && (
|
|
29
|
+
// biome-ignore lint/a11y/noStaticElementInteractions: This is a hint that is not interactive
|
|
30
|
+
// biome-ignore lint/a11y/useKeyWithClickEvents: This is a hint that is not interactive
|
|
31
|
+
jsx("span", { className: cx('text-tertiary', sizes[size].hint), onClick: (event) => event.stopPropagation(), children: hint }))] }))] })) }));
|
|
32
|
+
};
|
|
33
|
+
RadioButton.displayName = 'RadioButton';
|
|
34
|
+
const RadioGroup = ({ children, className, size = 'sm', ...props }) => {
|
|
35
|
+
return (jsx(RadioGroupContext.Provider, { value: { size }, children: jsx(RadioGroup$1, { ...props, className: cx('flex flex-col gap-4', className), children: children }) }));
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export { RadioButton, RadioButtonBase, RadioGroup };
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/atoms/RadioButton/index.tsx"],"sourcesContent":[null],"names":["_jsx","AriaRadio","_jsxs","_Fragment","AriaRadioGroup"],"mappings":";;;;;AAeA,MAAM,iBAAiB,GAAG,aAAa,CAA+B,IAAI,C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I,EAAE,GAAG,KAAK,EAAmB,KAAI;AAC5F,IAAA,QACEA,GAAA,CAAC,iBAAiB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,EAAE,IAAI,EAAE,EAAA,QAAA,EACzCA,IAACI,YAAc,EAAA,EAAA,GAAK,KAAK,EAAE,SAAS,EAAE,EAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,EAAA,QAAA,EACvE,QAAQ,EAAA,CACM,EAAA,CACU;AAEjC;;;;"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var cx = require('@flipdish/ui-library/utilities/cx');
|
|
5
|
+
var reactAriaComponents = require('react-aria-components');
|
|
6
|
+
|
|
7
|
+
const ToggleBase = ({ className, isHovered, isDisabled, isFocusVisible, isSelected, slim, size = 'sm' }) => {
|
|
8
|
+
const styles = {
|
|
9
|
+
default: {
|
|
10
|
+
sm: {
|
|
11
|
+
root: 'h-5 w-9 p-0.5',
|
|
12
|
+
switch: cx.cx('size-4', isSelected && 'translate-x-4'),
|
|
13
|
+
},
|
|
14
|
+
md: {
|
|
15
|
+
root: 'h-6 w-11 p-0.5',
|
|
16
|
+
switch: cx.cx('size-5', isSelected && 'translate-x-5'),
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
slim: {
|
|
20
|
+
sm: {
|
|
21
|
+
root: 'h-4 w-8',
|
|
22
|
+
switch: cx.cx('size-4', isSelected && 'translate-x-4'),
|
|
23
|
+
},
|
|
24
|
+
md: {
|
|
25
|
+
root: 'h-5 w-10',
|
|
26
|
+
switch: cx.cx('size-5', isSelected && 'translate-x-5'),
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
const classes = slim ? styles.slim[size] : styles.default[size];
|
|
31
|
+
return (jsxRuntime.jsx("div", { className: cx.cx('cursor-pointer rounded-full bg-tertiary ring-[0.5px] ring-secondary outline-focus-ring transition duration-150 ease-linear ring-inset', isSelected && 'bg-brand-solid', isSelected && isHovered && 'bg-brand-solid_hover', isDisabled && 'cursor-not-allowed opacity-50', isFocusVisible && 'outline-2 outline-offset-2', slim && 'ring-1', slim && isSelected && 'ring-transparent', classes.root, className), children: jsxRuntime.jsx("div", { style: {
|
|
32
|
+
transition: 'transform 0.15s ease-in-out, translate 0.15s ease-in-out, border-color 0.1s linear, background-color 0.1s linear',
|
|
33
|
+
}, className: cx.cx('rounded-full bg-fg-white shadow-sm', slim && 'shadow-xs', slim && 'border border-toggle-border', slim && isSelected && 'border-toggle-slim-border_pressed', slim && isSelected && isHovered && 'border-toggle-slim-border_pressed-hover', classes.switch) }) }));
|
|
34
|
+
};
|
|
35
|
+
const styles = {
|
|
36
|
+
sm: {
|
|
37
|
+
root: 'gap-2',
|
|
38
|
+
textWrapper: '',
|
|
39
|
+
label: 'text-sm font-medium',
|
|
40
|
+
hint: 'text-sm',
|
|
41
|
+
},
|
|
42
|
+
md: {
|
|
43
|
+
root: 'gap-3',
|
|
44
|
+
textWrapper: 'gap-0.5',
|
|
45
|
+
label: 'text-md font-medium',
|
|
46
|
+
hint: 'text-md',
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Switch control for toggling a single setting on or off, with optional label and hint.
|
|
51
|
+
*
|
|
52
|
+
* @summary on/off switch for a single setting
|
|
53
|
+
*/
|
|
54
|
+
const Toggle = ({ label, hint, className, size = 'sm', slim, ...ariaSwitchProps }) => {
|
|
55
|
+
return (jsxRuntime.jsx(reactAriaComponents.Switch, { ...ariaSwitchProps, className: (state) => cx.cx('relative flex w-max items-start', state.isDisabled && 'cursor-not-allowed', styles[size].root, typeof className === 'function' ? className(state) : className), children: ({ isSelected, isDisabled, isFocusVisible, isHovered }) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ToggleBase, { slim: slim, size: size, isHovered: isHovered, isDisabled: isDisabled, isFocusVisible: isFocusVisible, isSelected: isSelected, className: slim ? 'mt-0.5' : '' }), (label || hint) && (jsxRuntime.jsxs("div", { className: cx.cx('flex flex-col', styles[size].textWrapper), children: [label && jsxRuntime.jsx("p", { className: cx.cx('text-secondary select-none', styles[size].label), children: label }), hint && (
|
|
56
|
+
// biome-ignore lint/a11y/noStaticElementInteractions: This is a hint that is not interactive
|
|
57
|
+
// biome-ignore lint/a11y/useKeyWithClickEvents: This is a hint that is not interactive
|
|
58
|
+
jsxRuntime.jsx("span", { className: cx.cx('text-tertiary', styles[size].hint), onClick: (event) => event.stopPropagation(), children: hint }))] }))] })) }));
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
exports.Toggle = Toggle;
|
|
62
|
+
exports.ToggleBase = ToggleBase;
|
|
63
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/components/atoms/Toggle/index.tsx"],"sourcesContent":[null],"names":["cx","_jsx","AriaSwitch","_jsxs","_Fragment"],"mappings":";;;;;;MAiBa,UAAU,GAAG,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,EAAmB,KAAI;AACjI,IAAA,MAAM,MAAM,GAAG;AACb,QAAA,OAAO,EAAE;AACP,YAAA,EAAE,EAAE;AACF,gBAAA,IAAI,EAAE,eAAe;gBACrB,MAAM,EAAEA,KAAE,CAAC,QAAQ,EAAE,UAAU,IAAI,eAAe,CAAC;AACpD,aAAA;AACD,YAAA,EAAE,EAAE;AACF,gBAAA,IAAI,EAAE,gBAAgB;gBACtB,MAAM,EAAEA,KAAE,CAAC,QAAQ,EAAE,UAAU,IAAI,eAAe,CAAC;AACpD,aAAA;AACF,SAAA;AACD,QAAA,IAAI,EAAE;AACJ,YAAA,EAAE,EAAE;AACF,gBAAA,IAAI,EAAE,SAAS;gBACf,MAAM,EAAEA,KAAE,CAA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,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC,KAAK,KAAK,KAAK,CAAC,eAAe,EAAE,EAAA,QAAA,EACjG,IAAI,EAAA,CACA,CACR,IACG,CACP,CAAA,EAAA,CACA,CACJ,EAAA,CACU;AAEjB;;;;;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { SwitchProps as AriaSwitchProps } from 'react-aria-components';
|
|
3
|
+
interface ToggleBaseProps {
|
|
4
|
+
size?: 'sm' | 'md';
|
|
5
|
+
slim?: boolean;
|
|
6
|
+
className?: string;
|
|
7
|
+
isHovered?: boolean;
|
|
8
|
+
isFocusVisible?: boolean;
|
|
9
|
+
isSelected?: boolean;
|
|
10
|
+
isDisabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const ToggleBase: ({ className, isHovered, isDisabled, isFocusVisible, isSelected, slim, size }: ToggleBaseProps) => import("react").JSX.Element;
|
|
13
|
+
interface ToggleProps extends AriaSwitchProps {
|
|
14
|
+
size?: 'sm' | 'md';
|
|
15
|
+
label?: string;
|
|
16
|
+
hint?: ReactNode;
|
|
17
|
+
slim?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Switch control for toggling a single setting on or off, with optional label and hint.
|
|
21
|
+
*
|
|
22
|
+
* @summary on/off switch for a single setting
|
|
23
|
+
*/
|
|
24
|
+
export declare const Toggle: ({ label, hint, className, size, slim, ...ariaSwitchProps }: ToggleProps) => import("react").JSX.Element;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/Toggle/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG5E,UAAU,eAAe;IACvB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,UAAU,GAAI,8EAAqF,eAAe,gCA0D9H,CAAC;AAiBF,UAAU,WAAY,SAAQ,eAAe;IAC3C,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;;;GAIG;AACH,eAAO,MAAM,MAAM,GAAI,4DAAmE,WAAW,gCAyCpG,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { cx } from '@flipdish/ui-library/utilities/cx';
|
|
3
|
+
import { Switch } from 'react-aria-components';
|
|
4
|
+
|
|
5
|
+
const ToggleBase = ({ className, isHovered, isDisabled, isFocusVisible, isSelected, slim, size = 'sm' }) => {
|
|
6
|
+
const styles = {
|
|
7
|
+
default: {
|
|
8
|
+
sm: {
|
|
9
|
+
root: 'h-5 w-9 p-0.5',
|
|
10
|
+
switch: cx('size-4', isSelected && 'translate-x-4'),
|
|
11
|
+
},
|
|
12
|
+
md: {
|
|
13
|
+
root: 'h-6 w-11 p-0.5',
|
|
14
|
+
switch: cx('size-5', isSelected && 'translate-x-5'),
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
slim: {
|
|
18
|
+
sm: {
|
|
19
|
+
root: 'h-4 w-8',
|
|
20
|
+
switch: cx('size-4', isSelected && 'translate-x-4'),
|
|
21
|
+
},
|
|
22
|
+
md: {
|
|
23
|
+
root: 'h-5 w-10',
|
|
24
|
+
switch: cx('size-5', isSelected && 'translate-x-5'),
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
const classes = slim ? styles.slim[size] : styles.default[size];
|
|
29
|
+
return (jsx("div", { className: cx('cursor-pointer rounded-full bg-tertiary ring-[0.5px] ring-secondary outline-focus-ring transition duration-150 ease-linear ring-inset', isSelected && 'bg-brand-solid', isSelected && isHovered && 'bg-brand-solid_hover', isDisabled && 'cursor-not-allowed opacity-50', isFocusVisible && 'outline-2 outline-offset-2', slim && 'ring-1', slim && isSelected && 'ring-transparent', classes.root, className), children: jsx("div", { style: {
|
|
30
|
+
transition: 'transform 0.15s ease-in-out, translate 0.15s ease-in-out, border-color 0.1s linear, background-color 0.1s linear',
|
|
31
|
+
}, className: cx('rounded-full bg-fg-white shadow-sm', slim && 'shadow-xs', slim && 'border border-toggle-border', slim && isSelected && 'border-toggle-slim-border_pressed', slim && isSelected && isHovered && 'border-toggle-slim-border_pressed-hover', classes.switch) }) }));
|
|
32
|
+
};
|
|
33
|
+
const styles = {
|
|
34
|
+
sm: {
|
|
35
|
+
root: 'gap-2',
|
|
36
|
+
textWrapper: '',
|
|
37
|
+
label: 'text-sm font-medium',
|
|
38
|
+
hint: 'text-sm',
|
|
39
|
+
},
|
|
40
|
+
md: {
|
|
41
|
+
root: 'gap-3',
|
|
42
|
+
textWrapper: 'gap-0.5',
|
|
43
|
+
label: 'text-md font-medium',
|
|
44
|
+
hint: 'text-md',
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Switch control for toggling a single setting on or off, with optional label and hint.
|
|
49
|
+
*
|
|
50
|
+
* @summary on/off switch for a single setting
|
|
51
|
+
*/
|
|
52
|
+
const Toggle = ({ label, hint, className, size = 'sm', slim, ...ariaSwitchProps }) => {
|
|
53
|
+
return (jsx(Switch, { ...ariaSwitchProps, className: (state) => cx('relative flex w-max items-start', state.isDisabled && 'cursor-not-allowed', styles[size].root, typeof className === 'function' ? className(state) : className), children: ({ isSelected, isDisabled, isFocusVisible, isHovered }) => (jsxs(Fragment, { children: [jsx(ToggleBase, { slim: slim, size: size, isHovered: isHovered, isDisabled: isDisabled, isFocusVisible: isFocusVisible, isSelected: isSelected, className: slim ? 'mt-0.5' : '' }), (label || hint) && (jsxs("div", { className: cx('flex flex-col', styles[size].textWrapper), children: [label && jsx("p", { className: cx('text-secondary select-none', styles[size].label), children: label }), hint && (
|
|
54
|
+
// biome-ignore lint/a11y/noStaticElementInteractions: This is a hint that is not interactive
|
|
55
|
+
// biome-ignore lint/a11y/useKeyWithClickEvents: This is a hint that is not interactive
|
|
56
|
+
jsx("span", { className: cx('text-tertiary', styles[size].hint), onClick: (event) => event.stopPropagation(), children: hint }))] }))] })) }));
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export { Toggle, ToggleBase };
|
|
60
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/atoms/Toggle/index.tsx"],"sourcesContent":[null],"names":["_jsx","AriaSwitch","_jsxs","_Fragment"],"mappings":";;;;MAiBa,UAAU,GAAG,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,EAAmB,KAAI;AACjI,IAAA,MAAM,MAAM,GAAG;AACb,QAAA,OAAO,EAAE;AACP,YAAA,EAAE,EAAE;AACF,gBAAA,IAAI,EAAE,eAAe;gBACrB,MAAM,EAAE,EAAE,CAAC,QAAQ,EAAE,UAAU,IAAI,eAAe,CAAC;AACpD,aAAA;AACD,YAAA,EAAE,EAAE;AACF,gBAAA,IAAI,EAAE,gBAAgB;gBACtB,MAAM,EAAE,EAAE,CAAC,QAAQ,EAAE,UAAU,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C,KAAK,CAAC,EAAA,QAAA,EAAG,KAAK,EAAA,CAAK,EACxF,IAAI;;;AAGH,wBAAAA,GAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAE,EAAE,CAAC,eAAe,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC,KAAK,KAAK,KAAK,CAAC,eAAe,EAAE,EAAA,QAAA,EACjG,IAAI,EAAA,CACA,CACR,IACG,CACP,CAAA,EAAA,CACA,CACJ,EAAA,CACU;AAEjB;;;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var cx = require('@flipdish/ui-library/utilities/cx');
|
|
5
|
+
var reactAriaComponents = require('react-aria-components');
|
|
6
|
+
|
|
7
|
+
const Tooltip = ({ title, description, children, arrow = false, delay = 300, closeDelay = 0, trigger, isDisabled, isOpen, defaultOpen, offset = 6, crossOffset, placement = 'top', onOpenChange, ...tooltipProps }) => {
|
|
8
|
+
const isTopOrBottomLeft = ['top left', 'top end', 'bottom left', 'bottom end'].includes(placement);
|
|
9
|
+
const isTopOrBottomRight = ['top right', 'top start', 'bottom right', 'bottom start'].includes(placement);
|
|
10
|
+
// Set negative cross offset for left and right placement to visually balance the tooltip.
|
|
11
|
+
const calculatedCrossOffset = isTopOrBottomLeft ? -12 : isTopOrBottomRight ? 12 : 0;
|
|
12
|
+
return (jsxRuntime.jsxs(reactAriaComponents.TooltipTrigger, { trigger, delay, closeDelay, isDisabled, isOpen, defaultOpen, onOpenChange, children: [children, jsxRuntime.jsx(reactAriaComponents.Tooltip, { ...tooltipProps, offset: offset, placement: placement, crossOffset: crossOffset ?? calculatedCrossOffset, className: ({ isEntering, isExiting }) => cx.cx(isEntering && 'ease-out animate-in', isExiting && 'ease-in animate-out'), children: ({ isEntering, isExiting }) => (jsxRuntime.jsxs("div", { className: cx.cx('z-50 flex max-w-xs origin-(--trigger-anchor-point) flex-col items-start gap-1 rounded-lg bg-primary-solid px-3 shadow-lg will-change-transform', description ? 'py-3' : 'py-2', isEntering &&
|
|
13
|
+
'ease-out animate-in fade-in zoom-in-95 in-placement-left:slide-in-from-right-0.5 in-placement-right:slide-in-from-left-0.5 in-placement-top:slide-in-from-bottom-0.5 in-placement-bottom:slide-in-from-top-0.5', isExiting &&
|
|
14
|
+
'ease-in animate-out fade-out zoom-out-95 in-placement-left:slide-out-to-right-0.5 in-placement-right:slide-out-to-left-0.5 in-placement-top:slide-out-to-bottom-0.5 in-placement-bottom:slide-out-to-top-0.5'), children: [jsxRuntime.jsx("span", { className: "text-xs font-semibold text-white", children: title }), description && jsxRuntime.jsx("span", { className: "text-xs font-medium text-tooltip-supporting-text", children: description }), arrow && (jsxRuntime.jsx(reactAriaComponents.OverlayArrow, { children: jsxRuntime.jsx("svg", { viewBox: "0 0 100 100", className: "size-2.5 fill-bg-primary-solid in-placement-left:-rotate-90 in-placement-right:rotate-90 in-placement-top:rotate-0 in-placement-bottom:rotate-180", children: jsxRuntime.jsx("path", { d: "M0,0 L35.858,35.858 Q50,50 64.142,35.858 L100,0 Z" }) }) }))] })) })] }));
|
|
15
|
+
};
|
|
16
|
+
const TooltipTrigger = ({ children, className, ...buttonProps }) => {
|
|
17
|
+
return (jsxRuntime.jsx(reactAriaComponents.Button, { ...buttonProps, className: (values) => cx.cx('h-max w-max outline-hidden', typeof className === 'function' ? className(values) : className), children: children }));
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
exports.Tooltip = Tooltip;
|
|
21
|
+
exports.TooltipTrigger = TooltipTrigger;
|
|
22
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/components/atoms/Tooltip/index.tsx"],"sourcesContent":[null],"names":["_jsxs","AriaTooltipTrigger","_jsx","AriaTooltip","cx","AriaOverlayArrow","AriaButton"],"mappings":";;;;;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