@rip-lang/ui 0.3.38 → 0.3.39
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/{accordion.rip → components/accordion.rip} +8 -18
- package/{autocomplete.rip → components/autocomplete.rip} +9 -27
- package/{checkbox-group.rip → components/checkbox-group.rip} +8 -12
- package/{combobox.rip → components/combobox.rip} +9 -28
- package/{context-menu.rip → components/context-menu.rip} +14 -30
- package/{menu.rip → components/menu.rip} +14 -35
- package/{radio-group.rip → components/radio-group.rip} +7 -17
- package/{select.rip → components/select.rip} +14 -39
- package/{tabs.rip → components/tabs.rip} +11 -22
- package/{toggle-group.rip → components/toggle-group.rip} +6 -13
- package/{toolbar.rip → components/toolbar.rip} +6 -14
- package/package.json +3 -3
- package/index.rip +0 -16
- /package/{alert-dialog.rip → components/alert-dialog.rip} +0 -0
- /package/{avatar.rip → components/avatar.rip} +0 -0
- /package/{badge.rip → components/badge.rip} +0 -0
- /package/{breadcrumb.rip → components/breadcrumb.rip} +0 -0
- /package/{button-group.rip → components/button-group.rip} +0 -0
- /package/{button.rip → components/button.rip} +0 -0
- /package/{card.rip → components/card.rip} +0 -0
- /package/{carousel.rip → components/carousel.rip} +0 -0
- /package/{checkbox.rip → components/checkbox.rip} +0 -0
- /package/{collapsible.rip → components/collapsible.rip} +0 -0
- /package/{date-picker.rip → components/date-picker.rip} +0 -0
- /package/{dialog.rip → components/dialog.rip} +0 -0
- /package/{drawer.rip → components/drawer.rip} +0 -0
- /package/{editable-value.rip → components/editable-value.rip} +0 -0
- /package/{field.rip → components/field.rip} +0 -0
- /package/{fieldset.rip → components/fieldset.rip} +0 -0
- /package/{form.rip → components/form.rip} +0 -0
- /package/{grid.rip → components/grid.rip} +0 -0
- /package/{input-group.rip → components/input-group.rip} +0 -0
- /package/{input.rip → components/input.rip} +0 -0
- /package/{label.rip → components/label.rip} +0 -0
- /package/{menubar.rip → components/menubar.rip} +0 -0
- /package/{meter.rip → components/meter.rip} +0 -0
- /package/{multi-select.rip → components/multi-select.rip} +0 -0
- /package/{native-select.rip → components/native-select.rip} +0 -0
- /package/{nav-menu.rip → components/nav-menu.rip} +0 -0
- /package/{number-field.rip → components/number-field.rip} +0 -0
- /package/{otp-field.rip → components/otp-field.rip} +0 -0
- /package/{pagination.rip → components/pagination.rip} +0 -0
- /package/{popover.rip → components/popover.rip} +0 -0
- /package/{preview-card.rip → components/preview-card.rip} +0 -0
- /package/{progress.rip → components/progress.rip} +0 -0
- /package/{resizable.rip → components/resizable.rip} +0 -0
- /package/{scroll-area.rip → components/scroll-area.rip} +0 -0
- /package/{separator.rip → components/separator.rip} +0 -0
- /package/{skeleton.rip → components/skeleton.rip} +0 -0
- /package/{slider.rip → components/slider.rip} +0 -0
- /package/{spinner.rip → components/spinner.rip} +0 -0
- /package/{table.rip → components/table.rip} +0 -0
- /package/{textarea.rip → components/textarea.rip} +0 -0
- /package/{toast.rip → components/toast.rip} +0 -0
- /package/{toggle.rip → components/toggle.rip} +0 -0
- /package/{tooltip.rip → components/tooltip.rip} +0 -0
|
@@ -73,24 +73,14 @@ export Accordion = component
|
|
|
73
73
|
openItems.has(id)
|
|
74
74
|
|
|
75
75
|
onTriggerKeydown: (e, id) ->
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
@_focusNext(1)
|
|
85
|
-
when 'ArrowUp'
|
|
86
|
-
e.preventDefault()
|
|
87
|
-
@_focusNext(-1)
|
|
88
|
-
when 'Home'
|
|
89
|
-
e.preventDefault()
|
|
90
|
-
@_focusTrigger(0)
|
|
91
|
-
when 'End'
|
|
92
|
-
e.preventDefault()
|
|
93
|
-
@_focusTrigger(-1)
|
|
76
|
+
disabled = e.currentTarget.closest('[data-item]')?.hasAttribute('data-disabled')
|
|
77
|
+
ARIA.rovingNav e, {
|
|
78
|
+
next: => @_focusNext(1)
|
|
79
|
+
prev: => @_focusNext(-1)
|
|
80
|
+
first: => @_focusTrigger(0)
|
|
81
|
+
last: => @_focusTrigger(-1)
|
|
82
|
+
select: => @toggle(id) unless disabled
|
|
83
|
+
}
|
|
94
84
|
|
|
95
85
|
_triggers: ->
|
|
96
86
|
return [] unless @_content
|
|
@@ -84,35 +84,17 @@ export Autocomplete = component
|
|
|
84
84
|
|
|
85
85
|
onKeydown: (e) ->
|
|
86
86
|
len = filteredItems.length
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
e.preventDefault()
|
|
96
|
-
@openMenu() unless open
|
|
97
|
-
if len
|
|
98
|
-
@_hlIdx = if @_hlIdx <= 0 then len - 1 else @_hlIdx - 1
|
|
99
|
-
@_updateHighlight()
|
|
100
|
-
when 'Enter'
|
|
101
|
-
e.preventDefault()
|
|
102
|
-
@selectIndex(@_hlIdx) if @_hlIdx >= 0
|
|
103
|
-
when 'Escape'
|
|
104
|
-
e.preventDefault()
|
|
105
|
-
@close()
|
|
106
|
-
when 'Tab'
|
|
107
|
-
@close()
|
|
87
|
+
ARIA.listNav e,
|
|
88
|
+
next: => @openMenu() unless open; if len then @_hlIdx = (@_hlIdx + 1) %% len; @_updateHighlight()
|
|
89
|
+
prev: => @openMenu() unless open; if len then @_hlIdx = if @_hlIdx <= 0 then len - 1 else @_hlIdx - 1; @_updateHighlight()
|
|
90
|
+
first: => if len then @_hlIdx = 0; @_updateHighlight()
|
|
91
|
+
last: => if len then @_hlIdx = len - 1; @_updateHighlight()
|
|
92
|
+
select: => @selectIndex(@_hlIdx) if @_hlIdx >= 0
|
|
93
|
+
dismiss: => @close()
|
|
94
|
+
tab: => @close()
|
|
108
95
|
|
|
109
96
|
~>
|
|
110
|
-
|
|
111
|
-
onDown = (e) =>
|
|
112
|
-
unless @_input?.contains(e.target) or @_list?.contains(e.target)
|
|
113
|
-
@close()
|
|
114
|
-
document.addEventListener 'mousedown', onDown
|
|
115
|
-
return -> document.removeEventListener 'mousedown', onDown
|
|
97
|
+
ARIA.popupDismiss open, @_list, (=> @close()), [@_input]
|
|
116
98
|
|
|
117
99
|
mounted: ->
|
|
118
100
|
@_hlIdx = -1
|
|
@@ -20,9 +20,6 @@ export CheckboxGroup = component
|
|
|
20
20
|
return [] unless @_slot
|
|
21
21
|
Array.from(@_slot.querySelectorAll('[data-value]') or [])
|
|
22
22
|
|
|
23
|
-
_isChecked: (val) ->
|
|
24
|
-
Array.isArray(@value) and val in @value
|
|
25
|
-
|
|
26
23
|
_toggle: (val) ->
|
|
27
24
|
return if @disabled
|
|
28
25
|
arr = if Array.isArray(@value) then [...@value] else []
|
|
@@ -39,13 +36,12 @@ export CheckboxGroup = component
|
|
|
39
36
|
focused = Array.from(boxes).indexOf(document.activeElement)
|
|
40
37
|
return if focused < 0
|
|
41
38
|
len = boxes.length
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
boxes[(focused - 1) %% len]?.focus()
|
|
39
|
+
ARIA.rovingNav e, {
|
|
40
|
+
next: => boxes[(focused + 1) %% len]?.focus()
|
|
41
|
+
prev: => boxes[(focused - 1) %% len]?.focus()
|
|
42
|
+
first: => boxes[0]?.focus()
|
|
43
|
+
last: => boxes[len - 1]?.focus()
|
|
44
|
+
}, 'both'
|
|
49
45
|
|
|
50
46
|
render
|
|
51
47
|
div ref: "_root", role: "group", aria-label: @label or undefined, aria-orientation: @orientation
|
|
@@ -57,8 +53,8 @@ export CheckboxGroup = component
|
|
|
57
53
|
|
|
58
54
|
for opt, idx in _options
|
|
59
55
|
button role: "checkbox", tabindex: (if idx is 0 then "0" else "-1")
|
|
60
|
-
aria-checked:
|
|
61
|
-
$checked:
|
|
56
|
+
aria-checked: opt.dataset.value in @value
|
|
57
|
+
$checked: (opt.dataset.value in @value)?!
|
|
62
58
|
$disabled: @disabled?!
|
|
63
59
|
$value: opt.dataset.value
|
|
64
60
|
@click: (=> @_toggle(opt.dataset.value))
|
|
@@ -86,36 +86,17 @@ export Combobox = component
|
|
|
86
86
|
|
|
87
87
|
_onKeydown: (e) ->
|
|
88
88
|
len = @getItems().length
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
highlightedIndex = @_nextEnabled(highlightedIndex, -1)
|
|
98
|
-
@_scrollToItem()
|
|
99
|
-
when 'Enter'
|
|
100
|
-
e.preventDefault()
|
|
101
|
-
if highlightedIndex >= 0
|
|
102
|
-
@selectIndex(highlightedIndex)
|
|
103
|
-
else if len is 1
|
|
104
|
-
@selectIndex(0)
|
|
105
|
-
when 'Escape'
|
|
106
|
-
e.preventDefault()
|
|
107
|
-
if open then @close() else @query = ''
|
|
108
|
-
when 'Tab'
|
|
109
|
-
@close()
|
|
89
|
+
ARIA.listNav e,
|
|
90
|
+
next: => @openMenu() unless open; highlightedIndex = @_nextEnabled(highlightedIndex, 1); @_scrollToItem()
|
|
91
|
+
prev: => highlightedIndex = @_nextEnabled(highlightedIndex, -1); @_scrollToItem()
|
|
92
|
+
first: => highlightedIndex = 0; @_scrollToItem()
|
|
93
|
+
last: => highlightedIndex = len - 1; @_scrollToItem()
|
|
94
|
+
select: => if highlightedIndex >= 0 then @selectIndex(highlightedIndex) else if len is 1 then @selectIndex(0)
|
|
95
|
+
dismiss: => if open then @close() else @query = ''
|
|
96
|
+
tab: => @close()
|
|
110
97
|
|
|
111
98
|
~>
|
|
112
|
-
|
|
113
|
-
onDown = (e) =>
|
|
114
|
-
root = @_content
|
|
115
|
-
unless root?.contains(e.target)
|
|
116
|
-
@close()
|
|
117
|
-
document.addEventListener 'mousedown', onDown
|
|
118
|
-
return -> document.removeEventListener 'mousedown', onDown
|
|
99
|
+
ARIA.popupDismiss open, @_list, (=> @close()), [@_content]
|
|
119
100
|
|
|
120
101
|
render
|
|
121
102
|
. ref: "_content", $open: open?!
|
|
@@ -48,40 +48,24 @@ export ContextMenu = component
|
|
|
48
48
|
@emit 'select', item.dataset.item
|
|
49
49
|
@close()
|
|
50
50
|
|
|
51
|
+
_focusItem: (idx) ->
|
|
52
|
+
highlightedIndex = idx
|
|
53
|
+
@_list?.querySelectorAll('[role="menuitem"]')[idx]?.focus()
|
|
54
|
+
|
|
51
55
|
_onKeydown: (e) ->
|
|
56
|
+
return unless _menuItems.length
|
|
52
57
|
len = _menuItems.length
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
highlightedIndex = (highlightedIndex - 1) %% len
|
|
62
|
-
@_list?.querySelectorAll('[role="menuitem"]')[highlightedIndex]?.focus()
|
|
63
|
-
when 'Home'
|
|
64
|
-
e.preventDefault()
|
|
65
|
-
highlightedIndex = 0
|
|
66
|
-
@_list?.querySelectorAll('[role="menuitem"]')[0]?.focus()
|
|
67
|
-
when 'End'
|
|
68
|
-
e.preventDefault()
|
|
69
|
-
highlightedIndex = len - 1
|
|
70
|
-
@_list?.querySelectorAll('[role="menuitem"]')[len - 1]?.focus()
|
|
71
|
-
when 'Enter', ' '
|
|
72
|
-
e.preventDefault()
|
|
73
|
-
@selectIndex(highlightedIndex)
|
|
74
|
-
when 'Escape', 'Tab'
|
|
75
|
-
e.preventDefault() if e.key is 'Escape'
|
|
76
|
-
@close()
|
|
58
|
+
ARIA.listNav e,
|
|
59
|
+
next: => @_focusItem((highlightedIndex + 1) %% len)
|
|
60
|
+
prev: => @_focusItem((highlightedIndex - 1) %% len)
|
|
61
|
+
first: => @_focusItem(0)
|
|
62
|
+
last: => @_focusItem(len - 1)
|
|
63
|
+
select: => @selectIndex(highlightedIndex)
|
|
64
|
+
dismiss: => @close()
|
|
65
|
+
tab: => @close()
|
|
77
66
|
|
|
78
67
|
~>
|
|
79
|
-
|
|
80
|
-
onDown = (e) =>
|
|
81
|
-
unless @_list?.contains(e.target)
|
|
82
|
-
@close()
|
|
83
|
-
document.addEventListener 'mousedown', onDown
|
|
84
|
-
return -> document.removeEventListener 'mousedown', onDown
|
|
68
|
+
ARIA.popupDismiss open, @_list, (=> @close())
|
|
85
69
|
|
|
86
70
|
render
|
|
87
71
|
. @contextmenu: @_onContextMenu
|
|
@@ -93,46 +93,25 @@ export Menu = component
|
|
|
93
93
|
e.preventDefault()
|
|
94
94
|
@openMenu()
|
|
95
95
|
|
|
96
|
+
_focusItem: (idx) ->
|
|
97
|
+
highlightedIndex = idx
|
|
98
|
+
@_list?.querySelectorAll('[role="menuitem"]')[idx]?.focus()
|
|
99
|
+
|
|
96
100
|
onMenuKeydown: (e) ->
|
|
97
101
|
len = items.length
|
|
98
102
|
return unless len
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
@_list?.querySelectorAll('[role="menuitem"]')[highlightedIndex]?.focus()
|
|
109
|
-
when 'Home'
|
|
110
|
-
e.preventDefault()
|
|
111
|
-
highlightedIndex = 0
|
|
112
|
-
@_list?.querySelectorAll('[role="menuitem"]')[0]?.focus()
|
|
113
|
-
when 'End'
|
|
114
|
-
e.preventDefault()
|
|
115
|
-
highlightedIndex = len - 1
|
|
116
|
-
@_list?.querySelectorAll('[role="menuitem"]')[len - 1]?.focus()
|
|
117
|
-
when 'Enter', ' '
|
|
118
|
-
e.preventDefault()
|
|
119
|
-
@selectIndex(highlightedIndex)
|
|
120
|
-
when 'Escape'
|
|
121
|
-
e.preventDefault()
|
|
122
|
-
@close()
|
|
123
|
-
when 'Tab'
|
|
124
|
-
@close()
|
|
125
|
-
else
|
|
126
|
-
if e.key.length is 1
|
|
127
|
-
@_typeahead(e.key)
|
|
103
|
+
ARIA.listNav e,
|
|
104
|
+
next: => @_focusItem((highlightedIndex + 1) %% len)
|
|
105
|
+
prev: => @_focusItem((highlightedIndex - 1) %% len)
|
|
106
|
+
first: => @_focusItem(0)
|
|
107
|
+
last: => @_focusItem(len - 1)
|
|
108
|
+
select: => @selectIndex(highlightedIndex)
|
|
109
|
+
dismiss: => @close()
|
|
110
|
+
tab: => @close()
|
|
111
|
+
char: => @_typeahead(e.key)
|
|
128
112
|
|
|
129
113
|
~>
|
|
130
|
-
|
|
131
|
-
onDown = (e) =>
|
|
132
|
-
unless @_trigger?.contains(e.target) or @_list?.contains(e.target)
|
|
133
|
-
@close()
|
|
134
|
-
document.addEventListener 'mousedown', onDown
|
|
135
|
-
return -> document.removeEventListener 'mousedown', onDown
|
|
114
|
+
ARIA.popupDismiss open, @_list, (=> @close()), [@_trigger]
|
|
136
115
|
|
|
137
116
|
render
|
|
138
117
|
.
|
|
@@ -30,23 +30,13 @@ export RadioGroup = component
|
|
|
30
30
|
focused = Array.from(radios).indexOf(document.activeElement)
|
|
31
31
|
return if focused < 0
|
|
32
32
|
len = radios.length
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
next = (focused - 1) %% len
|
|
41
|
-
when 'Home'
|
|
42
|
-
e.preventDefault()
|
|
43
|
-
next = 0
|
|
44
|
-
when 'End'
|
|
45
|
-
e.preventDefault()
|
|
46
|
-
next = len - 1
|
|
47
|
-
else return
|
|
48
|
-
radios[next]?.focus()
|
|
49
|
-
@_select(_options[next]?.dataset.value)
|
|
33
|
+
move = (idx) => radios[idx]?.focus(); @_select(_options[idx]?.dataset.value)
|
|
34
|
+
ARIA.rovingNav e, {
|
|
35
|
+
next: => move((focused + 1) %% len)
|
|
36
|
+
prev: => move((focused - 1) %% len)
|
|
37
|
+
first: => move(0)
|
|
38
|
+
last: => move(len - 1)
|
|
39
|
+
}, 'both'
|
|
50
40
|
|
|
51
41
|
render
|
|
52
42
|
div ref: "_root", role: "radiogroup", aria-orientation: @orientation
|
|
@@ -80,37 +80,16 @@ export Select = component
|
|
|
80
80
|
from
|
|
81
81
|
|
|
82
82
|
onListKeydown: (e) ->
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
highlightedIndex = @_nextEnabled(highlightedIndex, -1)
|
|
94
|
-
@_focusHighlighted()
|
|
95
|
-
when 'Home'
|
|
96
|
-
e.preventDefault()
|
|
97
|
-
highlightedIndex = 0
|
|
98
|
-
@_focusHighlighted()
|
|
99
|
-
when 'End'
|
|
100
|
-
e.preventDefault()
|
|
101
|
-
highlightedIndex = len - 1
|
|
102
|
-
@_focusHighlighted()
|
|
103
|
-
when 'Enter', ' '
|
|
104
|
-
e.preventDefault()
|
|
105
|
-
@selectIndex(highlightedIndex)
|
|
106
|
-
when 'Escape'
|
|
107
|
-
e.preventDefault()
|
|
108
|
-
@close()
|
|
109
|
-
when 'Tab'
|
|
110
|
-
@close()
|
|
111
|
-
else
|
|
112
|
-
if e.key.length is 1
|
|
113
|
-
@_typeahead(e.key)
|
|
83
|
+
return unless options.length
|
|
84
|
+
ARIA.listNav e,
|
|
85
|
+
next: => highlightedIndex = @_nextEnabled(highlightedIndex, 1); @_focusHighlighted()
|
|
86
|
+
prev: => highlightedIndex = @_nextEnabled(highlightedIndex, -1); @_focusHighlighted()
|
|
87
|
+
first: => highlightedIndex = 0; @_focusHighlighted()
|
|
88
|
+
last: => highlightedIndex = options.length - 1; @_focusHighlighted()
|
|
89
|
+
select: => @selectIndex(highlightedIndex)
|
|
90
|
+
dismiss: => @close()
|
|
91
|
+
tab: => @close()
|
|
92
|
+
char: => @_typeahead(e.key)
|
|
114
93
|
|
|
115
94
|
_typeahead: (char) ->
|
|
116
95
|
clearTimeout typeaheadTimer if typeaheadTimer
|
|
@@ -122,8 +101,9 @@ export Select = component
|
|
|
122
101
|
@_focusHighlighted()
|
|
123
102
|
|
|
124
103
|
_focusHighlighted: ->
|
|
125
|
-
|
|
126
|
-
|
|
104
|
+
el = @_list?.querySelectorAll('[role="option"]')?.[highlightedIndex]
|
|
105
|
+
el?.focus()
|
|
106
|
+
el?.scrollIntoView { block: 'nearest' }
|
|
127
107
|
|
|
128
108
|
_position: ->
|
|
129
109
|
return unless @_trigger and @_list
|
|
@@ -138,12 +118,7 @@ export Select = component
|
|
|
138
118
|
@_list.style.visibility = 'visible'
|
|
139
119
|
|
|
140
120
|
~>
|
|
141
|
-
|
|
142
|
-
onDown = (e) =>
|
|
143
|
-
unless @_trigger?.contains(e.target) or @_list?.contains(e.target)
|
|
144
|
-
@close()
|
|
145
|
-
document.addEventListener 'mousedown', onDown
|
|
146
|
-
return -> document.removeEventListener 'mousedown', onDown
|
|
121
|
+
ARIA.popupDismiss open, @_list, (=> @close()), [@_trigger]
|
|
147
122
|
|
|
148
123
|
render
|
|
149
124
|
.
|
|
@@ -82,28 +82,17 @@ export Tabs = component
|
|
|
82
82
|
ids = tabs.map (t) -> t.dataset.tab
|
|
83
83
|
idx = ids.indexOf @active
|
|
84
84
|
return if idx is -1
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
if @activation is 'manual'
|
|
97
|
-
e.preventDefault()
|
|
98
|
-
@select(ids[idx])
|
|
99
|
-
null
|
|
100
|
-
else null
|
|
101
|
-
|
|
102
|
-
if next
|
|
103
|
-
e.preventDefault()
|
|
104
|
-
tab = tabs.find (t) -> t.dataset.tab is next
|
|
105
|
-
tab?.focus()
|
|
106
|
-
@select(next) if @activation is 'automatic'
|
|
85
|
+
move = (nextId) =>
|
|
86
|
+
return unless nextId
|
|
87
|
+
tabs.find((t) -> t.dataset.tab is nextId)?.focus()
|
|
88
|
+
@select(nextId) if @activation is 'automatic'
|
|
89
|
+
ARIA.rovingNav e, {
|
|
90
|
+
next: => move(@_nextEnabled(ids, idx, 1))
|
|
91
|
+
prev: => move(@_nextEnabled(ids, idx, -1))
|
|
92
|
+
first: => move(@_nextEnabled(ids, ids.length - 1, 1))
|
|
93
|
+
last: => move(@_nextEnabled(ids, 0, -1))
|
|
94
|
+
select: => @select(ids[idx]) if @activation is 'manual'
|
|
95
|
+
}, @orientation
|
|
107
96
|
|
|
108
97
|
render
|
|
109
98
|
.
|
|
@@ -46,19 +46,12 @@ export ToggleGroup = component
|
|
|
46
46
|
focused = Array.from(opts).indexOf(document.activeElement)
|
|
47
47
|
return if focused < 0
|
|
48
48
|
len = opts.length
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
opts[(focused - 1) %% len]?.focus()
|
|
56
|
-
when 'Home'
|
|
57
|
-
e.preventDefault()
|
|
58
|
-
opts[0]?.focus()
|
|
59
|
-
when 'End'
|
|
60
|
-
e.preventDefault()
|
|
61
|
-
opts[len - 1]?.focus()
|
|
49
|
+
ARIA.rovingNav e, {
|
|
50
|
+
next: => opts[(focused + 1) %% len]?.focus()
|
|
51
|
+
prev: => opts[(focused - 1) %% len]?.focus()
|
|
52
|
+
first: => opts[0]?.focus()
|
|
53
|
+
last: => opts[len - 1]?.focus()
|
|
54
|
+
}, 'both'
|
|
62
55
|
|
|
63
56
|
render
|
|
64
57
|
div ref: "_root", role: "group", aria-orientation: @orientation
|
|
@@ -25,20 +25,12 @@ export Toolbar = component
|
|
|
25
25
|
focused = els.indexOf(document.activeElement)
|
|
26
26
|
return if focused < 0
|
|
27
27
|
len = els.length
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
e.preventDefault()
|
|
35
|
-
els[(focused - 1) %% len]?.focus()
|
|
36
|
-
when 'Home'
|
|
37
|
-
e.preventDefault()
|
|
38
|
-
els[0]?.focus()
|
|
39
|
-
when 'End'
|
|
40
|
-
e.preventDefault()
|
|
41
|
-
els[len - 1]?.focus()
|
|
28
|
+
ARIA.rovingNav e, {
|
|
29
|
+
next: => els[(focused + 1) %% len]?.focus()
|
|
30
|
+
prev: => els[(focused - 1) %% len]?.focus()
|
|
31
|
+
first: => els[0]?.focus()
|
|
32
|
+
last: => els[len - 1]?.focus()
|
|
33
|
+
}, @orientation
|
|
42
34
|
|
|
43
35
|
render
|
|
44
36
|
div role: "toolbar", aria-label: @label or undefined, aria-orientation: @orientation
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rip-lang/ui",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.39",
|
|
4
4
|
"description": "Headless, accessible UI components written in Rip — zero CSS, zero dependencies",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"author": "Steve Shreeve <steve.shreeve@gmail.com>",
|
|
32
32
|
"license": "MIT",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"rip-lang": ">=3.13.
|
|
34
|
+
"rip-lang": ">=3.13.94"
|
|
35
35
|
},
|
|
36
36
|
"files": [
|
|
37
|
-
"
|
|
37
|
+
"components/",
|
|
38
38
|
"README.md"
|
|
39
39
|
]
|
|
40
40
|
}
|
package/index.rip
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# Widget Gallery — dev server for testing all widgets
|
|
2
|
-
|
|
3
|
-
import { get, use, start, notFound } from '@rip-lang/server'
|
|
4
|
-
import { serve } from '@rip-lang/server/middleware'
|
|
5
|
-
|
|
6
|
-
dir = import.meta.dir
|
|
7
|
-
|
|
8
|
-
use serve dir: dir, bundle: ['.'], watch: true
|
|
9
|
-
|
|
10
|
-
get '/*.rip', -> @send "#{dir}/#{@req.path.slice(1)}"
|
|
11
|
-
get '/*.css', -> @send "#{dir}/#{@req.path.slice(1)}", 'text/css; charset=UTF-8'
|
|
12
|
-
get '/hljs-rip.js', -> @send "#{dir}/../print/hljs-rip.js", 'text/javascript; charset=UTF-8'
|
|
13
|
-
|
|
14
|
-
notFound -> @send "#{dir}/index.html", 'text/html; charset=UTF-8'
|
|
15
|
-
|
|
16
|
-
start port: 3005
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|