Skip to content

Commit

Permalink
Merge branch 'main' into chore/gh-workflow-cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kennylam authored Feb 14, 2024
2 parents 20ae59b + bd356ad commit 9085d39
Show file tree
Hide file tree
Showing 35 changed files with 298 additions and 478 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ Here's a quick example to get you started.

### JS (via import)

Note that, please always use the latest version.

```javascript
import '@carbon/ibmdotcom-web-components/es/components/notice-choice/index.js';
```
Expand All @@ -40,9 +38,8 @@ import '@carbon/ibmdotcom-web-components/es/components/notice-choice/index.js';
question-choices="1,2"
state="CA"
terms-condition-link=""
bpid-legal-text=""
enable-all-opt-in=""
default-values="">
hide-error-message="false"
enable-all-opt-in="">
</c4d-notice-choice>
```

Expand All @@ -60,7 +57,14 @@ document.addEventListener('cds-notice-choice-change', (event) => {

## Props

<Props of="c4d-notice-choice" />
| Name | Description | Default |
| -------------------- | ------------------------------------------------------------------------------------------- | ------- |
| question-choices | Set to "1" if Email only. Set to "1, 2" if Email and Phone | 1 |
| country | Country code based on the customer country | US |
| state | State code based on the customer state | |
| language | form based on the country and language | en |
| terms-condition-link | Terms and conditions link appended to the end of the privacy statement - should be specific | |
| hide-error-message | Hide Error Messages for PUNS statement | false |

## Stable selectors

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,37 +49,70 @@ const countryList = {
India: 'IN',
China: 'CN',
Japan: 'JP',
'Korea, Republic of': 'KR',
};
const stateList = {
Unknown: '',
Alabama: 'AL',
California: 'CA',
US: {
Unknown: '',
Alabama: 'AL',
California: 'CA',
},
IN: {
Unknown: '',
Karnataka: 'KA',
Delhi: 'DL',
},
CN: {
Unknown: '',
'Beijing Shi': 'BJ',
'Hong Kong': 'HK',
},
JP: {
Unknown: '',
Kyoto: '26',
Mie: '27',
},
KR: {
Unknown: '',
Sejong: '50',
'Daegu-gwangyeoksi': '27',
},
DE: {
Unknown: '',
Hamburg: 'HU',
Sachsen: 'SN',
},
};
const hideErrorMessages = {
true: 'true',
false: 'false',
};
const showLegalNotices = {
true: 'true',
false: 'false',
};
const onChange = (event: CustomEvent) => {
console.log(event.detail);
};
const props = () => ({
language: select('Language', languages, 'en'),
country: select('Country', countryList, 'US'),
state: select('State', stateList, ''),
questionchoices: select('Question Choices', questionChoices, '1,2'),
termsConditionLink: text(
'Terms & Condition Link',
'https://www.ibm.com/legal'
),
bpidLegalText: text('BPID Legal Text', ''),
onChange: action('c4d-notice-choice-change'),
hideErrorMessages: select('Hide Error Messages', hideErrorMessages, 'false'),
showLegalNotice: select('Show Legal Notice', showLegalNotices, 'true'),
});
const props = () => {
const selectedCountry = select('Country', countryList, 'US');
let availableStates = stateList[selectedCountry] || [{ Unknown: '' }];

return {
language: select('Language', languages, 'en'),
country: selectedCountry,
state: select('State', availableStates, ''),
questionchoices: select('Question Choices', questionChoices, '1,2'),
termsConditionLink: text(
'Terms & Condition Link',
'https://www.ibm.com/legal'
),
onChange: action('c4d-notice-choice-change'),
hideErrorMessages: select(
'Hide Error Messages',
hideErrorMessages,
'false'
),
};
};

console.log(props);

export const Default = (args) => {
const {
Expand All @@ -89,9 +122,7 @@ export const Default = (args) => {
termsConditionLink,
questionchoices,
hideErrorMessages,
showLegalNotice,
enableAllOptIn,
bpidLegalText,
hiddenEmail,
hiddenPhone,
ncTeleDetail,
Expand All @@ -105,9 +136,7 @@ export const Default = (args) => {
state="${state}"
terms-condition-link="${termsConditionLink || ''}"
hide-error-message="${hideErrorMessages}"
show-legal-notice=${showLegalNotice}
?enable-all-opt-in=${enableAllOptIn}
bpid-legal-text="${bpidLegalText}"
.hiddenEmail="${hiddenEmail}"
.hiddenPhone="${hiddenPhone}"
.nc-tele-detail="${ncTeleDetail}"
Expand Down
20 changes: 0 additions & 20 deletions packages/web-components/src/components/notice-choice/cc-lc-map.ts

This file was deleted.

Loading

0 comments on commit 9085d39

Please sign in to comment.