ywana-core8 0.1.74 → 0.1.76

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 (123) hide show
  1. package/ACCORDION_EVALUATION.md +583 -0
  2. package/CHECKBOX_EVALUATION.md +273 -0
  3. package/CHIP_EVALUATION.md +542 -0
  4. package/COLOR_EVALUATION.md +524 -0
  5. package/COMPONENTS_EVALUATION.md +477 -0
  6. package/FORM_EVALUATION.md +459 -0
  7. package/HEADER_EVALUATION.md +436 -0
  8. package/ICON_EVALUATION.md +254 -0
  9. package/LIST_EVALUATION.md +574 -0
  10. package/PROGRESS_EVALUATION.md +450 -0
  11. package/RADIO_EVALUATION.md +439 -0
  12. package/RADIO_VISUAL_FIX.md +183 -0
  13. package/SECTION_IMPROVEMENTS.md +153 -0
  14. package/SWITCH_EVALUATION.md +335 -0
  15. package/SWITCH_VISUAL_FIX.md +232 -0
  16. package/TAB_EVALUATION.md +626 -0
  17. package/TEXTFIELD_EVALUATION.md +747 -0
  18. package/TOOLTIP_FIX.md +157 -0
  19. package/TREE_EVALUATION.md +708 -0
  20. package/dist/index.cjs +7900 -1615
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.css +6094 -1122
  23. package/dist/index.css.map +1 -1
  24. package/dist/index.modern.js +7929 -1645
  25. package/dist/index.modern.js.map +1 -1
  26. package/dist/index.umd.js +7900 -1615
  27. package/dist/index.umd.js.map +1 -1
  28. package/jest.config.js +24 -0
  29. package/package.json +10 -1
  30. package/src/html/accordion.css +208 -4
  31. package/src/html/accordion.example.js +390 -0
  32. package/src/html/accordion.js +284 -28
  33. package/src/html/accordion.unit.test.js +334 -0
  34. package/src/html/button.css +157 -16
  35. package/src/html/button.example.js +374 -0
  36. package/src/html/button.js +240 -60
  37. package/src/html/button.test.js +422 -0
  38. package/src/html/checkbox.css +74 -2
  39. package/src/html/checkbox.example.js +316 -0
  40. package/src/html/checkbox.js +113 -26
  41. package/src/html/checkbox.test.js +285 -0
  42. package/src/html/chip.css +230 -19
  43. package/src/html/chip.example.js +355 -0
  44. package/src/html/chip.js +321 -25
  45. package/src/html/chip.test.js +425 -0
  46. package/src/html/color.css +435 -6
  47. package/src/html/color.example.js +527 -0
  48. package/src/html/color.js +458 -9
  49. package/src/html/color.test.js +362 -4
  50. package/src/html/components.example.js +492 -0
  51. package/src/html/components_enhanced.test.js +581 -0
  52. package/src/html/form.css +70 -3
  53. package/src/html/form.example.js +385 -0
  54. package/src/html/form.js +232 -34
  55. package/src/html/form.test.js +369 -0
  56. package/src/html/header2.css +264 -0
  57. package/src/html/header2.example.js +411 -0
  58. package/src/html/header2.js +203 -0
  59. package/src/html/header2.test.js +377 -0
  60. package/src/html/icon.css +20 -2
  61. package/src/html/icon.example.js +268 -0
  62. package/src/html/icon.js +86 -16
  63. package/src/html/icon.test.js +231 -0
  64. package/src/html/index.js +1 -1
  65. package/src/html/list.css +393 -1
  66. package/src/html/list.example.js +404 -0
  67. package/src/html/list.js +583 -40
  68. package/src/html/list.test.js +383 -0
  69. package/src/html/progress.css +707 -17
  70. package/src/html/progress.example.js +424 -0
  71. package/src/html/progress.js +906 -9
  72. package/src/html/progress.test.js +313 -0
  73. package/src/html/property.css +399 -0
  74. package/src/html/property.example.js +553 -0
  75. package/src/html/property.js +393 -15
  76. package/src/html/property.test.js +351 -2
  77. package/src/html/radio-visual-test.js +289 -0
  78. package/src/html/radio.css +137 -11
  79. package/src/html/radio.example.js +389 -0
  80. package/src/html/radio.js +234 -10
  81. package/src/html/radio.test.js +318 -0
  82. package/src/html/section.example.js +99 -0
  83. package/src/html/section.js +40 -3
  84. package/src/html/section.test.js +131 -0
  85. package/src/html/selector.css +329 -3
  86. package/src/html/selector.js +369 -23
  87. package/src/html/switch-debug.js +197 -0
  88. package/src/html/switch-test-visual.js +294 -0
  89. package/src/html/switch.css +200 -0
  90. package/src/html/switch.example.js +461 -0
  91. package/src/html/switch.js +283 -23
  92. package/src/html/switch.test.js +355 -0
  93. package/src/html/tab.css +288 -0
  94. package/src/html/tab.example.js +446 -0
  95. package/src/html/tab.js +387 -22
  96. package/src/html/tab_enhanced.js +378 -0
  97. package/src/html/tab_enhanced.test.js +504 -0
  98. package/src/html/table2.css +576 -0
  99. package/src/html/table2.example.js +703 -0
  100. package/src/html/table2.js +1252 -0
  101. package/src/html/table2.migration.md +328 -0
  102. package/src/html/table2.test.js +582 -0
  103. package/src/html/text.css +375 -0
  104. package/src/html/text.js +311 -20
  105. package/src/html/textfield.js +1 -1
  106. package/src/html/textfield2.css +842 -0
  107. package/src/html/textfield2.example.js +499 -0
  108. package/src/html/textfield2.js +1130 -0
  109. package/src/html/textfield2.test.js +950 -0
  110. package/src/html/thumbnail.css +289 -2
  111. package/src/html/thumbnail.js +214 -9
  112. package/src/html/tokenfield.css +449 -1
  113. package/src/html/tokenfield.example.js +503 -0
  114. package/src/html/tokenfield.js +561 -56
  115. package/src/html/tokenfield.test.js +423 -0
  116. package/src/html/tooltip-positioning-demo.js +187 -0
  117. package/src/html/tooltip.css +25 -2
  118. package/src/html/tree.css +228 -0
  119. package/src/html/tree.example.js +475 -0
  120. package/src/html/tree.js +712 -28
  121. package/src/html/tree_enhanced.test.js +495 -0
  122. package/table2.test.js +454 -0
  123. package/src/html/button.tsx +0 -38
