@hero-design/rn 8.92.1 → 8.92.3
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/.turbo/turbo-build.log +2 -2
- package/CHANGELOG.md +24 -0
- package/assets/fonts/hero-icons-mobile.ttf +0 -0
- package/es/index.js +594 -729
- package/lib/assets/fonts/hero-icons-mobile.ttf +0 -0
- package/lib/index.js +595 -729
- package/package.json +4 -2
- package/rollup.config.mjs +1 -0
- package/src/components/Button/StyledButton.tsx +15 -8
- package/src/components/Button/UtilityButton/StyledUtilityButton.tsx +5 -3
- package/src/components/Button/UtilityButton/__tests__/__snapshots__/index.spec.tsx.snap +4 -0
- package/src/components/Button/__tests__/__snapshots__/Button.spec.tsx.snap +61 -4
- package/src/components/Button/__tests__/__snapshots__/StyledButton.spec.tsx.snap +26 -0
- package/src/components/Calendar/__tests__/CalendarRange.spec.tsx +26 -11
- package/src/components/Calendar/__tests__/helper.spec.ts +65 -58
- package/src/components/Calendar/helpers.ts +8 -13
- package/src/components/Carousel/__tests__/__snapshots__/index.spec.tsx.snap +6 -0
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +2 -0
- package/src/components/Icon/HeroIcon/glyphMap.json +1 -1
- package/src/components/Icon/IconList.ts +1 -0
- package/src/components/MapPin/StyledMapPin.tsx +1 -9
- package/src/components/Progress/ProgressCircle.tsx +53 -109
- package/src/components/Progress/StyledProgressBar.tsx +4 -1
- package/src/components/Progress/StyledProgressCircle.tsx +1 -57
- package/src/components/Progress/StyledStep.tsx +1 -1
- package/src/components/Progress/__tests__/__snapshots__/index.spec.js.snap +299 -647
- package/src/components/Search/SearchOneLine.tsx +2 -2
- package/src/components/Search/SearchTwoLine.tsx +1 -1
- package/src/components/Search/StyledSearch.tsx +20 -35
- package/src/components/Search/__tests__/__snapshots__/SearchOneLine.spec.tsx.snap +51 -51
- package/src/components/Search/__tests__/__snapshots__/SearchSuffixIcon.spec.tsx.snap +2 -2
- package/src/components/Search/__tests__/__snapshots__/SearchTwoLine.spec.tsx.snap +13 -15
- package/src/components/Search/__tests__/__snapshots__/utils.spec.tsx.snap +4 -4
- package/src/components/Search/utils.tsx +2 -2
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +5 -0
- package/src/components/Tabs/TabWithBadge.tsx +1 -1
- package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabs.spec.tsx.snap +15 -9
- package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabsHeader.spec.tsx.snap +6 -6
- package/src/components/Tabs/__tests__/__snapshots__/TabWithBadge.spec.tsx.snap +3 -3
- package/src/components/Tabs/__tests__/__snapshots__/index.spec.tsx.snap +15 -9
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +1 -0
- package/src/components/Toolbar/StyledToolbar.tsx +1 -0
- package/src/components/Toolbar/ToolbarMessage.tsx +3 -0
- package/src/components/Toolbar/__tests__/__snapshots__/ToolbarMessage.spec.tsx.snap +8 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +20 -23
- package/src/theme/components/button.ts +10 -0
- package/src/theme/components/progress.ts +21 -26
- package/src/theme/components/search.ts +2 -10
- package/src/theme/components/toolbar.ts +2 -0
- package/src/utils/helpers.ts +9 -0
- package/stats/8.92.2/rn-stats.html +4842 -0
- package/stats/8.92.3/rn-stats.html +4842 -0
- package/types/components/Button/StyledButton.d.ts +2 -2
- package/types/components/Button/UtilityButton/StyledUtilityButton.d.ts +1 -1
- package/types/components/Icon/IconList.d.ts +1 -1
- package/types/components/Icon/index.d.ts +1 -1
- package/types/components/Progress/StyledProgressCircle.d.ts +1 -32
- package/types/components/Search/StyledSearch.d.ts +0 -1
- package/types/components/TextInput/index.d.ts +1 -1
- package/types/theme/components/button.d.ts +3 -0
- package/types/theme/components/progress.d.ts +6 -6
- package/types/theme/components/search.d.ts +2 -10
- package/types/theme/components/toolbar.d.ts +2 -0
- package/types/utils/helpers.d.ts +1 -0
|
@@ -73,99 +73,106 @@ describe('isDateInRange', () => {
|
|
|
73
73
|
});
|
|
74
74
|
|
|
75
75
|
describe('setStartOrEndDate', () => {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
76
|
+
const today = new Date('2024-01-01');
|
|
77
|
+
const tomorrow = new Date('2024-01-02');
|
|
78
|
+
const nextWeek = new Date('2024-01-08');
|
|
79
|
+
|
|
80
|
+
it('should set start date when no dates are selected', () => {
|
|
81
|
+
const result = setStartOrEndDate({
|
|
82
|
+
date: today,
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
expect(result).toEqual({
|
|
86
|
+
startDate: today,
|
|
87
|
+
endDate: undefined,
|
|
88
|
+
});
|
|
84
89
|
});
|
|
85
90
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
91
|
+
it('should set end date when only start date is selected', () => {
|
|
92
|
+
const result = setStartOrEndDate({
|
|
93
|
+
date: tomorrow,
|
|
94
|
+
startDate: today,
|
|
95
|
+
});
|
|
90
96
|
|
|
91
|
-
const result = setStartOrEndDate({ date, startDate });
|
|
92
97
|
expect(result).toEqual({
|
|
93
|
-
startDate:
|
|
94
|
-
endDate:
|
|
98
|
+
startDate: today,
|
|
99
|
+
endDate: tomorrow,
|
|
95
100
|
});
|
|
96
101
|
});
|
|
97
102
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
103
|
+
it('should set start date when date is before current start date', () => {
|
|
104
|
+
const result = setStartOrEndDate({
|
|
105
|
+
date: today,
|
|
106
|
+
startDate: tomorrow,
|
|
107
|
+
});
|
|
101
108
|
|
|
102
|
-
const result = setStartOrEndDate({ date });
|
|
103
109
|
expect(result).toEqual({
|
|
104
|
-
startDate:
|
|
105
|
-
endDate:
|
|
110
|
+
startDate: today,
|
|
111
|
+
endDate: tomorrow,
|
|
106
112
|
});
|
|
107
113
|
});
|
|
108
114
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
115
|
+
it('should set end date when date is after current start date', () => {
|
|
116
|
+
const result = setStartOrEndDate({
|
|
117
|
+
date: tomorrow,
|
|
118
|
+
startDate: today,
|
|
119
|
+
});
|
|
113
120
|
|
|
114
|
-
const result = setStartOrEndDate({ date, startDate });
|
|
115
121
|
expect(result).toEqual({
|
|
116
|
-
startDate:
|
|
117
|
-
endDate:
|
|
122
|
+
startDate: today,
|
|
123
|
+
endDate: tomorrow,
|
|
118
124
|
});
|
|
119
125
|
});
|
|
120
126
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
127
|
+
it('should reset selection when clicking within range', () => {
|
|
128
|
+
const result = setStartOrEndDate({
|
|
129
|
+
date: tomorrow,
|
|
130
|
+
startDate: today,
|
|
131
|
+
endDate: nextWeek,
|
|
132
|
+
});
|
|
125
133
|
|
|
126
|
-
const result = setStartOrEndDate({ date, startDate });
|
|
127
134
|
expect(result).toEqual({
|
|
128
|
-
startDate:
|
|
129
|
-
endDate:
|
|
135
|
+
startDate: tomorrow,
|
|
136
|
+
endDate: undefined,
|
|
130
137
|
});
|
|
131
138
|
});
|
|
132
139
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
140
|
+
it('should reset selection when clicking outside range', () => {
|
|
141
|
+
const result = setStartOrEndDate({
|
|
142
|
+
date: nextWeek,
|
|
143
|
+
startDate: today,
|
|
144
|
+
endDate: tomorrow,
|
|
145
|
+
});
|
|
138
146
|
|
|
139
|
-
const result = setStartOrEndDate({ date, startDate, endDate });
|
|
140
147
|
expect(result).toEqual({
|
|
141
|
-
startDate:
|
|
148
|
+
startDate: nextWeek,
|
|
142
149
|
endDate: undefined,
|
|
143
150
|
});
|
|
144
151
|
});
|
|
145
152
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
153
|
+
it('should set same date for both start and end when clicking start date', () => {
|
|
154
|
+
const result = setStartOrEndDate({
|
|
155
|
+
date: today,
|
|
156
|
+
startDate: today,
|
|
157
|
+
endDate: tomorrow,
|
|
158
|
+
});
|
|
151
159
|
|
|
152
|
-
const result = setStartOrEndDate({ date, startDate, endDate });
|
|
153
160
|
expect(result).toEqual({
|
|
154
|
-
startDate:
|
|
155
|
-
endDate:
|
|
161
|
+
startDate: today,
|
|
162
|
+
endDate: today,
|
|
156
163
|
});
|
|
157
164
|
});
|
|
158
165
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
166
|
+
it('should set same date for both start and end when clicking end date', () => {
|
|
167
|
+
const result = setStartOrEndDate({
|
|
168
|
+
date: tomorrow,
|
|
169
|
+
startDate: today,
|
|
170
|
+
endDate: tomorrow,
|
|
171
|
+
});
|
|
164
172
|
|
|
165
|
-
const result = setStartOrEndDate({ date, startDate, endDate });
|
|
166
173
|
expect(result).toEqual({
|
|
167
|
-
startDate:
|
|
168
|
-
endDate:
|
|
174
|
+
startDate: tomorrow,
|
|
175
|
+
endDate: tomorrow,
|
|
169
176
|
});
|
|
170
177
|
});
|
|
171
178
|
});
|
|
@@ -54,15 +54,15 @@ export const setStartOrEndDate = ({
|
|
|
54
54
|
startDate?: Date;
|
|
55
55
|
endDate?: Date;
|
|
56
56
|
}) => {
|
|
57
|
-
//
|
|
57
|
+
// If both dates are set, selecting start or end date will set the same date
|
|
58
58
|
if (
|
|
59
59
|
startDate &&
|
|
60
60
|
endDate &&
|
|
61
61
|
(isEqDate(date, startDate) || isEqDate(date, endDate))
|
|
62
62
|
) {
|
|
63
63
|
return {
|
|
64
|
-
startDate,
|
|
65
|
-
endDate,
|
|
64
|
+
startDate: date,
|
|
65
|
+
endDate: date,
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
|
|
@@ -95,14 +95,9 @@ export const setStartOrEndDate = ({
|
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
// Clicking outside range -
|
|
99
|
-
return
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
: {
|
|
105
|
-
startDate,
|
|
106
|
-
endDate: date,
|
|
107
|
-
};
|
|
98
|
+
// Clicking outside range - reset range
|
|
99
|
+
return {
|
|
100
|
+
startDate: date,
|
|
101
|
+
endDate: undefined,
|
|
102
|
+
};
|
|
108
103
|
};
|
|
@@ -730,7 +730,9 @@ exports[`Carousel renders correctly with pageControlPosition bottom 1`] = `
|
|
|
730
730
|
{
|
|
731
731
|
"color": "#ffffff",
|
|
732
732
|
"flexShrink": 1,
|
|
733
|
+
"lineHeight": undefined,
|
|
733
734
|
"textAlign": "center",
|
|
735
|
+
"textAlignVertical": "center",
|
|
734
736
|
},
|
|
735
737
|
undefined,
|
|
736
738
|
],
|
|
@@ -1725,7 +1727,9 @@ exports[`Carousel renders correctly with pageControlPosition top 1`] = `
|
|
|
1725
1727
|
{
|
|
1726
1728
|
"color": "#ffffff",
|
|
1727
1729
|
"flexShrink": 1,
|
|
1730
|
+
"lineHeight": undefined,
|
|
1728
1731
|
"textAlign": "center",
|
|
1732
|
+
"textAlignVertical": "center",
|
|
1729
1733
|
},
|
|
1730
1734
|
undefined,
|
|
1731
1735
|
],
|
|
@@ -2001,7 +2005,9 @@ exports[`Carousel should render correctly when image is undefined 1`] = `
|
|
|
2001
2005
|
{
|
|
2002
2006
|
"color": "#ffffff",
|
|
2003
2007
|
"flexShrink": 1,
|
|
2008
|
+
"lineHeight": undefined,
|
|
2004
2009
|
"textAlign": "center",
|
|
2010
|
+
"textAlignVertical": "center",
|
|
2005
2011
|
},
|
|
2006
2012
|
undefined,
|
|
2007
2013
|
],
|
|
@@ -634,6 +634,7 @@ exports[`DatePickerIOS renders correctly 1`] = `
|
|
|
634
634
|
"flexShrink": 1,
|
|
635
635
|
"lineHeight": 22,
|
|
636
636
|
"textAlign": "center",
|
|
637
|
+
"textAlignVertical": "center",
|
|
637
638
|
},
|
|
638
639
|
undefined,
|
|
639
640
|
],
|
|
@@ -1316,6 +1317,7 @@ exports[`DatePickerIOS renders correctly with custom locale 1`] = `
|
|
|
1316
1317
|
"flexShrink": 1,
|
|
1317
1318
|
"lineHeight": 22,
|
|
1318
1319
|
"textAlign": "center",
|
|
1320
|
+
"textAlignVertical": "center",
|
|
1319
1321
|
},
|
|
1320
1322
|
undefined,
|
|
1321
1323
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"activate":59000,"add-emoji":59001,"add-person":59002,"adjustment":59003,"alignment":59004,"antenna":59005,"archive":59006,"assignment-warning":59007,"bank":59008,"bell":59009,"billing":59010,"bolt":59011,"bookmark-added":59012,"bookmark-checked":59013,"bookmark":59014,"box-check":59015,"box":59016,"bpay":59017,"buildings":59018,"cake":59019,"calendar-clock":59020,"calendar":59021,"candy-box-menu":59022,"caret-down-small":59023,"caret-down":59024,"caret-left-small":59025,"caret-left":59026,"caret-right-small":59027,"caret-right":59028,"caret-up-small":59029,"caret-up":59030,"check-radio":59031,"circle-add":59032,"circle-cancel":59033,"circle-check":59034,"circle-down":59035,"circle-info":59036,"circle-left":59037,"circle-ok":59038,"circle-pencil":59039,"circle-question":59040,"circle-remove":59041,"circle-right":59042,"circle-up":59043,"circle-warning":59044,"clock-3":59045,"clock":59046,"cloud-download":59047,"cloud-upload":59048,"cog":59049,"coin":59050,"contacts":59051,"credit-card":59052,"diamond":59053,"direction-arrows":59054,"directory":59055,"document":59056,"dollar-coin-shine":59057,"dot":59058,"double-buildings":59059,"edit-template":59060,"envelope":59061,"exclude":59062,"expand-content":59063,"expense":59064,"explore_nearby":59065,"eye-circle":59066,"eye-invisible":59067,"eye":59068,"face-meh":59069,"face-sad":59070,"face-smiley":59071,"feed":59072,"feedbacks":59073,"file-certified":59074,"file-clone":59075,"file-copy":59076,"file-csv":59077,"file-dispose":59078,"file-doc":59079,"file-excel":59080,"file-export":59081,"file-lock":59082,"file-pdf":59083,"file-powerpoint":59084,"file-search":59085,"file-secured":59086,"file-sheets":59087,"file-slide":59088,"file-verified":59089,"file-word":59090,"file":59091,"filter":59092,"folder-user":59093,"folder":59094,"format-bold":59095,"format-heading1":59096,"format-heading2":59097,"format-italic":59098,"format-list-bulleted":59099,"format-list-numbered":59100,"format-underlined":59101,"funnel-filter":59102,"global-dollar":59103,"globe":59104,"graduation-cap":59105,"graph":59106,"happy-sun":59107,"health-bag":59108,"heart":59109,"hero-points":59110,"home":59111,"image":59112,"import":59113,"incident-siren":59114,"instapay-daily":59115,"instapay-now":59116,"instapay":59117,"list":59118,"loading-2":59119,"loading":59120,"location-on":59121,"location":59122,"lock":59123,"looks-one":59124,"looks-two":59125,"media-content":59126,"menu":59127,"money-notes":59128,"moneybag":59129,"moon":59130,"multiple-stars":59131,"multiple-users":59132,"near-me":59133,"node":59134,"open-folder":59135,"paperclip-vertical":59136,"paperclip":59137,"payment-summary":59138,"pencil":59139,"phone":59140,"piggy-bank":59141,"plane-up":59142,"plane":59143,"play-arrow":59144,"play-circle":59145,"print":59146,"raising-hands":59147,"reply-arrow":59148,"reply":59149,"reschedule":59150,"rostering":59151,"salary-sacrifice":59152,"save":59153,"schedule-send":59154,"schedule":59155,"search-person":59156,"search":59157,"send":59158,"speaker-active":59159,"speaker":59160,"star-award":59161,"star-badge":59162,"star-circle":59163,"star-medal":59164,"star":59165,"steps-circle":59166,"stopwatch":59167,"suitcase":59168,"surfing":59169,"survey":59170,"swag-pillar-benefit":59171,"swag-pillar-career":59172,"swag-pillar-money":59173,"swag-pillar-work":59174,"swag":59175,"swipe-right":59176,"switch":59177,"tag":59178,"target":59179,"teams":59180,"thumb-down":59181,"timesheet":59182,"touch-id":59183,"trash-bin":59184,"unlock":59185,"user":59186,"video-1":59187,"video-2":59188,"wallet":59189,"warning":59190,"accommodation-outlined":59191,"activate-outlined":59192,"add-credit-card-outlined":59193,"add-person-outlined":59194,"add-section-outlined":59195,"add-time-outlined":59196,"add":59197,"adjustment-outlined":59198,"afternoon-outlined":59199,"ai-outlined":59200,"alignment-2-outlined":59201,"alignment-outlined":59202,"all-caps":59203,"application-outlined":59204,"arrow-down":59205,"arrow-downwards":59206,"arrow-left":59207,"arrow-leftwards":59208,"arrow-right":59209,"arrow-rightwards":59210,"arrow-up":59211,"arrow-upwards":59212,"article-outlined":59213,"at-sign":59214,"auto-graph-outlined":59215,"automotive-outlined":59216,"bakery-outlined":59217,"bar-outlined":59218,"beauty-outlined":59219,"beer-outlined":59220,"bell-active-outlined":59221,"bell-outlined":59222,"bell-slash-outlined":59223,"bill-management-outlined":59224,"billing-outlined":59225,"body-outlined":59226,"bold":59227,"bolt-outlined":59228,"book-outlined":59229,"bookmark-added-outlined":59230,"bookmark-checked-outlined":59231,"bookmark-outlined":59232,"box-1-outlined":59233,"box-check-outlined":59234,"box-outlined":59235,"bullet-points":59236,"cake-outlined":59237,"calendar-dates-outlined":59238,"calendar-star-outlined":59239,"call-outlined":59240,"call-split-outlined":59241,"camera-outlined":59242,"cancel":59243,"car-forward-outlined":59244,"cashback-outlined":59245,"charging-station-outlined":59246,"chat-bubble-outlined":59247,"chat-unread-outlined":59248,"checkmark":59249,"circle-add-outlined":59250,"circle-cancel-outlined":59251,"circle-down-outlined":59252,"circle-info-outlined":59253,"circle-left-outlined":59254,"circle-ok-outlined":59255,"circle-question-outlined":59256,"circle-remove-outlined":59257,"circle-right-outlined":59258,"circle-up-outlined":59259,"circle-warning-outlined":59260,"clock-2-outlined":59261,"clock-in-outlined":59262,"clock-out-outlined":59263,"clock-outlined":59264,"cog-outlined":59265,"coin-outlined":59266,"coin-super-outlined":59267,"comment-outlined":59268,"contacts-outlined":59269,"contacts-user-outlined":59270,"credit-card-outlined":59271,"cultural-site-outlined":59272,"cup-outlined":59273,"dentistry-outlined":59274,"direction-arrows-outlined":59275,"directory-outlined":59276,"document-outlined":59277,"dollar-box-outlined":59278,"dollar-card-outlined":59279,"dollar-coin-shine-outlined":59280,"dollar-credit-card-outlined":59281,"dollar-sign":59282,"double-buildings-outlined":59283,"double-left-arrows":59284,"double-right-arrows":59285,"download-box-outlined":59286,"download-outlined":59287,"edit-template-outlined":59288,"electronics-outlined":59289,"email-outlined":59290,"end-break-outlined":59291,"enter-arrow":59292,"entertainment-outlined":59293,"envelope-outlined":59294,"evening-outlined":59295,"expense-approval-outlined":59296,"expense-outlined":59297,"explore-outlined":59298,"extension-outlined":59299,"external-link":59300,"eye-invisible-outlined":59301,"eye-outlined":59302,"face-id":59303,"face-meh-outlined":59304,"face-open-smiley-outlined":59305,"face-sad-outlined":59306,"face-smiley-outlined":59307,"fastfood-outlined":59308,"feed-outlined":59309,"file-certified-outlined":59310,"file-clone-outlined":59311,"file-copy-outlined":59312,"file-dispose-outlined":59313,"file-dollar-certified-outlined":59314,"file-dollar-outlined":59315,"file-download-outlined":59316,"file-export-outlined":59317,"file-lock-outlined":59318,"file-outlined":59319,"file-search-outlined":59320,"file-secured-outlined":59321,"file-statutory-outlined":59322,"file-verified-outlined":59323,"filter-outlined":59324,"fitness-outlined":59325,"folder-outlined":59326,"folder-upload-outlined":59327,"folder-user-outlined":59328,"form-outlined":59329,"funnel-filter-outline":59330,"goal-outlined":59331,"graph-outlined":59332,"grocery-outlined":59333,"hand-holding-user-outlined":59334,"handshake-outlined":59335,"happy-sun-outlined":59336,"health-bag-outlined":59337,"heart-outlined":59338,"home-active-outlined":59339,"home-outlined":59340,"id-card-outlined":59341,"image-outlined":59342,"import-outlined":59343,"instapay-outlined":59344,"italic":59345,"job-search-outlined":59346,"leave-approval-outlined":59347,"link-1":59348,"link-2":59349,"list-outlined":59350,"live-help-outlined":59351,"local_mall_outlined":59352,"location-on-outlined":59353,"location-outlined":59354,"lock-outlined":59355,"locked-file-outlined":59356,"log-out":59357,"mail-outlined":59358,"map-outlined":59359,"media-content-outlined":59360,"menu-close":59361,"menu-expand":59362,"menu-fold-outlined":59363,"menu-unfold-outlined":59364,"moneybag-outlined":59365,"moon-outlined":59366,"more-horizontal":59367,"more-vertical":59368,"morning-outlined":59369,"multiple-folders-outlined":59370,"multiple-users-outlined":59371,"near-me-outlined":59372,"node-outlined":59373,"number-points":59374,"number":59375,"overview-outlined":59376,"park-outlined":59377,"payment-summary-outlined":59378,"payslip-outlined":59379,"pencil-outlined":59380,"percentage":59381,"phone-outlined":59382,"piggy-bank-outlined":59383,"plane-outlined":59384,"play-circle-outlined":59385,"print-outlined":59386,"propane-tank-outlined":59387,"qr-code-outlined":59388,"qualification-outlined":59389,"re-assign":59390,"redeem":59391,"refresh":59392,"remove":59393,"reply-outlined":59394,"restart":59395,"restaurant-outlined":59396,"resume-outlined":59397,"return-arrow":59398,"rostering-outlined":59399,"safety-outlined":59400,"save-outlined":59401,"schedule-outlined":59402,"search-outlined":59403,"search-secured-outlined":59404,"send-outlined":59405,"share-1":59406,"share-2":59407,"share-outlined-2":59408,"share-outlined":59409,"shop-outlined":59410,"shopping_basket_outlined":59411,"show-chart-outlined":59412,"single-down-arrow":59413,"single-left-arrow":59414,"single-right-arrow":59415,"single-up-arrow":59416,"smart-match-outlined":59417,"sparkle-outlined":59418,"speaker-active-outlined":59419,"speaker-outlined":59420,"star-circle-outlined":59421,"star-outlined":59422,"start-break-outlined":59423,"stash-outlined":59424,"stopwatch-outlined":59425,"strikethrough":59426,"styler-outlined":59427,"suitcase-clock-outlined":59428,"suitcase-outlined":59429,"survey-outlined":59430,"switch-outlined":59431,"sync":59432,"tag-outlined":59433,"target-outlined":59434,"tennis-outlined":59435,"thumb-down-outlined":59436,"ticket-outlined":59437,"timesheet-outlined":59438,"timesheets-outlined":59439,"today-outlined":59440,"transfer":59441,"transportation-outlined":59442,"trash-bin-outlined":59443,"umbrela-outlined":59444,"unavailability-outlined":59445,"unavailable":59446,"underline":59447,"union-outlined":59448,"unlock-outlined":59449,"upload-outlined":59450,"user-circle-outlined":59451,"user-gear-outlined":59452,"user-outlined":59453,"user-rectangle-outlined":59454,"video-1-outlined":59455,"video-2-outlined":59456,"volunteer-outlined":59457,"wallet-outlined":59458,"wellness-outlined":59459}
|
|
1
|
+
{"activate":59000,"add-emoji":59001,"add-person":59002,"adjustment":59003,"alignment":59004,"antenna":59005,"archive":59006,"assignment-warning":59007,"bank":59008,"bell":59009,"billing":59010,"bolt":59011,"bookmark-added":59012,"bookmark-checked":59013,"bookmark":59014,"box-check":59015,"box":59016,"bpay":59017,"buildings":59018,"cake":59019,"calendar-clock":59020,"calendar":59021,"candy-box-menu":59022,"caret-down-small":59023,"caret-down":59024,"caret-left-small":59025,"caret-left":59026,"caret-right-small":59027,"caret-right":59028,"caret-up-small":59029,"caret-up":59030,"check-radio":59031,"circle-add":59032,"circle-cancel":59033,"circle-check":59034,"circle-down":59035,"circle-info":59036,"circle-left":59037,"circle-ok":59038,"circle-pencil":59039,"circle-question":59040,"circle-remove":59041,"circle-right":59042,"circle-up":59043,"circle-warning":59044,"clock-3":59045,"clock":59046,"cloud-download":59047,"cloud-upload":59048,"cog":59049,"coin":59050,"contacts":59051,"credit-card":59052,"diamond":59053,"direction-arrows":59054,"directory":59055,"document":59056,"dollar-coin-shine":59057,"dot":59058,"double-buildings":59059,"edit-template":59060,"envelope":59061,"exclude":59062,"expand-content":59063,"expense":59064,"explore_nearby":59065,"eye-circle":59066,"eye-invisible":59067,"eye":59068,"face-meh":59069,"face-sad":59070,"face-smiley":59071,"feed":59072,"feedbacks":59073,"file-certified":59074,"file-clone":59075,"file-copy":59076,"file-csv":59077,"file-dispose":59078,"file-doc":59079,"file-excel":59080,"file-export":59081,"file-lock":59082,"file-pdf":59083,"file-powerpoint":59084,"file-search":59085,"file-secured":59086,"file-sheets":59087,"file-slide":59088,"file-verified":59089,"file-word":59090,"file":59091,"filter":59092,"folder-user":59093,"folder":59094,"format-bold":59095,"format-heading1":59096,"format-heading2":59097,"format-italic":59098,"format-list-bulleted":59099,"format-list-numbered":59100,"format-underlined":59101,"funnel-filter":59102,"global-dollar":59103,"globe":59104,"graduation-cap":59105,"graph":59106,"happy-sun":59107,"health-bag":59108,"heart":59109,"hero-points":59110,"home":59111,"image":59112,"import":59113,"incident-siren":59114,"instapay-daily":59115,"instapay-now":59116,"instapay":59117,"list":59118,"loading-2":59119,"loading":59120,"location-on":59121,"location":59122,"lock":59123,"looks-one":59124,"looks-two":59125,"media-content":59126,"menu":59127,"money-notes":59128,"moneybag":59129,"moon":59130,"multiple-stars":59131,"multiple-users":59132,"near-me":59133,"node":59134,"open-folder":59135,"paperclip-vertical":59136,"paperclip":59137,"payment-summary":59138,"pencil":59139,"phone":59140,"piggy-bank":59141,"plane-up":59142,"plane":59143,"play-arrow":59144,"play-circle":59145,"print":59146,"raising-hands":59147,"reply-arrow":59148,"reply":59149,"reschedule":59150,"rostering":59151,"salary-sacrifice":59152,"save":59153,"schedule-send":59154,"schedule":59155,"search-person":59156,"search":59157,"send":59158,"speaker-active":59159,"speaker":59160,"star-award":59161,"star-badge":59162,"star-circle":59163,"star-medal":59164,"star":59165,"steps-circle":59166,"stopwatch":59167,"suitcase":59168,"surfing":59169,"survey":59170,"swag-pillar-benefit":59171,"swag-pillar-career":59172,"swag-pillar-money":59173,"swag-pillar-work":59174,"swag":59175,"swipe-right":59176,"switch":59177,"tag":59178,"target":59179,"teams":59180,"thumb-down":59181,"timesheet":59182,"touch-id":59183,"trash-bin":59184,"unlock":59185,"user":59186,"video-1":59187,"video-2":59188,"wallet":59189,"warning":59190,"accommodation-outlined":59191,"activate-outlined":59192,"add-credit-card-outlined":59193,"add-person-outlined":59194,"add-section-outlined":59195,"add-time-outlined":59196,"add":59197,"adjustment-outlined":59198,"afternoon-outlined":59199,"ai-outlined":59200,"alignment-2-outlined":59201,"alignment-outlined":59202,"all-caps":59203,"application-outlined":59204,"arrow-down":59205,"arrow-downwards":59206,"arrow-left":59207,"arrow-leftwards":59208,"arrow-right":59209,"arrow-rightwards":59210,"arrow-up":59211,"arrow-upwards":59212,"article-outlined":59213,"at-sign":59214,"auto-graph-outlined":59215,"automotive-outlined":59216,"bakery-outlined":59217,"bar-outlined":59218,"beauty-outlined":59219,"beer-outlined":59220,"bell-active-outlined":59221,"bell-outlined":59222,"bell-slash-outlined":59223,"bill-management-outlined":59224,"billing-outlined":59225,"body-outlined":59226,"bold":59227,"bolt-outlined":59228,"book-outlined":59229,"bookmark-added-outlined":59230,"bookmark-checked-outlined":59231,"bookmark-outlined":59232,"box-1-outlined":59233,"box-check-outlined":59234,"box-outlined":59235,"bullet-points":59236,"cake-outlined":59237,"calculator-outlined":59238,"calendar-dates-outlined":59239,"calendar-star-outlined":59240,"call-outlined":59241,"call-split-outlined":59242,"camera-outlined":59243,"cancel":59244,"car-forward-outlined":59245,"cashback-outlined":59246,"charging-station-outlined":59247,"chat-bubble-outlined":59248,"chat-unread-outlined":59249,"checkmark":59250,"circle-add-outlined":59251,"circle-cancel-outlined":59252,"circle-down-outlined":59253,"circle-info-outlined":59254,"circle-left-outlined":59255,"circle-ok-outlined":59256,"circle-question-outlined":59257,"circle-remove-outlined":59258,"circle-right-outlined":59259,"circle-up-outlined":59260,"circle-warning-outlined":59261,"clock-2-outlined":59262,"clock-in-outlined":59263,"clock-out-outlined":59264,"clock-outlined":59265,"cog-outlined":59266,"coin-outlined":59267,"coin-super-outlined":59268,"comment-outlined":59269,"contacts-outlined":59270,"contacts-user-outlined":59271,"credit-card-outlined":59272,"cultural-site-outlined":59273,"cup-outlined":59274,"dentistry-outlined":59275,"direction-arrows-outlined":59276,"directory-outlined":59277,"document-outlined":59278,"dollar-box-outlined":59279,"dollar-card-outlined":59280,"dollar-coin-shine-outlined":59281,"dollar-credit-card-outlined":59282,"dollar-sign":59283,"double-buildings-outlined":59284,"double-left-arrows":59285,"double-right-arrows":59286,"download-box-outlined":59287,"download-outlined":59288,"edit-template-outlined":59289,"electronics-outlined":59290,"email-outlined":59291,"end-break-outlined":59292,"enter-arrow":59293,"entertainment-outlined":59294,"envelope-outlined":59295,"evening-outlined":59296,"expense-approval-outlined":59297,"expense-outlined":59298,"explore-outlined":59299,"extension-outlined":59300,"external-link":59301,"eye-invisible-outlined":59302,"eye-outlined":59303,"face-id":59304,"face-meh-outlined":59305,"face-open-smiley-outlined":59306,"face-sad-outlined":59307,"face-smiley-outlined":59308,"fastfood-outlined":59309,"feed-outlined":59310,"file-certified-outlined":59311,"file-clone-outlined":59312,"file-copy-outlined":59313,"file-dispose-outlined":59314,"file-dollar-certified-outlined":59315,"file-dollar-outlined":59316,"file-download-outlined":59317,"file-export-outlined":59318,"file-lock-outlined":59319,"file-outlined":59320,"file-search-outlined":59321,"file-secured-outlined":59322,"file-statutory-outlined":59323,"file-verified-outlined":59324,"filter-outlined":59325,"fitness-outlined":59326,"folder-outlined":59327,"folder-upload-outlined":59328,"folder-user-outlined":59329,"form-outlined":59330,"funnel-filter-outline":59331,"goal-outlined":59332,"graph-outlined":59333,"grocery-outlined":59334,"hand-holding-user-outlined":59335,"handshake-outlined":59336,"happy-sun-outlined":59337,"health-bag-outlined":59338,"heart-outlined":59339,"home-active-outlined":59340,"home-outlined":59341,"id-card-outlined":59342,"image-outlined":59343,"import-outlined":59344,"instapay-outlined":59345,"italic":59346,"job-search-outlined":59347,"leave-approval-outlined":59348,"link-1":59349,"link-2":59350,"list-outlined":59351,"live-help-outlined":59352,"local_mall_outlined":59353,"location-on-outlined":59354,"location-outlined":59355,"lock-outlined":59356,"locked-file-outlined":59357,"log-out":59358,"mail-outlined":59359,"map-outlined":59360,"media-content-outlined":59361,"menu-close":59362,"menu-expand":59363,"menu-fold-outlined":59364,"menu-unfold-outlined":59365,"moneybag-outlined":59366,"moon-outlined":59367,"more-horizontal":59368,"more-vertical":59369,"morning-outlined":59370,"multiple-folders-outlined":59371,"multiple-users-outlined":59372,"near-me-outlined":59373,"node-outlined":59374,"number-points":59375,"number":59376,"overview-outlined":59377,"park-outlined":59378,"payment-summary-outlined":59379,"payslip-outlined":59380,"pencil-outlined":59381,"percentage":59382,"phone-outlined":59383,"piggy-bank-outlined":59384,"plane-outlined":59385,"play-circle-outlined":59386,"print-outlined":59387,"propane-tank-outlined":59388,"qr-code-outlined":59389,"qualification-outlined":59390,"re-assign":59391,"redeem":59392,"refresh":59393,"remove":59394,"reply-outlined":59395,"restart":59396,"restaurant-outlined":59397,"resume-outlined":59398,"return-arrow":59399,"rostering-outlined":59400,"safety-outlined":59401,"save-outlined":59402,"schedule-outlined":59403,"search-outlined":59404,"search-secured-outlined":59405,"send-outlined":59406,"share-1":59407,"share-2":59408,"share-outlined-2":59409,"share-outlined":59410,"shop-outlined":59411,"shopping_basket_outlined":59412,"show-chart-outlined":59413,"single-down-arrow":59414,"single-left-arrow":59415,"single-right-arrow":59416,"single-up-arrow":59417,"smart-match-outlined":59418,"sparkle-outlined":59419,"speaker-active-outlined":59420,"speaker-outlined":59421,"star-circle-outlined":59422,"star-outlined":59423,"start-break-outlined":59424,"stash-outlined":59425,"stopwatch-outlined":59426,"strikethrough":59427,"styler-outlined":59428,"suitcase-clock-outlined":59429,"suitcase-outlined":59430,"survey-outlined":59431,"switch-outlined":59432,"sync":59433,"tag-outlined":59434,"target-outlined":59435,"tennis-outlined":59436,"thumb-down-outlined":59437,"ticket-outlined":59438,"timesheet-outlined":59439,"timesheets-outlined":59440,"today-outlined":59441,"transfer":59442,"transportation-outlined":59443,"trash-bin-outlined":59444,"umbrela-outlined":59445,"unavailability-outlined":59446,"unavailable":59447,"underline":59448,"union-outlined":59449,"unlock-outlined":59450,"upload-outlined":59451,"user-circle-outlined":59452,"user-gear-outlined":59453,"user-outlined":59454,"user-rectangle-outlined":59455,"video-1-outlined":59456,"video-2-outlined":59457,"volunteer-outlined":59458,"wallet-outlined":59459,"wellness-outlined":59460}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import styled from '@emotion/native';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
import Icon from '../Icon';
|
|
4
|
+
import { hexToRgba } from '../../utils/helpers';
|
|
4
5
|
|
|
5
6
|
type State = 'idle' | 'selected' | 'applied';
|
|
6
7
|
|
|
@@ -60,15 +61,6 @@ export const StyledBadgeIcon = styled(Icon)(({ theme }) => ({
|
|
|
60
61
|
color: theme.__hd__.mapPin.colors.badgeIcon,
|
|
61
62
|
}));
|
|
62
63
|
|
|
63
|
-
function hexToRgba(hex: string, a: number) {
|
|
64
|
-
const arrBuff = new ArrayBuffer(4);
|
|
65
|
-
const vw = new DataView(arrBuff);
|
|
66
|
-
vw.setUint32(0, parseInt(hex, 16), false);
|
|
67
|
-
const arrByte = new Uint8Array(arrBuff);
|
|
68
|
-
const [r, g, b] = arrByte;
|
|
69
|
-
return `rgba(${r},${g},${b},${a})`;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
64
|
export const StyledFocusIcon = styled(Icon)(({ theme }) => ({
|
|
73
65
|
fontSize: theme.__hd__.mapPin.fontSizes.icon,
|
|
74
66
|
textShadowColor: hexToRgba(
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import { useTheme } from '@emotion/react';
|
|
2
2
|
import React, { useEffect, useRef } from 'react';
|
|
3
|
-
import { Animated,
|
|
3
|
+
import { Animated, Easing, View } from 'react-native';
|
|
4
|
+
import Svg, { Circle, G } from 'react-native-svg';
|
|
4
5
|
import type { ViewProps, StyleProp, ViewStyle } from 'react-native';
|
|
5
|
-
import {
|
|
6
|
-
StyledContainer,
|
|
7
|
-
StyledDonutCircle,
|
|
8
|
-
StyledHalfCircleInnerFG,
|
|
9
|
-
StyledHalfCircleInnerBG,
|
|
10
|
-
StyledHalfCircleWrapper,
|
|
11
|
-
StyledStrokeEnd,
|
|
12
|
-
} from './StyledProgressCircle';
|
|
6
|
+
import { StyledContainer, StyledDonutCircle } from './StyledProgressCircle';
|
|
13
7
|
import Typography from '../Typography';
|
|
14
|
-
import
|
|
8
|
+
import { THEME_INTENT_MAP } from './constants';
|
|
9
|
+
import { hexToRgba } from '../../utils/helpers';
|
|
15
10
|
|
|
16
11
|
export interface ProgressCircleProps extends ViewProps {
|
|
17
12
|
/**
|
|
@@ -48,23 +43,8 @@ export interface ProgressCircleProps extends ViewProps {
|
|
|
48
43
|
testID?: string;
|
|
49
44
|
}
|
|
50
45
|
|
|
51
|
-
const HalfCircle = ({
|
|
52
|
-
type,
|
|
53
|
-
themeIntent,
|
|
54
|
-
}: {
|
|
55
|
-
type: 'background' | 'foreground';
|
|
56
|
-
themeIntent: ThemeIntent;
|
|
57
|
-
}) => (
|
|
58
|
-
<StyledHalfCircleWrapper>
|
|
59
|
-
{type === 'background' ? (
|
|
60
|
-
<StyledHalfCircleInnerBG themeIntent={themeIntent} />
|
|
61
|
-
) : (
|
|
62
|
-
<StyledHalfCircleInnerFG themeIntent={themeIntent} />
|
|
63
|
-
)}
|
|
64
|
-
</StyledHalfCircleWrapper>
|
|
65
|
-
);
|
|
66
|
-
|
|
67
46
|
const defaultRenderValue = (value: number) => `${value}%`;
|
|
47
|
+
const AnimatedCircle = Animated.createAnimatedComponent(Circle);
|
|
68
48
|
|
|
69
49
|
const ProgressCircle = ({
|
|
70
50
|
value,
|
|
@@ -75,101 +55,65 @@ const ProgressCircle = ({
|
|
|
75
55
|
...nativeProps
|
|
76
56
|
}: ProgressCircleProps): JSX.Element => {
|
|
77
57
|
const theme = useTheme();
|
|
78
|
-
const
|
|
79
|
-
const
|
|
58
|
+
const size = theme.__hd__.progress.sizes.circleDiameter;
|
|
59
|
+
const strokeWidth = theme.__hd__.progress.sizes.circleCompletenessHeight;
|
|
60
|
+
const radius = size / 2 - strokeWidth;
|
|
61
|
+
const circumference = 2 * Math.PI * radius;
|
|
62
|
+
|
|
63
|
+
const progressAnimatedValue = useRef(new Animated.Value(0)).current;
|
|
64
|
+
const minArc = strokeWidth / 2 / Math.PI; // Minimum arc length
|
|
80
65
|
|
|
81
66
|
useEffect(() => {
|
|
82
|
-
|
|
67
|
+
Animated.timing(progressAnimatedValue, {
|
|
83
68
|
toValue: value,
|
|
84
69
|
useNativeDriver: true,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
animation.start();
|
|
88
|
-
|
|
89
|
-
return () => animation.stop();
|
|
70
|
+
easing: Easing.inOut(Easing.ease),
|
|
71
|
+
}).start();
|
|
90
72
|
}, [value]);
|
|
91
73
|
|
|
92
|
-
|
|
93
|
-
const interpolateRotateRightHalf = progressAnimatedValue.current.interpolate({
|
|
94
|
-
inputRange: [0, 50],
|
|
95
|
-
outputRange: ['0deg', '180deg'],
|
|
96
|
-
extrapolate: 'clamp',
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
const interpolateOpacityRightHalf = progressAnimatedValue.current.interpolate(
|
|
100
|
-
{
|
|
101
|
-
inputRange: [50, 51], // Transition between left and right half
|
|
102
|
-
outputRange: [1, 0],
|
|
103
|
-
extrapolate: 'clamp',
|
|
104
|
-
}
|
|
105
|
-
);
|
|
106
|
-
|
|
107
|
-
// Animate progress circle: 50% => 100%
|
|
108
|
-
const interpolateRotateSecondHalf = progressAnimatedValue.current.interpolate(
|
|
109
|
-
{
|
|
110
|
-
inputRange: [50, 100],
|
|
111
|
-
outputRange: ['0deg', '180deg'],
|
|
112
|
-
extrapolate: 'clamp',
|
|
113
|
-
}
|
|
114
|
-
);
|
|
115
|
-
|
|
116
|
-
// Curve at the end of progress stroke
|
|
117
|
-
const interpolateDotRotate = progressAnimatedValue.current.interpolate({
|
|
74
|
+
const strokeDashoffset = progressAnimatedValue.interpolate({
|
|
118
75
|
inputRange: [0, 100],
|
|
119
|
-
outputRange: [
|
|
120
|
-
extrapolate: 'clamp',
|
|
76
|
+
outputRange: [circumference - minArc, 0], // Full circle to zero offset
|
|
121
77
|
});
|
|
122
78
|
|
|
123
79
|
return (
|
|
124
80
|
<View {...nativeProps} testID={testID} style={style}>
|
|
125
81
|
<StyledContainer>
|
|
126
|
-
<
|
|
127
|
-
|
|
128
|
-
<
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
>
|
|
160
|
-
|
|
161
|
-
</Animated.View>
|
|
162
|
-
</View>
|
|
163
|
-
<StyledStrokeEnd themeIntent={intent} />
|
|
164
|
-
<Animated.View
|
|
165
|
-
style={{
|
|
166
|
-
...StyleSheet.absoluteFillObject,
|
|
167
|
-
zIndex: 2,
|
|
168
|
-
transform: [{ rotate: interpolateDotRotate }],
|
|
169
|
-
}}
|
|
170
|
-
>
|
|
171
|
-
<StyledStrokeEnd themeIntent={intent} />
|
|
172
|
-
</Animated.View>
|
|
82
|
+
<Svg width={size} height={size} viewBox={`0 0 ${size} ${size}`}>
|
|
83
|
+
{/* rotation -90 in order to move start point from 3 o'clock to 12 o'clock */}
|
|
84
|
+
<G rotation="-90" origin={`${size / 2}, ${size / 2}`}>
|
|
85
|
+
{/* Background Circle */}
|
|
86
|
+
<Circle
|
|
87
|
+
cx={size / 2}
|
|
88
|
+
cy={size / 2}
|
|
89
|
+
r={radius}
|
|
90
|
+
stroke={hexToRgba(
|
|
91
|
+
theme.__hd__.progress.colors.incompleteness[
|
|
92
|
+
THEME_INTENT_MAP[intent]
|
|
93
|
+
],
|
|
94
|
+
0.1
|
|
95
|
+
)}
|
|
96
|
+
strokeWidth={strokeWidth}
|
|
97
|
+
fill="transparent"
|
|
98
|
+
/>
|
|
99
|
+
{/* Progress Circle */}
|
|
100
|
+
<AnimatedCircle
|
|
101
|
+
cx={size / 2}
|
|
102
|
+
cy={size / 2}
|
|
103
|
+
r={radius}
|
|
104
|
+
stroke={
|
|
105
|
+
theme.__hd__.progress.colors.completeness[
|
|
106
|
+
THEME_INTENT_MAP[intent]
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
strokeWidth={strokeWidth}
|
|
110
|
+
fill="transparent"
|
|
111
|
+
strokeDasharray={circumference}
|
|
112
|
+
strokeDashoffset={strokeDashoffset}
|
|
113
|
+
strokeLinecap="round"
|
|
114
|
+
/>
|
|
115
|
+
</G>
|
|
116
|
+
</Svg>
|
|
173
117
|
<StyledDonutCircle>
|
|
174
118
|
<Typography.Body>{renderValue(value)}</Typography.Body>
|
|
175
119
|
</StyledDonutCircle>
|
|
@@ -3,15 +3,18 @@ import styled from '@emotion/native';
|
|
|
3
3
|
import type { ViewProps } from 'react-native';
|
|
4
4
|
import type { ThemeIntent } from './types';
|
|
5
5
|
import { THEME_INTENT_MAP } from './constants';
|
|
6
|
+
import { hexToRgba } from '../../utils/helpers';
|
|
6
7
|
|
|
7
8
|
const StyledWrapper = styled(View)<ViewProps & { themeIntent: ThemeIntent }>(
|
|
8
9
|
({ theme, themeIntent }) => ({
|
|
9
10
|
height: theme.__hd__.progress.sizes.barHeight,
|
|
10
11
|
alignSelf: 'stretch',
|
|
11
|
-
backgroundColor:
|
|
12
|
+
backgroundColor: hexToRgba(
|
|
12
13
|
theme.__hd__.progress.colors.incompleteness[
|
|
13
14
|
THEME_INTENT_MAP[themeIntent]
|
|
14
15
|
],
|
|
16
|
+
0.1
|
|
17
|
+
),
|
|
15
18
|
overflow: 'hidden',
|
|
16
19
|
borderRadius: theme.__hd__.progress.radii.default,
|
|
17
20
|
})
|
|
@@ -1,44 +1,12 @@
|
|
|
1
1
|
import { View } from 'react-native';
|
|
2
2
|
import styled from '@emotion/native';
|
|
3
3
|
import type { ViewProps } from 'react-native';
|
|
4
|
-
import type { ThemeIntent } from './types';
|
|
5
|
-
import { THEME_INTENT_MAP } from './constants';
|
|
6
4
|
|
|
7
5
|
const StyledContainer = styled(View)<ViewProps>(({ theme }) => ({
|
|
8
6
|
flexDirection: 'row',
|
|
9
7
|
borderRadius: theme.__hd__.progress.radii.default,
|
|
10
8
|
}));
|
|
11
9
|
|
|
12
|
-
const StyledHalfCircleWrapper = styled(View)<ViewProps>(({ theme }) => ({
|
|
13
|
-
width: theme.__hd__.progress.sizes.circleDiameter / 2,
|
|
14
|
-
height: theme.__hd__.progress.sizes.circleDiameter,
|
|
15
|
-
overflow: 'hidden',
|
|
16
|
-
}));
|
|
17
|
-
|
|
18
|
-
const StyledHalfCircleInnerFG = styled(View)<{ themeIntent: ThemeIntent }>(
|
|
19
|
-
({ theme, themeIntent }) => ({
|
|
20
|
-
width: theme.__hd__.progress.sizes.circleDiameter,
|
|
21
|
-
height: theme.__hd__.progress.sizes.circleDiameter,
|
|
22
|
-
borderRadius: theme.__hd__.progress.radii.default,
|
|
23
|
-
borderColor:
|
|
24
|
-
theme.__hd__.progress.colors.completeness[THEME_INTENT_MAP[themeIntent]],
|
|
25
|
-
borderWidth: theme.__hd__.progress.sizes.circleCompletenessHeight,
|
|
26
|
-
})
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
const StyledHalfCircleInnerBG = styled(View)<{ themeIntent: ThemeIntent }>(
|
|
30
|
-
({ theme, themeIntent }) => ({
|
|
31
|
-
width: theme.__hd__.progress.sizes.circleDiameter,
|
|
32
|
-
height: theme.__hd__.progress.sizes.circleDiameter,
|
|
33
|
-
borderRadius: theme.__hd__.progress.radii.default,
|
|
34
|
-
borderWidth: theme.__hd__.progress.sizes.circleCompletenessHeight,
|
|
35
|
-
borderColor:
|
|
36
|
-
theme.__hd__.progress.colors.incompleteness[
|
|
37
|
-
THEME_INTENT_MAP[themeIntent]
|
|
38
|
-
],
|
|
39
|
-
})
|
|
40
|
-
);
|
|
41
|
-
|
|
42
10
|
const StyledDonutCircle = styled(View)<ViewProps>(({ theme }) => ({
|
|
43
11
|
position: 'absolute',
|
|
44
12
|
top: theme.__hd__.progress.sizes.circleCompletenessHeight,
|
|
@@ -55,28 +23,4 @@ const StyledDonutCircle = styled(View)<ViewProps>(({ theme }) => ({
|
|
|
55
23
|
justifyContent: 'center',
|
|
56
24
|
}));
|
|
57
25
|
|
|
58
|
-
|
|
59
|
-
({ theme, themeIntent }) => ({
|
|
60
|
-
position: 'absolute',
|
|
61
|
-
top: 0,
|
|
62
|
-
left:
|
|
63
|
-
(theme.__hd__.progress.sizes.circleDiameter -
|
|
64
|
-
theme.__hd__.progress.sizes.circleCompletenessHeight) /
|
|
65
|
-
2,
|
|
66
|
-
width: theme.__hd__.progress.sizes.circleCompletenessHeight,
|
|
67
|
-
height: theme.__hd__.progress.sizes.circleCompletenessHeight,
|
|
68
|
-
borderRadius: theme.__hd__.progress.radii.default,
|
|
69
|
-
backgroundColor:
|
|
70
|
-
theme.__hd__.progress.colors.completeness[THEME_INTENT_MAP[themeIntent]],
|
|
71
|
-
zIndex: 2,
|
|
72
|
-
})
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
export {
|
|
76
|
-
StyledContainer,
|
|
77
|
-
StyledDonutCircle,
|
|
78
|
-
StyledHalfCircleWrapper,
|
|
79
|
-
StyledHalfCircleInnerFG,
|
|
80
|
-
StyledHalfCircleInnerBG,
|
|
81
|
-
StyledStrokeEnd,
|
|
82
|
-
};
|
|
26
|
+
export { StyledContainer, StyledDonutCircle };
|