@flipdish/ui-library 0.62.0 → 0.64.0
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 +22 -21
- package/dist/components/__internal__/listOption/listOption.styles.cjs +20 -0
- package/dist/components/__internal__/listOption/listOption.styles.cjs.map +1 -0
- package/dist/components/__internal__/listOption/listOption.styles.d.ts +16 -0
- package/dist/components/__internal__/listOption/listOption.styles.d.ts.map +1 -0
- package/dist/components/__internal__/listOption/listOption.styles.js +18 -0
- package/dist/components/__internal__/listOption/listOption.styles.js.map +1 -0
- package/dist/components/atoms/BackgroundPattern/components/Circle.cjs +17 -12
- package/dist/components/atoms/BackgroundPattern/components/Circle.cjs.map +1 -1
- package/dist/components/atoms/BackgroundPattern/components/Circle.d.ts +3 -3
- package/dist/components/atoms/BackgroundPattern/components/Circle.d.ts.map +1 -1
- package/dist/components/atoms/BackgroundPattern/components/Circle.js +17 -12
- package/dist/components/atoms/BackgroundPattern/components/Circle.js.map +1 -1
- package/dist/components/atoms/BackgroundPattern/components/Grid.cjs +17 -12
- package/dist/components/atoms/BackgroundPattern/components/Grid.cjs.map +1 -1
- package/dist/components/atoms/BackgroundPattern/components/Grid.d.ts +3 -3
- package/dist/components/atoms/BackgroundPattern/components/Grid.d.ts.map +1 -1
- package/dist/components/atoms/BackgroundPattern/components/Grid.js +17 -12
- package/dist/components/atoms/BackgroundPattern/components/Grid.js.map +1 -1
- package/dist/components/atoms/BackgroundPattern/components/GridCheck.cjs +13 -8
- package/dist/components/atoms/BackgroundPattern/components/GridCheck.cjs.map +1 -1
- package/dist/components/atoms/BackgroundPattern/components/GridCheck.d.ts +3 -3
- package/dist/components/atoms/BackgroundPattern/components/GridCheck.d.ts.map +1 -1
- package/dist/components/atoms/BackgroundPattern/components/GridCheck.js +13 -8
- package/dist/components/atoms/BackgroundPattern/components/GridCheck.js.map +1 -1
- package/dist/components/atoms/BackgroundPattern/components/Square.cjs +17 -12
- package/dist/components/atoms/BackgroundPattern/components/Square.cjs.map +1 -1
- package/dist/components/atoms/BackgroundPattern/components/Square.d.ts +3 -3
- package/dist/components/atoms/BackgroundPattern/components/Square.d.ts.map +1 -1
- package/dist/components/atoms/BackgroundPattern/components/Square.js +17 -12
- package/dist/components/atoms/BackgroundPattern/components/Square.js.map +1 -1
- package/dist/components/atoms/BackgroundPattern/index.cjs +5 -3
- package/dist/components/atoms/BackgroundPattern/index.cjs.map +1 -1
- package/dist/components/atoms/BackgroundPattern/index.d.ts +11 -11
- package/dist/components/atoms/BackgroundPattern/index.d.ts.map +1 -1
- package/dist/components/atoms/BackgroundPattern/index.js +5 -3
- package/dist/components/atoms/BackgroundPattern/index.js.map +1 -1
- package/dist/components/atoms/BrandButtons/SocialButton/SocialButton.cjs +7 -3
- package/dist/components/atoms/BrandButtons/SocialButton/SocialButton.cjs.map +1 -1
- package/dist/components/atoms/BrandButtons/SocialButton/SocialButton.d.ts +4 -4
- package/dist/components/atoms/BrandButtons/SocialButton/SocialButton.d.ts.map +1 -1
- package/dist/components/atoms/BrandButtons/SocialButton/SocialButton.js +7 -3
- package/dist/components/atoms/BrandButtons/SocialButton/SocialButton.js.map +1 -1
- package/dist/components/atoms/Buttons/IconButton/IconButton.cjs +6 -3
- package/dist/components/atoms/Buttons/IconButton/IconButton.cjs.map +1 -1
- package/dist/components/atoms/Buttons/IconButton/IconButton.d.ts +4 -4
- package/dist/components/atoms/Buttons/IconButton/IconButton.d.ts.map +1 -1
- package/dist/components/atoms/Buttons/IconButton/IconButton.js +7 -4
- package/dist/components/atoms/Buttons/IconButton/IconButton.js.map +1 -1
- package/dist/components/atoms/Card/index.cjs +5 -3
- package/dist/components/atoms/Card/index.cjs.map +1 -1
- package/dist/components/atoms/Card/index.d.ts +3 -3
- package/dist/components/atoms/Card/index.d.ts.map +1 -1
- package/dist/components/atoms/Card/index.js +5 -3
- package/dist/components/atoms/Card/index.js.map +1 -1
- package/dist/components/atoms/Checkbox/index.d.ts +1 -4
- package/dist/components/atoms/Checkbox/index.d.ts.map +1 -1
- package/dist/components/atoms/Checkboxes/Checkbox/Checkbox.cjs +3 -3
- package/dist/components/atoms/Checkboxes/Checkbox/Checkbox.cjs.map +1 -1
- package/dist/components/atoms/Checkboxes/Checkbox/Checkbox.d.ts +2 -7
- package/dist/components/atoms/Checkboxes/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/atoms/Checkboxes/Checkbox/Checkbox.js +4 -4
- package/dist/components/atoms/Checkboxes/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/atoms/Dot/index.cjs +5 -3
- package/dist/components/atoms/Dot/index.cjs.map +1 -1
- package/dist/components/atoms/Dot/index.d.ts +3 -3
- package/dist/components/atoms/Dot/index.d.ts.map +1 -1
- package/dist/components/atoms/Dot/index.js +5 -3
- package/dist/components/atoms/Dot/index.js.map +1 -1
- package/dist/components/atoms/FeaturedIcon/index.cjs +4 -3
- package/dist/components/atoms/FeaturedIcon/index.cjs.map +1 -1
- package/dist/components/atoms/FeaturedIcon/index.d.ts +2 -4
- package/dist/components/atoms/FeaturedIcon/index.d.ts.map +1 -1
- package/dist/components/atoms/FeaturedIcon/index.js +5 -4
- package/dist/components/atoms/FeaturedIcon/index.js.map +1 -1
- package/dist/components/atoms/Flag/index.cjs +10 -6
- package/dist/components/atoms/Flag/index.cjs.map +1 -1
- package/dist/components/atoms/Flag/index.d.ts +3 -3
- package/dist/components/atoms/Flag/index.d.ts.map +1 -1
- package/dist/components/atoms/Flag/index.js +12 -8
- package/dist/components/atoms/Flag/index.js.map +1 -1
- package/dist/components/atoms/FlipdishLogo/index.cjs +5 -3
- package/dist/components/atoms/FlipdishLogo/index.cjs.map +1 -1
- package/dist/components/atoms/FlipdishLogo/index.d.ts +3 -3
- package/dist/components/atoms/FlipdishLogo/index.d.ts.map +1 -1
- package/dist/components/atoms/FlipdishLogo/index.js +5 -3
- package/dist/components/atoms/FlipdishLogo/index.js.map +1 -1
- package/dist/components/atoms/Illustration/components/TextIllustration.cjs +7 -4
- package/dist/components/atoms/Illustration/components/TextIllustration.cjs.map +1 -1
- package/dist/components/atoms/Illustration/components/TextIllustration.d.ts +2 -3
- package/dist/components/atoms/Illustration/components/TextIllustration.d.ts.map +1 -1
- package/dist/components/atoms/Illustration/components/TextIllustration.js +7 -4
- package/dist/components/atoms/Illustration/components/TextIllustration.js.map +1 -1
- package/dist/components/atoms/Input/index.d.ts +2 -8
- package/dist/components/atoms/Input/index.d.ts.map +1 -1
- package/dist/components/atoms/Inputs/Input/Input.cjs +4 -4
- package/dist/components/atoms/Inputs/Input/Input.cjs.map +1 -1
- package/dist/components/atoms/Inputs/Input/Input.d.ts +3 -11
- package/dist/components/atoms/Inputs/Input/Input.d.ts.map +1 -1
- package/dist/components/atoms/Inputs/Input/Input.js +6 -6
- package/dist/components/atoms/Inputs/Input/Input.js.map +1 -1
- package/dist/components/atoms/Inputs/SearchInput/SearchInput.cjs +3 -2
- package/dist/components/atoms/Inputs/SearchInput/SearchInput.cjs.map +1 -1
- package/dist/components/atoms/Inputs/SearchInput/SearchInput.d.ts +2 -7
- package/dist/components/atoms/Inputs/SearchInput/SearchInput.d.ts.map +1 -1
- package/dist/components/atoms/Inputs/SearchInput/SearchInput.js +3 -2
- package/dist/components/atoms/Inputs/SearchInput/SearchInput.js.map +1 -1
- package/dist/components/atoms/Inputs/TextArea/TextArea.cjs +7 -6
- package/dist/components/atoms/Inputs/TextArea/TextArea.cjs.map +1 -1
- package/dist/components/atoms/Inputs/TextArea/TextArea.d.ts +4 -13
- package/dist/components/atoms/Inputs/TextArea/TextArea.d.ts.map +1 -1
- package/dist/components/atoms/Inputs/TextArea/TextArea.js +8 -7
- package/dist/components/atoms/Inputs/TextArea/TextArea.js.map +1 -1
- package/dist/components/atoms/Inputs/TimeInput/TimeInput.cjs +5 -5
- package/dist/components/atoms/Inputs/TimeInput/TimeInput.cjs.map +1 -1
- package/dist/components/atoms/Inputs/TimeInput/TimeInput.d.ts +2 -7
- package/dist/components/atoms/Inputs/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/components/atoms/Inputs/TimeInput/TimeInput.js +6 -6
- package/dist/components/atoms/Inputs/TimeInput/TimeInput.js.map +1 -1
- package/dist/components/atoms/Inputs/components/HintText.cjs +4 -3
- package/dist/components/atoms/Inputs/components/HintText.cjs.map +1 -1
- package/dist/components/atoms/Inputs/components/HintText.d.ts +3 -8
- package/dist/components/atoms/Inputs/components/HintText.d.ts.map +1 -1
- package/dist/components/atoms/Inputs/components/HintText.js +4 -3
- package/dist/components/atoms/Inputs/components/HintText.js.map +1 -1
- package/dist/components/atoms/Inputs/components/Label.cjs +4 -3
- package/dist/components/atoms/Inputs/components/Label.cjs.map +1 -1
- package/dist/components/atoms/Inputs/components/Label.d.ts +3 -8
- package/dist/components/atoms/Inputs/components/Label.d.ts.map +1 -1
- package/dist/components/atoms/Inputs/components/Label.js +4 -3
- package/dist/components/atoms/Inputs/components/Label.js.map +1 -1
- package/dist/components/atoms/PhoneInput/components/PhoneInputCountrySelect.cjs +35 -0
- package/dist/components/atoms/PhoneInput/components/PhoneInputCountrySelect.cjs.map +1 -0
- package/dist/components/atoms/PhoneInput/components/PhoneInputCountrySelect.d.ts +24 -0
- package/dist/components/atoms/PhoneInput/components/PhoneInputCountrySelect.d.ts.map +1 -0
- package/dist/components/atoms/PhoneInput/components/PhoneInputCountrySelect.js +33 -0
- package/dist/components/atoms/PhoneInput/components/PhoneInputCountrySelect.js.map +1 -0
- package/dist/components/atoms/PhoneInput/hooks/usePhoneEntry.cjs +100 -0
- package/dist/components/atoms/PhoneInput/hooks/usePhoneEntry.cjs.map +1 -0
- package/dist/components/atoms/PhoneInput/hooks/usePhoneEntry.d.ts +35 -0
- package/dist/components/atoms/PhoneInput/hooks/usePhoneEntry.d.ts.map +1 -0
- package/dist/components/atoms/PhoneInput/hooks/usePhoneEntry.js +98 -0
- package/dist/components/atoms/PhoneInput/hooks/usePhoneEntry.js.map +1 -0
- package/dist/components/atoms/PhoneInput/index.cjs +79 -0
- package/dist/components/atoms/PhoneInput/index.cjs.map +1 -0
- package/dist/components/atoms/PhoneInput/index.d.ts +48 -0
- package/dist/components/atoms/PhoneInput/index.d.ts.map +1 -0
- package/dist/components/atoms/PhoneInput/index.js +77 -0
- package/dist/components/atoms/PhoneInput/index.js.map +1 -0
- package/dist/components/atoms/PhoneInput/phoneInput.types.d.ts +17 -0
- package/dist/components/atoms/PhoneInput/phoneInput.types.d.ts.map +1 -0
- package/dist/components/atoms/PhoneInput/utilities/phoneInput.utils.cjs +304 -0
- package/dist/components/atoms/PhoneInput/utilities/phoneInput.utils.cjs.map +1 -0
- package/dist/components/atoms/PhoneInput/utilities/phoneInput.utils.d.ts +147 -0
- package/dist/components/atoms/PhoneInput/utilities/phoneInput.utils.d.ts.map +1 -0
- package/dist/components/atoms/PhoneInput/utilities/phoneInput.utils.js +288 -0
- package/dist/components/atoms/PhoneInput/utilities/phoneInput.utils.js.map +1 -0
- package/dist/components/atoms/RadioButton/index.d.ts +1 -4
- package/dist/components/atoms/RadioButton/index.d.ts.map +1 -1
- package/dist/components/atoms/Radios/RadioButton/RadioButton.cjs +6 -4
- package/dist/components/atoms/Radios/RadioButton/RadioButton.cjs.map +1 -1
- package/dist/components/atoms/Radios/RadioButton/RadioButton.d.ts +2 -7
- package/dist/components/atoms/Radios/RadioButton/RadioButton.d.ts.map +1 -1
- package/dist/components/atoms/Radios/RadioButton/RadioButton.js +7 -5
- package/dist/components/atoms/Radios/RadioButton/RadioButton.js.map +1 -1
- package/dist/components/atoms/RatingStars/index.cjs +4 -3
- package/dist/components/atoms/RatingStars/index.cjs.map +1 -1
- package/dist/components/atoms/RatingStars/index.d.ts +3 -3
- package/dist/components/atoms/RatingStars/index.d.ts.map +1 -1
- package/dist/components/atoms/RatingStars/index.js +6 -5
- package/dist/components/atoms/RatingStars/index.js.map +1 -1
- package/dist/components/atoms/SearchInput/index.d.ts +1 -4
- package/dist/components/atoms/SearchInput/index.d.ts.map +1 -1
- package/dist/components/atoms/SocialButton/index.d.ts +1 -1
- package/dist/components/atoms/SocialButton/index.d.ts.map +1 -1
- package/dist/components/atoms/UtilityButton/index.cjs.map +1 -1
- package/dist/components/atoms/UtilityButton/index.d.ts +2 -2
- package/dist/components/atoms/UtilityButton/index.d.ts.map +1 -1
- package/dist/components/atoms/UtilityButton/index.js.map +1 -1
- package/dist/components/atoms/VerificationCodeInput/index.cjs +18 -18
- package/dist/components/atoms/VerificationCodeInput/index.cjs.map +1 -1
- package/dist/components/atoms/VerificationCodeInput/index.d.ts +10 -29
- package/dist/components/atoms/VerificationCodeInput/index.d.ts.map +1 -1
- package/dist/components/atoms/VerificationCodeInput/index.js +19 -19
- package/dist/components/atoms/VerificationCodeInput/index.js.map +1 -1
- package/dist/components/forms/Form/index.cjs +14 -11
- package/dist/components/forms/Form/index.cjs.map +1 -1
- package/dist/components/forms/Form/index.d.ts +9 -8
- package/dist/components/forms/Form/index.d.ts.map +1 -1
- package/dist/components/forms/Form/index.js +16 -13
- package/dist/components/forms/Form/index.js.map +1 -1
- package/dist/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.cjs +10 -1
- package/dist/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.cjs.map +1 -1
- package/dist/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.d.ts.map +1 -1
- package/dist/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.js +10 -1
- package/dist/components/forms/__internal__/formField/hooks/useFocusThroughSubmit.js.map +1 -1
- package/dist/components/forms/fields/FormPhoneInput/index.cjs +36 -0
- package/dist/components/forms/fields/FormPhoneInput/index.cjs.map +1 -0
- package/dist/components/forms/fields/FormPhoneInput/index.d.ts +19 -0
- package/dist/components/forms/fields/FormPhoneInput/index.d.ts.map +1 -0
- package/dist/components/forms/fields/FormPhoneInput/index.js +34 -0
- package/dist/components/forms/fields/FormPhoneInput/index.js.map +1 -0
- package/dist/components/forms/validation/index.cjs +25 -56
- package/dist/components/forms/validation/index.cjs.map +1 -1
- package/dist/components/forms/validation/index.d.ts +2 -12
- package/dist/components/forms/validation/index.d.ts.map +1 -1
- package/dist/components/forms/validation/index.js +1 -32
- package/dist/components/forms/validation/index.js.map +1 -1
- package/dist/components/forms/validation/phoneNumber/index.cjs +20 -0
- package/dist/components/forms/validation/phoneNumber/index.cjs.map +1 -0
- package/dist/components/forms/validation/phoneNumber/index.d.ts +14 -0
- package/dist/components/forms/validation/phoneNumber/index.d.ts.map +1 -0
- package/dist/components/forms/validation/phoneNumber/index.js +18 -0
- package/dist/components/forms/validation/phoneNumber/index.js.map +1 -0
- package/dist/components/forms/validation/utilities/validation.utils.cjs +34 -0
- package/dist/components/forms/validation/utilities/validation.utils.cjs.map +1 -1
- package/dist/components/forms/validation/utilities/validation.utils.d.ts +29 -1
- package/dist/components/forms/validation/utilities/validation.utils.d.ts.map +1 -1
- package/dist/components/forms/validation/utilities/validation.utils.js +33 -2
- package/dist/components/forms/validation/utilities/validation.utils.js.map +1 -1
- package/dist/components/forms/validation/validation.types.d.ts +10 -0
- package/dist/components/forms/validation/validation.types.d.ts.map +1 -1
- package/dist/components/molecules/ButtonGroup/index.cjs +8 -6
- package/dist/components/molecules/ButtonGroup/index.cjs.map +1 -1
- package/dist/components/molecules/ButtonGroup/index.d.ts +7 -5
- package/dist/components/molecules/ButtonGroup/index.d.ts.map +1 -1
- package/dist/components/molecules/ButtonGroup/index.js +12 -10
- package/dist/components/molecules/ButtonGroup/index.js.map +1 -1
- package/dist/components/molecules/EmptyState/index.cjs +33 -33
- package/dist/components/molecules/EmptyState/index.cjs.map +1 -1
- package/dist/components/molecules/EmptyState/index.d.ts +23 -24
- package/dist/components/molecules/EmptyState/index.d.ts.map +1 -1
- package/dist/components/molecules/EmptyState/index.js +36 -36
- package/dist/components/molecules/EmptyState/index.js.map +1 -1
- package/dist/components/molecules/Messaging/index.cjs +5 -3
- package/dist/components/molecules/Messaging/index.cjs.map +1 -1
- package/dist/components/molecules/Messaging/index.d.ts +3 -3
- package/dist/components/molecules/Messaging/index.d.ts.map +1 -1
- package/dist/components/molecules/Messaging/index.js +5 -3
- package/dist/components/molecules/Messaging/index.js.map +1 -1
- package/dist/components/molecules/SectionFooter/index.cjs +9 -6
- package/dist/components/molecules/SectionFooter/index.cjs.map +1 -1
- package/dist/components/molecules/SectionFooter/index.d.ts +5 -5
- package/dist/components/molecules/SectionFooter/index.d.ts.map +1 -1
- package/dist/components/molecules/SectionFooter/index.js +10 -7
- package/dist/components/molecules/SectionFooter/index.js.map +1 -1
- package/dist/components/molecules/SectionHeader/index.cjs +21 -15
- package/dist/components/molecules/SectionHeader/index.cjs.map +1 -1
- package/dist/components/molecules/SectionHeader/index.d.ts +11 -11
- package/dist/components/molecules/SectionHeader/index.d.ts.map +1 -1
- package/dist/components/molecules/SectionHeader/index.js +22 -16
- package/dist/components/molecules/SectionHeader/index.js.map +1 -1
- package/dist/components/molecules/Select/index.d.ts +2 -5
- package/dist/components/molecules/Select/index.d.ts.map +1 -1
- package/dist/components/molecules/Selects/MultiSelect/MultiSelect.cjs +3 -2
- package/dist/components/molecules/Selects/MultiSelect/MultiSelect.cjs.map +1 -1
- package/dist/components/molecules/Selects/MultiSelect/MultiSelect.d.ts +3 -3
- package/dist/components/molecules/Selects/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/components/molecules/Selects/MultiSelect/MultiSelect.js +4 -3
- package/dist/components/molecules/Selects/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/components/molecules/Selects/Select/Select.cjs +5 -5
- package/dist/components/molecules/Selects/Select/Select.cjs.map +1 -1
- package/dist/components/molecules/Selects/Select/Select.d.ts +3 -6
- package/dist/components/molecules/Selects/Select/Select.d.ts.map +1 -1
- package/dist/components/molecules/Selects/Select/Select.js +6 -6
- package/dist/components/molecules/Selects/Select/Select.js.map +1 -1
- package/dist/components/molecules/Selects/Select/components/Combobox.cjs +7 -5
- package/dist/components/molecules/Selects/Select/components/Combobox.cjs.map +1 -1
- package/dist/components/molecules/Selects/Select/components/Combobox.d.ts +3 -3
- package/dist/components/molecules/Selects/Select/components/Combobox.d.ts.map +1 -1
- package/dist/components/molecules/Selects/Select/components/Combobox.js +10 -8
- package/dist/components/molecules/Selects/Select/components/Combobox.js.map +1 -1
- package/dist/components/molecules/Selects/Select/components/Popover.cjs +2 -3
- package/dist/components/molecules/Selects/Select/components/Popover.cjs.map +1 -1
- package/dist/components/molecules/Selects/Select/components/Popover.d.ts.map +1 -1
- package/dist/components/molecules/Selects/Select/components/Popover.js +2 -3
- package/dist/components/molecules/Selects/Select/components/Popover.js.map +1 -1
- package/dist/components/molecules/Selects/components/SelectItem.cjs +2 -1
- package/dist/components/molecules/Selects/components/SelectItem.cjs.map +1 -1
- package/dist/components/molecules/Selects/components/SelectItem.d.ts.map +1 -1
- package/dist/components/molecules/Selects/components/SelectItem.js +2 -1
- package/dist/components/molecules/Selects/components/SelectItem.js.map +1 -1
- package/dist/components/molecules/Tabs/index.cjs +10 -7
- package/dist/components/molecules/Tabs/index.cjs.map +1 -1
- package/dist/components/molecules/Tabs/index.d.ts +12 -15
- package/dist/components/molecules/Tabs/index.d.ts.map +1 -1
- package/dist/components/molecules/Tabs/index.js +13 -10
- package/dist/components/molecules/Tabs/index.js.map +1 -1
- package/dist/components/molecules/Tags/Tag/Tag.cjs +4 -3
- package/dist/components/molecules/Tags/Tag/Tag.cjs.map +1 -1
- package/dist/components/molecules/Tags/Tag/Tag.d.ts +4 -3
- package/dist/components/molecules/Tags/Tag/Tag.d.ts.map +1 -1
- package/dist/components/molecules/Tags/Tag/Tag.js +5 -4
- package/dist/components/molecules/Tags/Tag/Tag.js.map +1 -1
- package/dist/components/molecules/Tags/TagGroup/TagGroup.cjs +5 -3
- package/dist/components/molecules/Tags/TagGroup/TagGroup.cjs.map +1 -1
- package/dist/components/molecules/Tags/TagGroup/TagGroup.d.ts +2 -3
- package/dist/components/molecules/Tags/TagGroup/TagGroup.d.ts.map +1 -1
- package/dist/components/molecules/Tags/TagGroup/TagGroup.js +6 -4
- package/dist/components/molecules/Tags/TagGroup/TagGroup.js.map +1 -1
- package/dist/components/molecules/TextArea/index.d.ts +1 -4
- package/dist/components/molecules/TextArea/index.d.ts.map +1 -1
- package/dist/components/organisms/Carousel/index.cjs +26 -14
- package/dist/components/organisms/Carousel/index.cjs.map +1 -1
- package/dist/components/organisms/Carousel/index.d.ts +8 -10
- package/dist/components/organisms/Carousel/index.d.ts.map +1 -1
- package/dist/components/organisms/Carousel/index.js +28 -16
- package/dist/components/organisms/Carousel/index.js.map +1 -1
- package/dist/components/organisms/ColorPicker/components/ColorPickerField.cjs +3 -2
- package/dist/components/organisms/ColorPicker/components/ColorPickerField.cjs.map +1 -1
- package/dist/components/organisms/ColorPicker/components/ColorPickerField.d.ts +2 -4
- package/dist/components/organisms/ColorPicker/components/ColorPickerField.d.ts.map +1 -1
- package/dist/components/organisms/ColorPicker/components/ColorPickerField.js +4 -3
- package/dist/components/organisms/ColorPicker/components/ColorPickerField.js.map +1 -1
- package/dist/components/organisms/ColorPicker/index.cjs +3 -1
- package/dist/components/organisms/ColorPicker/index.cjs.map +1 -1
- package/dist/components/organisms/ColorPicker/index.d.ts +1 -1
- package/dist/components/organisms/ColorPicker/index.d.ts.map +1 -1
- package/dist/components/organisms/ColorPicker/index.js +7 -5
- package/dist/components/organisms/ColorPicker/index.js.map +1 -1
- package/dist/components/organisms/ColorPicker/providers/ColorPicker.provider.js +1 -1
- package/dist/components/organisms/CommandMenu/components/CommandInput.cjs +5 -3
- package/dist/components/organisms/CommandMenu/components/CommandInput.cjs.map +1 -1
- package/dist/components/organisms/CommandMenu/components/CommandInput.d.ts +3 -5
- package/dist/components/organisms/CommandMenu/components/CommandInput.d.ts.map +1 -1
- package/dist/components/organisms/CommandMenu/components/CommandInput.js +5 -3
- package/dist/components/organisms/CommandMenu/components/CommandInput.js.map +1 -1
- package/dist/components/organisms/CommandMenu/index.cjs +8 -6
- package/dist/components/organisms/CommandMenu/index.cjs.map +1 -1
- package/dist/components/organisms/CommandMenu/index.d.ts +4 -4
- package/dist/components/organisms/CommandMenu/index.d.ts.map +1 -1
- package/dist/components/organisms/CommandMenu/index.js +9 -7
- package/dist/components/organisms/CommandMenu/index.js.map +1 -1
- package/dist/components/organisms/DatePickers/DatePicker/DatePicker.cjs +4 -2
- package/dist/components/organisms/DatePickers/DatePicker/DatePicker.cjs.map +1 -1
- package/dist/components/organisms/DatePickers/DatePicker/DatePicker.d.ts +2 -4
- package/dist/components/organisms/DatePickers/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/organisms/DatePickers/DatePicker/DatePicker.js +4 -2
- package/dist/components/organisms/DatePickers/DatePicker/DatePicker.js.map +1 -1
- package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.cjs +3 -2
- package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.cjs.map +1 -1
- package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.d.ts +2 -4
- package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.d.ts.map +1 -1
- package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.js +4 -3
- package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.js.map +1 -1
- package/dist/components/organisms/DatePickers/RangeCalendar/RangeCalendar.js +2 -2
- package/dist/components/organisms/FileUpload/index.cjs +8 -6
- package/dist/components/organisms/FileUpload/index.cjs.map +1 -1
- package/dist/components/organisms/FileUpload/index.d.ts +7 -7
- package/dist/components/organisms/FileUpload/index.d.ts.map +1 -1
- package/dist/components/organisms/FileUpload/index.js +12 -10
- package/dist/components/organisms/FileUpload/index.js.map +1 -1
- package/dist/components/organisms/FilterBar/index.cjs +13 -9
- package/dist/components/organisms/FilterBar/index.cjs.map +1 -1
- package/dist/components/organisms/FilterBar/index.d.ts +7 -7
- package/dist/components/organisms/FilterBar/index.d.ts.map +1 -1
- package/dist/components/organisms/FilterBar/index.js +14 -10
- package/dist/components/organisms/FilterBar/index.js.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelContent.cjs +4 -3
- package/dist/components/organisms/SidePanel/components/SidePanelContent.cjs.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelContent.d.ts +12 -6
- package/dist/components/organisms/SidePanel/components/SidePanelContent.d.ts.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelContent.js +4 -3
- package/dist/components/organisms/SidePanel/components/SidePanelContent.js.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelFooter.cjs +4 -3
- package/dist/components/organisms/SidePanel/components/SidePanelFooter.cjs.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelFooter.d.ts +11 -6
- package/dist/components/organisms/SidePanel/components/SidePanelFooter.d.ts.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelFooter.js +4 -3
- package/dist/components/organisms/SidePanel/components/SidePanelFooter.js.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelHeader.cjs +12 -10
- package/dist/components/organisms/SidePanel/components/SidePanelHeader.cjs.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelHeader.d.ts +8 -7
- package/dist/components/organisms/SidePanel/components/SidePanelHeader.d.ts.map +1 -1
- package/dist/components/organisms/SidePanel/components/SidePanelHeader.js +15 -13
- package/dist/components/organisms/SidePanel/components/SidePanelHeader.js.map +1 -1
- package/dist/components/organisms/SidebarNavigation/index.cjs +2 -1
- package/dist/components/organisms/SidebarNavigation/index.cjs.map +1 -1
- package/dist/components/organisms/SidebarNavigation/index.d.ts.map +1 -1
- package/dist/components/organisms/SidebarNavigation/index.js +2 -1
- package/dist/components/organisms/SidebarNavigation/index.js.map +1 -1
- package/dist/components/organisms/SlideoutMenu/index.cjs +8 -8
- package/dist/components/organisms/SlideoutMenu/index.cjs.map +1 -1
- package/dist/components/organisms/SlideoutMenu/index.d.ts +9 -18
- package/dist/components/organisms/SlideoutMenu/index.d.ts.map +1 -1
- package/dist/components/organisms/SlideoutMenu/index.js +9 -9
- package/dist/components/organisms/SlideoutMenu/index.js.map +1 -1
- package/dist/components/organisms/Table/index.cjs +15 -10
- package/dist/components/organisms/Table/index.cjs.map +1 -1
- package/dist/components/organisms/Table/index.d.ts +10 -19
- package/dist/components/organisms/Table/index.d.ts.map +1 -1
- package/dist/components/organisms/Table/index.js +18 -13
- package/dist/components/organisms/Table/index.js.map +1 -1
- package/dist/components/organisms/TextEditor/components/TextEditorExtensions.js +1 -1
- package/dist/components/organisms/TextEditor/components/TextEditorToolbar.cjs +5 -3
- package/dist/components/organisms/TextEditor/components/TextEditorToolbar.cjs.map +1 -1
- package/dist/components/organisms/TextEditor/components/TextEditorToolbar.d.ts +2 -3
- package/dist/components/organisms/TextEditor/components/TextEditorToolbar.d.ts.map +1 -1
- package/dist/components/organisms/TextEditor/components/TextEditorToolbar.js +5 -3
- package/dist/components/organisms/TextEditor/components/TextEditorToolbar.js.map +1 -1
- package/dist/components/organisms/TextEditor/index.cjs +16 -9
- package/dist/components/organisms/TextEditor/index.cjs.map +1 -1
- package/dist/components/organisms/TextEditor/index.d.ts +7 -9
- package/dist/components/organisms/TextEditor/index.d.ts.map +1 -1
- package/dist/components/organisms/TextEditor/index.js +21 -14
- package/dist/components/organisms/TextEditor/index.js.map +1 -1
- package/dist/components/organisms/VideoPlayer/index.cjs +3 -2
- package/dist/components/organisms/VideoPlayer/index.cjs.map +1 -1
- package/dist/components/organisms/VideoPlayer/index.d.ts +1 -6
- package/dist/components/organisms/VideoPlayer/index.d.ts.map +1 -1
- package/dist/components/organisms/VideoPlayer/index.js +4 -3
- package/dist/components/organisms/VideoPlayer/index.js.map +1 -1
- package/dist/native/components/atoms/PhoneInput/index.d.ts +12 -0
- package/dist/native/components/forms/fields/FormPhoneInput/index.d.ts +12 -0
- package/dist/native/components/forms/validation/phoneNumber/index.d.ts +12 -0
- package/dist/utilities/__internal__/inertUtils/inert.utils.cjs +17 -0
- package/dist/utilities/__internal__/inertUtils/inert.utils.cjs.map +1 -1
- package/dist/utilities/__internal__/inertUtils/inert.utils.d.ts +11 -0
- package/dist/utilities/__internal__/inertUtils/inert.utils.d.ts.map +1 -1
- package/dist/utilities/__internal__/inertUtils/inert.utils.js +17 -1
- package/dist/utilities/__internal__/inertUtils/inert.utils.js.map +1 -1
- package/dist/utilities/__internal__/refUtils/ref.utils.cjs +20 -0
- package/dist/utilities/__internal__/refUtils/ref.utils.cjs.map +1 -1
- package/dist/utilities/__internal__/refUtils/ref.utils.d.ts +10 -1
- package/dist/utilities/__internal__/refUtils/ref.utils.d.ts.map +1 -1
- package/dist/utilities/__internal__/refUtils/ref.utils.js +20 -1
- package/dist/utilities/__internal__/refUtils/ref.utils.js.map +1 -1
- package/package.json +13 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/organisms/Table/index.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/organisms/Table/index.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,wBAAwB,EAExB,cAAc,EACd,YAAY,EACZ,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EACV,SAAS,IAAI,aAAa,EAC1B,WAAW,IAAI,eAAe,EAC9B,QAAQ,IAAI,YAAY,EACxB,gBAAgB,IAAI,oBAAoB,EACxC,UAAU,IAAI,cAAc,EAC5B,GAAG,EAEJ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAOL,SAAS,IAAI,aAAa,EAG3B,MAAM,uBAAuB,CAAC;AAK/B,2HAA2H;AAC3H,eAAO,MAAM,uBAAuB,mCAkBnC,CAAC;AAuBF,UAAU,oBAAoB;IAC5B,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,gDAAgD;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uDAAuD;IACvD,eAAe,C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AE;wEAwB1C,oBAAoB;CAyTvG,CAAC;AAEF;;;;;;GAMG;AACH,QAAA,MAAM,KAAK,EAAgB,OAAO,SAAS,GAAG;IAC5C,IAAI,EAAE,OAAO,aAAa,CAAC;IAC3B,IAAI,EAAE,OAAO,SAAS,CAAC;IACvB,IAAI,EAAE,OAAO,SAAS,CAAC;IACvB,MAAM,EAAE,OAAO,WAAW,CAAC;IAC3B,GAAG,EAAE,OAAO,QAAQ,CAAC;CACtB,CAAC;AAOF,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { Edit01, Copy01, Trash01
|
|
2
|
+
import { HelpCircle, Edit01, Copy01, Trash01 } from '@flipdish/ui-icons';
|
|
3
3
|
import { Badge } from '@flipdish/ui-library/components/atoms/Badges';
|
|
4
4
|
import { Checkbox } from '@flipdish/ui-library/components/atoms/Checkboxes';
|
|
5
5
|
import { Tooltip, TooltipTrigger } from '@flipdish/ui-library/components/atoms/Tooltip';
|
|
6
6
|
import { Dropdown } from '@flipdish/ui-library/components/molecules/Dropdown';
|
|
7
7
|
import { cx } from '@flipdish/ui-library/utilities/cx';
|
|
8
8
|
import { useResolvedTestId, joinTestId, slugifyTestId } from '@flipdish/ui-library/utilities/testIdUtils';
|
|
9
|
-
import { createContext, useContext, isValidElement } from 'react';
|
|
10
|
-
import { Table as Table$1,
|
|
9
|
+
import { createContext, forwardRef, useContext, isValidElement } from 'react';
|
|
10
|
+
import { Table as Table$1, useTableOptions, Cell, TableBody, TableHeader as TableHeader$1, Column, Collection, Row, Group } from 'react-aria-components';
|
|
11
11
|
import { TableSortIcon } from './components/TableSortIcon.js';
|
|
12
12
|
import { useSelectableRowRegistry, useRegisterSelectableRow } from './hooks/useSelectableRowRegistry.js';
|
|
13
13
|
import { hasSelectionListener, selectionOfKey, reportSelectionChange } from './table.utils.js';
|
|
@@ -31,7 +31,8 @@ const TableCardHeader = ({ title, badge, description, contentTrailing, className
|
|
|
31
31
|
};
|
|
32
32
|
return (jsxs("div", { className: cx('relative flex flex-col items-start gap-4 border-b border-secondary bg-primary px-4 md:flex-row', size === 'sm' ? 'py-4 md:px-5' : 'py-5 md:px-6', className), children: [jsxs("div", { className: "flex flex-1 flex-col gap-0.5", children: [jsxs("div", { className: "flex items-center gap-2", children: [jsx("h2", { className: "text-md font-semibold text-primary", children: title }), renderBadge()] }), description && jsx("p", { className: "text-sm text-tertiary", children: description })] }), contentTrailing] }));
|
|
33
33
|
};
|
|
34
|
-
|
|
34
|
+
// The element types match react-aria's: inside a `Virtualizer` the table, its header, rows and cells render as `div`s.
|
|
35
|
+
const TableRoot = forwardRef(({ className, size: sizeProp, selectedKey, onSelectedKeyChange, onSelectedKeysChange, 'data-testid': dataTestId, ...props }, ref) => {
|
|
35
36
|
// Re-providing the context would otherwise reset a card-level `size` back to `md`.
|
|
36
37
|
const inherited = useContext(TableContext);
|
|
37
38
|
const size = sizeProp ?? inherited.size;
|
|
@@ -44,18 +45,20 @@ const TableRoot = ({ className, size: sizeProp, selectedKey, onSelectedKeyChange
|
|
|
44
45
|
};
|
|
45
46
|
return (
|
|
46
47
|
// A row cannot see the table-level `onRowAction`, so the context carries whether one exists.
|
|
47
|
-
jsx(TableContext.Provider, { value: { size, testIdPrefix: rootTestId, hasRowAction: props.onRowAction !== undefined, registerRow }, children: jsx("div", { className: "overflow-x-auto", children: jsx(Table$1, { "data-testid": rootTestId, className: (state) => cx('w-full overflow-x-hidden', typeof className === 'function' ? className(state) : className), ...props, selectedKeys: selectedKey !== undefined ? selectionOfKey(selectedKey) : props.selectedKeys, onSelectionChange: hasSelectionListener(selectionListeners) ? handleSelectionChange : undefined }) }) }));
|
|
48
|
-
};
|
|
48
|
+
jsx(TableContext.Provider, { value: { size, testIdPrefix: rootTestId, hasRowAction: props.onRowAction !== undefined, registerRow }, children: jsx("div", { className: "overflow-x-auto", children: jsx(Table$1, { "data-testid": rootTestId, className: (state) => cx('w-full overflow-x-hidden', typeof className === 'function' ? className(state) : className), ...props, ref: ref, selectedKeys: selectedKey !== undefined ? selectionOfKey(selectedKey) : props.selectedKeys, onSelectionChange: hasSelectionListener(selectionListeners) ? handleSelectionChange : undefined }) }) }));
|
|
49
|
+
});
|
|
49
50
|
TableRoot.displayName = 'Table';
|
|
50
|
-
const
|
|
51
|
+
const TableHeaderBase = ({ columns, children, bordered = true, className, size: sizeProp, ...props }, ref) => {
|
|
51
52
|
const context = useContext(TableContext);
|
|
52
53
|
const { selectionBehavior, selectionMode } = useTableOptions();
|
|
53
54
|
const size = sizeProp ?? context.size;
|
|
54
|
-
return (jsxs(TableHeader$1, { ...props, className: (state) => cx('relative bg-secondary', size === 'sm' ? 'h-9' : 'h-11',
|
|
55
|
+
return (jsxs(TableHeader$1, { ...props, ref: ref, className: (state) => cx('relative bg-secondary', size === 'sm' ? 'h-9' : 'h-11',
|
|
55
56
|
// Row border—using an "after" pseudo-element to avoid the border taking up space.
|
|
56
57
|
bordered &&
|
|
57
58
|
'[&>tr>th]:after:pointer-events-none [&>tr>th]:after:absolute [&>tr>th]:after:inset-x-0 [&>tr>th]:after:bottom-0 [&>tr>th]:after:h-px [&>tr>th]:after:bg-border-secondary [&>tr>th]:focus-visible:after:bg-transparent', typeof className === 'function' ? className(state) : className), children: [selectionBehavior === 'toggle' && (jsx(Column, { className: cx('relative py-2 pr-0 pl-4', size === 'sm' ? 'w-9 md:pl-5' : 'w-11 md:pl-6'), children: selectionMode === 'multiple' && (jsx("div", { className: "flex items-start", children: jsx(Checkbox, { slot: "selection", size: "md" }) })) })), jsx(Collection, { items: columns, children: children })] }));
|
|
58
59
|
};
|
|
60
|
+
// `forwardRef` drops the type parameter that ties `columns` to the item a render function gets; the cast restores it.
|
|
61
|
+
const TableHeader = forwardRef(TableHeaderBase);
|
|
59
62
|
TableHeader.displayName = 'TableHeader';
|
|
60
63
|
const TableHead = ({ className, tooltip, label, children, 'data-testid': dataTestId, ...props }) => {
|
|
61
64
|
const { selectionBehavior } = useTableOptions();
|
|
@@ -67,7 +70,7 @@ TableHead.displayName = 'TableHead';
|
|
|
67
70
|
// The design's selected row: a brand tint and a 4px brand bar down the row's left edge, drawn by its first cell. The
|
|
68
71
|
// `_alt` tint is brand-50 in light and the secondary surface in dark, where `bg-brand-primary` is a solid brand-500.
|
|
69
72
|
const HIGHLIGHTED_ROW_CLASSNAME = "bg-brand-primary_alt hover:bg-brand-primary_alt [&>td:first-child]:before:absolute [&>td:first-child]:before:inset-y-0 [&>td:first-child]:before:left-0 [&>td:first-child]:before:w-1 [&>td:first-child]:before:bg-brand-solid [&>td:first-child]:before:content-['']";
|
|
70
|
-
const
|
|
73
|
+
const TableRowBase = ({ columns, children, className, highlightSelectedRow = true, isHighlighted = false, size: sizeProp, 'data-testid': dataTestId, ...props }, ref) => {
|
|
71
74
|
const context = useContext(TableContext);
|
|
72
75
|
const { selectionBehavior, selectionMode } = useTableOptions();
|
|
73
76
|
const size = sizeProp ?? context.size;
|
|
@@ -78,17 +81,19 @@ const TableRow = ({ columns, children, className, highlightSelectedRow = true, i
|
|
|
78
81
|
const { registerRow } = context;
|
|
79
82
|
const { id, isDisabled } = props;
|
|
80
83
|
useRegisterSelectableRow(registerRow, id, isDisabled);
|
|
81
|
-
return (jsxs(Row, { ...props, "data-testid": rowTestId, "data-highlighted": isHighlighted || undefined, className: (state) => cx('relative outline-focus-ring transition-colors after:pointer-events-none hover:bg-secondary focus-visible:outline-2 focus-visible:-outline-offset-2', size === 'sm' ? 'h-14' : 'h-18', ((highlightSelectedRow && state.isSelected) || isHighlighted) && HIGHLIGHTED_ROW_CLASSNAME, isInteractive && (state.isDisabled ? 'cursor-default' : 'cursor-pointer'),
|
|
84
|
+
return (jsxs(Row, { ...props, ref: ref, "data-testid": rowTestId, "data-highlighted": isHighlighted || undefined, className: (state) => cx('relative outline-focus-ring transition-colors after:pointer-events-none hover:bg-secondary focus-visible:outline-2 focus-visible:-outline-offset-2', size === 'sm' ? 'h-14' : 'h-18', ((highlightSelectedRow && state.isSelected) || isHighlighted) && HIGHLIGHTED_ROW_CLASSNAME, isInteractive && (state.isDisabled ? 'cursor-default' : 'cursor-pointer'),
|
|
82
85
|
// Row border—using an "after" pseudo-element to avoid the border taking up space.
|
|
83
86
|
'[&>td]:after:absolute [&>td]:after:inset-x-0 [&>td]:after:bottom-0 [&>td]:after:h-px [&>td]:after:w-full [&>td]:after:bg-border-secondary last:[&>td]:after:hidden [&>td]:focus-visible:after:opacity-0 focus-visible:[&>td]:after:opacity-0', typeof className === 'function' ? className(state) : className), children: [selectionBehavior === 'toggle' && (jsx(Cell, { className: cx('relative py-2 pr-0 pl-4', size === 'sm' ? 'md:pl-5' : 'md:pl-6'), children: jsx("div", { className: "flex items-end", children: jsx(Checkbox, { slot: "selection", size: "md", "data-testid": rowTestId ? joinTestId(rowTestId, 'selection') : undefined }) }) })), jsx(Collection, { items: columns, children: children })] }));
|
|
84
87
|
};
|
|
88
|
+
// As for `TableHeader`: the cast restores the type parameter `forwardRef` drops.
|
|
89
|
+
const TableRow = forwardRef(TableRowBase);
|
|
85
90
|
TableRow.displayName = 'TableRow';
|
|
86
|
-
const TableCell = ({ className, children, size: sizeProp, ...props }) => {
|
|
91
|
+
const TableCell = forwardRef(({ className, children, size: sizeProp, ...props }, ref) => {
|
|
87
92
|
const context = useContext(TableContext);
|
|
88
93
|
const { selectionBehavior } = useTableOptions();
|
|
89
94
|
const size = sizeProp ?? context.size;
|
|
90
|
-
return (jsx(Cell, { ...props, className: (state) => cx('relative text-sm text-tertiary outline-focus-ring focus-visible:z-1 focus-visible:outline-2 focus-visible:-outline-offset-2', size === 'sm' && 'px-5 py-3', size === 'md' && 'px-6 py-4', selectionBehavior === 'toggle' && 'nth-2:pl-3', typeof className === 'function' ? className(state) : className), children: children }));
|
|
91
|
-
};
|
|
95
|
+
return (jsx(Cell, { ...props, ref: ref, className: (state) => cx('relative text-sm text-tertiary outline-focus-ring focus-visible:z-1 focus-visible:outline-2 focus-visible:-outline-offset-2', size === 'sm' && 'px-5 py-3', size === 'md' && 'px-6 py-4', selectionBehavior === 'toggle' && 'nth-2:pl-3', typeof className === 'function' ? className(state) : className), children: children }));
|
|
96
|
+
});
|
|
92
97
|
TableCell.displayName = 'TableCell';
|
|
93
98
|
const TableCard = {
|
|
94
99
|
Root: TableCardRoot,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/organisms/Table/index.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx","AriaTable","AriaTableHeader","AriaColumn","AriaCollection","AriaGroup","AriaRow","AriaCell","AriaTableBody"],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/organisms/Table/index.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx","AriaTable","AriaTableHeader","AriaColumn","AriaCollection","AriaGroup","AriaRow","AriaCell","AriaTableBody"],"mappings":";;;;;;;;;;;;;;AA4CA;AACO,MAAM,uBAAuB,GAAG,OACrCA,IAAA,CAAC,QAAQ,CAAC,IAAI,eACZC,GAAA,CAAC,QAAQ,CAAC,UAAU,EAAA,EAAC,KAAK,EAAC,UAAU,EAAA,CAAG,EAExCA,IAAC,QAAQ,CAAC,OAAO,EAAA,EAAC,SAAS,EAAC,OAAO,EAAA,QAAA,EACjCD,KAAC,QAAQ,CAAC,IAAI,EAAA,EAAA,QAAA,EAAA,CACZC,GAAA,CAAC,QAAQ,CAAC,IAAI,IAAC,IAAI,EAAE,MAAM,EAAA,QAAA,EACzBA,cAAM,SAAS,EAAC,MAAM,EAAA,QAAA,EAAA,MAAA,EAAA,CAAY,EAAA,CACpB,EAChBA,GAAA,CAAC,QAAQ,CAAC,IAAI,EAAA,EAAC,IAAI,EAAE,MAAM,YACzBA,GAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAC,MAAM,EAAA,QAAA,EAAA,WAAA,EAAA,CAAiB,EAAA,CACzB,EACh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EAAE,CAAC,KAAK,KACf,EAAE,CACA,6HAA6H,EAC7H,IAAI,KAAK,IAAI,IAAI,WAAW,EAC5B,IAAI,KAAK,IAAI,IAAI,WAAW,EAE5B,iBAAiB,KAAK,QAAQ,IAAI,YAAY,EAE9C,OAAO,SAAS,KAAK,UAAU,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,SAAS,CAC/D,EAAA,QAAA,EAGF,QAAQ,EAAA,CACA;AAEf,CAAC,CAAC;AACF,SAAS,CAAC,WAAW,GAAG,WAAW;AAEnC,MAAM,SAAS,GAAG;AAChB,IAAA,IAAI,EAAE,aAAa;AACnB,IAAA,MAAM,EAAE,eAAe;;AAGzB;;;;;;AAMG;AACH,MAAM,KAAK,GAAG;AAOd,KAAK,CAAC,IAAI,GAAGC,SAAa;AAC1B,KAAK,CAAC,IAAI,GAAG,SAAS;AACtB,KAAK,CAAC,IAAI,GAAG,SAAS;AACtB,KAAK,CAAC,MAAM,GAAG,WAAW;AAC1B,KAAK,CAAC,GAAG,GAAG,QAAQ;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { Bold01, Italic01, Underline01, AlignLeft, AlignCenter,
|
|
2
|
+
import { Bold01, Italic01, Underline01, AlignLeft, AlignCenter, Dotpoints01, Type01, Link01, Image01, Stars02 } from '@flipdish/ui-icons';
|
|
3
3
|
import { InputBase } from '@flipdish/ui-library/components/atoms/Inputs';
|
|
4
4
|
import { Tooltip } from '@flipdish/ui-library/components/atoms/Tooltip';
|
|
5
5
|
import { Select } from '@flipdish/ui-library/components/molecules/Selects';
|
|
@@ -3,20 +3,22 @@
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var Tooltip = require('@flipdish/ui-library/components/atoms/Tooltip');
|
|
5
5
|
var cx = require('@flipdish/ui-library/utilities/cx');
|
|
6
|
+
var React = require('react');
|
|
6
7
|
var useHotkeyHint = require('../../../../hooks/__internal__/useHotkeyHint/useHotkeyHint.cjs');
|
|
7
8
|
var textEditor_utils = require('../textEditor.utils.cjs');
|
|
8
9
|
var TextEditorExtensions = require('./TextEditorExtensions.cjs');
|
|
9
10
|
|
|
10
|
-
const TextEditorToolbar = ({ className,
|
|
11
|
+
const TextEditorToolbar = React.forwardRef(({ className, type = 'simple', floating = false, hideFontSize }, ref) => {
|
|
11
12
|
const boldLabel = `Bold ${useHotkeyHint.useHotkeyHint('mod+b', textEditor_utils.EDITOR_HOTKEY_HINT)}`;
|
|
12
13
|
const italicLabel = `Italic ${useHotkeyHint.useHotkeyHint('mod+i', textEditor_utils.EDITOR_HOTKEY_HINT)}`;
|
|
13
14
|
const underlineLabel = `Underline ${useHotkeyHint.useHotkeyHint('mod+u', textEditor_utils.EDITOR_HOTKEY_HINT)}`;
|
|
14
15
|
const linkLabel = `Link ${useHotkeyHint.useHotkeyHint('mod+k', textEditor_utils.EDITOR_HOTKEY_HINT)}`;
|
|
15
16
|
if (type === 'simple') {
|
|
16
|
-
return (jsxRuntime.jsxs("div", { className: cx.cx('flex w-max flex-wrap gap-0.5 md:flex-nowrap', floating && 'rounded-lg bg-primary p-1 shadow-lg ring-1 ring-secondary_alt', className), children: [jsxRuntime.jsx(Tooltip.Tooltip, { title: boldLabel, children: jsxRuntime.jsx(TextEditorExtensions.TextEditorBold, {}) }), jsxRuntime.jsx(Tooltip.Tooltip, { title: italicLabel, children: jsxRuntime.jsx(TextEditorExtensions.TextEditorItalic, {}) }), jsxRuntime.jsx(Tooltip.Tooltip, { title: underlineLabel, children: jsxRuntime.jsx(TextEditorExtensions.TextEditorUnderline, {}) }), jsxRuntime.jsx("div", { className: "p-1.5", children: jsxRuntime.jsx("div", { className: "h-full w-px rounded-full bg-border-primary" }) }), jsxRuntime.jsx(TextEditorExtensions.TextEditorColor, {}), jsxRuntime.jsx("div", { className: "p-1.5", children: jsxRuntime.jsx("div", { className: "h-full w-px rounded-full bg-border-primary" }) }), jsxRuntime.jsx(Tooltip.Tooltip, { title: "Left align", children: jsxRuntime.jsx(TextEditorExtensions.TextEditorAlignLeft, {}) }), jsxRuntime.jsx(Tooltip.Tooltip, { title: "Center align", children: jsxRuntime.jsx(TextEditorExtensions.TextEditorAlignCenter, {}) }), jsxRuntime.jsx(Tooltip.Tooltip, { title: "Bullet list", children: jsxRuntime.jsx(TextEditorExtensions.TextEditorBulletList, {}) })] }));
|
|
17
|
+
return (jsxRuntime.jsxs("div", { ref: ref, className: cx.cx('flex w-max flex-wrap gap-0.5 md:flex-nowrap', floating && 'rounded-lg bg-primary p-1 shadow-lg ring-1 ring-secondary_alt', className), children: [jsxRuntime.jsx(Tooltip.Tooltip, { title: boldLabel, children: jsxRuntime.jsx(TextEditorExtensions.TextEditorBold, {}) }), jsxRuntime.jsx(Tooltip.Tooltip, { title: italicLabel, children: jsxRuntime.jsx(TextEditorExtensions.TextEditorItalic, {}) }), jsxRuntime.jsx(Tooltip.Tooltip, { title: underlineLabel, children: jsxRuntime.jsx(TextEditorExtensions.TextEditorUnderline, {}) }), jsxRuntime.jsx("div", { className: "p-1.5", children: jsxRuntime.jsx("div", { className: "h-full w-px rounded-full bg-border-primary" }) }), jsxRuntime.jsx(TextEditorExtensions.TextEditorColor, {}), jsxRuntime.jsx("div", { className: "p-1.5", children: jsxRuntime.jsx("div", { className: "h-full w-px rounded-full bg-border-primary" }) }), jsxRuntime.jsx(Tooltip.Tooltip, { title: "Left align", children: jsxRuntime.jsx(TextEditorExtensions.TextEditorAlignLeft, {}) }), jsxRuntime.jsx(Tooltip.Tooltip, { title: "Center align", children: jsxRuntime.jsx(TextEditorExtensions.TextEditorAlignCenter, {}) }), jsxRuntime.jsx(Tooltip.Tooltip, { title: "Bullet list", children: jsxRuntime.jsx(TextEditorExtensions.TextEditorBulletList, {}) })] }));
|
|
17
18
|
}
|
|
18
19
|
return (jsxRuntime.jsxs("div", { ref: ref, className: cx.cx('flex w-max flex-col items-start justify-center gap-2 md:flex-row md:items-center md:justify-start md:gap-3', floating && 'rounded-xl bg-primary p-2 shadow-lg ring-1 ring-secondary_alt', className), children: [!floating && (jsxRuntime.jsxs("div", { className: "flex gap-2", children: [jsxRuntime.jsx(TextEditorExtensions.TextEditorFontFamily, {}), !hideFontSize && jsxRuntime.jsx(TextEditorExtensions.TextEditorFontSize, {})] })), jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-0.5 md:flex-nowrap", children: [jsxRuntime.jsx(Tooltip.Tooltip, { title: boldLabel, children: jsxRuntime.jsx(TextEditorExtensions.TextEditorBold, {}) }), jsxRuntime.jsx(Tooltip.Tooltip, { title: italicLabel, children: jsxRuntime.jsx(TextEditorExtensions.TextEditorItalic, {}) }), jsxRuntime.jsx(Tooltip.Tooltip, { title: underlineLabel, children: jsxRuntime.jsx(TextEditorExtensions.TextEditorUnderline, {}) }), jsxRuntime.jsx("div", { className: "p-1.5", children: jsxRuntime.jsx("div", { className: "h-full w-px rounded-full bg-border-primary" }) }), jsxRuntime.jsx(TextEditorExtensions.TextEditorColor, {}), jsxRuntime.jsx("div", { className: "p-1.5", children: jsxRuntime.jsx("div", { className: "h-full w-px rounded-full bg-border-primary" }) }), jsxRuntime.jsx(Tooltip.Tooltip, { title: "Left align", children: jsxRuntime.jsx(TextEditorExtensions.TextEditorAlignLeft, {}) }), jsxRuntime.jsx(Tooltip.Tooltip, { title: "Center align", children: jsxRuntime.jsx(TextEditorExtensions.TextEditorAlignCenter, {}) }), jsxRuntime.jsx(Tooltip.Tooltip, { title: "Bullet list", children: jsxRuntime.jsx(TextEditorExtensions.TextEditorBulletList, {}) }), jsxRuntime.jsx("div", { className: "p-1.5", children: jsxRuntime.jsx("div", { className: "h-full w-px rounded-full bg-border-primary" }) }), jsxRuntime.jsx(Tooltip.Tooltip, { title: linkLabel, children: jsxRuntime.jsx(TextEditorExtensions.TextEditorLink, {}) }), jsxRuntime.jsx(Tooltip.Tooltip, { title: "Insert image", children: jsxRuntime.jsx(TextEditorExtensions.TextEditorImage, {}) }), jsxRuntime.jsx("div", { className: "p-1.5", children: jsxRuntime.jsx("div", { className: "h-full w-px rounded-full bg-border-primary" }) }), jsxRuntime.jsx(Tooltip.Tooltip, { title: "Generate", children: jsxRuntime.jsx(TextEditorExtensions.TextEditorGenerate, {}) })] })] }));
|
|
19
|
-
};
|
|
20
|
+
});
|
|
21
|
+
TextEditorToolbar.displayName = 'TextEditorToolbar';
|
|
20
22
|
|
|
21
23
|
exports.TextEditorToolbar = TextEditorToolbar;
|
|
22
24
|
//# sourceMappingURL=TextEditorToolbar.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEditorToolbar.cjs","sources":["../../../../../src/components/organisms/TextEditor/components/TextEditorToolbar.tsx"],"sourcesContent":[null],"names":["useHotkeyHint","EDITOR_HOTKEY_HINT","_jsxs","cx","_jsx","Tooltip","TextEditorBold","TextEditorItalic","TextEditorUnderline","TextEditorColor","TextEditorAlignLeft","TextEditorAlignCenter","TextEditorBulletList","TextEditorFontFamily","TextEditorFontSize","TextEditorLink","TextEditorImage","TextEditorGenerate"],"mappings":"
|
|
1
|
+
{"version":3,"file":"TextEditorToolbar.cjs","sources":["../../../../../src/components/organisms/TextEditor/components/TextEditorToolbar.tsx"],"sourcesContent":[null],"names":["forwardRef","useHotkeyHint","EDITOR_HOTKEY_HINT","_jsxs","cx","_jsx","Tooltip","TextEditorBold","TextEditorItalic","TextEditorUnderline","TextEditorColor","TextEditorAlignLeft","TextEditorAlignCenter","TextEditorBulletList","TextEditorFontFamily","TextEditorFontSize","TextEditorLink","TextEditorImage","TextEditorGenerate"],"mappings":";;;;;;;;;;MAiCa,iBAAiB,GAAGA,gBAAU,CACzC,CAAC,EAAE,SAAS,EAAE,IAAI,GAAG,QAAQ,EAAE,QAAQ,GAAG,KAAK,EAAE,YAAY,EAAE,EAAE,GAAG,KAAI;IACtE,MAAM,SAAS,GAAG,CAAA,KAAA,EAAQC,2BAAa,CAAC,OAAO,EAAEC,mCAAkB,CAAC,CAAA,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,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export interface TextEditorToolbarProps extends RefAttributes<HTMLDivElement> {
|
|
1
|
+
export interface TextEditorToolbarProps {
|
|
3
2
|
/** Extra classes merged onto the toolbar's root element. */
|
|
4
3
|
className?: string;
|
|
5
4
|
/** `simple` shows text formatting, colour, alignment and lists; `advanced` adds font controls, link, image and generate. */
|
|
@@ -9,5 +8,5 @@ export interface TextEditorToolbarProps extends RefAttributes<HTMLDivElement> {
|
|
|
9
8
|
/** Hides the font size select in the `advanced` toolbar. */
|
|
10
9
|
hideFontSize?: boolean;
|
|
11
10
|
}
|
|
12
|
-
export declare const TextEditorToolbar: (
|
|
11
|
+
export declare const TextEditorToolbar: import("react").ForwardRefExoticComponent<TextEditorToolbarProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
13
12
|
//# sourceMappingURL=TextEditorToolbar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEditorToolbar.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/TextEditor/components/TextEditorToolbar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TextEditorToolbar.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/TextEditor/components/TextEditorToolbar.tsx"],"names":[],"mappings":"AAsBA,MAAM,WAAW,sBAAsB;IACrC,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4HAA4H;IAC5H,IAAI,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC7B,qFAAqF;IACrF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4DAA4D;IAC5D,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,eAAO,MAAM,iBAAiB,mHAuH7B,CAAC"}
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { Tooltip } from '@flipdish/ui-library/components/atoms/Tooltip';
|
|
3
3
|
import { cx } from '@flipdish/ui-library/utilities/cx';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
4
5
|
import { useHotkeyHint } from '../../../../hooks/__internal__/useHotkeyHint/useHotkeyHint.js';
|
|
5
6
|
import { EDITOR_HOTKEY_HINT } from '../textEditor.utils.js';
|
|
6
7
|
import { TextEditorBold, TextEditorItalic, TextEditorUnderline, TextEditorColor, TextEditorAlignLeft, TextEditorAlignCenter, TextEditorBulletList, TextEditorFontFamily, TextEditorFontSize, TextEditorLink, TextEditorImage, TextEditorGenerate } from './TextEditorExtensions.js';
|
|
7
8
|
|
|
8
|
-
const TextEditorToolbar = ({ className,
|
|
9
|
+
const TextEditorToolbar = forwardRef(({ className, type = 'simple', floating = false, hideFontSize }, ref) => {
|
|
9
10
|
const boldLabel = `Bold ${useHotkeyHint('mod+b', EDITOR_HOTKEY_HINT)}`;
|
|
10
11
|
const italicLabel = `Italic ${useHotkeyHint('mod+i', EDITOR_HOTKEY_HINT)}`;
|
|
11
12
|
const underlineLabel = `Underline ${useHotkeyHint('mod+u', EDITOR_HOTKEY_HINT)}`;
|
|
12
13
|
const linkLabel = `Link ${useHotkeyHint('mod+k', EDITOR_HOTKEY_HINT)}`;
|
|
13
14
|
if (type === 'simple') {
|
|
14
|
-
return (jsxs("div", { className: cx('flex w-max flex-wrap gap-0.5 md:flex-nowrap', floating && 'rounded-lg bg-primary p-1 shadow-lg ring-1 ring-secondary_alt', className), children: [jsx(Tooltip, { title: boldLabel, children: jsx(TextEditorBold, {}) }), jsx(Tooltip, { title: italicLabel, children: jsx(TextEditorItalic, {}) }), jsx(Tooltip, { title: underlineLabel, children: jsx(TextEditorUnderline, {}) }), jsx("div", { className: "p-1.5", children: jsx("div", { className: "h-full w-px rounded-full bg-border-primary" }) }), jsx(TextEditorColor, {}), jsx("div", { className: "p-1.5", children: jsx("div", { className: "h-full w-px rounded-full bg-border-primary" }) }), jsx(Tooltip, { title: "Left align", children: jsx(TextEditorAlignLeft, {}) }), jsx(Tooltip, { title: "Center align", children: jsx(TextEditorAlignCenter, {}) }), jsx(Tooltip, { title: "Bullet list", children: jsx(TextEditorBulletList, {}) })] }));
|
|
15
|
+
return (jsxs("div", { ref: ref, className: cx('flex w-max flex-wrap gap-0.5 md:flex-nowrap', floating && 'rounded-lg bg-primary p-1 shadow-lg ring-1 ring-secondary_alt', className), children: [jsx(Tooltip, { title: boldLabel, children: jsx(TextEditorBold, {}) }), jsx(Tooltip, { title: italicLabel, children: jsx(TextEditorItalic, {}) }), jsx(Tooltip, { title: underlineLabel, children: jsx(TextEditorUnderline, {}) }), jsx("div", { className: "p-1.5", children: jsx("div", { className: "h-full w-px rounded-full bg-border-primary" }) }), jsx(TextEditorColor, {}), jsx("div", { className: "p-1.5", children: jsx("div", { className: "h-full w-px rounded-full bg-border-primary" }) }), jsx(Tooltip, { title: "Left align", children: jsx(TextEditorAlignLeft, {}) }), jsx(Tooltip, { title: "Center align", children: jsx(TextEditorAlignCenter, {}) }), jsx(Tooltip, { title: "Bullet list", children: jsx(TextEditorBulletList, {}) })] }));
|
|
15
16
|
}
|
|
16
17
|
return (jsxs("div", { ref: ref, className: cx('flex w-max flex-col items-start justify-center gap-2 md:flex-row md:items-center md:justify-start md:gap-3', floating && 'rounded-xl bg-primary p-2 shadow-lg ring-1 ring-secondary_alt', className), children: [!floating && (jsxs("div", { className: "flex gap-2", children: [jsx(TextEditorFontFamily, {}), !hideFontSize && jsx(TextEditorFontSize, {})] })), jsxs("div", { className: "flex flex-wrap gap-0.5 md:flex-nowrap", children: [jsx(Tooltip, { title: boldLabel, children: jsx(TextEditorBold, {}) }), jsx(Tooltip, { title: italicLabel, children: jsx(TextEditorItalic, {}) }), jsx(Tooltip, { title: underlineLabel, children: jsx(TextEditorUnderline, {}) }), jsx("div", { className: "p-1.5", children: jsx("div", { className: "h-full w-px rounded-full bg-border-primary" }) }), jsx(TextEditorColor, {}), jsx("div", { className: "p-1.5", children: jsx("div", { className: "h-full w-px rounded-full bg-border-primary" }) }), jsx(Tooltip, { title: "Left align", children: jsx(TextEditorAlignLeft, {}) }), jsx(Tooltip, { title: "Center align", children: jsx(TextEditorAlignCenter, {}) }), jsx(Tooltip, { title: "Bullet list", children: jsx(TextEditorBulletList, {}) }), jsx("div", { className: "p-1.5", children: jsx("div", { className: "h-full w-px rounded-full bg-border-primary" }) }), jsx(Tooltip, { title: linkLabel, children: jsx(TextEditorLink, {}) }), jsx(Tooltip, { title: "Insert image", children: jsx(TextEditorImage, {}) }), jsx("div", { className: "p-1.5", children: jsx("div", { className: "h-full w-px rounded-full bg-border-primary" }) }), jsx(Tooltip, { title: "Generate", children: jsx(TextEditorGenerate, {}) })] })] }));
|
|
17
|
-
};
|
|
18
|
+
});
|
|
19
|
+
TextEditorToolbar.displayName = 'TextEditorToolbar';
|
|
18
20
|
|
|
19
21
|
export { TextEditorToolbar };
|
|
20
22
|
//# sourceMappingURL=TextEditorToolbar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEditorToolbar.js","sources":["../../../../../src/components/organisms/TextEditor/components/TextEditorToolbar.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"TextEditorToolbar.js","sources":["../../../../../src/components/organisms/TextEditor/components/TextEditorToolbar.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;MAiCa,iBAAiB,GAAG,UAAU,CACzC,CAAC,EAAE,SAAS,EAAE,IAAI,GAAG,QAAQ,EAAE,QAAQ,GAAG,KAAK,EAAE,YAAY,EAAE,EAAE,GAAG,KAAI;IACtE,MAAM,SAAS,GAAG,CAAA,KAAA,EAAQ,aAAa,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAA,CAAE;IACtE,MAAM,WAAW,GAAG,CAAA,OAAA,EAAU,aAAa,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAA,CAAE;IAC1E,MAAM,cAAc,GAAG,CAAA,UAAA,EAAa,aAAa,CAAC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AA,CAC1D,EAENA,IAAC,OAAO,EAAA,EAAC,KAAK,EAAC,YAAY,EAAA,QAAA,EACzBA,IAAC,mBAAmB,EAAA,EAAA,CAAG,GACf,EACVA,GAAA,CAAC,OAAO,EAAA,EAAC,KAAK,EAAC,cAAc,EAAA,QAAA,EAC3BA,GAAA,CAAC,qBAAqB,EAAA,EAAA,CAAG,EAAA,CACjB,EACVA,GAAA,CAAC,OAAO,IAAC,KAAK,EAAC,aAAa,EAAA,QAAA,EAC1BA,GAAA,CAAC,oBAAoB,KAAG,EAAA,CAChB,EAEVA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,OAAO,YACpBA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,4CAA4C,EAAA,CAAG,EAAA,CAC1D,EAENA,GAAA,CAAC,OAAO,IAAC,KAAK,EAAE,SAAS,EAAA,QAAA,EACvBA,GAAA,CAAC,cAAc,EAAA,EAAA,CAAG,EAAA,CACV,EACVA,IAAC,OAAO,EAAA,EAAC,KAAK,EAAC,cAAc,YAC3BA,GAAA,CAAC,eAAe,EAAA,EAAA,CAAG,EAAA,CACX,EAEVA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,OAAO,YACpBA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,4CAA4C,EAAA,CAAG,EAAA,CAC1D,EAENA,GAAA,CAAC,OAAO,IAAC,KAAK,EAAC,UAAU,EAAA,QAAA,EACvBA,GAAA,CAAC,kBAAkB,KAAG,EAAA,CACd,CAAA,EAAA,CACN,CAAA,EAAA,CACF;AAEV,CAAC;AAEH,iBAAiB,CAAC,WAAW,GAAG,mBAAmB;;"}
|
|
@@ -4,6 +4,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
4
4
|
var Inputs = require('@flipdish/ui-library/components/atoms/Inputs');
|
|
5
5
|
var cx = require('@flipdish/ui-library/utilities/cx');
|
|
6
6
|
var testIdUtils = require('@flipdish/ui-library/utilities/testIdUtils');
|
|
7
|
+
var utils = require('@react-aria/utils');
|
|
7
8
|
var extensionImage = require('@tiptap/extension-image');
|
|
8
9
|
var extensionPlaceholder = require('@tiptap/extension-placeholder');
|
|
9
10
|
var extensionTextAlign = require('@tiptap/extension-text-align');
|
|
@@ -21,7 +22,8 @@ var textEditor_utils = require('./textEditor.utils.cjs');
|
|
|
21
22
|
const getResizeHandleBg = (color) => {
|
|
22
23
|
return `url(data:image/svg+xml;base64,${btoa(`<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10 2L2 10" stroke="${color}" stroke-linecap="round"/><path d="M11 7L7 11" stroke="${color}" stroke-linecap="round"/></svg>`)})`;
|
|
23
24
|
};
|
|
24
|
-
|
|
25
|
+
/** The editor's root; its element only mounts once the editor exists, so the ref stays `null` until then. */
|
|
26
|
+
const TextEditorRoot = React.forwardRef(({ className, inputClassName, children, isInvalid, isDisabled, limit, placeholder = 'Write something...', 'data-testid': dataTestId, ...editorOptions }, ref) => {
|
|
25
27
|
const id = React.useId();
|
|
26
28
|
const editorId = `editor-${id}`;
|
|
27
29
|
const testId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'text-editor', rootName: 'text-editor' });
|
|
@@ -126,20 +128,25 @@ const TextEditorRoot = ({ className, inputClassName, children, isInvalid, isDisa
|
|
|
126
128
|
if (!editor) {
|
|
127
129
|
return null;
|
|
128
130
|
}
|
|
129
|
-
return (jsxRuntime.jsx(testIdUtils.TestIdProvider, { value: testId, children: jsxRuntime.jsx(TextEditor_context.EditorContext.Provider, { value: { editor, isDisabled, limit, isInvalid, editorId }, children: jsxRuntime.jsx("div", { "data-testid": testId, className: cx.cx('flex w-full flex-col gap-3', className), children: children }) }) }));
|
|
130
|
-
};
|
|
131
|
-
|
|
131
|
+
return (jsxRuntime.jsx(testIdUtils.TestIdProvider, { value: testId, children: jsxRuntime.jsx(TextEditor_context.EditorContext.Provider, { value: { editor, isDisabled, limit, isInvalid, editorId }, children: jsxRuntime.jsx("div", { ref: ref, "data-testid": testId, className: cx.cx('flex w-full flex-col gap-3', className), children: children }) }) }));
|
|
132
|
+
});
|
|
133
|
+
TextEditorRoot.displayName = 'TextEditor.Root';
|
|
134
|
+
const TextEditorContent = React.forwardRef(({ innerRef, ...props }, ref) => {
|
|
132
135
|
const { editor, isDisabled } = TextEditor_context.useEditorContext();
|
|
133
136
|
const prefix = testIdUtils.useTestIdPrefix();
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
+
// Tiptap lets `innerRef` replace the forwarded ref, so the two are merged and handed over as one.
|
|
138
|
+
const contentRef = React.useMemo(() => utils.mergeRefs(innerRef, ref), [innerRef, ref]);
|
|
139
|
+
return (jsxRuntime.jsx(react.EditorContent, { disabled: isDisabled, ...props, ref: contentRef, editor: editor, "data-testid": prefix ? testIdUtils.joinTestId(prefix, 'content') : undefined }));
|
|
140
|
+
});
|
|
141
|
+
TextEditorContent.displayName = 'TextEditor.Content';
|
|
142
|
+
const TextEditorLabel = React.forwardRef(({ children, ...props }, ref) => {
|
|
137
143
|
const { editor, editorId } = TextEditor_context.useEditorContext();
|
|
138
144
|
const prefix = testIdUtils.useTestIdPrefix();
|
|
139
|
-
return (jsxRuntime.jsx(Inputs.Label, { ...props, id: `${editorId}-label`, "data-testid": prefix ? testIdUtils.joinTestId(prefix, 'label') : undefined, onClick: () => {
|
|
145
|
+
return (jsxRuntime.jsx(Inputs.Label, { ...props, ref: ref, id: `${editorId}-label`, "data-testid": prefix ? testIdUtils.joinTestId(prefix, 'label') : undefined, onClick: () => {
|
|
140
146
|
editor.chain().focus().run();
|
|
141
147
|
}, children: children }));
|
|
142
|
-
};
|
|
148
|
+
});
|
|
149
|
+
TextEditorLabel.displayName = 'TextEditor.Label';
|
|
143
150
|
const TextEditorHintText = ({ children, ...props }) => {
|
|
144
151
|
const { editor, editorId, limit, isInvalid } = TextEditor_context.useEditorContext();
|
|
145
152
|
const prefix = testIdUtils.useTestIdPrefix();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../../src/components/organisms/TextEditor/index.tsx"],"sourcesContent":[null],"names":["useId","useResolvedTestId","useEditor","StarterKit","isAllowedLinkUri","TextStyleKit","TextAlign","Image","Placeholder","CharacterCount","cx","useEffect","applyLinkEdit","resolveLinkEdit","_jsx","TestIdProvider","EditorContext","useEditorContext","useTestIdPrefix","EditorContent","joinTestId","Label","useEditorState","HintText","TextEditorToolbar","TextEditorTooltip"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/components/organisms/TextEditor/index.tsx"],"sourcesContent":[null],"names":["forwardRef","useId","useResolvedTestId","useEditor","StarterKit","isAllowedLinkUri","TextStyleKit","TextAlign","Image","Placeholder","CharacterCount","cx","useEffect","applyLinkEdit","resolveLinkEdit","_jsx","TestIdProvider","EditorContext","useEditorContext","useTestIdPrefix","useMemo","mergeRefs","EditorContent","joinTestId","Label","useEditorState","HintText","TextEditorToolbar","TextEditorTooltip"],"mappings":";;;;;;;;;;;;;;;;;;;;AAwBA;AACA,MAAM,iBAAiB,GAAG,CAAC,KAAa,KAAI;IAC1C,OAAO,CAAA,8BAAA,EAAiC,IAAI,CAAC,CAAA,4HAAA,EAA+H,KAAK,0DAA0D,KAAK,CAAA,gCAAA,CAAkC,CAAC,CAAA,CAAA,CAAG;AACxR,CAAC;AAcD;AACA,MAAM,cAAc,GAAGA,gBAAU,CAC/B,CACE,EACE,SAAS,EACT,cAAc,EACd,QAAQ,EACR,SAAS,EACT,UAAU,EACV,KAAK,EACL,WAAW,GAAG,oBAAoB,EAClC,aAAa,EAAE,UAAU,EACzB,GAAG,aAAa,EACjB,EACD,GAAG,KACD;AACF,IAAA,MAAM,EAAE,GAAGC,WAAK,EAAE;AAClB,IAAA,MAAM,QAAQ,GAAG,CAAA,OAAA,EAAU,EAAE,EAAE;AAC/B,IAAA,MAAM,MAAM,GAAGC,6BAAiB,CAAC,EAAE,MAAM,EAAE,UA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
+
import type { ComponentPropsWithoutRef, HTMLAttributes, ReactNode } from 'react';
|
|
4
4
|
export { useEditorContext } from './providers/TextEditor.context';
|
|
5
5
|
interface TextEditorRootProps extends Partial<EditorOptions> {
|
|
6
6
|
className?: string;
|
|
@@ -10,14 +10,12 @@ interface TextEditorRootProps extends Partial<EditorOptions> {
|
|
|
10
10
|
isInvalid?: boolean;
|
|
11
11
|
children?: ReactNode;
|
|
12
12
|
inputClassName?: string;
|
|
13
|
-
ref?: Ref<HTMLDivElement>;
|
|
14
13
|
/** Overrides the root `data-testid` (defaults to `fd-text-editor`). */
|
|
15
14
|
'data-testid'?: string;
|
|
16
15
|
}
|
|
17
|
-
interface TextEditorContentProps extends Omit<EditorContentProps, 'editor'> {
|
|
18
|
-
ref?: Ref<HTMLDivElement>;
|
|
16
|
+
interface TextEditorContentProps extends Omit<EditorContentProps, 'editor' | 'ref'> {
|
|
19
17
|
}
|
|
20
|
-
interface TextEditorLabelProps extends
|
|
18
|
+
interface TextEditorLabelProps extends ComponentPropsWithoutRef<typeof Label> {
|
|
21
19
|
}
|
|
22
20
|
interface TextEditorHintTextProps extends HTMLAttributes<HTMLElement> {
|
|
23
21
|
}
|
|
@@ -28,11 +26,11 @@ interface TextEditorHintTextProps extends HTMLAttributes<HTMLElement> {
|
|
|
28
26
|
* @summary rich-text editor with a formatting toolbar
|
|
29
27
|
*/
|
|
30
28
|
export declare const TextEditor: {
|
|
31
|
-
Root: (
|
|
32
|
-
Toolbar: (
|
|
29
|
+
Root: import("react").ForwardRefExoticComponent<TextEditorRootProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
30
|
+
Toolbar: import("react").ForwardRefExoticComponent<import("./components/TextEditorToolbar").TextEditorToolbarProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
33
31
|
Tooltip: ({ className, theme }: import("./components/TextEditorTooltip").TextEditorTooltipProps) => import("react").JSX.Element;
|
|
34
|
-
Content: (
|
|
35
|
-
Label: (
|
|
32
|
+
Content: import("react").ForwardRefExoticComponent<TextEditorContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
33
|
+
Label: import("react").ForwardRefExoticComponent<TextEditorLabelProps & import("react").RefAttributes<HTMLLabelElement>>;
|
|
36
34
|
HintText: ({ children, ...props }: TextEditorHintTextProps) => import("react").JSX.Element | null;
|
|
37
35
|
};
|
|
38
36
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/organisms/TextEditor/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,EAAE,MAAM,8CAA8C,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/organisms/TextEditor/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,EAAE,MAAM,8CAA8C,CAAC;AAQ/E,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGvE,OAAO,KAAK,EAAE,wBAAwB,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AASjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAOlE,UAAU,mBAAoB,SAAQ,OAAO,CAAC,aAAa,CAAC;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uEAAuE;IACvE,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAsJD,UAAU,sBAAuB,SAAQ,IAAI,CAAC,kBAAkB,EAAE,QAAQ,GAAG,KAAK,CAAC;CAAG;AAoBtF,UAAU,oBAAqB,SAAQ,wBAAwB,CAAC,OAAO,KAAK,CAAC;CAAG;AAsBhF,UAAU,uBAAwB,SAAQ,cAAc,CAAC,WAAW,CAAC;CAAG;AAmCxE;;;;;GAKG;AACH,eAAO,MAAM,UAAU;;;;;;uCAvC6B,uBAAuB;CA8C1E,CAAC"}
|
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { Label, HintText } from '@flipdish/ui-library/components/atoms/Inputs';
|
|
3
3
|
import { cx } from '@flipdish/ui-library/utilities/cx';
|
|
4
|
-
import {
|
|
4
|
+
import { useResolvedTestId, TestIdProvider, useTestIdPrefix, joinTestId } from '@flipdish/ui-library/utilities/testIdUtils';
|
|
5
|
+
import { mergeRefs } from '@react-aria/utils';
|
|
5
6
|
import { Image } from '@tiptap/extension-image';
|
|
6
7
|
import { Placeholder } from '@tiptap/extension-placeholder';
|
|
7
8
|
import { TextAlign } from '@tiptap/extension-text-align';
|
|
8
9
|
import { TextStyleKit } from '@tiptap/extension-text-style';
|
|
9
|
-
import {
|
|
10
|
+
import { useEditor, EditorContent, useEditorState } from '@tiptap/react';
|
|
10
11
|
import { StarterKit } from '@tiptap/starter-kit';
|
|
11
|
-
import { useId, useEffect } from 'react';
|
|
12
|
+
import { forwardRef, useId, useEffect, useMemo } from 'react';
|
|
12
13
|
import { CharacterCount } from './components/TextEditorCharacterCount.js';
|
|
13
14
|
import { TextEditorToolbar } from './components/TextEditorToolbar.js';
|
|
14
15
|
import { TextEditorTooltip } from './components/TextEditorTooltip.js';
|
|
15
|
-
import {
|
|
16
|
+
import { EditorContext, useEditorContext } from './providers/TextEditor.context.js';
|
|
16
17
|
import { isAllowedLinkUri, applyLinkEdit, resolveLinkEdit } from './textEditor.utils.js';
|
|
17
18
|
|
|
18
19
|
// Creates a data URL for an SVG resize handle with a given color.
|
|
19
20
|
const getResizeHandleBg = (color) => {
|
|
20
21
|
return `url(data:image/svg+xml;base64,${btoa(`<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10 2L2 10" stroke="${color}" stroke-linecap="round"/><path d="M11 7L7 11" stroke="${color}" stroke-linecap="round"/></svg>`)})`;
|
|
21
22
|
};
|
|
22
|
-
|
|
23
|
+
/** The editor's root; its element only mounts once the editor exists, so the ref stays `null` until then. */
|
|
24
|
+
const TextEditorRoot = forwardRef(({ className, inputClassName, children, isInvalid, isDisabled, limit, placeholder = 'Write something...', 'data-testid': dataTestId, ...editorOptions }, ref) => {
|
|
23
25
|
const id = useId();
|
|
24
26
|
const editorId = `editor-${id}`;
|
|
25
27
|
const testId = useResolvedTestId({ testId: dataTestId, segment: 'text-editor', rootName: 'text-editor' });
|
|
@@ -124,20 +126,25 @@ const TextEditorRoot = ({ className, inputClassName, children, isInvalid, isDisa
|
|
|
124
126
|
if (!editor) {
|
|
125
127
|
return null;
|
|
126
128
|
}
|
|
127
|
-
return (jsx(TestIdProvider, { value: testId, children: jsx(EditorContext.Provider, { value: { editor, isDisabled, limit, isInvalid, editorId }, children: jsx("div", { "data-testid": testId, className: cx('flex w-full flex-col gap-3', className), children: children }) }) }));
|
|
128
|
-
};
|
|
129
|
-
|
|
129
|
+
return (jsx(TestIdProvider, { value: testId, children: jsx(EditorContext.Provider, { value: { editor, isDisabled, limit, isInvalid, editorId }, children: jsx("div", { ref: ref, "data-testid": testId, className: cx('flex w-full flex-col gap-3', className), children: children }) }) }));
|
|
130
|
+
});
|
|
131
|
+
TextEditorRoot.displayName = 'TextEditor.Root';
|
|
132
|
+
const TextEditorContent = forwardRef(({ innerRef, ...props }, ref) => {
|
|
130
133
|
const { editor, isDisabled } = useEditorContext();
|
|
131
134
|
const prefix = useTestIdPrefix();
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
+
// Tiptap lets `innerRef` replace the forwarded ref, so the two are merged and handed over as one.
|
|
136
|
+
const contentRef = useMemo(() => mergeRefs(innerRef, ref), [innerRef, ref]);
|
|
137
|
+
return (jsx(EditorContent, { disabled: isDisabled, ...props, ref: contentRef, editor: editor, "data-testid": prefix ? joinTestId(prefix, 'content') : undefined }));
|
|
138
|
+
});
|
|
139
|
+
TextEditorContent.displayName = 'TextEditor.Content';
|
|
140
|
+
const TextEditorLabel = forwardRef(({ children, ...props }, ref) => {
|
|
135
141
|
const { editor, editorId } = useEditorContext();
|
|
136
142
|
const prefix = useTestIdPrefix();
|
|
137
|
-
return (jsx(Label, { ...props, id: `${editorId}-label`, "data-testid": prefix ? joinTestId(prefix, 'label') : undefined, onClick: () => {
|
|
143
|
+
return (jsx(Label, { ...props, ref: ref, id: `${editorId}-label`, "data-testid": prefix ? joinTestId(prefix, 'label') : undefined, onClick: () => {
|
|
138
144
|
editor.chain().focus().run();
|
|
139
145
|
}, children: children }));
|
|
140
|
-
};
|
|
146
|
+
});
|
|
147
|
+
TextEditorLabel.displayName = 'TextEditor.Label';
|
|
141
148
|
const TextEditorHintText = ({ children, ...props }) => {
|
|
142
149
|
const { editor, editorId, limit, isInvalid } = useEditorContext();
|
|
143
150
|
const prefix = useTestIdPrefix();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/organisms/TextEditor/index.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/organisms/TextEditor/index.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;;;;;;;;;;;;;;;;AAwBA;AACA,MAAM,iBAAiB,GAAG,CAAC,KAAa,KAAI;IAC1C,OAAO,CAAA,8BAAA,EAAiC,IAAI,CAAC,CAAA,4HAAA,EAA+H,KAAK,0DAA0D,KAAK,CAAA,gCAAA,CAAkC,CAAC,CAAA,CAAA,CAAG;AACxR,CAAC;AAcD;AACA,MAAM,cAAc,GAAG,UAAU,CAC/B,CACE,EACE,SAAS,EACT,cAAc,EACd,QAAQ,EACR,SAAS,EACT,UAAU,EACV,KAAK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e;AACtB,IAAA,QAAQ,EAAE,kBAAkB;;;"}
|
|
@@ -17,7 +17,7 @@ var videoPlayer_utils = require('./videoPlayer.utils.cjs');
|
|
|
17
17
|
*
|
|
18
18
|
* @summary inline video player with hover-revealed controls
|
|
19
19
|
*/
|
|
20
|
-
const VideoPlayer = ({ src, type = 'video/mp4', autoPlay = false, thumbnailUrl, thumbnailAlt, showThumbnailOverlay, className, thumbnailButtonClassName, size = 'md',
|
|
20
|
+
const VideoPlayer = React.forwardRef(({ src, type = 'video/mp4', autoPlay = false, thumbnailUrl, thumbnailAlt, showThumbnailOverlay, className, thumbnailButtonClassName, size = 'md', 'data-testid': dataTestId, }, ref) => {
|
|
21
21
|
const testId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'video-player', rootName: 'video-player' });
|
|
22
22
|
const videoRef = React.useRef(null);
|
|
23
23
|
const containerRef = React.useRef(null);
|
|
@@ -54,7 +54,8 @@ const VideoPlayer = ({ src, type = 'video/mp4', autoPlay = false, thumbnailUrl,
|
|
|
54
54
|
left: hoverPosition || 0,
|
|
55
55
|
transition: 'opacity .3s cubic-bezier(0.4, 0, 0.6, 1), transform .3s cubic-bezier(0.4, 0, 0.6, 1), translate .3s cubic-bezier(0.4, 0, 0.6, 1)',
|
|
56
56
|
}, children: canShowTrickPlayTime ? formatTime(hoverTime) : '' })] }) }), jsxRuntime.jsxs("span", { className: "pointer-events-none text-xs font-semibold text-white", children: ["-", formatTime(duration - currentTime)] })] }), size === 'lg' && (jsxRuntime.jsxs(VideoPlayerButton, { tooltipPlacement: "top", tooltipTitle: "Playback speed", tooltipDescription: "\u2190 \u2192", tabIndex: -1, onClick: toggleSpeed, "aria-label": `Change playback speed. Current speed: ${playbackRate}x`, "data-testid": testIdUtils.joinTestId(testId, 'speed'), className: "flex items-center", children: [jsxRuntime.jsx("span", { className: "text-xs font-semibold", children: playbackRate }), jsxRuntime.jsx("svg", { viewBox: "0 0 8 8", fill: "none", className: "mt-0.5 size-2", children: jsxRuntime.jsx("path", { d: "M6 2L2 6M2 2L6 6", stroke: "white", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })] })), jsxRuntime.jsx(VideoPlayerButton, { tooltipPlacement: "top end", crossOffset: 16, tooltipTitle: isFullscreen ? 'Minimize' : 'Fullscreen', tooltipDescription: isFullscreen ? 'Escape' : 'F', tabIndex: -1, onClick: toggleFullscreen, "aria-label": isFullscreen ? 'Exit fullscreen' : 'Enter fullscreen', "data-testid": testIdUtils.joinTestId(testId, 'fullscreen'), children: isFullscreen ? jsxRuntime.jsx(uiIcons.Minimize01, { className: "size-4" }) : jsxRuntime.jsx(uiIcons.Maximize01, { className: "size-4" }) })] }) })] }));
|
|
57
|
-
};
|
|
57
|
+
});
|
|
58
|
+
VideoPlayer.displayName = 'VideoPlayer';
|
|
58
59
|
const VideoPlayerButton = ({ children, tooltipPlacement = 'top', tooltipTitle, tooltipDescription, crossOffset, 'data-testid': dataTestId, ...props }) => {
|
|
59
60
|
return (jsxRuntime.jsxs(reactAriaComponents.TooltipTrigger, { delay: 350, closeDelay: 0, children: [jsxRuntime.jsx(reactAriaComponents.Focusable, { children: jsxRuntime.jsx("button", { ...props, className: cx.cx('flex h-8 min-w-8 cursor-pointer items-center justify-center rounded-md p-2 text-white outline-hidden transition duration-100 ease-linear before:absolute before:size-6 hover:bg-alpha-white/20 hover:backdrop-blur-sm focus-visible:outline-offset-2 focus-visible:outline-white', props.className), "data-testid": dataTestId, children: children }) }), jsxRuntime.jsxs(reactAriaComponents.Tooltip, { offset: 8, placement: tooltipPlacement, crossOffset: crossOffset, className: ({ isEntering, isExiting }) => cx.cx('dark-mode pointer-events-none flex gap-1.5 rounded-lg bg-alpha-white/20 p-1 pl-2 shadow-lg ring-1 ring-alpha-white/10 backdrop-blur-sm ring-inset', isEntering && 'origin-bottom ease-out animate-in fade-in slide-in-from-bottom-0.5 zoom-in-95', isExiting && 'origin-bottom ease-in animate-out fade-out slide-out-to-bottom-0.5 zoom-out-95'), children: [jsxRuntime.jsx("div", { className: "text-sm font-semibold text-white", children: tooltipTitle }), jsxRuntime.jsx("div", { className: "rounded bg-alpha-white/30 px-[3px] py-[1px] font-sans text-xs font-semibold text-white shadow-xs ring-1 ring-alpha-white/10 ring-inset", children: tooltipDescription })] })] }));
|
|
60
61
|
};
|