-
Notifications
You must be signed in to change notification settings - Fork 9.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Number formatting using Intl.* APIs #14174
Merged
niik
merged 1,923 commits into
locale-aware-formatting
from
region-aware-number-formatting
Apr 13, 2023
Merged
Changes from 16 commits
Commits
Show all changes
1923 commits
Select commit
Hold shift + click to select a range
91ed597
Remove unnecessary cast to any
sergiou87 2eab0b4
Set `aria-haspopup` prop
sergiou87 0b6dc8e
(WIP) Some changes to tag autocomplete items properly
sergiou87 21336fa
Make screen readers read autocomplete suggestions
sergiou87 6e09df7
Fix unknown user autocomplete item
sergiou87 ddf70a8
Fix a11y attributes for autocomplete items
sergiou87 7544810
Make screen reader read number of co-author suggestions
sergiou87 617be99
Some cleanup (or not)
sergiou87 7da372d
(WIP) Try things
sergiou87 669257d
First steps to make AutocompletingTextInput accessible
sergiou87 ab5314b
(WIP) Use AutocompletingInput for co-authors
sergiou87 63051fc
Some work to make the Co-Authors textbox look good
sergiou87 191c0d0
Use autocompletion to get co-authors!
sergiou87 dfdd3f3
Create Co-Author autocompletion provider
sergiou87 01f7234
Add support for "unknown" users in our autocompletion component
sergiou87 467c228
Only show "Search user" entry when needed
sergiou87 2fec3d3
Always show autocomplete for co-authors
sergiou87 dd6f6f7
Use different IDs when autocomplete list is refreshed
sergiou87 c25db50
Add aria-live with number of suggestions
sergiou87 a7e7b70
More co-author input improvements. Needs cleanup!
sergiou87 b2b0070
Add name to added handle aria label
sergiou87 abb0855
Merge pull request #16274 from desktop/commit-attribution-descriptive…
tidy-dev 71187ad
Add tabIndex -1 to menu items
tidy-dev 0092b61
Make button be a menuitem
tidy-dev cfadaae
Bubble up unknown authors instead of keeping them as internal state
sergiou87 4cee176
On menu open through space/enter, select first item
tidy-dev 0bdd850
Stop pane from stealing focus from first selected item
tidy-dev 9dadbc8
Add icons for unknown authors added
sergiou87 d067454
Search for unknown users to add them as co-authors!
sergiou87 f080c8d
Clean up
sergiou87 b3d2382
Open autocomplete list without selected item
sergiou87 de4a6d6
Take username casing into account
sergiou87 5e49796
Detect use of space at the end of input and attempt autocomplete
sergiou87 a74b2d7
More cleanup
sergiou87 c87c6a8
Improve types
sergiou87 39dfe10
More and better comments
sergiou87 734528e
Display autocomplete above element when needed
sergiou87 58c436d
Select last author instead of deleting it when pressing backspace
sergiou87 81b431c
Be smart about next selected author after removing one
sergiou87 94e862a
Add overflow-y to dialogs
tidy-dev e363a9a
Make preferences dialog scroll vertically when zoomed
tidy-dev e3bfe23
Move uncommitted changes preference to prompts tab
niik 922bc77
Bump webpack from 5.68.0 to 5.76.0
dependabot[bot] 75ae97c
Improve accessibility of AutocompletingTextInput component
sergiou87 35fbb2d
Remove : from emoji suggestion list
sergiou87 4a2d721
Fix issue autocompletion style and accessibility
sergiou87 733a514
Add aria-haspopup to menu bar buttons
tidy-dev bf4b48e
Docs to aria attributtes
tidy-dev 29c9dc2
Merge pull request #16313 from desktop/preference-tweaks
niik cf50f5a
Add aria-labellby to windows menus
tidy-dev 99f7474
Merge pull request #16317 from desktop/scrollable-dialogs
tidy-dev 21ffd81
Remove focus logic - I think is unneeded.
tidy-dev ac90008
Add menu items to resize main view width
tidy-dev ea9038d
Add the functionality to app store
tidy-dev e7acc4e
Docs..
tidy-dev ab42584
lowercase w
tidy-dev d9f42e8
Merge pull request #16324 from desktop/autocompleting-input-a11y
sergiou87 9d59b67
Merge branch 'development' into co-author-accessibility-fixes
sergiou87 7432214
Fix typo
sergiou87 9d100eb
Add new stats for PR comment notifications
sergiou87 51a2ef6
Record new PR comment notification stats
sergiou87 4a41306
Disable select on hover for autocompletion lists
sergiou87 9c82ce6
Use author username/name as handle `key`
sergiou87 b7f7988
Fix check when updating autocompleting list :facepalm:
sergiou87 538c201
Switch focus after component is rendered
sergiou87 fb2f310
Announce when authors are added/removed
sergiou87 d00631a
Co-authors labelled with all added co-authors
sergiou87 8c6808a
Fix author labelling for screen reader
sergiou87 0eb57b6
Move code around
sergiou87 2a5e465
Fix labelling of user not found
sergiou87 8328a9c
Add Zed as an external editor option
JosephTLyons f508eb7
Add new RStudio bundle identifier
steveward 44eac84
Merge pull request #16320 from desktop/dependabot/npm_and_yarn/webpac…
sergiou87 e49c1a7
Announce Committing Status/Move to Undo on Completion
tidy-dev 5d12981
Make reused method
tidy-dev 8498eb2
Make the linter happy
steveward d73fefb
Typing by HTMLAttributes
tidy-dev 083a4d0
Bump peter-evans/create-pull-request from 4.2.3 to 4.2.4
dependabot[bot] 2d64e0f
More deterministic approach - think my brain wasn't working Friday
tidy-dev baae169
For first time undo displays
tidy-dev 03330ae
Match button text - condense repeated code
tidy-dev 6b6fc05
Tidying..
tidy-dev be2b4ef
Tidying.. - make sure amending gets right message
tidy-dev 77930f5
Tidying
tidy-dev 83e41c6
Merge pull request #16346 from desktop/dependabot/github_actions/pete…
tidy-dev 508eb23
Merge pull request #16334 from desktop/pr-comment-notification-metrics
sergiou87 171874e
Merge pull request #16339 from desktop/fix-rstudio-macos
sergiou87 1397a87
Replace dialog `header` with `div`
sergiou87 6ffc1af
Merge pull request #16350 from desktop/dialog-header-is-div
sergiou87 ea73aeb
Use HTMLElement
tidy-dev 25c146d
Revert undo focus changes
tidy-dev 47083e2
Announce just committed and delay removal of loading message
tidy-dev 9d25a96
Use one message
tidy-dev b4b2d82
Focus Changes/History view when accessed via shortcut
sergiou87 e61ce4d
Use role=combobox for co-authors input
sergiou87 8238146
Refactor co-author render and allow tabbing into the list
sergiou87 80d82f3
Fix focusing added authors with (shift+)tab
sergiou87 e9b0d1f
Update app/src/lib/api.ts
niik 42257ff
Update commit-message.tsx
tidy-dev efbc5b0
Merge pull request #16315 from desktop/windows-app-menu-screen-reader…
tidy-dev bc4a096
Release 3.2.1-beta2
tidy-dev 0c5a3b9
Merge pull request #16360 from desktop/focus-history-and-changes
sergiou87 65488d4
Don't need mostRecentLocalCommit anymore
tidy-dev 0d54f03
Delay if time > 0
tidy-dev af13ec0
Merge branch 'development' into releases/3.2.1-beta2
tidy-dev 0d1fb20
Add focus history/changes list fix
tidy-dev a5517e8
Merge pull request #16340 from desktop/annouce-commit-button-status
tidy-dev 406785f
Update changelog.json
tidy-dev 96b42f9
Update changelog.json
tidy-dev 7574eff
Add remove button to author handles
sergiou87 8bd19fa
update bitbucket.md integration docs
dereklowlind ae7c15d
Update changelog.json
sergiou87 92403fe
Use overflow-y auto not scroll
tidy-dev 58e6f81
Merge pull request #16367 from desktop/windows-menu-scroll-overflow
tidy-dev ffda449
Lint
niik d6cb971
Merge pull request #16362 from desktop/releases/3.2.1-beta2
tidy-dev 00cb5cc
Merge pull request #16338 from JosephTLyons/add-Zed-as-an-external-ed…
niik 47ecc3a
Add warning for commits with unknown authors
sergiou87 b6361f4
Add styling for Unknown Authors dialog
sergiou87 817b124
Remove unnecessary CSS class
sergiou87 6db32e3
State not updated when actions are updated
tidy-dev 1f79189
Remove delay
tidy-dev 3f874fb
Needs something new in the aria-live to ensure it is announced
tidy-dev 7ed0504
Update to use resizeActiveResizable
tidy-dev f8d963c
Add resizable event listeners to resizable component
tidy-dev dd81309
Remove unused methods from last approach
tidy-dev c7dfd45
Need to be () =>
tidy-dev 2e1a611
Typo
tidy-dev cc7c9ac
5px better than one
tidy-dev 44572aa
More concise words?
tidy-dev 9827eb6
Correct word with action
tidy-dev 4de1dc8
Update menu state when resizable focus changes
tidy-dev fa80e3a
Add broken logic to enable/disable menu increase when not applicable
tidy-dev bb05e01
Removed unused method
tidy-dev 8c267c5
More removal
tidy-dev c9b8655
Merge pull request #16366 from dereklowlind/development
sergiou87 3c3f113
Fix CSS of PR preview dialog
sergiou87 d4fee9e
Merge pull request #16395 from desktop/preview-pr-header-css
sergiou87 9120bdf
Merge pull request #16371 from desktop/Remove-unnecesssary-delay
tidy-dev a4ee318
Configure added co-authors as a listbox
sergiou87 34c708d
Add those Ids - different accelerator to not mingle with zoom functio…
tidy-dev 86e79e8
Add support private repo images
sergiou87 8ebd9c6
Add "Co-authors" label to input and list of coauthors
sergiou87 f47da3d
Use tracking of a focused elements because windows menus are elements
tidy-dev 842af74
Merge branch 'development' into resize-pane-with-keyboard-shorcut
tidy-dev a6f5740
Merge pull request #16286 from desktop/stream-available-repos
niik 44fb504
Move misattributed popover into view when screen is small and zoomed
tidy-dev bc5a1d5
Use button not anchor for banner close button
tidy-dev 51aa882
Remove other linters
tidy-dev 74adc6e
make some div css apply to button
tidy-dev 5252ec2
Make expander a button
tidy-dev 805f675
Override user agent button styles
tidy-dev f697616
Remove aria-selected attribute and linter
tidy-dev 7b3ce09
Use aria-labelledby for co-authors label references
sergiou87 57358e1
Add auth token for github.com private asset requests
sergiou87 4e549f6
Rename filter to reflect its new behavior
sergiou87 5b8dd9e
Use nbsp to force screen readers to read number of suggestions when n…
sergiou87 03c1add
Merge pull request #16408 from desktop/some-linters
tidy-dev 4f26e19
Merge pull request #16409 from desktop/expander-button-linters
tidy-dev 6a0a238
Merge pull request #16410 from desktop/stashed-changes-remove-aria-se…
tidy-dev 56ae463
Merge pull request #16335 from desktop/co-author-accessibility-fixes
sergiou87 38a2f1a
Avoid retaining DOM elements
niik eeb71b9
Set aria-multiselectable when more than one item is selectable
niik 3dd5641
Only set aria-selected for selectable items
niik 6a503c6
Get rid of broken mouse over event in lists
niik d8d2713
Allow passing arbitrary a11y props to list rows
niik 1fd8b21
Announce the included state of changed file
niik ccfb73b
Remove log
tidy-dev 667703a
Use 8 and 9 as keyboard shortcut
tidy-dev 0fd4549
Allow tabbing to empty lists
niik dd9f04e
Announce empty lists
niik afe3359
Merge pull request #16407 from desktop/misattribued-commit-popover-zo…
tidy-dev 809e2d3
Merge pull request #16332 from desktop/resize-pane-with-keyboard-shorcut
tidy-dev e14401b
Condense commit description textarea when zoomed
tidy-dev 56b5fd2
Make changes list scroll when zoomed
tidy-dev c832025
group non-list divs
tidy-dev 5b8359e
Use value not clamp
tidy-dev b4f8a1a
Merge pull request #16412 from desktop/private-repo-assets
niik 4437370
Merge branch 'desktop:development' into patch-2
KendallDoesCoding 23cb6d0
Changelog and version bump
niik ec1544d
Merge pull request #16293 from KendallDoesCoding/patch-2
tidy-dev 8b289cb
Use toggle tip component based on tooltip
tidy-dev f79b60c
Merge pull request #16445 from desktop/releases/3.2.1-beta3
niik d0f5b89
Don't introduce a11y props abstraction at this time
niik 9929995
Camel case aria label prop
niik be5a31f
Changelog and version bump
niik f3241b2
Remove pr comments release notes
tidy-dev 1d4b16d
Remove non applicable release note
tidy-dev 12e5443
Remove duplicate release note
tidy-dev 6e2eac3
Merge pull request #16452 from desktop/releases/3.2.1
tidy-dev 7a3aac1
Add aria described by to changed files checkbox
tidy-dev 25a8c7f
words
tidy-dev 79b8816
Update app/src/ui/lib/checkbox.tsx
tidy-dev 884a0e8
Update app/src/ui/lib/checkbox.tsx
tidy-dev cff01b8
Merge pull request #16420 from desktop/listitem-aria-select
niik 00a1cac
Contrain value respects min for max.
tidy-dev 4ca1523
Use clamp again for sidebar
tidy-dev 6838ce3
Other ariaDescribedBy spot
tidy-dev f807171
Merge branch 'development' into change-list-scrollable-zoomed
tidy-dev 9d78482
toolTipVisible should be state, subscribe to button ref in constructor
tidy-dev 993f1d0
Add/remove tooltip visibility listeners
tidy-dev 1733581
Merge branch 'development' into character-length-warning-keyboard-acc…
tidy-dev 77ba189
Merge pull request #16370 from desktop/fix-pr-preview--sometimes-erro…
tidy-dev 84177dd
Merge pull request #16457 from desktop/add-description-for-changes-li…
tidy-dev 283dbee
Make changes list panel and history log list be the tab associated pa…
tidy-dev 70de07e
Focus first focusable element of changes panel
tidy-dev 8cb15f1
Merge branch 'development' into change-list-scrollable-zoomed
tidy-dev 249fc2c
Add icons for tabs in Repository settings dialog
sweezyio 6705f5b
Merge pull request #16425 from desktop/change-list-scrollable-zoomed
tidy-dev c24bf64
Keep a button ref instance to remove listeners
tidy-dev 65de4dd
Merge branch 'development' into character-length-warning-keyboard-acc…
tidy-dev a6b5f5a
Merge branch 'development' into remove-avatar-tooltip
tidy-dev 07193af
Merge branch 'character-length-warning-keyboard-accessible' into remo…
tidy-dev 52b94a0
Revert title removal stuff
tidy-dev e204fc6
Use toggle tip for commit message avatar
tidy-dev 04d9e5f
No tooltip when misattributed warning
tidy-dev 35f659e
Put username in warning
tidy-dev 113f033
Add role of `alertdialog` implementation
tidy-dev fdc7bf7
Type to require ariaDescribedBy for alertdialog roles
tidy-dev 927bed2
enable auto-updating of theme and following system theme on Linux
shiftkey da438ba
pull in additional stylings to allow scrollbar styling on Linux to ma…
shiftkey 611fa16
opt-out of rendering HTML menu on Linux
shiftkey ab8b209
Open the changed file header tool tip on checkbox focus
tidy-dev e047904
Add errors when too many popups
tidy-dev 806daef
Update popup-manager.ts
tidy-dev dbf1e30
Bump xml2js from 0.4.19 to 0.5.0
dependabot[bot] 971ef11
fix VSCodium name
GitMensch a0a194e
Merge pull request #16511 from GitMensch/patch-2
niik 4e95b19
Add VimR to editors/darwin.ts
5d96f90
Add VimR to editor-integration.md MacOS list
b482085
Merge pull request #16465 from sweezyio/development
niik 16a3de4
Merge pull request #16503 from desktop/dependabot/npm_and_yarn/xml2js…
niik e974cee
Update app/styles/themes/_dark.scss
shiftkey b214dca
Merge pull request #16515 from Elmar-Wiese/development
niik d83ca1b
Merge pull request #16487 from desktop/open-changed-list-heading-tool…
tidy-dev 3862811
Merge pull request #16499 from desktop/too-many-popups
tidy-dev 121beb7
Merge branch 'development' into undo-confirmation-alert-dialog
tidy-dev c11ea57
Cleaner interface union
tidy-dev a915933
Merge branch 'development' into character-length-warning-keyboard-acc…
tidy-dev 5969613
Merge branch 'development' into changes-history-tabs
tidy-dev 1317a7e
Merge pull request #16463 from desktop/changes-history-tabs
tidy-dev 66d5cf4
Merge pull request #16449 from desktop/character-length-warning-keybo…
tidy-dev 321b49c
Merge pull request #16272 from desktop/remove-avatar-tooltip
tidy-dev 2146162
Merge pull request #16484 from shiftkey/allow-for-dark-styling
niik 24e2722
Merge pull request #16472 from desktop/undo-confirmation-alert-dialog
tidy-dev 3249868
Issue 15284 Toggle Diff Display Mode and Hide Whitespace Changes
angusdev 187b2ed
Merge pull request #14176 from desktop/shared-formatter-caching
niik c7d4b33
Merge branch 'locale-aware-formatting' into region-aware-number-forma…
niik b7779cc
Merge branch 'development' into region-aware-number-formatting
niik 935c44e
Merge fail
niik File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { formatCount } from './format-count' | ||
|
||
/** | ||
* Returns a string used for communicating a quantity of commits in a human- | ||
* readable, pluralized format (i.e '1 commit', '2 commits') | ||
*/ | ||
export const formatCommitCount = (numberOfCommits: number) => | ||
formatCount(numberOfCommits, 'commit') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { formatNumber } from './format-number' | ||
|
||
/** | ||
* Returns a string used for communicating a count in a human-readable, | ||
* pluralized format (i.e '1 commit', '2 commits') | ||
* | ||
* @param count The number 'units' | ||
* @param unit A string written in such a way that without | ||
* modification it can be paired with the digit 1 such as | ||
* 'commit' and which, when a 's' is appended to it can | ||
* be paired with a zero digit or a number greater than | ||
* one. | ||
*/ | ||
export const formatCount = (count: number, unit: string) => | ||
`${formatNumber(count)} ${unit}${count === 1 ? '' : 's'}` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import mem from 'mem' | ||
import QuickLRU from 'quick-lru' | ||
import { getFormattingLocales } from './formatting-locale' | ||
|
||
// Initializing a nuumber formatter is expensive but formatting is relatively | ||
// cheap so we cache them based on the locale and their options. The maxSize of | ||
// a 100 is only as an escape hatch, we don't expect to ever create more than a | ||
// handful different formatters. | ||
const getNumber = mem( | ||
(locale: string | string[], options?: Intl.NumberFormatOptions) => { | ||
try { | ||
return new Intl.NumberFormat(locale, options) | ||
} catch (e) { | ||
log.error(`Error creating NumberFormat with locale '${locale}'`, e) | ||
return new Intl.NumberFormat(undefined, options) | ||
} | ||
}, | ||
{ | ||
cache: new QuickLRU({ maxSize: 100 }), | ||
cacheKey: (...args) => JSON.stringify(args), | ||
} | ||
) | ||
|
||
/** | ||
* Format a date in the user's formatting locale, customizable with | ||
* Intl.NumberFormatOptions. | ||
* | ||
* See Intl.NumberFormat for more information | ||
*/ | ||
export const formatNumber = (num: number, options?: Intl.NumberFormatOptions) => | ||
getNumber(getFormattingLocales(), options).format(num) | ||
|
||
/** Shorthand for formatNumber(x, { style: 'percent' }) */ | ||
export const formatPercent = ( | ||
num: number, | ||
options?: Omit<Intl.NumberFormatOptions, 'style'> | ||
) => formatNumber(num, { ...options, style: 'percent' }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.