@@ -0,0 +1,422 @@
1
+ import React from 'react'
2
+ import { Button, ActionButton } from './button'
3
+
4
+ // Pruebas unitarias para los componentes Button
5
+ describe('Button Components', () => {
6
+ // Mock de los componentes dependientes
7
+ const mockText = jest.fn()
8
+ const mockIcon = jest.fn()
9
+
10
+ beforeEach(() => {
11
+ jest.clearAllMocks()
12
+
13
+ // Mock del componente Text
14
+ jest.doMock('./text', () => ({
15
+ Text: mockText
16
+ }))
17
+
18
+ // Mock del componente Icon
19
+ jest.doMock('./icon', () => ({
20
+ Icon: mockIcon
21
+ }))
22
+
23
+ // Mock de console.warn para las pruebas
24
+ jest.spyOn(console, 'warn').mockImplementation(() => {})
25
+ })
26
+
27
+ afterEach(() => {
28
+ console.warn.mockRestore()
29
+ })
30
+
31
+ describe('Button Component', () => {
32
+ test('component exports correctly', () => {
33
+ expect(Button).toBeDefined()
34
+ expect(typeof Button).toBe('function')
35
+ })
36
+
37
+ test('component has correct PropTypes', () => {
38
+ expect(Button.propTypes).toBeDefined()
39
+ expect(Button.propTypes.id).toBeDefined()
40
+ expect(Button.propTypes.label).toBeDefined()
41
+ expect(Button.propTypes.icon).toBeDefined()
42
+ expect(Button.propTypes.action).toBeDefined()
43
+ expect(Button.propTypes.disabled).toBeDefined()
44
+ expect(Button.propTypes.loading).toBeDefined()
45
+ expect(Button.propTypes.outlined).toBeDefined()
46
+ expect(Button.propTypes.raised).toBeDefined()
47
+ expect(Button.propTypes.size).toBeDefined()
48
+ expect(Button.propTypes.type).toBeDefined()
49
+ expect(Button.propTypes.className).toBeDefined()
50
+ expect(Button.propTypes.ariaLabel).toBeDefined()
51
+ expect(Button.propTypes.onClick).toBeDefined()
52
+ })
53
+
54
+ test('component has correct defaultProps', () => {
55
+ expect(Button.defaultProps).toBeDefined()
56
+ expect(Button.defaultProps.disabled).toBe(false)
57
+ expect(Button.defaultProps.loading).toBe(false)
58
+ expect(Button.defaultProps.outlined).toBe(false)
59
+ expect(Button.defaultProps.raised).toBe(false)
60
+ expect(Button.defaultProps.size).toBe('normal')
61
+ expect(Button.defaultProps.type).toBe('button')
62
+ expect(Button.defaultProps.className).toBe('')
63
+ })
64
+
65
+ test('warns when accessibility props are missing', () => {
66
+ const validateAccessibility = (label, icon, ariaLabel) => {
67
+ if (!label && !icon && !ariaLabel) {
68
+ console.warn('Button component: label, icon, or ariaLabel prop is required for accessibility')
69
+ }
70
+ }
71
+
72
+ validateAccessibility(null, null, null)
73
+ expect(console.warn).toHaveBeenCalledWith('Button component: label, icon, or ariaLabel prop is required for accessibility')
74
+
75
+ console.warn.mockClear()
76
+ validateAccessibility('Test Label', null, null)
77
+ expect(console.warn).not.toHaveBeenCalled()
78
+ })
79
+
80
+ test('generates correct CSS classes for different variants', () => {
81
+ const generateClasses = (raised, outlined, size, disabled, loading, className) => {
82
+ const variant = raised ? 'raised' : outlined ? 'outlined' : 'normal'
83
+ const state = disabled ? 'disabled' : loading ? 'loading' : ''
84
+
85
+ return [
86
+ 'btn',
87
+ variant,
88
+ size,
89
+ state,
90
+ className || ''
91
+ ].filter(Boolean).join(' ')
92
+ }
93
+
94
+ expect(generateClasses(false, false, 'normal', false, false, '')).toBe('btn normal normal')
95
+ expect(generateClasses(true, false, 'normal', false, false, '')).toBe('btn raised normal')
96
+ expect(generateClasses(false, true, 'normal', false, false, '')).toBe('btn outlined normal')
97
+ expect(generateClasses(false, false, 'small', false, false, '')).toBe('btn normal small')
98
+ expect(generateClasses(false, false, 'normal', true, false, '')).toBe('btn normal normal disabled')
99
+ expect(generateClasses(false, false, 'normal', false, true, '')).toBe('btn normal normal loading')
100
+ expect(generateClasses(false, false, 'normal', false, false, 'custom')).toBe('btn normal normal custom')
101
+ })
102
+
103
+ test('click handler works correctly', () => {
104
+ const mockAction = jest.fn()
105
+ const mockOnClick = jest.fn()
106
+
107
+ const simulateClick = (disabled, loading, action, onClick, type) => {
108
+ const event = {
109
+ stopPropagation: jest.fn(),
110
+ preventDefault: jest.fn()
111
+ }
112
+
113
+ if (!disabled && !loading) {
114
+ if (type !== 'submit') {
115
+ event.stopPropagation()
116
+ event.preventDefault()
117
+ }
118
+
119
+ if (action) action(event)
120
+ if (onClick) onClick(event)
121
+ }
122
+
123
+ return event
124
+ }
125
+
126
+ // Click normal
127
+ const event1 = simulateClick(false, false, mockAction, mockOnClick, 'button')
128
+ expect(event1.stopPropagation).toHaveBeenCalled()
129
+ expect(event1.preventDefault).toHaveBeenCalled()
130
+ expect(mockAction).toHaveBeenCalledWith(event1)
131
+ expect(mockOnClick).toHaveBeenCalledWith(event1)
132
+
133
+ mockAction.mockClear()
134
+ mockOnClick.mockClear()
135
+
136
+ // Click con disabled
137
+ simulateClick(true, false, mockAction, mockOnClick, 'button')
138
+ expect(mockAction).not.toHaveBeenCalled()
139
+ expect(mockOnClick).not.toHaveBeenCalled()
140
+
141
+ // Click con loading
142
+ simulateClick(false, true, mockAction, mockOnClick, 'button')
143
+ expect(mockAction).not.toHaveBeenCalled()
144
+ expect(mockOnClick).not.toHaveBeenCalled()
145
+
146
+ // Submit button (no preventDefault)
147
+ const event2 = simulateClick(false, false, mockAction, mockOnClick, 'submit')
148
+ expect(event2.preventDefault).not.toHaveBeenCalled()
149
+ expect(mockAction).toHaveBeenCalledWith(event2)
150
+ })
151
+
152
+ test('keyboard event handling works correctly', () => {
153
+ const mockClick = jest.fn()
154
+ const mockOnKeyDown = jest.fn()
155
+
156
+ const simulateKeyDown = (key, type, click, onKeyDown) => {
157
+ const event = {
158
+ key,
159
+ preventDefault: jest.fn()
160
+ }
161
+
162
+ if (event.key === 'Enter' || event.key === ' ') {
163
+ if (type === 'button') {
164
+ event.preventDefault()
165
+ click(event)
166
+ }
167
+ }
168
+ if (onKeyDown) onKeyDown(event)
169
+
170
+ return event
171
+ }
172
+
173
+ // Enter key on button
174
+ const enterEvent = simulateKeyDown('Enter', 'button', mockClick, mockOnKeyDown)
175
+ expect(enterEvent.preventDefault).toHaveBeenCalled()
176
+ expect(mockClick).toHaveBeenCalledWith(enterEvent)
177
+ expect(mockOnKeyDown).toHaveBeenCalledWith(enterEvent)
178
+
179
+ mockClick.mockClear()
180
+ mockOnKeyDown.mockClear()
181
+
182
+ // Space key on button
183
+ const spaceEvent = simulateKeyDown(' ', 'button', mockClick, mockOnKeyDown)
184
+ expect(spaceEvent.preventDefault).toHaveBeenCalled()
185
+ expect(mockClick).toHaveBeenCalledWith(spaceEvent)
186
+
187
+ mockClick.mockClear()
188
+
189
+ // Enter key on submit (should not prevent default)
190
+ const submitEvent = simulateKeyDown('Enter', 'submit', mockClick, mockOnKeyDown)
191
+ expect(submitEvent.preventDefault).not.toHaveBeenCalled()
192
+ expect(mockClick).not.toHaveBeenCalled()
193
+ })
194
+
195
+ test('accessibility attributes generation works correctly', () => {
196
+ const generateAriaAttributes = (ariaLabel, icon, label, disabled, loading, tooltip, id) => {
197
+ return {
198
+ 'aria-label': ariaLabel || (icon && !label ? `${icon} button` : undefined),
199
+ 'aria-disabled': disabled || loading,
200
+ 'aria-busy': loading,
201
+ 'aria-describedby': tooltip ? `${id}-tooltip` : undefined
202
+ }
203
+ }
204
+
205
+ const basic = generateAriaAttributes(null, null, 'Test Label', false, false, null, 'test')
206
+ expect(basic['aria-label']).toBeUndefined()
207
+ expect(basic['aria-disabled']).toBe(false)
208
+ expect(basic['aria-busy']).toBe(false)
209
+
210
+ const withIcon = generateAriaAttributes(null, 'add', null, false, false, null, 'test')
211
+ expect(basic['aria-label']).toBeUndefined()
212
+
213
+ const withAriaLabel = generateAriaAttributes('Custom ARIA', null, null, false, false, null, 'test')
214
+ expect(withAriaLabel['aria-label']).toBe('Custom ARIA')
215
+
216
+ const disabled = generateAriaAttributes(null, null, 'Test', true, false, null, 'test')
217
+ expect(disabled['aria-disabled']).toBe(true)
218
+
219
+ const loading = generateAriaAttributes(null, null, 'Test', false, true, null, 'test')
220
+ expect(loading['aria-busy']).toBe(true)
221
+ expect(loading['aria-disabled']).toBe(true)
222
+ })
223
+
224
+ test('icon configuration works correctly', () => {
225
+ const getIconProps = (loading, icon, size, disabled) => {
226
+ return {
227
+ icon: loading ? 'hourglass_empty' : icon,
228
+ size: size === 'small' ? 'small' : size === 'large' ? 'normal' : 'small',
229
+ disabled: disabled || loading,
230
+ className: loading ? 'loading-icon' : ''
231
+ }
232
+ }
233
+
234
+ const normal = getIconProps(false, 'add', 'normal', false)
235
+ expect(normal.icon).toBe('add')
236
+ expect(normal.size).toBe('small')
237
+ expect(normal.disabled).toBe(false)
238
+ expect(normal.className).toBe('')
239
+
240
+ const loadingIcon = getIconProps(true, 'add', 'normal', false)
241
+ expect(loadingIcon.icon).toBe('hourglass_empty')
242
+ expect(loadingIcon.disabled).toBe(true)
243
+ expect(loadingIcon.className).toBe('loading-icon')
244
+
245
+ const smallSize = getIconProps(false, 'add', 'small', false)
246
+ expect(smallSize.size).toBe('small')
247
+
248
+ const largeSize = getIconProps(false, 'add', 'large', false)
249
+ expect(largeSize.size).toBe('normal')
250
+ })
251
+ })
252
+
253
+ describe('ActionButton Component', () => {
254
+ test('component exports correctly', () => {
255
+ expect(ActionButton).toBeDefined()
256
+ expect(typeof ActionButton).toBe('function')
257
+ })
258
+
259
+ test('component has correct PropTypes', () => {
260
+ expect(ActionButton.propTypes).toBeDefined()
261
+ expect(ActionButton.propTypes.states).toBeDefined()
262
+ expect(ActionButton.propTypes.state).toBeDefined()
263
+ expect(ActionButton.propTypes.disabled).toBeDefined()
264
+ expect(ActionButton.propTypes.className).toBeDefined()
265
+ expect(ActionButton.propTypes.onStateChange).toBeDefined()
266
+ })
267
+
268
+ test('component has correct defaultProps', () => {
269
+ expect(ActionButton.defaultProps).toBeDefined()
270
+ expect(ActionButton.defaultProps.disabled).toBe(false)
271
+ expect(ActionButton.defaultProps.className).toBe('')
272
+ })
273
+
274
+ test('warns when required props are missing', () => {
275
+ const validateStates = (states) => {
276
+ if (!states || typeof states !== 'object') {
277
+ console.warn('ActionButton component: states prop is required and must be an object')
278
+ return null
279
+ }
280
+ return true
281
+ }
282
+
283
+ const validateState = (state) => {
284
+ if (!state) {
285
+ console.warn('ActionButton component: state prop is required')
286
+ return null
287
+ }
288
+ return true
289
+ }
290
+
291
+ expect(validateStates(null)).toBeNull()
292
+ expect(console.warn).toHaveBeenCalledWith('ActionButton component: states prop is required and must be an object')
293
+
294
+ console.warn.mockClear()
295
+ expect(validateState(null)).toBeNull()
296
+ expect(console.warn).toHaveBeenCalledWith('ActionButton component: state prop is required')
297
+ })
298
+
299
+ test('state synchronization works correctly', () => {
300
+ let currentState = null
301
+
302
+ const syncState = (externalState) => {
303
+ currentState = externalState
304
+ }
305
+
306
+ syncState('normal')
307
+ expect(currentState).toBe('normal')
308
+
309
+ syncState('running')
310
+ expect(currentState).toBe('running')
311
+ })
312
+
313
+ test('execution logic works correctly', async () => {
314
+ const mockAction = jest.fn().mockResolvedValue('success')
315
+ const mockOnStateChange = jest.fn()
316
+
317
+ const states = {
318
+ normal: { icon: 'add', label: 'Start', action: mockAction },
319
+ success: { icon: 'check', label: 'Done' }
320
+ }
321
+
322
+ const simulateExecution = async (disabled, isExecuting, currentState, states, onStateChange) => {
323
+ if (disabled || isExecuting) return
324
+
325
+ const stateConfig = states[currentState]
326
+ if (!stateConfig) return
327
+
328
+ let newState = null
329
+ if (stateConfig.action) {
330
+ newState = await stateConfig.action()
331
+ if (newState && states[newState]) {
332
+ if (onStateChange) onStateChange(newState)
333
+ }
334
+ }
335
+ return newState
336
+ }
337
+
338
+ // Normal execution
339
+ const result = await simulateExecution(false, false, 'normal', states, mockOnStateChange)
340
+ expect(mockAction).toHaveBeenCalled()
341
+ expect(mockOnStateChange).toHaveBeenCalledWith('success')
342
+ expect(result).toBe('success')
343
+
344
+ mockAction.mockClear()
345
+ mockOnStateChange.mockClear()
346
+
347
+ // Disabled execution
348
+ await simulateExecution(true, false, 'normal', states, mockOnStateChange)
349
+ expect(mockAction).not.toHaveBeenCalled()
350
+ expect(mockOnStateChange).not.toHaveBeenCalled()
351
+
352
+ // Already executing
353
+ await simulateExecution(false, true, 'normal', states, mockOnStateChange)
354
+ expect(mockAction).not.toHaveBeenCalled()
355
+ })
356
+
357
+ test('error handling works correctly', async () => {
358
+ const mockAction = jest.fn().mockRejectedValue(new Error('Test error'))
359
+ const mockOnStateChange = jest.fn()
360
+
361
+ const states = {
362
+ normal: { icon: 'add', label: 'Start', action: mockAction },
363
+ error: { icon: 'error', label: 'Error' }
364
+ }
365
+
366
+ const simulateExecutionWithError = async (currentState, states, onStateChange) => {
367
+ const stateConfig = states[currentState]
368
+ if (!stateConfig) return
369
+
370
+ try {
371
+ if (stateConfig.action) {
372
+ await stateConfig.action()
373
+ }
374
+ } catch (error) {
375
+ console.error('ActionButton execution error:', error)
376
+ if (states.error) {
377
+ if (onStateChange) onStateChange('error')
378
+ }
379
+ }
380
+ }
381
+
382
+ // Mock console.error
383
+ jest.spyOn(console, 'error').mockImplementation(() => {})
384
+
385
+ await simulateExecutionWithError('normal', states, mockOnStateChange)
386
+ expect(mockAction).toHaveBeenCalled()
387
+ expect(console.error).toHaveBeenCalledWith('ActionButton execution error:', expect.any(Error))
388
+ expect(mockOnStateChange).toHaveBeenCalledWith('error')
389
+
390
+ console.error.mockRestore()
391
+ })
392
+
393
+ test('autoexec functionality works correctly', () => {
394
+ const mockExecute = jest.fn()
395
+
396
+ const simulateAutoexec = (currentState, states, isExecuting, execute) => {
397
+ if (states[currentState] && states[currentState].autoexec && !isExecuting) {
398
+ execute()
399
+ }
400
+ }
401
+
402
+ const states = {
403
+ normal: { icon: 'add', label: 'Start' },
404
+ running: { icon: 'rotate', label: 'Running', autoexec: true }
405
+ }
406
+
407
+ // Normal state (no autoexec)
408
+ simulateAutoexec('normal', states, false, mockExecute)
409
+ expect(mockExecute).not.toHaveBeenCalled()
410
+
411
+ // Running state (with autoexec)
412
+ simulateAutoexec('running', states, false, mockExecute)
413
+ expect(mockExecute).toHaveBeenCalled()
414
+
415
+ mockExecute.mockClear()
416
+
417
+ // Running state but already executing
418
+ simulateAutoexec('running', states, true, mockExecute)
419
+ expect(mockExecute).not.toHaveBeenCalled()
420
+ })
421
+ })
422
+ })
@@ -4,6 +4,16 @@
4
4
  display: flex;
