Skip to content

Commit

Permalink
Merge pull request #204 from opf/bump/primer-upstream
Browse files Browse the repository at this point in the history
Bump/primer upstream 0.35.1
  • Loading branch information
HDinger authored Nov 18, 2024
2 parents df356d4 + 114be1e commit 3ebb713
Show file tree
Hide file tree
Showing 18 changed files with 70 additions and 50 deletions.
5 changes: 5 additions & 0 deletions .changeset/chilly-rocks-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@openproject/primer-view-components': patch
---

Switch Ruby match from Regexps to String's starts_with method
5 changes: 5 additions & 0 deletions .changeset/silent-wasps-peel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@openproject/primer-view-components': patch
---

[SelectPanel] Don't clear selection if input field doesn't exist
5 changes: 5 additions & 0 deletions .changeset/wise-terms-act.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@openproject/primer-view-components": patch
---

Update the primer/primitives dependency to be 9.x || 10.x and move it to peer
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 7 additions & 4 deletions app/components/primer/alpha/select_panel_element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,13 @@ export class SelectPanelElement extends HTMLElement {
this.dialog.removeAttribute('data-ready')
this.invokerElement?.setAttribute('aria-expanded', 'false')
// When we close the dialog, clear the filter input
const fireSearchEvent = this.filterInputTextField.value.length > 0
this.filterInputTextField.value = ''
if (fireSearchEvent) {
this.filterInputTextField.dispatchEvent(new Event('input'))

if (this.filterInputTextField) {
const fireSearchEvent = this.filterInputTextField.value.length > 0
this.filterInputTextField.value = ''
if (fireSearchEvent) {
this.filterInputTextField.dispatchEvent(new Event('input'))
}
}

this.dispatchEvent(
Expand Down
26 changes: 13 additions & 13 deletions lib/primer/classify/utilities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ class Utilities

# Replacements for some classnames that end up being a different argument key
REPLACEMENT_KEYS = {
Regexp.new("^f") => "font_size",
Regexp.new("^anim") => "animation",
Regexp.new("^v-align") => "vertical_align",
Regexp.new("^d") => "display",
Regexp.new("^wb") => "word_break",
Regexp.new("^v") => "visibility",
Regexp.new("^width") => "w",
Regexp.new("^height") => "h",
Regexp.new("^color-bg") => "bg",
Regexp.new("^color-border") => "border_color",
Regexp.new("^color-fg") => "color",
Regexp.new("^rounded") => "border_radius"
"f" => "font_size",
"anim" => "animation",
"v-align" => "vertical_align",
"d" => "display",
"wb" => "word_break",
"v" => "visibility",
"width" => "w",
"height" => "h",
"color-bg" => "bg",
"color-border" => "border_color",
"color-fg" => "color",
"rounded" => "border_radius"
}.freeze

SUPPORTED_KEY_CACHE = Hash.new { |h, k| h[k] = !UTILITIES[k].nil? }
Expand Down Expand Up @@ -190,7 +190,7 @@ def find_selector(selector)

def infer_selector_key(selector)
REPLACEMENT_KEYS.each do |k, v|
return v.to_sym if selector.match?(k)
return v.to_sym if selector.start_with?(k)
end
selector.split("-").first.to_sym
end
Expand Down
4 changes: 2 additions & 2 deletions lib/tasks/utilities.rake
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ namespace :utilities do

# Look for a replacement key
Primer::Classify::Utilities::REPLACEMENT_KEYS.each do |k, v|
next unless classname.match?(Regexp.new(k))
next unless classname.start_with?(k)

key = v
classname.sub!(Regexp.new("#{k}-"), "")
classname.sub!(Regexp.new("\A#{k}-"), "")
end

# If we didn't find a replacement, grab the first text before hyphen
Expand Down
52 changes: 26 additions & 26 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
"@oddbird/popover-polyfill": "^0.4.0",
"@primer/behaviors": "^1.3.4"
},
"peerDependencies": {
"@primer/primitives": "9.x || 10.x"
},
"devDependencies": {
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.24.1",
Expand All @@ -65,7 +68,6 @@
"@github/prettier-config": "0.0.6",
"@playwright/test": "^1.35.1",
"@primer/css": "21.5.0",
"@primer/primitives": "^9.0.2",
"@primer/stylelint-config": "^13.1.1",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-typescript": "^8.3.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
open_on_load: open_on_load
)) do |panel| %>
<% panel.with_show_button { "Panel" } %>
<% panel.with_item(label: "GitHub", href: "https://github.com") %>
<% panel.with_item(label: "Microsoft", href: "https://microsoft.com", active: true) %>
<% panel.with_item(label: "Primer", href: "https://primer.style") %>
<% panel.with_item(label: "Microsoft", href: "https://microsoft.com", active: true) %>
<% panel.with_item(label: "GitHub", href: "https://github.com") %>
<% panel.with_item(label: "Catalyst", href: "https://catalyst.rocks") %>
<% end %>

Expand Down
2 changes: 1 addition & 1 deletion test/lib/css_coverage_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def setup
# Cleanup the data to make sure it's only one selector per item
@css_data = @css_data
.flat_map { |c| c.gsub(/(\w)\./, '\1 .').split(/[\s:\[+>]+/) }
.select { |c| c.starts_with?(".") }
.select { |c| c.start_with?(".") }
.uniq
end

Expand Down
2 changes: 1 addition & 1 deletion test/system/alpha/select_panel_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def test_pressing_enter_in_filter_input_navigates_if_first_item_is_link

keyboard.type(:enter)

assert_current_path "https://github.com"
assert_current_path "https://primer.style"
end

def test_selecting_without_data_values
Expand Down

0 comments on commit 3ebb713

Please sign in to comment.