@opengovsg/oui 0.0.19 → 0.0.20

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.
@@ -43,6 +43,9 @@ const Banner = ({
43
43
  if (startContentProp) {
44
44
  return startContentProp;
45
45
  }
46
+ if (startContentProp === null) {
47
+ return null;
48
+ }
46
49
  switch (variant) {
47
50
  case "info":
48
51
  return /* @__PURE__ */ jsxRuntime.jsx(info.default, { className: styles.icon({ className: classNames?.icon }) });
@@ -58,7 +61,9 @@ const Banner = ({
58
61
  }, [classNames?.icon, startContentProp, styles, variant]);
59
62
  const bannerRef = $670gB$react.useRef(null);
60
63
  const state = reactStately.useDisclosureState({
61
- defaultExpanded
64
+ defaultExpanded,
65
+ isExpanded: disclosureProps.isExpanded,
66
+ onExpandedChange: disclosureProps.onExpandedChange
62
67
  });
63
68
  const { buttonProps, panelProps: bannerProps } = reactAria.useDisclosure(
64
69
  disclosureProps,
@@ -76,7 +81,7 @@ const Banner = ({
76
81
  ...isDismissable ? bannerProps : {},
77
82
  children: [
78
83
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.content({ className: classNames?.content }), children: [
79
- /* @__PURE__ */ jsxRuntime.jsx(
84
+ startContent && /* @__PURE__ */ jsxRuntime.jsx(
80
85
  "div",
81
86
  {
82
87
  className: styles.startContentWrapper({
@@ -23,6 +23,7 @@ var tagFieldItem = require('./tag-field/tag-field-item.cjs');
23
23
  var select = require('./select/select.cjs');
24
24
  var selectItem = require('./select/select-item.cjs');
25
25
  var selectVariantContext = require('./select/select-variant-context.cjs');
26
+ var badge = require('./badge/badge.cjs');
26
27
  var calendar = require('./calendar/calendar.cjs');
27
28
  var calendarStyleContext = require('./calendar/calendar-style-context.cjs');
28
29
  var utils = require('./calendar/utils.cjs');
@@ -43,7 +44,6 @@ var usePagination = require('./pagination/hooks/use-pagination.cjs');
43
44
  var usePagination$1 = require('./pagination/use-pagination.cjs');
44
45
  var button = require('./button/button.cjs');
45
46
  var banner = require('./banner/banner.cjs');
46
- var badge = require('./badge/badge.cjs');
47
47
 
48
48
 
49
49
 
@@ -75,6 +75,7 @@ exports.Select = select.Select;
75
75
  exports.SelectItem = selectItem.SelectItem;
76
76
  exports.SelectVariantContext = selectVariantContext.SelectVariantContext;
77
77
  exports.useSelectVariantContext = selectVariantContext.useSelectVariantContext;
78
+ exports.Badge = badge.Badge;
78
79
  exports.Calendar = calendar.Calendar;
79
80
  exports.CalendarStateWrapper = calendar.CalendarStateWrapper;
80
81
  exports.CalendarStyleContext = calendarStyleContext.CalendarStyleContext;
@@ -121,4 +122,3 @@ exports.CURSOR_TRANSITION_TIMEOUT = usePagination$1.CURSOR_TRANSITION_TIMEOUT;
121
122
  exports.usePagination = usePagination$1.usePagination;
122
123
  exports.Button = button.Button;
123
124
  exports.Banner = banner.Banner;
124
- exports.Badge = badge.Badge;
@@ -41,6 +41,9 @@ const Banner = ({
41
41
  if (startContentProp) {
42
42
  return startContentProp;
43
43
  }
44
+ if (startContentProp === null) {
45
+ return null;
46
+ }
44
47
  switch (variant) {
45
48
  case "info":
46
49
  return /* @__PURE__ */ jsx(Info, { className: styles.icon({ className: classNames?.icon }) });
@@ -56,7 +59,9 @@ const Banner = ({
56
59
  }, [classNames?.icon, startContentProp, styles, variant]);
57
60
  const bannerRef = useRef(null);
58
61
  const state = useDisclosureState({
59
- defaultExpanded
62
+ defaultExpanded,
63
+ isExpanded: disclosureProps.isExpanded,
64
+ onExpandedChange: disclosureProps.onExpandedChange
60
65
  });
61
66
  const { buttonProps, panelProps: bannerProps } = useDisclosure(
62
67
  disclosureProps,
@@ -74,7 +79,7 @@ const Banner = ({
74
79
  ...isDismissable ? bannerProps : {},
75
80
  children: [
76
81
  /* @__PURE__ */ jsxs("div", { className: styles.content({ className: classNames?.content }), children: [
77
- /* @__PURE__ */ jsx(
82
+ startContent && /* @__PURE__ */ jsx(
78
83
  "div",
79
84
  {
80
85
  className: styles.startContentWrapper({
package/dist/esm/index.js CHANGED
@@ -21,6 +21,7 @@ export { TagFieldItem } from './tag-field/tag-field-item.js';
21
21
  export { Select } from './select/select.js';
22
22
  export { SelectItem } from './select/select-item.js';
23
23
  export { SelectVariantContext, useSelectVariantContext } from './select/select-variant-context.js';
24
+ export { Badge } from './badge/badge.js';
24
25
  export { Calendar, CalendarStateWrapper } from './calendar/calendar.js';
25
26
  export { CalendarStyleContext, useCalendarStyleContext } from './calendar/calendar-style-context.js';
26
27
  export { getEraFormat, useGenerateLocalizedMonths, useGenerateLocalizedYears, useLocalizedMonthYear } from './calendar/utils.js';
@@ -41,4 +42,3 @@ export { PaginationItemType } from './pagination/hooks/use-pagination.js';
41
42
  export { CURSOR_TRANSITION_TIMEOUT, usePagination } from './pagination/use-pagination.js';
42
43
  export { Button } from './button/button.js';
43
44
  export { Banner } from './banner/banner.js';
44
- export { Badge } from './badge/badge.js';
@@ -6,7 +6,7 @@ interface BannerProps extends VariantProps<typeof bannerStyles>, AriaDisclosureP
6
6
  /**
7
7
  * The banner start content. Will default to the relevant icons based on the `variant` prop.
8
8
  */
9
- startContent?: React.ReactNode;
9
+ startContent?: React.ReactNode | null;
10
10
  children: ReactNode;
11
11
  /**
12
12
  * If provided, the dismiss button will be rendered.
@@ -1 +1 @@
1
- {"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../../../src/banner/banner.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,mBAAmB,EAAoB,MAAM,YAAY,CAAA;AAMvE,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACd,YAAY,EACb,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAInD,UAAU,WACR,SAAQ,YAAY,CAAC,OAAO,YAAY,CAAC,EACvC,mBAAmB;IACrB;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC9B,QAAQ,EAAE,SAAS,CAAA;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,CAAA;CACzC;AAiBD,eAAO,MAAM,MAAM,2IAUhB,WAAW,mDA6Eb,CAAA"}
1
+ {"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../../../src/banner/banner.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,mBAAmB,EAAoB,MAAM,YAAY,CAAA;AAMvE,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACd,YAAY,EACb,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAInD,UAAU,WACR,SAAQ,YAAY,CAAC,OAAO,YAAY,CAAC,EACvC,mBAAmB;IACrB;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,IAAI,CAAA;IACrC,QAAQ,EAAE,SAAS,CAAA;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,CAAA;CACzC;AAiBD,eAAO,MAAM,MAAM,2IAUhB,WAAW,mDAsFb,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengovsg/oui",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "sideEffects": false,
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "type": "module",
@@ -49,9 +49,9 @@
49
49
  "storybook": "9.1.6",
50
50
  "tsx": "^4.20.3",
51
51
  "typescript": "5.7.3",
52
- "@opengovsg/oui-theme": "0.0.19",
53
- "@oui/chromatic": "0.0.0",
54
52
  "@oui/eslint-config": "0.0.0",
53
+ "@oui/chromatic": "0.0.0",
54
+ "@opengovsg/oui-theme": "0.0.20",
55
55
  "@oui/prettier-config": "0.0.0",
56
56
  "@oui/typescript-config": "0.0.0"
57
57
  },
@@ -83,7 +83,7 @@
83
83
  "motion": ">=11.12.0 || >=12.0.0-alpha.1",
84
84
  "react": ">= 18",
85
85
  "react-aria-components": "^1.12.2",
86
- "@opengovsg/oui-theme": "0.0.19"
86
+ "@opengovsg/oui-theme": "0.0.20"
87
87
  },
88
88
  "scripts": {
89
89
  "build": "tsx ../../tooling/build-scripts/main.ts --dts --clean",