@faststore/core 0.3.5 → 0.3.7

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.
Files changed (91) hide show
  1. package/.github/workflows/release.yml +1 -1
  2. package/.storybook/preview.js +0 -4
  3. package/CHANGELOG.md +9 -0
  4. package/README.md +13 -11
  5. package/cypress/integration/analytics.test.js +1 -1
  6. package/cypress/integration/search.test.js +1 -1
  7. package/package.json +17 -16
  8. package/src/components/cart/CartItem/CartItem.tsx +4 -4
  9. package/src/components/cart/CartSidebar/CartSidebar.stories.mdx +3 -3
  10. package/src/components/cart/CartSidebar/CartSidebar.tsx +14 -11
  11. package/src/components/cart/CartToggle/CartToggle.tsx +6 -4
  12. package/src/components/cart/EmptyCart/EmptyCart.tsx +4 -3
  13. package/src/components/common/Footer/Footer.tsx +9 -5
  14. package/src/components/common/Footer/FooterLinks.tsx +1 -1
  15. package/src/components/common/Navbar/Navbar.tsx +4 -6
  16. package/src/components/common/Navbar/NavbarSlider.tsx +3 -5
  17. package/src/components/common/Navbar/navbar.module.scss +1 -1
  18. package/src/components/product/OutOfStock/OutOfStock.tsx +5 -5
  19. package/src/components/product/ProductCard/ProductCard.stories.mdx +14 -14
  20. package/src/components/product/ProductCard/ProductCard.tsx +10 -9
  21. package/src/components/regionalization/Regionalization.stories.mdx +2 -6
  22. package/src/components/regionalization/RegionalizationBar/RegionalizationBar.tsx +3 -3
  23. package/src/components/regionalization/RegionalizationButton/RegionalizationButton.tsx +4 -3
  24. package/src/components/regionalization/RegionalizationInput/RegionalizationInput.tsx +2 -2
  25. package/src/components/regionalization/RegionalizationModal/RegionalizationModalContent.tsx +3 -2
  26. package/src/components/search/Filter/Facets.tsx +9 -6
  27. package/src/components/search/Filter/FilterSlider.tsx +6 -6
  28. package/src/components/search/SearchHistory/SearchHistory.tsx +4 -5
  29. package/src/components/search/SearchInput/search-input.module.scss +1 -14
  30. package/src/components/search/SearchTop/SearchTop.tsx +4 -5
  31. package/src/components/search/Sort/Sort.tsx +2 -3
  32. package/src/components/sections/BannerText/banner-text.module.scss +6 -6
  33. package/src/components/sections/Incentives/Incentives.tsx +1 -1
  34. package/src/components/sections/Newsletter/Newsletter.tsx +10 -8
  35. package/src/components/sections/Newsletter/newsletter.module.scss +1 -1
  36. package/src/components/sections/ProducDetailsContent/ProductDetailsContent.tsx +1 -1
  37. package/src/components/sections/ProducDetailsContent/product-details-content.module.scss +0 -9
  38. package/src/components/sections/ProductDetails/ProductDetails.tsx +11 -5
  39. package/src/components/sections/ProductDetails/product-details.module.scss +1 -1
  40. package/src/components/sections/ProductGallery/ProductGallery.tsx +4 -3
  41. package/src/components/sections/ScrollToTopButton/ScrollToTopButton.tsx +5 -4
  42. package/src/components/ui/Alert/Alert.tsx +7 -4
  43. package/src/components/ui/Button/Button.stories.mdx +3 -44
  44. package/src/components/ui/Button/ButtonLink/ButtonLink.tsx +2 -1
  45. package/src/components/ui/Button/button.module.scss +0 -381
  46. package/src/components/ui/Button/index.ts +0 -3
  47. package/src/components/ui/Gift/Gift.tsx +2 -2
  48. package/src/components/ui/ImageGallery/ImageGallerySelector.tsx +5 -5
  49. package/src/components/ui/ImageGallery/image-gallery-selector.module.scss +6 -0
  50. package/src/components/ui/Link/Link.tsx +19 -34
  51. package/src/components/ui/PriceRange/PriceRange.tsx +6 -4
  52. package/src/components/ui/PriceRange/price-range.module.scss +1 -1
  53. package/src/components/ui/ProductTitle/ProductTitle.stories.mdx +13 -15
  54. package/src/components/ui/QuantitySelector/quantity-selector.module.scss +21 -26
  55. package/src/components/ui/ShippingSimulation/ShippingSimulation.stories.mdx +1 -1
  56. package/src/components/ui/ShippingSimulation/ShippingSimulation.tsx +8 -3
  57. package/src/components/ui/SlideOver/SlideOver.stories.mdx +3 -3
  58. package/src/pages/_app.tsx +3 -4
  59. package/src/styles/global/components.scss +0 -3
  60. package/src/styles/global/storybook-components.scss +3 -3
  61. package/src/styles/global/utilities.scss +12 -5
  62. package/src/components/ui/Badge/Badge.stories.mdx +0 -465
  63. package/src/components/ui/Badge/Badge.tsx +0 -76
  64. package/src/components/ui/Badge/DiscountBadge.stories.mdx +0 -191
  65. package/src/components/ui/Badge/DiscountBadge.tsx +0 -57
  66. package/src/components/ui/Badge/badge.module.scss +0 -252
  67. package/src/components/ui/Badge/index.ts +0 -4
  68. package/src/components/ui/Button/Button.tsx +0 -85
  69. package/src/components/ui/Button/ButtonBuy/ButtonBuy.tsx +0 -24
  70. package/src/components/ui/Button/ButtonBuy/index.ts +0 -1
  71. package/src/components/ui/Checkbox/Checkbox.stories.mdx +0 -268
  72. package/src/components/ui/Checkbox/Checkbox.tsx +0 -20
  73. package/src/components/ui/Checkbox/checkbox.module.scss +0 -157
  74. package/src/components/ui/Checkbox/index.ts +0 -2
  75. package/src/components/ui/InputText/InputText.stories.mdx +0 -311
  76. package/src/components/ui/InputText/InputText.tsx +0 -128
  77. package/src/components/ui/InputText/index.ts +0 -2
  78. package/src/components/ui/InputText/input-text.module.scss +0 -168
  79. package/src/components/ui/Link/link.module.scss +0 -98
  80. package/src/components/ui/Radio/Radio.stories.mdx +0 -237
  81. package/src/components/ui/Radio/Radio.tsx +0 -36
  82. package/src/components/ui/Radio/index.ts +0 -2
  83. package/src/components/ui/Radio/radio.module.scss +0 -122
  84. package/src/components/ui/Select/Select.stories.mdx +0 -168
  85. package/src/components/ui/Select/Select.tsx +0 -70
  86. package/src/components/ui/Select/index.ts +0 -2
  87. package/src/components/ui/Select/select.module.scss +0 -85
  88. package/src/components/ui/SlideOver/overlay.scss +0 -14
  89. package/src/styles/global/resets.scss +0 -48
  90. package/src/styles/global/tokens.scss +0 -276
  91. package/src/styles/global/typography.scss +0 -66
