@primer/react 37.11.0 → 37.11.1
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/CHANGELOG.md +6 -0
- package/dist/browser.esm.js +3 -3
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +1 -1
- package/dist/browser.umd.js.map +1 -1
- package/generated/hooks.json +969 -0
- package/lib/FormControl/FormControl.d.ts.map +1 -1
- package/lib/FormControl/FormControl.js +18 -7
- package/lib/node_modules/@github/relative-time-element/dist/duration.js +4 -3
- package/lib/node_modules/@github/relative-time-element/dist/relative-time-element-define.js +2 -0
- package/lib/node_modules/@github/relative-time-element/dist/relative-time-element.js +6 -4
- package/lib-esm/FormControl/FormControl.js +18 -7
- package/package.json +1 -1
- package/lib/ActionBar/disabled.ActionBar.Figma.d.ts +0 -2
- package/lib/ActionBar/disabled.ActionBar.Figma.d.ts.map +0 -1
- package/lib-esm/ActionBar/disabled.ActionBar.Figma.d.ts +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormControl.d.ts","sourceRoot":"","sources":["../../src/FormControl/FormControl.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"FormControl.d.ts","sourceRoot":"","sources":["../../src/FormControl/FormControl.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAavC,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,OAAO,CAAA;AAEjC,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAA;AAavD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,YAAY,GAAG,UAAU,CAAA;IAClC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,GAAG,MAAM,CAAA;;eAnBG,KAAK,CAAC,SAAS;IAC1B;;OAEG;eACQ,OAAO;IAClB;;OAEG;SACE,MAAM;IACX;;OAEG;eACQ,OAAO;IAClB;;;OAGG;aACM,YAAY,GAAG,UAAU;gBACtB,MAAM;;;;;;;;;;;;;;;;;AAsPpB,wBAKE"}
|
|
@@ -10,6 +10,7 @@ var SelectPanel = require('../SelectPanel/SelectPanel.js');
|
|
|
10
10
|
var TextInput = require('../TextInput/TextInput.js');
|
|
11
11
|
var TextInputWithTokens = require('../TextInputWithTokens/TextInputWithTokens.js');
|
|
12
12
|
var Textarea = require('../Textarea/Textarea.js');
|
|
13
|
+
var Box = require('../Box/Box.js');
|
|
13
14
|
require('../internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.js');
|
|
14
15
|
var CheckboxOrRadioGroupContext = require('../internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroupContext.js');
|
|
15
16
|
var ValidationAnimationContainer = require('../internal/components/ValidationAnimationContainer.js');
|
|
@@ -113,10 +114,24 @@ const FormControl = /*#__PURE__*/React__default.default.forwardRef(({
|
|
|
113
114
|
"data-has-caption": slots.caption ? '' : undefined
|
|
114
115
|
}, slots.leadingVisual) : null, /*#__PURE__*/React__default.default.createElement(StyledLabelContainer, {
|
|
115
116
|
className: FormControl_module.LabelContainer
|
|
116
|
-
}, slots.label, slots.caption)) : /*#__PURE__*/React__default.default.createElement(
|
|
117
|
+
}, slots.label, slots.caption)) : /*#__PURE__*/React__default.default.createElement(Box, {
|
|
117
118
|
ref: ref,
|
|
118
119
|
"data-has-label": !isLabelHidden ? '' : undefined,
|
|
119
|
-
|
|
120
|
+
display: "flex",
|
|
121
|
+
flexDirection: "column",
|
|
122
|
+
alignItems: "flex-start",
|
|
123
|
+
sx: enabled ? sx : {
|
|
124
|
+
...(isLabelHidden ? {
|
|
125
|
+
'> *:not(label) + *': {
|
|
126
|
+
marginTop: 1
|
|
127
|
+
}
|
|
128
|
+
} : {
|
|
129
|
+
'> * + *': {
|
|
130
|
+
marginTop: 1
|
|
131
|
+
}
|
|
132
|
+
}),
|
|
133
|
+
...sx
|
|
134
|
+
},
|
|
120
135
|
className: clsx.clsx(className, {
|
|
121
136
|
[FormControl_module.ControlVerticalLayout]: enabled
|
|
122
137
|
})
|
|
@@ -142,13 +157,9 @@ const StyledLabelContainer = toggleStyledComponent.toggleStyledComponent(feature
|
|
|
142
157
|
displayName: "FormControl__StyledLabelContainer",
|
|
143
158
|
componentId: "sc-1t6d2k4-2"
|
|
144
159
|
})(["> *{padding-left:var(--stack-gap-condensed);}> label{font-weight:var(--base-text-weight-normal);}"]));
|
|
145
|
-
const StyledVerticalLayout = toggleStyledComponent.toggleStyledComponent(featureFlags.cssModulesFlag, 'div', styled__default.default.div.withConfig({
|
|
146
|
-
displayName: "FormControl__StyledVerticalLayout",
|
|
147
|
-
componentId: "sc-1t6d2k4-3"
|
|
148
|
-
})(["display:flex;flex-direction:column;align-items:flex-start;& > *:not(label) + *{margin-top:var(--base-size-4);}&:where([data-has-label]) > * + *{margin-top:var(--base-size-4);}", ""], sx.default));
|
|
149
160
|
const StyledLeadingVisual = toggleStyledComponent.toggleStyledComponent(featureFlags.cssModulesFlag, 'div', styled__default.default.div.withConfig({
|
|
150
161
|
displayName: "FormControl__StyledLeadingVisual",
|
|
151
|
-
componentId: "sc-1t6d2k4-
|
|
162
|
+
componentId: "sc-1t6d2k4-3"
|
|
152
163
|
})(["color:var(--fgColor-default);margin-left:var(--base-size-8);&:where([data-disabled]){color:var(--fgColor-muted);}> *{fill:currentColor;min-width:var(--text-body-size-large);min-height:var(--text-body-size-large);}> *:where([data-has-caption]){min-width:var(--base-size-24);min-height:var(--base-size-24);}"]));
|
|
153
164
|
var FormControl$1 = Object.assign(FormControl, {
|
|
154
165
|
Caption: FormControlCaption.FormControlCaption,
|
|
@@ -32,6 +32,7 @@ class Duration {
|
|
|
32
32
|
this.milliseconds || (this.milliseconds = 0);
|
|
33
33
|
this.sign || (this.sign = Math.sign(this.milliseconds));
|
|
34
34
|
this.blank = this.sign === 0;
|
|
35
|
+
console.log("heyyyy");
|
|
35
36
|
}
|
|
36
37
|
abs() {
|
|
37
38
|
return new Duration(Math.abs(this.years), Math.abs(this.months), Math.abs(this.weeks), Math.abs(this.days), Math.abs(this.hours), Math.abs(this.minutes), Math.abs(this.seconds), Math.abs(this.milliseconds));
|
|
@@ -54,7 +55,7 @@ class Duration {
|
|
|
54
55
|
throw new RangeError('invalid duration');
|
|
55
56
|
}
|
|
56
57
|
static compare(one, two) {
|
|
57
|
-
const now =
|
|
58
|
+
const now = 1733097600000;
|
|
58
59
|
const oneApplied = Math.abs(applyDuration(now, Duration.from(one)).getTime() - now);
|
|
59
60
|
const twoApplied = Math.abs(applyDuration(now, Duration.from(two)).getTime() - now);
|
|
60
61
|
return oneApplied > twoApplied ? -1 : oneApplied < twoApplied ? 1 : 0;
|
|
@@ -73,7 +74,7 @@ function applyDuration(date, duration) {
|
|
|
73
74
|
r.setSeconds(r.getSeconds() + duration.seconds);
|
|
74
75
|
return r;
|
|
75
76
|
}
|
|
76
|
-
function elapsedTime(date, precision = 'second', now =
|
|
77
|
+
function elapsedTime(date, precision = 'second', now = 1733097600000) {
|
|
77
78
|
const delta = date.getTime() - now;
|
|
78
79
|
if (delta === 0)
|
|
79
80
|
return new Duration();
|
|
@@ -88,7 +89,7 @@ function elapsedTime(date, precision = 'second', now = Date.now()) {
|
|
|
88
89
|
const i = unitNames.indexOf(precision) || unitNames.length;
|
|
89
90
|
return new Duration(i >= 0 ? year * sign : 0, i >= 1 ? (month - year * 12) * sign : 0, 0, i >= 3 ? (day - month * 30) * sign : 0, i >= 4 ? (hr - day * 24) * sign : 0, i >= 5 ? (min - hr * 60) * sign : 0, i >= 6 ? (sec - min * 60) * sign : 0, i >= 7 ? (ms - sec * 1000) * sign : 0);
|
|
90
91
|
}
|
|
91
|
-
function roundToSingleUnit(duration, { relativeTo =
|
|
92
|
+
function roundToSingleUnit(duration, { relativeTo = 1733097600000 } = {}) {
|
|
92
93
|
relativeTo = new Date(relativeTo);
|
|
93
94
|
if (duration.blank)
|
|
94
95
|
return duration;
|
|
@@ -5,7 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var relativeTimeElement = require('./relative-time-element.js');
|
|
6
6
|
|
|
7
7
|
const root = (typeof globalThis !== 'undefined' ? globalThis : window);
|
|
8
|
+
console.log("ooooop");
|
|
8
9
|
try {
|
|
10
|
+
console.log("heyyyy");
|
|
9
11
|
root.RelativeTimeElement = relativeTimeElement.RelativeTimeElement.define();
|
|
10
12
|
}
|
|
11
13
|
catch (e) {
|
|
@@ -40,7 +40,7 @@ function getUnitFactor(el) {
|
|
|
40
40
|
return 60 * 1000;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
const ms = Math.abs(
|
|
43
|
+
const ms = Math.abs(1733097600000 - el.date.getTime());
|
|
44
44
|
if (ms < 60 * 1000)
|
|
45
45
|
return 1000;
|
|
46
46
|
if (ms < 60 * 60 * 1000)
|
|
@@ -52,6 +52,7 @@ const dateObserver = new (class {
|
|
|
52
52
|
this.elements = new Set();
|
|
53
53
|
this.time = Infinity;
|
|
54
54
|
this.timer = -1;
|
|
55
|
+
console.log("heyyyy");
|
|
55
56
|
}
|
|
56
57
|
observe(element) {
|
|
57
58
|
if (this.elements.has(element))
|
|
@@ -60,7 +61,7 @@ const dateObserver = new (class {
|
|
|
60
61
|
const date = element.date;
|
|
61
62
|
if (date && date.getTime()) {
|
|
62
63
|
const ms = getUnitFactor(element);
|
|
63
|
-
const time =
|
|
64
|
+
const time = 1733097600000 + ms;
|
|
64
65
|
if (time < this.time) {
|
|
65
66
|
clearTimeout(this.timer);
|
|
66
67
|
this.timer = setTimeout(() => this.update(), ms);
|
|
@@ -84,7 +85,7 @@ const dateObserver = new (class {
|
|
|
84
85
|
}
|
|
85
86
|
this.time = Math.min(60 * 60 * 1000, nearestDistance);
|
|
86
87
|
this.timer = setTimeout(() => this.update(), this.time);
|
|
87
|
-
this.time +=
|
|
88
|
+
this.time += 1733097600000;
|
|
88
89
|
}
|
|
89
90
|
})();
|
|
90
91
|
class RelativeTimeElement extends HTMLElement {
|
|
@@ -95,6 +96,7 @@ class RelativeTimeElement extends HTMLElement {
|
|
|
95
96
|
_RelativeTimeElement_updating.set(this, false);
|
|
96
97
|
_RelativeTimeElement_renderRoot.set(this, this.shadowRoot ? this.shadowRoot : this.attachShadow ? this.attachShadow({ mode: 'open' }) : this);
|
|
97
98
|
_RelativeTimeElement_onRelativeTimeUpdated.set(this, null);
|
|
99
|
+
console.log("ahhh");
|
|
98
100
|
}
|
|
99
101
|
static define(tag = 'relative-time', registry = customElements) {
|
|
100
102
|
registry.define(tag, this);
|
|
@@ -336,7 +338,7 @@ class RelativeTimeElement extends HTMLElement {
|
|
|
336
338
|
__classPrivateFieldGet(this, _RelativeTimeElement_renderRoot, "f").textContent = oldText;
|
|
337
339
|
return;
|
|
338
340
|
}
|
|
339
|
-
const now =
|
|
341
|
+
const now = 1733097600000;
|
|
340
342
|
if (!__classPrivateFieldGet(this, _RelativeTimeElement_customTitle, "f")) {
|
|
341
343
|
newTitle = __classPrivateFieldGet(this, _RelativeTimeElement_instances, "m", _RelativeTimeElement_getFormattedTitle).call(this, date) || '';
|
|
342
344
|
if (newTitle && !this.noTitle)
|
|
@@ -8,6 +8,7 @@ import { SelectPanel } from '../SelectPanel/SelectPanel.js';
|
|
|
8
8
|
import TextInput from '../TextInput/TextInput.js';
|
|
9
9
|
import TextInputWithTokens from '../TextInputWithTokens/TextInputWithTokens.js';
|
|
10
10
|
import Textarea from '../Textarea/Textarea.js';
|
|
11
|
+
import Box from '../Box/Box.js';
|
|
11
12
|
import '../internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.js';
|
|
12
13
|
import CheckboxOrRadioGroupContext from '../internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroupContext.js';
|
|
13
14
|
import ValidationAnimationContainer from '../internal/components/ValidationAnimationContainer.js';
|
|
@@ -106,10 +107,24 @@ const FormControl = /*#__PURE__*/React.forwardRef(({
|
|
|
106
107
|
"data-has-caption": slots.caption ? '' : undefined
|
|
107
108
|
}, slots.leadingVisual) : null, /*#__PURE__*/React.createElement(StyledLabelContainer, {
|
|
108
109
|
className: classes.LabelContainer
|
|
109
|
-
}, slots.label, slots.caption)) : /*#__PURE__*/React.createElement(
|
|
110
|
+
}, slots.label, slots.caption)) : /*#__PURE__*/React.createElement(Box, {
|
|
110
111
|
ref: ref,
|
|
111
112
|
"data-has-label": !isLabelHidden ? '' : undefined,
|
|
112
|
-
|
|
113
|
+
display: "flex",
|
|
114
|
+
flexDirection: "column",
|
|
115
|
+
alignItems: "flex-start",
|
|
116
|
+
sx: enabled ? sx : {
|
|
117
|
+
...(isLabelHidden ? {
|
|
118
|
+
'> *:not(label) + *': {
|
|
119
|
+
marginTop: 1
|
|
120
|
+
}
|
|
121
|
+
} : {
|
|
122
|
+
'> * + *': {
|
|
123
|
+
marginTop: 1
|
|
124
|
+
}
|
|
125
|
+
}),
|
|
126
|
+
...sx
|
|
127
|
+
},
|
|
113
128
|
className: clsx(className, {
|
|
114
129
|
[classes.ControlVerticalLayout]: enabled
|
|
115
130
|
})
|
|
@@ -135,13 +150,9 @@ const StyledLabelContainer = toggleStyledComponent(cssModulesFlag, 'div', styled
|
|
|
135
150
|
displayName: "FormControl__StyledLabelContainer",
|
|
136
151
|
componentId: "sc-1t6d2k4-2"
|
|
137
152
|
})(["> *{padding-left:var(--stack-gap-condensed);}> label{font-weight:var(--base-text-weight-normal);}"]));
|
|
138
|
-
const StyledVerticalLayout = toggleStyledComponent(cssModulesFlag, 'div', styled.div.withConfig({
|
|
139
|
-
displayName: "FormControl__StyledVerticalLayout",
|
|
140
|
-
componentId: "sc-1t6d2k4-3"
|
|
141
|
-
})(["display:flex;flex-direction:column;align-items:flex-start;& > *:not(label) + *{margin-top:var(--base-size-4);}&:where([data-has-label]) > * + *{margin-top:var(--base-size-4);}", ""], sx));
|
|
142
153
|
const StyledLeadingVisual = toggleStyledComponent(cssModulesFlag, 'div', styled.div.withConfig({
|
|
143
154
|
displayName: "FormControl__StyledLeadingVisual",
|
|
144
|
-
componentId: "sc-1t6d2k4-
|
|
155
|
+
componentId: "sc-1t6d2k4-3"
|
|
145
156
|
})(["color:var(--fgColor-default);margin-left:var(--base-size-8);&:where([data-disabled]){color:var(--fgColor-muted);}> *{fill:currentColor;min-width:var(--text-body-size-large);min-height:var(--text-body-size-large);}> *:where([data-has-caption]){min-width:var(--base-size-24);min-height:var(--base-size-24);}"]));
|
|
146
157
|
var FormControl$1 = Object.assign(FormControl, {
|
|
147
158
|
Caption: FormControlCaption,
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"disabled.ActionBar.Figma.d.ts","sourceRoot":"","sources":["../../src/ActionBar/disabled.ActionBar.Figma.tsx"],"names":[],"mappings":""}
|