5
5
  align-items: center;
6
6
  position: relative;
7
+ cursor: pointer;
8
+ }
9
+
10
+ .checkbox.disabled {
11
+ cursor: not-allowed;
12
+ opacity: 0.6;
13
+ }
14
+
15
+ .checkbox.readonly {
16
+ cursor: default;
7
17
  }
8
18
 
9
19
  .checkbox .checkmark {
@@ -18,10 +28,24 @@
18
28
  padding-bottom: .1rem;
19
29
  }
20
30
 
21
- .checkbox.readonly>.checkmark {
31
+ .checkbox.readonly > .checkmark {
22
32
  border: solid 1px var(--text-color-light);
23
33
  }
24
34
 
35
+ .checkbox.disabled > .checkmark {
36
+ border: solid 1px var(--text-color-lighter);
37
+ background-color: var(--background-color);
38
+ }
39
+
40
+ .checkbox.error > .checkmark {
41
+ border: solid 2px var(--danger-color);
42
+ }
43
+
44
+ .checkbox:focus-within > .checkmark {
45
+ outline: 2px solid var(--primary-color);
46
+ outline-offset: 2px;
47
+ }
48
+
25
49
  .checkbox .checkmark:after {
26
50
  content: "";
27
51
  width: 0.3rem;
@@ -39,6 +63,14 @@
39
63
  border-color: var(--text-color-lighter);
40
64
  }
41
65
 
66
+ .checkbox.disabled .checkmark:after {
67
+ border-color: var(--text-color-lighter);
68
+ }
69
+
70
+ .checkbox.error .checkmark:after {
71
+ border-color: var(--danger-color);
72
+ }
73
+
42
74
 
43
75
  .checkbox>input {
44
76
  position: absolute;
@@ -59,6 +91,46 @@ input:checked~.checkmark:after {
59
91
  font-weight: normal;
60
92
  }
61
93
 
62
- .checkbox.readonly>label {
94
+ .checkbox.readonly > label {
63
95
  color: var(--text-color-light);
96
+ }
97
+
98
+ .checkbox.disabled > label {
99
+ color: var(--text-color-lighter);
100
+ }
101
+
102
+ .checkbox.error > label {
103
+ color: var(--danger-color);
104
+ }
105
+
106
+ /* Error message styling */
107
+ .checkbox .error-message {
108
+ color: var(--danger-color);
109
+ font-size: 0.8rem;
110
+ margin-left: 2.1rem;
111
+ margin-top: 0.2rem;
112
+ display: block;
113
+ }
114
+
115
+ /* Indeterminate state styling */
116
+ .checkbox input:indeterminate ~ .checkmark:after {
117
+ content: "";
118
+ width: 0.8rem;
119
+ height: 0.2rem;
120
+ border: none;
121
+ background-color: var(--primary-color);
122
+ transform: none;
123
+ display: block;
124
+ }
125
+
126
+ .checkbox.readonly input:indeterminate ~ .checkmark:after {
127
+ background-color: var(--text-color-lighter);
128
+ }
129
+
130
+ .checkbox.disabled input:indeterminate ~ .checkmark:after {
131
+ background-color: var(--text-color-lighter);
132
+ }
133
+
134
+ .checkbox.error input:indeterminate ~ .checkmark:after {
135
+ background-color: var(--danger-color);
64
136
  }