@@ -1,168 +0,0 @@
1
- @import "src/styles/scaffold";
2
-
3
- .fs-input-text {
4
- // --------------------------------------------------------
5
- // Design Tokens for Input Text
6
- // --------------------------------------------------------
7
-
8
- // Default properties
9
- --fs-input-padding : var(--fs-spacing-2) var(--fs-spacing-2) 0;
10
- --fs-input-height : var(--fs-control-tap-size);
11
-
12
- --fs-input-box-shadow : none;
13
- --fs-input-box-shadow-hover : 0 0 0 var(--fs-border-width) var(--fs-border-color-active);
14
-
15
- --fs-input-border-radius : var(--fs-border-radius);
16
- --fs-input-border-width : var(--fs-border-width);
17
- --fs-input-border-color : var(--fs-border-color);
18
- --fs-input-border-color-hover : var(--fs-border-color-active);
19
-
20
- --fs-input-text-color : var(--fs-color-text);
21
- --fs-input-text-size : var(--fs-text-size-body);
22
-
23
- --fs-input-line-height : 1.25;
24
-
25
- --fs-input-transition-function : var(--fs-transition-function);
26
- --fs-input-transition-property : var(--fs-transition-property);
27
- --fs-input-transition-timing : var(--fs-transition-timing);
28
-
29
- // Label
30
- --fs-input-label-padding : 0 var(--fs-spacing-2);
31
- --fs-input-label-color : var(--fs-color-text-light);
32
- --fs-input-label-size : var(--fs-text-size-tiny);
33
-
34
- // Error
35
- --fs-input-error-message-size : var(--fs-text-size-legend);
36
- --fs-input-error-message-line-height : 1.1;
37
- --fs-input-error-message-margin-top : var(--fs-spacing-0);
38
- --fs-input-error-message-color : var(--fs-color-danger-text);
39
- --fs-input-error-border-color : var(--fs-color-danger-border);
40
- --fs-input-error-box-shadow : 0 0 0 var(--fs-border-width) var(--fs-input-error-border-color);
41
- --fs-input-error-focus-ring : var(--fs-color-focus-ring-danger);
42
-
43
- // Disabled
44
- --fs-input-disabled-bkg-color : var(--fs-color-disabled-bkg);
45
- --fs-input-disabled-text-color : var(--fs-color-disabled-text);
46
- --fs-input-disabled-border-width : var(--fs-border-width);
47
- --fs-input-disabled-border-color : var(--fs-border-color);
48
-
49
- // --------------------------------------------------------
50
- // Structural Styles
51
- // --------------------------------------------------------
52
-
53
- position: relative;
54
- display: flex;
55
- flex-flow: column;
56
-
57
- input,
58
- label {
59
- transition: var(--fs-input-transition-property) var(--fs-input-transition-timing) var(--fs-input-transition-function);
60
- }
61
-
62
- input {
63
- height: var(--fs-input-height);
64
- padding: var(--fs-input-padding);
65
- font-size: var(--fs-input-text-size);
66
- line-height: var(--fs-input-line-height);
67
- color: var(--fs-input-text-color);
68
- border: var(--fs-input-border-width) solid var(--fs-input-border-color);
69
- border-radius: var(--fs-input-border-radius);
70
- box-shadow: var(--fs-input-box-shadow);
71
-
72
- @include input-focus-ring;
73
-
74
- &:placeholder-shown + label {
75
- top: calc(1.5 * (var(--fs-input-text-size) / 2));
76
- overflow: hidden;
77
- }
78
-
79
- &::placeholder {
80
- opacity: 0;
81
- transition: inherit;
82
- }
83
-
84
- &:focus::placeholder {
85
- opacity: 1;
86
- }
87
-
88
- &:not(:placeholder-shown) + label,
89
- &:focus + label {
90
- top: rem(6px);
91
- font-size: var(--fs-input-label-size);
92
- }
93
-
94
- &:hover:not(:disabled):not(:focus-visible):not(:focus) {
95
- border-color: var(--fs-input-border-color-hover);
96
- box-shadow: var(--fs-input-box-shadow-hover);
97
- }
98
-
99
- &:disabled {
100
- cursor: not-allowed;
101
- background-color: var(--fs-input-disabled-bkg-color);
102
- border: var(--fs-input-disabled-border-width) solid var(--fs-input-disabled-border-color);
103
- + label { cursor: not-allowed; }
104
- }
105
- }
106
-
107
- label {
108
- position: absolute;
109
- padding: var(--fs-input-label-padding);
110
- font-size: var(--fs-input-text-size);
111
- line-height: 1.5;
112
- color: var(--fs-input-label-color);
113
- }
114
-
115
- // --------------------------------------------------------
116
- // Variants Styles
117
- // --------------------------------------------------------
118
-
119
- &[data-fs-input-text-error="true"] {
120
- input {
121
- border-color: var(--fs-input-error-border-color);
122
-
123
- @include input-focus-ring($outline: #{var(--fs-input-error-focus-ring)},
124
- $border: #{var(--fs-input-error-border-color)});
125
-
126
- &:hover:not(:disabled):not(:focus-visible):not(:focus) {
127
- border-color: var(--fs-input-error-border-color);
128
- box-shadow: var(--fs-input-error-box-shadow);
129
- }
130
- }
131
-
132
- [data-fs-input-text-error-message] {
133
- margin-top: var(--fs-input-error-message-margin-top);
134
- font-size: var(--fs-input-error-message-size);
135
- line-height: var(--fs-input-error-message-line-height);
136
- color: var(--fs-input-error-message-color);
137
- }
138
- }
139
-
140
- &[data-fs-input-text-actionable="true"] {
141
- min-width: rem(250px);
142
-
143
- input {
144
- padding-right: var(--fs-spacing-13);
145
- }
146
-
147
- [data-fs-button] {
148
- position: absolute;
149
- top: var(--fs-spacing-1);
150
- right: var(--fs-spacing-1);
151
-
152
- &::before {
153
- position: absolute;
154
- left: calc(-1 * var(--fs-spacing-1));
155
- width: 1px;
156
- height: 80%;
157
- content: "";
158
- background-color: var(--fs-input-border-color);
159
- }
160
- }
161
-
162
- [data-fs-button][data-fs-icon-button] {
163
- &::before {
164
- left: calc(-1 * var(--fs-spacing-1));
165
- }
166
- }
167
- }
168
- }
@@ -1,98 +0,0 @@
1
- @import "src/styles/scaffold";
2
-
3
- .fs-link {
4
- // --------------------------------------------------------
5
- // Design Tokens for Link
6
- // --------------------------------------------------------
7
-
8
- // Default properties
9
- --fs-link-min-width : auto;
10
- --fs-link-min-height : var(--fs-link-min-width);
11
- --fs-link-padding : var(--fs-spacing-2) var(--fs-spacing-0);
12
- --fs-link-border-radius : var(--fs-border-radius);
13
-
14
- --fs-link-text-line-height : 1.5;
15
- --fs-link-text-color : var(--fs-color-link);
16
- --fs-link-text-color-visited : var(--fs-color-link-visited);
17
- --fs-link-text-decoration : none;
18
- --fs-link-text-decoration-hover : underline;
19
-
20
- --fs-link-transition-function : var(--fs-transition-function);
21
- --fs-link-transition-property : var(--fs-transition-property);
22
- --fs-link-transition-timing : var(--fs-transition-timing);
23
-
24
- // Inverse
25
- --fs-link-inverse-text-color : var(--fs-color-link-inverse);
26
- --fs-link-inverse-text-color-visited : var(--fs-link-inverse-text-color);
27
-
28
- // Display
29
- --fs-link-display-text-line-height : var(--fs-link-text-line-height);
30
- --fs-link-display-text-color : var(--fs-color-text-display);
31
- --fs-link-display-text-color-visited : var(--fs-link-display-text-color);
32
-
33
- // Inline
34
- --fs-link-inline-padding : 0;
35
- --fs-link-inline-text-decoration : underline;
36
- --fs-link-inline-text-color : var(--fs-link-text-color);
37
-
38
- // Footer
39
- --fs-link-footer-text-size : var(--fs-text-size-1);
40
- --fs-link-footer-text-color : var(--fs-color-info-text);
41
- --fs-link-footer-padding : var(--fs-spacing-1) var(--fs-spacing-0);
42
-
43
- // --------------------------------------------------------
44
- // Structural Styles
45
- // --------------------------------------------------------
46
-
47
- min-width: var(--fs-link-min-width);
48
- min-height: var(--fs-link-min-height);
49
- padding: var(--fs-link-padding);
50
- text-decoration: var(--fs-link-text-decoration);
51
-
52
- &:hover { text-decoration: var(--fs-link-text-decoration-hover); }
53
-
54
- &:visited { color: var(--fs-link-text-color-visited); }
55
-
56
- a, [data-fs-link] {
57
- border-radius: var(--fs-link-border-radius);
58
- transition: var(--fs-link-transition-property) var(--fs-link-transition-timing) var(--fs-link-transition-function);
59
-
60
- @include focus-ring-visible;
61
- }
62
-
63
- // --------------------------------------------------------
64
- // Variants Styles
65
- // --------------------------------------------------------
66
-
67
- &[data-fs-link-variant="default"] {
68
- line-height: var(--fs-link-text-line-height);
69
- color: var(--fs-link-text-color);
70
- }
71
-
72
- &[data-fs-link-variant="display"] {
73
- line-height: var(--fs-link-display-text-line-height);
74
- color: var(--fs-link-display-text-color);
75
-
76
- &:visited { color: var(--fs-link-display-text-color-visited); }
77
- }
78
-
79
- &[data-fs-link-variant="inline"] {
80
- display: inline-block;
81
- padding: var(--fs-link-inline-padding);
82
- color: var(--fs-link-inline-text-color);
83
- text-decoration: var(--fs-link-inline-text-decoration);
84
- }
85
-
86
- &[data-fs-link-variant="footer"] {
87
- font-size: var(--fs-link-footer-text-size);
88
- color: var(--fs-link-footer-text-color);
89
-
90
- @include media(">=notebook") { padding: var(--fs-link-footer-padding); }
91
- }
92
-
93
- &[data-fs-link-inverse="true"] {
94
- color: var(--fs-link-inverse-text-color);
95
-
96
- &:visited { color: var(--fs-link-inverse-text-color-visited); }
97
- }
98
- }
@@ -1,237 +0,0 @@
1
- import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
2
-
3
- import Radio from '.'
4
- import {
5
- TokenTable,
6
- TokenRow,
7
- TokenDivider,
8
- } from 'src/../.storybook/components'
9
-
10
- <Meta
11
- title="Atoms/Radio"
12
- component={Radio}
13
- argTypes={{
14
- disabled: {
15
- type: {
16
- name: 'boolean',
17
- },
18
- description:
19
- 'Specifies that this input should be disabled. <br/> `boolean`',
20
- defaultValue: false,
21
- },
22
- }}
23
- />
24
-
25
- export const Template = (args) => <Radio {...args} onChange={() => {}} />
26
-
27
- <header>
28
-
29
- # Radio
30
-
31
- Radios allow users to select one option from a set.
32
-
33
- </header>
34
-
35
- ## Overview
36
-
37
- The `Radio` component uses [FastStore UI Radio](https://www.faststore.dev/reference/ui/atoms/Radio) as base.
38
-
39
- <Canvas>
40
- <Story
41
- name="overview-default-1"
42
- args={{
43
- id: 'overview-radio-default-1',
44
- label: 'Label',
45
- }}
46
- >
47
- {Template.bind({})}
48
- </Story>
49
- <Story
50
- name="overview-default-2"
51
- args={{
52
- id: 'overview-radio-default-2',
53
- label: 'Label',
54
- checked: true,
55
- }}
56
- >
57
- {Template.bind({})}
58
- </Story>
59
- <Story
60
- name="overview-default-3"
61
- args={{
62
- id: 'overview-radio-default-3',
63
- label: 'Label',
64
- disabled: true,
65
- }}
66
- >
67
- {Template.bind({})}
68
- </Story>
69
- <Story
70
- name="overview-default-4"
71
- args={{
72
- id: 'overview-radio-default-4',
73
- label: 'Label',
74
- disabled: true,
75
- checked: true,
76
- }}
77
- >
78
- {Template.bind({})}
79
- </Story>
80
- </Canvas>
81
-
82
- ---
83
-
84
- ## Usage
85
-
86
- `import Radio from '../components/ui/Radio'`
87
-
88
- <Canvas>
89
- <Story
90
- name="default"
91
- args={{
92
- id: 'radio-default',
93
- label: 'Label',
94
- }}
95
- >
96
- {Template.bind({})}
97
- </Story>
98
- </Canvas>
99
-
100
- <ArgsTable story="default" />
101
-
102
- <TokenTable>
103
- <TokenRow token="--fs-radio-width" value="1.25rem" />
104
- <TokenRow token="--fs-radio-height" value="var(--fs-radio-width)" />
105
- <TokenDivider />
106
- <TokenRow token="--fs-radio-border-width" value="var(--fs-border-width)" />
107
- <TokenRow
108
- token="--fs-radio-border-radius"
109
- value="var(--fs-border-radius-circle)"
110
- />
111
- <TokenRow
112
- token="--fs-radio-border-color"
113
- value="var(--fs-border-color)"
114
- isColor
115
- />
116
- <TokenRow
117
- token="--fs-radio-border-color-hover"
118
- value="var(--fs-border-color-hover)"
119
- isColor
120
- />
121
- <TokenDivider />
122
- <TokenRow
123
- token="--fs-radio-transition"
124
- value="border var(--fs-transition-timing) var(--fs-transition-function), background-color var(--fs-transition-timing) var(--fs-transition-function), box-shadow var(--fs-transition-timing) var(--fs-transition-function)"
125
- />
126
- <TokenDivider />
127
- <TokenRow
128
- token="--fs-radio-bkg-color-hover"
129
- value="var(--fs-color-primary-bkg-light)"
130
- isColor
131
- />
132
- <TokenRow
133
- token="--fs-radio-shadow-hover"
134
- value="0 0 0 var(--fs-radio-border-width) var(--fs-border-color-active)"
135
- />
136
- </TokenTable>
137
-
138
- ---
139
-
140
- ## Nested Elements
141
-
142
- ### Knob
143
-
144
- <TokenTable>
145
- <TokenRow token="--fs-radio-knob-width" value="var(--fs-spacing-1)" />
146
- <TokenRow token="--fs-radio-knob-height" value="var(--fs-radio-knob-width)" />
147
- <TokenRow
148
- token="--fs-radio-knob-bkg-color"
149
- value="var(--fs-color-body-bkg)"
150
- isColor
151
- />
152
- <TokenRow
153
- token="--fs-radio-knob-disabled-bkg-color"
154
- value="var(--fs-color-neutral-5)"
155
- isColor
156
- />
157
- </TokenTable>
158
-
159
- ---
160
-
161
- ## Variants
162
-
163
- ### Checked
164
-
165
- <Canvas>
166
- <Story
167
- name="checked"
168
- args={{
169
- id: 'radio-checked',
170
- label: 'Label',
171
- checked: true,
172
- }}
173
- >
174
- {Template.bind({})}
175
- </Story>
176
- </Canvas>
177
-
178
- <TokenTable>
179
- <TokenRow
180
- token="--fs-radio-checked-bkg-color"
181
- value="var(--fs-color-primary-bkg)"
182
- isColor
183
- />
184
- <TokenRow
185
- token="--fs-radio-checked-bkg-color-hover"
186
- value="var(--fs-color-primary-bkg-hover)"
187
- isColor
188
- />
189
- </TokenTable>
190
-
191
- ### Disabled
192
-
193
- <Canvas>
194
- <Story
195
- name="disabled"
196
- args={{
197
- id: 'radio-disabled',
198
- label: 'Label',
199
- disabled: true,
200
- }}
201
- >
202
- {Template.bind({})}
203
- </Story>
204
- <Story
205
- name="disabled-checked"
206
- args={{
207
- id: 'radio-disabled-checked',
208
- label: 'Label',
209
- disabled: true,
210
- checked: true,
211
- }}
212
- >
213
- {Template.bind({})}
214
- </Story>
215
- </Canvas>
216
-
217
- <TokenTable>
218
- <TokenRow
219
- token="--fs-radio-disabled-bkg-color"
220
- value="var(--fs-color-disabled-bkg)"
221
- isColor
222
- />
223
- <TokenRow
224
- token="--fs-radio-disabled-border-width"
225
- value="var(--fs-radio-border-width)"
226
- />
227
- <TokenRow
228
- token="--fs-radio-disabled-border-color"
229
- value="var(--fs-border-color-disabled)"
230
- isColor
231
- />
232
- <TokenRow
233
- token="--fs-radio-disabled-text-color"
234
- value="var(--fs-color-disabled-text)"
235
- isColor
236
- />
237
- </TokenTable>
@@ -1,36 +0,0 @@
1
- import { Radio as UIRadio, Label as UILabel } from '@faststore/ui'
2
- import type { RadioProps as UIRadioProps } from '@faststore/ui'
3
-
4
- import styles from './radio.module.scss'
5
-
6
- export type RadioProps = {
7
- /**
8
- * ID to identify input and corresponding label.
9
- */
10
- id: string
11
- /**
12
- * The text displayed to identify the input.
13
- */
14
- label: string
15
- /**
16
- * The value to identify the input.
17
- */
18
- value?: string
19
- /**
20
- * Identify radio in the same group.
21
- */
22
- name?: string
23
- } & UIRadioProps
24
-
25
- function Radio({ id, label, value, name, ...otherProps }: RadioProps) {
26
- return (
27
- <div data-fs-radio className={styles.fsRadio}>
28
- <UIRadio id={id} value={value ?? label} name={name} {...otherProps} />
29
- <UILabel data-fs-label htmlFor={id}>
30
- {label}
31
- </UILabel>
32
- </div>
33
- )
34
- }
35
-
36
- export default Radio
@@ -1,2 +0,0 @@
1
- export { default } from './Radio'
2
- export type { RadioProps } from './Radio'
@@ -1,122 +0,0 @@
1
- @import "src/styles/scaffold";
2
-
3
- .fs-radio {
4
- // --------------------------------------------------------
5
- // Design Tokens for radio
6
- // --------------------------------------------------------
7
-
8
- // Default properties
9
- --fs-radio-width : 1.25rem;
10
- --fs-radio-height : var(--fs-radio-width);
11
-
12
- --fs-radio-border-width : var(--fs-border-width);
13
- --fs-radio-border-radius : var(--fs-border-radius-circle);
14
- --fs-radio-border-color : var(--fs-border-color);
15
- --fs-radio-border-color-hover : var(--fs-border-color-hover);
16
-
17
- --fs-radio-transition : border var(--fs-transition-timing) var(--fs-transition-function), background-color var(--fs-transition-timing) var(--fs-transition-function), box-shadow var(--fs-transition-timing) var(--fs-transition-function);
18
-
19
- --fs-radio-bkg-color-hover : var(--fs-color-primary-bkg-light);
20
- --fs-radio-shadow-hover : 0 0 0 var(--fs-radio-border-width) var(--fs-border-color-active);
21
-
22
- // Knob
23
- --fs-radio-knob-width : var(--fs-spacing-1);
24
- --fs-radio-knob-height : var(--fs-radio-knob-width);
25
- --fs-radio-knob-bkg-color : var(--fs-color-body-bkg);
26
- --fs-radio-knob-disabled-bkg-color : var(--fs-color-neutral-5);
27
-
28
- // Checked
29
- --fs-radio-checked-bkg-color : var(--fs-color-primary-bkg);
30
- --fs-radio-checked-bkg-color-hover : var(--fs-color-primary-bkg-hover);
31
-
32
- // Disabled
33
- --fs-radio-disabled-bkg-color : var(--fs-color-disabled-bkg);
34
- --fs-radio-disabled-border-width : var(--fs-radio-border-width);
35
- --fs-radio-disabled-border-color : var(--fs-border-color-disabled);
36
- --fs-radio-disabled-text-color : var(--fs-color-disabled-text);
37
-
38
- // --------------------------------------------------------
39
- // Structural Styles
40
- // --------------------------------------------------------
41
-
42
- display: flex;
43
- column-gap: var(--fs-spacing-1);
44
- align-items: center;
45
-
46
- label { width: 100%; }
47
-
48
- input {
49
- position: relative;
50
- display: flex;
51
- flex-shrink: 0;
52
- align-items: center;
53
- justify-content: center;
54
- width: var(--fs-radio-width);
55
- height: var(--fs-radio-height);
56
- cursor: pointer;
57
- border: var(--fs-radio-border-width) solid var(--fs-radio-border-color);
58
- border-radius: var(--fs-radio-border-radius);
59
- outline: none;
60
- transition: var(--fs-radio-transition);
61
- appearance: none;
62
-
63
- @include input-focus-ring;
64
-
65
- &::before {
66
- width: var(--fs-radio-knob-width);
67
- height: var(--fs-radio-knob-height);
68
- pointer-events: none;
69
- content: "";
70
- background-color: var(--fs-radio-knob-bkg-color);
71
- border-radius: var(--fs-radio-border-radius);
72
- opacity: 0;
73
- }
74
-
75
- &:hover:not(:disabled) {
76
- background-color: var(--fs-radio-bkg-color-hover);
77
- }
78
-
79
- &:hover:not(:disabled):not(:focus-visible):not(:focus) {
80
- border-color: var(--fs-radio-border-color-hover);
81
- box-shadow: var(--fs-radio-shadow-hover);
82
- }
83
-
84
- &:checked {
85
- background-color: var(--fs-radio-checked-bkg-color);
86
- border: none;
87
-
88
- &::before {
89
- opacity: 1;
90
- }
91
-
92
- &:hover:not(:disabled) {
93
- background-color: var(--fs-radio-checked-bkg-color-hover);
94
- }
95
-
96
- &:hover:not(:disabled):not(:focus-visible):not(:focus) {
97
- box-shadow: none;
98
- }
99
- }
100
-
101
- &:disabled {
102
- cursor: not-allowed;
103
- background-color: var(--fs-radio-disabled-bkg-color);
104
- border: var(--fs-radio-disabled-border-width) solid var(--fs-radio-disabled-border-color);
105
-
106
- &::before {
107
- background-color: var(--fs-radio-knob-disabled-bkg-color);
108
- }
109
-
110
- &:checked {
111
- &::before {
112
- background-color: var(--fs-radio-knob-disabled-bkg-color);
113
- }
114
- }
115
-
116
- + label {
117
- color: var(--fs-radio-disabled-text-color);
118
- cursor: not-allowed;
119
- }
120
- }
121
- }
122
- }