tf-checkout-react 2.0.0-beta.2 → 2.0.0-beta.4

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.
@@ -1,6 +1,7 @@
1
1
  import React, { type FC } from 'react'
2
2
 
3
3
  import { cx } from './cx'
4
+ import { useT } from './I18nProvider'
4
5
 
5
6
  /** Quantity ± control (ticket / add-on quantities). */
6
7
  export const Stepper: FC<{
@@ -11,26 +12,29 @@ export const Stepper: FC<{
11
12
  step?: number
12
13
  disabled?: boolean
13
14
  className?: string
14
- }> = ({ value, onChange, min = 0, max = Infinity, step = 1, disabled, className }) => (
15
- <div className={cx('tf-checkout-stepper', className)}>
16
- <button
17
- type="button"
18
- className="tf-checkout-stepper__btn"
19
- aria-label="Decrease"
20
- disabled={disabled || value <= min}
21
- onClick={() => onChange(Math.max(min, value - step))}
22
- >
23
- −
24
- </button>
25
- <span className="tf-checkout-stepper__value">{value}</span>
26
- <button
27
- type="button"
28
- className="tf-checkout-stepper__btn"
29
- aria-label="Increase"
30
- disabled={disabled || value >= max}
31
- onClick={() => onChange(Math.min(max, value + step))}
32
- >
33
- +
34
- </button>
35
- </div>
36
- )
15
+ }> = ({ value, onChange, min = 0, max = Infinity, step = 1, disabled, className }) => {
16
+ const t = useT()
17
+ return (
18
+ <div className={cx('tf-checkout-stepper', className)}>
19
+ <button
20
+ type="button"
21
+ className="tf-checkout-stepper__btn"
22
+ aria-label={t('common.decrease')}
23
+ disabled={disabled || value <= min}
24
+ onClick={() => onChange(Math.max(min, value - step))}
25
+ >
26
+ −
27
+ </button>
28
+ <span className="tf-checkout-stepper__value">{value}</span>
29
+ <button
30
+ type="button"
31
+ className="tf-checkout-stepper__btn"
32
+ aria-label={t('common.increase')}
33
+ disabled={disabled || value >= max}
34
+ onClick={() => onChange(Math.min(max, value + step))}
35
+ >
36
+ +
37
+ </button>
38
+ </div>
39
+ )
40
+ }