@bacon-pos/ui 0.1.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/LICENSE +21 -0
- package/README.md +236 -0
- package/lib/commonjs/components/Avatar/Avatar.js +96 -0
- package/lib/commonjs/components/Avatar/Avatar.js.map +1 -0
- package/lib/commonjs/components/Avatar/Avatar.stories.js +87 -0
- package/lib/commonjs/components/Avatar/Avatar.stories.js.map +1 -0
- package/lib/commonjs/components/Avatar/Avatar.test.js +63 -0
- package/lib/commonjs/components/Avatar/Avatar.test.js.map +1 -0
- package/lib/commonjs/components/Avatar/index.js +13 -0
- package/lib/commonjs/components/Avatar/index.js.map +1 -0
- package/lib/commonjs/components/Button/Button.js +201 -0
- package/lib/commonjs/components/Button/Button.js.map +1 -0
- package/lib/commonjs/components/Button/Button.stories.js +139 -0
- package/lib/commonjs/components/Button/Button.stories.js.map +1 -0
- package/lib/commonjs/components/Button/Button.test.js +64 -0
- package/lib/commonjs/components/Button/Button.test.js.map +1 -0
- package/lib/commonjs/components/Button/index.js +13 -0
- package/lib/commonjs/components/Button/index.js.map +1 -0
- package/lib/commonjs/components/Card/Card.js +129 -0
- package/lib/commonjs/components/Card/Card.js.map +1 -0
- package/lib/commonjs/components/Card/Card.stories.js +87 -0
- package/lib/commonjs/components/Card/Card.stories.js.map +1 -0
- package/lib/commonjs/components/Card/Card.test.js +51 -0
- package/lib/commonjs/components/Card/Card.test.js.map +1 -0
- package/lib/commonjs/components/Card/index.js +13 -0
- package/lib/commonjs/components/Card/index.js.map +1 -0
- package/lib/commonjs/components/Checkbox/Checkbox.js +75 -0
- package/lib/commonjs/components/Checkbox/Checkbox.js.map +1 -0
- package/lib/commonjs/components/Checkbox/Checkbox.stories.js +69 -0
- package/lib/commonjs/components/Checkbox/Checkbox.stories.js.map +1 -0
- package/lib/commonjs/components/Checkbox/Checkbox.test.js +62 -0
- package/lib/commonjs/components/Checkbox/Checkbox.test.js.map +1 -0
- package/lib/commonjs/components/Checkbox/index.js +13 -0
- package/lib/commonjs/components/Checkbox/index.js.map +1 -0
- package/lib/commonjs/components/Chip/Chip.js +119 -0
- package/lib/commonjs/components/Chip/Chip.js.map +1 -0
- package/lib/commonjs/components/Chip/Chip.stories.js +112 -0
- package/lib/commonjs/components/Chip/Chip.stories.js.map +1 -0
- package/lib/commonjs/components/Chip/Chip.test.js +63 -0
- package/lib/commonjs/components/Chip/Chip.test.js.map +1 -0
- package/lib/commonjs/components/Chip/ChipGroup.js +54 -0
- package/lib/commonjs/components/Chip/ChipGroup.js.map +1 -0
- package/lib/commonjs/components/Chip/ChipGroup.stories.js +78 -0
- package/lib/commonjs/components/Chip/ChipGroup.stories.js.map +1 -0
- package/lib/commonjs/components/Chip/ChipGroup.test.js +70 -0
- package/lib/commonjs/components/Chip/ChipGroup.test.js.map +1 -0
- package/lib/commonjs/components/Chip/index.js +20 -0
- package/lib/commonjs/components/Chip/index.js.map +1 -0
- package/lib/commonjs/components/CodeInput/CodeInput.js +163 -0
- package/lib/commonjs/components/CodeInput/CodeInput.js.map +1 -0
- package/lib/commonjs/components/CodeInput/CodeInput.stories.js +98 -0
- package/lib/commonjs/components/CodeInput/CodeInput.stories.js.map +1 -0
- package/lib/commonjs/components/CodeInput/CodeInput.test.js +74 -0
- package/lib/commonjs/components/CodeInput/CodeInput.test.js.map +1 -0
- package/lib/commonjs/components/CodeInput/index.js +13 -0
- package/lib/commonjs/components/CodeInput/index.js.map +1 -0
- package/lib/commonjs/components/Icon/Icon.js +32 -0
- package/lib/commonjs/components/Icon/Icon.js.map +1 -0
- package/lib/commonjs/components/Icon/Icon.stories.js +94 -0
- package/lib/commonjs/components/Icon/Icon.stories.js.map +1 -0
- package/lib/commonjs/components/Icon/Icon.test.js +38 -0
- package/lib/commonjs/components/Icon/Icon.test.js.map +1 -0
- package/lib/commonjs/components/Icon/icons.generated.js +179 -0
- package/lib/commonjs/components/Icon/icons.generated.js.map +1 -0
- package/lib/commonjs/components/Icon/index.js +20 -0
- package/lib/commonjs/components/Icon/index.js.map +1 -0
- package/lib/commonjs/components/IconButton/IconButton.js +139 -0
- package/lib/commonjs/components/IconButton/IconButton.js.map +1 -0
- package/lib/commonjs/components/IconButton/IconButton.stories.js +119 -0
- package/lib/commonjs/components/IconButton/IconButton.stories.js.map +1 -0
- package/lib/commonjs/components/IconButton/IconButton.test.js +55 -0
- package/lib/commonjs/components/IconButton/IconButton.test.js.map +1 -0
- package/lib/commonjs/components/IconButton/index.js +13 -0
- package/lib/commonjs/components/IconButton/index.js.map +1 -0
- package/lib/commonjs/components/Input/Input.js +176 -0
- package/lib/commonjs/components/Input/Input.js.map +1 -0
- package/lib/commonjs/components/Input/Input.stories.js +116 -0
- package/lib/commonjs/components/Input/Input.stories.js.map +1 -0
- package/lib/commonjs/components/Input/Input.test.js +103 -0
- package/lib/commonjs/components/Input/Input.test.js.map +1 -0
- package/lib/commonjs/components/Input/index.js +13 -0
- package/lib/commonjs/components/Input/index.js.map +1 -0
- package/lib/commonjs/components/LinkButton/LinkButton.js +95 -0
- package/lib/commonjs/components/LinkButton/LinkButton.js.map +1 -0
- package/lib/commonjs/components/LinkButton/LinkButton.stories.js +91 -0
- package/lib/commonjs/components/LinkButton/LinkButton.stories.js.map +1 -0
- package/lib/commonjs/components/LinkButton/LinkButton.test.js +61 -0
- package/lib/commonjs/components/LinkButton/LinkButton.test.js.map +1 -0
- package/lib/commonjs/components/LinkButton/index.js +13 -0
- package/lib/commonjs/components/LinkButton/index.js.map +1 -0
- package/lib/commonjs/components/ProductCard/ProductCard.js +167 -0
- package/lib/commonjs/components/ProductCard/ProductCard.js.map +1 -0
- package/lib/commonjs/components/ProductCard/ProductCard.stories.js +118 -0
- package/lib/commonjs/components/ProductCard/ProductCard.stories.js.map +1 -0
- package/lib/commonjs/components/ProductCard/ProductCard.test.js +69 -0
- package/lib/commonjs/components/ProductCard/ProductCard.test.js.map +1 -0
- package/lib/commonjs/components/ProductCard/index.js +13 -0
- package/lib/commonjs/components/ProductCard/index.js.map +1 -0
- package/lib/commonjs/components/QuantityStepper/QuantityStepper.js +135 -0
- package/lib/commonjs/components/QuantityStepper/QuantityStepper.js.map +1 -0
- package/lib/commonjs/components/QuantityStepper/QuantityStepper.stories.js +90 -0
- package/lib/commonjs/components/QuantityStepper/QuantityStepper.stories.js.map +1 -0
- package/lib/commonjs/components/QuantityStepper/QuantityStepper.test.js +100 -0
- package/lib/commonjs/components/QuantityStepper/QuantityStepper.test.js.map +1 -0
- package/lib/commonjs/components/QuantityStepper/index.js +13 -0
- package/lib/commonjs/components/QuantityStepper/index.js.map +1 -0
- package/lib/commonjs/components/Radio/Radio.js +59 -0
- package/lib/commonjs/components/Radio/Radio.js.map +1 -0
- package/lib/commonjs/components/Radio/Radio.stories.js +60 -0
- package/lib/commonjs/components/Radio/Radio.stories.js.map +1 -0
- package/lib/commonjs/components/Radio/Radio.test.js +46 -0
- package/lib/commonjs/components/Radio/Radio.test.js.map +1 -0
- package/lib/commonjs/components/Radio/index.js +13 -0
- package/lib/commonjs/components/Radio/index.js.map +1 -0
- package/lib/commonjs/components/Surface/Surface.js +84 -0
- package/lib/commonjs/components/Surface/Surface.js.map +1 -0
- package/lib/commonjs/components/Surface/Surface.stories.js +97 -0
- package/lib/commonjs/components/Surface/Surface.stories.js.map +1 -0
- package/lib/commonjs/components/Surface/Surface.test.js +58 -0
- package/lib/commonjs/components/Surface/Surface.test.js.map +1 -0
- package/lib/commonjs/components/Surface/index.js +13 -0
- package/lib/commonjs/components/Surface/index.js.map +1 -0
- package/lib/commonjs/components/Switch/Switch.js +109 -0
- package/lib/commonjs/components/Switch/Switch.js.map +1 -0
- package/lib/commonjs/components/Switch/Switch.stories.js +89 -0
- package/lib/commonjs/components/Switch/Switch.stories.js.map +1 -0
- package/lib/commonjs/components/Switch/Switch.test.js +46 -0
- package/lib/commonjs/components/Switch/Switch.test.js.map +1 -0
- package/lib/commonjs/components/Switch/index.js +13 -0
- package/lib/commonjs/components/Switch/index.js.map +1 -0
- package/lib/commonjs/components/Text/Text.js +39 -0
- package/lib/commonjs/components/Text/Text.js.map +1 -0
- package/lib/commonjs/components/Text/Text.stories.js +47 -0
- package/lib/commonjs/components/Text/Text.stories.js.map +1 -0
- package/lib/commonjs/components/Text/index.js +13 -0
- package/lib/commonjs/components/Text/index.js.map +1 -0
- package/lib/commonjs/components/_internal/Labeled.js +50 -0
- package/lib/commonjs/components/_internal/Labeled.js.map +1 -0
- package/lib/commonjs/components/brand/Flag.js +45 -0
- package/lib/commonjs/components/brand/Flag.js.map +1 -0
- package/lib/commonjs/components/brand/Flag.stories.js +59 -0
- package/lib/commonjs/components/brand/Flag.stories.js.map +1 -0
- package/lib/commonjs/components/brand/Logo.js +30 -0
- package/lib/commonjs/components/brand/Logo.js.map +1 -0
- package/lib/commonjs/components/brand/Logo.stories.js +59 -0
- package/lib/commonjs/components/brand/Logo.stories.js.map +1 -0
- package/lib/commonjs/components/brand/brand.test.js +39 -0
- package/lib/commonjs/components/brand/brand.test.js.map +1 -0
- package/lib/commonjs/components/brand/generated/FlagBr.js +95 -0
- package/lib/commonjs/components/brand/generated/FlagBr.js.map +1 -0
- package/lib/commonjs/components/brand/generated/FlagUs.js +82 -0
- package/lib/commonjs/components/brand/generated/FlagUs.js.map +1 -0
- package/lib/commonjs/components/brand/generated/Mastercard.js +42 -0
- package/lib/commonjs/components/brand/generated/Mastercard.js.map +1 -0
- package/lib/commonjs/components/brand/generated/Visa.js +99 -0
- package/lib/commonjs/components/brand/generated/Visa.js.map +1 -0
- package/lib/commonjs/components/brand/index.js +27 -0
- package/lib/commonjs/components/brand/index.js.map +1 -0
- package/lib/commonjs/components/brand/registry.js +36 -0
- package/lib/commonjs/components/brand/registry.js.map +1 -0
- package/lib/commonjs/components/index.js +193 -0
- package/lib/commonjs/components/index.js.map +1 -0
- package/lib/commonjs/index.js +28 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/theme/ThemeProvider.js +52 -0
- package/lib/commonjs/theme/ThemeProvider.js.map +1 -0
- package/lib/commonjs/theme/ThemeProvider.test.js +65 -0
- package/lib/commonjs/theme/ThemeProvider.test.js.map +1 -0
- package/lib/commonjs/theme/index.js +101 -0
- package/lib/commonjs/theme/index.js.map +1 -0
- package/lib/commonjs/theme/palette.js +94 -0
- package/lib/commonjs/theme/palette.js.map +1 -0
- package/lib/commonjs/theme/spacing.js +39 -0
- package/lib/commonjs/theme/spacing.js.map +1 -0
- package/lib/commonjs/theme/themes.js +171 -0
- package/lib/commonjs/theme/themes.js.map +1 -0
- package/lib/commonjs/theme/typography.js +65 -0
- package/lib/commonjs/theme/typography.js.map +1 -0
- package/lib/module/components/Avatar/Avatar.js +92 -0
- package/lib/module/components/Avatar/Avatar.js.map +1 -0
- package/lib/module/components/Avatar/Avatar.stories.js +83 -0
- package/lib/module/components/Avatar/Avatar.stories.js.map +1 -0
- package/lib/module/components/Avatar/Avatar.test.js +62 -0
- package/lib/module/components/Avatar/Avatar.test.js.map +1 -0
- package/lib/module/components/Avatar/index.js +4 -0
- package/lib/module/components/Avatar/index.js.map +1 -0
- package/lib/module/components/Button/Button.js +197 -0
- package/lib/module/components/Button/Button.js.map +1 -0
- package/lib/module/components/Button/Button.stories.js +135 -0
- package/lib/module/components/Button/Button.stories.js.map +1 -0
- package/lib/module/components/Button/Button.test.js +63 -0
- package/lib/module/components/Button/Button.test.js.map +1 -0
- package/lib/module/components/Button/index.js +4 -0
- package/lib/module/components/Button/index.js.map +1 -0
- package/lib/module/components/Card/Card.js +125 -0
- package/lib/module/components/Card/Card.js.map +1 -0
- package/lib/module/components/Card/Card.stories.js +83 -0
- package/lib/module/components/Card/Card.stories.js.map +1 -0
- package/lib/module/components/Card/Card.test.js +50 -0
- package/lib/module/components/Card/Card.test.js.map +1 -0
- package/lib/module/components/Card/index.js +4 -0
- package/lib/module/components/Card/index.js.map +1 -0
- package/lib/module/components/Checkbox/Checkbox.js +71 -0
- package/lib/module/components/Checkbox/Checkbox.js.map +1 -0
- package/lib/module/components/Checkbox/Checkbox.stories.js +65 -0
- package/lib/module/components/Checkbox/Checkbox.stories.js.map +1 -0
- package/lib/module/components/Checkbox/Checkbox.test.js +61 -0
- package/lib/module/components/Checkbox/Checkbox.test.js.map +1 -0
- package/lib/module/components/Checkbox/index.js +4 -0
- package/lib/module/components/Checkbox/index.js.map +1 -0
- package/lib/module/components/Chip/Chip.js +115 -0
- package/lib/module/components/Chip/Chip.js.map +1 -0
- package/lib/module/components/Chip/Chip.stories.js +108 -0
- package/lib/module/components/Chip/Chip.stories.js.map +1 -0
- package/lib/module/components/Chip/Chip.test.js +62 -0
- package/lib/module/components/Chip/Chip.test.js.map +1 -0
- package/lib/module/components/Chip/ChipGroup.js +50 -0
- package/lib/module/components/Chip/ChipGroup.js.map +1 -0
- package/lib/module/components/Chip/ChipGroup.stories.js +74 -0
- package/lib/module/components/Chip/ChipGroup.stories.js.map +1 -0
- package/lib/module/components/Chip/ChipGroup.test.js +69 -0
- package/lib/module/components/Chip/ChipGroup.test.js.map +1 -0
- package/lib/module/components/Chip/index.js +5 -0
- package/lib/module/components/Chip/index.js.map +1 -0
- package/lib/module/components/CodeInput/CodeInput.js +161 -0
- package/lib/module/components/CodeInput/CodeInput.js.map +1 -0
- package/lib/module/components/CodeInput/CodeInput.stories.js +94 -0
- package/lib/module/components/CodeInput/CodeInput.stories.js.map +1 -0
- package/lib/module/components/CodeInput/CodeInput.test.js +73 -0
- package/lib/module/components/CodeInput/CodeInput.test.js.map +1 -0
- package/lib/module/components/CodeInput/index.js +4 -0
- package/lib/module/components/CodeInput/index.js.map +1 -0
- package/lib/module/components/Icon/Icon.js +28 -0
- package/lib/module/components/Icon/Icon.js.map +1 -0
- package/lib/module/components/Icon/Icon.stories.js +90 -0
- package/lib/module/components/Icon/Icon.stories.js.map +1 -0
- package/lib/module/components/Icon/Icon.test.js +37 -0
- package/lib/module/components/Icon/Icon.test.js.map +1 -0
- package/lib/module/components/Icon/icons.generated.js +175 -0
- package/lib/module/components/Icon/icons.generated.js.map +1 -0
- package/lib/module/components/Icon/index.js +5 -0
- package/lib/module/components/Icon/index.js.map +1 -0
- package/lib/module/components/IconButton/IconButton.js +135 -0
- package/lib/module/components/IconButton/IconButton.js.map +1 -0
- package/lib/module/components/IconButton/IconButton.stories.js +115 -0
- package/lib/module/components/IconButton/IconButton.stories.js.map +1 -0
- package/lib/module/components/IconButton/IconButton.test.js +54 -0
- package/lib/module/components/IconButton/IconButton.test.js.map +1 -0
- package/lib/module/components/IconButton/index.js +4 -0
- package/lib/module/components/IconButton/index.js.map +1 -0
- package/lib/module/components/Input/Input.js +174 -0
- package/lib/module/components/Input/Input.js.map +1 -0
- package/lib/module/components/Input/Input.stories.js +112 -0
- package/lib/module/components/Input/Input.stories.js.map +1 -0
- package/lib/module/components/Input/Input.test.js +103 -0
- package/lib/module/components/Input/Input.test.js.map +1 -0
- package/lib/module/components/Input/index.js +4 -0
- package/lib/module/components/Input/index.js.map +1 -0
- package/lib/module/components/LinkButton/LinkButton.js +91 -0
- package/lib/module/components/LinkButton/LinkButton.js.map +1 -0
- package/lib/module/components/LinkButton/LinkButton.stories.js +87 -0
- package/lib/module/components/LinkButton/LinkButton.stories.js.map +1 -0
- package/lib/module/components/LinkButton/LinkButton.test.js +60 -0
- package/lib/module/components/LinkButton/LinkButton.test.js.map +1 -0
- package/lib/module/components/LinkButton/index.js +4 -0
- package/lib/module/components/LinkButton/index.js.map +1 -0
- package/lib/module/components/ProductCard/ProductCard.js +163 -0
- package/lib/module/components/ProductCard/ProductCard.js.map +1 -0
- package/lib/module/components/ProductCard/ProductCard.stories.js +114 -0
- package/lib/module/components/ProductCard/ProductCard.stories.js.map +1 -0
- package/lib/module/components/ProductCard/ProductCard.test.js +68 -0
- package/lib/module/components/ProductCard/ProductCard.test.js.map +1 -0
- package/lib/module/components/ProductCard/index.js +4 -0
- package/lib/module/components/ProductCard/index.js.map +1 -0
- package/lib/module/components/QuantityStepper/QuantityStepper.js +131 -0
- package/lib/module/components/QuantityStepper/QuantityStepper.js.map +1 -0
- package/lib/module/components/QuantityStepper/QuantityStepper.stories.js +86 -0
- package/lib/module/components/QuantityStepper/QuantityStepper.stories.js.map +1 -0
- package/lib/module/components/QuantityStepper/QuantityStepper.test.js +99 -0
- package/lib/module/components/QuantityStepper/QuantityStepper.test.js.map +1 -0
- package/lib/module/components/QuantityStepper/index.js +4 -0
- package/lib/module/components/QuantityStepper/index.js.map +1 -0
- package/lib/module/components/Radio/Radio.js +55 -0
- package/lib/module/components/Radio/Radio.js.map +1 -0
- package/lib/module/components/Radio/Radio.stories.js +56 -0
- package/lib/module/components/Radio/Radio.stories.js.map +1 -0
- package/lib/module/components/Radio/Radio.test.js +45 -0
- package/lib/module/components/Radio/Radio.test.js.map +1 -0
- package/lib/module/components/Radio/index.js +4 -0
- package/lib/module/components/Radio/index.js.map +1 -0
- package/lib/module/components/Surface/Surface.js +80 -0
- package/lib/module/components/Surface/Surface.js.map +1 -0
- package/lib/module/components/Surface/Surface.stories.js +93 -0
- package/lib/module/components/Surface/Surface.stories.js.map +1 -0
- package/lib/module/components/Surface/Surface.test.js +57 -0
- package/lib/module/components/Surface/Surface.test.js.map +1 -0
- package/lib/module/components/Surface/index.js +4 -0
- package/lib/module/components/Surface/index.js.map +1 -0
- package/lib/module/components/Switch/Switch.js +105 -0
- package/lib/module/components/Switch/Switch.js.map +1 -0
- package/lib/module/components/Switch/Switch.stories.js +85 -0
- package/lib/module/components/Switch/Switch.stories.js.map +1 -0
- package/lib/module/components/Switch/Switch.test.js +45 -0
- package/lib/module/components/Switch/Switch.test.js.map +1 -0
- package/lib/module/components/Switch/index.js +4 -0
- package/lib/module/components/Switch/index.js.map +1 -0
- package/lib/module/components/Text/Text.js +35 -0
- package/lib/module/components/Text/Text.js.map +1 -0
- package/lib/module/components/Text/Text.stories.js +43 -0
- package/lib/module/components/Text/Text.stories.js.map +1 -0
- package/lib/module/components/Text/index.js +4 -0
- package/lib/module/components/Text/index.js.map +1 -0
- package/lib/module/components/_internal/Labeled.js +46 -0
- package/lib/module/components/_internal/Labeled.js.map +1 -0
- package/lib/module/components/brand/Flag.js +41 -0
- package/lib/module/components/brand/Flag.js.map +1 -0
- package/lib/module/components/brand/Flag.stories.js +55 -0
- package/lib/module/components/brand/Flag.stories.js.map +1 -0
- package/lib/module/components/brand/Logo.js +26 -0
- package/lib/module/components/brand/Logo.js.map +1 -0
- package/lib/module/components/brand/Logo.stories.js +55 -0
- package/lib/module/components/brand/Logo.stories.js.map +1 -0
- package/lib/module/components/brand/brand.test.js +38 -0
- package/lib/module/components/brand/brand.test.js.map +1 -0
- package/lib/module/components/brand/generated/FlagBr.js +90 -0
- package/lib/module/components/brand/generated/FlagBr.js.map +1 -0
- package/lib/module/components/brand/generated/FlagUs.js +76 -0
- package/lib/module/components/brand/generated/FlagUs.js.map +1 -0
- package/lib/module/components/brand/generated/Mastercard.js +37 -0
- package/lib/module/components/brand/generated/Mastercard.js.map +1 -0
- package/lib/module/components/brand/generated/Visa.js +94 -0
- package/lib/module/components/brand/generated/Visa.js.map +1 -0
- package/lib/module/components/brand/index.js +6 -0
- package/lib/module/components/brand/index.js.map +1 -0
- package/lib/module/components/brand/registry.js +31 -0
- package/lib/module/components/brand/registry.js.map +1 -0
- package/lib/module/components/index.js +20 -0
- package/lib/module/components/index.js.map +1 -0
- package/lib/module/index.js +10 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/theme/ThemeProvider.js +46 -0
- package/lib/module/theme/ThemeProvider.js.map +1 -0
- package/lib/module/theme/ThemeProvider.test.js +64 -0
- package/lib/module/theme/ThemeProvider.test.js.map +1 -0
- package/lib/module/theme/index.js +8 -0
- package/lib/module/theme/index.js.map +1 -0
- package/lib/module/theme/palette.js +90 -0
- package/lib/module/theme/palette.js.map +1 -0
- package/lib/module/theme/spacing.js +34 -0
- package/lib/module/theme/spacing.js.map +1 -0
- package/lib/module/theme/themes.js +166 -0
- package/lib/module/theme/themes.js.map +1 -0
- package/lib/module/theme/typography.js +61 -0
- package/lib/module/theme/typography.js.map +1 -0
- package/lib/typescript/commonjs/components/Avatar/Avatar.d.ts +31 -0
- package/lib/typescript/commonjs/components/Avatar/Avatar.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Avatar/index.d.ts +2 -0
- package/lib/typescript/commonjs/components/Avatar/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Button/Button.d.ts +40 -0
- package/lib/typescript/commonjs/components/Button/Button.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Button/index.d.ts +2 -0
- package/lib/typescript/commonjs/components/Button/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Card/Card.d.ts +32 -0
- package/lib/typescript/commonjs/components/Card/Card.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Card/index.d.ts +2 -0
- package/lib/typescript/commonjs/components/Card/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Checkbox/Checkbox.d.ts +25 -0
- package/lib/typescript/commonjs/components/Checkbox/Checkbox.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Checkbox/index.d.ts +2 -0
- package/lib/typescript/commonjs/components/Checkbox/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Chip/Chip.d.ts +40 -0
- package/lib/typescript/commonjs/components/Chip/Chip.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Chip/ChipGroup.d.ts +49 -0
- package/lib/typescript/commonjs/components/Chip/ChipGroup.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Chip/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Chip/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/CodeInput/CodeInput.d.ts +41 -0
- package/lib/typescript/commonjs/components/CodeInput/CodeInput.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/CodeInput/index.d.ts +2 -0
- package/lib/typescript/commonjs/components/CodeInput/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Icon/Icon.d.ts +19 -0
- package/lib/typescript/commonjs/components/Icon/Icon.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Icon/icons.generated.d.ts +171 -0
- package/lib/typescript/commonjs/components/Icon/icons.generated.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Icon/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/Icon/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/IconButton/IconButton.d.ts +34 -0
- package/lib/typescript/commonjs/components/IconButton/IconButton.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/IconButton/index.d.ts +2 -0
- package/lib/typescript/commonjs/components/IconButton/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Input/Input.d.ts +38 -0
- package/lib/typescript/commonjs/components/Input/Input.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Input/index.d.ts +2 -0
- package/lib/typescript/commonjs/components/Input/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/LinkButton/LinkButton.d.ts +31 -0
- package/lib/typescript/commonjs/components/LinkButton/LinkButton.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/LinkButton/index.d.ts +2 -0
- package/lib/typescript/commonjs/components/LinkButton/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/ProductCard/ProductCard.d.ts +31 -0
- package/lib/typescript/commonjs/components/ProductCard/ProductCard.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/ProductCard/index.d.ts +2 -0
- package/lib/typescript/commonjs/components/ProductCard/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/QuantityStepper/QuantityStepper.d.ts +36 -0
- package/lib/typescript/commonjs/components/QuantityStepper/QuantityStepper.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/QuantityStepper/index.d.ts +2 -0
- package/lib/typescript/commonjs/components/QuantityStepper/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Radio/Radio.d.ts +23 -0
- package/lib/typescript/commonjs/components/Radio/Radio.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Radio/index.d.ts +2 -0
- package/lib/typescript/commonjs/components/Radio/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Surface/Surface.d.ts +31 -0
- package/lib/typescript/commonjs/components/Surface/Surface.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Surface/index.d.ts +2 -0
- package/lib/typescript/commonjs/components/Surface/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Switch/Switch.d.ts +26 -0
- package/lib/typescript/commonjs/components/Switch/Switch.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Switch/index.d.ts +2 -0
- package/lib/typescript/commonjs/components/Switch/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Text/Text.d.ts +21 -0
- package/lib/typescript/commonjs/components/Text/Text.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/Text/index.d.ts +2 -0
- package/lib/typescript/commonjs/components/Text/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/_internal/Labeled.d.ts +27 -0
- package/lib/typescript/commonjs/components/_internal/Labeled.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/brand/Flag.d.ts +14 -0
- package/lib/typescript/commonjs/components/brand/Flag.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/brand/Logo.d.ts +15 -0
- package/lib/typescript/commonjs/components/brand/Logo.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/brand/generated/FlagBr.d.ts +4 -0
- package/lib/typescript/commonjs/components/brand/generated/FlagBr.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/brand/generated/FlagUs.d.ts +4 -0
- package/lib/typescript/commonjs/components/brand/generated/FlagUs.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/brand/generated/Mastercard.d.ts +4 -0
- package/lib/typescript/commonjs/components/brand/generated/Mastercard.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/brand/generated/Visa.d.ts +4 -0
- package/lib/typescript/commonjs/components/brand/generated/Visa.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/brand/index.d.ts +4 -0
- package/lib/typescript/commonjs/components/brand/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/brand/registry.d.ts +33 -0
- package/lib/typescript/commonjs/components/brand/registry.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/index.d.ts +19 -0
- package/lib/typescript/commonjs/components/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +8 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/theme/ThemeProvider.d.ts +29 -0
- package/lib/typescript/commonjs/theme/ThemeProvider.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/index.d.ts +6 -0
- package/lib/typescript/commonjs/theme/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/palette.d.ts +89 -0
- package/lib/typescript/commonjs/theme/palette.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/spacing.d.ts +34 -0
- package/lib/typescript/commonjs/theme/spacing.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/themes.d.ts +93 -0
- package/lib/typescript/commonjs/theme/themes.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/typography.d.ts +60 -0
- package/lib/typescript/commonjs/theme/typography.d.ts.map +1 -0
- package/lib/typescript/module/components/Avatar/Avatar.d.ts +31 -0
- package/lib/typescript/module/components/Avatar/Avatar.d.ts.map +1 -0
- package/lib/typescript/module/components/Avatar/index.d.ts +2 -0
- package/lib/typescript/module/components/Avatar/index.d.ts.map +1 -0
- package/lib/typescript/module/components/Button/Button.d.ts +40 -0
- package/lib/typescript/module/components/Button/Button.d.ts.map +1 -0
- package/lib/typescript/module/components/Button/index.d.ts +2 -0
- package/lib/typescript/module/components/Button/index.d.ts.map +1 -0
- package/lib/typescript/module/components/Card/Card.d.ts +32 -0
- package/lib/typescript/module/components/Card/Card.d.ts.map +1 -0
- package/lib/typescript/module/components/Card/index.d.ts +2 -0
- package/lib/typescript/module/components/Card/index.d.ts.map +1 -0
- package/lib/typescript/module/components/Checkbox/Checkbox.d.ts +25 -0
- package/lib/typescript/module/components/Checkbox/Checkbox.d.ts.map +1 -0
- package/lib/typescript/module/components/Checkbox/index.d.ts +2 -0
- package/lib/typescript/module/components/Checkbox/index.d.ts.map +1 -0
- package/lib/typescript/module/components/Chip/Chip.d.ts +40 -0
- package/lib/typescript/module/components/Chip/Chip.d.ts.map +1 -0
- package/lib/typescript/module/components/Chip/ChipGroup.d.ts +49 -0
- package/lib/typescript/module/components/Chip/ChipGroup.d.ts.map +1 -0
- package/lib/typescript/module/components/Chip/index.d.ts +3 -0
- package/lib/typescript/module/components/Chip/index.d.ts.map +1 -0
- package/lib/typescript/module/components/CodeInput/CodeInput.d.ts +41 -0
- package/lib/typescript/module/components/CodeInput/CodeInput.d.ts.map +1 -0
- package/lib/typescript/module/components/CodeInput/index.d.ts +2 -0
- package/lib/typescript/module/components/CodeInput/index.d.ts.map +1 -0
- package/lib/typescript/module/components/Icon/Icon.d.ts +19 -0
- package/lib/typescript/module/components/Icon/Icon.d.ts.map +1 -0
- package/lib/typescript/module/components/Icon/icons.generated.d.ts +171 -0
- package/lib/typescript/module/components/Icon/icons.generated.d.ts.map +1 -0
- package/lib/typescript/module/components/Icon/index.d.ts +3 -0
- package/lib/typescript/module/components/Icon/index.d.ts.map +1 -0
- package/lib/typescript/module/components/IconButton/IconButton.d.ts +34 -0
- package/lib/typescript/module/components/IconButton/IconButton.d.ts.map +1 -0
- package/lib/typescript/module/components/IconButton/index.d.ts +2 -0
- package/lib/typescript/module/components/IconButton/index.d.ts.map +1 -0
- package/lib/typescript/module/components/Input/Input.d.ts +38 -0
- package/lib/typescript/module/components/Input/Input.d.ts.map +1 -0
- package/lib/typescript/module/components/Input/index.d.ts +2 -0
- package/lib/typescript/module/components/Input/index.d.ts.map +1 -0
- package/lib/typescript/module/components/LinkButton/LinkButton.d.ts +31 -0
- package/lib/typescript/module/components/LinkButton/LinkButton.d.ts.map +1 -0
- package/lib/typescript/module/components/LinkButton/index.d.ts +2 -0
- package/lib/typescript/module/components/LinkButton/index.d.ts.map +1 -0
- package/lib/typescript/module/components/ProductCard/ProductCard.d.ts +31 -0
- package/lib/typescript/module/components/ProductCard/ProductCard.d.ts.map +1 -0
- package/lib/typescript/module/components/ProductCard/index.d.ts +2 -0
- package/lib/typescript/module/components/ProductCard/index.d.ts.map +1 -0
- package/lib/typescript/module/components/QuantityStepper/QuantityStepper.d.ts +36 -0
- package/lib/typescript/module/components/QuantityStepper/QuantityStepper.d.ts.map +1 -0
- package/lib/typescript/module/components/QuantityStepper/index.d.ts +2 -0
- package/lib/typescript/module/components/QuantityStepper/index.d.ts.map +1 -0
- package/lib/typescript/module/components/Radio/Radio.d.ts +23 -0
- package/lib/typescript/module/components/Radio/Radio.d.ts.map +1 -0
- package/lib/typescript/module/components/Radio/index.d.ts +2 -0
- package/lib/typescript/module/components/Radio/index.d.ts.map +1 -0
- package/lib/typescript/module/components/Surface/Surface.d.ts +31 -0
- package/lib/typescript/module/components/Surface/Surface.d.ts.map +1 -0
- package/lib/typescript/module/components/Surface/index.d.ts +2 -0
- package/lib/typescript/module/components/Surface/index.d.ts.map +1 -0
- package/lib/typescript/module/components/Switch/Switch.d.ts +26 -0
- package/lib/typescript/module/components/Switch/Switch.d.ts.map +1 -0
- package/lib/typescript/module/components/Switch/index.d.ts +2 -0
- package/lib/typescript/module/components/Switch/index.d.ts.map +1 -0
- package/lib/typescript/module/components/Text/Text.d.ts +21 -0
- package/lib/typescript/module/components/Text/Text.d.ts.map +1 -0
- package/lib/typescript/module/components/Text/index.d.ts +2 -0
- package/lib/typescript/module/components/Text/index.d.ts.map +1 -0
- package/lib/typescript/module/components/_internal/Labeled.d.ts +27 -0
- package/lib/typescript/module/components/_internal/Labeled.d.ts.map +1 -0
- package/lib/typescript/module/components/brand/Flag.d.ts +14 -0
- package/lib/typescript/module/components/brand/Flag.d.ts.map +1 -0
- package/lib/typescript/module/components/brand/Logo.d.ts +15 -0
- package/lib/typescript/module/components/brand/Logo.d.ts.map +1 -0
- package/lib/typescript/module/components/brand/generated/FlagBr.d.ts +4 -0
- package/lib/typescript/module/components/brand/generated/FlagBr.d.ts.map +1 -0
- package/lib/typescript/module/components/brand/generated/FlagUs.d.ts +4 -0
- package/lib/typescript/module/components/brand/generated/FlagUs.d.ts.map +1 -0
- package/lib/typescript/module/components/brand/generated/Mastercard.d.ts +4 -0
- package/lib/typescript/module/components/brand/generated/Mastercard.d.ts.map +1 -0
- package/lib/typescript/module/components/brand/generated/Visa.d.ts +4 -0
- package/lib/typescript/module/components/brand/generated/Visa.d.ts.map +1 -0
- package/lib/typescript/module/components/brand/index.d.ts +4 -0
- package/lib/typescript/module/components/brand/index.d.ts.map +1 -0
- package/lib/typescript/module/components/brand/registry.d.ts +33 -0
- package/lib/typescript/module/components/brand/registry.d.ts.map +1 -0
- package/lib/typescript/module/components/index.d.ts +19 -0
- package/lib/typescript/module/components/index.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +8 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/theme/ThemeProvider.d.ts +29 -0
- package/lib/typescript/module/theme/ThemeProvider.d.ts.map +1 -0
- package/lib/typescript/module/theme/index.d.ts +6 -0
- package/lib/typescript/module/theme/index.d.ts.map +1 -0
- package/lib/typescript/module/theme/palette.d.ts +89 -0
- package/lib/typescript/module/theme/palette.d.ts.map +1 -0
- package/lib/typescript/module/theme/spacing.d.ts +34 -0
- package/lib/typescript/module/theme/spacing.d.ts.map +1 -0
- package/lib/typescript/module/theme/themes.d.ts +93 -0
- package/lib/typescript/module/theme/themes.d.ts.map +1 -0
- package/lib/typescript/module/theme/typography.d.ts +60 -0
- package/lib/typescript/module/theme/typography.d.ts.map +1 -0
- package/package.json +116 -0
- package/src/components/Avatar/Avatar.tsx +111 -0
- package/src/components/Avatar/index.ts +1 -0
- package/src/components/Button/Button.tsx +216 -0
- package/src/components/Button/index.ts +6 -0
- package/src/components/Card/Card.tsx +145 -0
- package/src/components/Card/index.ts +1 -0
- package/src/components/Checkbox/Checkbox.tsx +86 -0
- package/src/components/Checkbox/index.ts +1 -0
- package/src/components/Chip/Chip.tsx +126 -0
- package/src/components/Chip/ChipGroup.tsx +88 -0
- package/src/components/Chip/index.ts +2 -0
- package/src/components/CodeInput/CodeInput.tsx +200 -0
- package/src/components/CodeInput/index.ts +1 -0
- package/src/components/Icon/Icon.tsx +32 -0
- package/src/components/Icon/icons.generated.ts +174 -0
- package/src/components/Icon/index.ts +2 -0
- package/src/components/IconButton/IconButton.tsx +156 -0
- package/src/components/IconButton/index.ts +7 -0
- package/src/components/Input/Input.tsx +230 -0
- package/src/components/Input/index.ts +1 -0
- package/src/components/LinkButton/LinkButton.tsx +118 -0
- package/src/components/LinkButton/index.ts +6 -0
- package/src/components/ProductCard/ProductCard.tsx +176 -0
- package/src/components/ProductCard/index.ts +1 -0
- package/src/components/QuantityStepper/QuantityStepper.tsx +162 -0
- package/src/components/QuantityStepper/index.ts +5 -0
- package/src/components/Radio/Radio.tsx +76 -0
- package/src/components/Radio/index.ts +1 -0
- package/src/components/Surface/Surface.tsx +99 -0
- package/src/components/Surface/index.ts +6 -0
- package/src/components/Switch/Switch.tsx +110 -0
- package/src/components/Switch/index.ts +1 -0
- package/src/components/Text/Text.tsx +51 -0
- package/src/components/Text/index.ts +1 -0
- package/src/components/_internal/Labeled.tsx +72 -0
- package/src/components/brand/Flag.tsx +41 -0
- package/src/components/brand/Logo.tsx +23 -0
- package/src/components/brand/generated/FlagBr.tsx +8 -0
- package/src/components/brand/generated/FlagUs.tsx +7 -0
- package/src/components/brand/generated/Mastercard.tsx +4 -0
- package/src/components/brand/generated/Visa.tsx +4 -0
- package/src/components/brand/index.ts +3 -0
- package/src/components/brand/registry.ts +27 -0
- package/src/components/index.ts +19 -0
- package/src/index.tsx +7 -0
- package/src/theme/ThemeProvider.tsx +66 -0
- package/src/theme/index.ts +31 -0
- package/src/theme/palette.ts +89 -0
- package/src/theme/spacing.ts +37 -0
- package/src/theme/themes.ts +248 -0
- package/src/theme/typography.ts +37 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
ActivityIndicator,
|
|
4
|
+
Pressable,
|
|
5
|
+
type PressableProps,
|
|
6
|
+
type PressableStateCallbackType,
|
|
7
|
+
type StyleProp,
|
|
8
|
+
type ViewStyle,
|
|
9
|
+
} from 'react-native';
|
|
10
|
+
import { useTheme, type Theme } from '../../theme';
|
|
11
|
+
import { Icon } from '../Icon/Icon';
|
|
12
|
+
import type { IconName } from '../Icon/icons.generated';
|
|
13
|
+
|
|
14
|
+
/** Icon-only button styles — 1:1 with the Figma "Icon button" style variants. */
|
|
15
|
+
export type IconButtonVariant =
|
|
16
|
+
| 'default'
|
|
17
|
+
| 'secondary'
|
|
18
|
+
| 'inverse'
|
|
19
|
+
| 'destructive'
|
|
20
|
+
| 'ghost';
|
|
21
|
+
|
|
22
|
+
export type IconButtonSize = 'sm' | 'md' | 'lg';
|
|
23
|
+
|
|
24
|
+
/** `round` = circle (default), `square` = 16px corner radius. */
|
|
25
|
+
export type IconButtonShape = 'round' | 'square';
|
|
26
|
+
|
|
27
|
+
export interface IconButtonProps extends Omit<PressableProps, 'style' | 'children'> {
|
|
28
|
+
/** Icon name from the generated registry. */
|
|
29
|
+
icon: IconName;
|
|
30
|
+
/**
|
|
31
|
+
* Describes the action for screen readers — required since there is no visible
|
|
32
|
+
* label (e.g. "Delete item").
|
|
33
|
+
*/
|
|
34
|
+
accessibilityLabel: string;
|
|
35
|
+
/** Visual style. Defaults to `default` (the lime accent action). */
|
|
36
|
+
variant?: IconButtonVariant;
|
|
37
|
+
/** Container size: `sm` = 40, `md` = 48, `lg` = 58. Defaults to `md`. */
|
|
38
|
+
size?: IconButtonSize;
|
|
39
|
+
/** Corner style. Defaults to `round` (circle). */
|
|
40
|
+
shape?: IconButtonShape;
|
|
41
|
+
/** Show a spinner and block presses. */
|
|
42
|
+
loading?: boolean;
|
|
43
|
+
/** Disable interaction and apply disabled tokens. */
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
/** Override the container style. */
|
|
46
|
+
style?: StyleProp<ViewStyle>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const SIZES: Record<IconButtonSize, { box: number; iconSize: number }> = {
|
|
50
|
+
sm: { box: 40, iconSize: 20 },
|
|
51
|
+
md: { box: 48, iconSize: 24 },
|
|
52
|
+
lg: { box: 58, iconSize: 24 },
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
interface VariantColors {
|
|
56
|
+
backgroundColor: string;
|
|
57
|
+
iconColor: string;
|
|
58
|
+
borderColor: string;
|
|
59
|
+
borderWidth: number;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function getVariantColors(theme: Theme, variant: IconButtonVariant): VariantColors {
|
|
63
|
+
const { action, state, border, text } = theme.colors;
|
|
64
|
+
const noBorder = { borderColor: 'transparent', borderWidth: 0 };
|
|
65
|
+
switch (variant) {
|
|
66
|
+
case 'secondary':
|
|
67
|
+
return {
|
|
68
|
+
backgroundColor: action.secondary,
|
|
69
|
+
iconColor: action.secondaryForeground,
|
|
70
|
+
borderColor: border.default,
|
|
71
|
+
borderWidth: 1,
|
|
72
|
+
};
|
|
73
|
+
case 'inverse':
|
|
74
|
+
return { backgroundColor: action.inverse, iconColor: action.inverseForeground, ...noBorder };
|
|
75
|
+
case 'destructive':
|
|
76
|
+
return {
|
|
77
|
+
backgroundColor: state.destructiveSubtle,
|
|
78
|
+
iconColor: state.destructiveSubtleForeground,
|
|
79
|
+
...noBorder,
|
|
80
|
+
};
|
|
81
|
+
case 'ghost':
|
|
82
|
+
return { backgroundColor: 'transparent', iconColor: text.primary, ...noBorder };
|
|
83
|
+
case 'default':
|
|
84
|
+
default:
|
|
85
|
+
return { backgroundColor: action.primary, iconColor: action.primaryForeground, ...noBorder };
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Icon-only button — faithful to the Bacon POS Figma "Icon button" frames.
|
|
91
|
+
* Circular or square, token-driven colors and states.
|
|
92
|
+
*/
|
|
93
|
+
export function IconButton({
|
|
94
|
+
icon,
|
|
95
|
+
accessibilityLabel,
|
|
96
|
+
variant = 'default',
|
|
97
|
+
size = 'md',
|
|
98
|
+
shape = 'round',
|
|
99
|
+
loading = false,
|
|
100
|
+
disabled = false,
|
|
101
|
+
style,
|
|
102
|
+
...rest
|
|
103
|
+
}: IconButtonProps) {
|
|
104
|
+
const theme = useTheme();
|
|
105
|
+
const sizeConfig = SIZES[size];
|
|
106
|
+
const isDisabled = disabled || loading;
|
|
107
|
+
|
|
108
|
+
const colors = useMemo<VariantColors>(() => {
|
|
109
|
+
const variantColors = getVariantColors(theme, variant);
|
|
110
|
+
if (!isDisabled) return variantColors;
|
|
111
|
+
return {
|
|
112
|
+
backgroundColor: variant === 'ghost' ? 'transparent' : theme.colors.disabled.background,
|
|
113
|
+
iconColor: theme.colors.disabled.foreground,
|
|
114
|
+
borderColor: variantColors.borderWidth > 0 ? theme.colors.disabled.border : 'transparent',
|
|
115
|
+
borderWidth: variantColors.borderWidth,
|
|
116
|
+
};
|
|
117
|
+
}, [theme, variant, isDisabled]);
|
|
118
|
+
|
|
119
|
+
const borderRadius = shape === 'square' ? theme.radii.xl : theme.radii.pill;
|
|
120
|
+
|
|
121
|
+
const containerStyle = useMemo(
|
|
122
|
+
() =>
|
|
123
|
+
({ pressed }: PressableStateCallbackType): StyleProp<ViewStyle> => [
|
|
124
|
+
{
|
|
125
|
+
width: sizeConfig.box,
|
|
126
|
+
height: sizeConfig.box,
|
|
127
|
+
borderRadius,
|
|
128
|
+
borderWidth: colors.borderWidth,
|
|
129
|
+
borderColor: colors.borderColor,
|
|
130
|
+
backgroundColor: colors.backgroundColor,
|
|
131
|
+
alignItems: 'center',
|
|
132
|
+
justifyContent: 'center',
|
|
133
|
+
opacity: pressed && !isDisabled ? 0.9 : 1,
|
|
134
|
+
} satisfies ViewStyle,
|
|
135
|
+
style,
|
|
136
|
+
],
|
|
137
|
+
[sizeConfig, borderRadius, colors, isDisabled, style],
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
return (
|
|
141
|
+
<Pressable
|
|
142
|
+
accessibilityRole="button"
|
|
143
|
+
accessibilityLabel={accessibilityLabel}
|
|
144
|
+
accessibilityState={{ disabled: isDisabled, busy: loading }}
|
|
145
|
+
disabled={isDisabled}
|
|
146
|
+
style={containerStyle}
|
|
147
|
+
{...rest}
|
|
148
|
+
>
|
|
149
|
+
{loading ? (
|
|
150
|
+
<ActivityIndicator color={colors.iconColor} size="small" />
|
|
151
|
+
) : (
|
|
152
|
+
<Icon name={icon} size={sizeConfig.iconSize} color={colors.iconColor} />
|
|
153
|
+
)}
|
|
154
|
+
</Pressable>
|
|
155
|
+
);
|
|
156
|
+
}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { forwardRef, useState, type ReactNode } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Pressable,
|
|
4
|
+
TextInput,
|
|
5
|
+
View,
|
|
6
|
+
type NativeSyntheticEvent,
|
|
7
|
+
type StyleProp,
|
|
8
|
+
type TextInputFocusEventData,
|
|
9
|
+
type TextInputProps,
|
|
10
|
+
type TextStyle,
|
|
11
|
+
type ViewStyle,
|
|
12
|
+
} from 'react-native';
|
|
13
|
+
import { useTheme, textStyle } from '../../theme';
|
|
14
|
+
import type { TypographyVariant } from '../../theme/typography';
|
|
15
|
+
import { Icon } from '../Icon/Icon';
|
|
16
|
+
import { Text } from '../Text/Text';
|
|
17
|
+
|
|
18
|
+
/** Width of the focus ring, in px (Figma "Focus" effect: spread 6). */
|
|
19
|
+
const FOCUS_RING_SPREAD = 6;
|
|
20
|
+
/** Focus ring opacity (Figma color #..0x26 ≈ 15%). */
|
|
21
|
+
const FOCUS_RING_ALPHA = 0.15;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Removes the browser's default focus outline on web (react-native-web renders
|
|
25
|
+
* TextInput as a DOM input). No-op on native; our lime focus ring is the focus
|
|
26
|
+
* affordance instead.
|
|
27
|
+
*/
|
|
28
|
+
const WEB_NO_OUTLINE = { outlineStyle: 'none', outlineWidth: 0 } as unknown as TextStyle;
|
|
29
|
+
|
|
30
|
+
/** Convert a `#RRGGBB` (or `#RGB`) token to an `rgba()` string at the given alpha. */
|
|
31
|
+
function hexToRgba(hex: string, alpha: number): string {
|
|
32
|
+
const h = hex.replace('#', '');
|
|
33
|
+
const full = h.length === 3 ? h.replace(/./g, (c) => c + c) : h;
|
|
34
|
+
const r = parseInt(full.slice(0, 2), 16);
|
|
35
|
+
const g = parseInt(full.slice(2, 4), 16);
|
|
36
|
+
const b = parseInt(full.slice(4, 6), 16);
|
|
37
|
+
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type InputSize = 'md' | 'lg';
|
|
41
|
+
|
|
42
|
+
export interface InputProps extends Omit<TextInputProps, 'style' | 'editable'> {
|
|
43
|
+
/** Field label rendered above the input. */
|
|
44
|
+
label?: string;
|
|
45
|
+
/** Helper text rendered below the input. Replaced by the error message when `error` is a string. */
|
|
46
|
+
helperText?: string;
|
|
47
|
+
/** Mark the field invalid. Pass a string to show it as the error message. */
|
|
48
|
+
error?: boolean | string;
|
|
49
|
+
/** Field height: `md` = 48, `lg` = 58. Defaults to `lg`. */
|
|
50
|
+
size?: InputSize;
|
|
51
|
+
/** Disable input and apply disabled tokens. */
|
|
52
|
+
disabled?: boolean;
|
|
53
|
+
/** Element rendered inside the field, before the text. */
|
|
54
|
+
leftIcon?: ReactNode;
|
|
55
|
+
/** Element rendered inside the field, after the text. */
|
|
56
|
+
rightIcon?: ReactNode;
|
|
57
|
+
/**
|
|
58
|
+
* Password field with a trailing eye toggle to reveal/hide the text. Starts
|
|
59
|
+
* masked; the toggle replaces `rightIcon`.
|
|
60
|
+
*/
|
|
61
|
+
revealable?: boolean;
|
|
62
|
+
/** Accessibility labels for the reveal toggle. */
|
|
63
|
+
revealLabel?: string;
|
|
64
|
+
hideLabel?: string;
|
|
65
|
+
/** Style for the outer wrapper (label + field + helper). */
|
|
66
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
67
|
+
/** Style for the field row. */
|
|
68
|
+
fieldStyle?: StyleProp<ViewStyle>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const SIZES: Record<
|
|
72
|
+
InputSize,
|
|
73
|
+
{ height: number; gap: number; iconSize: number; textVariant: TypographyVariant }
|
|
74
|
+
> = {
|
|
75
|
+
md: { height: 48, gap: 8, iconSize: 20, textVariant: 'bodyMedium' },
|
|
76
|
+
lg: { height: 58, gap: 10, iconSize: 24, textVariant: 'bodyLarge' },
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Text field — faithful to the Bacon POS Figma "Input rounds".
|
|
81
|
+
* Pill-shaped, with label, helper/error text, optional icons and a lime focus
|
|
82
|
+
* ring. Focus is tracked internally; error and disabled are controlled by props.
|
|
83
|
+
*/
|
|
84
|
+
export const Input = forwardRef<TextInput, InputProps>(function Input(
|
|
85
|
+
{
|
|
86
|
+
label,
|
|
87
|
+
helperText,
|
|
88
|
+
error,
|
|
89
|
+
size = 'lg',
|
|
90
|
+
disabled = false,
|
|
91
|
+
leftIcon,
|
|
92
|
+
rightIcon,
|
|
93
|
+
revealable = false,
|
|
94
|
+
revealLabel = 'Show password',
|
|
95
|
+
hideLabel = 'Hide password',
|
|
96
|
+
secureTextEntry,
|
|
97
|
+
containerStyle,
|
|
98
|
+
fieldStyle,
|
|
99
|
+
onFocus,
|
|
100
|
+
onBlur,
|
|
101
|
+
...rest
|
|
102
|
+
},
|
|
103
|
+
ref,
|
|
104
|
+
) {
|
|
105
|
+
const theme = useTheme();
|
|
106
|
+
const sizeConfig = SIZES[size];
|
|
107
|
+
const [focused, setFocused] = useState(false);
|
|
108
|
+
const [revealed, setRevealed] = useState(false);
|
|
109
|
+
|
|
110
|
+
const effectiveSecure = revealable ? !revealed : secureTextEntry;
|
|
111
|
+
const trailing = revealable ? (
|
|
112
|
+
<Pressable
|
|
113
|
+
onPress={() => setRevealed((r) => !r)}
|
|
114
|
+
disabled={disabled}
|
|
115
|
+
hitSlop={8}
|
|
116
|
+
accessibilityRole="button"
|
|
117
|
+
accessibilityLabel={revealed ? hideLabel : revealLabel}
|
|
118
|
+
>
|
|
119
|
+
<Icon name={revealed ? 'eye' : 'eye-hide'} size={sizeConfig.iconSize} color="tertiary" />
|
|
120
|
+
</Pressable>
|
|
121
|
+
) : (
|
|
122
|
+
rightIcon
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
const hasError = Boolean(error);
|
|
126
|
+
const message = typeof error === 'string' ? error : helperText;
|
|
127
|
+
|
|
128
|
+
const borderColor = disabled
|
|
129
|
+
? theme.colors.disabled.border
|
|
130
|
+
: hasError
|
|
131
|
+
? theme.colors.feedback.error
|
|
132
|
+
: focused
|
|
133
|
+
? theme.colors.border.focus
|
|
134
|
+
: theme.colors.border.default;
|
|
135
|
+
|
|
136
|
+
// Outer focus ring — a colored spread with no blur (Figma "Focus" effect).
|
|
137
|
+
// `boxShadow` (RN 0.76+ / New Architecture, and react-native-web) is the only
|
|
138
|
+
// cross-platform way to get a colored spread: `shadow*` is iOS-only with no
|
|
139
|
+
// spread, and `elevation` is a grey Android-only shadow.
|
|
140
|
+
const showRing = focused && !disabled;
|
|
141
|
+
const ringColor = hasError ? theme.colors.feedback.error : theme.colors.border.focus;
|
|
142
|
+
const boxShadow: ViewStyle['boxShadow'] = showRing
|
|
143
|
+
? [
|
|
144
|
+
{
|
|
145
|
+
offsetX: 0,
|
|
146
|
+
offsetY: 0,
|
|
147
|
+
blurRadius: 0,
|
|
148
|
+
spreadDistance: FOCUS_RING_SPREAD,
|
|
149
|
+
color: hexToRgba(ringColor, FOCUS_RING_ALPHA),
|
|
150
|
+
},
|
|
151
|
+
]
|
|
152
|
+
: undefined;
|
|
153
|
+
|
|
154
|
+
const iconBox: ViewStyle = {
|
|
155
|
+
width: sizeConfig.iconSize,
|
|
156
|
+
height: sizeConfig.iconSize,
|
|
157
|
+
alignItems: 'center',
|
|
158
|
+
justifyContent: 'center',
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const handleFocus = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
|
|
162
|
+
setFocused(true);
|
|
163
|
+
onFocus?.(e);
|
|
164
|
+
};
|
|
165
|
+
const handleBlur = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
|
|
166
|
+
setFocused(false);
|
|
167
|
+
onBlur?.(e);
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
return (
|
|
171
|
+
<View style={containerStyle}>
|
|
172
|
+
{label ? (
|
|
173
|
+
<Text variant="bodySmall" color="secondary" style={{ marginBottom: 4, marginLeft: 8 }}>
|
|
174
|
+
{label}
|
|
175
|
+
</Text>
|
|
176
|
+
) : null}
|
|
177
|
+
|
|
178
|
+
<View
|
|
179
|
+
style={[
|
|
180
|
+
{
|
|
181
|
+
flexDirection: 'row',
|
|
182
|
+
alignItems: 'center',
|
|
183
|
+
gap: sizeConfig.gap,
|
|
184
|
+
height: sizeConfig.height,
|
|
185
|
+
paddingHorizontal: 16,
|
|
186
|
+
borderWidth: 1,
|
|
187
|
+
borderColor,
|
|
188
|
+
borderRadius: theme.radii.pill,
|
|
189
|
+
backgroundColor: disabled
|
|
190
|
+
? theme.colors.disabled.background
|
|
191
|
+
: theme.colors.background.default,
|
|
192
|
+
boxShadow,
|
|
193
|
+
},
|
|
194
|
+
fieldStyle,
|
|
195
|
+
]}
|
|
196
|
+
>
|
|
197
|
+
{leftIcon ? <View style={iconBox}>{leftIcon}</View> : null}
|
|
198
|
+
<TextInput
|
|
199
|
+
ref={ref}
|
|
200
|
+
editable={!disabled}
|
|
201
|
+
secureTextEntry={effectiveSecure}
|
|
202
|
+
placeholderTextColor={theme.colors.text.tertiary}
|
|
203
|
+
onFocus={handleFocus}
|
|
204
|
+
onBlur={handleBlur}
|
|
205
|
+
style={[
|
|
206
|
+
textStyle(theme, sizeConfig.textVariant, 'regular'),
|
|
207
|
+
{
|
|
208
|
+
flex: 1,
|
|
209
|
+
paddingVertical: 0,
|
|
210
|
+
color: disabled ? theme.colors.text.tertiary : theme.colors.text.primary,
|
|
211
|
+
},
|
|
212
|
+
WEB_NO_OUTLINE,
|
|
213
|
+
]}
|
|
214
|
+
{...rest}
|
|
215
|
+
/>
|
|
216
|
+
{trailing ? <View style={iconBox}>{trailing}</View> : null}
|
|
217
|
+
</View>
|
|
218
|
+
|
|
219
|
+
{message ? (
|
|
220
|
+
<Text
|
|
221
|
+
variant="bodySmall"
|
|
222
|
+
color={hasError ? theme.colors.feedback.error : 'tertiary'}
|
|
223
|
+
style={{ marginTop: 8, marginLeft: 8 }}
|
|
224
|
+
>
|
|
225
|
+
{message}
|
|
226
|
+
</Text>
|
|
227
|
+
) : null}
|
|
228
|
+
</View>
|
|
229
|
+
);
|
|
230
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Input, type InputProps, type InputSize } from './Input';
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { useMemo, type ReactNode } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
ActivityIndicator,
|
|
4
|
+
Pressable,
|
|
5
|
+
View,
|
|
6
|
+
type PressableProps,
|
|
7
|
+
type PressableStateCallbackType,
|
|
8
|
+
type StyleProp,
|
|
9
|
+
type TextStyle,
|
|
10
|
+
type ViewStyle,
|
|
11
|
+
} from 'react-native';
|
|
12
|
+
import { useTheme } from '../../theme';
|
|
13
|
+
import type { TypographyVariant } from '../../theme/typography';
|
|
14
|
+
import { Text } from '../Text/Text';
|
|
15
|
+
|
|
16
|
+
/** Link styles — the Figma "Link buttons" frame (default / destructive). */
|
|
17
|
+
export type LinkButtonVariant = 'default' | 'destructive';
|
|
18
|
+
|
|
19
|
+
export type LinkButtonSize = 'md' | 'lg';
|
|
20
|
+
|
|
21
|
+
export interface LinkButtonProps extends Omit<PressableProps, 'style' | 'children'> {
|
|
22
|
+
/** Link label. */
|
|
23
|
+
label: string;
|
|
24
|
+
/** Color intent. Defaults to `default`. */
|
|
25
|
+
variant?: LinkButtonVariant;
|
|
26
|
+
/** Underline the label (Figma "underline" styles). Defaults to false. */
|
|
27
|
+
underline?: boolean;
|
|
28
|
+
/** Typography size: `md` = 16, `lg` = 18. Defaults to `md`. */
|
|
29
|
+
size?: LinkButtonSize;
|
|
30
|
+
/** Dim and block presses. */
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
/** Show a spinner in the leading slot and block presses. The label stays visible. */
|
|
33
|
+
loading?: boolean;
|
|
34
|
+
/** Element rendered before the label. */
|
|
35
|
+
leftIcon?: ReactNode;
|
|
36
|
+
/** Element rendered after the label. */
|
|
37
|
+
rightIcon?: ReactNode;
|
|
38
|
+
/** Override the container style. */
|
|
39
|
+
style?: StyleProp<ViewStyle>;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const SIZES: Record<LinkButtonSize, { textVariant: TypographyVariant; gap: number; iconSize: number }> = {
|
|
43
|
+
md: { textVariant: 'bodyMedium', gap: 8, iconSize: 20 },
|
|
44
|
+
lg: { textVariant: 'bodyLarge', gap: 10, iconSize: 24 },
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Text link with an optional underline — faithful to the Bacon POS Figma
|
|
49
|
+
* "Link buttons" frame. No background; sits inline with copy.
|
|
50
|
+
*/
|
|
51
|
+
export function LinkButton({
|
|
52
|
+
label,
|
|
53
|
+
variant = 'default',
|
|
54
|
+
underline = false,
|
|
55
|
+
size = 'md',
|
|
56
|
+
disabled = false,
|
|
57
|
+
loading = false,
|
|
58
|
+
leftIcon,
|
|
59
|
+
rightIcon,
|
|
60
|
+
style,
|
|
61
|
+
...rest
|
|
62
|
+
}: LinkButtonProps) {
|
|
63
|
+
const theme = useTheme();
|
|
64
|
+
const sizeConfig = SIZES[size];
|
|
65
|
+
const isDisabled = disabled || loading;
|
|
66
|
+
|
|
67
|
+
const textColor = isDisabled
|
|
68
|
+
? theme.colors.disabled.foreground
|
|
69
|
+
: variant === 'destructive'
|
|
70
|
+
? theme.colors.state.destructiveSubtleForeground
|
|
71
|
+
: theme.colors.action.secondaryForeground; // neutral-800, Figma text/foreground
|
|
72
|
+
|
|
73
|
+
const labelStyle: TextStyle = underline ? { textDecorationLine: 'underline' } : {};
|
|
74
|
+
|
|
75
|
+
const containerStyle = useMemo(
|
|
76
|
+
() =>
|
|
77
|
+
({ pressed }: PressableStateCallbackType): StyleProp<ViewStyle> => [
|
|
78
|
+
{
|
|
79
|
+
flexDirection: 'row',
|
|
80
|
+
alignItems: 'center',
|
|
81
|
+
alignSelf: 'flex-start',
|
|
82
|
+
gap: sizeConfig.gap,
|
|
83
|
+
paddingVertical: 2,
|
|
84
|
+
opacity: pressed && !isDisabled ? 0.6 : 1,
|
|
85
|
+
} satisfies ViewStyle,
|
|
86
|
+
style,
|
|
87
|
+
],
|
|
88
|
+
[sizeConfig, isDisabled, style],
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
const iconBox: ViewStyle = {
|
|
92
|
+
width: sizeConfig.iconSize,
|
|
93
|
+
height: sizeConfig.iconSize,
|
|
94
|
+
alignItems: 'center',
|
|
95
|
+
justifyContent: 'center',
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<Pressable
|
|
100
|
+
accessibilityRole="link"
|
|
101
|
+
accessibilityState={{ disabled: isDisabled, busy: loading }}
|
|
102
|
+
disabled={isDisabled}
|
|
103
|
+
hitSlop={8}
|
|
104
|
+
style={containerStyle}
|
|
105
|
+
{...rest}
|
|
106
|
+
>
|
|
107
|
+
{loading ? (
|
|
108
|
+
<ActivityIndicator color={textColor} size="small" />
|
|
109
|
+
) : leftIcon ? (
|
|
110
|
+
<View style={iconBox}>{leftIcon}</View>
|
|
111
|
+
) : null}
|
|
112
|
+
<Text variant={sizeConfig.textVariant} weight="medium" color={textColor} style={labelStyle}>
|
|
113
|
+
{label}
|
|
114
|
+
</Text>
|
|
115
|
+
{!loading && rightIcon ? <View style={iconBox}>{rightIcon}</View> : null}
|
|
116
|
+
</Pressable>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Image,
|
|
4
|
+
Pressable,
|
|
5
|
+
View,
|
|
6
|
+
type ImageSourcePropType,
|
|
7
|
+
type PressableStateCallbackType,
|
|
8
|
+
type StyleProp,
|
|
9
|
+
type ViewStyle,
|
|
10
|
+
} from 'react-native';
|
|
11
|
+
import { useTheme } from '../../theme';
|
|
12
|
+
import { palette } from '../../theme/palette';
|
|
13
|
+
import { Icon } from '../Icon/Icon';
|
|
14
|
+
import { Text } from '../Text/Text';
|
|
15
|
+
|
|
16
|
+
const PHOTO_HEIGHT = 104;
|
|
17
|
+
const NO_PHOTO_ICON = 48;
|
|
18
|
+
|
|
19
|
+
export interface ProductCardProps {
|
|
20
|
+
/** Product name (up to 2 lines). */
|
|
21
|
+
name: string;
|
|
22
|
+
/** Pre-formatted price string, e.g. "$5.50". */
|
|
23
|
+
price: string;
|
|
24
|
+
/** Product image. Omit for the no-photo layout; on load error it falls back to a placeholder. */
|
|
25
|
+
image?: ImageSourcePropType;
|
|
26
|
+
/** Category label shown on the photo (e.g. "Starters"). */
|
|
27
|
+
category?: string;
|
|
28
|
+
/** Category pill background color. Defaults to the design's light category tint. */
|
|
29
|
+
categoryColor?: string;
|
|
30
|
+
/** When > 0, shows the lime quantity badge. */
|
|
31
|
+
quantity?: number;
|
|
32
|
+
/** Makes the card pressable. */
|
|
33
|
+
onPress?: () => void;
|
|
34
|
+
/** Dim and block presses. */
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
/** Override the container style (e.g. width in a grid). */
|
|
37
|
+
style?: StyleProp<ViewStyle>;
|
|
38
|
+
/** Accessibility label. Defaults to "{name}, {price}". */
|
|
39
|
+
accessibilityLabel?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Product tile — faithful to the Bacon POS Figma "Product card". Photo with an
|
|
44
|
+
* optional category pill, name + price, and a lime quantity badge. Handles three
|
|
45
|
+
* states: with photo, image-load failure (placeholder), and no photo (shorter).
|
|
46
|
+
*/
|
|
47
|
+
export function ProductCard({
|
|
48
|
+
name,
|
|
49
|
+
price,
|
|
50
|
+
image,
|
|
51
|
+
category,
|
|
52
|
+
categoryColor = '#FDD8D8', // dish-category/1-light (category-specific tint)
|
|
53
|
+
quantity,
|
|
54
|
+
onPress,
|
|
55
|
+
disabled = false,
|
|
56
|
+
style,
|
|
57
|
+
accessibilityLabel,
|
|
58
|
+
}: ProductCardProps) {
|
|
59
|
+
const theme = useTheme();
|
|
60
|
+
const [errored, setErrored] = useState(false);
|
|
61
|
+
|
|
62
|
+
const hasPhoto = image != null;
|
|
63
|
+
const showBadge = typeof quantity === 'number' && quantity > 0;
|
|
64
|
+
|
|
65
|
+
const containerStyle: ViewStyle = {
|
|
66
|
+
backgroundColor: theme.colors.background.default,
|
|
67
|
+
borderRadius: theme.radii['2xl'],
|
|
68
|
+
padding: 8,
|
|
69
|
+
overflow: 'hidden',
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const categoryPill = (extra: ViewStyle) =>
|
|
73
|
+
category ? (
|
|
74
|
+
<View
|
|
75
|
+
style={{
|
|
76
|
+
backgroundColor: categoryColor,
|
|
77
|
+
paddingHorizontal: 8,
|
|
78
|
+
paddingVertical: 4,
|
|
79
|
+
borderRadius: theme.radii.pill,
|
|
80
|
+
...extra,
|
|
81
|
+
}}
|
|
82
|
+
>
|
|
83
|
+
<Text variant="bodySmall" weight="medium" color="primary" numberOfLines={1}>
|
|
84
|
+
{category}
|
|
85
|
+
</Text>
|
|
86
|
+
</View>
|
|
87
|
+
) : null;
|
|
88
|
+
|
|
89
|
+
const content = (
|
|
90
|
+
<>
|
|
91
|
+
{hasPhoto ? (
|
|
92
|
+
<View
|
|
93
|
+
style={{
|
|
94
|
+
height: PHOTO_HEIGHT,
|
|
95
|
+
width: '100%',
|
|
96
|
+
borderTopLeftRadius: theme.radii.xl,
|
|
97
|
+
borderTopRightRadius: theme.radii.xl,
|
|
98
|
+
overflow: 'hidden',
|
|
99
|
+
backgroundColor: errored ? palette.neutral[200] : theme.colors.background.default,
|
|
100
|
+
alignItems: 'center',
|
|
101
|
+
justifyContent: 'center',
|
|
102
|
+
}}
|
|
103
|
+
>
|
|
104
|
+
{errored ? (
|
|
105
|
+
<Icon name="no-photo" size={NO_PHOTO_ICON} color="tertiary" />
|
|
106
|
+
) : (
|
|
107
|
+
<Image
|
|
108
|
+
source={image}
|
|
109
|
+
resizeMode="cover"
|
|
110
|
+
onError={() => setErrored(true)}
|
|
111
|
+
style={{ width: '100%', height: '100%' }}
|
|
112
|
+
/>
|
|
113
|
+
)}
|
|
114
|
+
{/* Category pill sits on the photo, bottom-left. */}
|
|
115
|
+
{categoryPill({ position: 'absolute', left: 10, bottom: 8 })}
|
|
116
|
+
</View>
|
|
117
|
+
) : null}
|
|
118
|
+
|
|
119
|
+
<View style={{ gap: 12, paddingTop: 16, paddingBottom: 10, paddingHorizontal: 10, width: '100%' }}>
|
|
120
|
+
{/* No photo: the category pill moves inline, above the name. */}
|
|
121
|
+
{!hasPhoto ? categoryPill({ alignSelf: 'flex-start' }) : null}
|
|
122
|
+
<Text variant="h2" weight="semibold" color="primary" numberOfLines={2}>
|
|
123
|
+
{name}
|
|
124
|
+
</Text>
|
|
125
|
+
<Text variant="bodyMedium" weight="medium" color="tertiary" numberOfLines={1}>
|
|
126
|
+
{price}
|
|
127
|
+
</Text>
|
|
128
|
+
</View>
|
|
129
|
+
|
|
130
|
+
{showBadge ? (
|
|
131
|
+
<View
|
|
132
|
+
style={{
|
|
133
|
+
position: 'absolute',
|
|
134
|
+
top: 16,
|
|
135
|
+
right: 16,
|
|
136
|
+
width: 32,
|
|
137
|
+
height: 32,
|
|
138
|
+
borderRadius: theme.radii.pill,
|
|
139
|
+
backgroundColor: theme.colors.action.primary,
|
|
140
|
+
alignItems: 'center',
|
|
141
|
+
justifyContent: 'center',
|
|
142
|
+
boxShadow: [
|
|
143
|
+
{ offsetX: 0, offsetY: 10, blurRadius: 7.5, spreadDistance: 0, color: 'rgba(0,0,0,0.04)' },
|
|
144
|
+
{ offsetX: 0, offsetY: 4, blurRadius: 3, spreadDistance: 0, color: 'rgba(0,0,0,0.04)' },
|
|
145
|
+
] as ViewStyle['boxShadow'],
|
|
146
|
+
}}
|
|
147
|
+
>
|
|
148
|
+
<Text variant="bodyMedium" weight="medium" color={theme.colors.action.primaryForeground}>
|
|
149
|
+
{quantity}
|
|
150
|
+
</Text>
|
|
151
|
+
</View>
|
|
152
|
+
) : null}
|
|
153
|
+
</>
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
if (!onPress) {
|
|
157
|
+
return <View style={[containerStyle, style]}>{content}</View>;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return (
|
|
161
|
+
<Pressable
|
|
162
|
+
accessibilityRole="button"
|
|
163
|
+
accessibilityLabel={accessibilityLabel ?? `${name}, ${price}`}
|
|
164
|
+
accessibilityState={{ disabled }}
|
|
165
|
+
disabled={disabled}
|
|
166
|
+
onPress={onPress}
|
|
167
|
+
style={({ pressed }: PressableStateCallbackType) => [
|
|
168
|
+
containerStyle,
|
|
169
|
+
{ opacity: disabled ? 0.5 : pressed ? 0.96 : 1 },
|
|
170
|
+
style,
|
|
171
|
+
]}
|
|
172
|
+
>
|
|
173
|
+
{content}
|
|
174
|
+
</Pressable>
|
|
175
|
+
);
|
|
176
|
+
}
|