|
1 | 1 | import React, { forwardRef, useState } from 'react';
|
2 | 2 | import styled from 'styled-components';
|
3 | 3 |
|
4 |
| -import { compose, MarginProps, margin, width, WidthProps } from 'styled-system'; |
5 |
| -import { EyeOpenIcon, EyeClosedIcon } from '../../icons'; |
| 4 | +import { compose, margin, MarginProps, width, WidthProps } from 'styled-system'; |
| 5 | +import { EyeClosedIcon, EyeOpenIcon } from '../../icons'; |
6 | 6 | import { InnerInput as Input } from '../Input/InnerInput';
|
7 | 7 | import { InputProps } from '../Input/InputProps';
|
8 | 8 | import { InputWrapperProps } from '../Input/InputWrapper';
|
9 | 9 | import { VisuallyHidden } from '../VisuallyHidden/VisuallyHidden';
|
10 |
| -import { Colors } from '../../essentials/Colors/Colors'; |
11 | 10 | import { useGeneratedId } from '../../utils/hooks/useGeneratedId';
|
| 11 | +import { getSemanticValue } from '../../utils/cssVariables'; |
12 | 12 | import { ToggleButton } from './ToggleButton';
|
13 | 13 | import { TOGGLE_MODE_BUTTON_WIDTH } from './constants';
|
14 | 14 | import { extractWidthProps, extractWrapperMarginProps } from '../../utils/extractProps';
|
@@ -51,10 +51,24 @@ const defaultAriaStrings = {
|
51 | 51 | };
|
52 | 52 |
|
53 | 53 | const iconColors = {
|
54 |
| - regular: { color: Colors.AUTHENTIC_BLUE_550, hover: Colors.AUTHENTIC_BLUE_900 }, |
55 |
| - inverted: { color: Colors.AUTHENTIC_BLUE_200, hover: Colors.AUTHENTIC_BLUE_50 } |
| 54 | + regular: { |
| 55 | + color: getSemanticValue('icon-secondary-default'), |
| 56 | + hover: getSemanticValue('icon-secondary-hover') |
| 57 | + }, |
| 58 | + inverted: { |
| 59 | + color: getSemanticValue('icon-secondary-inverted'), |
| 60 | + hover: getSemanticValue('icon-secondary-hoverInverted') |
| 61 | + } |
56 | 62 | };
|
57 | 63 |
|
| 64 | +// allow component level CSS variables to be passed via `style` prop |
| 65 | +declare module 'csstype' { |
| 66 | + interface Properties { |
| 67 | + '--wave-c-password-color'?: string; |
| 68 | + '--wave-c-password-color-hover'?: string; |
| 69 | + } |
| 70 | +} |
| 71 | + |
58 | 72 | const Password = forwardRef<HTMLDivElement, PasswordProps>(
|
59 | 73 | (
|
60 | 74 | {
|
@@ -105,9 +119,8 @@ const Password = forwardRef<HTMLDivElement, PasswordProps>(
|
105 | 119 | aria-controls={inputId}
|
106 | 120 | aria-label={isHidden ? aria.showPasswordButton : aria.hidePasswordButton}
|
107 | 121 | style={{
|
108 |
| - // https://github.com/frenic/csstype#what-should-i-do-when-i-get-type-errors |
109 |
| - ['--color' as never]: color, |
110 |
| - ['--hover-color' as never]: hover |
| 122 | + '--wave-c-password-color': color, |
| 123 | + '--wave-c-password-color-hover': hover |
111 | 124 | }}
|
112 | 125 | >
|
113 | 126 | {isHidden ? <EyeOpenIcon /> : <EyeClosedIcon />}
|
|
0 commit comments