@automattic/date-range-picker 1.0.1 → 1.0.4

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 CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.4
4
+
5
+ - Declare React 19 compatibility for package consumers (#111721).
6
+
7
+ ## 1.0.3
8
+
9
+ - Fix: restore `*.scss` in `sideEffects` so Calypso (which consumes the package via `calypso:src`) doesn't tree-shake the `import './style.scss'` and lose all of the picker's styles.
10
+
11
+ ## 1.0.2
12
+
13
+ - Packaging: pre-compile SCSS to CSS in `dist/{esm,cjs}/style.css` so external consumers no longer need a Sass loader. SCSS variables from `@wordpress/base-styles` are resolved at build time.
14
+ - Packaging: move `@wordpress/components`, `@wordpress/compose`, `@wordpress/date`, `@wordpress/i18n`, and `@wordpress/icons` to `peerDependencies` (with `>=` ranges) to prevent duplicate installs and to accommodate hosts pinned to newer `@wordpress/*` majors.
15
+ - Packaging: stop shipping `src/test/**` and `dist/*.tsbuildinfo` in the published tarball.
16
+ - Packaging: drop unused `tslib` runtime dependency.
17
+ - Styles: add sensible fallbacks (`#fff`, `#1e1e1e`, `#949494`) to the dashboard CSS custom properties so the picker renders correctly outside the Calypso dashboard shell.
18
+ - Docs: add a "Using outside Calypso" section to the README documenting peer-deps, the required `@automattic/ui/style.css` import, and the themable CSS custom properties.
19
+
3
20
  ## 1.0.1
4
21
 
5
22
  - Fix packaging: include `style.scss` in `dist/esm/` and `dist/cjs/` so the compiled `import './style.scss'` resolves for consumers that don't use the `calypso:src` exports condition.
package/README.md CHANGED
@@ -11,19 +11,6 @@ site-day handling.
11
11
  npm install @automattic/date-range-picker
12
12
  ```
13
13
 
14
- Consumers must also load the calendar styles from `@automattic/ui` and import
15
- the picker's own stylesheet. The package ships SCSS source; compile it via
16
- your own build pipeline (sass-loader, etc.):
17
-
18
- ```ts
19
- import '@automattic/ui/style.css';
20
- import '@automattic/date-range-picker/src/style.scss';
21
- ```
22
-
23
- The SCSS expects `$grid-unit-*`, `$radius-small`, and `$gray-600` from
24
- `@wordpress/base-styles` to be in scope (either via a global `@import` or via
25
- sass-loader's `additionalData`).
26
-
27
14
  ## Usage
28
15
 
29
16
  ```tsx
@@ -44,6 +31,11 @@ function Example() {
44
31
  }
45
32
  ```
46
33
 
34
+ The picker's stylesheet is side-effect imported from the component module, so a
35
+ plain `import { DateRangePicker }` is enough — there's no separate CSS import to
36
+ remember. The package ships pre-compiled CSS in `dist/`, so consumers don't
37
+ need a Sass loader.
38
+
47
39
  ### Props
48
40
 
49
41
  | Prop | Type | Default | Description |
@@ -73,6 +65,51 @@ import {
73
65
  } from '@automattic/date-range-picker';
74
66
  ```
75
67
 
68
+ ## Using outside Calypso
69
+
70
+ The package is published to npm and works for any React app — Jetpack, custom
71
+ WordPress plugins, etc. A few things to know:
72
+
73
+ ### Required peer dependencies
74
+
75
+ The host application must install these alongside the picker:
76
+
77
+ - `react` and `react-dom` (`^18.3.1`)
78
+ - `@wordpress/components` (`>=33.1.0`)
79
+ - `@wordpress/compose` (`>=7.23.0`)
80
+ - `@wordpress/date` (`>=5.23.0`)
81
+ - `@wordpress/i18n` (`>=5.23.0`)
82
+ - `@wordpress/icons` (`>=10.23.0`)
83
+
84
+ These are peer dependencies (not bundled) so that the host can control the
85
+ exact version and avoid duplicate copies of WordPress packages — multiple
86
+ copies of `@wordpress/compose` will silently break hooks shared across the
87
+ picker and the host.
88
+
89
+ ### Calendar styles
90
+
91
+ The picker renders `@automattic/ui`'s `DateRangeCalendar`. Make sure the
92
+ host loads its stylesheet once:
93
+
94
+ ```ts
95
+ import '@automattic/ui/style.css';
96
+ ```
97
+
98
+ ### Skinning via CSS custom properties
99
+
100
+ The picker honours these CSS custom properties on a wrapping element, with
101
+ sensible defaults when they're not set:
102
+
103
+ | Custom property | Default | Purpose |
104
+ | --------------------------------------- | ------------- | -------------------------------------- |
105
+ | `--dashboard-surface__background-color` | `#fff` | Trigger button background. |
106
+ | `--dashboard__text-color` | `#1e1e1e` | Trigger button text and icon colour. |
107
+ | `--dashboard-field__border-color` | `#949494` | Trigger button border colour. |
108
+
109
+ Set them on `:root` (or any ancestor of the picker) to theme it. The Calypso
110
+ dashboard shell sets these globally; outside Calypso, set whichever you'd like
111
+ to override.
112
+
76
113
  ## Translations
77
114
 
78
115
  The package uses `@wordpress/i18n` directly. Strings are extracted with the
@@ -10,7 +10,7 @@ const react_1 = require("react");
10
10
  const date_range_content_1 = require("./date-range-content");
11
11
  const datetime_1 = require("./datetime");
12
12
  const utils_1 = require("./utils");
13
- require("./style.scss");
13
+ require("./style.css");
14
14
  function DateRangePicker({ start, end, onChange, gmtOffset, timezoneString, locale, disableFuture = true, disabledBefore, defaultFallbackPreset = 'last-7-days', hiddenPresets, inputsProps, }) {
15
15
  const isSmall = (0, compose_1.useMediaQuery)('(max-width: 600px)');
16
16
  // Use a wider breakpoint to decide when two calendars can fit comfortably
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Colors
3
+ */
4
+ /**
5
+ * SCSS Variables.
6
+ *
7
+ * Please use variables from this sheet to ensure consistency across the UI.
8
+ * Don't add to this sheet unless you're pretty sure the value will be reused in many places.
9
+ * For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
10
+ */
11
+ /**
12
+ * Fonts & basic variables.
13
+ */
14
+ /**
15
+ * Typography
16
+ */
17
+ /**
18
+ * Grid System.
19
+ * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
20
+ */
21
+ /**
22
+ * Radius scale.
23
+ */
24
+ /**
25
+ * Elevation scale.
26
+ */
27
+ /**
28
+ * Dimensions.
29
+ */
30
+ /**
31
+ * Mobile specific styles
32
+ */
33
+ /**
34
+ * Editor styles.
35
+ */
36
+ /**
37
+ * Block & Editor UI.
38
+ */
39
+ /**
40
+ * Block paddings.
41
+ */
42
+ /**
43
+ * React Native specific.
44
+ * These variables do not appear to be used anywhere else.
45
+ */
46
+ /* Popover sizing */
47
+ .daterange-popover .components-popover__content {
48
+ overflow: visible;
49
+ width: auto;
50
+ max-width: calc(100vw - 48px);
51
+ }
52
+
53
+ /* Body rows */
54
+ .daterange-inputs {
55
+ margin-bottom: 12px;
56
+ }
57
+
58
+ .daterange-input__field.components-button {
59
+ background: var(--dashboard-surface__background-color, #fff);
60
+ padding: 4px 4px 4px 8px;
61
+ box-shadow: none;
62
+ border-radius: 2px;
63
+ border: 1px solid var(--dashboard-field__border-color, #949494);
64
+ }
65
+ .daterange-input__field svg {
66
+ color: var(--dashboard__text-color, #1e1e1e);
67
+ padding: 4px;
68
+ }
69
+ .daterange-input__text {
70
+ color: var(--dashboard__text-color, #1e1e1e);
71
+ padding: 0 4px;
72
+ }
73
+
74
+ /* Mobile */
75
+ @media (max-width: 600px) {
76
+ .daterange-calendar {
77
+ display: flex;
78
+ justify-content: center;
79
+ width: 100%;
80
+ }
81
+ }
82
+ /* Medium screens: presets and calendar should be centered with no awkward right margin */
83
+ @media (min-width: 601px) and (max-width: 899px) {
84
+ .daterange-body {
85
+ justify-content: space-between !important;
86
+ }
87
+ }
88
+ /* Desktop presets column: ensure a reasonable width to avoid awkward wrapping */
89
+ @media (min-width: 601px) {
90
+ .daterange-presets {
91
+ min-width: 240px;
92
+ }
93
+ }
94
+ /* Preset list items: keep buttons full-width and avoid awkward line wrapping */
95
+ .preset-listbox__item .components-button {
96
+ width: 100%;
97
+ justify-content: flex-start;
98
+ white-space: nowrap;
99
+ overflow: hidden;
100
+ text-overflow: ellipsis;
101
+ }
102
+
103
+ /* Hide native date picker icons inside our date inputs (visual only) */
104
+ .daterange-inputs input[type=date]::-webkit-calendar-picker-indicator {
105
+ display: none;
106
+ }
107
+
108
+ .daterange-inputs input[type=date]::-webkit-clear-button {
109
+ display: none;
110
+ }
@@ -7,7 +7,7 @@ import { useMemo, useState } from 'react';
7
7
  import { DateRangeContent } from './date-range-content';
8
8
  import { parseYmdLocal, formatYmd, formatSiteYmd } from './datetime';
9
9
  import { formatLabel } from './utils';
10
- import './style.scss';
10
+ import './style.css';
11
11
  export function DateRangePicker({ start, end, onChange, gmtOffset, timezoneString, locale, disableFuture = true, disabledBefore, defaultFallbackPreset = 'last-7-days', hiddenPresets, inputsProps, }) {
12
12
  const isSmall = useMediaQuery('(max-width: 600px)');
13
13
  // Use a wider breakpoint to decide when two calendars can fit comfortably
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Colors
3
+ */
4
+ /**
5
+ * SCSS Variables.
6
+ *
7
+ * Please use variables from this sheet to ensure consistency across the UI.
8
+ * Don't add to this sheet unless you're pretty sure the value will be reused in many places.
9
+ * For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
10
+ */
11
+ /**
12
+ * Fonts & basic variables.
13
+ */
14
+ /**
15
+ * Typography
16
+ */
17
+ /**
18
+ * Grid System.
19
+ * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
20
+ */
21
+ /**
22
+ * Radius scale.
23
+ */
24
+ /**
25
+ * Elevation scale.
26
+ */
27
+ /**
28
+ * Dimensions.
29
+ */
30
+ /**
31
+ * Mobile specific styles
32
+ */
33
+ /**
34
+ * Editor styles.
35
+ */
36
+ /**
37
+ * Block & Editor UI.
38
+ */
39
+ /**
40
+ * Block paddings.
41
+ */
42
+ /**
43
+ * React Native specific.
44
+ * These variables do not appear to be used anywhere else.
45
+ */
46
+ /* Popover sizing */
47
+ .daterange-popover .components-popover__content {
48
+ overflow: visible;
49
+ width: auto;
50
+ max-width: calc(100vw - 48px);
51
+ }
52
+
53
+ /* Body rows */
54
+ .daterange-inputs {
55
+ margin-bottom: 12px;
56
+ }
57
+
58
+ .daterange-input__field.components-button {
59
+ background: var(--dashboard-surface__background-color, #fff);
60
+ padding: 4px 4px 4px 8px;
61
+ box-shadow: none;
62
+ border-radius: 2px;
63
+ border: 1px solid var(--dashboard-field__border-color, #949494);
64
+ }
65
+ .daterange-input__field svg {
66
+ color: var(--dashboard__text-color, #1e1e1e);
67
+ padding: 4px;
68
+ }
69
+ .daterange-input__text {
70
+ color: var(--dashboard__text-color, #1e1e1e);
71
+ padding: 0 4px;
72
+ }
73
+
74
+ /* Mobile */
75
+ @media (max-width: 600px) {
76
+ .daterange-calendar {
77
+ display: flex;
78
+ justify-content: center;
79
+ width: 100%;
80
+ }
81
+ }
82
+ /* Medium screens: presets and calendar should be centered with no awkward right margin */
83
+ @media (min-width: 601px) and (max-width: 899px) {
84
+ .daterange-body {
85
+ justify-content: space-between !important;
86
+ }
87
+ }
88
+ /* Desktop presets column: ensure a reasonable width to avoid awkward wrapping */
89
+ @media (min-width: 601px) {
90
+ .daterange-presets {
91
+ min-width: 240px;
92
+ }
93
+ }
94
+ /* Preset list items: keep buttons full-width and avoid awkward line wrapping */
95
+ .preset-listbox__item .components-button {
96
+ width: 100%;
97
+ justify-content: flex-start;
98
+ white-space: nowrap;
99
+ overflow: hidden;
100
+ text-overflow: ellipsis;
101
+ }
102
+
103
+ /* Hide native date picker icons inside our date inputs (visual only) */
104
+ .daterange-inputs input[type=date]::-webkit-calendar-picker-indicator {
105
+ display: none;
106
+ }
107
+
108
+ .daterange-inputs input[type=date]::-webkit-clear-button {
109
+ display: none;
110
+ }
@@ -1,38 +1,38 @@
1
1
  export type PresetId = 'today' | 'yesterday' | 'last-7-days' | 'last-30-days' | 'last-90-days' | 'month-to-date' | 'last-12-months' | 'year-to-date' | 'last-3-years' | 'custom';
2
2
  export declare const presetDefs: readonly [{
3
3
  readonly id: "today";
4
- readonly label: string;
4
+ readonly label: import("@wordpress/i18n").TransformedText<"Today">;
5
5
  }, {
6
6
  readonly id: "yesterday";
7
- readonly label: string;
7
+ readonly label: import("@wordpress/i18n").TransformedText<"Yesterday">;
8
8
  }, {
9
9
  readonly id: "last-7-days";
10
- readonly label: string;
10
+ readonly label: import("@wordpress/i18n").TransformedText<"Last 7 days">;
11
11
  }, {
12
12
  readonly id: "last-30-days";
13
- readonly label: string;
13
+ readonly label: import("@wordpress/i18n").TransformedText<"Last 30 days">;
14
14
  }, {
15
15
  readonly id: "last-90-days";
16
- readonly label: string;
16
+ readonly label: import("@wordpress/i18n").TransformedText<"Last 90 days">;
17
17
  }, {
18
18
  readonly id: "month-to-date";
19
- readonly label: string;
19
+ readonly label: import("@wordpress/i18n").TransformedText<"Month to date">;
20
20
  }, {
21
21
  readonly id: "last-12-months";
22
- readonly label: string;
22
+ readonly label: import("@wordpress/i18n").TransformedText<"Last 12 months">;
23
23
  }, {
24
24
  readonly id: "year-to-date";
25
- readonly label: string;
25
+ readonly label: import("@wordpress/i18n").TransformedText<"Year to date">;
26
26
  }, {
27
27
  readonly id: "last-3-years";
28
- readonly label: string;
28
+ readonly label: import("@wordpress/i18n").TransformedText<"Last 3 years">;
29
29
  }];
30
30
  export declare function computePresetRange(preset: PresetId, baseDate: Date): {
31
31
  from: Date;
32
32
  to: Date;
33
33
  } | undefined;
34
34
  export declare function getActivePresetId(from?: Date, to?: Date, baseDate?: Date): PresetId | undefined;
35
- export declare function formatLabel(start: Date, end: Date, locale: string): string;
35
+ export declare function formatLabel(start: Date, end: Date, locale: string): import("@wordpress/i18n").TransformedText<"%1$s to %2$s">;
36
36
  export declare function isLast7Days(range: {
37
37
  start: Date;
38
38
  end: Date;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAkCA,MAAM,MAAM,QAAQ,GACjB,OAAO,GACP,WAAW,GACX,aAAa,GACb,cAAc,GACd,cAAc,GACd,eAAe,GACf,gBAAgB,GAChB,cAAc,GACd,cAAc,GACd,QAAQ,CAAC;AAEZ,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUmE,CAAC;AAE3F,wBAAgB,kBAAkB,CAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI;;;cA0BnE;AAED,wBAAgB,iBAAiB,CAAE,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAI,QAAQ,GAAG,SAAS,CAiEjG;AAGD,wBAAgB,WAAW,CAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,UAOlE;AAGD,wBAAgB,WAAW,CAC1B,KAAK,EAAE;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,GAAG,EAAE,IAAI,CAAA;CAAE,EACjC,cAAc,CAAC,EAAE,MAAM,EACvB,SAAS,CAAC,EAAE,MAAM,GAChB,OAAO,CAKT"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAkCA,MAAM,MAAM,QAAQ,GACjB,OAAO,GACP,WAAW,GACX,aAAa,GACb,cAAc,GACd,cAAc,GACd,eAAe,GACf,gBAAgB,GAChB,cAAc,GACd,cAAc,GACd,QAAQ,CAAC;AAEZ,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUmE,CAAC;AAE3F,wBAAgB,kBAAkB,CAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI;;;cA0BnE;AAED,wBAAgB,iBAAiB,CAAE,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAI,QAAQ,GAAG,SAAS,CAiEjG;AAGD,wBAAgB,WAAW,CAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,6DAOlE;AAGD,wBAAgB,WAAW,CAC1B,KAAK,EAAE;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,GAAG,EAAE,IAAI,CAAA;CAAE,EACjC,cAAc,CAAC,EAAE,MAAM,EACvB,SAAS,CAAC,EAAE,MAAM,GAChB,OAAO,CAKT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/date-range-picker",
3
- "version": "1.0.1",
3
+ "version": "1.0.4",
4
4
  "description": "A date-range picker built on top of @automattic/ui's DateRangeCalendar, with timezone-aware site-day handling, preset shortcuts, and accessible inputs.",
5
5
  "homepage": "https://github.com/Automattic/wp-calypso",
6
6
  "license": "GPL-2.0-or-later",
@@ -34,41 +34,70 @@
34
34
  "bugs": "https://github.com/Automattic/wp-calypso/issues",
35
35
  "files": [
36
36
  "dist",
37
- "src"
37
+ "src",
38
+ "!dist/**/*.tsbuildinfo",
39
+ "!src/test"
38
40
  ],
39
41
  "types": "dist/types",
40
42
  "scripts": {
41
43
  "clean": "tsc --build ./tsconfig.json ./tsconfig-cjs.json --clean && rm -rf dist",
42
- "build": "tsc --build ./tsconfig.json ./tsconfig-cjs.json && copy-assets",
44
+ "build": "tsc --build ./tsconfig.json ./tsconfig-cjs.json && node ./bin/build-styles.js",
43
45
  "prepack": "yarn run clean && yarn run build"
44
46
  },
45
47
  "dependencies": {
46
- "@automattic/ui": "^1.0.2",
47
- "@wordpress/base-styles": "^5.23.0",
48
- "@wordpress/components": "^32.1.0",
49
- "@wordpress/compose": "7.23.0",
50
- "@wordpress/date": "5.23.0",
51
- "@wordpress/i18n": "^5.23.0",
52
- "@wordpress/icons": "^10.23.0",
53
- "date-fns": "^4.1.0",
54
- "tslib": "^2.8.1"
48
+ "@automattic/ui": "^1.0.3",
49
+ "date-fns": "^4.1.0"
55
50
  },
56
51
  "peerDependencies": {
57
- "react": "^18.3.1",
58
- "react-dom": "^18.3.1"
52
+ "@wordpress/components": ">=35.0.0",
53
+ "@wordpress/compose": ">=8.1.0",
54
+ "@wordpress/date": ">=5.48.0",
55
+ "@wordpress/i18n": ">=6.21.0",
56
+ "@wordpress/icons": ">=13.3.0",
57
+ "react": "^18.3.1 || ^19.0.0",
58
+ "react-dom": "^18.3.1 || ^19.0.0"
59
+ },
60
+ "peerDependenciesMeta": {
61
+ "@wordpress/components": {
62
+ "optional": false
63
+ },
64
+ "@wordpress/compose": {
65
+ "optional": false
66
+ },
67
+ "@wordpress/date": {
68
+ "optional": false
69
+ },
70
+ "@wordpress/i18n": {
71
+ "optional": false
72
+ },
73
+ "@wordpress/icons": {
74
+ "optional": false
75
+ },
76
+ "react": {
77
+ "optional": false
78
+ },
79
+ "react-dom": {
80
+ "optional": false
81
+ }
59
82
  },
60
83
  "devDependencies": {
61
- "@automattic/calypso-build": "^11.0.0",
62
84
  "@automattic/calypso-typescript-config": "^1.0.0",
63
85
  "@testing-library/dom": "^10.4.1",
64
86
  "@testing-library/jest-dom": "^6.9.1",
65
- "@testing-library/react": "^16.3.0",
87
+ "@testing-library/react": "^16.3.2",
66
88
  "@testing-library/user-event": "^14.6.1",
67
89
  "@types/react": "^18.3.18",
90
+ "@wordpress/base-styles": "^9.1.0",
91
+ "@wordpress/components": "^35.0.0",
92
+ "@wordpress/compose": "patch:@wordpress/compose@npm%3A8.1.0#~/.yarn/patches/@wordpress-compose-npm-8.1.0-ea108e3129.patch",
93
+ "@wordpress/date": "5.48.0",
94
+ "@wordpress/i18n": "^6.21.0",
95
+ "@wordpress/icons": "^13.3.0",
68
96
  "jest": "^29.7.0",
69
97
  "mockdate": "^2.0.5",
70
98
  "postcss": "^8.5.3",
71
- "typescript": "^5.8.3",
99
+ "sass": "1.77.8",
100
+ "typescript": "^6.0.3",
72
101
  "webpack": "^5.99.8"
73
102
  }
74
103
  }
package/src/style.scss CHANGED
@@ -1,3 +1,6 @@
1
+ @use "@wordpress/base-styles/colors" as colors;
2
+ @use "@wordpress/base-styles/variables" as v;
3
+
1
4
  /* Popover sizing */
2
5
  .daterange-popover .components-popover__content {
3
6
  overflow: visible;
@@ -14,20 +17,20 @@
14
17
  &__field {
15
18
  // The extra class is to make sure it overrides the default button styles
16
19
  &.components-button {
17
- background: var( --dashboard-surface__background-color );
18
- padding: $grid-unit-05 $grid-unit-05 $grid-unit-05 $grid-unit-10;
20
+ background: var(--dashboard-surface__background-color, #fff);
21
+ padding: v.$grid-unit-05 v.$grid-unit-05 v.$grid-unit-05 v.$grid-unit-10;
19
22
  box-shadow: none;
20
- border-radius: $radius-small;
21
- border: 1px solid var(--dashboard-field__border-color, $gray-600);
23
+ border-radius: v.$radius-small;
24
+ border: 1px solid var(--dashboard-field__border-color, #{colors.$gray-600});
22
25
  }
23
26
  svg {
24
- color: var(--dashboard__text-color);
25
- padding: $grid-unit-05;
27
+ color: var(--dashboard__text-color, #{colors.$gray-900});
28
+ padding: v.$grid-unit-05;
26
29
  }
27
30
  }
28
31
  &__text {
29
- color: var(--dashboard__text-color);
30
- padding: 0 $grid-unit-05;
32
+ color: var(--dashboard__text-color, #{colors.$gray-900});
33
+ padding: 0 v.$grid-unit-05;
31
34
  }
32
35
  }
33
36
 
package/src/types.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  declare module '*.scss';
2
+ declare module '*.css';
@@ -1,72 +0,0 @@
1
- /* Popover sizing */
2
- .daterange-popover .components-popover__content {
3
- overflow: visible;
4
- width: auto;
5
- max-width: calc( 100vw - 48px );
6
- }
7
-
8
- /* Body rows */
9
- .daterange-inputs {
10
- margin-bottom: 12px;
11
- }
12
-
13
- .daterange-input {
14
- &__field {
15
- // The extra class is to make sure it overrides the default button styles
16
- &.components-button {
17
- background: var( --dashboard-surface__background-color );
18
- padding: $grid-unit-05 $grid-unit-05 $grid-unit-05 $grid-unit-10;
19
- box-shadow: none;
20
- border-radius: $radius-small;
21
- border: 1px solid var(--dashboard-field__border-color, $gray-600);
22
- }
23
- svg {
24
- color: var(--dashboard__text-color);
25
- padding: $grid-unit-05;
26
- }
27
- }
28
- &__text {
29
- color: var(--dashboard__text-color);
30
- padding: 0 $grid-unit-05;
31
- }
32
- }
33
-
34
- /* Mobile */
35
- @media ( max-width: 600px ) {
36
- .daterange-calendar {
37
- display: flex;
38
- justify-content: center;
39
- width: 100%;
40
- }
41
- }
42
-
43
- /* Medium screens: presets and calendar should be centered with no awkward right margin */
44
- @media ( min-width: 601px ) and ( max-width: 899px ) {
45
- .daterange-body {
46
- justify-content: space-between !important;
47
- }
48
- }
49
-
50
- /* Desktop presets column: ensure a reasonable width to avoid awkward wrapping */
51
- @media ( min-width: 601px ) {
52
- .daterange-presets {
53
- min-width: 240px;
54
- }
55
- }
56
-
57
- /* Preset list items: keep buttons full-width and avoid awkward line wrapping */
58
- .preset-listbox__item .components-button {
59
- width: 100%;
60
- justify-content: flex-start;
61
- white-space: nowrap;
62
- overflow: hidden;
63
- text-overflow: ellipsis;
64
- }
65
-
66
- /* Hide native date picker icons inside our date inputs (visual only) */
67
- .daterange-inputs input[type='date']::-webkit-calendar-picker-indicator {
68
- display: none;
69
- }
70
- .daterange-inputs input[type='date']::-webkit-clear-button {
71
- display: none;
72
- }
@@ -1,72 +0,0 @@
1
- /* Popover sizing */
2
- .daterange-popover .components-popover__content {
3
- overflow: visible;
4
- width: auto;
5
- max-width: calc( 100vw - 48px );
6
- }
7
-
8
- /* Body rows */
9
- .daterange-inputs {
10
- margin-bottom: 12px;
11
- }
12
-
13
- .daterange-input {
14
- &__field {
15
- // The extra class is to make sure it overrides the default button styles
16
- &.components-button {
17
- background: var( --dashboard-surface__background-color );
18
- padding: $grid-unit-05 $grid-unit-05 $grid-unit-05 $grid-unit-10;
19
- box-shadow: none;
20
- border-radius: $radius-small;
21
- border: 1px solid var(--dashboard-field__border-color, $gray-600);
22
- }
23
- svg {
24
- color: var(--dashboard__text-color);
25
- padding: $grid-unit-05;
26
- }
27
- }
28
- &__text {
29
- color: var(--dashboard__text-color);
30
- padding: 0 $grid-unit-05;
31
- }
32
- }
33
-
34
- /* Mobile */
35
- @media ( max-width: 600px ) {
36
- .daterange-calendar {
37
- display: flex;
38
- justify-content: center;
39
- width: 100%;
40
- }
41
- }
42
-
43
- /* Medium screens: presets and calendar should be centered with no awkward right margin */
44
- @media ( min-width: 601px ) and ( max-width: 899px ) {
45
- .daterange-body {
46
- justify-content: space-between !important;
47
- }
48
- }
49
-
50
- /* Desktop presets column: ensure a reasonable width to avoid awkward wrapping */
51
- @media ( min-width: 601px ) {
52
- .daterange-presets {
53
- min-width: 240px;
54
- }
55
- }
56
-
57
- /* Preset list items: keep buttons full-width and avoid awkward line wrapping */
58
- .preset-listbox__item .components-button {
59
- width: 100%;
60
- justify-content: flex-start;
61
- white-space: nowrap;
62
- overflow: hidden;
63
- text-overflow: ellipsis;
64
- }
65
-
66
- /* Hide native date picker icons inside our date inputs (visual only) */
67
- .daterange-inputs input[type='date']::-webkit-calendar-picker-indicator {
68
- display: none;
69
- }
70
- .daterange-inputs input[type='date']::-webkit-clear-button {
71
- display: none;
72
- }